Class Layer<T extends Theme>

java.lang.Object
ca.spatial.mapview.Layer<T>
Direct Known Subclasses:
GeoRelLayer, ImageLayer

public abstract class Layer<T extends Theme> extends Object
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 Details

    • Layer

      public Layer()
  • Method Details

    • clone

      public abstract Object clone()
    • close

      public void close()
    • getTable

      public abstract AttributeStore getTable()
    • doTableSnapshot

      public abstract void doTableSnapshot() throws Exception
      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

      public String getTitle()
      Get the title of the map layer
    • setTitle

      public Layer setTitle(String title)
      Set the title of the map layer
    • isVisible

      public boolean isVisible()
      Return true or false indicating if the layer is visible or not
    • setShowLegend

      public Layer setShowLegend(boolean show)
      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

      public Layer setShowLegendItems(boolean show)
      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

      public void setParent(LayerList parent)
      Assign this layer to a LayerList. Layers can only belong to a single list at a time.
    • setTheme

      public abstract Layer setTheme(T theme)
      Set the theme for this layer
    • getTheme

      public T 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

      public Layer setDPI(int dpi)
      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

      public Layer setVector(boolean mode)
    • getVector

      public boolean getVector()
    • setFeatureProperties

      public Layer setFeatureProperties(ArrayList<DBFColumnSpec> featureProperties)
      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

      public ArrayList<DBFColumnSpec> getFeatureProperties()
      Return a list of properties definitions, potentially useful in printing contexts that know what to do with them.
    • setAnnotations

      public Layer setAnnotations(ArrayList<LayerAnnotation> annotations)
      Set a list of annotations to be drawn upon the layer
    • setAnnotations

      public Layer setAnnotations(Callable<ArrayList<LayerAnnotation>> callable)
      Set a callable that will create a list of annotations to be drawn upon the layer
    • getAnnotations

      public ArrayList<LayerAnnotation> getAnnotations()
      Get the list of annotations for this layer. If there is a callable it will be executed.
    • getThemeList

      public ArrayList<ThemeDescriptor> getThemeList()
    • maybePopup

      public abstract void maybePopup(MouseEvent e, double x, double y, double fuzz, int period)
    • selectRecords

      public abstract void selectRecords(Extent2D box, boolean add)
    • identifyRecords

      public abstract void identifyRecords(Extent2D box)
    • processRecords

      public abstract void processRecords(Extent2D box, RecordHandler handler)
    • getSelectedExtent

      public abstract Extent2D getSelectedExtent()
    • getType

      public abstract int getType()
    • getStats

      public abstract double[] getStats(Window owner, AttributeStore store, Expression expr, int period)
    • 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

      public abstract Extent2D getExtent2D()
    • paintLayer

      public abstract boolean paintLayer(Extent2D extent, AffineTransform af, double scale)
    • 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

      public boolean refreshLayer(Graphics2D g1, double scale)
      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()