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

mitkPolygonWidgetModel2D.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 
00012 #ifndef __mitkPolygonWidgetModel2D_h
00013 #define __mitkPolygonWidgetModel2D_h
00014 
00015 #include "mitkWidgetModel2D.h"
00016 #include <string>
00017 
00018 using std::string;
00019 
00020 class PointList;
00021 
00029 class MITK_VISUALIZATION_API mitkPolygonWidgetModel2D : public mitkWidgetModel2D
00030 {
00031 public:
00032     MITK_TYPE(mitkPolygonWidgetModel2D, mitkWidgetModel2D)
00033 
00034     virtual void PrintSelf(ostream &os);
00035 
00036     mitkPolygonWidgetModel2D();
00037     
00044     virtual int Render(mitkScene *scene);
00045 
00051     virtual void Pick(const WidgetNames &names);
00052 
00056     virtual void Release();
00057 
00074     void AddPoint(int sx, int sy);
00075 
00081     void AddPoint(float x, float y);
00082 
00088     void AddPoint(float point[2]) { this->AddPoint(point[0], point[1]); }
00089 
00106     void MoveCurrentPoint(int sx, int sy);
00107 
00113     void MoveCurrentPoint(float x, float y);
00114 
00120     void MoveCurrentPoint(float point[2]) { this->MoveCurrentPoint(point[0], point[1]); }
00121 
00127     void SetUnitName(const string &name) { m_UnitName = name; }
00128 
00134     const string& GetUnitName() { return m_UnitName; }
00135 
00140     float GetArea();
00141 
00146     float GetPerimeter();
00147 
00155     bool GetCurrentPoint(float &x, float &y);
00156 
00163     bool GetCurrentPoint(int &ix, int &iy);
00164 
00169     int GetPointsNumber();
00170 
00179     bool GetPoint(int idx, float &x, float &y);
00180 
00188     bool GetPoint(int idx, int &ix, int &iy);
00189 
00196     virtual mitkVolume* GetRegionMask();
00197 
00198 protected:
00199     virtual ~mitkPolygonWidgetModel2D();
00200     virtual float* _getBounds();
00201 
00210     virtual void _onMouseDown(int mouseButton, bool ctrlDown, bool shiftDown, int xPos, int yPos);
00211 
00220     virtual void _onMouseUp(int mouseButton, bool ctrlDown, bool shiftDown, int xPos, int yPos);
00221 
00231     virtual void _onMouseMove(bool ctrlDown, bool shiftDown, int xPos, int yPos, int deltaX, int deltaY);
00232 
00233     void _init();
00234 
00235     enum { MAXNUM_OF_POINTS = 1 << 20 };
00236 
00237     enum 
00238     { 
00239         unknown, 
00240         poly,
00241         startpoint,
00242         startline = startpoint + MAXNUM_OF_POINTS
00243     };
00244     
00245     float m_DotColor[4];
00246     float m_LineColor[4];
00247     float m_PickedDotColor[4];
00248     float m_PickedLineColor[4];
00249 
00250     float m_DotSize;
00251 
00252     float m_Left;
00253     float m_Right;
00254     float m_Top;
00255     float m_Bottom;
00256 
00257     PointList *m_Points;
00258 
00259     bool m_Done;
00260 
00261     string m_UnitName;
00262 
00263 private:
00264     mitkPolygonWidgetModel2D(const mitkPolygonWidgetModel2D&);
00265     void operator = (const mitkPolygonWidgetModel2D&);
00266 
00267 };
00268 
00269 
00270 //#define DEFINED_mitkPolygonWidgetModel2D
00271 
00272 
00273 
00274 #endif
00275 

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