Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members

mitkLineWidgetModel3D.h

00001 /*=========================================================================
00002 
00003   Program:   3DMed
00004   Date:      $Date: 2014-02-25 18:30:00 +0800 $
00005   Version:   $Version: 4.6.0 $
00006   Copyright: MIPG, Institute of Automation, Chinese Academy of Sciences
00007 
00008 =========================================================================*/
00009 
00010 
00011 #ifndef __mitkLineWidgetModel3D_h
00012 #define __mitkLineWidgetModel3D_h
00013 
00014 #include "mitkWidgetModel3D.h"
00015 #include <string>
00016 
00017 using std::string;
00018 
00026 class MITK_VISUALIZATION_API mitkLineWidgetModel3D : public mitkWidgetModel3D
00027 {
00028 public:
00029     MITK_TYPE(mitkLineWidgetModel3D, mitkWidgetModel3D)
00030 
00031     virtual void PrintSelf(ostream &os);
00032 
00042     mitkLineWidgetModel3D(float point0[3], float point1[3]);
00043 
00050     virtual int Render(mitkScene *view);
00051 
00057     virtual void Pick(const WidgetNames &names);
00058 
00062     virtual void Release();
00063 
00070     void SetUnits(float ux, float uy, float uz);
00071 
00078     void SetUnits(float units[3]);
00079 
00084     float GetLineLength();
00085 
00091     void SetUnitName(const string &name) { m_UnitName = name; }
00092 
00096     //          of the length unit this line uses
00098     const string& GetUnitName() { return m_UnitName; }
00099     
00103     virtual void Update();
00104     
00105 protected:
00106     virtual ~mitkLineWidgetModel3D();
00107     virtual float* _getBounds();
00108 
00117     virtual void _onMouseDown(int mouseButton, bool ctrlDown, bool shiftDown, int xPos, int yPos);
00118 
00127     virtual void _onMouseUp(int mouseButton, bool ctrlDown, bool shiftDown, int xPos, int yPos);
00128 
00138     virtual void _onMouseMove(bool ctrlDown, bool shiftDown, int xPos, int yPos, int deltaX, int deltaY);
00139 
00140     // Initialize.
00141     void _init();
00142 
00143     // Names of parts can be picked.
00144     enum
00145     {
00146         unknown,
00147         arrow0,
00148         arrow1,
00149         line
00150     };
00151 
00152     mitkVector *m_Points;
00153     mitkVector *m_ScreenPoints;
00154     mitkMatrix *m_TransformMatrix;
00155     float m_UnitsPerPixel[3];
00156     float m_ArrowLength;
00157 
00158     float m_ArrowColor[4];
00159     float m_LineColor[4];
00160     float m_PickedArrowColor[4];
00161     float m_PickedLineColor[4];
00162 
00163     string m_UnitName;
00164 
00165     //?
00166 //  GLdouble modelview[16];
00167 //  GLdouble projection[16];
00168 //  GLint    viewport[4];
00169 
00170     
00171 private:
00172     mitkLineWidgetModel3D(const mitkLineWidgetModel3D&);
00173     void operator = (const mitkLineWidgetModel3D&);
00174 };
00175 
00176 inline void mitkLineWidgetModel3D::SetUnits(float ux, float uy, float uz)
00177 {
00178     m_UnitsPerPixel[0] = ux;
00179     m_UnitsPerPixel[1] = uy;
00180     m_UnitsPerPixel[2] = uz;
00181 }
00182 
00183 inline void mitkLineWidgetModel3D::SetUnits(float units[3])
00184 {
00185     SetUnits(units[0], units[1], units[2]);
00186 }
00187 
00188 
00189 //#define DEFINED_mitkLineWidgetModel3D
00190 
00191 
00192 
00193 #endif
00194 

Generated on Tue Feb 25 15:00:37 2014 for MITK (Medical Imaging ToolKit) by  doxygen 1.4.3