VTK
vtkInteractorStyle.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkInteractorStyle.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 =========================================================================*/
100 #ifndef __vtkInteractorStyle_h
101 #define __vtkInteractorStyle_h
102 
103 #include "vtkRenderingCoreModule.h" // For export macro
104 #include "vtkInteractorObserver.h"
105 
106 // Motion flags
107 
108 #define VTKIS_START 0
109 #define VTKIS_NONE 0
110 
111 #define VTKIS_ROTATE 1
112 #define VTKIS_PAN 2
113 #define VTKIS_SPIN 3
114 #define VTKIS_DOLLY 4
115 #define VTKIS_ZOOM 5
116 #define VTKIS_USCALE 6
117 #define VTKIS_TIMER 7
118 #define VTKIS_FORWARDFLY 8
119 #define VTKIS_REVERSEFLY 9
120 
121 #define VTKIS_ANIM_OFF 0
122 #define VTKIS_ANIM_ON 1
123 
124 class vtkActor2D;
125 class vtkActor;
126 class vtkCallbackCommand;
128 class vtkOutlineSource;
129 class vtkPolyDataMapper;
130 class vtkProp3D;
131 class vtkProp;
133 
135 {
136 public:
140  static vtkInteractorStyle *New();
141 
143  void PrintSelf(ostream& os, vtkIndent indent);
144 
147  virtual void SetInteractor(vtkRenderWindowInteractor *interactor);
148 
154  virtual void SetEnabled(int);
155 
157 
163  vtkSetClampMacro(AutoAdjustCameraClippingRange, int, 0, 1 );
164  vtkGetMacro(AutoAdjustCameraClippingRange, int );
165  vtkBooleanMacro(AutoAdjustCameraClippingRange, int );
167 
171  void FindPokedRenderer(int,int);
172 
174 
175  vtkGetMacro(State,int);
177 
179 
180  vtkGetMacro(UseTimers,int);
181  vtkSetMacro(UseTimers,int);
182  vtkBooleanMacro(UseTimers,int);
184 
186 
190  vtkSetClampMacro(TimerDuration,unsigned long,1,100000);
191  vtkGetMacro(TimerDuration,unsigned long);
193 
195 
196  vtkSetMacro(HandleObservers,int);
197  vtkGetMacro(HandleObservers,int);
198  vtkBooleanMacro(HandleObservers,int);
200 
202 
203  virtual void OnMouseMove() {}
204  virtual void OnLeftButtonDown() {}
205  virtual void OnLeftButtonUp() {}
206  virtual void OnMiddleButtonDown() {}
207  virtual void OnMiddleButtonUp() {}
208  virtual void OnRightButtonDown() {}
209  virtual void OnRightButtonUp() {}
210  virtual void OnMouseWheelForward() {}
211  virtual void OnMouseWheelBackward() {}
213 
216  virtual void OnChar();
217 
218  // OnKeyDown is triggered by pressing any key (identical to OnKeyPress()).
219  // An empty implementation is provided. The behavior of this function should
220  // be specified in the subclass.
221  virtual void OnKeyDown() {}
222 
223  // OnKeyUp is triggered by releaseing any key (identical to OnKeyRelease()).
224  // An empty implementation is provided. The behavior of this function should
225  // be specified in the subclass.
226  virtual void OnKeyUp() {}
227 
228  // OnKeyPress is triggered by pressing any key (identical to OnKeyDown()).
229  // An empty implementation is provided. The behavior of this function should
230  // be specified in the subclass.
231  virtual void OnKeyPress() {}
232 
233  // OnKeyRelease is triggered by pressing any key (identical to OnKeyUp()).
234  // An empty implementation is provided. The behavior of this function should
235  // be specified in the subclass.
236  virtual void OnKeyRelease() {}
237 
239 
240  virtual void OnExpose() {}
241  virtual void OnConfigure() {}
242  virtual void OnEnter() {}
243  virtual void OnLeave() {}
245 
248  virtual void OnTimer();
249 
251 
255  virtual void Rotate() {}
256  virtual void Spin() {}
257  virtual void Pan() {}
258  virtual void Dolly() {}
259  virtual void Zoom() {}
260  virtual void UniformScale() {}
262 
264 
265  virtual void StartState(int newstate);
266  virtual void StopState();
268 
270 
271  virtual void StartAnimate();
272  virtual void StopAnimate();
273  virtual void StartRotate();
274  virtual void EndRotate();
275  virtual void StartZoom();
276  virtual void EndZoom();
277  virtual void StartPan();
278  virtual void EndPan();
279  virtual void StartSpin();
280  virtual void EndSpin();
281  virtual void StartDolly();
282  virtual void EndDolly();
283  virtual void StartUniformScale();
284  virtual void EndUniformScale();
285  virtual void StartTimer();
286  virtual void EndTimer();
288 
290 
294  virtual void HighlightProp(vtkProp *prop);
295  virtual void HighlightActor2D(vtkActor2D *actor2D);
296  virtual void HighlightProp3D(vtkProp3D *prop3D);
298 
300 
302  vtkSetVector3Macro(PickColor,double);
303  vtkGetVectorMacro(PickColor, double, 3);
305 
307 
310  vtkSetMacro(MouseWheelMotionFactor, double);
311  vtkGetMacro(MouseWheelMotionFactor, double);
313 
315 
318  virtual void SetTDxStyle(vtkTDxInteractorStyle *tdxStyle);
320 
322 
323  void DelegateTDxEvent(unsigned long event,
324  void *calldata);
326 
327 protected:
330 
332 
333  static void ProcessEvents(vtkObject* object,
334  unsigned long event,
335  void* clientdata,
336  void* calldata);
338 
339  // Keep track of current state
340  int State;
342 
343  // Should observers be handled here, should we fire timers
346  int TimerId; //keep track of the timers that are created/destroyed
347 
349 
350  // For picking and highlighting props
357  int PropPicked; // bool: prop picked?
358  double PickColor[3]; // support 2D picking
360 
361  // Control the timer duration
362  unsigned long TimerDuration; //in milliseconds
363 
364  // Forward events to the RenderWindowInteractor
366 
368 
369 private:
370  vtkInteractorStyle(const vtkInteractorStyle&); // Not implemented.
371  void operator=(const vtkInteractorStyle&); // Not implemented.
372 };
373 
374 #endif
a simple event forwarder command
virtual void OnLeftButtonDown()
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:47
virtual void SetInteractor(vtkRenderWindowInteractor *iren)
virtual void OnMiddleButtonDown()
virtual void OnRightButtonDown()
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:50
abstract base class for most VTK objects
Definition: vtkObject.h:61
virtual void OnLeftButtonUp()
virtual void OnKeyUp()
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
virtual void OnMiddleButtonUp()
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:83
a actor that draws 2D data
Definition: vtkActor2D.h:44
virtual void SetEnabled(int)
virtual void UniformScale()
abstract specification for renderers
Definition: vtkRenderer.h:63
#define vtkSetClampMacro(name, type, min, max)
Definition: vtkSetGet.h:133
virtual void OnMouseWheelForward()
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:42
virtual void OnKeyRelease()
virtual void OnKeyPress()
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:619
virtual void OnEnter()
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor ...
vtkPolyDataMapper * OutlineMapper
virtual void OnRightButtonUp()
platform-independent render window interaction including picking and frame rate control.
vtkEventForwarderCommand * EventForwarder
virtual void OnExpose()
supports function callbacks
vtkActor2D * PickedActor2D
virtual void OnKeyDown()
virtual void OnConfigure()
struct _cl_event * event
Definition: vtkgl.h:14387
a simple class to control print indentation
Definition: vtkIndent.h:38
virtual void OnMouseWheelBackward()
unsigned long TimerDuration
create wireframe outline around bounding box
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:222
vtkRenderer * PickedRenderer
provide 3DConnexion device event-driven interface to the rendering window
map vtkPolyData to graphics primitives
provide event-driven interface to the rendering window (defines trackball mode)
#define VTKRENDERINGCORE_EXPORT
virtual void OnLeave()
void PrintSelf(ostream &os, vtkIndent indent)
#define vtkBooleanMacro(name, type)
Definition: vtkSetGet.h:234
virtual void OnChar()
static vtkObject * New()
#define vtkSetVector3Macro(name, type)
Definition: vtkSetGet.h:277
#define vtkGetVectorMacro(name, type, count)
Definition: vtkSetGet.h:414
virtual void OnMouseMove()
vtkOutlineSource * Outline
#define vtkSetMacro(name, type)
Definition: vtkSetGet.h:69
vtkTDxInteractorStyle * TDxStyle