Class FeatureLayer

java.lang.Object
com.luciad.layers.Layer
com.luciad.layers.features.FeatureLayer
All Implemented Interfaces:
AutoCloseable

public final class FeatureLayer extends Layer implements AutoCloseable
A layer for feature models.

Use FeatureLayer#newBuilder to create a feature layer instance.

  • Field Details Link icon

    • PropertyEditable Link icon

      public static final String PropertyEditable
      Returns the property name for the LayerEvent that is fired as a result of changing the layer's editable flag.
      See Also:
    • PropertyLabeled Link icon

      public static final String PropertyLabeled
      Returns the property name for the LayerEvent that is fired as a result of changing the layer's labeled flag.
      See Also:
    • PropertyQueryable Link icon

      public static final String PropertyQueryable
      Returns the property name for the LayerEvent that is fired as a result of changing the layer's queryable flag.
      Since:
      2023.1
      See Also:
    • PropertyPainter Link icon

      public static final String PropertyPainter
      Returns the property name for the LayerEvent that is fired as a result of changing the layer's IFeaturePainter.
      Since:
      2023.1
      See Also:
    • PropertyDensitySettings Link icon

      public static final String PropertyDensitySettings
      Returns the property name for the LayerEvent that is fired as a result of changing the layer's DensitySettings.
      Since:
      2024.1
      See Also:
  • Method Details Link icon

    • finalize Link icon

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

      public void close()
      Specified by:
      close in interface AutoCloseable
      Overrides:
      close in class Layer
    • newBuilder Link icon

      @NotNull public static FeatureLayer.Builder newBuilder()
      Returns a new builder for creating a FeatureLayer.
      Returns:
      a new builder for creating a FeatureLayer.
    • asBuilder Link icon

      @NotNull public FeatureLayer.Builder asBuilder()
      Returns a new builder based on this layer instance.

      You can use this builder, for example, to create a copy of this layer.

      Note that this function will not make copies of the used IFeatureModel or IFeaturePainter, but use the same instances that are present on this layer. You need to make sure that these are thread-safe and can handle concurrent usage.

      Also note that observers will not be transferred to a new layer.

      Returns:
      a new builder based on this layer instance.
      Since:
      2024.1.03
    • getModel Link icon

      @NotNull public IFeatureModel getModel()
      Returns the layer's model, which provides the features to present.
      Returns:
      the layer's model, which provides the features to present.
    • getPainter Link icon

      @NotNull public IFeaturePainter getPainter()
      Returns the layer's painter, which determines how the features are presented.
      Returns:
      the layer's painter, which determines how the features are presented.
    • setPainter Link icon

      public void setPainter(@NotNull IFeaturePainter featurePainter) throws NullPointerException, IllegalArgumentException
      Sets the layer's painter, which determines how the features are presented.

      It will replace the IFeaturePainter that was set using the FeatureLayer.Builder#painter method, or if that method was not called, it will replace the default feature painter.

      Limitation: This method currently only supports setting a new IFeaturePainter with the exact same level of details as the previous painter. If this is not the case, this method will throw an exception.

      Parameters:
      featurePainter - the feature painter used to paint the feature model. Cannot be null.
      Throws:
      NullPointerException - when the given feature painter is null
      IllegalArgumentException - when the new painter has different detail levels than the previous painter
      Since:
      2023.1
    • getQueryConfiguration Link icon

      @NotNull public FeatureQueryConfiguration getQueryConfiguration()
      Returns the query configuration, which specifies which feature to present at different map scales.
      Returns:
      the query configuration, which specifies which feature to present at different map scales.
    • getEditConfiguration Link icon

      @Nullable public IFeatureEditConfiguration getEditConfiguration()
      Returns the edit configuration if editing is supported, or null.

      Whether or not the layer can be edited by the user is controlled using setEditable.

      Returns:
      the edit configuration, if editing is supported.
      See Also:
    • getEditCreateGeometryProvider Link icon

      @NotNull public IFeatureGeometryProvider getEditCreateGeometryProvider()
      Returns the edit/create geometry provider for a Feature.
      Returns:
      the edit/create geometry provider for a Feature.
      See Also:
    • getDensitySettings Link icon

      @Nullable public DensitySettings getDensitySettings()
      Returns the currently set density settings, or null if density painting is not active.
      Returns:
      the currently set density settings, or null if density painting is not active.
      Since:
      2024.1
    • setDensitySettings Link icon

      public void setDensitySettings(@Nullable DensitySettings densitySettings)
      Sets the layer's density settings.

      Can be set to null to 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.
      Since:
      2024.1
      See Also:
    • isEditable Link icon

      public boolean isEditable()
      Returns whether this layer is editable.

      A layer is editable if it has an IFeatureEditConfiguration and if the editable flag is set.

      Returns:
      whether this layer is editable.
      See Also:
    • setEditable Link icon

      public void setEditable(boolean editable)
      Sets whether this layer is editable.

      If the new value is different from the old one, a LayerEvent is delivered to the observers with the property name FeatureLayer#propertyEditable.

      This flag is checked by the Editor when receiving events from the IFeatureEditCandidateProvider in conjunction with the model's IFeatureModelUpdater and the layer's IFeatureEditConfiguration.

      This flag is true by default. This flag has no effect if the layer does not contain an IFeatureEditConfiguration or if the model's IFeatureModelUpdater is missing.

      Parameters:
      editable - the new value for this property
    • isLabeled Link icon

      public boolean isLabeled()
      Returns whether this layer displays labels.
      Returns:
      whether this layer displays labels.
    • setLabeled Link icon

      public void setLabeled(boolean labeled)
      Sets whether this layer displays labels.

      Note that in order for the layer to display labels, its IFeaturePainter should also call the FeatureCanvas#drawLabel method for its features. If not, no labels will be displayed, regardless of this setting.

      Parameters:
      labeled - true to enable labels.
    • isQueryable Link icon

      public boolean isQueryable()
      Returns whether the features of this layer can be returned in the Map#queryFeatures method.
      Returns:
      whether the features of this layer can be returned in the Map#queryFeatures method.
      Since:
      2023.1
    • setQueryable Link icon

      public void setQueryable(boolean queryable)
      Sets whether the features of this layer can be returned in the Map#queryFeatures method.

      The default is true.

      It is useful to set this property to false when:

      • you don't want features to be selected or set to the hovered state by the SelectEventHandler or HoverEventHandler classes.
      • there is a performance issue with the Map#queryFeatures method, for example for a layer with many features that don't need to be selected.
      Parameters:
      queryable - whether the features of this layer can be returned in the Map#queryFeatures method
      Since:
      2023.1
    • getLoadingStrategy Link icon

      @NotNull public FeatureLayerLoadingStrategy getLoadingStrategy()
      Returns the loading strategy that is used.
      Returns:
      the loading strategy that is used.
      Since:
      2023.0.02
      See Also:
    • hashCode Link icon

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals Link icon

      public boolean equals(@Nullable Object other)
      Overrides:
      equals in class Object