Class FeatureLayer.Builder
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
FeatureLayer
Builder
for the FeatureLayer
class.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Returns a new layer, based on the properties set on this builder.void
close()
editable
(boolean editable) Sets whether the layer should be editable initially.editConfiguration
(IFeatureEditConfiguration editConfiguration) Enables editing capabilities using the givenIFeatureEditConfiguration
.editCreateGeometryProvider
(IFeatureGeometryProvider geometryProvider) Provides the edit/create geometry provider for aFeature
.protected void
finalize()
labeled
(boolean labeled) Sets whether the layer should display labels initially.loadingStrategy
(FeatureLayerLoadingStrategy loadingStrategy) Sets theFeatureLayerLoadingStrategy
to use.model
(IFeatureModel model) Sets the feature model of the layer.painter
(IFeaturePainter featurePainter) Sets theIFeaturePainter
to use.queryable
(boolean queryable) Sets whether the features in this layer can be returned in theMap#queryFeatures
method.queryConfiguration
(FeatureQueryConfiguration configuration) Sets the query configuration to use.Sets the title to use for the layer.visible
(boolean visible) Sets whether the layer should be visible initially.
-
Constructor Details
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
build
Returns a new layer, based on the properties set on this builder.- Returns:
- a new layer, based on the properties set on this builder.
- Throws:
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.
-
painter
@NotNull public FeatureLayer.Builder painter(@NotNull IFeaturePainter featurePainter) throws NullPointerException Sets theIFeaturePainter
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.
- Parameters:
featurePainter
- the feature painter used to paint the feature model. Cannot benull
.- Returns:
- this builder.
- Throws:
NullPointerException
- when the given feature painter isnull
-
title
Sets the title to use for the layer.If not set, the title from the
ModelMetadata
is used.- Parameters:
title
- the title for the layer.- Returns:
- this builder.
-
visible
Sets whether the layer should be visible initially.Default is
true
.- Parameters:
visible
- the visibility.- Returns:
- this builder.
-
editConfiguration
@NotNull public FeatureLayer.Builder editConfiguration(@NotNull IFeatureEditConfiguration editConfiguration) throws NullPointerException Enables editing capabilities using the givenIFeatureEditConfiguration
.If not set, editing will not be supported, and
FeatureLayer#getEditConfiguration
will returnnull
. If set, editing will beenabled
by default.Additional configuration for editing can be done using:
Editor.Builder
: for more global editing configurationFeatureLayer.Builder#editCreateGeometryProvider
: to determine the edit/create geometry associated with aFeature
- Parameters:
editConfiguration
- the feature edit configuration used to edit the feature model. Cannot benull
.- Returns:
- this builder.
- Throws:
NullPointerException
- when the given edit configuration isnull
-
editCreateGeometryProvider
@NotNull public FeatureLayer.Builder editCreateGeometryProvider(@NotNull IFeatureGeometryProvider geometryProvider) throws NullPointerException Provides the edit/create geometry provider for aFeature
.This geometry provider determines using which geometry a
Feature
can be edited or created, and how to apply this geometry back on theFeature
. This implementation is for example used byFeatureHandlesProvider
, and byCreator
.Calling this method is optional. When this method is not called, a default implementation will be used. This default implementation assumes that
- the
Feature
has aDataType
with aGeometryDataAnnotation
that points to theGeometry
that can be edited - the changed
Geometry
can be applied by replacing thatGeometry
property value, usingFeature#asBuilder
- Parameters:
geometryProvider
- the edit geometry provider for the currentFeature
. Cannot benull
.- Returns:
- this
- Throws:
NullPointerException
- when the given geometry provider isnull
- the
-
editable
Sets whether the layer should be editable initially.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 isedit set
, a default edit configuration will be used. This default configuration enables editing for all features, using a defaulthandles provider
.Refer to
editConfiguration
for enabling editing capabilities.- Parameters:
editable
- the edit capability.- Returns:
- this builder.
- See Also:
-
labeled
Sets whether the layer should display labels initially.The default is true.
- Parameters:
labeled
- whether the layer should display labels initially.- Returns:
- this builder.
- See Also:
-
queryable
Sets whether the features in this layer can be returned in theMap#queryFeatures
method.The default is true.
- Parameters:
queryable
- whether the features in this layer can be returned in theMap#queryFeatures
method.- Returns:
- this builder
- Since:
- 2023.1
- See Also:
-
queryConfiguration
@NotNull public FeatureLayer.Builder queryConfiguration(@NotNull FeatureQueryConfiguration configuration) throws NullPointerException Sets the query configuration to use.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.
- Parameters:
configuration
- the query configuration. Cannot benull
.- Returns:
- this builder
- Throws:
NullPointerException
- when the given query configuration isnull
-
model
@NotNull public FeatureLayer.Builder model(@NotNull IFeatureModel model) throws NullPointerException Sets the feature model of the layer.Calling this function is mandatory.
- Parameters:
model
- the feature model of the layer. Cannot benull
.- Returns:
- this builder.
- Throws:
NullPointerException
- when the given model isnull
.
-
loadingStrategy
@NotNull public FeatureLayer.Builder loadingStrategy(@NotNull FeatureLayerLoadingStrategy loadingStrategy) Sets theFeatureLayerLoadingStrategy
to use.This method is optional. If a loading strategy is not explicitly configured, the
LoadSpatially
strategy is used. It tries to use theLoadSpatially
strategy first. If that strategy is not supported for the layer's model, theLoadEverything
strategy is used as fallback.- Parameters:
loadingStrategy
- the loading strategy to use.- Returns:
- this builder
- Since:
- 2023.0.02
-