Class GeoRelLayer

All Implemented Interfaces:
EventListener, TableModelListener

public class GeoRelLayer extends Layer<ChoroplethTheme> implements TableModelListener
A GeoRelLayer is a geo-relational attribute store plus thematic information describing how the data should be rendered. As a layer it can be added to a LayerList and then displayed in a MapViewer or a MapReport.
  • Constructor Details

    • GeoRelLayer

      public GeoRelLayer(GeoRelationalStore store, ChoroplethTheme theme, String fieldname) throws Exception
      Set 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 soure
      theme - the thematic defintion
      fieldname - the attribute field expression used to classify the features
      Throws:
      Exception
    • GeoRelLayer

      @Deprecated public GeoRelLayer(GeoRelationalStore store, ChoroplethTheme theme) throws Exception
      Deprecated.
      This is the legacy constructor. It is the equivalent of
       new 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 Exception
      Deprecated.
      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

      public Object clone()
      Specified by:
      clone in class Layer<ChoroplethTheme>
    • close

      public void close()
      Overrides:
      close in class Layer<ChoroplethTheme>
    • getFieldname

      public String getFieldname()
    • setFieldname

      public void setFieldname(String fieldname)
    • getTable

      public GeoRelationalStore getTable()
      Specified by:
      getTable in class Layer<ChoroplethTheme>
    • doTableSnapshot

      public void doTableSnapshot() throws Exception
      Specified by:
      doTableSnapshot in class Layer<ChoroplethTheme>
      Throws:
      Exception
    • setVisible

      public void setVisible(boolean visible)
      Overrides:
      setVisible in class Layer<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 class Layer<ChoroplethTheme>
    • getConnected

      public boolean getConnected()
      Specified by:
      getConnected in class Layer<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

      public GeoRelLayer setTheme(ChoroplethTheme theme, String fieldname)
    • setTheme

      public GeoRelLayer setTheme(ChoroplethTheme theme)
      Description copied from class: Layer
      Set the theme for this layer
      Specified by:
      setTheme in class Layer<ChoroplethTheme>
    • getTheme

      public ChoroplethTheme getTheme()
      Description copied from class: Layer
      Get the theme that this layer is set to
      Overrides:
      getTheme in class Layer<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 class Layer<ChoroplethTheme>
    • maybePopup

      public void maybePopup(MouseEvent e, double x, double y, double fuzz, int period)
      Specified by:
      maybePopup in class Layer<ChoroplethTheme>
    • selectRecords

      public void selectRecords(Extent2D box, boolean add)
      Specified by:
      selectRecords in class Layer<ChoroplethTheme>
    • identifyRecords

      public void identifyRecords(Extent2D box)
      Specified by:
      identifyRecords in class Layer<ChoroplethTheme>
    • processRecords

      public void processRecords(Extent2D box, RecordHandler handler)
      Specified by:
      processRecords in class Layer<ChoroplethTheme>
    • getSelectedExtent

      public Extent2D getSelectedExtent()
      Specified by:
      getSelectedExtent in class Layer<ChoroplethTheme>
    • getExtent2D

      public Extent2D getExtent2D()
      Specified by:
      getExtent2D in class Layer<ChoroplethTheme>
    • getType

      public int getType()
      Specified by:
      getType in class Layer<ChoroplethTheme>
    • getShowLegendItems

      public boolean getShowLegendItems()
      Description copied from class: Layer
      Return the currect setting of the show legend items parameter
      Overrides:
      getShowLegendItems in class Layer<ChoroplethTheme>
    • getUniqueValues

      public Object[] getUniqueValues(Window owner, AttributeStore store, Expression expr, int period)
      Specified by:
      getUniqueValues in class Layer<ChoroplethTheme>
    • getStats

      public double[] getStats(Window owner, AttributeStore store, Expression expr, int period)
      Specified by:
      getStats in class Layer<ChoroplethTheme>
    • getHistogram

      public double[] getHistogram(Window owner, AttributeStore store, Expression expr, int period, double min, double max) throws Exception
      Specified by:
      getHistogram in class Layer<ChoroplethTheme>
      Throws:
      Exception
    • addMenuItems

      public boolean addMenuItems(JPopupMenu jpm, Layer l, double x, double y)
    • getRepaintWidth

      public int getRepaintWidth()
      Get the width of the damage repaint area that is used during feature update events.
    • setRepaintWidth

      public GeoRelLayer setRepaintWidth(int width)
      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

      public ArrayList<ThemeDescriptor> getThemeList()
      Overrides:
      getThemeList in class Layer<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 class Layer<ChoroplethTheme>
    • hasSelectionContext

      public boolean hasSelectionContext()
      Description copied from class: Layer
      Check if this theme uses a selection context
      Overrides:
      hasSelectionContext in class Layer<ChoroplethTheme>
    • 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.
      Overrides:
      setFeatureProperties in class Layer<ChoroplethTheme>
      Parameters:
      featureProperties - a list of column specifications.
    • paintLayer

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

      public void tableChanged(TableModelEvent e)
      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 interface TableModelListener