]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualBaseModel.h
fe772f70433d9640a786985c3cf0bbedfce90646
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / manualContour / manualBaseModel.h
1 #ifndef manualBaseModel_h
2 #define manualBaseModel_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 <vtkCellPicker.h> 
15 #include <vtkCamera.h> 
16 #include <vtkPolyLine.h>
17 #include <vtkDataSetMapper.h>
18 #include <vtkUnstructuredGrid.h>
19
20 #include "wxVTKRenderWindowInteractor.h"
21
22 #include <vector>
23 #include "wxVtkBaseView.h"
24 #include "marTypes.h"
25 #include "manualPoint.h"
26
27 // --------------------------------------------------------------------------------------------
28 // Includes the functionality to manage a contour without the spline line usage
29 // @author RaC 09-09
30 class creaMaracasVisu_EXPORT manualBaseModel
31 {
32 public:
33         manualBaseModel();
34         virtual ~manualBaseModel();
35
36         virtual manualBaseModel * Clone();
37         void CopyAttributesTo( manualBaseModel *cloneObject );
38         virtual void Open(FILE *ff);    // virtual
39         virtual void Save(FILE *ff);    // virtual
40         virtual int GetTypeModel();                     // virtual 
41         
42         virtual void                    SetNumberOfPointsSpline(int size);
43
44         virtual int                             AddPoint(double x,double y,double z);
45         virtual int                             InsertPoint(double x,double y,double z);
46         virtual void                    InsertPoint_id(int id, double x,double y,double z);
47         virtual void                    AddManualPoint( manualPoint* theManualPoint );
48         virtual void                    DeletePoint(int i);
49         virtual void                    DeleteAllPoints();
50
51         virtual void                    MovePoint(int i,double dx,double dy,double dz);
52         virtual void                    MoveLstPoints(double dx,double dy,double dz);
53         virtual void                    MoveAllPoints(double dx,double dy,double dz);
54
55         // Returns the id of the point in the coordinates and the i_range given, according to the type
56         // which corresponds to the plane where it's necessary to find the point.
57         // @param type=-1  x,y,z - type=0 y,z - type=1  x,z - type=2    x,y
58         // @return int - Returns the id of the point in the coordinates given. Returns -1 otherwise.
59         virtual int                             GetIdPoint(double x, double y, double z, int i_range,int type);
60         virtual manualPoint*    GetManualPoint(int id);
61         virtual int                             GetSizeLstPoints();
62         virtual double                  GetPathSize();
63         virtual void                    Transform_Ax_Plus_B (double Ax, double Bx, double Ay, double By);
64         virtual void    GetSpline_i_Point(int i, double *x, double *y, double *z);
65         virtual void                    GetSpline_t_Point(double t, double *x, double *y, double *z);
66
67         //
68         // Returns the number of points of the spline line, but not the contour control points
69         // @return int - spline points size
70         //
71         virtual int                             GetNumberOfPointsSpline();
72         virtual void    UpdateSpline();
73
74         //
75         // Returns a list with the actual model
76         // @return std::vector<manualBaseModel*>
77         //
78         virtual std::vector<manualBaseModel*> ExploseModel(  );
79         virtual double                  GetPathArea();
80         virtual void                    GetNearestPointAndNormal(double *p, double *rp,  double *rn);
81
82         virtual void                    SetCloseContour(bool closeContour);
83         virtual bool                    IfCloseContour();
84
85         // RaC 27-09-09 ----
86
87         //
88         // Returns true if the point with the coordinates in parameters is one of the points in
89         // the list of points of the model,
90         // @param x double
91         // @param y double
92         // @return true if the point with the coordinates in parameters is one of the points, false otherwise
93         //
94         int     IsPoint(double x, double y);
95
96         // CMRU 17-08-09 -----------------------------------------------------------------
97         
98         /*
99         * Assigns the parameter value to the label
100         * @param newLabel New label of the contour
101         */
102         virtual void SetLabel(std::string newLabel);
103         
104         /*
105         * Assigns the parameter value to the real size
106         * @param newRealSize New real size in milimeters of the contour
107         */
108         virtual void SetRealSize(double newRealSize);
109         
110         /**
111         * Returns the label of the contour
112         */
113         virtual std::string GetLabel();
114
115         /**
116         * Returns the real size in milimeters of the contour
117         */
118         virtual double GetRealSize();
119         
120         /*
121         * Saves the label and the real size of the contour
122         * @param ff File where the information is stored 
123         */
124         virtual void SaveData(FILE *ff);
125  
126         /*
127         * Reads and interprets the information of the label and the real size
128         * @param ff File where the information is readed 
129         */
130         virtual void OpenData(FILE *ff);
131
132 protected:
133         int                                                     _sizePointsContour;
134         std::vector<manualPoint*>       _lstPoints;
135
136 }; 
137
138
139 #endif // manualBaseModel_h