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
00107 #ifndef __vtkInteractorStyle_h
00108 #define __vtkInteractorStyle_h
00109
00110 #include "vtkRenderWindowInteractor.h"
00111
00112
00113 #define VTKIS_START 0
00114 #define VTKIS_ROTATE 1
00115 #define VTKIS_ZOOM 2
00116 #define VTKIS_PAN 3
00117 #define VTKIS_SPIN 4
00118 #define VTKIS_DOLLY 5
00119 #define VTKIS_USCALE 6
00120 #define VTKIS_TIMER 7
00121 #define VTKIS_ANIM_OFF 0
00122 #define VTKIS_ANIM_ON 1
00123
00124 class vtkPolyDataMapper;
00125 class vtkOutlineSource;
00126
00127 class VTK_EXPORT vtkInteractorStyle : public vtkObject
00128 {
00129 public:
00133 static vtkInteractorStyle *New();
00134
00135 vtkTypeMacro(vtkInteractorStyle,vtkObject);
00136 void PrintSelf(ostream& os, vtkIndent indent);
00137
00139 virtual void SetInteractor(vtkRenderWindowInteractor *interactor);
00140 vtkGetObjectMacro(Interactor, vtkRenderWindowInteractor);
00141
00146 void FindPokedCamera(int,int);
00147 void FindPokedRenderer(int,int);
00148
00153 virtual void HighlightProp(vtkProp *prop);
00154 virtual void HighlightActor2D(vtkActor2D *actor2D);
00155 virtual void HighlightProp3D(vtkProp3D *prop3D);
00156
00159 vtkSetVector3Macro(PickColor,float);
00160 vtkGetVectorMacro(PickColor, float, 3);
00161
00163 virtual void OnMouseMove (int ctrl, int shift, int X, int Y);
00164 virtual void OnLeftButtonDown(int ctrl, int shift, int X, int Y);
00165 virtual void OnLeftButtonUp (int ctrl, int shift, int X, int Y);
00166 virtual void OnMiddleButtonDown(int ctrl, int shift, int X, int Y);
00167 virtual void OnMiddleButtonUp (int ctrl, int shift, int X, int Y);
00168 virtual void OnRightButtonDown(int ctrl, int shift, int X, int Y);
00169 virtual void OnRightButtonUp (int ctrl, int shift, int X, int Y);
00170
00173 virtual void OnChar (int ctrl, int shift, char keycode, int repeatcount);
00174 virtual void OnKeyDown(int ctrl, int shift, char keycode, int repeatcount);
00175 virtual void OnKeyUp (int ctrl, int shift, char keycode, int repeatcount);
00176 virtual void OnKeyPress(int ctrl, int shift, char keycode, char *keysym,
00177 int repeatcount);
00178 virtual void OnKeyRelease(int ctrl, int shift, char keycode, char *keysym,
00179 int repeatcount);
00180
00182 virtual void OnConfigure(int width, int height);
00183 virtual void OnEnter(int ctrl, int shift, int x, int y);
00184 virtual void OnLeave(int ctrl, int shift, int x, int y);
00185
00188 virtual void OnTimer();
00189
00191 void SetLeftButtonPressMethod(void (*f)(void *), void *arg);
00192 void SetLeftButtonPressMethodArgDelete(void (*f)(void *));
00193 void SetLeftButtonReleaseMethod(void (*f)(void *), void *arg);
00194 void SetLeftButtonReleaseMethodArgDelete(void (*f)(void *));
00195 void SetMiddleButtonPressMethod(void (*f)(void *), void *arg);
00196 void SetMiddleButtonPressMethodArgDelete(void (*f)(void *));
00197 void SetMiddleButtonReleaseMethod(void (*f)(void *), void *arg);
00198 void SetMiddleButtonReleaseMethodArgDelete(void (*f)(void *));
00199 void SetRightButtonPressMethod(void (*f)(void *), void *arg);
00200 void SetRightButtonPressMethodArgDelete(void (*f)(void *));
00201 void SetRightButtonReleaseMethod(void (*f)(void *), void *arg);
00202 void SetRightButtonReleaseMethodArgDelete(void (*f)(void *));
00203
00204 protected:
00205 vtkInteractorStyle();
00206 ~vtkInteractorStyle();
00207 vtkInteractorStyle(const vtkInteractorStyle&) {};
00208 void operator=(const vtkInteractorStyle&) {};
00209
00210
00211 virtual void ComputeDisplayToWorld(double x, double y, double z,
00212 double *worldPt);
00213 virtual void ComputeWorldToDisplay(double x, double y, double z,
00214 double *displayPt);
00215 virtual void ComputeDisplayToWorld(double x, double y, double z,
00216 float *worldPt);
00217 virtual void ComputeWorldToDisplay(double x, double y, double z,
00218 float *displayPt);
00219
00220 virtual void UpdateInternalState(int ctrl, int shift, int X, int Y);
00221
00222
00223
00224
00225
00226 virtual void RotateCamera(int x, int y);
00227 virtual void SpinCamera(int x, int y);
00228 virtual void PanCamera(int x, int y);
00229 virtual void DollyCamera(int x, int y);
00230
00231
00232 virtual void StartState(int newstate);
00233 virtual void StopState();
00234
00235
00236 virtual void StartAnimate();
00237 virtual void StopAnimate();
00238 virtual void StartRotate();
00239 virtual void EndRotate();
00240 virtual void StartZoom();
00241 virtual void EndZoom();
00242 virtual void StartPan();
00243 virtual void EndPan();
00244 virtual void StartSpin();
00245 virtual void EndSpin();
00246 virtual void StartDolly();
00247 virtual void EndDolly();
00248 virtual void StartUniformScale();
00249 virtual void EndUniformScale();
00250 virtual void StartTimer();
00251 virtual void EndTimer();
00252
00253
00254 vtkRenderWindowInteractor *Interactor;
00255
00256 vtkCamera *CurrentCamera;
00257 vtkLight *CurrentLight;
00258 vtkRenderer *CurrentRenderer;
00259
00260 float Center[2];
00261 float DeltaAzimuth;
00262 float DeltaElevation;
00263 int CtrlKey;
00264 int ShiftKey;
00265 int LastPos[2];
00266 int State;
00267 int AnimState;
00268 float FocalDepth;
00269
00270
00271 vtkOutlineSource *Outline;
00272 vtkPolyDataMapper *OutlineMapper;
00273 vtkActor *OutlineActor;
00274 vtkRenderer *PickedRenderer;
00275 vtkProp *CurrentProp;
00276 int PropPicked;
00277 float PickColor[3];
00278 vtkActor2D *PickedActor2D;
00279
00280 unsigned long LeftButtonPressTag;
00281 unsigned long LeftButtonReleaseTag;
00282 unsigned long MiddleButtonPressTag;
00283 unsigned long MiddleButtonReleaseTag;
00284 unsigned long RightButtonPressTag;
00285 unsigned long RightButtonReleaseTag;
00286 };
00287
00288 #endif