LuciadCPillar 2024.0.04
|
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 | |
void | addEditStateObserver (std::shared_ptr< IInvalidationCallback > observer) override |
Adds an observer that is called when the edit state of this handle has changed. More... | |
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 |
Returns the icon to paint when the handle is in an active state. More... | |
const std::optional< ComplexStrokeLineStyle > & | getActiveVisualAidComplexStrokeLineStyle () const |
Returns the visual aid line style to use when this handle is in an active state. More... | |
const std::optional< LineStyle > & | getActiveVisualAidLineStyle () const |
Returns the visual aid line style to use when this handle is in an active state. More... | |
EditHandleState | getEditState () const override |
Returns the current state of this handle. More... | |
std::shared_ptr< luciad::IIcon > | getHighlightedIcon () const |
Returns the icon to paint when the handle is in a highlighted state. More... | |
const std::optional< ComplexStrokeLineStyle > & | getHighlightedVisualAidComplexStrokeLineStyle () const |
Returns the visual aid complex stroke line style to use when this handle is in a highlighted state. More... | |
const std::optional< LineStyle > & | getHighlightedVisualAidLineStyle () const |
Returns the visual aid line style to use when this handle is in a highlighted state. More... | |
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 |
Returns the location provider to use when the handle is active . More... | |
std::optional< MouseCursor > | getMouseCursor () const override |
Returns the current mouse cursor that should be displayed for this handle. More... | |
EditMoveConstraint | getMoveConstraint () const |
Returns the move constraint of this point handle. More... | |
std::shared_ptr< luciad::IIcon > | getRegularIcon () const |
Returns the icon to paint when the handle is in a regular state. More... | |
const std::optional< ComplexStrokeLineStyle > & | getRegularVisualAidComplexStrokeLineStyle () const |
Returns the visual aid complex stroke line style to use when this handle is in an inactive state. More... | |
const std::optional< LineStyle > & | getRegularVisualAidLineStyle () const |
Returns the visual aid line style to use when this handle is in an inactive state. More... | |
std::shared_ptr< IVisualAidProvider > | getVisualAidLineProvider () const |
Returns the visual aid line provider that allows to paint a visual aid line together with this handle. More... | |
ZOrder | getZOrder () const |
Returns the Z-order that is used for this handle's paint calls to the FeatureCanvas . More... | |
bool | isUseFeatureAsHandle () const |
Returns whether this handle should paint any icons itself. More... | |
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 | removeEditStateObserver (const std::shared_ptr< IInvalidationCallback > &observer) override |
Removes the given observer. More... | |
void | setActiveIcon (std::shared_ptr< IIcon > icon) |
Sets the icon to paint when the handle is in an active state. More... | |
void | setActiveVisualAidComplexStrokeLineStyle (std::optional< ComplexStrokeLineStyle > lineStyle) |
Sets the visual aid line style to use when this handle is in an active state. More... | |
void | setActiveVisualAidLineStyle (std::optional< LineStyle > lineStyle) |
Sets the visual aid line style to use when this handle is in an 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 | setHighlightedVisualAidComplexStrokeLineStyle (std::optional< ComplexStrokeLineStyle > lineStyle) |
Sets the visual aid complex stroke line style to use when this handle is in a highlighted state. More... | |
void | setHighlightedVisualAidLineStyle (std::optional< LineStyle > lineStyle) |
Sets the visual aid line style to use when this handle is in a 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) |
Sets the location provider to use when the handle is active . More... | |
void | setMoveConstraint (EditMoveConstraint moveConstraint) |
Sets the move constraint of this point handle. More... | |
void | setRegularIcon (std::shared_ptr< IIcon > icon) |
Sets the icon to paint when the handle is in a regular state. More... | |
void | setRegularVisualAidComplexStrokeLineStyle (std::optional< ComplexStrokeLineStyle > lineStyle) |
Sets the visual aid complex stroke line style to use when this handle is in an inactive state. More... | |
void | setRegularVisualAidLineStyle (std::optional< LineStyle > lineStyle) |
Sets the visual aid line style to use when this handle is in an inactive state. More... | |
void | setUseFeatureAsHandle (bool useFeatureAsHandle) |
Sets whether this handle should paint any icons itself. More... | |
void | setVisualAidLineProvider (std::shared_ptr< IVisualAidProvider > provider) |
Sets the 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 () | |
Creates a new edit handle instance. More... | |
virtual | ~IEditHandle ()=default |
virtual void | addEditStateObserver (std::shared_ptr< IInvalidationCallback > observer)=0 |
Adds an observer that is called when the edit state of this handle has changed. More... | |
virtual EditHandleState | getEditState () const =0 |
Returns the current state of this handle. More... | |
virtual std::optional< MouseCursor > | getMouseCursor () const =0 |
Returns the current mouse cursor that should be displayed for this handle. More... | |
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 | removeEditStateObserver (const std::shared_ptr< IInvalidationCallback > &observer)=0 |
Removes the given observer. 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 |
|
overridevirtual |
Adds an observer that is called when the edit state
of this handle has changed.
Adding the same observer twice is forbidden, and will cause an exception to be thrown.
observer | an observer |
InvalidArgumentException | when the observer was already added. |
Implements luciad::IEditHandle.
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 |
Returns the icon to paint when the handle is in an active state.
const std::optional< ComplexStrokeLineStyle > & luciad::PointEditHandle::getActiveVisualAidComplexStrokeLineStyle | ( | ) | const |
Returns the visual aid line style to use when this handle is in an active
state.
This method is linked to the getActiveVisualAidLineStyle
method:
std::nullopt
, no visual aid line is paintedstd::nullopt
, that line style is usedstd::nullopt
value: they are mutually exclusiveactive
state. const std::optional< LineStyle > & luciad::PointEditHandle::getActiveVisualAidLineStyle | ( | ) | const |
Returns the visual aid line style to use when this handle is in an active
state.
This method is linked to the getActiveVisualAidComplexStrokeLineStyle
method:
std::nullopt
, no visual aid line is paintedstd::nullopt
, that line style is usedstd::nullopt
value: they are mutually exclusiveactive
state.
|
overridevirtual |
Returns the current state of this handle.
Implements luciad::IEditHandle.
std::shared_ptr< luciad::IIcon > luciad::PointEditHandle::getHighlightedIcon | ( | ) | const |
Returns the icon to paint when the handle is in a highlighted state.
const std::optional< ComplexStrokeLineStyle > & luciad::PointEditHandle::getHighlightedVisualAidComplexStrokeLineStyle | ( | ) | const |
Returns the visual aid complex stroke line style to use when this handle is in a highlighted
state.
This method is linked to the getHighlightedVisualAidLineStyle
method:
std::nullopt
, no visual aid line is paintedstd::nullopt
, that line style is usedstd::nullopt
value: they are mutually exclusivehighlighted
state. const std::optional< LineStyle > & luciad::PointEditHandle::getHighlightedVisualAidLineStyle | ( | ) | const |
Returns the visual aid line style to use when this handle is in a highlighted
state.
This method is linked to the getHighlightedVisualAidComplexStrokeLineStyle
method:
std::nullopt
, no visual aid line is paintedstd::nullopt
, that line style is usedstd::nullopt
value: they are mutually exclusivehighlighted
state. 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 |
|
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.
EditMoveConstraint luciad::PointEditHandle::getMoveConstraint | ( | ) | const |
Returns the move constraint of this point handle.
std::shared_ptr< luciad::IIcon > luciad::PointEditHandle::getRegularIcon | ( | ) | const |
Returns the icon to paint when the handle is in a regular state.
const std::optional< ComplexStrokeLineStyle > & luciad::PointEditHandle::getRegularVisualAidComplexStrokeLineStyle | ( | ) | const |
Returns the visual aid complex stroke line style to use when this handle is in an inactive
state.
This method is linked to the getRegularVisualAidLineStyle
method:
std::nullopt
, no visual aid line is paintedstd::nullopt
, that line style is usedstd::nullopt
value: they are mutually exclusiveinactive
state. const std::optional< LineStyle > & luciad::PointEditHandle::getRegularVisualAidLineStyle | ( | ) | const |
Returns the visual aid line style to use when this handle is in an inactive
state.
This method is linked to the getRegularVisualAidComplexStrokeLineStyle
method:
std::nullopt
, no visual aid line is paintedstd::nullopt
, that line style is usedstd::nullopt
value: they are mutually exclusiveinactive
state. std::shared_ptr< IVisualAidProvider > luciad::PointEditHandle::getVisualAidLineProvider | ( | ) | const |
Returns the visual aid line provider that allows to paint a visual aid line together with this handle.
ZOrder luciad::PointEditHandle::getZOrder | ( | ) | const |
Returns the Z-order that is used for this handle's paint calls to the FeatureCanvas
.
FeatureCanvas
. FeatureCanvas
draw commands. For example FeatureCanvas::IconDrawCommand::zOrder
. bool luciad::PointEditHandle::isUseFeatureAsHandle | ( | ) | const |
Returns whether this handle should paint any icons itself.
When set to true, this handle does not paint any icons itself.
|
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.
|
overridevirtual |
Removes the given observer.
If the given observer was never added, an exception is thrown.
observer | an observer |
InvalidArgumentException | when the observer is not known. |
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::setActiveVisualAidComplexStrokeLineStyle | ( | std::optional< ComplexStrokeLineStyle > | lineStyle | ) |
Sets the visual aid line style to use when this handle is in an active
state.
This style is only used when a visual aid line is set
.
Only one active line style can be set, if this function is called with a non std::nullopt
value when a LineStyle
has already been set, it will be overwritten.
The default is std::nullopt
, as a linestyle
is used as default active visual aid style.
lineStyle | the visual aid complex stroke line style to use when this handle is in a EditHandleState::Active state. |
void luciad::PointEditHandle::setActiveVisualAidLineStyle | ( | std::optional< LineStyle > | lineStyle | ) |
Sets the visual aid line style to use when this handle is in an active
state.
This style is only used when a visual aid line is set
.
Only one active line style can be set, if this function is called with a non std::nullopt
value when a ComplexStrokeLineStyle
has already been set, it will be overwritten.
The default is a small, grey line.
lineStyle | the visual aid line style to use when this handle is in an active 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::setHighlightedVisualAidComplexStrokeLineStyle | ( | std::optional< ComplexStrokeLineStyle > | lineStyle | ) |
Sets the visual aid complex stroke line style to use when this handle is in a highlighted
state.
This style is only used when a visual aid line is set
.
Only one highlighted line style can be set, if this function is called with a non std::nullopt
value when a LineStyle
has already been set, it will be overwritten.
The default is std::nullopt
, as a linestyle
is used as default highlighted visual aid style.
lineStyle | the visual aid complex stroke line style to use when this handle is in a highlighted state. |
void luciad::PointEditHandle::setHighlightedVisualAidLineStyle | ( | std::optional< LineStyle > | lineStyle | ) |
Sets the visual aid line style to use when this handle is in a highlighted
state.
This style is only used when a visual aid line is set
.
Only one regular line style can be set, if this function is called with a non std::nullopt
value when a ComplexStrokeLineStyle
has already been set, it will be overwritten.
The default is a small, grey line.
lineStyle | the visual aid line style to use when this handle is in a highlighted 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 | ) |
Sets 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
.
locationProviderWhenActive | the location provider to use when the handle is active . |
void luciad::PointEditHandle::setMoveConstraint | ( | EditMoveConstraint | moveConstraint | ) |
Sets the move constraint of this point handle.
By default, this is EditMoveConstraint::XY
.
moveConstraint | the move constraint of this point handle. |
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::setRegularVisualAidComplexStrokeLineStyle | ( | std::optional< ComplexStrokeLineStyle > | lineStyle | ) |
Sets the visual aid complex stroke line style to use when this handle is in an inactive
state.
This style is only used when a visual aid line is set
.
Only one regular line style can be set, if this function is called with a non std::nullopt
value when a LineStyle
has already been set, it will be overwritten.
The default is std::nullopt
, as a linestyle
is used as default regular visual aid style.
lineStyle | the visual aid complex stroke line style to use when this handle is in an inactive state. |
void luciad::PointEditHandle::setRegularVisualAidLineStyle | ( | std::optional< LineStyle > | lineStyle | ) |
Sets the visual aid line style to use when this handle is in an inactive
state.
This style is only used when a visual aid line is set
.
Only one regular line style can be set, if this function is called with a non std::nullopt
value when a ComplexStrokeLineStyle
has already been set, it will be overwritten.
The default is a small, grey line.
lineStyle | the visual aid line style to use when this handle is in an inactive state. |
void luciad::PointEditHandle::setUseFeatureAsHandle | ( | bool | useFeatureAsHandle | ) |
Sets whether this handle should paint any icons itself.
When 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.
useFeatureAsHandle | when true, this handle does not paint any icons for itself. |
void luciad::PointEditHandle::setVisualAidLineProvider | ( | std::shared_ptr< IVisualAidProvider > | provider | ) |
Sets the 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
.
If nullptr
, no visual aid line is painted. The default is nullptr
.
provider | the visual aid line provider. |
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.
Must be between [-1000,1000]. The default value is 0.
zOrder | the Z-order that is used for this handle's paint calls to the FeatureCanvas . |
FeatureCanvas
draw commands. For example FeatureCanvas::IconDrawCommand::zOrder
.