Package org.geotools.map
Class FeatureLayer
- Object
-
- Layer
-
- StyleLayer
-
- FeatureLayer
-
public class FeatureLayer extends StyleLayer
Layer responsible for rendering vector information provided by a FeatureSource.The FeatureLayer combines:
- data: FeatureSource
- style: Style
- Since:
- 2.7
-
-
Field Summary
Fields Modifier and Type Field Description protected FeatureSource<? extends FeatureType,? extends Feature>
featureSource
FeatureSource offering content for displayprotected Query
query
Query use to limit content of featureSourceprotected FeatureListener
sourceListener
Listener to forward feature source events as layer events-
Fields inherited from class StyleLayer
style
-
-
Constructor Summary
Constructors Constructor Description FeatureLayer(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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.ReferencedEnvelope
getBounds()
The bounds of the Layer content (if known).FeatureSource<?,?>
getFeatureSource()
Get the feature source for this layer.Query
getQuery()
Returns the definition query (filter) for this layer.SimpleFeatureSource
getSimpleFeatureSource()
Get the feature source for this layer.void
setQuery(Query query)
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 Detail
-
featureSource
protected FeatureSource<? extends FeatureType,? extends Feature> featureSource
FeatureSource offering content for display
-
query
protected Query query
Query use to limit content of featureSource
-
sourceListener
protected FeatureListener sourceListener
Listener to forward feature source events as layer events
-
-
Constructor Detail
-
FeatureLayer
public FeatureLayer(FeatureSource featureSource, Style style)
Creates a new instance of FeatureLayer- Parameters:
featureSource
- the data source for this layerstyle
- the style used to represent this layer
-
FeatureLayer
public FeatureLayer(FeatureSource featureSource, Style style, String title)
-
FeatureLayer
public FeatureLayer(FeatureCollection collection, Style style)
-
FeatureLayer
public FeatureLayer(FeatureCollection collection, Style style, String title)
-
-
Method Detail
-
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
public FeatureSource<?,?> getFeatureSource()
Get the feature source for this layer.- Overrides:
getFeatureSource
in classLayer
- Returns:
- feature source for the contents of this layer
-
getSimpleFeatureSource
public SimpleFeatureSource getSimpleFeatureSource()
Get the feature source for this layer.- Returns:
- SimpleFeatureSource for this layer, or null if not available
-
getQuery
public Query getQuery()
Returns the definition query (filter) for this layer. If no definition query has been definedQuery.ALL
is returned.
-
setQuery
public void setQuery(Query query)
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
public ReferencedEnvelope 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.
-
-