VTK
vtkRenderWindowInteractor3D.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkRenderWindowInteractor3D.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
29#ifndef vtkRenderWindowInteractor3D_h
30#define vtkRenderWindowInteractor3D_h
31
32#include "vtkRenderingCoreModule.h" // For export macro
34
35class vtkCamera;
36
37class VTKRENDERINGCORE_EXPORT vtkRenderWindowInteractor3D : public vtkRenderWindowInteractor
38{
39public:
44
46 void PrintSelf(ostream& os, vtkIndent indent);
47
49
58 virtual void Enable();
59 virtual void Disable();
61
67 void TerminateApp(void);
68
74
76
83 virtual double *GetWorldEventPosition(int pointerIndex)
84 {
85 if (pointerIndex >= VTKI_MAX_POINTERS)
86 {
87 return NULL;
88 }
89 return this->WorldEventPositions[pointerIndex];
90 }
91 virtual double *GetLastWorldEventPosition(int pointerIndex)
92 {
93 if (pointerIndex >= VTKI_MAX_POINTERS)
94 {
95 return NULL;
96 }
97 return this->LastWorldEventPositions[pointerIndex];
98 }
99 virtual double *GetWorldEventOrientation(int pointerIndex)
100 {
101 if (pointerIndex >= VTKI_MAX_POINTERS)
102 {
103 return NULL;
104 }
105 return this->WorldEventOrientations[pointerIndex];
106 }
107 virtual double *GetLastWorldEventOrientation(int pointerIndex)
108 {
109 if (pointerIndex >= VTKI_MAX_POINTERS)
110 {
111 return NULL;
112 }
113 return this->LastWorldEventOrientations[pointerIndex];
114 }
116
118
123 virtual void SetPhysicalEventPosition(double x, double y, double z, int pointerIndex)
124 {
125 if (pointerIndex < 0 || pointerIndex >= VTKI_MAX_POINTERS)
126 {
127 return;
128 }
129 vtkDebugMacro(
130 << this->GetClassName() << " (" << this
131 << "): setting PhysicalEventPosition to ("
132 << x << "," << y << "," << z
133 << ") for pointerIndex number " << pointerIndex);
134 if (this->PhysicalEventPositions[pointerIndex][0] != x ||
135 this->PhysicalEventPositions[pointerIndex][1] != y ||
136 this->PhysicalEventPositions[pointerIndex][2] != z ||
137 this->LastPhysicalEventPositions[pointerIndex][0] != x ||
138 this->LastPhysicalEventPositions[pointerIndex][1] != y ||
139 this->LastPhysicalEventPositions[pointerIndex][2] != z)
140 {
141 this->LastPhysicalEventPositions[pointerIndex][0] = this->PhysicalEventPositions[pointerIndex][0];
142 this->LastPhysicalEventPositions[pointerIndex][1] = this->PhysicalEventPositions[pointerIndex][1];
143 this->LastPhysicalEventPositions[pointerIndex][2] = this->PhysicalEventPositions[pointerIndex][2];
144 this->PhysicalEventPositions[pointerIndex][0] = x;
145 this->PhysicalEventPositions[pointerIndex][1] = y;
146 this->PhysicalEventPositions[pointerIndex][2] = z;
147 this->Modified();
148 }
149 }
151
153
158 virtual void SetWorldEventPosition(double x, double y, double z, int pointerIndex)
159 {
160 if (pointerIndex < 0 || pointerIndex >= VTKI_MAX_POINTERS)
161 {
162 return;
163 }
164 vtkDebugMacro(
165 << this->GetClassName() << " (" << this
166 << "): setting WorldEventPosition to ("
167 << x << "," << y << "," << z
168 << ") for pointerIndex number " << pointerIndex);
169 if (this->WorldEventPositions[pointerIndex][0] != x ||
170 this->WorldEventPositions[pointerIndex][1] != y ||
171 this->WorldEventPositions[pointerIndex][2] != z ||
172 this->LastWorldEventPositions[pointerIndex][0] != x ||
173 this->LastWorldEventPositions[pointerIndex][1] != y ||
174 this->LastWorldEventPositions[pointerIndex][2] != z)
175 {
176 this->LastWorldEventPositions[pointerIndex][0] = this->WorldEventPositions[pointerIndex][0];
177 this->LastWorldEventPositions[pointerIndex][1] = this->WorldEventPositions[pointerIndex][1];
178 this->LastWorldEventPositions[pointerIndex][2] = this->WorldEventPositions[pointerIndex][2];
179 this->WorldEventPositions[pointerIndex][0] = x;
180 this->WorldEventPositions[pointerIndex][1] = y;
181 this->WorldEventPositions[pointerIndex][2] = z;
182 this->Modified();
183 }
184 }
185 virtual void SetWorldEventOrientation(double w, double x, double y, double z, int pointerIndex)
186 {
187 if (pointerIndex < 0 || pointerIndex >= VTKI_MAX_POINTERS)
188 {
189 return;
190 }
191 vtkDebugMacro(
192 << this->GetClassName() << " (" << this
193 << "): setting WorldEventOrientation to ("
194 << w << "," << x << "," << y << "," << z
195 << ") for pointerIndex number " << pointerIndex);
196 if (this->WorldEventOrientations[pointerIndex][0] != w ||
197 this->WorldEventOrientations[pointerIndex][1] != x ||
198 this->WorldEventOrientations[pointerIndex][2] != y ||
199 this->WorldEventOrientations[pointerIndex][3] != z ||
200 this->LastWorldEventOrientations[pointerIndex][0] != w ||
201 this->LastWorldEventOrientations[pointerIndex][1] != x ||
202 this->LastWorldEventOrientations[pointerIndex][2] != y ||
203 this->LastWorldEventOrientations[pointerIndex][3] != z)
204 {
205 this->LastWorldEventOrientations[pointerIndex][0] = this->WorldEventOrientations[pointerIndex][0];
206 this->LastWorldEventOrientations[pointerIndex][1] = this->WorldEventOrientations[pointerIndex][1];
207 this->LastWorldEventOrientations[pointerIndex][2] = this->WorldEventOrientations[pointerIndex][2];
208 this->LastWorldEventOrientations[pointerIndex][3] = this->WorldEventOrientations[pointerIndex][3];
209 this->WorldEventOrientations[pointerIndex][0] = w;
210 this->WorldEventOrientations[pointerIndex][1] = x;
211 this->WorldEventOrientations[pointerIndex][2] = y;
212 this->WorldEventOrientations[pointerIndex][3] = z;
213 this->Modified();
214 }
215 }
217
219
222 virtual void RightButtonPressEvent();
225
227
230 vtkSetVector2Macro(TouchPadPosition,float);
231 vtkGetVector2Macro(TouchPadPosition,float);
233
235
239 virtual void SetPhysicalTranslation(vtkCamera *, double, double, double) {};
240 virtual double *GetPhysicalTranslation(vtkCamera *) { return NULL; };
242
244
247 void SetTranslation3D(double val[3]);
248 vtkGetVector3Macro(Translation3D, double);
249 vtkGetVector3Macro(LastTranslation3D, double);
251
252protected:
255
258 float TouchPadPosition[2];
259 double Translation3D[3];
260 double LastTranslation3D[3];
261
262 bool Done; // is the event loop done running
263
264 double WorldEventPositions[VTKI_MAX_POINTERS][3];
265 double LastWorldEventPositions[VTKI_MAX_POINTERS][3];
266 double PhysicalEventPositions[VTKI_MAX_POINTERS][3];
267 double LastPhysicalEventPositions[VTKI_MAX_POINTERS][3];
268 double StartingPhysicalEventPositions[VTKI_MAX_POINTERS][3];
269 double WorldEventOrientations[VTKI_MAX_POINTERS][4];
270 double LastWorldEventOrientations[VTKI_MAX_POINTERS][4];
271 virtual void RecognizeGesture(vtkCommand::EventIds);
272
273private:
274 vtkRenderWindowInteractor3D(const vtkRenderWindowInteractor3D&) VTK_DELETE_FUNCTION; // Not implemented.
275 void operator=(const vtkRenderWindowInteractor3D&) VTK_DELETE_FUNCTION; // Not implemented.
276};
277
278#endif
abstract API for pickers that can pick an instance of vtkProp
a virtual camera for 3D rendering
Definition: vtkCamera.h:51
a simple class to control print indentation
Definition: vtkIndent.h:40
const char * GetClassName() const
Return the class name as a string.
virtual void Modified()
Update the modification time for this object.
adds support for 3D events to vtkRenderWindowInteractor.
virtual double * GetPhysicalTranslation(vtkCamera *)
void SetTranslation3D(double val[3])
Set/get the tranlation for pan/swipe gestures, update LastTranslation.
virtual void SetWorldEventPosition(double x, double y, double z, int pointerIndex)
With VR we know the world coordinate positions and orientations of events.
virtual void SetWorldEventOrientation(double w, double x, double y, double z, int pointerIndex)
void TerminateApp(void)
OpenVR specific application terminate, calls ClassExitMethod then calls PostQuitMessage(0) to termina...
virtual void SetPhysicalEventPosition(double x, double y, double z, int pointerIndex)
With VR we know the physical/room coordinate positions and orientations of events.
virtual double * GetLastWorldEventOrientation(int pointerIndex)
virtual void SetPhysicalTranslation(vtkCamera *, double, double, double)
Set/Get the optional translation to map world coordinates into the 3D physical space (meters,...
virtual double * GetWorldEventOrientation(int pointerIndex)
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
virtual void RightButtonReleaseEvent()
virtual double * GetWorldEventPosition(int pointerIndex)
With VR we know the world coordinate positions and orientations of events.
static vtkRenderWindowInteractor3D * New()
Construct object so that light follows camera motion.
virtual vtkAbstractPropPicker * CreateDefaultPicker()
Create default picker.
virtual void RightButtonPressEvent()
Override to set pointers down.
virtual void RecognizeGesture(vtkCommand::EventIds)
virtual double * GetLastWorldEventPosition(int pointerIndex)
virtual void Enable()
Enable/Disable interactions.
platform-independent render window interaction including picking and frame rate control.
#define VTKI_MAX_POINTERS