Class Layer

All Implemented Interfaces:
Disposable, Layerable, LayerManagerProxy
Direct Known Subclasses:
LayerView, ReferencedImagesLayer, SpatialDSLayer, SystemLayerFinder.NonSavePromptingLayer

public class Layer extends GeoReferencedLayerable implements Disposable
Adds colour, line-width, and other stylistic information to a Feature Collection.

When adding or removing multiple features to this Layer's FeatureCollection, prefer #addAll and #removeAll to #add and #remove -- fewer events will be fired.

  • Constructor Details

  • Method Details

    • defaultLineColor

      public static Color defaultLineColor(Color fillColor)
      Parameters:
      fillColor - the fillColor we want to derive a lineColor
      Returns:
      a darker version of the given fill colour, for use as the line colour
    • setDescription

      public void setDescription(String description)
    • setDrawingLast

      public void setDrawingLast(boolean drawingLast)
      Used for lightweight layers like the Vector layer.
      Parameters:
      drawingLast - true if the layer should be among those drawn last
    • setFeatureCollection

      public void setFeatureCollection(FeatureCollection featureCollection)
    • setSynchronizingLineColor

      public void setSynchronizingLineColor(boolean synchronizingLineColor)
    • getBasicStyle

      public BasicStyle getBasicStyle()
    • getVertexStyle

      public VertexStyle getVertexStyle()
    • getLabelStyle

      public LabelStyle getLabelStyle()
    • getDescription

      public String getDescription()
    • getFeatureCollectionWrapper

      public FeatureCollectionWrapper getFeatureCollectionWrapper()
      Returns a wrapper around the FeatureCollection which was added using #wrapFeatureCollection. The original FeatureCollection can be retrieved using FeatureCollectionWrapper#getWrappee. However, parties are encouraged to use the FeatureCollectionWrapper instead, so that feature additions and removals cause FeatureEvents to be fired (by the Layer).
      Returns:
      the FeatureCollectionWrapper containing features
    • setFeatureCollectionWrapper

      protected void setFeatureCollectionWrapper(FeatureCollectionWrapper featureCollectionWrapper)
    • getStyle

      public Style getStyle(Class<?> c)
      Styles do not notify the Layer when their parameters change. Therefore, after you modify a Style's parameters (for example, the fill colour of BasicStyle), be sure to call #fireAppearanceChanged
      Parameters:
      c - Can even be the desired Style's superclass or interface
      Returns:
      The style value
    • getStylesIfEnabled

      public List<Style> getStylesIfEnabled(Class<?> filter)
      get a list of all enabled styles matching the parameter class
      Parameters:
      filter - superclass of the requested styles
      Returns:
      a list containing enabled styles implementing the requested class
    • getStyles

      public List<Style> getStyles()
      get a list of all styles
      Returns:
      all Styles of this Layer in a new unmodifiable List
    • getStyles

      public List<Style> getStyles(Class<?> filter)
      get a list of all styles matching the parameter class
      Parameters:
      filter - superclass or interface of the requested styles
      Returns:
      a list containing all styles implementing the requested class
    • hasReadableDataSource

      public boolean hasReadableDataSource()
    • isDrawingLast

      public boolean isDrawingLast()
    • isSynchronizingLineColor

      public boolean isSynchronizingLineColor()
    • addStyle

      public void addStyle(Style style)
    • dispose

      public void dispose()
      Releases references to the data, to facilitate garbage collection. Important for MDI apps like the JUMP Workbench. Called when the last JInternalFrame viewing the LayerManager is closed (i.e. internal frame's responsibility). To conserve memory, if layers are frequently added and removed from the LayerManager, parties may want to call #dispose themselves rather than waiting for the internal frame to be closed.
      Specified by:
      dispose in interface Disposable
    • removeStyle

      public void removeStyle(Style p)
    • cloneStyles

      public Collection<Style> cloneStyles()
    • setStyles

      public void setStyles(Collection<Style> newStyles)
    • setLayerManager

      public void setLayerManager(LayerManager layerManager)
      Description copied from interface: Layerable
      Called by Java2XML
      Specified by:
      setLayerManager in interface Layerable
      Overrides:
      setLayerManager in class AbstractLayerable
      Parameters:
      layerManager - the LayerManager
    • addUndo

      public static UndoableCommand addUndo(String layerName, LayerManagerProxy proxy, UndoableCommand wrappeeCommand)
      Enables a layer to be changed undoably. Since the layer's features are saved, only use this method for layers with few features.
      Parameters:
      layerName - the target Layer name
      proxy - a LayerManager proxy
      wrappeeCommand - the undoable command
      Returns:
      the command to be executed
    • tryToInvalidateEnvelope

      public static void tryToInvalidateEnvelope(Layer layer)
      Does nothing if the underlying feature collection is not a FeatureDataset.
      Parameters:
      layer - the Layer whose envelope must be invalidated
    • getDataSourceQuery

      public DataSourceQuery getDataSourceQuery()
    • setDataSourceQuery

      public Layer setDataSourceQuery(DataSourceQuery dataSourceQuery)
    • isFeatureCollectionModified

      public boolean isFeatureCollectionModified()
    • setFeatureCollectionModified

      public Layer setFeatureCollectionModified(boolean featureCollectionModified)
    • getFeatureSchemaOperations

      public Collection<String> getFeatureSchemaOperations()
    • addFeatureSchemaOperation

      public void addFeatureSchemaOperation(String expression)