Salome HOME
0f4429c2badb3363023fe4f443073305fc0395ec
[modules/gui.git] / src / VTKViewer / VTKViewer_ConvexTool.h
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, 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.
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 #ifndef _VTKViewer_ConvexTool_H
23 #define _VTKViewer_ConvexTool_H
24
25 #include "VTKViewer.h"
26
27 #include <vector>
28
29 #include <vtkSystemIncludes.h>
30
31 class vtkUnstructuredGrid;
32 class vtkGeometryFilter;
33 class vtkGenericCell;
34 class vtkDelaunay3D;
35 class vtkPolyData;
36 class vtkCellData;
37 class vtkPoints;
38 class vtkIdList;
39 class vtkCell;
40 class vtkCellArray;
41 class vtkTriangle;
42 class vtkOrderedTriangulator;
43
44
45 //----------------------------------------------------------------------------
46 class VTKVIEWER_EXPORT VTKViewer_Triangulator
47 {
48  public:
49   VTKViewer_Triangulator();
50
51   ~VTKViewer_Triangulator();
52
53   bool 
54   Execute(vtkUnstructuredGrid *theInput,
55           vtkCellData* thInputCD,
56           vtkIdType theCellId,
57           int theShowInside,
58           int theAllVisible,
59           const char* theCellsVisibility,
60           vtkPolyData *theOutput,
61           vtkCellData* theOutputCD,
62           int theStoreMapping,
63           std::vector<vtkIdType>& theVTK2ObjIds,
64           bool theIsCheckConvex);
65
66  private:
67   vtkIdList* myCellIds;
68
69  protected:
70   vtkIdType *myPointIds;
71   vtkIdList* myFaceIds;
72   vtkPoints* myPoints;
73
74   virtual
75   vtkPoints* 
76   InitPoints(vtkUnstructuredGrid *theInput,
77              vtkIdType theCellId);
78
79   virtual
80   vtkIdType 
81   GetNumFaces() = 0;
82
83   virtual
84   vtkCell* 
85   GetFace(vtkIdType theFaceId) = 0;
86
87   vtkIdType 
88   GetNbOfPoints();
89
90   vtkIdType 
91   GetPointId(vtkIdType thePointId);
92
93   vtkFloatingPointType 
94   GetCellLength();
95
96   void 
97   GetCellNeighbors(vtkUnstructuredGrid *theInput,
98                    vtkIdType theCellId,
99                    vtkCell* theFace,
100                    vtkIdList* theCellIds);
101
102   vtkIdType 
103   GetConnectivity(vtkIdType thePntId);
104 };
105
106
107 //----------------------------------------------------------------------------
108 class VTKVIEWER_EXPORT VTKViewer_OrderedTriangulator : public VTKViewer_Triangulator
109 {
110  public:
111
112   VTKViewer_OrderedTriangulator();
113
114   ~VTKViewer_OrderedTriangulator();
115
116  protected:
117   vtkOrderedTriangulator *myTriangulator;
118   vtkCellArray *myBoundaryTris;
119   vtkTriangle  *myTriangle;
120
121   virtual
122   vtkPoints* 
123   InitPoints(vtkUnstructuredGrid *theInput,
124              vtkIdType theCellId);
125
126   virtual
127   vtkIdType 
128   GetNumFaces();
129
130   virtual
131   vtkCell* 
132   GetFace(vtkIdType theFaceId);
133 };
134
135
136 //----------------------------------------------------------------------------
137 class VTKVIEWER_EXPORT VTKViewer_DelaunayTriangulator : public VTKViewer_Triangulator
138 {
139  public:
140
141   VTKViewer_DelaunayTriangulator();
142
143   ~VTKViewer_DelaunayTriangulator();
144
145  protected:
146   vtkUnstructuredGrid* myUnstructuredGrid;
147   vtkGeometryFilter* myGeometryFilter;
148   vtkDelaunay3D* myDelaunay3D;
149   vtkPolyData* myPolyData;
150
151   virtual
152   vtkPoints* 
153   InitPoints(vtkUnstructuredGrid *theInput,
154              vtkIdType theCellId);
155
156   virtual
157   vtkIdType 
158   GetNumFaces();
159
160   virtual
161   vtkCell* 
162   GetFace(vtkIdType theFaceId);
163 };
164
165
166 #endif // _VTKViewer_ConvexTool_H