![]() |
ImFusion C++ SDK 4.5.0
|
#include <ImFusion/GUI/PointBasedAnnotationEventHandler.h>
Event handler for creating and editing point-based annotations. More...
Event handler for creating and editing point-based annotations.
This event handler can operate in two different modes:
If you need an interactively editable GlPointBasedAnnotation you additionally instantiate the PointBasedAnnotationEventHandler and wrap the two together in a TypedViewObject.
Classes | |
| struct | RegularMode |
| struct | CreateMode |
| struct | MovePointMode |
| struct | MoveAnnotationMode |
Public Types | |
| enum class | Action { CreateAppendPoint = 0 , AbortCreation = 1 , FinishCreation = 2 , MovePoint = 3 , InsertPoint = 4 , RemovePoint = 5 , MoveAnnotation = 6 } |
| Enumeration of available actions this event handler can perform on the underlying annotation. More... | |
Public Member Functions | |
| PointBasedAnnotationEventHandler (GlPointBasedAnnotation &annotation, bool startInCreationMode=true) | |
| Instantiates a new PointBasedAnnotationEventHandler for the given annotation additionally specifying the initial state whether the event handler is in "creation mode" or not. | |
| bool | isInCreationMode () const |
| Returns whether this class is currently in "creation mode" where the only possible action for the user is to append new points at the end, or if it is in "regular mode" where you can edit an existing annotation. | |
| bool | enableCreationMode () |
| Switches the event handler into "creation mode" where the only possible action for the user is to append new points at the end. | |
| std::optional< InputEvent::KeyboardModifier > | snapToAngleModifier () const |
| Returns the keyboard modifier that can be used to snap angles to 45° during creation/moving of points. | |
| void | setSnapToAngleModifier (std::optional< InputEvent::KeyboardModifier > value) |
| Sets the keyboard modifier that can be used to snap angles to 45° during creation/moving of points. | |
| std::optional< InputEvent::KeyboardModifier > | insertPointModifier () const |
| Returns the keyboard modifier that can be used to preview the insertion of points when hovering with the mouse. | |
| void | setInsertPointModifier (std::optional< InputEvent::KeyboardModifier > value) |
| Sets the keyboard modifier that can be used to preview the insertion of points when hovering with the mouse. | |
| InputEventMapper< Action > & | actionMapper () |
| Get access to the mapping of input events to Actions of this event handler. | |
| EventResult | handleInputEvent (const InputEvent &event, const View &parentView) override |
| This function is called by sources of input events in order to dispatch them to the handlers. | |
| void | setAllowCursorChanges (bool change) |
Public Attributes | |
| Signal< Action > | signalActionHappened |
| Signal emitted whenever an action has been performed. | |
Protected Member Functions | |
| int | getInsertionIndex (const std::vector< vec3 > &points, const GL::ViewState &viewState, const vec2 &screenPos) const |
| GUI::EventResult | handleMouseEvent (const GUI::MouseEvent &event, const View &parentView) |
| GUI::EventResult | handleKeyEvent (const GUI::KeyEvent &event, const View &parentView) |
Static Protected Member Functions | |
| static vec3 | snapToAngle (const GL::ViewState &viewState, const vec3 &previousPointWorld, const vec3 ¤tPointWorld) |
Protected Attributes | |
| GlPointBasedAnnotation & | m_annotation |
| InputEventMapper< Action > | m_eventMapper |
| std::optional< InputEvent::KeyboardModifier > | m_snapToAngleModifier = InputEvent::KeyboardModifier::Shift |
| std::optional< InputEvent::KeyboardModifier > | m_insertPointModifier = InputEvent::KeyboardModifier::Alt |
| Utils::Variant< RegularMode, CreateMode, MovePointMode, MoveAnnotationMode > | m_currentMode = RegularMode() |
| bool | m_stopPropagationOfNextMouseReleaseEvent = false |
| bool | m_allowCursorChanges = true |
|
strong |
Enumeration of available actions this event handler can perform on the underlying annotation.
| bool ImFusion::GUI::PointBasedAnnotationEventHandler::enableCreationMode | ( | ) |
Switches the event handler into "creation mode" where the only possible action for the user is to append new points at the end.
Returns false if "creation mode" cannot be enabled because the maximum number of points is already reached.
|
inline |
Get access to the mapping of input events to Actions of this event handler.
You can use this to customize the mapping of mouse and keyboard buttons, or disable certain Actions altogether.
|
overridevirtual |
This function is called by sources of input events in order to dispatch them to the handlers.
In case there are more than one InputEventHandlers dispatchers are intended call this function consecutively until the first handler indicates to stop by returning a result where EventResult::stopPropagation() is true.
Implements ImFusion::GUI::ViewObject::EventHandler.