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