00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef __mitkClippingPlaneWidgetModel_h
00012 #define __mitkClippingPlaneWidgetModel_h
00013
00014 #include "mitkWidgetModel3D.h"
00015 #include "mitkTrackBall.h"
00016
00017 class mitkPlane;
00018
00026 class MITK_VISUALIZATION_API mitkClippingPlaneWidgetModel : public mitkWidgetModel3D
00027 {
00028 public:
00029 typedef float coord_type;
00030
00031 MITK_TYPE(mitkClippingPlaneWidgetModel, mitkWidgetModel3D)
00032
00033 virtual void PrintSelf(ostream &os);
00034
00048 mitkClippingPlaneWidgetModel(float ox, float oy, float oz,
00049 float nx = 0.0f, float ny = 0.0f, float nz = 1.0f,
00050 float width = 100.0f, float height = 100.0f);
00051
00065 mitkClippingPlaneWidgetModel(coord_type v0x, coord_type v0y, coord_type v0z,
00066 coord_type v1x, coord_type v1y, coord_type v1z,
00067 coord_type cx, coord_type cy, coord_type cz);
00068
00083 void SetPlanePosition(coord_type v0x, coord_type v0y, coord_type v0z,
00084 coord_type v1x, coord_type v1y, coord_type v1z,
00085 coord_type cx, coord_type cy, coord_type cz);
00086
00093 virtual int Render(mitkScene *scene);
00094
00100 virtual void Pick(const WidgetNames &names);
00101
00105 virtual void Release();
00106
00114 virtual void SetSourceModel(mitkDataModel *model);
00115
00120 void SetOpacity(float opacity);
00121
00125 virtual void Update();
00126
00145 void RotateRadAroundXAxisOfPlane(float angle);
00146
00165 void RotateRadAroundYAxisOfPlane(float angle);
00166
00185 void RotateRadAroundZAxisOfPlane(float angle);
00186
00194 void RotateDegAroundXAxisOfPlane(float angle);
00195
00203 void RotateDegAroundYAxisOfPlane(float angle);
00204
00212 void RotateDegAroundZAxisOfPlane(float angle);
00213
00220 void TranslatePlane(float tx, float ty, float tz);
00221
00228 void SetPlaneCenter(float ox, float oy, float oz);
00229
00230 protected:
00231 virtual ~mitkClippingPlaneWidgetModel();
00232 virtual float* _getBounds();
00233
00242 virtual void _onMouseDown(int mouseButton, bool ctrlDown, bool shiftDown, int xPos, int yPos);
00243
00252 virtual void _onMouseUp(int mouseButton, bool ctrlDown, bool shiftDown, int xPos, int yPos);
00253
00263 virtual void _onMouseMove(bool ctrlDown, bool shiftDown, int xPos, int yPos, int deltaX, int deltaY);
00264
00265
00266 void _init();
00267
00268
00269 void _rotate();
00270
00271
00272 enum
00273 {
00274 unknown,
00275 lbball,
00276 ltball,
00277 rbball,
00278 rtball,
00279 lline,
00280 tline,
00281 rline,
00282 bline,
00283 plane
00284 };
00285
00286 mitkPlane *m_Plane;
00287
00288 mitkVector *m_LeftBottom;
00289 mitkVector *m_RightBottom;
00290 mitkVector *m_RightTop;
00291 mitkVector *m_LeftTop;
00292 mitkVector *m_Normal;
00293 mitkMatrix *m_InvMVMatrix;
00294 mitkMatrix *m_RotateMatrix;
00295
00296 mitkTrackBall m_TrackBall;
00297
00298
00299
00300
00301
00302
00303
00304
00305 float m_ArrowLength;
00306
00307 float m_ArrowColor[4];
00308 float m_BallColor[4];
00309 float m_LineColor[4];
00310
00311 float m_PickedBallColor[4];
00312 float m_PickedLineColor[4];
00313
00314 float m_Opacity;
00315
00316 float m_MoveUnit;
00317
00318 private:
00319 mitkClippingPlaneWidgetModel(const mitkClippingPlaneWidgetModel&);
00320 void operator = (const mitkClippingPlaneWidgetModel&);
00321 };
00322
00323
00324
00325
00326
00327
00328 #endif
00329