LuciadCPillar 2024.0.04
|
This provider can create handles to edit Polyline
geometries.
More...
#include <luciad/edit/geometries/PolylineHandlesProvider.h>
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< IPolylineConstraint > | getConstraint () const |
Returns the constraint that is applied to the handles' edit actions. More... | |
std::shared_ptr< IHandleFactory > | getHandleFactory () const |
Returns the handle factory used by the handles provider. More... | |
size_t | getMaxPointCount () const |
Returns the maximum number of points a polyline can have. More... | |
size_t | getMinPointCount () const |
Returns the minimum number of points a polyline can have. More... | |
std::shared_ptr< IEditHandles > | provide (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< ITranslateEditAction > | provideTranslateAction (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' edit actions. More... | |
void | setHandleFactory (std::shared_ptr< IHandleFactory > handleFactory) |
Sets the handle factory used by the handles provider. 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< IEditHandles > | provide (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< ITranslateEditAction > | provideTranslateAction (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... | |
This provider can create handles to edit Polyline
geometries.
It offer the following handles:
move point
handlesinsert point
handlesprepend point
handleappend point
handleremove point
handleselevation point
handles. Note that the default implementation of PointHandlesProvider::IHandleFactory
automatically omits these handles on a 2D map, or on a 3D map for polylines without elevation.Note: the handle to translate the entire feature is typically created by the IFeatureHandlesProvider
. FeatureHandlesProvider
does this by default.
luciad::PolylineHandlesProvider::PolylineHandlesProvider | ( | ) |
Creates a new handles provider that can create handles to modify Polyline geometries.
|
override |
|
overridevirtual |
Indicates if this handles provider can create handles for the given geometry.
geometry | an observable geometry, cannot be nullptr |
context | the context. Contains additional information about the edited feature, cannot be nullptr . |
Implements luciad::IGeometryHandlesProvider.
std::shared_ptr< IPolylineConstraint > luciad::PolylineHandlesProvider::getConstraint | ( | ) | const |
Returns the constraint that is applied to the handles' edit actions.
Can be nullptr
if no constraint is set.
nullptr
if no constraint is set. std::shared_ptr< IHandleFactory > luciad::PolylineHandlesProvider::getHandleFactory | ( | ) | const |
Returns the handle factory used by the handles provider.
size_t luciad::PolylineHandlesProvider::getMaxPointCount | ( | ) | const |
Returns the maximum number of points a polyline can have.
size_t luciad::PolylineHandlesProvider::getMinPointCount | ( | ) | const |
Returns the minimum number of points a polyline can have.
|
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.
geometry | the observable geometry for which to provide handles, cannot be nullptr . |
context | the context. Contains additional information about the edited feature, cannot be nullptr . |
geometryEditCallback | a callback that notifies the caller when the Feature has changed, cannot be nullptr . |
nullptr
. Implements luciad::IGeometryHandlesProvider.
|
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:
IGeometryEditCallback
with the resulting geometrygeometry | the observable geometry for which to provide a translate action, cannot be nullptr |
context | the context, cannot be nullptr |
geometryEditCallback | a callback that notifies the caller of this method when a translation has occurred, cannot be nullptr |
nullptr
. Implements luciad::IGeometryHandlesProvider.
void luciad::PolylineHandlesProvider::setConstraint | ( | std::shared_ptr< IPolylineConstraint > | constraint | ) |
Sets the constraint that is applied to the handles' edit actions.
They always call this constraint with a PolylineChange
, describing a single change. More specifically:
Move point handles
and elevation point handles
provide a PolylineChange
containing one moved point index
.Insert point handles
and the prepend
or append
point handle provide a PolylineChange
containing one inserted point index
.Remove point handles
provide a PolylineChange
containing one removed point index
.constraint | the constraint that is applied to the handles' edit actions, or nullptr if no constraint should be applied. |
void luciad::PolylineHandlesProvider::setHandleFactory | ( | std::shared_ptr< IHandleFactory > | handleFactory | ) |
Sets the handle factory used by the handles provider.
If this method is not called, a default handle factory is used. You can change the behavior of this default handle factory by:
IHandleFactory
implementation, by delegating to the default factoryhandleFactory | a handle factory |
NullArgumentException | when nullptr is passed. |
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".
maxPointCount | the maximum number of points allowed. |
InvalidArgumentException | if maxPointCount is lower than the current min point count . |
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.
minPointCount | the minimum number of points allowed. |
InvalidArgumentException | if minPointCount is lower than 2, or higher than the current maximum point count . |