LuciadCPillar 2023.1.04
luciad::CompositeGeometryHandlesProvider Class Referencefinal

A composite implementation of IGeometryHandlesProvider. More...

#include <luciad/edit/geometries/CompositeGeometryHandlesProvider.h>

Inheritance diagram for luciad::CompositeGeometryHandlesProvider:
luciad::IGeometryHandlesProvider

Public Member Functions

 CompositeGeometryHandlesProvider ()
 Creates an empty composite instance. More...
 
 ~CompositeGeometryHandlesProvider () override
 
void add (std::shared_ptr< IGeometryHandlesProvider > handlesProvider, Priority priority=Priority::normal())
 Adds the given instance to the list of registered instances with the given priority. More...
 
bool canProvide (const std::shared_ptr< Observable< std::shared_ptr< Geometry > > > &geometry, const std::shared_ptr< FeatureEditContext > &context) const override
 Indicates if this handles provider can create handles for the given geometry. More...
 
std::vector< std::shared_ptr< IGeometryHandlesProvider > > getList () const
 
std::shared_ptr< IEditHandlesprovide (std::shared_ptr< Observable< std::shared_ptr< Geometry > > > geometry, const std::shared_ptr< FeatureEditContext > &context, std::shared_ptr< IGeometryEditCallback > geometryEditCallback) const override
 Returns the handles for the given feature. More...
 
std::shared_ptr< ITranslateEditActionprovideTranslateAction (std::shared_ptr< Observable< std::shared_ptr< Geometry > > > geometry, const std::shared_ptr< FeatureEditContext > &context, std::shared_ptr< IGeometryEditCallback > geometryEditCallback) const override
 Provides a translate action that can be used by the caller to add translation behavior. More...
 
void remove (const std::shared_ptr< IGeometryHandlesProvider > &handlesProvider)
 Removes this given instance from the list of registered instances. More...
 
- Public Member Functions inherited from luciad::IGeometryHandlesProvider
virtual ~IGeometryHandlesProvider ()=default
 
virtual bool canProvide (const std::shared_ptr< Observable< std::shared_ptr< Geometry > > > &geometry, const std::shared_ptr< FeatureEditContext > &context) const =0
 Indicates if this handles provider can create handles for the given geometry. More...
 
virtual std::shared_ptr< IEditHandlesprovide (std::shared_ptr< Observable< std::shared_ptr< Geometry > > > geometry, const std::shared_ptr< FeatureEditContext > &context, std::shared_ptr< IGeometryEditCallback > geometryEditCallback) const =0
 Returns the handles for the given feature. More...
 
virtual std::shared_ptr< ITranslateEditActionprovideTranslateAction (std::shared_ptr< Observable< std::shared_ptr< Geometry > > > geometry, const std::shared_ptr< FeatureEditContext > &context, std::shared_ptr< IGeometryEditCallback > geometryEditCallback) const =0
 Provides a translate action that can be used by the caller to add translation behavior. More...
 

Static Public Member Functions

static std::shared_ptr< CompositeGeometryHandlesProvidercreateDefault ()
 Creates a a composite instance with a default set of instances that can handle the following geometries: More...
 

Detailed Description

A composite implementation of IGeometryHandlesProvider.

This composite allows you to:

The composite implementation uses its delegate instances in a specific order. The order is based on the priority you assign when you add the delegate instance. If the priorities of two instances are equal, the instance that you added first gets priority.

A default implementation is available, see createDefault.

Since
2020.1

Constructor & Destructor Documentation

◆ CompositeGeometryHandlesProvider()

luciad::CompositeGeometryHandlesProvider::CompositeGeometryHandlesProvider ( )

Creates an empty composite instance.

◆ ~CompositeGeometryHandlesProvider()

luciad::CompositeGeometryHandlesProvider::~CompositeGeometryHandlesProvider ( )
override

Member Function Documentation

◆ add()

void luciad::CompositeGeometryHandlesProvider::add ( std::shared_ptr< IGeometryHandlesProvider handlesProvider,
Priority  priority = Priority::normal() 
)

Adds the given instance to the list of registered instances with the given priority.

If you want to remove an instance again, use CompositeGeometryHandlesProvider::remove.

Parameters
handlesProvidera new instance to register, cannot be nullptr
prioritya priority. The default is PriorityDefault.
Exceptions
NullArgumentExceptionwhen nullptr is passed.

◆ canProvide()

bool luciad::CompositeGeometryHandlesProvider::canProvide ( const std::shared_ptr< Observable< std::shared_ptr< Geometry > > > &  geometry,
const std::shared_ptr< FeatureEditContext > &  context 
) const
overridevirtual

Indicates if this handles provider can create handles for the given geometry.

Parameters
geometryan observable geometry, cannot be nullptr
contextthe context. Contains additional information about the edited feature, cannot be nullptr.
Returns
if this handles provider can provide handles and a translate action for the given Feature

Implements luciad::IGeometryHandlesProvider.

◆ createDefault()

static std::shared_ptr< CompositeGeometryHandlesProvider > luciad::CompositeGeometryHandlesProvider::createDefault ( )
static

Creates a a composite instance with a default set of instances that can handle the following geometries:

Returns
a composite instance with a default set of instances. These instances are registered using CompositeGeometryHandlesProvider::PriorityDefault.

◆ getList()

std::vector< std::shared_ptr< IGeometryHandlesProvider > > luciad::CompositeGeometryHandlesProvider::getList ( ) const
Returns
a list containing all registered instances, ordered by priority (highest priority first).

◆ provide()

std::shared_ptr< IEditHandles > luciad::CompositeGeometryHandlesProvider::provide ( std::shared_ptr< Observable< std::shared_ptr< Geometry > > >  geometry,
const std::shared_ptr< FeatureEditContext > &  context,
std::shared_ptr< IGeometryEditCallback geometryEditCallback 
) const
overridevirtual

Returns the handles for the given feature.

Note: translation of features is handled by IFeatureHandlesProvider. So geometry handles providers should not provide handles to translate a geometry.

Parameters
geometrythe observable geometry for which to provide handles, cannot be nullptr.
contextthe context. Contains additional information about the edited feature, cannot be nullptr.
geometryEditCallbacka callback that notifies the caller when the Feature has changed, cannot be nullptr.
Returns
handles for the given feature. Never nullptr.

Implements luciad::IGeometryHandlesProvider.

◆ provideTranslateAction()

std::shared_ptr< ITranslateEditAction > luciad::CompositeGeometryHandlesProvider::provideTranslateAction ( std::shared_ptr< Observable< std::shared_ptr< Geometry > > >  geometry,
const std::shared_ptr< FeatureEditContext > &  context,
std::shared_ptr< IGeometryEditCallback geometryEditCallback 
) const
overridevirtual

Provides a translate action that can be used by the caller to add translation behavior.

A translation handle is typically added by an IFeatureHandlesProvider, like for example the FeatureHandlesProvider implementation. It calls this method to retrieve a translate action, and uses it to create a TranslateEditHandle.

When ITranslateEditAction::translate is called, the returned implementation must:

Parameters
geometrythe observable geometry for which to provide a translate action, cannot be nullptr
contextthe context, cannot be nullptr
geometryEditCallbacka callback that notifies the caller of this method when a translation has occurred, cannot be nullptr
Returns
a translate action. Never nullptr.

Implements luciad::IGeometryHandlesProvider.

◆ remove()

void luciad::CompositeGeometryHandlesProvider::remove ( const std::shared_ptr< IGeometryHandlesProvider > &  handlesProvider)

Removes this given instance from the list of registered instances.

Nothing will happen if the given instance was never added before.

Parameters
handlesProviderthe instance to remove from this composite, cannot be nullptr.
Exceptions
NullArgumentExceptionwhen nullptr is passed.