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=========================================================================*/
98#ifndef vtkInteractorStyle_h
99#define vtkInteractorStyle_h
100
101#include "vtkRenderingCoreModule.h" // For export macro
103
104// Motion flags
105
106#define VTKIS_START 0
107#define VTKIS_NONE 0
108
109#define VTKIS_ROTATE 1
110#define VTKIS_PAN 2
111#define VTKIS_SPIN 3
112#define VTKIS_DOLLY 4
113#define VTKIS_ZOOM 5
114#define VTKIS_USCALE 6
115#define VTKIS_TIMER 7
116#define VTKIS_FORWARDFLY 8
117#define VTKIS_REVERSEFLY 9
118#define VTKIS_TWO_POINTER 10
119
120#define VTKIS_ANIM_OFF 0
121#define VTKIS_ANIM_ON 1
122
123class vtkActor2D;
124class vtkActor;
127class vtkOutlineSource;
129class vtkProp3D;
130class vtkProp;
132
133class VTKRENDERINGCORE_EXPORT vtkInteractorStyle : public vtkInteractorObserver
134{
135public:
142
144 void PrintSelf(ostream& os, vtkIndent indent);
145
150 virtual void SetInteractor(vtkRenderWindowInteractor *interactor);
151
159 virtual void SetEnabled(int);
160
162
170 vtkSetClampMacro(AutoAdjustCameraClippingRange, int, 0, 1 );
171 vtkGetMacro(AutoAdjustCameraClippingRange, int );
172 vtkBooleanMacro(AutoAdjustCameraClippingRange, int );
174
180 void FindPokedRenderer(int,int);
181
183
186 vtkGetMacro(State,int);
188
190
193 vtkGetMacro(UseTimers,int);
194 vtkSetMacro(UseTimers,int);
195 vtkBooleanMacro(UseTimers,int);
197
199
205 vtkSetClampMacro(TimerDuration,unsigned long,1,100000);
206 vtkGetMacro(TimerDuration,unsigned long);
208
210
213 vtkSetMacro(HandleObservers,int);
214 vtkGetMacro(HandleObservers,int);
215 vtkBooleanMacro(HandleObservers,int);
217
221 virtual void OnMouseMove() {}
222 virtual void OnLeftButtonDown() {}
223 virtual void OnLeftButtonUp() {}
224 virtual void OnMiddleButtonDown() {}
225 virtual void OnMiddleButtonUp() {}
226 virtual void OnRightButtonDown() {}
227 virtual void OnRightButtonUp() {}
228 virtual void OnMouseWheelForward() {}
229 virtual void OnMouseWheelBackward() {}
230
235 virtual void OnChar();
236
237 // OnKeyDown is triggered by pressing any key (identical to OnKeyPress()).
238 // An empty implementation is provided. The behavior of this function should
239 // be specified in the subclass.
240 virtual void OnKeyDown() {}
241
242 // OnKeyUp is triggered by releaseing any key (identical to OnKeyRelease()).
243 // An empty implementation is provided. The behavior of this function should
244 // be specified in the subclass.
245 virtual void OnKeyUp() {}
246
247 // OnKeyPress is triggered by pressing any key (identical to OnKeyDown()).
248 // An empty implementation is provided. The behavior of this function should
249 // be specified in the subclass.
250 virtual void OnKeyPress() {}
251
252 // OnKeyRelease is triggered by pressing any key (identical to OnKeyUp()).
253 // An empty implementation is provided. The behavior of this function should
254 // be specified in the subclass.
255 virtual void OnKeyRelease() {}
256
260 virtual void OnExpose() {}
261 virtual void OnConfigure() {}
262 virtual void OnEnter() {}
263 virtual void OnLeave() {}
264
269 virtual void OnTimer();
270
277 virtual void Rotate() {}
278 virtual void Spin() {}
279 virtual void Pan() {}
280 virtual void Dolly() {}
281 virtual void Zoom() {}
282 virtual void UniformScale() {}
283
287 virtual void OnPinch() {}
288 virtual void OnRotate() {}
289 virtual void OnPan() {}
290 virtual void OnTap() {}
291 virtual void OnLongTap() {}
292 virtual void OnSwipe() {}
293
295
298 virtual void StartState(int newstate);
299 virtual void StopState();
301
303
306 virtual void StartAnimate();
307 virtual void StopAnimate();
308 virtual void StartRotate();
309 virtual void EndRotate();
310 virtual void StartZoom();
311 virtual void EndZoom();
312 virtual void StartPan();
313 virtual void EndPan();
314 virtual void StartSpin();
315 virtual void EndSpin();
316 virtual void StartDolly();
317 virtual void EndDolly();
318 virtual void StartUniformScale();
319 virtual void EndUniformScale();
320 virtual void StartTimer();
321 virtual void EndTimer();
322 virtual void StartTwoPointer();
323 virtual void EndTwoPointer();
325
327
333 virtual void HighlightProp(vtkProp *prop);
334 virtual void HighlightActor2D(vtkActor2D *actor2D);
335 virtual void HighlightProp3D(vtkProp3D *prop3D);
337
339
343 vtkSetVector3Macro(PickColor,double);
344 vtkGetVectorMacro(PickColor, double, 3);
346
348
353 vtkSetMacro(MouseWheelMotionFactor, double);
354 vtkGetMacro(MouseWheelMotionFactor, double);
356
358
362 vtkGetObjectMacro(TDxStyle,vtkTDxInteractorStyle);
363 virtual void SetTDxStyle(vtkTDxInteractorStyle *tdxStyle);
365
369 void DelegateTDxEvent(unsigned long event,
370 void *calldata);
371
372protected:
375
379 static void ProcessEvents(vtkObject* object,
380 unsigned long event,
381 void* clientdata,
382 void* calldata);
383
384 // Keep track of current state
385 int State;
387
388 // Should observers be handled here, should we fire timers
391 int TimerId; //keep track of the timers that are created/destroyed
392
394
395 // For picking and highlighting props
402 int PropPicked; // bool: prop picked?
403 double PickColor[3]; // support 2D picking
405
406 // Control the timer duration
407 unsigned long TimerDuration; //in milliseconds
408
409 // Forward events to the RenderWindowInteractor
411
413
414private:
415 vtkInteractorStyle(const vtkInteractorStyle&) VTK_DELETE_FUNCTION;
416 void operator=(const vtkInteractorStyle&) VTK_DELETE_FUNCTION;
417};
418
419#endif
a actor that draws 2D data
Definition: vtkActor2D.h:46
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:52
supports function callbacks
a simple event forwarder command
a simple class to control print indentation
Definition: vtkIndent.h:40
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor
provide event-driven interface to the rendering window (defines trackball mode)
virtual void StopAnimate()
vtkPolyDataMapper * OutlineMapper
virtual void OnMouseWheelBackward()
virtual void SetEnabled(int)
Turn on/off this interactor.
virtual void OnMiddleButtonDown()
virtual void OnLongTap()
virtual void OnEnter()
virtual void HighlightProp(vtkProp *prop)
When picking successfully selects an actor, this method highlights the picked prop appropriately.
virtual void EndUniformScale()
static vtkInteractorStyle * New()
This class must be supplied with a vtkRenderWindowInteractor wrapper or parent.
virtual void StartPan()
vtkEventForwarderCommand * EventForwarder
virtual void StartTimer()
virtual void OnRightButtonDown()
virtual void OnChar()
OnChar is triggered when an ASCII key is pressed.
virtual void Rotate()
These methods for the different interactions in different modes are overridden in subclasses to perfo...
void DelegateTDxEvent(unsigned long event, void *calldata)
Called by the callback to process 3DConnexion device events.
virtual void EndDolly()
virtual void OnKeyPress()
virtual void HighlightProp3D(vtkProp3D *prop3D)
virtual void UniformScale()
virtual void OnExpose()
These are more esoteric events, but are useful in some cases.
virtual void OnRightButtonUp()
virtual void OnKeyUp()
virtual void OnKeyDown()
virtual void OnConfigure()
virtual void OnPinch()
gesture based events
virtual void OnLeftButtonDown()
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
virtual void EndPan()
unsigned long TimerDuration
virtual void OnRotate()
virtual void OnMouseWheelForward()
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
Main process event method.
virtual void HighlightActor2D(vtkActor2D *actor2D)
virtual void OnMiddleButtonUp()
virtual void StartState(int newstate)
utility routines used by state changes
virtual void EndTwoPointer()
virtual void OnTimer()
OnTimer calls Rotate, Rotate etc which should be overridden by style subclasses.
virtual void OnLeave()
virtual void SetInteractor(vtkRenderWindowInteractor *interactor)
Set/Get the Interactor wrapper being controlled by this object.
virtual void StartUniformScale()
vtkOutlineSource * Outline
virtual void SetTDxStyle(vtkTDxInteractorStyle *tdxStyle)
vtkRenderer * PickedRenderer
virtual void StartZoom()
virtual void StartSpin()
virtual void OnMouseMove()
Generic event bindings can be overridden in subclasses.
virtual void OnKeyRelease()
void FindPokedRenderer(int, int)
When an event occurs, we must determine which Renderer the event occurred within, since one RenderWin...
virtual void StopState()
virtual void EndSpin()
virtual void EndTimer()
virtual void EndZoom()
virtual void OnLeftButtonUp()
virtual void StartTwoPointer()
vtkActor2D * PickedActor2D
virtual void StartDolly()
virtual void OnSwipe()
virtual void StartRotate()
virtual void StartAnimate()
Interaction mode entry points used internally.
vtkTDxInteractorStyle * TDxStyle
virtual void EndRotate()
abstract base class for most VTK objects
Definition: vtkObject.h:60
create wireframe outline around bounding box
map vtkPolyData to graphics primitives
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:47
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:48
platform-independent render window interaction including picking and frame rate control.
abstract specification for renderers
Definition: vtkRenderer.h:64
provide 3DConnexion device event-driven interface to the rendering window
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.