00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef __mitkVis2Scene3D_h
00011 #define __mitkVis2Scene3D_h
00012
00013 #include "mitkVisualization2Includes.h"
00014 #include "mitkRCPtr.h"
00015 #include "mitkSceneBase.h"
00016 #include "modules/mitkSceneParam.h"
00017
00018 class mitkPath;
00019
00023 class MITK_VISUALIZATION2_API mitkVis2Scene3D : public mitkSceneBase
00024 {
00025 public:
00026 MITK_TYPE(mitkVis2Scene3D,mitkSceneBase)
00027 mitkVis2Scene3D();
00028
00033 void SetFovy(float fovy);
00034
00039 void SetRotateRadPerPixel(float radPerPixel) { m_RadPerPixel=radPerPixel;}
00040
00045 float GetRotateRadPerPixel() const { return m_RadPerPixel; }
00046
00051 void SetScaleRatePerPixel(float scaleRatePerPixel) { m_ScaleRatePerPixel=scaleRatePerPixel;}
00056 float GetScaleRatePerPixel() const { return m_ScaleRatePerPixel; }
00057
00061 virtual void ResizeGL(int newX, int newY);
00065 virtual void RenderGL();
00069 virtual void OnMouseDown(int mouseButton, bool ctrlDown, bool shiftDown, int xPos, int yPos);
00073 virtual void OnMouseUp(int mouseButton, bool ctrlDown, bool shiftDown, int xPos, int yPos);
00077 virtual void OnMouseMove(bool ctrlDown, bool shiftDown, int xPos, int yPos);
00078
00079
00086 void GetTranslate(float translate[3]) const ;
00087
00092 float GetScale() const { return m_Param.m_Scale;}
00093
00098 const mitkVis2Quaternion& GetRotation() const { return m_Param.m_Rotation; }
00099
00106 void SetTranslate(const float translate[3]);
00111 void SetScale(float scale);
00112
00117 void SetRotation(const mitkVis2Quaternion& rotation);
00118
00123 const mitkVis2Matrix4x4& GetViewMatrix() const;
00124
00129 const mitkVis2Matrix4x4& GetProjectionMatrix() const;
00130
00135 float GetZTranslateBase() const { return m_Param.m_ZTranslateBase;}
00136
00144 void GetViewPort(int* viewport) const { viewport[0]=m_ViewPort[0]; viewport[1]=m_ViewPort[1];}
00145
00150 float GetFovy() const {return m_Param.m_Fovy;}
00151
00156 void SetEndoscopy(bool turnOn);
00157
00162 bool GetEndoscopy() { return m_Endoscopy;}
00163
00170 void MoveTo(float x,float y, float z);
00171
00178 void Move(float dx, float dy, float dz);
00179
00185 void Turn(float dx, float dy);
00186
00191 void Roll(float rad);
00192
00193
00194 void SetCenterline(mitkPath* cl, int position=0);
00195 void SetCenteLinePosition(int position);
00196 mitkPath* GetCenterline();
00197 int GetCenterlinePosition();
00198 void CenterLineForwards();
00199 void CenterLineBackwards();
00200
00201 mitkSceneParam& GetSceneParameters() { return m_Param;}
00202
00203 protected:
00204 virtual ~mitkVis2Scene3D();
00205 virtual void GetSize3D(float size3D[3])=0;
00206 void SetSize3DModified();
00207 void RenderCenterLine();
00208
00209
00210 int m_OldMouseX,m_OldMouseY;
00211
00212 private:
00213 mitkVis2Scene3D(const mitkVis2Scene3D&);
00214 void operator = (const mitkVis2Scene3D&);
00215
00216 private:
00217 void _alignCenterLine();
00218
00219
00220 int m_ViewPort[2];
00221 mitkSceneParam m_Param;
00222
00223
00224 bool m_NeedCalculateCamera;
00225
00226
00227 mitkVis2Matrix4x4 m_ViewMatrix;
00228 mitkVis2Matrix4x4 m_ProjectionMatrix;
00229
00231
00232
00233 float m_RadPerPixel;
00234 float m_ScaleRatePerPixel;
00235
00236
00237 bool m_Rotating;
00238 bool m_Scaling;
00239 bool m_Moving;
00240
00241 bool m_Endoscopy;
00242 bool m_EndoscopyDragging;
00243 bool m_EndoscopyDragging2;
00244
00245
00246 mitkRCPtr<mitkPath> m_Centerline;
00247 int m_CenterLinePosition;
00248
00249 };
00250
00251
00252
00253 #endif