Package ca.spatial.mapview
Class GeoRelLayer
- All Implemented Interfaces:
EventListener
,TableModelListener
-
Constructor Summary
ConstructorsConstructorDescriptionGeoRelLayer(GeoRelationalStore store, ChoroplethTheme theme)
Deprecated.GeoRelLayer(GeoRelationalStore store, ChoroplethTheme theme, double minScale, double maxScale)
Deprecated.GeoRelLayer(GeoRelationalStore store, ChoroplethTheme theme, String fieldname)
Set up the layer by joining a source data table, a theme, and a column specification. -
Method Summary
Modifier and TypeMethodDescriptionboolean
addMenuItems(JPopupMenu jpm, Layer l, double x, double y)
clone()
void
close()
void
boolean
boolean
double[]
getHistogram(Window owner, AttributeStore store, Expression expr, int period, double min, double max)
int
Get the width of the damage repaint area that is used during feature update events.boolean
Return the currect setting of the show legend items parameterdouble[]
getStats(Window owner, AttributeStore store, Expression expr, int period)
getTable()
getTheme()
Get the theme that this layer is set toint
getType()
Object[]
getUniqueValues(Window owner, AttributeStore store, Expression expr, int period)
boolean
Check if this theme uses a selection contextvoid
identifyRecords(Extent2D box)
void
maybePopup(MouseEvent e, double x, double y, double fuzz, int period)
boolean
paintLayer(Extent2D extent, AffineTransform af, double scale)
Draw the thematic data for this geographic layer on to the backing store.void
print(Graphics2D g1, Extent2D extent, double scale, AffineTransform af, int dpi, LayerPrintCallback callback)
Print the contents of the layer on to the GraphicsPrintervoid
processRecords(Extent2D box, RecordHandler handler)
void
Reset the selection context in the layer By default nothing happens.void
selectRecords(Extent2D box, boolean add)
void
setConnected(boolean state)
Connect the layer to the data source by adding a listener.void
setDisconnectWhenInvisible(boolean state)
Disconnnect the listener when the layer is not visible.setFeatureProperties(ArrayList<DBFColumnSpec> featureProperties)
Set a list of properties definitions, potentially useful in printing contexts that know what to do with them.void
setFieldname(String fieldname)
boolean
setPeriod(int period)
Set the planning period that this layer refers to.setRepaintWidth(int width)
This parameter sets the number of pixels of damage that should be repainted around each feature during an update operation.setTheme(ChoroplethTheme theme)
Set the theme for this layersetTheme(ChoroplethTheme theme, String fieldname)
void
setVisible(boolean visible)
void
Listen to changes in the attribute store data This interface only supports update events.Methods inherited from class ca.spatial.mapview.Layer
free, getAnnotations, getDPI, getFeatureProperties, getFeatureType, getIndex, getPeriod, getScale, getShowLegend, getTitle, getVector, isSelected, isVisible, needsRedraw, needsRefresh, refreshLayer, resize, setAnnotations, setAnnotations, setDPI, setParent, setRedraw, setRefresh, setSelected, setShowLegend, setShowLegendItems, setTitle, setVector
-
Constructor Details
-
GeoRelLayer
public GeoRelLayer(GeoRelationalStore store, ChoroplethTheme theme, String fieldname) throws ExceptionSet up the layer by joining a source data table, a theme, and a column specification. This will join the data source with the theme definition. The fieldname parameter is an expression that will be evaluated to determine the classification of each feature. The classification value will be used to lookup up the symbol to use from the theme.- Parameters:
store
- the GeoRelational data souretheme
- the thematic defintionfieldname
- the attribute field expression used to classify the features- Throws:
Exception
-
GeoRelLayer
Deprecated.This is the legacy constructor. It is the equivalent ofnew GeoRelLayer(store, theme, theme.getFieldName());
Use the #GeoRelLayer(GeoRelationalStore, ChoroplethTheme, String) consructor instead.- Throws:
Exception
-
GeoRelLayer
@Deprecated public GeoRelLayer(GeoRelationalStore store, ChoroplethTheme theme, double minScale, double maxScale) throws ExceptionDeprecated.Constructor to create a layer and set some theme properties. The preferred method to do this would be to set the theme properies directly on to the theme object.Use the #GeoRelLayer(GeoRelationalStore, ChoroplethTheme, String) consructor instead.
- Throws:
Exception
-
-
Method Details
-
clone
- Specified by:
clone
in classLayer<ChoroplethTheme>
-
close
public void close()- Overrides:
close
in classLayer<ChoroplethTheme>
-
getFieldname
-
setFieldname
-
getTable
- Specified by:
getTable
in classLayer<ChoroplethTheme>
-
doTableSnapshot
- Specified by:
doTableSnapshot
in classLayer<ChoroplethTheme>
- Throws:
Exception
-
setVisible
public void setVisible(boolean visible)- Overrides:
setVisible
in classLayer<ChoroplethTheme>
-
setConnected
public void setConnected(boolean state)Description copied from class:Layer
Connect the layer to the data source by adding a listener. The default value is true (connected).- Specified by:
setConnected
in classLayer<ChoroplethTheme>
-
getConnected
public boolean getConnected()- Specified by:
getConnected
in classLayer<ChoroplethTheme>
-
setDisconnectWhenInvisible
public void setDisconnectWhenInvisible(boolean state)Disconnnect the listener when the layer is not visible. This will increase performance for busy layers such as the route layer that have thousands of updates per second. Unfortunately, it will cause the backing store to forget that updates have occured, so set a flag to repaint the entire layer (perhaps unnecessarily) when the layer regains visibility.Caution: This method should only be used before the layer is made visible.
-
getDisconnectWhenInvisible
public boolean getDisconnectWhenInvisible() -
setTheme
-
setTheme
Description copied from class:Layer
Set the theme for this layer- Specified by:
setTheme
in classLayer<ChoroplethTheme>
-
getTheme
Description copied from class:Layer
Get the theme that this layer is set to- Overrides:
getTheme
in classLayer<ChoroplethTheme>
-
setPeriod
public boolean setPeriod(int period)Description copied from class:Layer
Set the planning period that this layer refers to. If the layer is not capable of displaying multiple periods this method will return false.- Overrides:
setPeriod
in classLayer<ChoroplethTheme>
-
maybePopup
- Specified by:
maybePopup
in classLayer<ChoroplethTheme>
-
selectRecords
- Specified by:
selectRecords
in classLayer<ChoroplethTheme>
-
identifyRecords
- Specified by:
identifyRecords
in classLayer<ChoroplethTheme>
-
processRecords
- Specified by:
processRecords
in classLayer<ChoroplethTheme>
-
getSelectedExtent
- Specified by:
getSelectedExtent
in classLayer<ChoroplethTheme>
-
getExtent2D
- Specified by:
getExtent2D
in classLayer<ChoroplethTheme>
-
getType
public int getType()- Specified by:
getType
in classLayer<ChoroplethTheme>
-
getShowLegendItems
public boolean getShowLegendItems()Description copied from class:Layer
Return the currect setting of the show legend items parameter- Overrides:
getShowLegendItems
in classLayer<ChoroplethTheme>
-
getUniqueValues
- Specified by:
getUniqueValues
in classLayer<ChoroplethTheme>
-
getStats
- Specified by:
getStats
in classLayer<ChoroplethTheme>
-
getHistogram
public double[] getHistogram(Window owner, AttributeStore store, Expression expr, int period, double min, double max) throws Exception- Specified by:
getHistogram
in classLayer<ChoroplethTheme>
- Throws:
Exception
-
addMenuItems
-
getRepaintWidth
public int getRepaintWidth()Get the width of the damage repaint area that is used during feature update events. -
setRepaintWidth
This parameter sets the number of pixels of damage that should be repainted around each feature during an update operation. The default value is 0. When specified with a positive number the update operation will clear the backing store near the updated feature, and then draw all features within distance. This will help to repair drawing artifacts caused overlapping symbology. Although this update mechanism is quite fast, it can cause slowdowns to the modeling system when called thousands of times per second.- Parameters:
width
- The number of pixels of area around the update feature that should be erased and redrawn.
-
getThemeList
- Overrides:
getThemeList
in classLayer<ChoroplethTheme>
-
resetSelectionContext
public void resetSelectionContext()Description copied from class:Layer
Reset the selection context in the layer By default nothing happens. Override in layers that have tables- Overrides:
resetSelectionContext
in classLayer<ChoroplethTheme>
-
hasSelectionContext
public boolean hasSelectionContext()Description copied from class:Layer
Check if this theme uses a selection context- Overrides:
hasSelectionContext
in classLayer<ChoroplethTheme>
-
setFeatureProperties
Set a list of properties definitions, potentially useful in printing contexts that know what to do with them. For example, the PDF output in the MapLayoutReport will format these properties as linked object data.- Overrides:
setFeatureProperties
in classLayer<ChoroplethTheme>
- Parameters:
featureProperties
- a list of column specifications.
-
paintLayer
Draw the thematic data for this geographic layer on to the backing store.In general, the process to follow is to set up a loop to retrieve features from the store, retreive their symbology, and then render. Each time through the loop test to see if the drawing has been interrupted.
Only the backing store is drawn by this method. The actual drawing on to the screen is handled solely by the refresh and update methods.
- Specified by:
paintLayer
in classLayer<ChoroplethTheme>
- Parameters:
extent
- The geographic extent to be drawn.af
- The affine transform needed to map from geographic to screen coordinates.scale
- the page to screen scale denominator (needed for scale thresholding).
-
print
public void print(Graphics2D g1, Extent2D extent, double scale, AffineTransform af, int dpi, LayerPrintCallback callback)Print the contents of the layer on to the GraphicsPrinter- Specified by:
print
in classLayer<ChoroplethTheme>
-
tableChanged
Listen to changes in the attribute store data This interface only supports update events. Record insertion and deletion events are prohibited.- Specified by:
tableChanged
in interfaceTableModelListener
-