ImFusion SDK 4.3
InteractionView2D Class Reference
+ Inheritance diagram for InteractionView2D:

Public Types

enum class  RotationReference { Dataset , View , Crossection }
 
enum class  InteractionTarget { Slice , Image }
 Enumeration of interaction modes allowing to choose between regular view interaction and the "move image" feature. More...
 

Signals

void windowingEditorRequested ()
 Connected slot should open a windowing editor for this view.
 
void moveImageStart ()
 Signals when the move image interaction starts.
 
void moveImageEnd ()
 Signals when the move image interaction ends.
 

Public Member Functions

 InteractionView2D (ImageView2D &view)
 
void setInteractionTarget (InteractionTarget target)
 
InteractionTarget interactionTarget () const
 
RotationReference rotationReference () const
 Returns the reference for determining the rotation center.
 
void setRotationReference (RotationReference value)
 Sets the reference for determining the rotation center.
 
void setTouchActions (const TouchActions &touchActions)
 Setter/getter pair for touch action types.
 
const TouchActionstouchActions () const
 
bool sceneEvent (QEvent *event) override
 Modify the view parameters based on the mouse events.
 
bool sceneEventTouch (QEvent *event)
 Modify the view parameters based on the touchscreen events.
 
void contextMenuCreate (QMenu &m) override
 Create context menu entries.
 
void contextMenuEvaluate (QAction *a) override
 Evaluate action chosen in context menu.
 
void createActions () override
 Create actions shown in context menu.
 
ImageView2Dview2D ()
 Returns the view of this interaction.
 
std::vector< SharedImageSet * > moveImages () const
 Returns the list of images that should be moved if interactionTarget() is InteractionTarget::Image.
 
void addMoveImage (SharedImageSet *val)
 Adds the given image to the list of images to which the "move image" feature is applied.
 
void removeMoveImage (const SharedImageSet *img)
 Removes the given image from the list of images to which the "move image" feature is applied.
 
void setMoveImageHighlightColor (const vec4 &color)
 Sets the color for highlighting move images.
 
void setMoveImageHighlightEnabled (bool enable)
 Enables/Disables highlighting of the move-image.
 
- Public Member Functions inherited from 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 ViewActionMapviewActionMap ()
 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 Interaction
virtual void openContextMenu (QPoint pos, QPoint globalPos, Qt::KeyboardModifiers modifiers)
 
virtual void reset ()
 
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.
 

Protected Member Functions

bool changePose (QMouseEvent *event)
 Changes the pose of the view using CumulativeViewManipulation2D.
 
vec3 rotationCenter (const SharedImageSet *sis=nullptr) const
 Returns the rotation center (optionally considering the image)
 
bool handleMouseMoveEvent (QMouseEvent *event)
 Returns true(false) if the mouse move was (not) handled.
 
bool hasMatchingAction (int touchPointsCount, ViewActionType action)
 Returns true (false) if there is (not) a matching action for the given number of touch-points Checks that the touch points are positive and smaller than three.
 
CumulativeViewManipulation2D * cumulativeManipulation () const
 Getters for the view manipulations.
 
ImmediateViewManipulation2D * immediateViewManipulation () const
 
- Protected Member Functions inherited from 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 Attributes

bool m_dragging = false
 
Qt::MouseButton m_mouseDragButton = Qt::NoButton
 
vec2 m_mouseDownPos = vec2::Zero()
 
vec2 m_mouseDelta = vec2::Zero()
 
vec3 m_rotationCenter = vec3::Zero()
 
std::optional< double > m_oldDistance = std::nullopt
 Indicates the cached distance between 2 former touchpoints.
 
vec2 m_oldPoint = vec2::Zero()
 Indicates the cached point of a single touch.
 
vec2 m_oldCenterPoint = vec2::Zero()
 Indicates the cached center between 2 former touchpoints.
 
QLineF m_oldAngleReferenceLine = {}
 Indicates the cached angle between 2 former lines (of 2 touchpoints)
 
TouchActions m_touchActions = {{PAN}, {PAN, ROTATESLICE2D, ZOOMSLICE}}
 Standard touch actions for one/two finger touch gestures.
 
InteractionTarget m_interactionTarget = InteractionTarget::Slice
 
RotationReference m_rotationReference = RotationReference::Crossection
 
- Protected Attributes inherited from ViewInteraction
InteractiveViewm_view
 
ViewActionMapm_viewActionMap
 Custom mapping for this specific view. This will override the global mapping if is not nullptr.
 
- Protected Attributes inherited from Interaction
QMap< QString, QAction * > m_actions
 Actions used in the context menu.
 
bool m_useContextMenu = false
 Default value is false.
 

Additional Inherited Members

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 ViewActionMapglobalViewActionMap ()
 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 ViewInteraction
static const std::unordered_map< ViewActionType, QString > viewActionsName
 
static const std::unordered_map< Qt::MouseButton, QString > mouseButtonsName
 
- Protected Slots inherited from ViewInteraction
void contextMenuEvaluate (QAction *action) override
 Evaluate action chosen in context menu or by shortcut.
 
- Static Protected Attributes inherited from 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 Enumeration Documentation

◆ InteractionTarget

enum class InteractionTarget
strong

Enumeration of interaction modes allowing to choose between regular view interaction and the "move image" feature.

Enumerator
Slice 

"move image" feature off: Panning and rotation interactions are applied to the view matrix.

Image 

"move image" feature on: Panning and rotation interactions are applied to the images in moveImages().

Member Function Documentation

◆ sceneEvent()

bool sceneEvent ( QEvent * event)
overridevirtual

Modify the view parameters based on the mouse events.

Implements Interaction.

◆ contextMenuCreate()

void contextMenuCreate ( QMenu & m)
overridevirtual

Create context menu entries.

Reimplemented from Interaction.

◆ contextMenuEvaluate()

void contextMenuEvaluate ( QAction * a)
overridevirtual

Evaluate action chosen in context menu.

Reimplemented from Interaction.

◆ createActions()

void createActions ( )
overridevirtual

Create actions shown in context menu.

Reimplemented from Interaction.

◆ addMoveImage()

void addMoveImage ( SharedImageSet * val)

Adds the given image to the list of images to which the "move image" feature is applied.

Will also enable the "move image" feature by setting the InteractionTarget flag to Image.

◆ removeMoveImage()

void removeMoveImage ( const SharedImageSet * img)

Removes the given image from the list of images to which the "move image" feature is applied.

If there are no move images left it will also disable the "move image" feature again by setting the InteractionTarget flag to Slice.


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close