![]() |
LuciadCPillar 2023.0
|
This handle represents a Point on the Map and can be visualized using an icon. More...
#include <luciad/edit/handles/PointEditHandle.h>
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 | |
EditActionBinder & | addOnClickAction (std::shared_ptr< IPointEditAction > action, size_t clickCount) |
Adds an action that will be triggered when the handle is clicked or tapped (touch). More... | |
EditActionBinder & | addOnDragAction (std::shared_ptr< IPointEditAction > action) |
Adds an action that will be triggered when the handle is dragged. More... | |
EditActionBinder & | addOnMouseMoveAction (std::shared_ptr< IPointEditAction > action) |
Adds an action that will be executed on every mouse move. More... | |
EditActionBinder & | addOnTouchLongPressAction (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::IIcon > | getActiveIcon () const |
std::shared_ptr< luciad::LineStyle > | getActiveVisualAidLineStyle () const |
EditHandleState | getEditState () const override |
std::shared_ptr< luciad::IIcon > | getHighlightedIcon () const |
std::shared_ptr< luciad::LineStyle > | getHighlightedVisualAidLineStyle () const |
std::shared_ptr< Point > | getLocation () 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< MouseCursor > | getMouseCursor () const override |
EditMoveConstraint | getMoveConstraint () const |
std::shared_ptr< luciad::IIcon > | getRegularIcon () const |
std::shared_ptr< luciad::LineStyle > | getRegularVisualAidLineStyle () const |
std::shared_ptr< IVisualAidProvider > | getVisualAidLineProvider () 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... | |
PointEditHandle & | operator= (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... | |
![]() | |
IEditHandle () | |
virtual | ~IEditHandle ()=default |
virtual EditHandleState | getEditState () const =0 |
virtual std::optional< MouseCursor > | getMouseCursor () 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... | |
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.
|
explicit |
Creates a new PointEditHandle without associated actions.
initialLocation | the initial location of the handle, cannot be nullptr |
|
explicit |
Creates a new PointEditHandle without associated actions.
locationProvider | the 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 . |
|
delete |
|
override |
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).
action | the action to be performed on click, cannot be nullptr . |
clickCount | the action will only be performed when an event is received with this click count |
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.
action | the action to be performed on drag, cannot be nullptr . |
EditActionBinder & luciad::PointEditHandle::addOnMouseMoveAction | ( | std::shared_ptr< IPointEditAction > | action | ) |
Adds an action that will be executed on every mouse move.
action | the action to be performed during the mouse move, cannot be nullptr . |
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.
action | the action to be performed, cannot be nullptr . |
std::shared_ptr< luciad::IIcon > luciad::PointEditHandle::getActiveIcon | ( | ) | const |
std::shared_ptr< luciad::LineStyle > luciad::PointEditHandle::getActiveVisualAidLineStyle | ( | ) | const |
EditHandleState::Active
state. Can be nullptr
.
|
overridevirtual |
Implements luciad::IEditHandle.
std::shared_ptr< luciad::IIcon > luciad::PointEditHandle::getHighlightedIcon | ( | ) | const |
std::shared_ptr< luciad::LineStyle > luciad::PointEditHandle::getHighlightedVisualAidLineStyle | ( | ) | const |
EditHandleState::Highlighted
state. Can be nullptr
. 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.
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
.
nullptr
. std::shared_ptr< Observable< std::shared_ptr< Point > > > luciad::PointEditHandle::getLocationProviderWhenActive | ( | ) | const |
active
, or nullptr
if no distinct location provider is set for when the handle is active.
|
overridevirtual |
std::nullopt
can be returned. Implements luciad::IEditHandle.
EditMoveConstraint luciad::PointEditHandle::getMoveConstraint | ( | ) | const |
std::shared_ptr< luciad::IIcon > luciad::PointEditHandle::getRegularIcon | ( | ) | const |
std::shared_ptr< luciad::LineStyle > luciad::PointEditHandle::getRegularVisualAidLineStyle | ( | ) | const |
EditHandleState::Inactive
state. Can be nullptr
. std::shared_ptr< IVisualAidProvider > luciad::PointEditHandle::getVisualAidLineProvider | ( | ) | const |
ZOrder luciad::PointEditHandle::getZOrder | ( | ) | const |
FeatureCanvas
. FeatureCanvas
. For example FeatureCanvas::IconDrawCommand::zOrder
. bool luciad::PointEditHandle::isUseFeatureAsHandle | ( | ) | const |
|
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
inputEvent | the event to handle, cannot be nullptr |
context | the context, cannot be nullptr |
NullArgumentException | when nullptr is passed. |
Implements luciad::IEditHandle.
|
delete |
|
overridevirtual |
Paints this handle on the given canvas.
This method is called when
IEditHandles
fires an EditHandlesEvent
containing this handle, when the handle is newly added or removed for example.invalidation callback
.This method only gets called on the UI thread, so there is no need for additional synchronization.
canvas | the canvas on which this handle gets painted. |
context | the context, cannot be nullptr |
Implements luciad::IEditHandle.
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.
icon | the icon to paint when the handle is in an active state |
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.
lineStyle | the 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. |
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.
icon | the icon to paint when the handle is in a highlighted state. |
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.
lineStyle | the 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. |
|
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.
invalidationCallback | the callback for the handle to call when its visual representation has changed |
Implements luciad::IEditHandle.
void luciad::PointEditHandle::setLocationProviderWhenActive | ( | std::shared_ptr< Observable< std::shared_ptr< Point > > > | locationProviderWhenActive | ) |
locationProviderWhenActive | the 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 . |
void luciad::PointEditHandle::setMoveConstraint | ( | EditMoveConstraint | moveConstraint | ) |
moveConstraint | the move constraint of this point handle. By default, this is EditMoveConstraint::XY . |
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.
icon | the icon to paint when the handle is in a regular (i.e. non-highlighted, non-active) state. |
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.
lineStyle | the 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. |
void luciad::PointEditHandle::setUseFeatureAsHandle | ( | bool | useFeatureAsHandle | ) |
useFeatureAsHandle | when 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. |
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
.
provider | the visual aid line provider. If nullptr , no visual aid line is painted. |
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.
zOrder | the Z-order that is used for this handle's paint calls to the FeatureCanvas . Must be between [-1000,1000]. |
FeatureCanvas
. For example FeatureCanvas::IconDrawCommand::zOrder
.