Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
vtkMRMLInteractionEventData.h
Go to the documentation of this file.
1/*==============================================================================
2
3 Program: 3D Slicer
4
5 Copyright (c) Kitware Inc.
6
7 See COPYRIGHT.txt
8 or http://www.slicer.org/copyright/copyright.txt for details.
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15
16==============================================================================*/
17
18#ifndef __vtkMRMLInteractionEventData_h
19#define __vtkMRMLInteractionEventData_h
20
21// VTK includes
22#include "vtkEventData.h"
23
24// MRML includes
25#include "vtkMRMLExport.h"
26
28class vtkRenderWindowInteractor;
29class vtkRenderer;
30class vtkCellPicker;
31
35class VTK_MRML_EXPORT vtkMRMLInteractionEventData : public vtkEventDataDevice3D
36{
37public:
38 vtkTypeMacro(vtkMRMLInteractionEventData, vtkEventDataDevice3D);
40
43 {
44 LeftButtonClickEvent = vtkCommand::UserEvent + 300, // button press and release without moving mouse
47 };
48
49 void SetType(unsigned long v);
50
51 void SetModifiers(int v);
53
55
58 void SetWorldPosition(const double p[3], bool accurate = true);
62
63 bool ComputeAccurateWorldPosition(bool force = false);
65
66 void GetDisplayPosition(int v[2]) const;
67 const int* GetDisplayPosition() const VTK_SIZEHINT(2);
68 void SetDisplayPosition(const int p[2]);
71
72 void SetKeyCode(char v);
73 char GetKeyCode();
74 void SetKeyRepeatCount(char v);
76 void SetKeySym(const std::string &v);
77 const std::string& GetKeySym();
78
81
82 void SetComponentType(int componentType);
83 int GetComponentType() const;
84
85 void SetComponentIndex(int componentIndex);
86 int GetComponentIndex() const;
87
90
91 void SetRotation(double v);
92 double GetRotation() const;
93 void SetLastRotation(double v);
94 double GetLastRotation() const;
95 void SetScale(double scale);
96 double GetScale() const;
97 void SetLastScale(double scale);
98 double GetLastScale() const;
99 void SetTranslation(const double translation[2]);
100 const double* GetTranslation() const VTK_SIZEHINT(2);
101 void SetLastTranslation(const double translation[2]);
102 const double* GetLastTranslation() const VTK_SIZEHINT(2);
105
107 void SetAttributesFromInteractor(vtkRenderWindowInteractor* interactor);
108
109 vtkRenderer* GetRenderer() const;
110 void SetRenderer(vtkRenderer* ren);
111
112 void SetAccuratePicker(vtkCellPicker* picker);
113 vtkCellPicker* GetAccuratePicker() const;
114
115 void SetInteractionContextName(const std::string& v);
116 const std::string& GetInteractionContextName();
117
118 void WorldToDisplay(const double worldPosition[3], double displayPosition[3]);
119
120protected:
128 vtkRenderer* Renderer;
129 vtkCellPicker* AccuratePicker;
135
137
140 std::string KeySym;
142
143 // Gesture events
145
146 double Rotation;
148 double Scale;
149 double LastScale;
150 double Translation[2];
153
157
160
161 bool Equivalent(const vtkEventData *e) const override;
162
164 ~vtkMRMLInteractionEventData() override = default;
165
166private:
168 void operator=(const vtkMRMLInteractionEventData&) = delete;
169};
170
171#endif
Abstract MRML node to represent a view. The class holds the properties common to any view type (3D,...
double Rotation
macOS touchpad events
void SetViewNode(vtkMRMLAbstractViewNode *viewNode)
const double * GetTranslation() const VTK_SIZEHINT(2)
bool GetMouseMovedSinceButtonDown() const
void SetDisplayPosition(const int p[2])
const std::string & GetKeySym()
bool ComputeAccurateWorldPosition(bool force=false)
static vtkMRMLInteractionEventData * New()
void SetLastTranslation(const double translation[2])
const std::string & GetInteractionContextName()
void GetDisplayPosition(int v[2]) const
const double * GetLastTranslation() const VTK_SIZEHINT(2)
void WorldToDisplay(const double worldPosition[3], double displayPosition[3])
vtkRenderer * GetRenderer() const
void SetTranslation(const double translation[2])
vtkCellPicker * GetAccuratePicker() const
void SetKeySym(const std::string &v)
void SetAttributesFromInteractor(vtkRenderWindowInteractor *interactor)
Set Modifiers and Key... attributes from interactor.
void SetWorldPosition(const double p[3], bool accurate=true)
void SetRenderer(vtkRenderer *ren)
void SetAccuratePicker(vtkCellPicker *picker)
std::string InteractionContextName
Name of interaction context. In case of the mouse, it is empty string.
void SetScale(double scale)
MRMLInteractionEvents
Extends vtkCommand events.
void SetComponentIndex(int componentIndex)
double GetWorldToPhysicalScale() const
bool Equivalent(const vtkEventData *e) const override
const int * GetDisplayPosition() const VTK_SIZEHINT(2)
void SetType(unsigned long v)
void SetLastRotation(double v)
void SetLastScale(double scale)
void SetComponentType(int componentType)
void SetMouseMovedSinceButtonDown(bool moved)
void SetWorldToPhysicalScale(double v)
double GetLastRotation() const
vtkMRMLAbstractViewNode * GetViewNode() const
void SetInteractionContextName(const std::string &v)