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
00059 #ifndef __vtkInteractorStyleTrackball_h
00060 #define __vtkInteractorStyleTrackball_h
00061
00062 #include "vtkInteractorStyle.h"
00063 #include "vtkAbstractPropPicker.h"
00064
00065 #define VTKIS_JOY 0
00066 #define VTKIS_TRACK 1
00067 #define VTKIS_CAMERA 0
00068 #define VTKIS_ACTOR 1
00069 #define VTKIS_CONTROL_OFF 0
00070 #define VTKIS_CONTROL_ON 1
00071
00072 class VTK_EXPORT vtkInteractorStyleTrackball : public vtkInteractorStyle
00073 {
00074 public:
00075 static vtkInteractorStyleTrackball *New();
00076 vtkTypeMacro(vtkInteractorStyleTrackball,vtkInteractorStyle);
00077 void PrintSelf(ostream& os, vtkIndent indent);
00078
00080 virtual void OnRightButtonDown(int ctrl, int shift, int X, int Y);
00081 virtual void OnRightButtonUp (int ctrl, int shift, int X, int Y);
00082 virtual void OnMiddleButtonDown(int ctrl, int shift, int X, int Y);
00083 virtual void OnMiddleButtonUp (int ctrl, int shift, int X, int Y);
00084 virtual void OnLeftButtonDown(int ctrl, int shift, int X, int Y);
00085 virtual void OnLeftButtonUp (int ctrl, int shift, int X, int Y);
00086 virtual void OnChar(int ctrl, int shift, char keycode, int repeatcount);
00087
00089 virtual void SetActorModeToCamera();
00090 virtual void SetActorModeToActor();
00091 vtkGetMacro(ActorMode, int);
00092
00094 virtual void SetTrackballModeToTrackball();
00095 virtual void SetTrackballModeToJoystick();
00096 vtkGetMacro(TrackballMode, int);
00097
00100 virtual void OnTimer(void);
00101
00102 protected:
00103 vtkInteractorStyleTrackball();
00104 ~vtkInteractorStyleTrackball();
00105 vtkInteractorStyleTrackball(const vtkInteractorStyleTrackball&) {};
00106 void operator=(const vtkInteractorStyleTrackball&) {};
00107
00108
00109
00110
00111 vtkAbstractPropPicker *InteractionPicker;
00112 int PropPicked;
00113 vtkProp3D *InteractionProp;
00114
00115
00116 int ActorMode;
00117 int TrackballMode;
00118 int ControlMode;
00119 float MotionFactor;
00120 int Preprocess;
00121 float RadianToDegree;
00122
00123
00124 float NewPickPoint[4];
00125 float OldPickPoint[4];
00126 float MotionVector[3];
00127 float OldX;
00128 float OldY;
00129
00130
00131 double ViewLook[3];
00132 double ViewPoint[3];
00133 double ViewFocus[3];
00134 double ViewUp[3];
00135 double ViewRight[3];
00136
00137
00138 float Origin[3];
00139 float Position[3];
00140 float ObjCenter[3];
00141 float DispObjCenter[3];
00142 float Radius;
00143
00144
00145 virtual void TrackballRotateCamera(int x, int y);
00146 virtual void TrackballSpinCamera(int x, int y);
00147 virtual void TrackballPanCamera(int x, int y);
00148 virtual void TrackballDollyCamera(int x, int y);
00149
00150 virtual void JoystickRotateActor(int x, int y);
00151 virtual void JoystickSpinActor(int x, int y);
00152 virtual void JoystickPanActor(int x, int y);
00153 virtual void JoystickDollyActor(int x, int y);
00154 virtual void JoystickScaleActor(int x, int y);
00155
00156 virtual void TrackballRotateActor(int x, int y);
00157 virtual void TrackballSpinActor(int x, int y);
00158 virtual void TrackballPanActor(int x, int y);
00159 virtual void TrackballDollyActor(int x, int y);
00160 virtual void TrackballScaleActor(int x, int y);
00161
00162 void Prop3DTransform(vtkProp3D *prop3D, double *boxCenter,
00163 int numRotation, double **rotate,
00164 double *scale);
00165 void Prop3DTransform(vtkProp3D *prop3D,float *boxCenter,
00166 int NumRotation,double **rotate,
00167 double *scale);
00168 void FindPickedActor(int X, int Y);
00169 };
00170
00171 #endif