MeVisLab Toolbox Reference
SoView2DInteraction.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2017, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#pragma once
14
16
17#include "SoView2DExtension.h"
18#include "View2DPosition.h"
19
23{
24public:
26 void setDevicePosition(const SbVec2f& pos) { _relPos = pos; }
27 void setVoxelPosition(const SbVec3f& pos) { _voxelPos = pos; }
28 void setViewport(const SbVec2f& origin, const SbVec2f& size)
29 {
30 _vpOrigin = origin; _vpSize = size;
31 }
32};
33
34//===================================================================================
35
40{
41public:
43
44protected:
46 bool augmentLocation(SoPointerPosition& position, bool dragging) override;
47
49 bool isEnabled(SoPointingAction* action, int currentMask) override;
50
53 bool isValidStartingLocation(const SoPointerPosition& location) override;
54
58
61
64};
65
70{
71public:
73
75 std::list<SoInteraction*> getInteractions(SoState* state) override;
76
78 void pointerPosition(SoState* state, const SoPointerPosition& pos) override;
79
81 void pointerLeftWindow(SoState* state) override;
82
83protected:
86 const SoNodeList* getExtensionList(SoState* state);
87
90
93};
94
96{
97public:
98 SoView2DKeyboardAction(SoView2D* view, const std::string& id, SoKeyboardEvent::Key key, bool withShift = false);
99 SoView2DKeyboardAction(SoView2D* view, const std::string& id, SoKeyboardEvent::Key key, SoKeyboardEvent::Key key2);
100
101 bool isNumberKey() const { return _numberKey; }
102
103 void execute() override;
104
105protected:
108};
void setVoxelPosition(const SbVec3f &pos)
void setDevicePosition(const SbVec2f &pos)
MutableView2DPosition(SoView2D *viewer)
void setViewport(const SbVec2f &origin, const SbVec2f &size)
SoCommandAction(SoInteractionOwner *owner, std::string id)
SoInteractionHandler(SoInteractionProvider *provider)
SoInteractionProvider()
Default constructor.
SoPointerPosition manages the current position of the mouse cursor.
SoView2D * getView() const
SoView2DKeyboardAction(SoView2D *view, const std::string &id, SoKeyboardEvent::Key key, SoKeyboardEvent::Key key2)
void execute() override
Executes the action. Must be overridden by user.
SoView2DKeyboardAction(SoView2D *view, const std::string &id, SoKeyboardEvent::Key key, bool withShift=false)
SoView2D is a 2D viewer for image data.
Definition SoView2D.h:62
bool _dragging
While dragging convert positions relative to the start slice.
MutableView2DPosition _view2DPosition
bool isValidStartingLocation(const SoPointerPosition &location) override
bool isEnabled(SoPointingAction *action, int currentMask) override
Only enable actions if the image in the SoView2D is valid.
View2DInteractionHandler(SoView2D *viewer, SoInteractionProvider *provider)
SoView2D * _viewer
Back-reference to the SoView2D object.
bool augmentLocation(SoPointerPosition &position, bool dragging) override
Set SoView2D information in position.
const SoNodeList * getExtensionList(SoState *state)
SoView2D * _viewer
Back-reference to the SoView2D object.
void pointerLeftWindow(SoState *state) override
Forwarding to the SoView2DExtensions.
std::list< SoInteraction * > getInteractions(SoState *state) override
return interactions from SoView2DExtensions
bool isExtensionEnabled(SoView2DExtension *ext) const
return true if interactions from the given SoView2DExtension should be handled
void pointerPosition(SoState *state, const SoPointerPosition &pos) override
Forwarding to the SoView2DExtensions.
View2DInteractionProvider(SoView2D *viewer)
View2DPosition(SoView2D *viewer=nullptr)
Constructor and destructor.