00001
00002
00003
00004
00005
00006
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
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
00141 void _init();
00142
00143
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
00167
00168
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
00190
00191
00192
00193 #endif
00194