LuciadCPillar 2023.1.04
luciad::DefaultFeatureGeometryProvider Class Referencefinal

Default geometry provider that works for Features with a DataType using a GeometryDataAnnotation. More...

#include <luciad/models/features/DefaultFeatureGeometryProvider.h>

Inheritance diagram for luciad::DefaultFeatureGeometryProvider:
luciad::IFeatureGeometryProvider

Public Member Functions

std::optional< FeatureapplyGeometry (Feature originalFeature, std::shared_ptr< Geometry > newGeometry) override
 Updates the original Feature using the modified Geometry, and returns it. More...
 
std::shared_ptr< GeometrygetGeometry (const Feature &feature) override
 Return the geometry for a Feature (for example a Geometry using which a Geometry can be edited or created). More...
 
- Public Member Functions inherited from luciad::IFeatureGeometryProvider
virtual ~IFeatureGeometryProvider ()=default
 
virtual std::optional< FeatureapplyGeometry (Feature originalFeature, std::shared_ptr< Geometry > newGeometry)=0
 Updates the original Feature using the modified Geometry, and returns it. More...
 
virtual std::shared_ptr< GeometrygetGeometry (const Feature &feature)=0
 Return the geometry for a Feature (for example a Geometry using which a Geometry can be edited or created). More...
 

Detailed Description

Default geometry provider that works for Features with a DataType using a GeometryDataAnnotation.

It is implemented as follows:

This class should not be used when:

  • The geometry of the feature is not exposed using Feature::findGeometry. The geometry isn't an explicit part of the feature, for example, but you can derive it from other properties on the feature.
  • The returned geometry is not the same as the geometry exposed by Feature::findGeometry. It can be useful to display a distinct geometry when a user edits a feature. For example, when users edit the location and orientation of a vessel, you can show an Ellipse, which also has a location and an orientation.
  • The feature has properties that are derived from the geometry. A simple example is a feature that has a Geometry property, and a property with the length of that geometry. When the Geometry property changes, the length property needs to change as well. You can do so by providing a custom implementation of IFeatureGeometryProvider::applyGeometry that changes the geometry, but also changes the length property.

In these cases, a custom IFeatureGeometryProvider implementation needs to be used.

Since
2020.1

Member Function Documentation

◆ applyGeometry()

std::optional< Feature > luciad::DefaultFeatureGeometryProvider::applyGeometry ( Feature  originalFeature,
std::shared_ptr< Geometry newGeometry 
)
overridevirtual

Updates the original Feature using the modified Geometry, and returns it.

This Geometry is not necessarily the same geometry as the one used for painting. See IFeatureGeometryProvider for an example.

Parameters
originalFeaturethe original Feature
newGeometrya new Geometry to apply on the Feature
Returns
a new Feature, based on a modified Geometry

Implements luciad::IFeatureGeometryProvider.

◆ getGeometry()

std::shared_ptr< Geometry > luciad::DefaultFeatureGeometryProvider::getGeometry ( const Feature feature)
overridevirtual

Return the geometry for a Feature (for example a Geometry using which a Geometry can be edited or created).

This Geometry is not necessarily the same geometry as the one used for painting.

See IFeatureGeometryProvider for more information.

Parameters
featurethe Feature to edit
Returns
the Geometry using which a Feature can be edited, or nullptr if the Feature can not be edited using a Geometry

Implements luciad::IFeatureGeometryProvider.