Class FeatureLayer.Builder

java.lang.Object
com.luciad.layers.features.FeatureLayer.Builder
All Implemented Interfaces:
AutoCloseable
Enclosing class:
FeatureLayer

public static final class FeatureLayer.Builder extends Object implements AutoCloseable
Builder for the FeatureLayer class.
  • Constructor Details Link icon

  • Method Details Link icon

    • finalize Link icon

      protected void finalize()
      Overrides:
      finalize in class Object
    • close Link icon

      public void close()
      Specified by:
      close in interface AutoCloseable
    • build Link icon

      @NotNull public FeatureLayer build() throws IllegalStateException
      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 Link icon

      @NotNull public FeatureLayer.Builder painter(@NotNull IFeaturePainter featurePainter) throws NullPointerException
      Sets the 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.

      Parameters:
      featurePainter - the feature painter used to paint the feature model. Cannot be null.
      Returns:
      this builder.
      Throws:
      NullPointerException - when the given feature painter is null
    • title Link icon

      @NotNull public FeatureLayer.Builder title(@NotNull String 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 Link icon

      @NotNull public FeatureLayer.Builder visible(boolean visible)
      Sets whether the layer should be visible initially.

      Default is true.

      Parameters:
      visible - the visibility.
      Returns:
      this builder.
    • editConfiguration Link icon

      @NotNull public FeatureLayer.Builder editConfiguration(@NotNull IFeatureEditConfiguration editConfiguration) throws NullPointerException
      Enables editing capabilities using the given 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:

      Parameters:
      editConfiguration - the feature edit configuration used to edit the feature model. Cannot be null.
      Returns:
      this builder.
      Throws:
      NullPointerException - when the given edit configuration is null
    • editCreateGeometryProvider Link icon

      @NotNull public FeatureLayer.Builder editCreateGeometryProvider(@NotNull IFeatureGeometryProvider geometryProvider) throws NullPointerException
      Provides the edit/create geometry provider for a 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

      Parameters:
      geometryProvider - the edit geometry provider for the current Feature. Cannot be null.
      Returns:
      this
      Throws:
      NullPointerException - when the given geometry provider is null
    • editable Link icon

      @NotNull public FeatureLayer.Builder editable(boolean 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 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.

      Parameters:
      editable - the edit capability.
      Returns:
      this builder.
      See Also:
    • labeled Link icon

      @NotNull public FeatureLayer.Builder labeled(boolean 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 Link icon

      @NotNull public FeatureLayer.Builder queryable(boolean queryable)
      Sets whether the features in this layer can be returned in the Map#queryFeatures method.

      The default is true.

      Parameters:
      queryable - whether the features in this layer can be returned in the Map#queryFeatures method.
      Returns:
      this builder
      Since:
      2023.1
      See Also:
    • queryConfiguration Link icon

      @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 be null.
      Returns:
      this builder
      Throws:
      NullPointerException - when the given query configuration is null
    • model Link icon

      @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 be null.
      Returns:
      this builder.
      Throws:
      NullPointerException - when the given model is null.
    • loadingStrategy Link icon

      @NotNull public FeatureLayer.Builder loadingStrategy(@NotNull FeatureLayerLoadingStrategy loadingStrategy)
      Sets the 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.

      Parameters:
      loadingStrategy - the loading strategy to use.
      Returns:
      this builder
      Since:
      2023.0.02