Class LayerManager

java.lang.Object
com.vividsolutions.jump.workbench.model.LayerManager

public class LayerManager extends Object
Registry of Layers in a Task.
See Also:
  • Constructor Details

    • LayerManager

      public LayerManager()
    • LayerManager

      public LayerManager(Task task)
  • Method Details

    • getUndoableEditReceiver

      public UndoableEditReceiver getUndoableEditReceiver()
    • deferFiringEvents

      public void deferFiringEvents(Runnable r)
    • generateLayerFillColor

      public Color generateLayerFillColor()
    • addLayer

      public Layer addLayer(String categoryName, Layer layer)
    • addLayerable

      public void addLayerable(String categoryName, Layerable layerable)
    • addCategory

      public void addCategory(String categoryName)
      / Unused : we don't want to reproject new layers automatically, / even if they don't match the project's CoordinateReferenceSystem
    • addCategory

      public void addCategory(String categoryName, int index)
    • getCategory

      public Category getCategory(String name)
    • getCategories

      public List<Category> getCategories()
    • addLayer

      public Layer addLayer(String categoryName, String layerName, FeatureCollection featureCollection)
      Parameters:
      layerName - the name of the layer. A number will be appended if a layer with the same name already exists. Set to null to automatically generate a new name.
    • addOrReplaceLayer

      public Layer addOrReplaceLayer(String categoryName, String layerName, FeatureCollection featureCollection)
      Parameters:
      categoryName - name of the category where the Layer will be added
      layerName - the Layer name
      featureCollection - the new FeatureCollection which will be added or which will replace the one in the previous Layer named layerName if any
      Returns:
      the Layer with its new FeatureCollection
    • uniqueLayerName

      public String uniqueLayerName(String name)
      Returns:
      a unique layer name based on the given name
    • remove

      public void remove(Layerable layerable)
      Convenience method. Use dispose rather than remove if you want to free the memory. remove is only used to temporarily remove a layer from the layer (ex. in the MoveLayerPlugIn).
      Parameters:
      layerable - Layerable to remove
    • remove

      public void remove(Layerable[] layerables)
      remove, but do not dispose layer (as used e.g. by MoveLayerPlugin)
    • removeIfEmpty

      public void removeIfEmpty(Category category)
    • dispose

      public void dispose()
    • dispose

      public void dispose(Layerable l)
    • dispose

      public void dispose(Layerable[] ls)
    • indexOf

      public int indexOf(Category category)
    • fireFeaturesChanged

      public void fireFeaturesChanged(Collection<Feature> features, FeatureEventType type, Layer layer)
    • fireGeometryModified

      public void fireGeometryModified(Collection<Feature> features, Layer layer, Collection<Feature> oldFeatureClones)
    • fireLayerChanged

      public void fireLayerChanged(Layerable layerable, LayerEventType type)
    • setFiringEvents

      public void setFiringEvents(boolean firingEvents)
    • isFiringEvents

      public boolean isFiringEvents()
    • reverseIterator

      public <T extends Layerable> Iterator<T> reverseIterator(Class<T> layerableClass)
      Returns:
      an iterator over the layers, from bottom to top. Layers with #drawingLast = true appear last.
    • iterator

      public <T> Iterator<T> iterator(Class<T> clazz)
      Returns:
      an iterator of layerables. Same as getLayerables but avoid building collections WARNING : old iterator() returning an iterator of Layers only has been removed and all classes using it in OpenJUMP core have been updated
    • getLayer

      public Layer getLayer(String name)
      Returns:
      null if there is no such layer
    • addLayerListener

      public void addLayerListener(LayerListener layerListener)
    • removeLayerListener

      public void removeLayerListener(LayerListener layerListener)
    • getLayer

      public Layer getLayer(int index)
    • size

      public int size()
    • getEnvelopeOfAllLayers

      public org.locationtech.jts.geom.Envelope getEnvelopeOfAllLayers()
    • getEnvelopeOfAllLayers

      public org.locationtech.jts.geom.Envelope getEnvelopeOfAllLayers(boolean visibleLayersOnly)
      Returns:
      the envelope containing all layers
      Since:
      [Giuseppe Aruta] July 8 2015. Now it takes into account Sextante Raster and WMS layers
    • getWMSLayers

      public List<WMSLayer> getWMSLayers()
      [Giuseppe Aruta] July 8 2015 Gets the list of WMSLayer.class registered in this manager
    • getRasterImageLayers

      public List<RasterImageLayer> getRasterImageLayers()
      [Giuseppe Aruta] July 8 2015 Gets the list of RasterImageLayer.class registered in this manager
    • indexOf

      public int indexOf(Layer layer)
      Returns:
      -1 if the layer does not exist
    • getCategory

      public Category getCategory(Layerable layerable)
    • getLayers

      public List<Layer> getLayers()
    • getLayerables

      public <T extends Layerable> List<T> getLayerables(Class<T> layerableClass)
      To get all Layerables, set layerableClass to Layerable.class.
    • getVisibleLayers

      public List<Layer> getVisibleLayers(boolean includeFence)
    • layerManagerCount

      public static int layerManagerCount()
    • getEditableLayers

      public Collection<Layer> getEditableLayers()
      Editability is not enforced; all parties are responsible for heeding the editability of a layer.
    • getBlackboard

      public Blackboard getBlackboard()
    • getLayersWithModifiedFeatureCollections

      public Collection<Layer> getLayersWithModifiedFeatureCollections()
    • getTemporaryRasterImageLayers

      public LinkedList<String> getTemporaryRasterImageLayers()
      Returns:
      a List of Temporary Raster Layers (RasterImageLayer.class in TMP folder)
    • getLayersWithNullDataSource

      public LinkedList<Layer> getLayersWithNullDataSource()
    • setCoordinateSystem

      public void setCoordinateSystem(CoordinateSystem coordinateSystem)
    • getCoordinateSystem

      public CoordinateSystem getCoordinateSystem()
    • fireFeaturesAttChanged

      public void fireFeaturesAttChanged(Collection<Feature> features, FeatureEventType type, Layer layer, Collection<Feature> oldFeatureClones)
    • getTask

      public Task getTask()