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

mitkAngleWidgetModel2D.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 __mitkAngleWidgetModel2D_h
00012 #define __mitkAngleWidgetModel2D_h
00013 
00014 #include "mitkWidgetModel2D.h"
00015 
00023 class MITK_VISUALIZATION_API mitkAngleWidgetModel2D : public mitkWidgetModel2D
00024 {
00025 public:
00026     MITK_TYPE(mitkAngleWidgetModel2D, mitkWidgetModel2D)
00027 
00028     virtual void PrintSelf(ostream &os);
00029 
00030     mitkAngleWidgetModel2D();
00031     
00038     virtual int Render(mitkScene *scene);
00039 
00045     virtual void Pick(const WidgetNames &names);
00046 
00050     virtual void Release();
00051 
00059     void SetStartPoint(float p[2]);
00060 
00068     void SetStartPoint(float x, float y);
00069 
00086     void SetStartPoint(int sx, int sy);
00087 
00095     void SetEndPoint0(float p[2]);
00096 
00104     void SetEndPoint0(float x, float y);
00105 
00122     void SetEndPoint0(int sx, int sy);
00123 
00131     void SetEndPoint1(float p[2]);
00132 
00140     void SetEndPoint1(float x, float y);
00141 
00158     void SetEndPoint1(int sx, int sy);
00159 
00164     float GetAngleInDegree();
00165 
00170     float GetAngleInRadian();
00171 
00172 protected:
00173     virtual ~mitkAngleWidgetModel2D();
00174 
00183     virtual void _onMouseDown(int mouseButton, bool ctrlDown, bool shiftDown, int xPos, int yPos);
00184 
00193     virtual void _onMouseUp(int mouseButton, bool ctrlDown, bool shiftDown, int xPos, int yPos);
00194 
00204     virtual void _onMouseMove(bool ctrlDown, bool shiftDown, int xPos, int yPos, int deltaX, int deltaY);
00205 
00206     virtual float* _getBounds();
00207 
00208     void _init();
00209 
00210     enum
00211     {
00212         unknown,
00213         dot,
00214         arrow0,
00215         arrow1,
00216         line
00217     };
00218 
00219     float m_StartPoint[2];
00220     float m_EndPoint0[2];
00221     float m_EndPoint1[2];
00222 
00223     float m_ArrowLength;
00224 
00225     float m_ArrowColor[4];
00226     float m_DotColor[4];
00227     float m_LineColor[4];
00228     float m_PickedArrowColor[4];
00229     float m_PickedDotColor[4];
00230     float m_PickedLineColor[4];
00231 
00232     bool m_StartPointSet;
00233     bool m_EndPoint0Set;
00234     bool m_EndPoint1Set;
00235 
00236 private:
00237     mitkAngleWidgetModel2D(const mitkAngleWidgetModel2D&);
00238     void operator = (const mitkAngleWidgetModel2D&);
00239 
00240 };
00241 
00242 inline void mitkAngleWidgetModel2D::SetStartPoint(float x, float y)
00243 {
00244     this->_getOriginalCoordinates(x, y, m_StartPoint[0], m_StartPoint[1]);
00245     m_StartPointSet = true;
00246 }
00247 
00248 inline void mitkAngleWidgetModel2D::SetStartPoint(float p[2])
00249 {
00250     this->SetStartPoint(p[0], p[1]);
00251 }
00252 
00253 inline void mitkAngleWidgetModel2D::SetStartPoint(int sx, int sy)
00254 {
00255     this->_getOriginalCoordinates(sx, sy, m_StartPoint[0], m_StartPoint[1]);
00256     m_StartPointSet = true;
00257 }
00258 
00259 inline void mitkAngleWidgetModel2D::SetEndPoint0(float x, float y)
00260 {
00261     this->_getOriginalCoordinates(x, y, m_EndPoint0[0], m_EndPoint0[1]);
00262     m_EndPoint0Set = true;
00263 }
00264 
00265 inline void mitkAngleWidgetModel2D::SetEndPoint0(float p[2])
00266 {
00267     this->SetEndPoint0(p[0], p[1]);
00268 }
00269 
00270 inline void mitkAngleWidgetModel2D::SetEndPoint0(int sx, int sy)
00271 {
00272     this->_getOriginalCoordinates(sx, sy, m_EndPoint0[0], m_EndPoint0[1]);
00273     m_EndPoint0Set = true;
00274 }
00275 
00276 inline void mitkAngleWidgetModel2D::SetEndPoint1(float x, float y)
00277 {
00278     this->_getOriginalCoordinates(x, y, m_EndPoint1[0], m_EndPoint1[1]);
00279     m_EndPoint1Set = true;
00280 }
00281 
00282 inline void mitkAngleWidgetModel2D::SetEndPoint1(float p[2])
00283 {
00284     this->SetEndPoint1(p[0], p[1]);
00285 }
00286 
00287 inline void mitkAngleWidgetModel2D::SetEndPoint1(int sx, int sy)
00288 {
00289     this->_getOriginalCoordinates(sx, sy, m_EndPoint1[0], m_EndPoint1[1]);
00290     m_EndPoint1Set = true;
00291 }
00292 
00293 
00294 //#define DEFINED_mitkAngleWidgetModel2D
00295 
00296 
00297 
00298 #endif
00299 

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