]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModel.h
Changes with manualBaseModel. It improves the functionality with the new
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / manualContour / manualContourModel.h
1 #ifndef manualContourModel_h
2 #define manualContourModel_h
3
4 #include "vtkRenderWindow.h"
5
6 #include "vtkRenderer.h"
7 #include "vtkRenderWindowInteractor.h" //extremely important with VC++ don't remove !
8 #include "vtkCommand.h"
9 #include "vtkPolyData.h"
10 #include "vtkCellArray.h"
11 #include "vtkPolyDataMapper.h"
12 #include "vtkInteractorObserver.h"
13 #include "vtkInteractorStyleImage.h"
14 #include <vtkKochanekSpline.h> 
15
16 #include <vtkCellPicker.h> 
17
18
19 #include <vtkCamera.h> 
20 #include <vtkPolyLine.h>
21 #include <vtkDataSetMapper.h>
22 #include <vtkUnstructuredGrid.h>
23
24 #include "wxVTKRenderWindowInteractor.h"
25
26
27 //--
28
29 #include <vector>
30 #include "wxVtkBaseView.h"
31 #include "marTypes.h"
32 #include "manualPoint.h"
33 #include "manualBaseModel.h"
34
35
36 // ----------------------------------------------------------------------------
37 // ----------------------------------------------------------------------------
38 // ----------------------------------------------------------------------------
39
40
41 class creaMaracasVisu_EXPORT manualContourModel : public manualBaseModel
42 {
43 public:
44         manualContourModel();
45         virtual ~manualContourModel();
46
47         virtual manualContourModel * Clone();
48         void CopyAttributesTo( manualContourModel *cloneObject );
49         void Open(FILE *ff);    // virtual
50         virtual void Save(FILE *ff);    // virtual
51         virtual int GetTypeModel();                     // virtual 
52
53         virtual int                             AddPoint(double x,double y,double z);
54         virtual int                             InsertPoint(double x,double y,double z);
55 //JSTG 25-04-08 -------------------------------------------------------
56         virtual void                    InsertPoint_id(int id, double x,double y,double z);
57 //---------------------------------------------------------------------
58         virtual void                    AddManualPoint( manualPoint* theManualPoint );
59         virtual void                    Transform_Ax_Plus_B (double Ax, double Bx, double Ay, double By);
60
61         virtual void                    DeletePoint(int i);
62         virtual void                    DeleteAllPoints();
63
64         virtual void                    MovePoint(int i,double dx,double dy,double dz);
65         virtual void                    MoveLstPoints(double dx,double dy,double dz);
66         virtual void                    MoveAllPoints(double dx,double dy,double dz);
67
68         virtual int                             GetIdPoint(double x, double y, double z, int i_range,int type);
69         virtual manualPoint*    GetManualPoint(int id);
70         virtual int                             GetSizeLstPoints();
71         int                             GetNumberOfPointsSpline();
72         virtual void                    SetNumberOfPointsSpline(int size);
73
74         virtual void    UpdateSpline();
75         void                    SetCloseContour(bool closeContour);
76         bool                    IfCloseContour();
77 //JSTG 25-02-08 -----------------------------------------------------------------
78         //void                  GetSplinePoint(double t, double &x, double &y, double &z);      //Method Original
79         //void                  GetSplineiPoint(int i, double &x, double &y, double &z);        //Method Original
80 //-------------------------------------------------------------------------------
81         virtual double                  GetPathSize();
82         virtual double                  GetPathArea();
83
84         void                    GetNearestPointAndNormal(double *p, double *rp,  double *rn);
85         
86 // JSTG 25-02-08 -----------------------------------------------------------------
87         virtual void    GetSpline_i_Point(int i, double *x, double *y, double *z);
88         void                    GetSpline_t_Point(double t, double *x, double *y, double *z);
89 //--------------------------------------------------------------------------------
90
91         virtual std::vector<manualBaseModel*> ExploseModel(  );
92
93 // CMRU 17-08-09 -----------------------------------------------------------------
94         
95         /*
96         * Assigns the parameter value to the label
97         * @param newLabel New label of the contour
98         */
99         void SetLabel(std::string newLabel);
100         
101         /*
102         * Assigns the parameter value to the real size
103         * @param newRealSize New real size in milimeters of the contour
104         */
105         void SetRealSize(double newRealSize);
106         
107         /**
108         * Returns the label of the contour
109         */
110         std::string GetLabel();
111
112         /**
113         * Returns the real size in milimeters of the contour
114         */
115         double GetRealSize();
116         
117         /*
118         * Saves the label and the real size of the contour
119         * @param ff File where the information is stored 
120         */
121         void SaveData(FILE *ff);
122
123         /*
124         * Reads and interprets the information of the label and the real size
125         * @param ff File where the information is readed 
126         */
127         void OpenData(FILE *ff);
128 //--------------------------------------------------------------------------------
129
130 private:
131         //int                                                   _sizePointsContour;
132         //std::vector<manualPoint*>     _lstPoints;
133         bool                                            _closeContour;
134     vtkKochanekSpline                   *_cntSplineX;
135     vtkKochanekSpline                   *_cntSplineY;
136     vtkKochanekSpline                   *_cntSplineZ;
137
138 //JSTG 25-02-08 ----------------------------------------
139         double                  _delta_JSTG;
140 //------------------------------------------------------
141
142 //CMRU 17-08-09 -----------------------------------------------------------------
143         /**
144         * Represents the real size in milimeters of the contour
145         */
146         double                  _realSize;
147
148         /**
149         * Represents the label associated with the contour
150         */
151         std::string             _label;
152 //--------------------------------------------------------------------------------
153
154 }; 
155
156
157 #endif // manualContourModel_h