]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.h
815a9db16fd1aee2a2b9a933097255095bb53338
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / manualContour / manualViewBaseContour.h
1 #ifndef manualViewBaseContour_h
2 #define manualViewBaseContour_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 <vtkActor.h>
17 #include <vtkProperty.h>
18 #include <vtkCellArray.h>
19 #include <vtkRenderer.h>
20 #include <vtkCoordinate.h>
21 #include <vtkTextProperty.h>
22 #include <vtkTextActor.h>
23 #include <vtkProperty2D.h>
24 #include <vtkPointPicker.h>
25 //#include "widgets/UtilVtk3DGeometriSelection.h"
26 #include "UtilVtk3DGeometriSelection.h"
27 #include <vtkCellPicker.h> 
28
29
30 #include <vtkCamera.h> 
31 #include <vtkPolyLine.h>
32 #include <vtkDataSetMapper.h>
33 #include <vtkUnstructuredGrid.h>
34
35 #include "wxVTKRenderWindowInteractor.h"
36
37
38 //--
39
40 #include <vector>
41 #include "wxVtkBaseView.h"
42 #include "marTypes.h"
43
44 #include "manualViewPoint.h"
45 #include "manualContourModel.h"
46
47 // ----------------------------------------------------------------------------
48 // ----------------------------------------------------------------------------
49 // ----------------------------------------------------------------------------
50
51
52 class creaMaracasVisu_EXPORT manualViewBaseContour{
53
54 //---------------------------------------------------
55 // PUBLIC METHODS & ATTS
56 //---------------------------------------------------
57
58 public:
59         manualViewBaseContour();
60         virtual ~manualViewBaseContour();
61
62         virtual int GetType();
63         virtual void Save(FILE *pFile);
64         virtual void Open(FILE *pFile);
65
66         void    AddPoint();
67         virtual void    AddPoint( manualViewPoint * manualViewPoint );
68         void    InsertPoint(int id);
69         void    DeleteContour();
70         void    DeletePoint(int x, int y,int z);
71         virtual void    DeletePoint(int id);
72
73         virtual void    UpdateViewPoint(int id);
74         virtual void    UpdateViewPoints();
75
76         void    SetSelected(bool selected);
77         void    SetPosibleSelected(bool posibleSelected);
78         bool    GetSelected();
79         bool    GetPosibleSelected();
80         void    DeleteSelectedPoints();
81         bool    GetEditable();
82         void    SetEditable( bool * condition );
83
84
85
86         virtual int             GetIdPoint(int x, int y, int z);
87
88         void    SelectPoint(int i,bool select);
89         void    SelectLstPoints();
90         void    SelectAllPoints(bool select);
91         virtual int             SelectPosiblePoint(int x, int y ,int z);
92         bool    SelectPosibleContour(int x, int y ,int z);
93         void    SelectAllPossibleSelected(bool select);
94         void    SetPointSelected(int id,bool select);
95         void    SetPointPosibleSelected(int id,bool select);
96         void    SetIfViewControlPoints(bool ifShow);
97         bool    GetIfViewControlPoints();
98         
99         void    UnSelectPoint(int i);
100         void    UnSelectLstPoints();
101         void    UnSelectAllPoints();
102
103         void    SetModel(manualBaseModel *manContModel);
104         void    SetWxVtkBaseView(wxVtkBaseView *wxvtkbaseview);
105
106         virtual void    Refresh();
107         int             GetNumberOfPoints();                                            // ??? 
108         //int           GetNumberOfPointsSpline();                              //JSTG 25-02-08 In ContourModel is the same method 
109         //void  SetNumberOfPointsSpline(int size);                      //JSTG 25-02-08 In ContourModel is the same method 
110
111         void    CreateNewContour();
112         double* GetVectorPointsXManualContour();
113         double* GetVectorPointsYManualContour();
114         double* GetVectorPointsZManualContour();
115
116         virtual bool    ifTouchContour(int x,int y, int z);
117         void    UpdateColorActor();
118
119         void    SetRange(double range);
120         double          GetRange();
121         void    SetZ(int z);
122         int             GetZ();
123
124         wxVtkBaseView *GetWxVtkBaseView();
125
126         virtual void InitMove(int x, int y, int z);
127         virtual void MoveContour(int x, int y, int z);
128         virtual void MoveContour(int horizontalUnits, int verticalUnits );
129         virtual void GetMinMax( double &minX,double &minY, double &minZ, double &maxX, double &maxY, double &maxZ );
130         virtual void TransfromCoordViewWorld(double &X, double &Y, double &Z, int type=2);
131
132         void    ClearContour();
133         virtual void    ClearPoint(int id);
134
135         void    SetVisible(bool ok);
136         void    SetShowText(bool ok);
137
138         void    GetSpacing(double spc[3]);
139         void    SetSpacing(double spc[3]);
140
141         void    SetColorNormalContour(double r, double g, double b);
142         void    GetColorNormalContour(double &r, double &g, double &b);
143         void    SetColorEditContour(double r, double g, double b);
144         void    GetColorEditContour(double &r, double &g, double &b);
145         void    SetColorSelectContour(double r, double g, double b);
146         void    GetColorSelectContour(double &r, double &g, double &b);
147         
148         //Addinging and removing from visualization specific actors included in the viewer contour
149         void    AddCompleteContourActor( bool ifControlPoints = false);
150         void    RemoveCompleteContourActor();
151         virtual void    AddSplineActor();
152         virtual void    RemoveSplineActor();
153         virtual void    AddControlPoints();
154         virtual void    RemoveControlPoints();  
155         void    AddTextActor();
156         void    RemoveTextActor();
157         void InitTextActor();
158
159         virtual manualViewBaseContour * Clone();
160                         void                                    CopyAttributesTo( manualViewBaseContour *cloneObject );
161         virtual void                                    RefreshContour();
162                         void                                    SetWidthLine(double width);
163                         double                                  GetWidthLine();
164
165         virtual void                    ConstructVTKObjects();
166
167 //---------------------------------------------------
168 // PRIVATE METHODS & ATTS
169 //---------------------------------------------------
170
171 private:
172
173         vtkPolyData                                             *_pd;
174         vtkActor                                                *_contourVtkActor;
175         vtkPolyDataMapper                               *_bboxMapper;
176
177         void                    DeleteVtkObjects();
178         
179
180 //---------------------------------------------------
181 // PROTECTED METHODS & ATTS
182 //---------------------------------------------------
183
184 protected:
185
186         double                                                          _range;
187
188         double                                                  _coulorEdit_r;
189         double                                                  _coulorEdit_g;
190         double                                                  _coulorEdit_b;
191         double                                                  _coulorNormal_r;
192         double                                                  _coulorNormal_g;
193         double                                                  _coulorNormal_b;
194         double                                                  _coulorSelection_r;
195         double                                                  _coulorSelection_g;
196         double                                                  _coulorSelection_b;
197         double                                                  _widthline;
198
199         //
200         // Reference to VTKBaseView
201         //
202         wxVtkBaseView                                   *_wxvtkbaseview;
203
204         //
205         // Is the contour selected
206         //
207         bool                                                    _selected;
208         bool                                                    *_editable;
209         bool                                                    _posibleSelected;
210         bool                                                    _viewControlPoints;
211
212         // text
213         bool                                                    _show_text;
214         int                                                             _id_viewPoint_for_text;
215         vtkTextActor                                    *_textActor;
216
217         //
218         // Contour model
219         //
220         manualBaseModel                         *_manContModel;
221
222         vtkPoints                                               *_pts;
223 // JSTG 25-02-08 --------------------------------------------
224         int                                                             _sizePointsContour;
225 //-----------------------------------------------------------
226
227         //
228         // Control points list
229         //
230         std::vector<manualViewPoint*>   _lstViewPoints;
231
232         //
233         // Spacing
234         //
235         double                                                  _spc[3];
236
237         virtual void    RefreshText();
238
239 };
240
241
242 #endif // manualViewBaseContour_h