![]() |
ImFusion C++ SDK 4.5.0
|
#include <ImFusion/GUI/BoxAnnotationEventHandler.h>
Event handler for creating and editing Box annotations. More...
Event handler for creating and editing Box annotations.
This event handler operates in different InteractionModes: None: default InteractionMode, no action is performed Create: allows setting the first two points that define the box MoveCorner: allows moving a corner of the box with the mouse MoveSide: allows moving a side of the box with the mouse MoveCenter: allows moving the box's center by dragging it with the mouse
Public Types | |
| enum class | InteractionMode { None = 0 , Create = 1 , MoveCorner = 1 << 1 , MoveSide = 1 << 2 , MoveCenter = 1 << 3 } |
| Enum class defining different interaction modes. | |
Public Member Functions | |
| BoxAnnotationEventHandler (GlBox &box, bool startInCreationMode=false) | |
| Constructor from a GlBox and an option to start the interaction in InteractionMode::Create. | |
| void | setInteractionMode (InteractionMode mode) |
| Setter/Getter pair for the InteractionMode. | |
| InteractionMode | interactionMode () const |
| void | enableCreationMode () |
| If not currently in Create Mode, clears the current points and enables InteractionMode::Create. | |
| void | setAdjustToViewAxis (bool enable) |
| Adjust the orientation of the box to the axis of the view. | |
| bool | adjustToViewAxis () const |
| void | setDefaultOrientation (mat3 orientation) |
| Sets the default orientation of box when created by the user. | |
| mat3 | defaultOrientation () const |
| const std::vector< vec3 > & | points () const |
| Returns the points that are currently set. | |
| EventResult | handleInputEvent (const InputEvent &event, const View &view) override |
| This function is called by sources of input events in order to dispatch them to the handlers. | |
| void ImFusion::GUI::BoxAnnotationEventHandler::setAdjustToViewAxis | ( | bool | enable | ) |
Adjust the orientation of the box to the axis of the view.
If set, the box will always be aligned to the current axis of the view it is created in, e.g. the box will be aligned to the screen axes. Otherwise the box uses the defaultOrientation. This only has an effect when the annotation is created. Enabled by default.
| void ImFusion::GUI::BoxAnnotationEventHandler::setDefaultOrientation | ( | mat3 | orientation | ) |
Sets the default orientation of box when created by the user.
This only has an effect if adjustToViewAxis is disabled. By default, the orientation is mat3::Identity(), i.e. the box will be axis-aligned to the world coordinate system.
|
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.