Package ca.spatial.mapview
Class Layer<T extends Theme>
java.lang.Object
ca.spatial.mapview.Layer<T>
- Direct Known Subclasses:
GeoRelLayer
,ImageLayer
This class represents a layer that is to be drawn in a map viewer.
This is an abstract base class that describes methods that
all specialized classes must implement.
In general, all Layer objects are composed of two parts:
- a geographic data source; and
- a description of how the data should be rendered.
GeoRelLayers are used to represent vector feature data. ImageLayers represent color imagery data such as georectified photography. Raster grid data Layers are also available.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Object
clone()
void
close()
abstract void
void
free()
Temporarily release resources used by this layer.Get the list of annotations for this layer.abstract boolean
int
getDPI()
Get the DPI to be used for printing.abstract Extent2D
Return a list of properties definitions, potentially useful in printing contexts that know what to do with them.int
abstract double[]
getHistogram(Window owner, AttributeStore store, Expression expr, int period, double min, double max)
int
getIndex()
int
Get the period for this layerdouble
getScale()
Get the scale factor for this layerabstract Extent2D
boolean
Return the currect setting of the show legend parameterboolean
Return the currect setting of the show legend items parameterabstract double[]
getStats(Window owner, AttributeStore store, Expression expr, int period)
abstract AttributeStore
getTable()
getTheme()
Get the theme that this layer is set togetTitle()
Get the title of the map layerabstract int
getType()
abstract Object[]
getUniqueValues(Window owner, AttributeStore store, Expression expr, int period)
boolean
boolean
Check if this theme uses a selection contextabstract void
identifyRecords(Extent2D box)
boolean
Test if this layer is selectedboolean
Return true or false indicating if the layer is visible or notabstract void
maybePopup(MouseEvent e, double x, double y, double fuzz, int period)
boolean
Check if the layer needs to be redrawn.boolean
Check if the layer requires refreshing.abstract boolean
paintLayer(Extent2D extent, AffineTransform af, double scale)
abstract void
print(Graphics2D g1, Extent2D extent, double scale, AffineTransform af, int dpi, LayerPrintCallback callback)
abstract void
processRecords(Extent2D box, RecordHandler handler)
boolean
refreshLayer(Graphics2D g1, double scale)
Refresh the contents of this layer onto the screen graphics and the backing store.void
Reset the selection context in the layer By default nothing happens.void
resize(int width, int height)
Set the size of the backing store used by this layer.abstract void
selectRecords(Extent2D box, boolean add)
setAnnotations(ArrayList<LayerAnnotation> annotations)
Set a list of annotations to be drawn upon the layersetAnnotations(Callable<ArrayList<LayerAnnotation>> callable)
Set a callable that will create a list of annotations to be drawn upon the layerabstract void
setConnected(boolean state)
Connect the layer to the data source by adding a listener.setDPI(int dpi)
Set the DPI to be used for printingsetFeatureProperties(ArrayList<DBFColumnSpec> featureProperties)
Set a list of properties definitions, potentially useful in printing contexts that know what to do with them.void
Assign this layer to aLayerList
.boolean
setPeriod(int period)
Set the planning period that this layer refers to.void
Specify that the layer should be redrawn.void
Specify that the layer requires a refresh.void
setSelected(boolean selected)
Specify that this layer is selectedsetShowLegend(boolean show)
Do not show the layer name in Map Report legends.setShowLegendItems(boolean show)
Do not show the legend categories in either the Map Report or Map Viewer legends.abstract Layer
Set the theme for this layerSet the title of the map layersetVector(boolean mode)
void
setVisible(boolean visible)
-
Constructor Details
-
Layer
public Layer()
-
-
Method Details
-
clone
-
close
public void close() -
getTable
-
doTableSnapshot
- Throws:
Exception
-
setVisible
public void setVisible(boolean visible) -
setPeriod
public boolean setPeriod(int period)Set the planning period that this layer refers to. If the layer is not capable of displaying multiple periods this method will return false. -
getTitle
Get the title of the map layer -
setTitle
Set the title of the map layer -
isVisible
public boolean isVisible()Return true or false indicating if the layer is visible or not -
setShowLegend
Do not show the layer name in Map Report legends. This has not effect on the appearnce of the Map Viewer legend. -
getShowLegend
public boolean getShowLegend()Return the currect setting of the show legend parameter -
setShowLegendItems
Do not show the legend categories in either the Map Report or Map Viewer legends. -
getShowLegendItems
public boolean getShowLegendItems()Return the currect setting of the show legend items parameter -
needsRefresh
public boolean needsRefresh()Check if the layer requires refreshing. This can occur if the underlying data has changed since the last refresh. -
setRefresh
public void setRefresh()Specify that the layer requires a refresh. -
needsRedraw
public boolean needsRedraw()Check if the layer needs to be redrawn. This may be required if the stacking order changes, or if some temporary drawing is removed.Redraws will come from the cache and do not need to access the underlying data.
-
setRedraw
public void setRedraw()Specify that the layer should be redrawn. -
setSelected
public void setSelected(boolean selected)Specify that this layer is selected -
isSelected
public boolean isSelected()Test if this layer is selected -
getScale
public double getScale()Get the scale factor for this layer -
setParent
Assign this layer to aLayerList
. Layers can only belong to a single list at a time. -
setTheme
Set the theme for this layer -
getTheme
Get the theme that this layer is set to -
getFeatureType
public int getFeatureType() -
getPeriod
public int getPeriod()Get the period for this layer -
setDPI
Set the DPI to be used for printing -
getDPI
public int getDPI()Get the DPI to be used for printing. The default value is 72. -
setVector
-
getVector
public boolean getVector() -
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.- Parameters:
featureProperties
- a list of column specifications.
-
getFeatureProperties
Return a list of properties definitions, potentially useful in printing contexts that know what to do with them. -
setAnnotations
Set a list of annotations to be drawn upon the layer -
setAnnotations
Set a callable that will create a list of annotations to be drawn upon the layer -
getAnnotations
Get the list of annotations for this layer. If there is a callable it will be executed. -
getThemeList
-
maybePopup
-
selectRecords
-
identifyRecords
-
processRecords
-
getSelectedExtent
-
getType
public abstract int getType() -
getStats
-
getHistogram
public abstract double[] getHistogram(Window owner, AttributeStore store, Expression expr, int period, double min, double max) throws Exception- Throws:
Exception
-
getUniqueValues
public abstract Object[] getUniqueValues(Window owner, AttributeStore store, Expression expr, int period) -
resetSelectionContext
public void resetSelectionContext()Reset the selection context in the layer By default nothing happens. Override in layers that have tables -
hasSelectionContext
public boolean hasSelectionContext()Check if this theme uses a selection context -
getExtent2D
-
paintLayer
-
print
public abstract void print(Graphics2D g1, Extent2D extent, double scale, AffineTransform af, int dpi, LayerPrintCallback callback) -
setConnected
public abstract void setConnected(boolean state)Connect the layer to the data source by adding a listener. The default value is true (connected). -
getConnected
public abstract boolean getConnected() -
refreshLayer
Refresh the contents of this layer onto the screen graphics and the backing store.The backing store is used for pan operations as well as to repair damage.
- Returns:
- indicate if this method should be re-tried due to failed locking or continued layer updates
-
resize
public void resize(int width, int height)Set the size of the backing store used by this layer. Note that the backing store must provide an alpha transparency channel. -
free
public void free()Temporarily release resources used by this layer. The layer will be able to regain these resources when required. -
getIndex
public int getIndex()
-