00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00112 #ifndef __vtkInteractorStyle_h
00113 #define __vtkInteractorStyle_h
00114
00115 #include "vtkRenderWindowInteractor.h"
00116
00117
00118 #define VTKIS_START 0
00119 #define VTKIS_ROTATE 1
00120 #define VTKIS_ZOOM 2
00121 #define VTKIS_PAN 3
00122 #define VTKIS_SPIN 4
00123 #define VTKIS_DOLLY 5
00124 #define VTKIS_USCALE 6
00125 #define VTKIS_TIMER 7
00126 #define VTKIS_ANIM_OFF 0
00127 #define VTKIS_ANIM_ON 1
00128
00129 class vtkPolyDataMapper;
00130 class vtkOutlineSource;
00131
00132 class VTK_RENDERING_EXPORT vtkInteractorStyle : public vtkObject
00133 {
00134 public:
00138 static vtkInteractorStyle *New();
00139
00140 vtkTypeMacro(vtkInteractorStyle,vtkObject);
00141 void PrintSelf(ostream& os, vtkIndent indent);
00142
00144
00145 virtual void SetInteractor(vtkRenderWindowInteractor *interactor);
00146 vtkGetObjectMacro(Interactor, vtkRenderWindowInteractor);
00148
00150
00156 vtkSetClampMacro( AutoAdjustCameraClippingRange, int, 0, 1 );
00157 vtkGetMacro( AutoAdjustCameraClippingRange, int );
00158 vtkBooleanMacro( AutoAdjustCameraClippingRange, int );
00160
00162
00166 void FindPokedCamera(int,int);
00167 void FindPokedRenderer(int,int);
00169
00171
00175 virtual void HighlightProp(vtkProp *prop);
00176 virtual void HighlightActor2D(vtkActor2D *actor2D);
00177 virtual void HighlightProp3D(vtkProp3D *prop3D);
00179
00181
00183 vtkSetVector3Macro(PickColor,float);
00184 vtkGetVectorMacro(PickColor, float, 3);
00186
00188
00189 virtual void OnMouseMove (int ctrl, int shift, int X, int Y);
00190 virtual void OnLeftButtonDown(int ctrl, int shift, int X, int Y);
00191 virtual void OnLeftButtonUp (int ctrl, int shift, int X, int Y);
00192 virtual void OnMiddleButtonDown(int ctrl, int shift, int X, int Y);
00193 virtual void OnMiddleButtonUp (int ctrl, int shift, int X, int Y);
00194 virtual void OnRightButtonDown(int ctrl, int shift, int X, int Y);
00195 virtual void OnRightButtonUp (int ctrl, int shift, int X, int Y);
00197
00199
00201 virtual void OnChar (int ctrl, int shift, char keycode, int repeatcount);
00202 virtual void OnKeyDown(int ctrl, int shift, char keycode, int repeatcount);
00203 virtual void OnKeyUp (int ctrl, int shift, char keycode, int repeatcount);
00204 virtual void OnKeyPress(int ctrl, int shift, char keycode, char *keysym,
00205 int repeatcount);
00206 virtual void OnKeyRelease(int ctrl, int shift, char keycode, char *keysym,
00207 int repeatcount);
00209
00211
00212 virtual void OnConfigure(int width, int height);
00213 virtual void OnEnter(int ctrl, int shift, int x, int y);
00214 virtual void OnLeave(int ctrl, int shift, int x, int y);
00216
00219 virtual void OnTimer();
00220
00222
00223 void SetLeftButtonPressMethod(void (*f)(void *), void *arg);
00224 void SetLeftButtonPressMethodArgDelete(void (*f)(void *));
00225 void SetLeftButtonReleaseMethod(void (*f)(void *), void *arg);
00226 void SetLeftButtonReleaseMethodArgDelete(void (*f)(void *));
00227 void SetMiddleButtonPressMethod(void (*f)(void *), void *arg);
00228 void SetMiddleButtonPressMethodArgDelete(void (*f)(void *));
00229 void SetMiddleButtonReleaseMethod(void (*f)(void *), void *arg);
00230 void SetMiddleButtonReleaseMethodArgDelete(void (*f)(void *));
00231 void SetRightButtonPressMethod(void (*f)(void *), void *arg);
00232 void SetRightButtonPressMethodArgDelete(void (*f)(void *));
00233 void SetRightButtonReleaseMethod(void (*f)(void *), void *arg);
00234 void SetRightButtonReleaseMethodArgDelete(void (*f)(void *));
00236
00237 protected:
00238 vtkInteractorStyle();
00239 ~vtkInteractorStyle();
00240
00241
00242 int AutoAdjustCameraClippingRange;
00243 void ResetCameraClippingRange();
00244
00245
00246 virtual void ComputeDisplayToWorld(double x, double y, double z,
00247 double *worldPt);
00248 virtual void ComputeWorldToDisplay(double x, double y, double z,
00249 double *displayPt);
00250 virtual void ComputeDisplayToWorld(double x, double y, double z,
00251 float *worldPt);
00252 virtual void ComputeWorldToDisplay(double x, double y, double z,
00253 float *displayPt);
00254
00255 virtual void UpdateInternalState(int ctrl, int shift, int X, int Y);
00256
00257
00258
00259
00260
00261 virtual void RotateCamera(int x, int y);
00262 virtual void SpinCamera(int x, int y);
00263 virtual void PanCamera(int x, int y);
00264 virtual void DollyCamera(int x, int y);
00265
00266
00267 virtual void StartState(int newstate);
00268 virtual void StopState();
00269
00270
00271 virtual void StartAnimate();
00272 virtual void StopAnimate();
00273 virtual void StartRotate();
00274 virtual void EndRotate();
00275 virtual void StartZoom();
00276 virtual void EndZoom();
00277 virtual void StartPan();
00278 virtual void EndPan();
00279 virtual void StartSpin();
00280 virtual void EndSpin();
00281 virtual void StartDolly();
00282 virtual void EndDolly();
00283 virtual void StartUniformScale();
00284 virtual void EndUniformScale();
00285 virtual void StartTimer();
00286 virtual void EndTimer();
00287
00288
00289 vtkRenderWindowInteractor *Interactor;
00290
00291 vtkCamera *CurrentCamera;
00292 vtkLight *CurrentLight;
00293 vtkRenderer *CurrentRenderer;
00294
00295 float Center[2];
00296 float DeltaAzimuth;
00297 float DeltaElevation;
00298 int CtrlKey;
00299 int ShiftKey;
00300 int LastPos[2];
00301 int State;
00302 int AnimState;
00303 float FocalDepth;
00304
00305
00306 vtkOutlineSource *Outline;
00307 vtkPolyDataMapper *OutlineMapper;
00308 vtkActor *OutlineActor;
00309 vtkRenderer *PickedRenderer;
00310 vtkProp *CurrentProp;
00311 int PropPicked;
00312 float PickColor[3];
00313 vtkActor2D *PickedActor2D;
00314
00315 unsigned long LeftButtonPressTag;
00316 unsigned long LeftButtonReleaseTag;
00317 unsigned long MiddleButtonPressTag;
00318 unsigned long MiddleButtonReleaseTag;
00319 unsigned long RightButtonPressTag;
00320 unsigned long RightButtonReleaseTag;
00321 private:
00322 vtkInteractorStyle(const vtkInteractorStyle&);
00323 void operator=(const vtkInteractorStyle&);
00324 };
00325
00326 #endif