LuciadCPillar 2023.1.03
luciad::PolylineHandlesProvider Class Referencefinal

This provider can create handles to edit Polyline geometries. More...

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

Inheritance diagram for luciad::PolylineHandlesProvider:
luciad::IGeometryHandlesProvider

Classes

class  IHandleFactory
 Allows you to specify which handles are used by this handles provider. More...
 

Public Member Functions

 PolylineHandlesProvider ()
 Creates a new handles provider that can create handles to modify Polyline geometries. More...
 
 ~PolylineHandlesProvider () override
 
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::shared_ptr< IPolylineConstraintgetConstraint () const
 
std::shared_ptr< IHandleFactorygetHandleFactory () const
 
size_t getMaxPointCount () const
 
size_t getMinPointCount () 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 setConstraint (std::shared_ptr< IPolylineConstraint > constraint)
 Sets the constraint that is applied to the handles created by this handles provider. More...
 
void setHandleFactory (std::shared_ptr< IHandleFactory > handleFactory)
 Sets the IHandleFactory that is used by this handles provider to create new handles. More...
 
void setMaxPointCount (size_t maxPointCount)
 Sets the maximum number of points a polyline can have. More...
 
void setMinPointCount (size_t minPointCount)
 Sets the minimum number of points a polyline can have. 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...
 

Detailed Description

This provider can create handles to edit Polyline geometries.

It offer the following handles:

Note: the handle to translate the entire feature is typically created by the IFeatureHandlesProvider. FeatureHandlesProvider does this by default.

Since
2020.1

Constructor & Destructor Documentation

◆ PolylineHandlesProvider()

luciad::PolylineHandlesProvider::PolylineHandlesProvider ( )

Creates a new handles provider that can create handles to modify Polyline geometries.

◆ ~PolylineHandlesProvider()

luciad::PolylineHandlesProvider::~PolylineHandlesProvider ( )
override

Member Function Documentation

◆ canProvide()

bool luciad::PolylineHandlesProvider::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.

◆ getConstraint()

std::shared_ptr< IPolylineConstraint > luciad::PolylineHandlesProvider::getConstraint ( ) const
Returns
constraint the constraint that is applied to the handles' edit actions, or nullptr if no constraint is set.

◆ getHandleFactory()

std::shared_ptr< IHandleFactory > luciad::PolylineHandlesProvider::getHandleFactory ( ) const
Returns
the handle factory used by the handles provider

◆ getMaxPointCount()

size_t luciad::PolylineHandlesProvider::getMaxPointCount ( ) const
Returns
the maximum number of points a polyline can have.
See also
setMaxPointCount

◆ getMinPointCount()

size_t luciad::PolylineHandlesProvider::getMinPointCount ( ) const
Returns
the minimum number of points a polyline can have.
See also
setMinPointCount

◆ provide()

std::shared_ptr< IEditHandles > luciad::PolylineHandlesProvider::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::PolylineHandlesProvider::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.

◆ setConstraint()

void luciad::PolylineHandlesProvider::setConstraint ( std::shared_ptr< IPolylineConstraint constraint)

Sets the constraint that is applied to the handles created by this handles provider.

They always call this constraint with a PolylineChange, describing a single change. More specifically:

Parameters
constraintthe constraint that is applied to the handles' edit actions, or nullptr if no constraint should be applied.

◆ setHandleFactory()

void luciad::PolylineHandlesProvider::setHandleFactory ( std::shared_ptr< IHandleFactory handleFactory)

Sets the IHandleFactory that is used by this handles provider to create new handles.

If this method is not called, a default handle factory is used. You can change the behavior of this default handle factory by:

  • retrieving it
  • wrapping it with your own IHandleFactory implementation, by delegating to the default factory
  • omitting/replacing one or more handles that are returned
Parameters
handleFactorya handle factory
Exceptions
NullArgumentExceptionwhen nullptr is passed.

◆ setMaxPointCount()

void luciad::PolylineHandlesProvider::setMaxPointCount ( size_t  maxPointCount)

Sets the maximum number of points a polyline can have.

If a polyline's point count is higher than or equal to this value, this handles provider will not provide handles to insert, prepend or append new points for that polyline. By default, this value is the maximum value of size_t, which realistically corresponds to "no maximum".

Parameters
maxPointCountthe maximum number of points allowed.
Exceptions
InvalidArgumentExceptionif maxPointCount is lower than the current min point count.

◆ setMinPointCount()

void luciad::PolylineHandlesProvider::setMinPointCount ( size_t  minPointCount)

Sets the minimum number of points a polyline can have.

If a polyline's point count is lower than or equal to this value, this handles provider will not provide handles to remove points from that polyline. By default, this value is 2.

Parameters
minPointCountthe minimum number of points allowed.
Exceptions
InvalidArgumentExceptionif minPointCount is lower than 2, or higher than the current maximum point count.