Class Layer
- java.lang.Object
-
- org.locationtech.jts.jump.workbench.model.AbstractLayerable
-
- org.locationtech.jts.jump.workbench.model.Layer
-
- All Implemented Interfaces:
Layerable,LayerManagerProxy
public class Layer extends AbstractLayerable implements LayerManagerProxy
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.
-
-
Field Summary
Fields Modifier and Type Field Description static StringFIRING_APPEARANCE_CHANGED_ON_ATTRIBUTE_CHANGE
-
Constructor Summary
Constructors Constructor Description Layer()Called by Java2XMLLayer(String name, Color fillColor, FeatureCollection featureCollection, LayerManager layerManager)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddStyle(Style style)static UndoableCommandaddUndo(String layerName, LayerManagerProxy proxy, UndoableCommand wrappeeCommand)Enables a layer to be changed undoably.CollectioncloneStyles()static ColordefaultLineColor(Color fillColor)voiddispose()Releases references to the data, to facilitate garbage collection.BasicStylegetBasicStyle()BlackboardgetBlackboard()DataSourceQuerygetDataSourceQuery()StringgetDescription()FeatureCollectionWrappergetFeatureCollectionWrapper()Returns a wrapper around the FeatureCollection which was added using #wrapFeatureCollection.LabelStylegetLabelStyle()StylegetStyle(Class c)Styles do not notify the Layer when their parameters change.ListgetStyles()VertexStylegetVertexStyle()booleanhasReadableDataSource()booleanisDrawingLast()booleanisEditable()booleanisFeatureCollectionModified()booleanisSynchronizingLineColor()voidremoveStyle(Style p)LayersetDataSourceQuery(DataSourceQuery dataSourceQuery)voidsetDescription(String description)voidsetDrawingLast(boolean drawingLast)Used for lightweight layers like the Vector layer.voidsetEditable(boolean editable)Editability is not enforced; all parties are responsible for heeding this flag.voidsetFeatureCollection(FeatureCollection featureCollection)LayersetFeatureCollectionModified(boolean featureCollectionModified)protected voidsetFeatureCollectionWrapper(FeatureCollectionWrapper featureCollectionWrapper)voidsetLayerManager(LayerManager layerManager)Called by Java2XMLvoidsetStyles(Collection newStyles)voidsetSynchronizingLineColor(boolean synchronizingLineColor)static voidtryToInvalidateEnvelope(Layer layer)Does nothing if the underlying feature collection is not a FeatureDataset.-
Methods inherited from class org.locationtech.jts.jump.workbench.model.AbstractLayerable
fireAppearanceChanged, fireLayerChanged, getLayerManager, getName, isVisible, setName, setVisible, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.locationtech.jts.jump.workbench.model.LayerManagerProxy
getLayerManager
-
-
-
-
Field Detail
-
FIRING_APPEARANCE_CHANGED_ON_ATTRIBUTE_CHANGE
public static final String FIRING_APPEARANCE_CHANGED_ON_ATTRIBUTE_CHANGE
-
-
Constructor Detail
-
Layer
public Layer()
Called by Java2XML
-
Layer
public Layer(String name, Color fillColor, FeatureCollection featureCollection, LayerManager layerManager)
-
-
Method Detail
-
defaultLineColor
public static Color defaultLineColor(Color fillColor)
- 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)
-
setEditable
public void setEditable(boolean editable)
Editability is not enforced; all parties are responsible for heeding this flag.
-
isEditable
public boolean isEditable()
-
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).
-
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
-
getStyles
public List getStyles()
-
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.
-
removeStyle
public void removeStyle(Style p)
-
cloneStyles
public Collection cloneStyles()
-
setStyles
public void setStyles(Collection newStyles)
-
setLayerManager
public void setLayerManager(LayerManager layerManager)
Description copied from interface:LayerableCalled by Java2XML- Specified by:
setLayerManagerin interfaceLayerable- Overrides:
setLayerManagerin classAbstractLayerable
-
getBlackboard
public Blackboard getBlackboard()
- Specified by:
getBlackboardin interfaceLayerable
-
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.
-
tryToInvalidateEnvelope
public static void tryToInvalidateEnvelope(Layer layer)
Does nothing if the underlying feature collection is not a FeatureDataset.
-
getDataSourceQuery
public DataSourceQuery getDataSourceQuery()
-
setDataSourceQuery
public Layer setDataSourceQuery(DataSourceQuery dataSourceQuery)
-
isFeatureCollectionModified
public boolean isFeatureCollectionModified()
-
setFeatureCollectionModified
public Layer setFeatureCollectionModified(boolean featureCollectionModified)
-
-