Package org.geotools.map
Class FeatureLayer
Object
Layer
StyleLayer
FeatureLayer
Layer responsible for rendering vector information provided by a FeatureSource.
The FeatureLayer combines:
- data: FeatureSource
- style: Style
- Since:
- 2.7
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected FeatureSource<? extends FeatureType,
? extends Feature> FeatureSource offering content for displayprotected Query
Query use to limit content of featureSourceprotected FeatureListener
Listener to forward feature source events as layer eventsFields inherited from class StyleLayer
style
-
Constructor Summary
ConstructorsConstructorDescriptionFeatureLayer
(FeatureSource featureSource, Style style) Creates a new instance of FeatureLayerFeatureLayer
(FeatureSource featureSource, Style style, String title) FeatureLayer
(FeatureCollection collection, Style style) FeatureLayer
(FeatureCollection collection, Style style, String title) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
connectDataListener
(boolean listen) Used to connect/disconnect a FeatureListener if any map layer listeners are registered.void
dispose()
Allows a Layer to clean up any listeners, or internal caches or resources it has added during use.The bounds of the Layer content (if known).FeatureSource<?,
?> Get the feature source for this layer.getQuery()
Returns the definition query (filter) for this layer.Get the feature source for this layer.void
Sets a definition query for the layer which acts as a filter for the features that the layer will draw.Methods inherited from class StyleLayer
getStyle, setStyle
Methods inherited from class Layer
addMapLayerListener, finalize, fireMapLayerListenerLayerChanged, fireMapLayerListenerLayerDeselected, fireMapLayerListenerLayerHidden, fireMapLayerListenerLayerPreDispose, fireMapLayerListenerLayerSelected, fireMapLayerListenerLayerShown, getTitle, getUserData, isSelected, isVisible, preDispose, removeMapLayerListener, setSelected, setTitle, setVisible, toString
-
Field Details
-
featureSource
FeatureSource offering content for display -
query
Query use to limit content of featureSource -
sourceListener
Listener to forward feature source events as layer events
-
-
Constructor Details
-
FeatureLayer
Creates a new instance of FeatureLayer- Parameters:
featureSource
- the data source for this layerstyle
- the style used to represent this layer
-
FeatureLayer
-
FeatureLayer
-
FeatureLayer
-
-
Method Details
-
connectDataListener
protected void connectDataListener(boolean listen) Used to connect/disconnect a FeatureListener if any map layer listeners are registered.- Overrides:
connectDataListener
in classLayer
- Parameters:
listen
- true to connect, false to disconnect
-
dispose
public void dispose()Description copied from class:Layer
Allows a Layer to clean up any listeners, or internal caches or resources it has added during use.- Overrides:
dispose
in classStyleLayer
-
getFeatureSource
Get the feature source for this layer.- Overrides:
getFeatureSource
in classLayer
- Returns:
- feature source for the contents of this layer
-
getSimpleFeatureSource
Get the feature source for this layer.- Returns:
- SimpleFeatureSource for this layer, or null if not available
-
getQuery
Returns the definition query (filter) for this layer. If no definition query has been definedQuery.ALL
is returned. -
setQuery
Sets a definition query for the layer which acts as a filter for the features that the layer will draw.A consumer must ensure that this query is used in combination with the bounding box filter generated on each map interaction to limit the number of features returned to those that complains both the definition query and relies inside the area of interest.
IMPORTANT: only include attribute names in the query if you want them to be ALWAYS returned. It is desirable to not include attributes at all but let the layer user (a renderer?) to decide wich attributes are actually needed to perform its requiered operation.
-
getBounds
Description copied from class:Layer
The bounds of the Layer content (if known). The bounds can be used to determine if any of the layers content is "on screen" when rendering the map; however often it is expensive to calculate a layers bounds up front so we are allowing this value to be optional.The returned bounds are a ReferencedEnvelope using the same CoordinateReferenceSystem as the layers contents.
-