Class FeatureQueryConfiguration.Builder
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
FeatureQueryConfiguration
Builder
for the FeatureQueryConfiguration
class.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddCondition
(MapScale minScale, MapScale maxScale, Expression condition) Defines an expression that is used when querying the model for a certain scale range of the map.build()
Creates aFeatureQueryConfiguration
based on the conditions added to this builder.void
close()
protected void
finalize()
By calling this method, the layer will load nothing when no condition set byaddCondition
is applicable for the current scale level.nonDefinedScales
(Expression condition) Defines the model query condition that is used when no condition set byaddCondition
is applicable for the current scale level of the map.
-
Constructor Details
-
Builder
-
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
build
Creates aFeatureQueryConfiguration
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 withnonDefinedScales
orloadNothingForNonDefinedScales
.- Parameters:
minScale
- the minimum scale (inclusive).maxScale
- the maximum scale (exclusive).condition
- the condition to be used for the given scale range. UseExpressionFactory
for creating conditions.- Returns:
- this builder.
- Throws:
IllegalArgumentException
- if the minimum scale is larger than the maximum scale.
-
nonDefinedScales
Defines the model query condition that is used when no condition set byaddCondition
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
By calling this method, the layer will load nothing when no condition set byaddCondition
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.
-