Class FeatureQueryConfiguration.Builder

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

public static final class FeatureQueryConfiguration.Builder extends Object implements AutoCloseable
  • Constructor Details

  • Method Details

    • finalize

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

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

      @NotNull public FeatureQueryConfiguration build()
      Creates a FeatureQueryConfiguration based on the conditions added to this builder.

      If no conditions were added to this builder, a configuration is built that accepts all features for all map scales.

      Returns:
      the configuration.
    • addCondition

      @NotNull public FeatureQueryConfiguration.Builder addCondition(@NotNull MapScale minScale, @NotNull MapScale maxScale, @NotNull Expression condition) throws IllegalArgumentException
      Defines an expression that is used when querying the model for a certain scale range of the map.

      This information is used by the layer to only query relevant data from the model when painting at a certain scale level. For example, when the map is zoomed out a lot, it makes sense to filter out smaller features, thereby reducing the amount of data that is loaded and painted.

      The scales are expressed in a unit-less scale. For example, specifying a scale of "1/5000" means that one centimetre on the map equals 5000 centimetres in reality. Valid scale values go from 0 (fully zoomed out) to DBL_MAX (fully zoomed in).

      This method can be called multiple times, in order to define different conditions for different scale ranges. Scale ranges are allowed to overlap. If multiple conditions apply to a certain scale level, the layer will combine them in an OR condition. When no conditions are defined for a certain scale range, the layer will by default load all data. You can change this default behaviour with nonDefinedScales or loadNothingForNonDefinedScales.

      Parameters:
      minScale - the minimum scale (inclusive).
      maxScale - the maximum scale (exclusive).
      condition - the condition to be used for the given scale range. Use ExpressionFactory for creating conditions.
      Returns:
      this builder.
      Throws:
      IllegalArgumentException - if the minimum scale is larger than the maximum scale.
    • nonDefinedScales

      @NotNull public FeatureQueryConfiguration.Builder nonDefinedScales(@NotNull Expression condition)
      Defines the model query condition that is used when no condition set by addCondition is applicable for the current scale level of the map.

      By default, this is an always-true expression, which means the layer will load everything in this case. Calling this method multiple times will simply overwrite the previously set expression.

      Parameters:
      condition - the condition to be used for scale levels for which no other conditions were explicitly specified.
      Returns:
      this builder.
    • loadNothingForNonDefinedScales

      @NotNull public FeatureQueryConfiguration.Builder loadNothingForNonDefinedScales()
      By calling this method, the layer will load nothing when no condition set by addCondition is applicable for the current scale level.

      This is a convenience method that has the same effect as calling nonDefinedScales with an always-false expression.

      Returns:
      this builder.