00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00097 #ifndef __vtkInteractorStyle_h
00098 #define __vtkInteractorStyle_h
00099
00100 #include "vtkInteractorObserver.h"
00101
00102
00103
00104 #define VTKIS_START 0
00105 #define VTKIS_NONE 0
00106
00107 #define VTKIS_ROTATE 1
00108 #define VTKIS_PAN 2
00109 #define VTKIS_SPIN 3
00110 #define VTKIS_DOLLY 4
00111 #define VTKIS_ZOOM 5
00112 #define VTKIS_USCALE 6
00113 #define VTKIS_TIMER 7
00114 #define VTKIS_FORWARDFLY 8
00115 #define VTKIS_REVERSEFLY 9
00116
00117 #define VTKIS_ANIM_OFF 0
00118 #define VTKIS_ANIM_ON 1
00119
00120 class vtkActor2D;
00121 class vtkActor;
00122 class vtkCallbackCommand;
00123 class vtkEventForwarderCommand;
00124 class vtkOutlineSource;
00125 class vtkPolyDataMapper;
00126 class vtkProp3D;
00127 class vtkProp;
00128
00129 class VTK_RENDERING_EXPORT vtkInteractorStyle : public vtkInteractorObserver
00130 {
00131 public:
00135 static vtkInteractorStyle *New();
00136
00137 vtkTypeRevisionMacro(vtkInteractorStyle,vtkInteractorObserver);
00138 void PrintSelf(ostream& os, vtkIndent indent);
00139
00142 virtual void SetInteractor(vtkRenderWindowInteractor *interactor);
00143
00149 virtual void SetEnabled(int);
00150
00152
00158 vtkSetClampMacro(AutoAdjustCameraClippingRange, int, 0, 1 );
00159 vtkGetMacro(AutoAdjustCameraClippingRange, int );
00160 vtkBooleanMacro(AutoAdjustCameraClippingRange, int );
00162
00166 void FindPokedRenderer(int,int);
00167
00169
00170 vtkGetMacro(State,int);
00172
00174
00175 vtkGetMacro(UseTimers,int);
00176 vtkSetMacro(UseTimers,int);
00177 vtkBooleanMacro(UseTimers,int);
00179
00181
00185 vtkSetClampMacro(TimerDuration,unsigned long,1,100000);
00186 vtkGetMacro(TimerDuration,unsigned long);
00188
00190
00191 vtkSetMacro(HandleObservers,int);
00192 vtkGetMacro(HandleObservers,int);
00193 vtkBooleanMacro(HandleObservers,int);
00195
00197
00198 virtual void OnMouseMove() {};
00199 virtual void OnLeftButtonDown() {};
00200 virtual void OnLeftButtonUp() {};
00201 virtual void OnMiddleButtonDown() {};
00202 virtual void OnMiddleButtonUp() {};
00203 virtual void OnRightButtonDown() {};
00204 virtual void OnRightButtonUp() {};
00205 virtual void OnMouseWheelForward() {};
00206 virtual void OnMouseWheelBackward() {};
00208
00210
00212 virtual void OnChar();
00213 virtual void OnKeyDown() {};
00214 virtual void OnKeyUp() {};
00215 virtual void OnKeyPress() {};
00216 virtual void OnKeyRelease() {};
00218
00220
00221 virtual void OnExpose() {};
00222 virtual void OnConfigure() {};
00223 virtual void OnEnter() {};
00224 virtual void OnLeave() {};
00226
00229 virtual void OnTimer();
00230
00232
00236 virtual void Rotate() {};
00237 virtual void Spin() {};
00238 virtual void Pan() {};
00239 virtual void Dolly() {};
00240 virtual void Zoom() {};
00241 virtual void UniformScale() {};
00243
00245
00246 virtual void StartState(int newstate);
00247 virtual void StopState();
00249
00251
00252 virtual void StartAnimate();
00253 virtual void StopAnimate();
00254 virtual void StartRotate();
00255 virtual void EndRotate();
00256 virtual void StartZoom();
00257 virtual void EndZoom();
00258 virtual void StartPan();
00259 virtual void EndPan();
00260 virtual void StartSpin();
00261 virtual void EndSpin();
00262 virtual void StartDolly();
00263 virtual void EndDolly();
00264 virtual void StartUniformScale();
00265 virtual void EndUniformScale();
00266 virtual void StartTimer();
00267 virtual void EndTimer();
00269
00271
00275 virtual void HighlightProp(vtkProp *prop);
00276 virtual void HighlightActor2D(vtkActor2D *actor2D);
00277 virtual void HighlightProp3D(vtkProp3D *prop3D);
00279
00281
00283 vtkSetVector3Macro(PickColor,double);
00284 vtkGetVectorMacro(PickColor, double, 3);
00286
00288
00291 vtkSetMacro(MouseWheelMotionFactor, double);
00292 vtkGetMacro(MouseWheelMotionFactor, double);
00294
00295 protected:
00296 vtkInteractorStyle();
00297 ~vtkInteractorStyle();
00298
00300
00301 static void ProcessEvents(vtkObject* object,
00302 unsigned long event,
00303 void* clientdata,
00304 void* calldata);
00306
00307
00308 int State;
00309 int AnimState;
00310
00311
00312 int HandleObservers;
00313 int UseTimers;
00314 int TimerId;
00315
00316 int AutoAdjustCameraClippingRange;
00317
00318
00319 vtkOutlineSource *Outline;
00320 vtkPolyDataMapper *OutlineMapper;
00321 vtkActor *OutlineActor;
00322 vtkRenderer *PickedRenderer;
00323 vtkProp *CurrentProp;
00324 vtkActor2D *PickedActor2D;
00325 int PropPicked;
00326 double PickColor[3];
00327 double MouseWheelMotionFactor;
00328
00329
00330 unsigned long TimerDuration;
00331
00332
00333 vtkEventForwarderCommand * EventForwarder;
00334
00335 private:
00336 vtkInteractorStyle(const vtkInteractorStyle&);
00337 void operator=(const vtkInteractorStyle&);
00338 };
00339
00340 #endif