Class FeatureLayer.Builder
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
FeatureLayer
Builder for the FeatureLayer class.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Returns a new layer, based on the properties set on this builder.voidclose()densitySettings(DensitySettings densitySettings) Sets the layer's density settings.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 voidfinalize()labeled(boolean labeled) Sets whether the layer should display labels initially.loadingStrategy(FeatureLayerLoadingStrategy loadingStrategy) Sets theFeatureLayerLoadingStrategyto use.model(IFeatureModel model) Sets the feature model of the layer.painter(IFeaturePainter featurePainter) Sets theIFeaturePainterto use.queryable(boolean queryable) Sets whether the features in this layer can be returned in theMap#queryFeaturesmethod.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
-
Builder
-
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
closein 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 theIFeaturePainterto 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
-
densitySettings
Sets the layer's density settings.Can be set to
nullto deactivate density painting.When density painting is active, the color map in the density settings is used to determine the colors of shapes drawn by the
IFeaturePainter.- Parameters:
densitySettings- the density painting settings.nullby default.- Returns:
- this builder.
- Since:
- 2024.1
- See Also:
-
title
Sets the title to use for the layer.If not set, the title from the
ModelMetadatais 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#getEditConfigurationwill returnnull. If set, editing will beenabledby 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
Featurecan 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
Featurehas aDataTypewith aGeometryDataAnnotationthat points to theGeometrythat can be edited - the changed
Geometrycan be applied by replacing thatGeometryproperty 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
trueas 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
editConfigurationfor 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#queryFeaturesmethod.The default is true.
- Parameters:
queryable- whether the features in this layer can be returned in theMap#queryFeaturesmethod.- 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 theFeatureLayerLoadingStrategyto use.This method is optional. If a loading strategy is not explicitly configured, the
LoadSpatiallystrategy is used. It tries to use theLoadSpatiallystrategy first. If that strategy is not supported for the layer's model, theLoadEverythingstrategy is used as fallback.- Parameters:
loadingStrategy- the loading strategy to use.- Returns:
- this builder
- Since:
- 2023.0.02
-