LuciadCPillar 2024.0.04
|
This handle allows you to translate a feature by translating its geometry using ITranslateEditAction. More...
#include <luciad/edit/handles/TranslateEditHandle.h>
Public Member Functions | |
TranslateEditHandle (const TranslateEditHandle &other)=delete | |
TranslateEditHandle (std::shared_ptr< CoordinateReference > reference, const std::shared_ptr< FeatureEditContext > &context) | |
Creates a new translate handle that allows you to drag around a feature or geometry horizontally. More... | |
~TranslateEditHandle () 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 & | addOnDragAction (std::shared_ptr< ITranslateEditAction > action) |
Adds an action that will be triggered when dragging. More... | |
EditHandleState | getEditState () const override |
Returns the current state of this handle. More... | |
std::optional< MouseCursor > | getMouseCursor () const override |
Returns the current mouse cursor that should be displayed for this handle. More... | |
const std::optional< ComplexStrokeLineStyle > & | getShadowComplexStrokeLineStyle () const |
Returns the complex stroke line style that is used for shadow lines. More... | |
const std::optional< FillStyle > & | getShadowFillStyle () const |
Returns the fill style that is used when a shadow version of a geometry is painted. More... | |
std::shared_ptr< Geometry > | getShadowGeometry () const |
Returns the current shadow geometry of this handle, or nullptr . More... | |
std::shared_ptr< Observable< std::shared_ptr< Geometry > > > | getShadowGeometryProvider () const |
Returns the shadow geometry provider of this handle. More... | |
std::shared_ptr< IIcon > | getShadowIcon () const |
Returns the icon that is used when a shadow version of a geometry is painted. More... | |
const std::optional< LineStyle > & | getShadowLineStyle () const |
Returns the line style that is used for shadow lines. 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... | |
TranslateEditHandle & | operator= (const TranslateEditHandle &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 | 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 | setShadowComplexStrokeLineStyle (std::optional< ComplexStrokeLineStyle > style) |
Sets the complex stroke line style that is used for shadow lines. More... | |
void | setShadowFillStyle (std::optional< FillStyle > style) |
Sets the fill style that is used when a shadow version of a geometry is painted. More... | |
void | setShadowGeometryProvider (std::shared_ptr< Observable< std::shared_ptr< Geometry > > > shadowGeometryProvider) |
Sets the shadow geometry provider of this handle. More... | |
void | setShadowIcon (std::shared_ptr< IIcon > icon) |
Sets the icon that is used when a shadow version of a geometry is painted. More... | |
void | setShadowLineStyle (std::optional< LineStyle > style) |
Sets the line style that is used for shadow lines. 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 allows you to translate a feature by translating its geometry using ITranslateEditAction.
This handle can operate in 2 modes: 1) Feature mode: the handle is highlighted and can be interacted with when the feature is touched.
2) Shadow geometry mode: this mode is enabled when a shadow geometry provider
is configured that provides a non-nullptr
shadow geometry. A shadow geometry is a draped
version of a geometry. In that case the handle is highlighted and can be interacted with when that shadow geometry is touched.
If the shadow geometry provider returns nullptr
, Feature mode is enabled.
This handle uses drag events
to call ITranslateEditAction::translate.
luciad::TranslateEditHandle::TranslateEditHandle | ( | std::shared_ptr< CoordinateReference > | reference, |
const std::shared_ptr< FeatureEditContext > & | context | ||
) |
Creates a new translate handle that allows you to drag around a feature or geometry horizontally.
reference | the coordinate reference in which the translation will occur, cannot be nullptr |
context | the context, 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::TranslateEditHandle::addOnDragAction | ( | std::shared_ptr< ITranslateEditAction > | action | ) |
Adds an action that will be triggered when dragging.
For every drag event, the following method call will be triggered:
action | the action to be performed on drag, cannot be nullptr . |
|
overridevirtual |
Returns the current state of this handle.
Implements luciad::IEditHandle.
|
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< ComplexStrokeLineStyle > & luciad::TranslateEditHandle::getShadowComplexStrokeLineStyle | ( | ) | const |
Returns the complex stroke line style that is used for shadow lines.
This method is linked to the getShadowLineStyle
method:
std::nullopt
, no shadow line is paintedstd::nullopt
, that shadow line style is usedstd::nullopt
value: they are mutually exclusiveconst std::optional< FillStyle > & luciad::TranslateEditHandle::getShadowFillStyle | ( | ) | const |
Returns the fill style that is used when a shadow version
of a geometry is painted.
shadow version
of a geometry is painted. std::shared_ptr< Geometry > luciad::TranslateEditHandle::getShadowGeometry | ( | ) | const |
Returns the current shadow geometry of this handle, or nullptr
.
nullptr
. std::shared_ptr< Observable< std::shared_ptr< Geometry > > > luciad::TranslateEditHandle::getShadowGeometryProvider | ( | ) | const |
Returns the shadow geometry provider of this handle.
Can be nullptr
.
nullptr
. std::shared_ptr< IIcon > luciad::TranslateEditHandle::getShadowIcon | ( | ) | const |
Returns the icon that is used when a shadow version
of a geometry is painted.
shadow version
of a geometry is painted. const std::optional< LineStyle > & luciad::TranslateEditHandle::getShadowLineStyle | ( | ) | const |
Returns the line style that is used for shadow lines.
This method is linked to the getShadowComplexStrokeLineStyle
method:
std::nullopt
, no shadow line is paintedstd::nullopt
, that shadow line style is usedstd::nullopt
value: they are mutually exclusiveZOrder luciad::TranslateEditHandle::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
.
|
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.
|
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::TranslateEditHandle::setShadowComplexStrokeLineStyle | ( | std::optional< ComplexStrokeLineStyle > | style | ) |
Sets the complex stroke line style that is used for shadow lines.
Only one shadow 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.
style | the complex stroke line style that is used for shadow lines. |
void luciad::TranslateEditHandle::setShadowFillStyle | ( | std::optional< FillStyle > | style | ) |
Sets the fill style that is used when a shadow version
of a geometry is painted.
Setting this to std::nullopt
means the shadow version of the geometry won't have a fill style.
style | fill style that is used when a shadow version of a geometry is painted. |
void luciad::TranslateEditHandle::setShadowGeometryProvider | ( | std::shared_ptr< Observable< std::shared_ptr< Geometry > > > | shadowGeometryProvider | ) |
Sets the shadow geometry provider of this handle.
When this provider (or the geometry it returned) is nullptr
, Feature mode is enabled for this handle. See TranslateEditHandle
for more information.
shadowGeometryProvider | the shadow geometry provider that is used by this handle. Can be nullptr to disable the shadow geometry mode. |
void luciad::TranslateEditHandle::setShadowIcon | ( | std::shared_ptr< IIcon > | icon | ) |
Sets the icon that is used when a shadow version
of a geometry is painted.
icon | the icon that is used when a shadow version of a geometry is painted. |
void luciad::TranslateEditHandle::setShadowLineStyle | ( | std::optional< LineStyle > | style | ) |
Sets the line style that is used for shadow lines.
Only one shadow 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.
style | the line style that is used for shadow lines. |
void luciad::TranslateEditHandle::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
.