1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 # This software is governed by the CeCILL-B license under French law and
10 # abiding by the rules of distribution of free software. You can use,
11 # modify and/ or redistribute the software under the terms of the CeCILL-B
12 # license as circulated by CEA, CNRS and INRIA at the following URL
13 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 # or in the file LICENSE.txt.
16 # As a counterpart to the access to the source code and rights to copy,
17 # modify and redistribute granted by the license, users are provided only
18 # with a limited warranty and the software's author, the holder of the
19 # economic rights, and the successive licensors have only limited
22 # The fact that you are presently reading this means that you have had
23 # knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
26 #ifndef manualViewBaseContour_h
27 #define manualViewBaseContour_h
29 #include "vtkRenderWindow.h"
31 #include "vtkRenderer.h"
32 #include "vtkRenderWindowInteractor.h" //extremely important with VC++ don't remove !
33 #include "vtkCommand.h"
34 #include "vtkPolyData.h"
35 #include "vtkCellArray.h"
36 #include "vtkPolyDataMapper.h"
37 #include "vtkInteractorObserver.h"
38 #include "vtkInteractorStyleImage.h"
39 #include <vtkKochanekSpline.h>
42 #include <vtkProperty.h>
43 #include <vtkCellArray.h>
44 #include <vtkRenderer.h>
45 #include <vtkCoordinate.h>
46 #include <vtkTextProperty.h>
47 #include <vtkTextActor.h>
48 #include <vtkProperty2D.h>
49 #include <vtkPointPicker.h>
50 //#include "widgets/UtilVtk3DGeometriSelection.h"
51 #include "UtilVtk3DGeometriSelection.h"
52 #include <vtkCellPicker.h>
55 #include <vtkCamera.h>
56 #include <vtkPolyLine.h>
57 #include <vtkDataSetMapper.h>
58 #include <vtkUnstructuredGrid.h>
60 #include "wxVTKRenderWindowInteractor.h"
66 #include "wxVtkBaseView.h"
69 #include "manualViewPoint.h"
70 #include "manualContourModel.h"
72 // ----------------------------------------------------------------------------
73 // ----------------------------------------------------------------------------
74 // ----------------------------------------------------------------------------
77 class creaMaracasVisu_EXPORT manualViewBaseContour{
79 //---------------------------------------------------
80 // PUBLIC METHODS & ATTS
81 //---------------------------------------------------
84 manualViewBaseContour();
85 virtual ~manualViewBaseContour();
87 virtual int GetType();
88 virtual void Save(FILE *pFile);
89 virtual void Open(FILE *pFile);
92 virtual void AddPoint( manualViewPoint * manualViewPoint );
93 void InsertPoint(int id);
95 void DeletePoint(int x, int y,int z);
96 virtual void DeletePoint(int id);
98 virtual void UpdateViewPoint(int id);
99 virtual void UpdateViewPoints();
101 void SetSelected(bool selected);
102 void SetPosibleSelected(bool posibleSelected);
104 bool GetPosibleSelected();
105 void DeleteSelectedPoints();
107 void SetEditable( bool * condition );
111 virtual int GetIdPoint(int x, int y, int z);
113 void SelectPoint(int i,bool select);
114 void SelectLstPoints();
115 void SelectAllPoints(bool select);
116 virtual int SelectPosiblePoint(int x, int y ,int z);
117 bool SelectPosibleContour(int x, int y ,int z);
118 void SelectAllPossibleSelected(bool select);
119 void SetPointSelected(int id,bool select);
120 void SetPointPosibleSelected(int id,bool select);
121 void SetIfViewControlPoints(bool ifShow);
122 bool GetIfViewControlPoints();
124 void UnSelectPoint(int i);
125 void UnSelectLstPoints();
126 void UnSelectAllPoints();
128 void SetModel(manualBaseModel *manContModel);
129 void SetWxVtkBaseView(wxVtkBaseView *wxvtkbaseview);
131 virtual void Refresh();
132 int GetNumberOfPoints(); // ???
133 //int GetNumberOfPointsSpline(); //JSTG 25-02-08 In ContourModel is the same method
134 //void SetNumberOfPointsSpline(int size); //JSTG 25-02-08 In ContourModel is the same method
136 void CreateNewContour();
137 double* GetVectorPointsXManualContour();
138 double* GetVectorPointsYManualContour();
139 double* GetVectorPointsZManualContour();
141 virtual bool ifTouchContour(int x,int y, int z);
142 void UpdateColorActor();
144 void SetRange(double range);
149 wxVtkBaseView *GetWxVtkBaseView();
151 virtual void InitMove(int x, int y, int z);
152 virtual void MoveContour(int x, int y, int z);
153 virtual void MoveContour(int horizontalUnits, int verticalUnits );
154 virtual void GetMinMax( double &minX,double &minY, double &minZ, double &maxX, double &maxY, double &maxZ );
155 virtual void TransfromCoordViewWorld(double &X, double &Y, double &Z, int type=2);
158 virtual void ClearPoint(int id);
160 void SetVisible(bool ok);
161 void SetShowText(bool ok);
163 void GetSpacing(double spc[3]);
164 void SetSpacing(double spc[3]);
166 void SetColorNormalContour(double r, double g, double b);
167 void GetColorNormalContour(double &r, double &g, double &b);
168 void SetColorEditContour(double r, double g, double b);
169 void GetColorEditContour(double &r, double &g, double &b);
170 void SetColorSelectContour(double r, double g, double b);
171 void GetColorSelectContour(double &r, double &g, double &b);
173 //Addinging and removing from visualization specific actors included in the viewer contour
174 void AddCompleteContourActor( bool ifControlPoints = false);
175 void RemoveCompleteContourActor();
176 virtual void AddSplineActor();
177 virtual void RemoveSplineActor();
178 virtual void AddControlPoints();
179 virtual void RemoveControlPoints();
181 void RemoveTextActor();
182 void InitTextActor();
184 virtual manualViewBaseContour * Clone();
185 void CopyAttributesTo( manualViewBaseContour *cloneObject );
186 virtual void RefreshContour();
187 void SetWidthLine(double width);
188 double GetWidthLine();
190 virtual void ConstructVTKObjects();
192 //---------------------------------------------------
193 // PRIVATE METHODS & ATTS
194 //---------------------------------------------------
199 vtkActor *_contourVtkActor;
200 vtkPolyDataMapper *_bboxMapper;
202 void DeleteVtkObjects();
205 //---------------------------------------------------
206 // PROTECTED METHODS & ATTS
207 //---------------------------------------------------
213 double _coulorEdit_r;
214 double _coulorEdit_g;
215 double _coulorEdit_b;
216 double _coulorNormal_r;
217 double _coulorNormal_g;
218 double _coulorNormal_b;
219 double _coulorSelection_r;
220 double _coulorSelection_g;
221 double _coulorSelection_b;
225 // Reference to VTKBaseView
227 wxVtkBaseView *_wxvtkbaseview;
230 // Is the contour selected
234 bool _posibleSelected;
235 bool _viewControlPoints;
239 int _id_viewPoint_for_text;
240 vtkTextActor *_textActor;
241 vtkTextActor *_textActor2;
246 manualBaseModel *_manContModel;
249 // JSTG 25-02-08 --------------------------------------------
250 int _sizePointsContour;
251 //-----------------------------------------------------------
254 // Control points list
256 std::vector<manualViewPoint*> _lstViewPoints;
263 virtual void RefreshText();
268 #endif // manualViewBaseContour_h