1 #ifndef manualViewBaseContour_h
2 #define manualViewBaseContour_h
4 #include "vtkRenderWindow.h"
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>
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>
30 #include <vtkCamera.h>
31 #include <vtkPolyLine.h>
32 #include <vtkDataSetMapper.h>
33 #include <vtkUnstructuredGrid.h>
35 #include "wxVTKRenderWindowInteractor.h"
41 #include "wxVtkBaseView.h"
44 #include "manualViewPoint.h"
45 #include "manualContourModel.h"
47 // ----------------------------------------------------------------------------
48 // ----------------------------------------------------------------------------
49 // ----------------------------------------------------------------------------
52 class creaMaracasVisu_EXPORT manualViewBaseContour{
54 //---------------------------------------------------
55 // PUBLIC METHODS & ATTS
56 //---------------------------------------------------
59 manualViewBaseContour();
60 virtual ~manualViewBaseContour();
62 virtual int GetType();
63 virtual void Save(FILE *pFile);
64 virtual void Open(FILE *pFile);
67 virtual void AddPoint( manualViewPoint * manualViewPoint );
68 void InsertPoint(int id);
70 void DeletePoint(int x, int y,int z);
71 virtual void DeletePoint(int id);
73 virtual void UpdateViewPoint(int id);
74 virtual void UpdateViewPoints();
76 void SetSelected(bool selected);
77 void SetPosibleSelected(bool posibleSelected);
79 bool GetPosibleSelected();
80 void DeleteSelectedPoints();
82 void SetEditable( bool * condition );
86 virtual int GetIdPoint(int x, int y, int z);
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();
99 void UnSelectPoint(int i);
100 void UnSelectLstPoints();
101 void UnSelectAllPoints();
103 void SetModel(manualBaseModel *manContModel);
104 void SetWxVtkBaseView(wxVtkBaseView *wxvtkbaseview);
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
111 void CreateNewContour();
112 double* GetVectorPointsXManualContour();
113 double* GetVectorPointsYManualContour();
114 double* GetVectorPointsZManualContour();
116 virtual bool ifTouchContour(int x,int y, int z);
117 void UpdateColorActor();
119 void SetRange(double range);
124 wxVtkBaseView *GetWxVtkBaseView();
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);
133 virtual void ClearPoint(int id);
135 void SetVisible(bool ok);
136 void SetShowText(bool ok);
138 void GetSpacing(double spc[3]);
139 void SetSpacing(double spc[3]);
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);
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();
156 void RemoveTextActor();
157 void InitTextActor();
159 virtual manualViewBaseContour * Clone();
160 void CopyAttributesTo( manualViewBaseContour *cloneObject );
161 virtual void RefreshContour();
162 void SetWidthLine(double width);
163 double GetWidthLine();
165 virtual void ConstructVTKObjects();
167 //---------------------------------------------------
168 // PRIVATE METHODS & ATTS
169 //---------------------------------------------------
174 vtkActor *_contourVtkActor;
175 vtkPolyDataMapper *_bboxMapper;
177 void DeleteVtkObjects();
180 //---------------------------------------------------
181 // PROTECTED METHODS & ATTS
182 //---------------------------------------------------
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;
200 // Reference to VTKBaseView
202 wxVtkBaseView *_wxvtkbaseview;
205 // Is the contour selected
209 bool _posibleSelected;
210 bool _viewControlPoints;
214 int _id_viewPoint_for_text;
215 vtkTextActor *_textActor;
220 manualBaseModel *_manContModel;
223 // JSTG 25-02-08 --------------------------------------------
224 int _sizePointsContour;
225 //-----------------------------------------------------------
228 // Control points list
230 std::vector<manualViewPoint*> _lstViewPoints;
237 virtual void RefreshText();
242 #endif // manualViewBaseContour_h