LuciadCPillar 2023.1.04
luciad::FeatureQueryConfiguration::Builder Class Referencefinal

Builder for the luciad::FeatureQueryConfiguration class. More...

#include <luciad/layers/features/FeatureQueryConfiguration.h>

Public Member Functions

 Builder (Builder &&other) noexcept
 
 Builder (const Builder &other)
 
 ~Builder ()
 
BuilderaddCondition (MapScale minScale, MapScale maxScale, const luciad::Expression &condition)
 Defines an expression that is used when querying the model for a certain scale range of the map. More...
 
std::shared_ptr< FeatureQueryConfigurationbuild () const
 Creates a FeatureQueryConfiguration based on the conditions added to this builder. More...
 
BuilderloadNothingForNonDefinedScales ()
 By calling this method, the layer will load nothing when no condition set by addCondition is applicable for the current scale level. More...
 
BuildernonDefinedScales (const luciad::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. More...
 
Builderoperator= (Builder other) noexcept
 

Detailed Description

Constructor & Destructor Documentation

◆ Builder() [1/2]

luciad::FeatureQueryConfiguration::Builder::Builder ( const Builder other)

◆ Builder() [2/2]

luciad::FeatureQueryConfiguration::Builder::Builder ( Builder &&  other)
noexcept

◆ ~Builder()

luciad::FeatureQueryConfiguration::Builder::~Builder ( )

Member Function Documentation

◆ addCondition()

Builder & luciad::FeatureQueryConfiguration::Builder::addCondition ( MapScale  minScale,
MapScale  maxScale,
const luciad::Expression condition 
)

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
minScalethe minimum scale (inclusive).
maxScalethe maximum scale (exclusive).
conditionthe condition to be used for the given scale range. Use luciad::ExpressionFactory for creating conditions.
Returns
this builder.
Exceptions
InvalidArgumentExceptionif the minimum scale is larger than the maximum scale.

◆ build()

std::shared_ptr< FeatureQueryConfiguration > luciad::FeatureQueryConfiguration::Builder::build ( ) const

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.

◆ loadNothingForNonDefinedScales()

Builder & luciad::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.

◆ nonDefinedScales()

Builder & luciad::FeatureQueryConfiguration::Builder::nonDefinedScales ( const luciad::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
conditionthe condition to be used for scale levels for which no other conditions were explicitly specified.
Returns
this builder.

◆ operator=()

Builder & luciad::FeatureQueryConfiguration::Builder::operator= ( Builder  other)
noexcept