public class FeatureLayer extends StyleLayer
The FeatureLayer combines:
Modifier and Type | Field and Description |
---|---|
protected FeatureSource<? extends FeatureType,? extends Feature> |
featureSource
FeatureSource offering content for display
|
protected Query |
query
Query use to limit content of featureSource
|
protected FeatureListener |
sourceListener
Listener to forward feature source events as layer events
|
style
Constructor and Description |
---|
FeatureLayer(FeatureCollection collection,
Style style) |
FeatureLayer(FeatureCollection collection,
Style style,
String title) |
FeatureLayer(FeatureSource featureSource,
Style style)
Creates a new instance of FeatureLayer
|
FeatureLayer(FeatureSource featureSource,
Style style,
String title) |
Modifier and Type | Method and 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.
|
getStyle, setStyle
addMapLayerListener, finalize, fireMapLayerListenerLayerChanged, fireMapLayerListenerLayerDeselected, fireMapLayerListenerLayerHidden, fireMapLayerListenerLayerPreDispose, fireMapLayerListenerLayerSelected, fireMapLayerListenerLayerShown, getTitle, getUserData, isSelected, isVisible, preDispose, removeMapLayerListener, setSelected, setTitle, setVisible, toString
protected FeatureSource<? extends FeatureType,? extends Feature> featureSource
protected Query query
protected FeatureListener sourceListener
public FeatureLayer(FeatureSource featureSource, Style style)
featureSource
- the data source for this layerstyle
- the style used to represent this layerpublic FeatureLayer(FeatureSource featureSource, Style style, String title)
public FeatureLayer(FeatureCollection collection, Style style)
public FeatureLayer(FeatureCollection collection, Style style, String title)
protected void connectDataListener(boolean listen)
connectDataListener
in class Layer
listen
- true to connect, false to disconnectpublic void dispose()
Layer
dispose
in class StyleLayer
public FeatureSource<?,?> getFeatureSource()
getFeatureSource
in class Layer
public SimpleFeatureSource getSimpleFeatureSource()
public Query getQuery()
Query.ALL
is returned.public void setQuery(Query query)
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.
query
- public ReferencedEnvelope getBounds()
Layer
The returned bounds are a ReferencedEnvelope using the same CoordinateReferenceSystem as the layers contents.
Copyright © 1996–2019 Geotools. All rights reserved.