Slicer 5.4
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
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 "vtkMRMLDisplayableManagerExport.h"
26
28class vtkRenderWindowInteractor;
29class vtkRenderer;
30class vtkCellPicker;
31
35class VTK_MRML_DISPLAYABLEMANAGER_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]);
69 bool IsDisplayPositionValid();
70 void SetDisplayPositionInvalid();
71
72 void SetKeyCode(char v);
73 char GetKeyCode();
74 void SetKeyRepeatCount(char v);
75 int GetKeyRepeatCount();
76 void SetKeySym(const std::string &v);
77 const std::string& GetKeySym();
78
79 void SetViewNode(vtkMRMLAbstractViewNode* viewNode);
80 vtkMRMLAbstractViewNode* GetViewNode() const;
81
82 void SetComponentType(int componentType);
83 int GetComponentType() const;
84
85 void SetComponentIndex(int componentIndex);
86 int GetComponentIndex() const;
87
88 void SetMouseMovedSinceButtonDown(bool moved);
89 bool GetMouseMovedSinceButtonDown() const;
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);
103 void SetWorldToPhysicalScale(double v);
104 double GetWorldToPhysicalScale() const;
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:
121 int Modifiers;
122 int DisplayPosition[2];
123 bool DisplayPositionValid;
124 bool WorldPositionValid;
125 bool WorldPositionAccurate;
126 bool ComputeAccurateWorldPositionAttempted;
128 vtkRenderer* Renderer;
129 vtkCellPicker* AccuratePicker;
130 int ComponentType;
131 int ComponentIndex;
132 bool MouseMovedSinceButtonDown;
133 double WorldToViewTransformMatrix[16];
134 bool WorldToViewTransformMatrixValid;
135
137
138 char KeyCode;
139 int KeyRepeatCount;
140 std::string KeySym;
142
143 // Gesture events
145
146 double Rotation;
147 double LastRotation;
148 double Scale;
149 double LastScale;
150 double Translation[2];
151 double LastTranslation[2];
153
156 double WorldToPhysicalScale;
157
159 std::string InteractionContextName;
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,...
bool ComputeAccurateWorldPosition(bool force=false)
static vtkMRMLInteractionEventData * New()
void GetDisplayPosition(int v[2]) const
void SetWorldPosition(const double p[3], bool accurate=true)
MRMLInteractionEvents
Extends vtkCommand events.
const int * GetDisplayPosition() const VTK_SIZEHINT(2)
void SetType(unsigned long v)