Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[modules/gui.git] / src / VTKViewer / VTKViewer_ConvexTool.h
1 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
3 // 
4 //  This library is free software; you can redistribute it and/or 
5 //  modify it under the terms of the GNU Lesser General Public 
6 //  License as published by the Free Software Foundation; either 
7 //  version 2.1 of the License. 
8 // 
9 //  This library is distributed in the hope that it will be useful, 
10 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 //  Lesser General Public License for more details. 
13 // 
14 //  You should have received a copy of the GNU Lesser General Public 
15 //  License along with this library; if not, write to the Free Software 
16 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
17 // 
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20
21 #ifndef _VTKViewer_ConvexTool_H
22 #define _VTKViewer_ConvexTool_H
23
24 #include "VTKViewer.h"
25
26 #include <vector>
27
28 #include <vtkSystemIncludes.h>
29
30 class vtkUnstructuredGrid;
31 class vtkGeometryFilter;
32 class vtkGenericCell;
33 class vtkDelaunay3D;
34 class vtkPolyData;
35 class vtkCellData;
36 class vtkPoints;
37 class vtkIdList;
38 class vtkCell;
39
40 class VTKVIEWER_EXPORT VTKViewer_Triangulator
41 {
42  public:
43   VTKViewer_Triangulator();
44
45   ~VTKViewer_Triangulator();
46
47   bool 
48   Execute(vtkUnstructuredGrid *theInput,
49           vtkCellData* thInputCD,
50           vtkIdType theCellId,
51           int theShowInside,
52           int theAllVisible,
53           const char* theCellsVisibility,
54           vtkPolyData *theOutput,
55           vtkCellData* theOutputCD,
56           int theStoreMapping,
57           std::vector<vtkIdType>& theVTK2ObjIds,
58           bool theIsCheckConvex);
59
60  protected:
61   vtkIdList* myCellIds;
62
63   vtkUnstructuredGrid *myInput;
64   vtkIdType myCellId;
65   int myShowInside;
66   int myAllVisible;
67   const char* myCellsVisibility;
68
69   virtual
70   vtkPoints* 
71   InitPoints() = 0;
72
73   virtual
74   vtkIdType 
75   GetNbOfPoints() = 0;
76
77   virtual
78   vtkIdType 
79   GetPointId(vtkIdType thePointId) = 0;
80
81   virtual
82   vtkFloatingPointType 
83   GetCellLength() = 0;
84
85   virtual
86   vtkIdType 
87   GetNumFaces() = 0;
88
89   virtual
90   vtkCell* 
91   GetFace(vtkIdType theFaceId) = 0;
92
93   virtual
94   void 
95   GetCellNeighbors(vtkIdType theCellId,
96                    vtkCell* theFace,
97                    vtkIdList* theCellIds) = 0;
98
99   virtual
100   vtkIdType 
101   GetConnectivity(vtkIdType thePntId) = 0;
102 };
103
104
105 class VTKVIEWER_EXPORT VTKViewer_OrderedTriangulator : public VTKViewer_Triangulator
106 {
107  public:
108
109   VTKViewer_OrderedTriangulator();
110
111   ~VTKViewer_OrderedTriangulator();
112
113  protected:
114   vtkGenericCell *myCell;
115
116   virtual
117   vtkPoints* 
118   InitPoints();
119
120   virtual
121   vtkIdType 
122   GetNbOfPoints();
123
124   vtkIdType 
125   GetPointId(vtkIdType thePointId);
126
127   virtual
128   vtkFloatingPointType 
129   GetCellLength();
130
131   virtual
132   vtkIdType 
133   GetNumFaces();
134
135   virtual
136   vtkCell* 
137   GetFace(vtkIdType theFaceId);
138
139   virtual
140   void 
141   GetCellNeighbors(vtkIdType theCellId,
142                    vtkCell* theFace,
143                    vtkIdList* theCellIds);
144
145   virtual
146   vtkIdType 
147   GetConnectivity(vtkIdType thePntId);
148 };
149
150
151 class VTKVIEWER_EXPORT VTKViewer_DelaunayTriangulator : public VTKViewer_Triangulator
152 {
153  public:
154
155   VTKViewer_DelaunayTriangulator();
156
157   ~VTKViewer_DelaunayTriangulator();
158
159  protected:
160   vtkUnstructuredGrid* myUnstructuredGrid;
161   vtkGeometryFilter* myGeometryFilter;
162   vtkDelaunay3D* myDelaunay3D;
163   vtkPolyData* myPolyData;
164   vtkIdType *myPointIds;
165   vtkIdList* myFaceIds;
166   vtkPoints* myPoints;
167
168   virtual
169   vtkPoints* 
170   InitPoints();
171
172   virtual
173   vtkIdType 
174   GetNbOfPoints();
175
176   vtkIdType 
177   GetPointId(vtkIdType thePointId);
178
179   virtual
180   vtkFloatingPointType 
181   GetCellLength();
182
183   virtual
184   vtkIdType 
185   GetNumFaces();
186
187   virtual
188   vtkCell* 
189   GetFace(vtkIdType theFaceId);
190
191   virtual
192   void 
193   GetCellNeighbors(vtkIdType theCellId,
194                    vtkCell* theFace,
195                    vtkIdList* theCellIds);
196
197   virtual
198   vtkIdType 
199   GetConnectivity(vtkIdType thePntId);
200 };
201
202
203 #endif // _VTKViewer_ConvexTool_H