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