public final class FeatureLayer extends Layer implements AutoCloseable
Use FeatureLayer#newBuilder
to create a feature layer instance.
Modifier and Type | Class and Description |
---|---|
static class |
FeatureLayer.Builder
Builder for the FeatureLayer class. |
Modifier and Type | Field and Description |
---|---|
static String |
PropertyEditable
Returns the property name for the
LayerEvent that is fired as a result of changing the layer's editable flag. |
static String |
PropertyLabeled
Returns the property name for the
LayerEvent that is fired as a result of changing the layer's labeled flag. |
static String |
PropertyPainter
Returns the property name for the
LayerEvent that is fired as a result of changing the layer's IFeaturePainter . |
static String |
PropertyQueryable
Returns the property name for the
LayerEvent that is fired as a result of changing the layer's queryable flag. |
PropertyTitle, PropertyVisible
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected void |
finalize() |
IFeatureEditConfiguration |
getEditConfiguration()
Returns if editing is supported and how editing is configured.
|
IFeatureGeometryProvider |
getEditCreateGeometryProvider() |
FeatureLayerLoadingStrategy |
getLoadingStrategy() |
IFeatureModel |
getModel() |
IFeaturePainter |
getPainter() |
FeatureQueryConfiguration |
getQueryConfiguration() |
boolean |
isEditable()
Returns whether this layer is editable.
|
boolean |
isLabeled() |
boolean |
isQueryable() |
static FeatureLayer.Builder |
newBuilder()
Returns a new builder for creating a
FeatureLayer . |
void |
setEditable(boolean editable)
Sets whether this layer is editable.
|
void |
setLabeled(boolean labeled)
Sets whether the layer should display labels.
|
void |
setPainter(IFeaturePainter featurePainter)
Sets the new
IFeaturePainter to use. |
void |
setQueryable(boolean queryable)
Sets whether the features of this layer can be returned in the
Map#queryFeatures method. |
addObserver, getId, getTitle, isVisible, removeObserver, setTitle, setVisible
public static final String PropertyEditable
LayerEvent
that is fired as a result of changing the layer's editable flag.setEditable
public static final String PropertyLabeled
LayerEvent
that is fired as a result of changing the layer's labeled flag.setLabeled
public static final String PropertyQueryable
LayerEvent
that is fired as a result of changing the layer's queryable flag.setQueryable
public static final String PropertyPainter
LayerEvent
that is fired as a result of changing the layer's IFeaturePainter
.setPainter
public void close()
close
in interface AutoCloseable
close
in class Layer
@NotNull public static FeatureLayer.Builder newBuilder()
FeatureLayer
.FeatureLayer
.@NotNull public IFeatureModel getModel()
@NotNull public IFeaturePainter getPainter()
public void setPainter(@NotNull IFeaturePainter featurePainter) throws NullPointerException, IllegalArgumentException
IFeaturePainter
to use.
It will replace the IFeaturePainter
that was set using the FeatureLayer.Builder#painter
method, or if that method was not called, it will replace the default feature painter.
Limitation: This method currently only supports setting a new IFeaturePainter
with the exact same level of details
as the previous painter. If this is not the case, this method will throw an exception.
featurePainter
- the feature painter used to paint the feature model. Cannot be null
.NullPointerException
- when the given feature painter is null
IllegalArgumentException
- when the new painter has different detail levels than the previous painter@NotNull public FeatureQueryConfiguration getQueryConfiguration()
@Nullable public IFeatureEditConfiguration getEditConfiguration()
Whether or not the layer can be edited by the user is controlled using setEditable
.
IFeatureEditConfiguration
for the IFeatureModel
of this layer, or null
if editing is not supported.FeatureLayer.Builder#editConfiguration
@NotNull public IFeatureGeometryProvider getEditCreateGeometryProvider()
Feature
.FeatureLayer.Builder#editCreateGeometryProvider
public boolean isEditable()
A layer is editable if it has an IFeatureEditConfiguration
and if the editable flag is set.
setEditable
public void setEditable(boolean editable)
Sets whether or not the features of the layer can be edited by the user. If the new value is different from the old one, a LayerEvent
is delivered to the observers with the property name FeatureLayer#propertyEditable
.
This flag is checked by the Editor
when receiving events from the IFeatureEditCandidateProvider
in conjunction with the model's IFeatureModelUpdater
and the layer's IFeatureEditConfiguration
.
This flag is true by default. This flag has no effect if the layer does not contain an IFeatureEditConfiguration
or if the model's IFeatureModelUpdater
is missing.
editable
- the new value for this propertypublic boolean isLabeled()
public void setLabeled(boolean labeled)
Note that in order for the layer to display labels, its IFeaturePainter
should also call the FeatureCanvas#drawLabel
method for its features. If not, no labels will be displayed, regardless of this setting.
labeled
- true to enable labels.public boolean isQueryable()
Map#queryFeatures
method.public void setQueryable(boolean queryable)
Map#queryFeatures
method.
The default is true.
It is useful to set this property to false when:
SelectEventHandler
or HoverEventHandler
classes.
Map#queryFeatures
method, for example for a layer with many features that don't need to be selected.
queryable
- whether the features of this layer can be returned in the Map#queryFeatures
method@NotNull public FeatureLayerLoadingStrategy getLoadingStrategy()
FeatureLayer.Builder#loadingStrategy