public static final class FeatureLayer.Builder extends Object implements AutoCloseable
Builder
for the FeatureLayer
class.Constructor and Description |
---|
Builder(FeatureLayer.Builder other) |
Modifier and Type | Method and Description |
---|---|
FeatureLayer |
build()
Returns a new layer, based on the properties set on this builder.
|
void |
close() |
FeatureLayer.Builder |
editable(boolean editable)
Sets whether the layer should be editable initially.
|
FeatureLayer.Builder |
editConfiguration(IFeatureEditConfiguration editConfiguration)
Enables editing capabilities using the given
IFeatureEditConfiguration . |
FeatureLayer.Builder |
editCreateGeometryProvider(IFeatureGeometryProvider geometryProvider)
Provides the edit/create geometry provider for a
Feature . |
protected void |
finalize() |
FeatureLayer.Builder |
labeled(boolean labeled)
Sets whether the layer should display labels initially.
|
FeatureLayer.Builder |
loadingStrategy(FeatureLayerLoadingStrategy loadingStrategy)
Sets the
FeatureLayerLoadingStrategy to use. |
FeatureLayer.Builder |
model(IFeatureModel model)
Sets the feature model of the layer.
|
FeatureLayer.Builder |
painter(IFeaturePainter featurePainter)
Sets the
IFeaturePainter to use. |
FeatureLayer.Builder |
queryable(boolean queryable)
Sets whether the features in this layer can be returned in the
Map#queryFeatures method. |
FeatureLayer.Builder |
queryConfiguration(FeatureQueryConfiguration configuration)
Sets the query configuration to use.
|
FeatureLayer.Builder |
title(String title)
Sets the title to use for the layer.
|
FeatureLayer.Builder |
visible(boolean visible)
Sets whether the layer should be visible initially.
|
public Builder(@NotNull FeatureLayer.Builder other)
public void close()
close
in interface AutoCloseable
@NotNull public FeatureLayer build() throws IllegalStateException
IllegalStateException
- If not all mandatory parameters are set. If no painter is set and the feature model contains at least one feature data type without a geometry.@NotNull public FeatureLayer.Builder painter(@NotNull IFeaturePainter featurePainter) throws NullPointerException
IFeaturePainter
to use.
If not set, a default painter will be used. The default painter relies on the feature model having all of its feature data types containing a geometry annotation.
featurePainter
- the feature painter used to paint the feature model. Cannot be null
.NullPointerException
- when the given feature painter is null
@NotNull public FeatureLayer.Builder title(@NotNull String title)
If not set, the title from the ModelMetadata
is used.
title
- the title for the layer.@NotNull public FeatureLayer.Builder visible(boolean visible)
Default is true
.
visible
- the visibility.@NotNull public FeatureLayer.Builder editConfiguration(@NotNull IFeatureEditConfiguration editConfiguration) throws NullPointerException
IFeatureEditConfiguration
.
If not set, editing will not be supported, and FeatureLayer#getEditConfiguration
will return null
. If set, editing will be enabled
by default.
Additional configuration for editing can be done using:
Editor.Builder
: for more global editing configuration
FeatureLayer.Builder#editCreateGeometryProvider
: to determine the edit/create geometry associated with a Feature
editConfiguration
- the feature edit configuration used to edit the feature model. Cannot be null
.NullPointerException
- when the given edit configuration is null
@NotNull public FeatureLayer.Builder editCreateGeometryProvider(@NotNull IFeatureGeometryProvider geometryProvider) throws NullPointerException
Feature
.
This geometry provider determines using which geometry a Feature
can be edited or created, and how to apply this geometry back on the Feature
. This implementation is for example used by FeatureHandlesProvider
, and by Creator
.
Calling this method is optional. When this method is not called, a default implementation will be used. This default implementation assumes that
Feature
has a DataType
with a GeometryDataAnnotation
that points to the Geometry
that can be edited
Geometry
can be applied by replacing that Geometry
property value, using Feature#asBuilder
geometryProvider
- the edit geometry provider for the current Feature
. Cannot be null
.NullPointerException
- when the given geometry provider is null
@NotNull public FeatureLayer.Builder editable(boolean editable)
When an edit configuration is set
, the default is true. When no edit configuration is set, the default is false.
When this method is called with true
as parameter, and no edit configuration is edit set
, a default edit configuration will be used. This default configuration enables editing for all features, using a default handles provider
.
Refer to editConfiguration
for enabling editing capabilities.
editable
- the edit capability.FeatureLayer#setEditable
@NotNull public FeatureLayer.Builder labeled(boolean labeled)
The default is true.
labeled
- whether the layer should display labels initially.FeatureLayer#setLabeled
@NotNull public FeatureLayer.Builder queryable(boolean queryable)
Map#queryFeatures
method.
The default is true.
queryable
- whether the features in this layer can be returned in the Map#queryFeatures
method.FeatureLayer#setQueryable
@NotNull public FeatureLayer.Builder queryConfiguration(@NotNull FeatureQueryConfiguration configuration) throws NullPointerException
The query configuration determines which features to load based on the current map's scale. If not set, a default configuration will be used that always loads all features.
configuration
- the query configuration. Cannot be null
.NullPointerException
- when the given query configuration is null
@NotNull public FeatureLayer.Builder model(@NotNull IFeatureModel model) throws NullPointerException
Calling this function is mandatory.
model
- the feature model of the layer. Cannot be null
.NullPointerException
- when the given model is null
.@NotNull public FeatureLayer.Builder loadingStrategy(@NotNull FeatureLayerLoadingStrategy loadingStrategy)
FeatureLayerLoadingStrategy
to use.
This method is optional. If a loading strategy is not explicitly configured, the LoadSpatially
strategy is used. It tries to use the LoadSpatially
strategy first. If that strategy is not supported for the layer's model, the LoadEverything
strategy is used as fallback.
loadingStrategy
- the loading strategy to use.