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 
00040 
00048 #ifndef __vtkInteractorStyleJoystickActor_h
00049 #define __vtkInteractorStyleJoystickActor_h
00050 
00051 #include "vtkInteractorStyle.h"
00052 #include "vtkCellPicker.h"
00053 
00054 
00055 #define VTK_INTERACTOR_STYLE_ACTOR_NONE    0
00056 #define VTK_INTERACTOR_STYLE_ACTOR_ROTATE  1
00057 #define VTK_INTERACTOR_STYLE_ACTOR_PAN     2
00058 #define VTK_INTERACTOR_STYLE_ACTOR_ZOOM    3
00059 #define VTK_INTERACTOR_STYLE_ACTOR_SPIN    4
00060 #define VTK_INTERACTOR_STYLE_ACTOR_SCALE   5
00061 
00062 class VTK_EXPORT vtkInteractorStyleJoystickActor : public vtkInteractorStyle
00063 {
00064 public:
00068   static vtkInteractorStyleJoystickActor *New();
00069 
00070   vtkTypeMacro(vtkInteractorStyleJoystickActor, vtkObject);
00071   void PrintSelf(ostream& os, vtkIndent indent);
00072 
00073   
00074   void OnMouseMove  (int ctrl, int shift, int x, int y);
00075   void OnLeftButtonDown(int ctrl, int shift, int x, int y);
00076   void OnLeftButtonUp  (int ctrl, int shift, int x, int y);
00077   void OnMiddleButtonDown(int ctrl, int shift, int x, int y);
00078   void OnMiddleButtonUp  (int ctrl, int shift, int x, int y);
00079   void OnRightButtonDown(int ctrl, int shift, int x, int y);
00080   void OnRightButtonUp  (int ctrl, int shift, int x, int y);
00081   void OnTimer(void);
00082 
00083 protected:
00084   vtkInteractorStyleJoystickActor();
00085   ~vtkInteractorStyleJoystickActor();
00086   vtkInteractorStyleJoystickActor(const vtkInteractorStyleJoystickActor&) {};
00087   void operator=(const vtkInteractorStyleJoystickActor&) {};
00088 
00089   void RotateXY(int x, int y);
00090   void PanXY(int x, int y);
00091   void DollyXY(int x, int y);
00092   void SpinXY(int x, int y);
00093   void ScaleXY(int x, int y);
00094   void FindPickedActor(int x, int y);
00095   void Prop3DTransform(vtkProp3D *prop3D, double *boxCenter,
00096                       int numRotation, double **rotate,
00097                       double *scale);
00098   void Prop3DTransform(vtkProp3D *prop3D,float *boxCenter,
00099                       int NumRotation,double **rotate,
00100                       double *scale);
00101   
00102   int State;
00103   float MotionFactor;
00104   float RadianToDegree;                 
00105   vtkProp3D *InteractionProp;
00106   double ViewUp[3];
00107   double ViewLook[3];
00108   double ViewRight[3];
00109   float ObjCenter[3];
00110   float DispObjCenter[3];
00111   float Radius;
00112   float NewPickPoint[4];
00113   float OldPickPoint[4];
00114   float MotionVector[3];
00115   double ViewPoint[3];
00116   double ViewFocus[3];
00117 
00118   vtkCellPicker *InteractionPicker;
00119 };
00120 
00121 #endif