LuciadCPillar 2023.0
luciad::PointEditHandle Class Referencefinal

This handle represents a Point on the Map and can be visualized using an icon. More...

#include <luciad/edit/handles/PointEditHandle.h>

Inheritance diagram for luciad::PointEditHandle:
luciad::IEditHandle

Classes

class  IVisualAidProvider
 This interface allows to calculate a visual aid line based on the location of the handle. More...
 

Public Member Functions

 PointEditHandle (const PointEditHandle &other)=delete
 
 PointEditHandle (std::shared_ptr< Observable< std::shared_ptr< Point > > > locationProvider)
 Creates a new PointEditHandle without associated actions. More...
 
 PointEditHandle (std::shared_ptr< Point > initialLocation)
 Creates a new PointEditHandle without associated actions. More...
 
 ~PointEditHandle () override
 
EditActionBinderaddOnClickAction (std::shared_ptr< IPointEditAction > action, size_t clickCount)
 Adds an action that will be triggered when the handle is clicked or tapped (touch). More...
 
EditActionBinderaddOnDragAction (std::shared_ptr< IPointEditAction > action)
 Adds an action that will be triggered when the handle is dragged. More...
 
EditActionBinderaddOnMouseMoveAction (std::shared_ptr< IPointEditAction > action)
 Adds an action that will be executed on every mouse move. More...
 
EditActionBinderaddOnTouchLongPressAction (std::shared_ptr< IPointEditAction > action)
 Adds an action that will be triggered when a long press is performed on a handle. More...
 
std::shared_ptr< luciad::IIcongetActiveIcon () const
 
std::shared_ptr< luciad::LineStylegetActiveVisualAidLineStyle () const
 
EditHandleState getEditState () const override
 
std::shared_ptr< luciad::IIcongetHighlightedIcon () const
 
std::shared_ptr< luciad::LineStylegetHighlightedVisualAidLineStyle () const
 
std::shared_ptr< PointgetLocation () const
 Returns the current location of this handle. More...
 
std::shared_ptr< Observable< std::shared_ptr< Point > > > getLocationProvider () const
 Returns the location provider of this handle. More...
 
std::shared_ptr< Observable< std::shared_ptr< Point > > > getLocationProviderWhenActive () const
 
std::optional< MouseCursorgetMouseCursor () const override
 
EditMoveConstraint getMoveConstraint () const
 
std::shared_ptr< luciad::IIcongetRegularIcon () const
 
std::shared_ptr< luciad::LineStylegetRegularVisualAidLineStyle () const
 
std::shared_ptr< IVisualAidProvidergetVisualAidLineProvider () const
 
ZOrder getZOrder () const
 
bool isUseFeatureAsHandle () const
 
EventResult onEvent (const std::shared_ptr< IInputEvent > &inputEvent, const std::shared_ptr< FeatureEditContext > &context) override
 Handles the given event, and returns if the event was consumed or not. More...
 
PointEditHandleoperator= (const PointEditHandle &other)=delete
 
void paint (FeatureCanvas &canvas, const std::shared_ptr< FeatureEditContext > &context) const override
 Paints this handle on the given canvas. More...
 
void setActiveIcon (std::shared_ptr< IIcon > icon)
 Sets the icon to paint when the handle is in an active state. More...
 
void setActiveVisualAidLineStyle (std::shared_ptr< LineStyle > lineStyle)
 Sets the visual aid line style to use when this handle is in a EditHandleState::Active state. More...
 
void setHighlightedIcon (std::shared_ptr< IIcon > icon)
 Sets the icon to paint when the handle is in a highlighted state. More...
 
void setHighlightedVisualAidLineStyle (std::shared_ptr< LineStyle > lineStyle)
 Sets the visual aid line style to use when this handle is in a EditHandleState::Highlighted state. More...
 
void setInvalidationCallback (std::shared_ptr< IInvalidationCallback > invalidationCallback) override
 Sets the callback for the handle to call when its visual representation or cursor has changed. More...
 
void setLocationProviderWhenActive (std::shared_ptr< Observable< std::shared_ptr< Point > > > locationProviderWhenActive)
 
void setMoveConstraint (EditMoveConstraint moveConstraint)
 
void setRegularIcon (std::shared_ptr< IIcon > icon)
 Sets the icon to paint when the handle is in a regular state. More...
 
void setRegularVisualAidLineStyle (std::shared_ptr< LineStyle > lineStyle)
 Sets the visual aid line style to use when this handle is in a EditHandleState::Inactive state. More...
 
void setUseFeatureAsHandle (bool useFeatureAsHandle)
 
void setVisualAidLineProvider (std::shared_ptr< IVisualAidProvider > provider)
 Sets a visual aid line provider that allows to paint a visual aid line together with this handle. More...
 
void setZOrder (ZOrder zOrder)
 Sets the Z-order that is used for this handle's paint calls to the FeatureCanvas. More...
 
- Public Member Functions inherited from luciad::IEditHandle
 IEditHandle ()
 
virtual ~IEditHandle ()=default
 
virtual EditHandleState getEditState () const =0
 
virtual std::optional< MouseCursorgetMouseCursor () const =0
 
virtual EventResult onEvent (const std::shared_ptr< IInputEvent > &inputEvent, const std::shared_ptr< FeatureEditContext > &context)=0
 Handles the given event, and returns if the event was consumed or not. More...
 
virtual void paint (FeatureCanvas &canvas, const std::shared_ptr< FeatureEditContext > &context) const =0
 Paints this handle on the given canvas. More...
 
virtual void setInvalidationCallback (std::shared_ptr< IInvalidationCallback > invalidationCallback)=0
 Sets the callback for the handle to call when its visual representation or cursor has changed. More...
 

Detailed Description

This handle represents a Point on the Map and can be visualized using an icon.

It can be moved around, or react to mouse events.

The handle executes IPointEditAction, based on mouse input events. IEditHandles implementations configure concrete IPointEditAction implementations on this handle to make sure they result in geometry or feature changes. For example, when this handle is dragged around on the Map, an IEditHandles implementation for polylines can make sure that the second point of the polyline is moved.

This class supports the following gestures:

This handle is painted using an icon at its current location.

Since
2020.1

Constructor & Destructor Documentation

◆ PointEditHandle() [1/3]

luciad::PointEditHandle::PointEditHandle ( std::shared_ptr< Point initialLocation)
explicit

Creates a new PointEditHandle without associated actions.

Parameters
initialLocationthe initial location of the handle, cannot be nullptr

◆ PointEditHandle() [2/3]

luciad::PointEditHandle::PointEditHandle ( std::shared_ptr< Observable< std::shared_ptr< Point > > >  locationProvider)
explicit

Creates a new PointEditHandle without associated actions.

Parameters
locationProviderthe location provider of the handle. The handle assumes the location of this point upon construction, while also observing the point to adjust its own location whenever the observable point changes; cannot be nullptr.

◆ PointEditHandle() [3/3]

luciad::PointEditHandle::PointEditHandle ( const PointEditHandle other)
delete

◆ ~PointEditHandle()

luciad::PointEditHandle::~PointEditHandle ( )
override

Member Function Documentation

◆ addOnClickAction()

EditActionBinder & luciad::PointEditHandle::addOnClickAction ( std::shared_ptr< IPointEditAction action,
size_t  clickCount 
)

Adds an action that will be triggered when the handle is clicked or tapped (touch).

Parameters
actionthe action to be performed on click, cannot be nullptr.
clickCountthe action will only be performed when an event is received with this click count
Returns
an object on which more options or requirements can be specified regarding the given on-click action, such as the mouse buttons that need to be pressed for the action to be executed.

◆ addOnDragAction()

EditActionBinder & luciad::PointEditHandle::addOnDragAction ( std::shared_ptr< IPointEditAction action)

Adds an action that will be triggered when the handle is dragged.

The given action is executed at least when the drag gesture starts and ends, and if EditActionBinder::performOnIntermediateEvents is set to true, it also gets executed on every intermediate drag event. The action is always called with an EventStatus parameter corresponding to the drag event.

Parameters
actionthe action to be performed on drag, cannot be nullptr.
Returns
an object on which more options or requirements can be specified regarding the given on-drag action, such as the mouse buttons that need to be pressed for the action to be executed.

◆ addOnMouseMoveAction()

EditActionBinder & luciad::PointEditHandle::addOnMouseMoveAction ( std::shared_ptr< IPointEditAction action)

Adds an action that will be executed on every mouse move.

Parameters
actionthe action to be performed during the mouse move, cannot be nullptr.
Returns
an object on which more options or requirements can be specified regarding the given action, such as the modifier keys that need to be pressed for the action to be executed.

◆ addOnTouchLongPressAction()

EditActionBinder & luciad::PointEditHandle::addOnTouchLongPressAction ( std::shared_ptr< IPointEditAction action)

Adds an action that will be triggered when a long press is performed on a handle.

Parameters
actionthe action to be performed, cannot be nullptr.
Returns
an object on which more options or requirements can be specified regarding the given on-drag action
Since
2022.1

◆ getActiveIcon()

std::shared_ptr< luciad::IIcon > luciad::PointEditHandle::getActiveIcon ( ) const
Returns
the icon to paint when the handle is in an active state.
See also
setActiveIcon

◆ getActiveVisualAidLineStyle()

std::shared_ptr< luciad::LineStyle > luciad::PointEditHandle::getActiveVisualAidLineStyle ( ) const
Returns
the visual aid line style to use when this handle is in an EditHandleState::Active state. Can be nullptr.
See also
setActiveVisualAidLineStyle

◆ getEditState()

EditHandleState luciad::PointEditHandle::getEditState ( ) const
overridevirtual
Returns
the current state of this handle.

Implements luciad::IEditHandle.

◆ getHighlightedIcon()

std::shared_ptr< luciad::IIcon > luciad::PointEditHandle::getHighlightedIcon ( ) const
Returns
the icon to paint when the handle is in a highlighted state.
See also
setHighlightedIcon

◆ getHighlightedVisualAidLineStyle()

std::shared_ptr< luciad::LineStyle > luciad::PointEditHandle::getHighlightedVisualAidLineStyle ( ) const
Returns
the visual aid line style to use when this handle is in a EditHandleState::Highlighted state. Can be nullptr.
See also
setHighlightedVisualAidLineStyle

◆ getLocation()

std::shared_ptr< Point > luciad::PointEditHandle::getLocation ( ) const

Returns the current location of this handle.

Note that this location is not necessarily equal to the location provider at all times. For example, they may differ when the handle is dragged around and no location changes are triggered in the location provider.

Returns
the current location of this handle

◆ getLocationProvider()

std::shared_ptr< Observable< std::shared_ptr< Point > > > luciad::PointEditHandle::getLocationProvider ( ) const

Returns the location provider of this handle.

Note that the handle's current location is not necessarily equal to this location provider at all times. For example, they may differ when the handle is dragged around and no location changes are triggered in this location provider. Additionally, the handle may have a different location provider when it is active. See getLocationProviderWhenActive.

Returns
the location provider of this handle. Never nullptr.

◆ getLocationProviderWhenActive()

std::shared_ptr< Observable< std::shared_ptr< Point > > > luciad::PointEditHandle::getLocationProviderWhenActive ( ) const
Returns
locationProviderWhenActive the location provider to use when the handle is active, or nullptr if no distinct location provider is set for when the handle is active.

◆ getMouseCursor()

std::optional< MouseCursor > luciad::PointEditHandle::getMouseCursor ( ) const
overridevirtual
Returns
the current mouse cursor that should be displayed for this handle. This method typically returns a value when this handle is highlighted or active. If not, std::nullopt can be returned.

Implements luciad::IEditHandle.

◆ getMoveConstraint()

EditMoveConstraint luciad::PointEditHandle::getMoveConstraint ( ) const
Returns
the move constraint of this point handle

◆ getRegularIcon()

std::shared_ptr< luciad::IIcon > luciad::PointEditHandle::getRegularIcon ( ) const
Returns
the icon to paint when the handle is in a regular state.
See also
setRegularIcon

◆ getRegularVisualAidLineStyle()

std::shared_ptr< luciad::LineStyle > luciad::PointEditHandle::getRegularVisualAidLineStyle ( ) const
Returns
the visual aid line style to use when this handle is in a EditHandleState::Inactive state. Can be nullptr.
See also
setRegularVisualAidLineStyle

◆ getVisualAidLineProvider()

std::shared_ptr< IVisualAidProvider > luciad::PointEditHandle::getVisualAidLineProvider ( ) const
Returns
the visual aid line provider
See also
setVisualAidLineProvider

◆ getZOrder()

ZOrder luciad::PointEditHandle::getZOrder ( ) const
Returns
the Z-order that is used for this handle's paint calls to the FeatureCanvas.
See also
setZOrder.
the DrawCommands on FeatureCanvas. For example FeatureCanvas::IconDrawCommand::zOrder.

◆ isUseFeatureAsHandle()

bool luciad::PointEditHandle::isUseFeatureAsHandle ( ) const
Returns
when this is set to true, this handle does not paint any icons for itself.
See also
setUseFeatureAsHandle

◆ onEvent()

EventResult luciad::PointEditHandle::onEvent ( const std::shared_ptr< IInputEvent > &  inputEvent,
const std::shared_ptr< FeatureEditContext > &  context 
)
overridevirtual

Handles the given event, and returns if the event was consumed or not.

While handling events, IEditHandles can mark themselves as highlighted or as Active. Related to event handling, the main effect of this is that highlighted or active handles get a higher priority compared to other handles: they get the chance to consume events first. See EditHandleState

Parameters
inputEventthe event to handle, cannot be nullptr
contextthe context, cannot be nullptr
Returns
if the event was consumed or not
Exceptions
NullArgumentExceptionwhen nullptr is passed.

Implements luciad::IEditHandle.

◆ operator=()

PointEditHandle & luciad::PointEditHandle::operator= ( const PointEditHandle other)
delete

◆ paint()

void luciad::PointEditHandle::paint ( FeatureCanvas canvas,
const std::shared_ptr< FeatureEditContext > &  context 
) const
overridevirtual

Paints this handle on the given canvas.

This method is called when

This method only gets called on the UI thread, so there is no need for additional synchronization.

Parameters
canvasthe canvas on which this handle gets painted.
contextthe context, cannot be nullptr

Implements luciad::IEditHandle.

◆ setActiveIcon()

void luciad::PointEditHandle::setActiveIcon ( std::shared_ptr< IIcon icon)

Sets the icon to paint when the handle is in an active state.

This icon is only used when setUseFeatureAsHandle is set to false.

Parameters
iconthe icon to paint when the handle is in an active state

◆ setActiveVisualAidLineStyle()

void luciad::PointEditHandle::setActiveVisualAidLineStyle ( std::shared_ptr< LineStyle lineStyle)

Sets the visual aid line style to use when this handle is in a EditHandleState::Active state.

this style is only used when a visual aid line is set.

The default is a small, gray line.

Parameters
lineStylethe visual aid line style to use when this handle is in an EditHandleState::Active state. Can be nullptr to not draw the visual aid line in this state.

◆ setHighlightedIcon()

void luciad::PointEditHandle::setHighlightedIcon ( std::shared_ptr< IIcon icon)

Sets the icon to paint when the handle is in a highlighted state.

This icon is only used when setUseFeatureAsHandle is set to false.

Parameters
iconthe icon to paint when the handle is in a highlighted state.

◆ setHighlightedVisualAidLineStyle()

void luciad::PointEditHandle::setHighlightedVisualAidLineStyle ( std::shared_ptr< LineStyle lineStyle)

Sets the visual aid line style to use when this handle is in a EditHandleState::Highlighted state.

this style is only used when a visual aid line is set.

The default is a small, gray line.

Parameters
lineStylethe visual aid line style to use when this handle is in a EditHandleState::Highlighted state. Can be nullptr to not draw the visual aid line in this state.

◆ setInvalidationCallback()

void luciad::PointEditHandle::setInvalidationCallback ( std::shared_ptr< IInvalidationCallback invalidationCallback)
overridevirtual

Sets the callback for the handle to call when its visual representation or cursor has changed.

Calling this callback triggers a new call to this handle's paint method.

Parameters
invalidationCallbackthe callback for the handle to call when its visual representation has changed

Implements luciad::IEditHandle.

◆ setLocationProviderWhenActive()

void luciad::PointEditHandle::setLocationProviderWhenActive ( std::shared_ptr< Observable< std::shared_ptr< Point > > >  locationProviderWhenActive)
Parameters
locationProviderWhenActivethe location provider to use when the handle is active. If set, this overrides the regular location provider when the handle is active, Can be nullptr.

◆ setMoveConstraint()

void luciad::PointEditHandle::setMoveConstraint ( EditMoveConstraint  moveConstraint)
Parameters
moveConstraintthe move constraint of this point handle. By default, this is EditMoveConstraint::XY.

◆ setRegularIcon()

void luciad::PointEditHandle::setRegularIcon ( std::shared_ptr< IIcon icon)

Sets the icon to paint when the handle is in a regular state.

This icon is only used when setUseFeatureAsHandle is set to false.

Parameters
iconthe icon to paint when the handle is in a regular (i.e. non-highlighted, non-active) state.

◆ setRegularVisualAidLineStyle()

void luciad::PointEditHandle::setRegularVisualAidLineStyle ( std::shared_ptr< LineStyle lineStyle)

Sets the visual aid line style to use when this handle is in a EditHandleState::Inactive state.

this style is only used when a visual aid line is set.

The default is a small, gray line.

Parameters
lineStylethe visual aid line style to use when this handle is in a EditHandleState::Inactive state. Can be nullptr to not draw the visual aid line in this state.

◆ setUseFeatureAsHandle()

void luciad::PointEditHandle::setUseFeatureAsHandle ( bool  useFeatureAsHandle)
Parameters
useFeatureAsHandlewhen this is set to true, this handle does not paint any icons for itself. In this case, the handle considers the feature that is being edited for determining whether it is touched or not. Otherwise, when this is set to false, the handle paints itself as an icon and only considers that icon for deciding whether it is touched. By default, this is false.

◆ setVisualAidLineProvider()

void luciad::PointEditHandle::setVisualAidLineProvider ( std::shared_ptr< IVisualAidProvider provider)

Sets a visual aid line provider that allows to paint a visual aid line together with this handle.

It is not possible to interact with this line. The line style can be configured using setRegularVisualAidLineStyle. The given provider is allowed

The default is nullptr.

Parameters
providerthe visual aid line provider. If nullptr, no visual aid line is painted.

◆ setZOrder()

void luciad::PointEditHandle::setZOrder ( ZOrder  zOrder)

Sets the Z-order that is used for this handle's paint calls to the FeatureCanvas.

This Z-order determines which handles are painted on top, when multiple handles overlap. Edit handles with a higher Z-order are painted on top of handles with a lower Z-order. Note: highlighted edit handles are always painted above regular handles, and active handles are always painted above highlighted handles. The default value is 0.

Parameters
zOrderthe Z-order that is used for this handle's paint calls to the FeatureCanvas. Must be between [-1000,1000].
See also
the DrawCommands on FeatureCanvas. For example FeatureCanvas::IconDrawCommand::zOrder.