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 #define VTKIS_TWO_POINTER 10
121 
122 #define VTKIS_ANIM_OFF 0
123 #define VTKIS_ANIM_ON 1
124 
125 class vtkActor2D;
126 class vtkActor;
127 class vtkCallbackCommand;
129 class vtkOutlineSource;
130 class vtkPolyDataMapper;
131 class vtkProp3D;
132 class vtkProp;
134 
136 {
137 public:
141  static vtkInteractorStyle *New();
142 
144  void PrintSelf(ostream& os, vtkIndent indent);
145 
148  virtual void SetInteractor(vtkRenderWindowInteractor *interactor);
149 
155  virtual void SetEnabled(int);
156 
158 
164  vtkSetClampMacro(AutoAdjustCameraClippingRange, int, 0, 1 );
165  vtkGetMacro(AutoAdjustCameraClippingRange, int );
166  vtkBooleanMacro(AutoAdjustCameraClippingRange, int );
168 
172  void FindPokedRenderer(int,int);
173 
175 
176  vtkGetMacro(State,int);
178 
180 
181  vtkGetMacro(UseTimers,int);
182  vtkSetMacro(UseTimers,int);
183  vtkBooleanMacro(UseTimers,int);
185 
187 
191  vtkSetClampMacro(TimerDuration,unsigned long,1,100000);
192  vtkGetMacro(TimerDuration,unsigned long);
194 
196 
197  vtkSetMacro(HandleObservers,int);
198  vtkGetMacro(HandleObservers,int);
199  vtkBooleanMacro(HandleObservers,int);
201 
203 
204  virtual void OnMouseMove() {}
205  virtual void OnLeftButtonDown() {}
206  virtual void OnLeftButtonUp() {}
207  virtual void OnMiddleButtonDown() {}
208  virtual void OnMiddleButtonUp() {}
209  virtual void OnRightButtonDown() {}
210  virtual void OnRightButtonUp() {}
211  virtual void OnMouseWheelForward() {}
212  virtual void OnMouseWheelBackward() {}
214 
217  virtual void OnChar();
218 
219  // OnKeyDown is triggered by pressing any key (identical to OnKeyPress()).
220  // An empty implementation is provided. The behavior of this function should
221  // be specified in the subclass.
222  virtual void OnKeyDown() {}
223 
224  // OnKeyUp is triggered by releaseing any key (identical to OnKeyRelease()).
225  // An empty implementation is provided. The behavior of this function should
226  // be specified in the subclass.
227  virtual void OnKeyUp() {}
228 
229  // OnKeyPress is triggered by pressing any key (identical to OnKeyDown()).
230  // An empty implementation is provided. The behavior of this function should
231  // be specified in the subclass.
232  virtual void OnKeyPress() {}
233 
234  // OnKeyRelease is triggered by pressing any key (identical to OnKeyUp()).
235  // An empty implementation is provided. The behavior of this function should
236  // be specified in the subclass.
237  virtual void OnKeyRelease() {}
238 
240 
241  virtual void OnExpose() {}
242  virtual void OnConfigure() {}
243  virtual void OnEnter() {}
244  virtual void OnLeave() {}
246 
249  virtual void OnTimer();
250 
252 
256  virtual void Rotate() {}
257  virtual void Spin() {}
258  virtual void Pan() {}
259  virtual void Dolly() {}
260  virtual void Zoom() {}
261  virtual void UniformScale() {}
263 
265 
266  virtual void StartState(int newstate);
267  virtual void StopState();
269 
271 
272  virtual void StartAnimate();
273  virtual void StopAnimate();
274  virtual void StartRotate();
275  virtual void EndRotate();
276  virtual void StartZoom();
277  virtual void EndZoom();
278  virtual void StartPan();
279  virtual void EndPan();
280  virtual void StartSpin();
281  virtual void EndSpin();
282  virtual void StartDolly();
283  virtual void EndDolly();
284  virtual void StartUniformScale();
285  virtual void EndUniformScale();
286  virtual void StartTimer();
287  virtual void EndTimer();
288  virtual void StartTwoPointer();
289  virtual void EndTwoPointer();
291 
293 
297  virtual void HighlightProp(vtkProp *prop);
298  virtual void HighlightActor2D(vtkActor2D *actor2D);
299  virtual void HighlightProp3D(vtkProp3D *prop3D);
301 
303 
305  vtkSetVector3Macro(PickColor,double);
306  vtkGetVectorMacro(PickColor, double, 3);
308 
310 
313  vtkSetMacro(MouseWheelMotionFactor, double);
314  vtkGetMacro(MouseWheelMotionFactor, double);
316 
318 
320  vtkGetObjectMacro(TDxStyle,vtkTDxInteractorStyle);
321  virtual void SetTDxStyle(vtkTDxInteractorStyle *tdxStyle);
323 
325 
326  void DelegateTDxEvent(unsigned long event,
327  void *calldata);
329 
330 protected:
333 
335 
336  static void ProcessEvents(vtkObject* object,
337  unsigned long event,
338  void* clientdata,
339  void* calldata);
341 
342  // Keep track of current state
343  int State;
345 
346  // Should observers be handled here, should we fire timers
349  int TimerId; //keep track of the timers that are created/destroyed
350 
352 
353  // For picking and highlighting props
360  int PropPicked; // bool: prop picked?
361  double PickColor[3]; // support 2D picking
363 
364  // Control the timer duration
365  unsigned long TimerDuration; //in milliseconds
366 
367  // Forward events to the RenderWindowInteractor
369 
371 
372 private:
373  vtkInteractorStyle(const vtkInteractorStyle&); // Not implemented.
374  void operator=(const vtkInteractorStyle&); // Not implemented.
375 };
376 
377 #endif
a simple event forwarder command
virtual void OnLeftButtonDown()
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
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()
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
virtual void OnMouseWheelForward()
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:42
virtual void OnKeyRelease()
virtual void OnKeyPress()
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()
a simple class to control print indentation
Definition: vtkIndent.h:38
virtual void OnMouseWheelBackward()
unsigned long TimerDuration
create wireframe outline around bounding box
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)
virtual void OnChar()
static vtkObject * New()
virtual void OnMouseMove()
vtkOutlineSource * Outline
vtkTDxInteractorStyle * TDxStyle