![]() |
ImFusion SDK 4.3
|
User interaction with views and overlays. More...
User interaction with views and overlays.
Interaction is the top-most class for handling user interaction with views and overlays. It is the base class for ViewInteraction and OverlayInteraction, and contains methods for creating and evaluating context menus as well as handing user inputs such as mouse events. Each InteractiveView has a ViewInteraction object for handing its interactions, and similarly, every InteractiveOverlay has an OverlayInteraction.
DisplayWidget filters all the QEvents inside the display area and sends them to corresponding InteractiveViews based on the mouse position and type of the event. sceneEvent method in InteractiveView receives the QEvent; the event is first sent to handleOverlayEvent method in ViewInteraction to check if it belongs to one of the overlays of that view. If the overlays do not accept the event then it will be passed to sceneEvent method in ViewInteraction. The QEvent is then processed by the sceneEvent method of ViewInteraction and changes are applied to the view.
Standard view action types such as pan, zoom, rotate, etc. are defined in ViewActionType enum in the ViewInteraction header file.
A mapping between these actions and combination of a mouse button and keyboard modifiers {control, shift, alt} is defined in the base ViewInteraction class. This global mapping is used by all the 2D and 3D views and it can be modified either in settings dialog in run-time or by using the API methods defined in ViewInteraction class. Creating a custom interaction mapping can be done in a sub-class of ViewInteraction similar to the following code:
This mapping is used in the sceneEvent method of view interaction classes to apply desired changes to GlView of the InteractiveView.
Defining more specific interactions can be achieved by overriding the sceneEvent method in ViewInteraction and handling the QEvent passed to this method. The events can be handled similar to this example:
Additional actions can be added to the context menu of a view and be handled in overridden contextMenuEvaluate method of ViewInteraction. In order to keep the context menu functionality of the base interaction classes, call the contextMenuCreate and contextMenuEvaluate methods of the base class in your overridden methods. Adding a new action to view's context menu and handling it can be achieved similar to the following code:
Classes | |
class | Interaction |
Base interface class for view and overlay interactions. More... | |
class | InteractionPlotView |
Interaction class for plot view. More... | |
class | InteractionView3D |
Standard 2D/3D view interaction. More... | |
class | OverlayInteraction |
Base class for all overlay interactions. More... | |
class | ViewInteraction |
Base class for all view interactions. More... | |
Enumerations | |
enum | ViewActionType { PAN = 0 , ZOOMSLICE = 1 , ROTATESLICE3D = 2 , ROTATESLICE2D = 3 , SWEEPSLICE3D = 4 , SWEEPSLICE2D = 5 , ROTATE3D = 6 , ZOOM3D = 7 , WINDOW = 8 , BLEND = 9 } |
Basic actions which are applied on the views. More... | |
enum ViewActionType |
#include <ImFusion/GUI/ViewInteraction.h>
Basic actions which are applied on the views.
Enumerator | |
---|---|
PAN | Translation of camera in 2D/3D views. |
ZOOMSLICE | Zooming in 2D views. |
ROTATESLICE3D | 3D rotation of a slice in MPR views |
ROTATESLICE2D | Rotation of 2D views inside their plane. |
SWEEPSLICE3D | Moving a MPR 2D slice along its third dimension. |
SWEEPSLICE2D | Changing the focus of SharedImageSet in a 2D view. |
ROTATE3D | Rotation of camera in 3D views. |
ZOOM3D | Zooming in 3D views. |
WINDOW | Changing the window and level of a view. |
BLEND | Changing the blend factor of a 2D view. |