ImFusion C++ SDK 4.4.0
ImFusion::Interaction3D Class Reference

#include <ImFusion/GUI/Interaction3D.h>

Standard 3D view interaction. More...

Inheritance diagram for ImFusion::Interaction3D:

Detailed Description

Standard 3D view interaction.

Public Member Functions

 Interaction3D (InteractiveView &view)
void reset (bool animate)
void reset () override
 Calls reset(true).
void setSceneCenter (const vec3 &center)
void setTranslation (double tx, double ty, double tz)
 Set translation in degrees.
void translation (double &tx, double &ty, double &tz)
 Get translation in degrees.
void setRotation (double rx, double ry, double rz)
 Set rotation in degrees.
void rotation (double &rx, double &ry, double &rz)
 Get rotation in degrees.
void setSensitivity (double sensitivityTranslation, double sensitivityRotation, double sensitivityDepth=-1)
 Set sensitivity, i.e. the factor by which the mouse movement is multiplied to obtain the movement in 3D space.
void sensitivity (double &sensitivityTranslation, double &sensitivityRotation, double &sensitivityDepth) const
 Get sensitivity, i.e. the factor by which the mouse movement is multiplied to obtain the movement in 3D space.
bool sceneEvent (QEvent *event) override
 Modify the translation and rotation parameters based on the mouse events.
mat4 transformation () const
 Return the transformation according to the current interaction state.
void setTransformation (const mat4 &mat)
 Interaction3D (GUI::VolumeView &view)
const mat4 & matrix () const
void setMatrix (const mat4 &mat)
void setInteractionCenter (const vec3 &center)
GUI::EventResult handleMouseEvent (const GUI::MouseEvent &event) override
GUI::EventResult handleContextMenuEvent (const GUI::ContextMenuEvent &event) override
Public Member Functions inherited from ImFusion::ViewInteraction
 ViewInteraction (InteractiveView &view)
 Instantiate a new ViewInteraction that contains already basic actions for the view.
void contextMenuCreate (QMenu &m) override
 Create context menu entries.
virtual void setViewActionMap (ViewActionMap *m)
 Sets the action mapping of this view. If nullptr, will default to the global one.
virtual ViewActionMap * viewActionMap ()
 Returns the local view action map for this view interaction, if any has been set.
void setMouseActionSpeed (ViewActionType action, double speed)
 Setters for the speed of a mouse (touch) action.
void setTouchActionSpeed (ViewActionType action, double speed)
double mouseActionSpeed (ViewActionType action) const
 Getters for the speed of a mouse (touch) action, return the default value if the action is not found in the map.
double touchActionSpeed (ViewActionType action) const
bool matchMappedActions (ViewActionType viewAction, Qt::MouseButton button, Qt::KeyboardModifiers modifiers) const
 Returns true if the MouseAction defined by button and modifiers is registered for the viewAction.
virtual void createCustomViewActionMap ()
 Must be used to override the global view action mapper This method can be overridden in order to define a custom default mapping between view actions and user mouse events Example code for the overridden method:
Public Member Functions inherited from ImFusion::Interaction
virtual void openContextMenu (QPoint pos, QPoint globalPos, Qt::KeyboardModifiers modifiers)
void setUseContextMenu (bool use)
 Set if the context menu must be created or not.
bool useContextMenu () const
 Specifies if the view creates context menu entries or not. Default value is false.
Public Member Functions inherited from ImFusion::GUI::VolumeViewDefaultEventHandler
 VolumeViewDefaultEventHandler (VolumeView &view)
const vec3 & rotationCenter () const
 Returns the center of rotation used during camera navigation.
void setRotationCenter (const vec3 &value)
 Sets the center of rotation used during camera navigation.
ActionSpeed actionSpeed (Action action) const
 Returns the speed at which a mouse/touch/keyboard event will modify the underlying view.
void setActionSpeed (Action action, ActionSpeed value)
 Sets the speed at which a mouse/touch/keyboard event will modify the underlying view.
bool orientToNormalOnDoubleClick () const
 Returns the flag whether MPR slices and camera should be oriented to the local surface normal on double click.
void setOrientToNormalOnDoubleClick (bool value)
 Sets the flag whether MPR slices and camera should be oriented to the local surface normal on double click.
void setUseLowQualityRenderingDuringInteraction (bool enable, std::optional< ByteSize > volumeSizeThreshold)
 Sets whether to reduce the visual rendering quality while running interactions to improve performance.
InputEventMapper< Action > & inputEventMapper ()
 Access to the helper class to map an InputEvent to an Action of this view to allow for to customize the mapping from the outside.
EventResult handleInputEvent (const InputEvent &event) override
 This function is called by sources of input events in order to dispatch them to the handlers.
Public Member Functions inherited from ImFusion::SignalReceiver
 SignalReceiver ()=default
 Default constructor.
 SignalReceiver (const SignalReceiver &other)
 Copy constructor, does not copy any existing signal connections from other.
SignalReceiveroperator= (SignalReceiver rhs)
 Assignment operator, disconnects all existing connections, does not copy any existing signal connections from rhs.
virtual ~SignalReceiver ()
 Virtual destructor disconnects from all connected signals.

Public Attributes

Signal resetPressed
Signal< vec3 > doubleClicked

Protected Member Functions

void applyIncrementalTransform ()
Protected Member Functions inherited from ImFusion::ViewInteraction
virtual void keyPressEvent (QKeyEvent *event)
 Triggers actions if the pressed key sequence matches their shortcut.
void createActions () override
 Creates actions shown in context menu.
Protected Member Functions inherited from ImFusion::GUI::VolumeViewDefaultEventHandler
virtual EventResult handleKeyEvent (const KeyEvent &event)
virtual EventResult handleTouchEvent (const TouchEvent &event)
void enableLowQualityRenderingIfApplicable ()
void disableLowQualityRendering ()
Protected Member Functions inherited from ImFusion::SignalReceiver
void disconnectAll ()
 Disconnects all existing connections.

Protected Attributes

InteractiveViewm_view
Protected Attributes inherited from ImFusion::ViewInteraction
InteractiveViewm_view
ViewActionMap * m_viewActionMap
 Custom mapping for this specific view. This will override the global mapping if is not nullptr.
Protected Attributes inherited from ImFusion::Interaction
QMap< QString, QAction * > m_actions
 Actions used in the context menu.
bool m_useContextMenu = false
 Default value is false.
Protected Attributes inherited from ImFusion::GUI::VolumeViewDefaultEventHandler
VolumeViewm_view
InputEventMapper< Actionm_actionMapper
CameraNavigation m_camNav
bool m_simultaneousBlending = true
bool m_orientToNormalOnDoubleClick = false
bool m_useLowQualityRenderingDuringInteraction = false
std::optional< ByteSizem_volumeSizeThresholdForLQRendering

Additional Inherited Members

Public Types inherited from ImFusion::GUI::VolumeViewDefaultEventHandler
enum class  Action {
  Pan , Zoom , Rotate , Windowing ,
  Blending , SetCameraPositiveX , SetCameraNegativeX , SetCameraPositiveY ,
  SetCameraNegativeY , SetCameraPositiveZ , SetCameraNegativeZ , PanUp ,
  PanDown , PanLeft , PanRight , ZoomIn ,
  ZoomOut , RotateUp , RotateDown , RotateLeft ,
  RotateRight
}
 Enumeration of actions that can be performed based on input events. More...
static bool addMappedViewAction (ViewActionType viewAction, Qt::MouseButton button, Qt::KeyboardModifiers modifiers)
static bool removeMappedViewAction (ViewActionType viewAction, Qt::MouseButton button, Qt::KeyboardModifiers modifiers)
 Removes mapping from viewAction to MouseAction defined by button and modifiers Returns true if removing succeeds, or false if this mapping does not exists.
static void resetActionMapping ()
 Loads the default view interaction mapping.
static const ViewActionMap & globalViewActionMap ()
 Const access to the global view action mapper.
static void setGlobalViewActionMap (const ViewActionMap &map)
 Sets the global view action map.
static bool hasConflicts (const ViewActionMap &actionMap, std::vector< std::pair< ViewActionType, ViewActionType > > &conflictingActions)
 Checks if the mapping defined in actionMap has any conflicts.
Static Public Attributes inherited from ImFusion::ViewInteraction
static const std::unordered_map< ViewActionType, QString > viewActionsName
static const std::unordered_map< Qt::MouseButton, QString > mouseButtonsName
Protected Slots inherited from ImFusion::ViewInteraction
void contextMenuEvaluate (QAction *action) override
 Evaluate action chosen in context menu or by shortcut.
Protected Slots inherited from ImFusion::Interaction
virtual void contextMenuEvaluate (QAction *)
 Evaluate action chosen in context menu or by shortcut.
Static Protected Attributes inherited from ImFusion::ViewInteraction
static ViewActionMap viewActionMapGlobal
 Global mapping between view actions and user mouse events (only mouse and keyboard modifiers now, touch and gestures must be supported too).

Member Function Documentation

◆ reset()

void ImFusion::Interaction3D::reset ( )
overridevirtual

Calls reset(true).

Reimplemented from ImFusion::Interaction.

◆ sceneEvent()

bool ImFusion::Interaction3D::sceneEvent ( QEvent * event)
overridevirtual

Modify the translation and rotation parameters based on the mouse events.

Implements ImFusion::Interaction.

◆ handleMouseEvent()

GUI::EventResult ImFusion::Interaction3D::handleMouseEvent ( const GUI::MouseEvent & event)
overridevirtual

◆ handleContextMenuEvent()

GUI::EventResult ImFusion::Interaction3D::handleContextMenuEvent ( const GUI::ContextMenuEvent & event)
overridevirtual

The documentation for this class was generated from the following files:
  • ImFusion/GUI/Interaction3D.h
  • ImFusionLabels/lib/include/ImFusion/Labels/UI/Views/Interaction3D.h
Search Tab / S to search, Esc to close