Version: 9.16.0
GEOMImpl_Block6Explorer.hxx
Go to the documentation of this file.
1// Copyright (C) 2007-2026 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// File : GEOMImpl_Block6Explorer.hxx
24// Module : GEOMImpl
25
26#ifndef GEOMImpl_Block6Explorer_HeaderFile
27#define GEOMImpl_Block6Explorer_HeaderFile
28
29#include <TopoDS_Shape.hxx>
30#include <TopoDS_Wire.hxx>
31#include <TopTools_Array1OfShape.hxx>
32#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
33#include <TCollection_AsciiString.hxx>
34#include <gp_Trsf.hxx>
35
36 /* ======================================================================================================
37 Class GEOMImpl_Block6Explorer gives easy and fast access to a certain sub-elements of hexahedral solid
38 Each face can be accessed by its global ID [1-6]
39 Each edge can be accessed by its global ID [1-12] or by its local NB [1-4] inside certain face
40 Each vertex can be accessed by its global ID [1-8] or by its local NB [1-4] inside certain face
41 Numeration of the sub-shapes is defined in constructors, see they comments
42
43 face 2 face 4 | 4 face 2 face
44 | / | \ |
45 \|/ |/_ | _\| \|/
46 ' ' | ' '
47 8_______7__7 | 7__7_______8
48 /| /| | |\ |\
49 8 12 6 11 | 11 6 12 8
50 / | / | | | \ | \
51 5/______5__6/ | | | \6__5______\5
52 face 5 ---> | | | | <--- 6 face | face 6 ---> | | | | <--- 5 face
53 | |__3__|____| | |____|__3__| |
54 | /4 | /3 | 3\ | 4\ |
55 | / | / | \ | \ |
56 9 4 10 2 | 2 10 4 9
57 |/__1______|/ | \|______1__\|
58 1 2 | 2 1
59 _. . | . ._
60 /| /|\ | /|\ |\
61 / | | | \
62 3 face 1 face | face 1 face 3
63 |
64 Picture 1 (right orientation) | Picture 2 (left orientation)
65
66 For the moment, the orientation of numbering is not controlled
67
68 Faces: 1 - bottom, 2 - top, 3 - front, 4 - back, 5 - left (right), 6 - right (left)
69
70
71 4_______3__3 2 ______2__3
72 / / | |
73 4 2 1 3
74 / / | |
75 1/______1__2/ | |
76 | |
77 | __4______|
78 face 2 face 4 1 4
79 | /
80 \|/ |/_
81 ' '
82 3 8_______7__7 3
83 /| /| /| /|
84 3 2 8 12 6 11 3 2
85 / | / | / | / |
86 4/ | 5/______5__6/ | 4/ |
87 | | face 5 ---> | | | | <--- 6 face | |
88 | | | |__3__|____| | |
89 | /2 | /4 | /3 | /2
90 | / | / | / | /
91 4 1 9 4 10 2 4 1
92 |/ |/__1______|/ |/
93 1 1 2 1
94 _. .
95 /| /|\
96 / |
97 2 ______2__3 3 face 1 face
98 | |
99 | | __3_______
100 | | /4 /3
101 | | / /
102 1 3 4 2
103 | __4______| /__1______ /
104 1 4 1 2
105
106 Picture 3 (On periferal pictures the local
107 numeration of edges and vertices is shown)
108 ====================================================================================================== */
109
111{
112 public:
113 // ---------- PUBLIC METHODS ----------
114
116 // Constructor.
117
118 // Initialization by existing solid,
119 // sub-elements regulate numeration
120
121 void InitByBlock (const TopoDS_Shape& theBlock);
122 // Init by hexahedral solid. First face, edge and vertex is defined randomly
123
124 void InitByBlockAndFace (const TopoDS_Shape& theBlock,
125 const TopoDS_Shape& theFace);
126 // Constructor from hexahedral solid, making theFace the first face.
127 // First edge and vertex is defined randomly from theFace entities
128
129 void InitByBlockAndEdges (const TopoDS_Shape& theBlock,
130 const TopoDS_Shape& theEdge1,
131 const TopoDS_Shape& theEdge2);
132 // Init by hexahedral solid, making theEdge1 the first, theEdge2 the third.
133 // First vertex is defined randomly from theEdge1 vertices
134 // (Picture 1 and Picture 2 shows two possible cases)
135
136 void InitByBlockAndVertices (const TopoDS_Shape& theBlock,
137 const TopoDS_Shape& theVertex1,
138 const TopoDS_Shape& theVertex2,
139 const TopoDS_Shape& theVertex3);
140 // Init by hexahedral solid, making theVertex1 the first,
141 // theVertex2 the second and theVertex3 the third vertices.
142
143 // Initialization by parts of solid to be built
144
145 void InitByTwoFaces (const TopoDS_Shape& theFace1,
146 const TopoDS_Shape& theFace2);
147 // Init by two faces. TheFace1 will be the first,
148 // theFace2 will be the second.
149 // First edge and vertex is defined randomly from theFace1 entities.
150
151 // Access to vertices
152 TopoDS_Shape GetVertex (const Standard_Integer theVertexID); // [1-8]
153
154 Standard_Integer GetVertexID (const TopoDS_Shape& theVertex);
155
156 Standard_Integer GetVertexID (const Standard_Integer theFaceID, // [1-6]
157 const Standard_Integer theVertexNB); // [1-4]
158
159 Standard_Integer GetVertexOnEdgeID (const Standard_Integer theEdgeID, // [1-12]
160 const Standard_Integer theVertexNB); // [1-2]
161
162 // Access to edges
163 TopoDS_Shape GetEdge (const Standard_Integer theEdgeID, // [1-12]
164 const Standard_Boolean doMake = Standard_False);
165
166 Standard_Integer GetEdgeID (const TopoDS_Shape& theEdge);
167
168 Standard_Integer GetEdgeID (const Standard_Integer theFaceID, // [1-6]
169 const Standard_Integer theEdgeNB); // [1-4]
170
171 Standard_Integer FindEdgeID (const Standard_Integer theVertex1ID,
172 const Standard_Integer theVertex2ID);
173
174 Standard_Integer FindCommonEdgeID (const Standard_Integer theFace1ID,
175 const Standard_Integer theFace2ID);
176
177 // Access to faces
178 TopoDS_Shape GetFace (const Standard_Integer theFaceID, // [1-6]
179 const Standard_Boolean doMake = Standard_False);
180
181 Standard_Integer GetFaceID (const TopoDS_Shape& theFace);
182
183 Standard_Integer FindFaceID (const Standard_Integer theEdge1ID,
184 const Standard_Integer theEdge2ID);
185
186 Standard_Integer GetOppositeFaceID (const Standard_Integer theFaceID);
187
188 // Check Block
189 Standard_Boolean IsSimilarFaces (const Standard_Integer theFace1ID,
190 const Standard_Integer theFace2ID,
191 const gp_Trsf theTransformation);
192 // returns true, if theFace1, transformed
193 // by theTransformation, coincides with theFace2
194 public:
195 // ---------- STATIC PUBLIC METHODS ----------
196 static void MapShapesAndAncestors (const TopoDS_Shape& S,
197 const TopAbs_ShapeEnum TS,
198 const TopAbs_ShapeEnum TA,
199 TopTools_IndexedDataMapOfShapeListOfShape& M);
200
201 static Standard_Boolean IsSimilarEdges (const TopoDS_Shape& E1,
202 const TopoDS_Shape& E2);
203
204 static Standard_Integer FindEdge (TopoDS_Shape& theResult,
205 const TopoDS_Shape& V1,
206 const TopoDS_Shape& V2,
207 const TopTools_IndexedDataMapOfShapeListOfShape& MVE,
208 const Standard_Boolean findAll = Standard_False);
209 // returns number of found edges
210
211 static Standard_Integer FindFace (TopoDS_Shape& theResult,
212 const TopoDS_Shape& V1,
213 const TopoDS_Shape& V2,
214 const TopoDS_Shape& V3,
215 const TopoDS_Shape& V4,
216 const TopTools_IndexedDataMapOfShapeListOfShape& MVF,
217 const Standard_Boolean findAll = Standard_False);
218 // returns number of found faces
219
229 static TCollection_AsciiString MakeFace (const TopoDS_Wire& theWire,
230 const Standard_Boolean isPlanarWanted,
231 TopoDS_Shape& theResult);
232
239 static TCollection_AsciiString MakeAnyFace (const TopoDS_Wire& theWire,
240 TopoDS_Shape& theResult);
241
242 private:
243 // ---------- PRIVATE FIELDS ----------
244
245 TopTools_Array1OfShape myFaces;
246 TopTools_Array1OfShape myEdges;
247 TopTools_Array1OfShape myVertices;
248};
249
250#endif
Definition: GEOMImpl_Block6Explorer.hxx:111
void InitByBlock(const TopoDS_Shape &theBlock)
Definition: GEOMImpl_Block6Explorer.cxx:498
void InitByBlockAndEdges(const TopoDS_Shape &theBlock, const TopoDS_Shape &theEdge1, const TopoDS_Shape &theEdge2)
Definition: GEOMImpl_Block6Explorer.cxx:556
static Standard_Integer FindFace(TopoDS_Shape &theResult, const TopoDS_Shape &V1, const TopoDS_Shape &V2, const TopoDS_Shape &V3, const TopoDS_Shape &V4, const TopTools_IndexedDataMapOfShapeListOfShape &MVF, const Standard_Boolean findAll=Standard_False)
Definition: GEOMImpl_Block6Explorer.cxx:1179
Standard_Integer GetFaceID(const TopoDS_Shape &theFace)
Definition: GEOMImpl_Block6Explorer.cxx:383
TopoDS_Shape GetEdge(const Standard_Integer theEdgeID, const Standard_Boolean doMake=Standard_False)
Definition: GEOMImpl_Block6Explorer.cxx:278
void InitByTwoFaces(const TopoDS_Shape &theFace1, const TopoDS_Shape &theFace2)
Definition: GEOMImpl_Block6Explorer.cxx:878
TopTools_Array1OfShape myVertices
Definition: GEOMImpl_Block6Explorer.hxx:247
static Standard_Boolean IsSimilarEdges(const TopoDS_Shape &E1, const TopoDS_Shape &E2)
Definition: GEOMImpl_Block6Explorer.cxx:1127
Standard_Integer FindFaceID(const Standard_Integer theEdge1ID, const Standard_Integer theEdge2ID)
Definition: GEOMImpl_Block6Explorer.cxx:396
Standard_Integer GetVertexID(const TopoDS_Shape &theVertex)
Definition: GEOMImpl_Block6Explorer.cxx:244
Standard_Integer FindEdgeID(const Standard_Integer theVertex1ID, const Standard_Integer theVertex2ID)
Definition: GEOMImpl_Block6Explorer.cxx:324
static void MapShapesAndAncestors(const TopoDS_Shape &S, const TopAbs_ShapeEnum TS, const TopAbs_ShapeEnum TA, TopTools_IndexedDataMapOfShapeListOfShape &M)
Definition: GEOMImpl_Block6Explorer.cxx:1089
void InitByBlockAndFace(const TopoDS_Shape &theBlock, const TopoDS_Shape &theFace)
Definition: GEOMImpl_Block6Explorer.cxx:515
TopoDS_Shape GetVertex(const Standard_Integer theVertexID)
Definition: GEOMImpl_Block6Explorer.cxx:233
GEOMImpl_Block6Explorer()
Definition: GEOMImpl_Block6Explorer.cxx:224
static Standard_Integer FindEdge(TopoDS_Shape &theResult, const TopoDS_Shape &V1, const TopoDS_Shape &V2, const TopTools_IndexedDataMapOfShapeListOfShape &MVE, const Standard_Boolean findAll=Standard_False)
Definition: GEOMImpl_Block6Explorer.cxx:1148
Standard_Boolean IsSimilarFaces(const Standard_Integer theFace1ID, const Standard_Integer theFace2ID, const gp_Trsf theTransformation)
Definition: GEOMImpl_Block6Explorer.cxx:424
Standard_Integer FindCommonEdgeID(const Standard_Integer theFace1ID, const Standard_Integer theFace2ID)
Definition: GEOMImpl_Block6Explorer.cxx:335
TopoDS_Shape GetFace(const Standard_Integer theFaceID, const Standard_Boolean doMake=Standard_False)
Definition: GEOMImpl_Block6Explorer.cxx:345
Standard_Integer GetVertexOnEdgeID(const Standard_Integer theEdgeID, const Standard_Integer theVertexNB)
Definition: GEOMImpl_Block6Explorer.cxx:268
Standard_Integer GetEdgeID(const TopoDS_Shape &theEdge)
Definition: GEOMImpl_Block6Explorer.cxx:301
void InitByBlockAndVertices(const TopoDS_Shape &theBlock, const TopoDS_Shape &theVertex1, const TopoDS_Shape &theVertex2, const TopoDS_Shape &theVertex3)
Definition: GEOMImpl_Block6Explorer.cxx:663
TopTools_Array1OfShape myEdges
Definition: GEOMImpl_Block6Explorer.hxx:246
static TCollection_AsciiString MakeFace(const TopoDS_Wire &theWire, const Standard_Boolean isPlanarWanted, TopoDS_Shape &theResult)
Definition: GEOMImpl_Block6Explorer.cxx:1223
TopTools_Array1OfShape myFaces
Definition: GEOMImpl_Block6Explorer.hxx:245
Standard_Integer GetOppositeFaceID(const Standard_Integer theFaceID)
Definition: GEOMImpl_Block6Explorer.cxx:406
static TCollection_AsciiString MakeAnyFace(const TopoDS_Wire &theWire, TopoDS_Shape &theResult)
Definition: GEOMImpl_Block6Explorer.cxx:1299