Class FeatureModelBuilder

java.lang.Object
com.luciad.models.features.FeatureModelBuilder
All Implemented Interfaces:
AutoCloseable

public final class FeatureModelBuilder extends Object implements AutoCloseable
Helps the creation of a IFeatureModel given a list of features, a model metadata, a feature model metadata and optionally a bounds.
  • Constructor Details

  • Method Details

    • finalize

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

      public void close()
      Specified by:
      close in interface AutoCloseable
    • newBuilder

      @NotNull public static FeatureModelBuilder newBuilder()
      Returns the builder class for creation of the IFeatureModel.
      Returns:
      the builder class for creation of the IFeatureModel.
    • build

      @NotNull public IFeatureModel build() throws IllegalStateException
      Creates a new in-memory IFeatureModel instance, based on the given model metadata, feature model metadata and the list of features.

      Depending on whether the editable flag was set, it is possible to add/remove or update the features of this model after it has been created.

      Returns:
      An in-memory IFeatureModel instance.
      Throws:
      IllegalStateException - If not all mandatory parameters are set.
    • bounds

      @NotNull public FeatureModelBuilder bounds(@NotNull Bounds bounds) throws NullPointerException
      Sets the bounds of the feature model.

      Calling this function is optional.

      If no bounds are provided, the model will attempt to derive the bounds by itself. It does so by calculating the union of the geometries of its features, as specified by Feature#findGeometry.

      Parameters:
      bounds - The model bounds. Cannot be null.
      Returns:
      this
      Throws:
      NullPointerException - when passing null.
    • featureModelMetadata

      @NotNull public FeatureModelBuilder featureModelMetadata(@NotNull FeatureModelMetadata featureModelMetadata)
      Sets the FeatureModelMetadata of the feature model.

      Calling this function is mandatory.

      Parameters:
      featureModelMetadata - The model feature model metadata.
      Returns:
      this
    • features

      @NotNull public FeatureModelBuilder features(@NotNull List<@NotNull Feature> features)
      Sets the features of the feature model.

      Calling this function is optional.

      The given features may or may not have an id assigned. If an id is missing, an id will be assigned to them by the resulting model.

      Parameters:
      features - The model features.
      Returns:
      this
    • modelMetadata

      @NotNull public FeatureModelBuilder modelMetadata(@NotNull ModelMetadata modelMetadata)
      Sets the ModelMetadata of the feature model.

      Calling this function is mandatory.

      Parameters:
      modelMetadata - The model metadata.
      Returns:
      this
    • editable

      @NotNull public FeatureModelBuilder editable(boolean editable)
      Sets whether the model should be editable or not.

      An editable model exposes an IFeatureModelUpdater, through which you can add, remove or update the model's features. Calling this function is optional. By default, this value is false.

      Parameters:
      editable - whether the model should be editable or not.
      Returns:
      this