00001 #ifndef RenderWindowInteractor_h
00002 #define RenderWindowInteractor_h
00003
00004
00005
00006
00007
00008 #include "renderwindow.h"
00009
00010 #include <qtimer.h>
00011
00012 #include "vtkActor.h"
00013 #include "vtkCamera.h"
00014 #include "vtkLight.h"
00015 #include "vtkCellPicker.h"
00016
00017 class RenderWindowInteractor : public RenderWindow
00018 {
00019 Q_OBJECT
00020
00021 public:
00022
00023 RenderWindowInteractor( QWidget *parent = 0, const char *name = 0 );
00024 RenderWindowInteractor( QGLFormat glf, QWidget *parent = 0, const char *name = 0 );
00025
00026 ~RenderWindowInteractor();
00027
00028 void SetLeftButtonFunction( const char* function );
00029 void SetMiddleButtonFunction( const char* function );
00030 void SetRightButtonFunction( const char* function );
00031 void SetShiftLeftButtonFunction( const char* function );
00032
00033 void SetInteractionActor( vtkActor* actor );
00034 void SetActorRotation( float x, float y, float z );
00035 void SetPlane(float *ebene);
00036 void SetInteractionTime( int time );
00037 void SetSensitivity( float t );
00038
00039 int GetInteractionTime( void );
00040 vtkActor *GetInteractionActor( void );
00041 float GetSensitivity();
00042 const char *GetClassName();
00043
00044
00045 signals:
00053 void ActorRotated( float xf, float yf );
00054
00061 void ActorRolled( float angle );
00062
00068 void Released( int x, int y );
00069
00070 protected:
00071 void mousePressEvent( QMouseEvent *event );
00072
00073 void mouseReleaseEvent( QMouseEvent *event );
00074 void mouseMoveEvent( QMouseEvent *event );
00075
00076 protected slots:
00077
00078 void ActorRotate();
00079 void ActorTranslate();
00080 void ActorZoom();
00081 void ActorRoll();
00082 void ActorPlaneRoll();
00083 void ActorPlaneMove();
00084
00085 void CameraRotate();
00086 void CameraTranslate();
00087 void CameraZoom();
00088 void CameraRoll();
00089
00090 void DoNothing();
00091
00092
00093 private:
00094 void RenderWindowInteractor::DisplayToWorld( float x, float y, float z,
00095 float *worldPoint );
00096
00097 void RenderWindowInteractor::WorldToDisplay( float x, float y, float z,
00098 float *displayPoint );
00099
00100 void InitRenderWindowInteractor();
00101
00102 vtkCellPicker *cellpicker;
00103
00104 vtkCamera *currentCamera;
00105 vtkActor *interactionActor;
00106 vtkActor *collisionActor;
00107 vtkLight *currentLight;
00108
00109 float viewUp[3];
00110 float vpNormal[3];
00111 float rotateY[3];
00112 float renCenter[3];
00113 float viewFocus[3];
00114 float camPos[3];
00115 float deltaElevation;
00116 float deltaAzimuth;
00117 float normale[3];
00118 float ebenekonstante;
00119
00120 QTimer *stepTimer;
00121 bool mouseEventActive;
00122 bool firstCall;
00123 float trackballFactor;
00124 float cameraRotation[3];
00125 int interactionTime;
00126 int currentMousePos[2];
00127 int lastMousePos[2];
00128
00129 char leftButtonFunction[200];
00130 char middleButtonFunction[200];
00131 char rightButtonFunction[200];
00132 char shiftLeftButtonFunction[200];
00133 };
00134
00135 #endif // RenderWindowInteractor_h