![]() |
LuciadCPillar 2024.1.05
|
A layer for feature models. More...
#include <luciad/layers/features/FeatureLayer.h>
Classes | |
class | Builder |
Builder for the luciad::FeatureLayer class. More... | |
Public Member Functions | |
~FeatureLayer () override | |
void | addObserver (std::shared_ptr< ILayerObserver > layerObserver) override |
Adds an observer that allows to receive change events from this layer. More... | |
Builder | asBuilder () const |
Returns a new builder based on this layer instance. More... | |
const std::optional< DensitySettings > & | getDensitySettings () const |
Returns the currently set density settings, or std::nullopt if density painting is not active. More... | |
std::shared_ptr< IFeatureEditConfiguration > | getEditConfiguration () const |
Returns the edit configuration if editing is supported, or nullptr . More... | |
std::shared_ptr< IFeatureGeometryProvider > | getEditCreateGeometryProvider () const |
Returns the edit/create geometry provider for a Feature. More... | |
FeatureLayerLoadingStrategy | getLoadingStrategy () const |
Returns the loading strategy that is used. More... | |
const std::shared_ptr< IFeatureModel > & | getModel () const |
Returns the layer's model, which provides the features to present. More... | |
const std::shared_ptr< IFeaturePainter > & | getPainter () const |
Returns the layer's painter, which determines how the features are presented. More... | |
const std::shared_ptr< FeatureQueryConfiguration > & | getQueryConfiguration () const |
Returns the query configuration, which specifies which feature to present at different map scales. More... | |
const std::string & | getTitle () const override |
Returns the layer's title. More... | |
bool | isBusy () const override |
Returns whether this layer is busy loading data, rendering, loading attributions, or anything else. More... | |
bool | isEditable () const |
Returns whether this layer is editable. More... | |
bool | isLabeled () const |
Returns whether this layer displays labels. More... | |
bool | isQueryable () const |
Returns whether the features of this layer can be returned in the Map::queryFeatures method. More... | |
bool | isVisible () const override |
Returns whether this layer is visible. More... | |
void | removeObserver (const std::shared_ptr< ILayerObserver > &layerObserver) override |
Removes the given observer. More... | |
void | setDensitySettings (std::optional< DensitySettings > densitySettings) |
Sets the layer's density settings. More... | |
void | setEditable (bool editable) |
Sets whether this layer is editable. More... | |
void | setLabeled (bool labeled) |
Sets whether this layer displays labels. More... | |
void | setPainter (std::shared_ptr< IFeaturePainter > featurePainter) |
Sets the layer's painter, which determines how the features are presented. More... | |
void | setQueryable (bool queryable) |
Sets whether the features of this layer can be returned in the Map::queryFeatures method. More... | |
void | setTitle (std::string title) override |
Sets the layer's title. More... | |
void | setVisible (bool visible) override |
Sets whether this layer is visible. More... | |
![]() | |
Layer () | |
Default constructor. More... | |
virtual | ~Layer ()=default |
virtual void | addObserver (std::shared_ptr< ILayerObserver > layerObserver)=0 |
Adds an observer that allows to receive change events from this layer. More... | |
virtual LayerId | getId () const |
Returns the layer's unique id. More... | |
virtual const std::string & | getTitle () const =0 |
Returns the layer's title. More... | |
virtual bool | isBusy () const =0 |
Returns whether this layer is busy loading data, rendering, loading attributions, or anything else. More... | |
virtual bool | isVisible () const =0 |
Returns whether this layer is visible. More... | |
virtual void | removeObserver (const std::shared_ptr< ILayerObserver > &layerObserver)=0 |
Removes the given observer. More... | |
virtual void | setTitle (std::string title)=0 |
Sets the layer's title. More... | |
virtual void | setVisible (bool visible)=0 |
Sets whether this layer is visible. More... | |
Static Public Member Functions | |
static Builder | newBuilder () |
Returns a new builder for creating a FeatureLayer. More... | |
static const std::string & | propertyDensitySettings () |
Returns the property name for the LayerEvent that is fired as a result of changing the layer's DensitySettings . More... | |
static const std::string & | propertyEditable () |
Returns the property name for the LayerEvent that is fired as a result of changing the layer's editable flag. More... | |
static const std::string & | propertyLabeled () |
Returns the property name for the LayerEvent that is fired as a result of changing the layer's labeled flag. More... | |
static const std::string & | propertyPainter () |
Returns the property name for the LayerEvent that is fired as a result of changing the layer's IFeaturePainter . More... | |
static const std::string & | propertyQueryable () |
Returns the property name for the LayerEvent that is fired as a result of changing the layer's queryable flag. More... | |
![]() | |
static const std::string & | propertyBusy () |
Property name for the LayerEvent that is fired as a result of the layer's busy flag changing. More... | |
static const std::string & | propertyTitle () |
Property name for the LayerEvent that is fired as a result of changing the layer's title. More... | |
static const std::string & | propertyVisible () |
Property name for the LayerEvent that is fired as a result of changing the layer's visible flag. More... | |
A layer for feature models.
Use luciad::FeatureLayer::newBuilder to create a feature layer instance.
|
override |
|
overridevirtual |
Adds an observer that allows to receive change events from this layer.
Adding the same observer twice is forbidden, and will cause an exception to be thrown.
layerObserver | an observer. |
luciad::InvalidArgumentException | when the observer was already added. |
luciad::NullArgumentException | when the observer is nullptr . |
Implements luciad::Layer.
Builder luciad::FeatureLayer::asBuilder | ( | ) | const |
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.
const std::optional< DensitySettings > & luciad::FeatureLayer::getDensitySettings | ( | ) | const |
Returns the currently set density settings, or std::nullopt
if density painting is not active.
std::nullopt
if density painting is not active. std::shared_ptr< IFeatureEditConfiguration > luciad::FeatureLayer::getEditConfiguration | ( | ) | const |
Returns the edit configuration if editing is supported, or nullptr
.
Whether or not the layer can be edited by the user is controlled using setEditable
.
std::shared_ptr< IFeatureGeometryProvider > luciad::FeatureLayer::getEditCreateGeometryProvider | ( | ) | const |
FeatureLayerLoadingStrategy luciad::FeatureLayer::getLoadingStrategy | ( | ) | const |
Returns the loading strategy that is used.
const std::shared_ptr< IFeatureModel > & luciad::FeatureLayer::getModel | ( | ) | const |
Returns the layer's model, which provides the features to present.
const std::shared_ptr< IFeaturePainter > & luciad::FeatureLayer::getPainter | ( | ) | const |
Returns the layer's painter, which determines how the features are presented.
const std::shared_ptr< FeatureQueryConfiguration > & luciad::FeatureLayer::getQueryConfiguration | ( | ) | const |
Returns the query configuration, which specifies which feature to present at different map scales.
|
overridevirtual |
Returns the layer's title.
Should be suitable for presenting to the user.
Implements luciad::Layer.
|
overridevirtual |
Returns whether this layer is busy loading data, rendering, loading attributions, or anything else.
When this property changes, a LayerEvent
is delivered to the observers with the property name propertyBusy
.
Note: when the map is moving around it can be that the layer is repeatedly loading new data, but does this fast enough that it is done by the time new data is needed, resulting in a repeatedly changing busyness state.
Implements luciad::Layer.
bool luciad::FeatureLayer::isEditable | ( | ) | const |
Returns whether this layer is editable.
A layer is editable if it has an IFeatureEditConfiguration
and if the editable flag is set.
bool luciad::FeatureLayer::isLabeled | ( | ) | const |
Returns whether this layer displays labels.
bool luciad::FeatureLayer::isQueryable | ( | ) | const |
Returns whether the features of this layer can be returned in the Map::queryFeatures
method.
Map::queryFeatures
method.
|
overridevirtual |
Returns whether this layer is visible.
Implements luciad::Layer.
|
static |
Returns a new builder for creating a FeatureLayer.
|
static |
Returns the property name for the LayerEvent that is fired as a result of changing the layer's DensitySettings
.
DensitySettings
.
|
static |
Returns the property name for the LayerEvent that is fired as a result of changing the layer's editable flag.
setEditable
|
static |
Returns the property name for the LayerEvent that is fired as a result of changing the layer's labeled flag.
setLabeled
|
static |
Returns the property name for the LayerEvent that is fired as a result of changing the layer's IFeaturePainter
.
IFeaturePainter
. setPainter
|
static |
Returns the property name for the LayerEvent that is fired as a result of changing the layer's queryable flag.
setQueryable
|
overridevirtual |
Removes the given observer.
If the given observer was never added, an exception is thrown.
layerObserver | an observer. |
luciad::InvalidArgumentException | when the observer is not known. |
luciad::NullArgumentException | when the observer is nullptr . |
Implements luciad::Layer.
void luciad::FeatureLayer::setDensitySettings | ( | std::optional< DensitySettings > | densitySettings | ) |
Sets the layer's density settings.
Can be set to std::nullopt
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
.
densitySettings | the density painting settings. |
DensitySettings
documentation for more information. void luciad::FeatureLayer::setEditable | ( | bool | 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.
editable | the new value for this property |
void luciad::FeatureLayer::setLabeled | ( | bool | 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.
labeled | true to enable labels. |
void luciad::FeatureLayer::setPainter | ( | std::shared_ptr< IFeaturePainter > | featurePainter | ) |
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.
featurePainter | the feature painter used to paint the feature model. Cannot be nullptr . |
luciad::NullArgumentException | when the given feature painter is nullptr |
luciad::InvalidArgumentException | when the new painter has different detail levels than the previous painter |
void luciad::FeatureLayer::setQueryable | ( | bool | 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:
luciad::SelectEventHandler
or luciad::HoverEventHandler
classes.Map::queryFeatures
method, for example for a layer with many features that don't need to be selected.queryable | whether the features of this layer can be returned in the Map::queryFeatures method |
|
overridevirtual |
Sets the layer's title.
Should be suitable for presenting to the user.
If the new title is indeed different from the old one, a LayerEvent is delivered to the observers with the property name PropertyTitle.
title | the new title. |
Implements luciad::Layer.
|
overridevirtual |
Sets whether this layer is visible.
Changes this layer's visibility. If the new visibility is different from the old one, a LayerEvent is delivered to the observers with the property name PropertyVisible.
visible | the new visibility. |
Implements luciad::Layer.