|
LuciadCPillar 2025.0.09
|
This handle represents a line on the Map and can be visualized using a line. More...
#include <luciad/edit/handles/LineEditHandle.h>
Public Member Functions | |
| LineEditHandle (const LineEditHandle &other)=delete | |
| LineEditHandle (std::shared_ptr< Geometry > geometry) | |
| Creates a new LineEditHandle without associated actions. More... | |
| LineEditHandle (std::shared_ptr< Observable< std::shared_ptr< Geometry > > > geometryProvider) | |
| Creates a LineEditHandle without associated actions. More... | |
| ~LineEditHandle () 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... | |
| const std::optional< LineStyle > & | getActiveLineStyle () 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< Geometry > | getGeometry () const |
| Returns the current geometry of this handle. More... | |
| std::shared_ptr< Observable< std::shared_ptr< Geometry > > > | getGeometryProvider () const |
| Returns the geometry provider of this handle. More... | |
| const std::optional< LineStyle > & | getHighlightedLineStyle () const |
Returns the visual aid line style to use when this handle is in a highlighted state. More... | |
| std::optional< MouseCursor > | getMouseCursor () const override |
| Returns the current mouse cursor that should be displayed for this handle. More... | |
| const std::optional< LineStyle > & | getRegularLineStyle () const |
Returns the visual aid line style to use when this handle is in an inactive state. More... | |
| ZOrder | getZOrder () const |
Returns the Z-order that is used for this handle's paint calls to the FeatureCanvas. 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... | |
| 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 | setActiveLineStyle (std::optional< LineStyle > lineStyle) |
Sets the line style to use when this handle is in an active state. More... | |
| void | setHighlightedLineStyle (std::optional< LineStyle > lineStyle) |
Sets the 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 | setRegularLineStyle (std::optional< LineStyle > lineStyle) |
Sets the line style to use when this handle is in an inactive state. 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 line on the Map and can be visualized using a line.
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 circles can make sure that the circle can expand/shrink.
This class supports the following gestures:
This handle is painted using the provided geometry.
|
explicit |
Creates a new LineEditHandle without associated actions.
| geometry | the initial geometry of the handle, cannot be nullptr |
|
explicit |
Creates a LineEditHandle without associated actions.
| geometryProvider | the geometry provider of the handle. The handle assumes the geometry of this point upon construction, while also observing the geometry to adjust its own shape whenever the observable geometry 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::LineEditHandle::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, cannot be nullptr. |
| clickCount | the action will only be performed when an event is received with this click count. |
| EditActionBinder & luciad::LineEditHandle::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::LineEditHandle::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::LineEditHandle::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. |
| const std::optional< LineStyle > & luciad::LineEditHandle::getActiveLineStyle | ( | ) | const |
|
overridevirtual |
Returns the current state of this handle.
Implements luciad::IEditHandle.
| std::shared_ptr< Geometry > luciad::LineEditHandle::getGeometry | ( | ) | const |
Returns the current geometry of this handle.
Note that this geometry is not necessarily equal to the geometry provider at all times. For example, they may differ when the handle is dragged around and no geometry changes are triggered in the geometry provider.
| std::shared_ptr< Observable< std::shared_ptr< Geometry > > > luciad::LineEditHandle::getGeometryProvider | ( | ) | const |
Returns the geometry provider of this handle.
Note that the handle's current geometry is not necessarily equal to this geometry provider at all times. For example, they may differ when the handle is dragged around and no geometry changes are triggered in this geometry provider.
nullptr. | const std::optional< LineStyle > & luciad::LineEditHandle::getHighlightedLineStyle | ( | ) | const |
Returns the visual aid line style to use when this handle is in a highlighted state.
highlighted state.
|
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.
| const std::optional< LineStyle > & luciad::LineEditHandle::getRegularLineStyle | ( | ) | const |
| ZOrder luciad::LineEditHandle::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::GeometryDrawCommand::zOrder.
|
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.
|
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::LineEditHandle::setActiveLineStyle | ( | std::optional< LineStyle > | lineStyle | ) |
| void luciad::LineEditHandle::setHighlightedLineStyle | ( | std::optional< LineStyle > | lineStyle | ) |
Sets the line style to use when this handle is in a highlighted state.
| lineStyle | The 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::LineEditHandle::setRegularLineStyle | ( | std::optional< LineStyle > | lineStyle | ) |
| void luciad::LineEditHandle::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::GeometryDrawCommand::zOrder.