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