1 // Created on: 1993-06-14
2 // Created by: Jean Yves LEBEY
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16 
17 #ifndef _TopOpeBRepBuild_Builder_HeaderFile
18 #define _TopOpeBRepBuild_Builder_HeaderFile
19 
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23 
24 #include <TopAbs_State.hxx>
25 #include <TopoDS_Shape.hxx>
26 #include <TopOpeBRepDS_BuildTool.hxx>
27 #include <TopTools_HArray1OfShape.hxx>
28 #include <TopTools_DataMapOfIntegerListOfShape.hxx>
29 #include <TopTools_HArray1OfListOfShape.hxx>
30 #include <TopOpeBRepDS_DataMapOfShapeListOfShapeOn1State.hxx>
31 #include <TopTools_ListOfShape.hxx>
32 #include <TopTools_DataMapOfShapeListOfShape.hxx>
33 #include <Standard_Boolean.hxx>
34 #include <TopoDS_Solid.hxx>
35 #include <TopoDS_Face.hxx>
36 #include <TopoDS_Edge.hxx>
37 #include <TopTools_IndexedMapOfShape.hxx>
38 #include <Standard_Integer.hxx>
39 #include <TopOpeBRepTool_ShapeClassifier.hxx>
40 #include <TopTools_MapOfShape.hxx>
41 #include <TCollection_AsciiString.hxx>
42 #include <TopTools_IndexedDataMapOfShapeShape.hxx>
43 #include <TopTools_IndexedMapOfOrientedShape.hxx>
44 #include <TopTools_DataMapOfShapeShape.hxx>
45 #include <TopAbs_ShapeEnum.hxx>
46 #include <TopAbs_Orientation.hxx>
47 #include <TopTools_DataMapOfIntegerShape.hxx>
48 #include <TopOpeBRepDS_Config.hxx>
49 #include <Standard_Real.hxx>
50 #include <TopTools_DataMapOfShapeInteger.hxx>
51 #include <Standard_Address.hxx>
52 class TopOpeBRepDS_HDataStructure;
53 class Standard_NoSuchObject;
54 class TopOpeBRepBuild_HBuilder;
55 class TopOpeBRepTool_ShapeExplorer;
56 class TopOpeBRepBuild_ShapeSet;
57 class TopOpeBRepBuild_EdgeBuilder;
58 class TopOpeBRepBuild_FaceBuilder;
59 class TopOpeBRepBuild_SolidBuilder;
60 class TopOpeBRepBuild_WireEdgeSet;
61 class TopOpeBRepDS_PointIterator;
62 class TopOpeBRepBuild_PaveSet;
63 class TopOpeBRepBuild_GTopo;
64 class TopOpeBRepBuild_ShellFaceSet;
65 class TopOpeBRepDS_SurfaceIterator;
66 class TopOpeBRepDS_CurveIterator;
67 class TopoDS_Vertex;
68 class gp_Pnt;
69 
70 // resolve name collisions with X11 headers
71 #ifdef FillSolid
72   #undef FillSolid
73 #endif
74 
75 //! The Builder  algorithm    constructs   topological
76 //! objects  from   an    existing  topology  and  new
77 //! geometries attached to the topology. It is used to
78 //! construct the result of a topological operation;
79 //! the existing  topologies are the parts involved in
80 //! the  topological  operation and the new geometries
81 //! are the intersection lines and points.
82 class TopOpeBRepBuild_Builder
83 {
84 public:
85 
86   DEFINE_STANDARD_ALLOC
87 
88 
89   Standard_EXPORT TopOpeBRepBuild_Builder(const TopOpeBRepDS_BuildTool& BT);
90 
91   Standard_EXPORT virtual ~TopOpeBRepBuild_Builder();
92 
93   Standard_EXPORT TopOpeBRepDS_BuildTool& ChangeBuildTool();
94 
95   Standard_EXPORT const TopOpeBRepDS_BuildTool& BuildTool() const;
96 
97   //! Stores the data structure <HDS>,
98   //! Create shapes from the new geometries.
99   Standard_EXPORT virtual void Perform (const Handle(TopOpeBRepDS_HDataStructure)& HDS);
100 
101   //! Stores the data structure <HDS>,
102   //! Create shapes from the new geometries,
103   //! Evaluates if an operation performed on shapes S1,S2
104   //! is a particular case.
105   Standard_EXPORT virtual void Perform (const Handle(TopOpeBRepDS_HDataStructure)& HDS, const TopoDS_Shape& S1, const TopoDS_Shape& S2);
106 
107   //! returns the DS handled by this builder
108   Standard_EXPORT Handle(TopOpeBRepDS_HDataStructure) DataStructure() const;
109 
110   //! Removes all splits and merges already performed.
111   //! Does NOT clear the handled DS.
112   Standard_EXPORT virtual void Clear();
113 
114   //! Merges  the two edges <S1> and <S2> keeping the
115   //! parts in each edge of states <TB1> and <TB2>.
116   //! Booleans onA, onB, onAB indicate wheter parts of edges
117   //! found as state ON respectively on first, second, and both
118   //! shapes must be (or not) built.
119   Standard_EXPORT void MergeEdges (const TopTools_ListOfShape& L1, const TopAbs_State TB1, const TopTools_ListOfShape& L2, const TopAbs_State TB2, const Standard_Boolean onA = Standard_False, const Standard_Boolean onB = Standard_False, const Standard_Boolean onAB = Standard_False);
120 
121   //! Merges  the two faces <S1>   and <S2> keeping the
122   //! parts in each face of states <TB1> and <TB2>.
123   Standard_EXPORT void MergeFaces (const TopTools_ListOfShape& S1, const TopAbs_State TB1, const TopTools_ListOfShape& S2, const TopAbs_State TB2, const Standard_Boolean onA = Standard_False, const Standard_Boolean onB = Standard_False, const Standard_Boolean onAB = Standard_False);
124 
125   //! Merges  the two solids <S1>   and <S2> keeping the
126   //! parts in each solid of states <TB1> and <TB2>.
127   Standard_EXPORT void MergeSolids (const TopoDS_Shape& S1, const TopAbs_State TB1, const TopoDS_Shape& S2, const TopAbs_State TB2);
128 
129   //! Merges the two shapes <S1> and <S2> keeping the
130   //! parts of states <TB1>,<TB2> in <S1>,<S2>.
131   Standard_EXPORT void MergeShapes (const TopoDS_Shape& S1, const TopAbs_State TB1, const TopoDS_Shape& S2, const TopAbs_State TB2);
132 
133   Standard_EXPORT void End();
134 
135   Standard_EXPORT Standard_Boolean Classify() const;
136 
137   Standard_EXPORT void ChangeClassify (const Standard_Boolean B);
138 
139   //! Merges the solid <S>  keeping the
140   //! parts of state <TB>.
141   Standard_EXPORT void MergeSolid (const TopoDS_Shape& S, const TopAbs_State TB);
142 
143   //! Returns the vertex created on point <I>.
144   Standard_EXPORT const TopoDS_Shape& NewVertex (const Standard_Integer I) const;
145 
146   //! Returns the edges created on curve <I>.
147   Standard_EXPORT const TopTools_ListOfShape& NewEdges (const Standard_Integer I) const;
148 
149   //! Returns the faces created on surface <I>.
150   Standard_EXPORT const TopTools_ListOfShape& NewFaces (const Standard_Integer I) const;
151 
152   //! Returns True if the shape <S> has been split.
153   Standard_EXPORT Standard_Boolean IsSplit (const TopoDS_Shape& S, const TopAbs_State TB) const;
154 
155   //! Returns the split parts <TB> of shape <S>.
156   Standard_EXPORT const TopTools_ListOfShape& Splits (const TopoDS_Shape& S, const TopAbs_State TB) const;
157 
158   //! Returns True if the shape <S> has been merged.
159   Standard_EXPORT Standard_Boolean IsMerged (const TopoDS_Shape& S, const TopAbs_State TB) const;
160 
161   //! Returns the merged parts <TB> of shape <S>.
162   Standard_EXPORT const TopTools_ListOfShape& Merged (const TopoDS_Shape& S, const TopAbs_State TB) const;
163 
164   Standard_EXPORT void InitSection();
165 
166   //! create parts ON solid of section edges
167   Standard_EXPORT void SplitSectionEdges();
168 
169   //! create parts ON solid of section edges
170   Standard_EXPORT virtual void SplitSectionEdge (const TopoDS_Shape& E);
171 
172   //! return the section edges built on new curves.
173   Standard_EXPORT void SectionCurves (TopTools_ListOfShape& L);
174 
175   //! return the parts of edges found ON the boundary
176   //! of the two arguments S1,S2 of Perform()
177   Standard_EXPORT void SectionEdges (TopTools_ListOfShape& L);
178 
179   //! Fills anAncMap with pairs (edge,ancestor edge) for each
180   //! split from the map aMapON for the shape object identified
181   //! by ShapeRank
182   Standard_EXPORT void FillSecEdgeAncestorMap (const Standard_Integer aShapeRank, const TopTools_MapOfShape& aMapON, TopTools_DataMapOfShapeShape& anAncMap) const;
183 
184   //! return all section edges.
185   Standard_EXPORT void Section (TopTools_ListOfShape& L);
186 
187   Standard_EXPORT const TopTools_ListOfShape& Section();
188 
189   //! update the DS by creating new geometries.
190   //! create vertices on DS points.
191   Standard_EXPORT void BuildVertices (const Handle(TopOpeBRepDS_HDataStructure)& DS);
192 
193   //! update the DS by creating new geometries.
194   //! create shapes from the new geometries.
195   Standard_EXPORT void BuildEdges (const Handle(TopOpeBRepDS_HDataStructure)& DS);
196 
197   Standard_EXPORT const TopOpeBRepDS_DataMapOfShapeListOfShapeOn1State& MSplit (const TopAbs_State s) const;
198 
199   Standard_EXPORT TopOpeBRepDS_DataMapOfShapeListOfShapeOn1State& ChangeMSplit (const TopAbs_State s);
200 
201   Standard_EXPORT void MakeEdges (const TopoDS_Shape& E, TopOpeBRepBuild_EdgeBuilder& B, TopTools_ListOfShape& L);
202 
203   Standard_EXPORT void MakeFaces (const TopoDS_Shape& F, TopOpeBRepBuild_FaceBuilder& B, TopTools_ListOfShape& L);
204 
205   Standard_EXPORT void MakeSolids (TopOpeBRepBuild_SolidBuilder& B, TopTools_ListOfShape& L);
206 
207   Standard_EXPORT void MakeShells (TopOpeBRepBuild_SolidBuilder& B, TopTools_ListOfShape& L);
208 
209   //! Returns a ref.on the list of shapes connected to <S> as
210   //! <TB> split parts of <S>.
211   //! Mark <S> as split in <TB> parts.
212   Standard_EXPORT TopTools_ListOfShape& ChangeSplit (const TopoDS_Shape& S, const TopAbs_State TB);
213 
214   Standard_EXPORT Standard_Boolean Opec12() const;
215 
216   Standard_EXPORT Standard_Boolean Opec21() const;
217 
218   Standard_EXPORT Standard_Boolean Opecom() const;
219 
220   Standard_EXPORT Standard_Boolean Opefus() const;
221 
222   Standard_EXPORT TopAbs_State ShapePosition (const TopoDS_Shape& S, const TopTools_ListOfShape& LS);
223 
224   Standard_EXPORT Standard_Boolean KeepShape (const TopoDS_Shape& S, const TopTools_ListOfShape& LS, const TopAbs_State T);
225 
226   Standard_EXPORT static TopAbs_ShapeEnum TopType (const TopoDS_Shape& S);
227 
228   Standard_EXPORT static Standard_Boolean Reverse (const TopAbs_State T1, const TopAbs_State T2);
229 
230   Standard_EXPORT static TopAbs_Orientation Orient (const TopAbs_Orientation O, const Standard_Boolean R);
231 
232   Standard_EXPORT void FindSameDomain (TopTools_ListOfShape& L1, TopTools_ListOfShape& L2) const;
233 
234   Standard_EXPORT void FindSameDomainSameOrientation (TopTools_ListOfShape& LSO, TopTools_ListOfShape& LDO) const;
235 
236   Standard_EXPORT void MapShapes (const TopoDS_Shape& S1, const TopoDS_Shape& S2);
237 
238   Standard_EXPORT void ClearMaps();
239 
240   Standard_EXPORT void FindSameRank (const TopTools_ListOfShape& L1, const Standard_Integer R, TopTools_ListOfShape& L2) const;
241 
242   Standard_EXPORT Standard_Integer ShapeRank (const TopoDS_Shape& S) const;
243 
244   Standard_EXPORT Standard_Boolean IsShapeOf (const TopoDS_Shape& S, const Standard_Integer I12) const;
245 
246   Standard_EXPORT static Standard_Boolean Contains (const TopoDS_Shape& S, const TopTools_ListOfShape& L);
247 
248   Standard_EXPORT Standard_Integer FindIsKPart();
249 
250   Standard_EXPORT Standard_Integer IsKPart() const;
251 
252   Standard_EXPORT virtual void MergeKPart();
253 
254   Standard_EXPORT virtual void MergeKPart (const TopAbs_State TB1, const TopAbs_State TB2);
255 
256   Standard_EXPORT void MergeKPartiskole();
257 
258   Standard_EXPORT void MergeKPartiskoletge();
259 
260   Standard_EXPORT void MergeKPartisdisj();
261 
262   Standard_EXPORT void MergeKPartisfafa();
263 
264   Standard_EXPORT void MergeKPartissoso();
265 
266   Standard_EXPORT Standard_Integer KPiskole();
267 
268   Standard_EXPORT Standard_Integer KPiskoletge();
269 
270   Standard_EXPORT Standard_Integer KPisdisj();
271 
272   Standard_EXPORT Standard_Integer KPisfafa();
273 
274   Standard_EXPORT Standard_Integer KPissoso();
275 
276   Standard_EXPORT void KPClearMaps();
277 
278   Standard_EXPORT Standard_Integer KPlhg (const TopoDS_Shape& S, const TopAbs_ShapeEnum T, TopTools_ListOfShape& L) const;
279 
280   Standard_EXPORT Standard_Integer KPlhg (const TopoDS_Shape& S, const TopAbs_ShapeEnum T) const;
281 
282   Standard_EXPORT Standard_Integer KPlhsd (const TopoDS_Shape& S, const TopAbs_ShapeEnum T, TopTools_ListOfShape& L) const;
283 
284   Standard_EXPORT Standard_Integer KPlhsd (const TopoDS_Shape& S, const TopAbs_ShapeEnum T) const;
285 
286   Standard_EXPORT TopAbs_State KPclasSS (const TopoDS_Shape& S1, const TopTools_ListOfShape& exceptLS1, const TopoDS_Shape& S2);
287 
288   Standard_EXPORT TopAbs_State KPclasSS (const TopoDS_Shape& S1, const TopoDS_Shape& exceptS1, const TopoDS_Shape& S2);
289 
290   Standard_EXPORT TopAbs_State KPclasSS (const TopoDS_Shape& S1, const TopoDS_Shape& S2);
291 
292   Standard_EXPORT Standard_Boolean KPiskolesh (const TopoDS_Shape& S, TopTools_ListOfShape& LS, TopTools_ListOfShape& LF) const;
293 
294   Standard_EXPORT Standard_Boolean KPiskoletgesh (const TopoDS_Shape& S, TopTools_ListOfShape& LS, TopTools_ListOfShape& LF) const;
295 
296   Standard_EXPORT void KPSameDomain (TopTools_ListOfShape& L1, TopTools_ListOfShape& L2) const;
297 
298   Standard_EXPORT Standard_Integer KPisdisjsh (const TopoDS_Shape& S) const;
299 
300   Standard_EXPORT Standard_Integer KPisfafash (const TopoDS_Shape& S) const;
301 
302   Standard_EXPORT Standard_Integer KPissososh (const TopoDS_Shape& S) const;
303 
304   Standard_EXPORT void KPiskoleanalyse (const TopAbs_State FT1, const TopAbs_State FT2, const TopAbs_State ST1, const TopAbs_State ST2, Standard_Integer& I, Standard_Integer& I1, Standard_Integer& I2) const;
305 
306   Standard_EXPORT void KPiskoletgeanalyse (const TopOpeBRepDS_Config Conf, const TopAbs_State ST1, const TopAbs_State ST2, Standard_Integer& I) const;
307 
308   Standard_EXPORT void KPisdisjanalyse (const TopAbs_State ST1, const TopAbs_State ST2, Standard_Integer& I, Standard_Integer& IC1, Standard_Integer& IC2) const;
309 
310   Standard_EXPORT static Standard_Integer KPls (const TopoDS_Shape& S, const TopAbs_ShapeEnum T, TopTools_ListOfShape& L);
311 
312   Standard_EXPORT static Standard_Integer KPls (const TopoDS_Shape& S, const TopAbs_ShapeEnum T);
313 
314   Standard_EXPORT TopAbs_State KPclassF (const TopoDS_Shape& F1, const TopoDS_Shape& F2);
315 
316   Standard_EXPORT void KPclassFF (const TopoDS_Shape& F1, const TopoDS_Shape& F2, TopAbs_State& T1, TopAbs_State& T2);
317 
318   Standard_EXPORT Standard_Boolean KPiskoleFF (const TopoDS_Shape& F1, const TopoDS_Shape& F2, TopAbs_State& T1, TopAbs_State& T2);
319 
320   Standard_EXPORT static Standard_Boolean KPContains (const TopoDS_Shape& S, const TopTools_ListOfShape& L);
321 
322   Standard_EXPORT TopoDS_Shape KPmakeface (const TopoDS_Shape& F1, const TopTools_ListOfShape& LF2, const TopAbs_State T1, const TopAbs_State T2, const Standard_Boolean R1, const Standard_Boolean R2);
323 
324   Standard_EXPORT static Standard_Integer KPreturn (const Standard_Integer KP);
325 
326   Standard_EXPORT void SplitEvisoONperiodicF();
327 
328   Standard_EXPORT void GMergeSolids (const TopTools_ListOfShape& LSO1, const TopTools_ListOfShape& LSO2, const TopOpeBRepBuild_GTopo& G);
329 
330   Standard_EXPORT void GFillSolidsSFS (const TopTools_ListOfShape& LSO1, const TopTools_ListOfShape& LSO2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_ShellFaceSet& SFS);
331 
332   Standard_EXPORT virtual void GFillSolidSFS (const TopoDS_Shape& SO1, const TopTools_ListOfShape& LSO2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_ShellFaceSet& SFS);
333 
334   Standard_EXPORT void GFillSurfaceTopologySFS (const TopoDS_Shape& SO1, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_ShellFaceSet& SFS);
335 
336   Standard_EXPORT void GFillSurfaceTopologySFS (const TopOpeBRepDS_SurfaceIterator& IT, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_ShellFaceSet& SFS) const;
337 
338   Standard_EXPORT virtual void GFillShellSFS (const TopoDS_Shape& SH1, const TopTools_ListOfShape& LSO2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_ShellFaceSet& SFS);
339 
340   Standard_EXPORT void GFillFaceSFS (const TopoDS_Shape& F1, const TopTools_ListOfShape& LSO2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_ShellFaceSet& SFS);
341 
342   Standard_EXPORT void GSplitFaceSFS (const TopoDS_Shape& F1, const TopTools_ListOfShape& LSclass, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_ShellFaceSet& SFS);
343 
344   Standard_EXPORT void GMergeFaceSFS (const TopoDS_Shape& F, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_ShellFaceSet& SFS);
345 
346   Standard_EXPORT void GSplitFace (const TopoDS_Shape& F, const TopOpeBRepBuild_GTopo& G, const TopTools_ListOfShape& LSclass);
347 
348   Standard_EXPORT void AddONPatchesSFS (const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_ShellFaceSet& SFS);
349 
350   Standard_EXPORT void FillOnPatches (const TopTools_ListOfShape& anEdgesON, const TopoDS_Shape& aBaseFace, const TopTools_IndexedMapOfOrientedShape& avoidMap);
351 
352   Standard_EXPORT void FindFacesTouchingEdge (const TopoDS_Shape& aFace, const TopoDS_Shape& anEdge, const Standard_Integer aShRank, TopTools_ListOfShape& aFaces) const;
353 
354   Standard_EXPORT void GMergeFaces (const TopTools_ListOfShape& LF1, const TopTools_ListOfShape& LF2, const TopOpeBRepBuild_GTopo& G);
355 
356   Standard_EXPORT void GFillFacesWES (const TopTools_ListOfShape& LF1, const TopTools_ListOfShape& LF2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_WireEdgeSet& WES);
357 
358   Standard_EXPORT void GFillFacesWESK (const TopTools_ListOfShape& LF1, const TopTools_ListOfShape& LF2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_WireEdgeSet& WES, const Standard_Integer K);
359 
360   Standard_EXPORT void GFillFacesWESMakeFaces (const TopTools_ListOfShape& LF1, const TopTools_ListOfShape& LF2, const TopTools_ListOfShape& LSO, const TopOpeBRepBuild_GTopo& G);
361 
362   Standard_EXPORT void GFillFaceWES (const TopoDS_Shape& F, const TopTools_ListOfShape& LF2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_WireEdgeSet& WES);
363 
364   Standard_EXPORT void GFillCurveTopologyWES (const TopoDS_Shape& F, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_WireEdgeSet& WES);
365 
366   Standard_EXPORT void GFillCurveTopologyWES (const TopOpeBRepDS_CurveIterator& IT, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_WireEdgeSet& WES) const;
367 
368   Standard_EXPORT void GFillONPartsWES (const TopoDS_Shape& F, const TopOpeBRepBuild_GTopo& G, const TopTools_ListOfShape& LSclass, TopOpeBRepBuild_WireEdgeSet& WES);
369 
370   Standard_EXPORT void GFillWireWES (const TopoDS_Shape& W, const TopTools_ListOfShape& LF2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_WireEdgeSet& WES);
371 
372   Standard_EXPORT void GFillEdgeWES (const TopoDS_Shape& E, const TopTools_ListOfShape& LF2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_WireEdgeSet& WES);
373 
374   Standard_EXPORT void GSplitEdgeWES (const TopoDS_Shape& E, const TopTools_ListOfShape& LF2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_WireEdgeSet& WES);
375 
376   Standard_EXPORT void GMergeEdgeWES (const TopoDS_Shape& E, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_WireEdgeSet& WES);
377 
378   Standard_EXPORT void GSplitEdge (const TopoDS_Shape& E, const TopOpeBRepBuild_GTopo& G, const TopTools_ListOfShape& LSclass);
379 
380   Standard_EXPORT void GMergeEdges (const TopTools_ListOfShape& LE1, const TopTools_ListOfShape& LE2, const TopOpeBRepBuild_GTopo& G);
381 
382   Standard_EXPORT void GFillEdgesPVS (const TopTools_ListOfShape& LE1, const TopTools_ListOfShape& LE2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_PaveSet& PVS);
383 
384   Standard_EXPORT void GFillEdgePVS (const TopoDS_Shape& E, const TopTools_ListOfShape& LE2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_PaveSet& PVS);
385 
386   Standard_EXPORT void GFillPointTopologyPVS (const TopoDS_Shape& E, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_PaveSet& PVS);
387 
388   Standard_EXPORT void GFillPointTopologyPVS (const TopoDS_Shape& E, const TopOpeBRepDS_PointIterator& IT, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_PaveSet& PVS) const;
389 
390   Standard_EXPORT Standard_Boolean GParamOnReference (const TopoDS_Vertex& V, const TopoDS_Edge& E, Standard_Real& P) const;
391 
392   Standard_EXPORT Standard_Boolean GKeepShape (const TopoDS_Shape& S, const TopTools_ListOfShape& Lref, const TopAbs_State T);
393 
394   //! return True if S is classified <T> / Lref shapes
395   Standard_EXPORT Standard_Boolean GKeepShape1 (const TopoDS_Shape& S, const TopTools_ListOfShape& Lref, const TopAbs_State T, TopAbs_State& pos);
396 
397   //! add to Lou the shapes of Lin classified <T> / Lref shapes.
398   //! Lou is not cleared. (S is a dummy trace argument)
399   Standard_EXPORT void GKeepShapes (const TopoDS_Shape& S, const TopTools_ListOfShape& Lref, const TopAbs_State T, const TopTools_ListOfShape& Lin, TopTools_ListOfShape& Lou);
400 
401   Standard_EXPORT void GSFSMakeSolids (const TopoDS_Shape& SOF, TopOpeBRepBuild_ShellFaceSet& SFS, TopTools_ListOfShape& LOSO);
402 
403   Standard_EXPORT void GSOBUMakeSolids (const TopoDS_Shape& SOF, TopOpeBRepBuild_SolidBuilder& SOBU, TopTools_ListOfShape& LOSO);
404 
405   Standard_EXPORT virtual void GWESMakeFaces (const TopoDS_Shape& FF, TopOpeBRepBuild_WireEdgeSet& WES, TopTools_ListOfShape& LOF);
406 
407   Standard_EXPORT void GFABUMakeFaces (const TopoDS_Shape& FF, TopOpeBRepBuild_FaceBuilder& FABU, TopTools_ListOfShape& LOF, TopTools_DataMapOfShapeInteger& MWisOld);
408 
409   Standard_EXPORT void RegularizeFaces (const TopoDS_Shape& FF, const TopTools_ListOfShape& lnewFace, TopTools_ListOfShape& LOF);
410 
411   Standard_EXPORT void RegularizeFace (const TopoDS_Shape& FF, const TopoDS_Shape& newFace, TopTools_ListOfShape& LOF);
412 
413   Standard_EXPORT void RegularizeSolids (const TopoDS_Shape& SS, const TopTools_ListOfShape& lnewSolid, TopTools_ListOfShape& LOS);
414 
415   Standard_EXPORT void RegularizeSolid (const TopoDS_Shape& SS, const TopoDS_Shape& newSolid, TopTools_ListOfShape& LOS);
416 
417   Standard_EXPORT void GPVSMakeEdges (const TopoDS_Shape& EF, TopOpeBRepBuild_PaveSet& PVS, TopTools_ListOfShape& LOE) const;
418 
419   Standard_EXPORT void GEDBUMakeEdges (const TopoDS_Shape& EF, TopOpeBRepBuild_EdgeBuilder& EDBU, TopTools_ListOfShape& LOE) const;
420 
421   Standard_EXPORT Standard_Boolean GToSplit (const TopoDS_Shape& S, const TopAbs_State TB) const;
422 
423   Standard_EXPORT Standard_Boolean GToMerge (const TopoDS_Shape& S) const;
424 
425   Standard_EXPORT static Standard_Boolean GTakeCommonOfSame (const TopOpeBRepBuild_GTopo& G);
426 
427   Standard_EXPORT static Standard_Boolean GTakeCommonOfDiff (const TopOpeBRepBuild_GTopo& G);
428 
429   Standard_EXPORT void GFindSamDom (const TopoDS_Shape& S, TopTools_ListOfShape& L1, TopTools_ListOfShape& L2) const;
430 
431   Standard_EXPORT void GFindSamDom (TopTools_ListOfShape& L1, TopTools_ListOfShape& L2) const;
432 
433   Standard_EXPORT void GFindSamDomSODO (const TopoDS_Shape& S, TopTools_ListOfShape& LSO, TopTools_ListOfShape& LDO) const;
434 
435   Standard_EXPORT void GFindSamDomSODO (TopTools_ListOfShape& LSO, TopTools_ListOfShape& LDO) const;
436 
437   Standard_EXPORT void GMapShapes (const TopoDS_Shape& S1, const TopoDS_Shape& S2);
438 
439   Standard_EXPORT void GClearMaps();
440 
441   Standard_EXPORT void GFindSameRank (const TopTools_ListOfShape& L1, const Standard_Integer R, TopTools_ListOfShape& L2) const;
442 
443   Standard_EXPORT Standard_Integer GShapeRank (const TopoDS_Shape& S) const;
444 
445   Standard_EXPORT Standard_Boolean GIsShapeOf (const TopoDS_Shape& S, const Standard_Integer I12) const;
446 
447   Standard_EXPORT static Standard_Boolean GContains (const TopoDS_Shape& S, const TopTools_ListOfShape& L);
448 
449   Standard_EXPORT static void GCopyList (const TopTools_ListOfShape& Lin, const Standard_Integer i1, const Standard_Integer i2, TopTools_ListOfShape& Lou);
450 
451   Standard_EXPORT static void GCopyList (const TopTools_ListOfShape& Lin, TopTools_ListOfShape& Lou);
452 
453   Standard_EXPORT void GdumpLS (const TopTools_ListOfShape& L) const;
454 
455   Standard_EXPORT static void GdumpPNT (const gp_Pnt& P);
456 
457   Standard_EXPORT static void GdumpORIPARPNT (const TopAbs_Orientation o, const Standard_Real p, const gp_Pnt& Pnt);
458 
459   Standard_EXPORT void GdumpSHA (const TopoDS_Shape& S, const Standard_Address str = NULL) const;
460 
461   Standard_EXPORT void GdumpSHAORI (const TopoDS_Shape& S, const Standard_Address str = NULL) const;
462 
463   Standard_EXPORT void GdumpSHAORIGEO (const TopoDS_Shape& S, const Standard_Address str = NULL) const;
464 
465   Standard_EXPORT void GdumpSHASTA (const Standard_Integer iS, const TopAbs_State T, const TCollection_AsciiString& a = "", const TCollection_AsciiString& b = "") const;
466 
467   Standard_EXPORT void GdumpSHASTA (const TopoDS_Shape& S, const TopAbs_State T, const TCollection_AsciiString& a = "", const TCollection_AsciiString& b = "") const;
468 
469   Standard_EXPORT void GdumpSHASTA (const Standard_Integer iS, const TopAbs_State T, const TopOpeBRepBuild_ShapeSet& SS, const TCollection_AsciiString& a = "", const TCollection_AsciiString& b = "", const TCollection_AsciiString& c = "\n") const;
470 
471   Standard_EXPORT void GdumpEDG (const TopoDS_Shape& S, const Standard_Address str = NULL) const;
472 
473   Standard_EXPORT void GdumpEDGVER (const TopoDS_Shape& E, const TopoDS_Shape& V, const Standard_Address str = NULL) const;
474 
475   Standard_EXPORT void GdumpSAMDOM (const TopTools_ListOfShape& L, const Standard_Address str = NULL) const;
476 
477   Standard_EXPORT void GdumpEXP (const TopOpeBRepTool_ShapeExplorer& E) const;
478 
479   Standard_EXPORT void GdumpSOBU (TopOpeBRepBuild_SolidBuilder& SB) const;
480 
481   Standard_EXPORT void GdumpFABU (TopOpeBRepBuild_FaceBuilder& FB) const;
482 
483   Standard_EXPORT void GdumpEDBU (TopOpeBRepBuild_EdgeBuilder& EB) const;
484 
485   Standard_EXPORT Standard_Boolean GtraceSPS (const Standard_Integer iS) const;
486 
487   Standard_EXPORT Standard_Boolean GtraceSPS (const Standard_Integer iS, const Standard_Integer jS) const;
488 
489   Standard_EXPORT Standard_Boolean GtraceSPS (const TopoDS_Shape& S) const;
490 
491   Standard_EXPORT Standard_Boolean GtraceSPS (const TopoDS_Shape& S, Standard_Integer& IS) const;
492 
493   Standard_EXPORT void GdumpSHASETreset();
494 
495   Standard_EXPORT Standard_Integer GdumpSHASETindex();
496 
497   Standard_EXPORT static void PrintGeo (const TopoDS_Shape& S);
498 
499   Standard_EXPORT static void PrintSur (const TopoDS_Face& F);
500 
501   Standard_EXPORT static void PrintCur (const TopoDS_Edge& E);
502 
503   Standard_EXPORT static void PrintPnt (const TopoDS_Vertex& V);
504 
505   Standard_EXPORT static void PrintOri (const TopoDS_Shape& S);
506 
507   Standard_EXPORT static TCollection_AsciiString StringState (const TopAbs_State S);
508 
509   Standard_EXPORT static Standard_Boolean GcheckNBOUNDS (const TopoDS_Shape& E);
510 
511 
512 friend class TopOpeBRepBuild_HBuilder;
513 
514 
515 protected:
516 
517 
518   //! update the DS by creating new geometries.
519   //! create edges on the new curve <Icurv>.
520   Standard_EXPORT void BuildEdges (const Standard_Integer iC, const Handle(TopOpeBRepDS_HDataStructure)& DS);
521 
522   //! update the DS by creating new geometries.
523   //! create faces on the new surface <ISurf>.
524   Standard_EXPORT void BuildFaces (const Standard_Integer iS, const Handle(TopOpeBRepDS_HDataStructure)& DS);
525 
526   //! update the DS by creating new geometries.
527   //! create shapes from the new geometries.
528   Standard_EXPORT void BuildFaces (const Handle(TopOpeBRepDS_HDataStructure)& DS);
529 
530   //! Split <E1> keeping the parts of state <TB1>.
531   Standard_EXPORT void SplitEdge (const TopoDS_Shape& E1, const TopAbs_State TB1, const TopAbs_State TB2);
532 
533   //! Split <E1> keeping the parts of state <TB1>.
534   Standard_EXPORT void SplitEdge1 (const TopoDS_Shape& E1, const TopAbs_State TB1, const TopAbs_State TB2);
535 
536   //! Split <E1> keeping the parts of state <TB1>.
537   Standard_EXPORT void SplitEdge2 (const TopoDS_Shape& E1, const TopAbs_State TB1, const TopAbs_State TB2);
538 
539   //! Split <F1> keeping the  parts of state  <TB1>.
540   //! Merge faces with same domain, keeping parts  of
541   //! state <TB2>.
542   Standard_EXPORT void SplitFace (const TopoDS_Shape& F1, const TopAbs_State TB1, const TopAbs_State TB2);
543 
544   Standard_EXPORT void SplitFace1 (const TopoDS_Shape& F1, const TopAbs_State TB1, const TopAbs_State TB2);
545 
546   Standard_EXPORT void SplitFace2 (const TopoDS_Shape& F1, const TopAbs_State TB1, const TopAbs_State TB2);
547 
548   //! Split <S1> keeping the parts of state <TB1>.
549   Standard_EXPORT void SplitSolid (const TopoDS_Shape& S1, const TopAbs_State TB1, const TopAbs_State TB2);
550 
551   //! Explore shapes of given  by explorer <Ex> to split them.
552   //! Store  new shapes in the set <SS>.
553   //! According to RevOri, reverse or not their orientation.
554   Standard_EXPORT void SplitShapes (TopOpeBRepTool_ShapeExplorer& Ex, const TopAbs_State TB1, const TopAbs_State TB2, TopOpeBRepBuild_ShapeSet& SS, const Standard_Boolean RevOri);
555 
556   //! Split edges of <F1> and store  wires and edges in
557   //! the set <WES>. According to RevOri, reverse (or not) orientation.
558   Standard_EXPORT void FillFace (const TopoDS_Shape& F1, const TopAbs_State TB1, const TopTools_ListOfShape& LF2, const TopAbs_State TB2, TopOpeBRepBuild_WireEdgeSet& WES, const Standard_Boolean RevOri);
559 
560   //! Split faces of <S1> and store shells  and faces in
561   //! the set <SS>. According to RevOri, reverse (or not) orientation.
562   Standard_EXPORT void FillSolid (const TopoDS_Shape& S1, const TopAbs_State TB1, const TopTools_ListOfShape& LS2, const TopAbs_State TB2, TopOpeBRepBuild_ShapeSet& SS, const Standard_Boolean RevOri);
563 
564   //! Split subshapes of <S1> and store subshapes in
565   //! the set <SS>. According to RevOri, reverse (or not) orientation.
566   Standard_EXPORT void FillShape (const TopoDS_Shape& S1, const TopAbs_State TB1, const TopTools_ListOfShape& LS2, const TopAbs_State TB2, TopOpeBRepBuild_ShapeSet& SS, const Standard_Boolean RevOri);
567 
568   //! fills the vertex set PVS with the point iterator IT.
569   //! IT accesses a list of interferences which geometry is a point or a vertex.
570   //! TB indicates the orientation to give to the geometries
571   //! found in interference list accessed by IT.
572   Standard_EXPORT void FillVertexSet (TopOpeBRepDS_PointIterator& IT, const TopAbs_State TB, TopOpeBRepBuild_PaveSet& PVS) const;
573 
574   //! fills vertex set PVS with the current value of IT.
575   //! I geometry is a point or a vertex.
576   //! TB  indicates the orientation to give to geometries found I
577   Standard_EXPORT void FillVertexSetOnValue (const TopOpeBRepDS_PointIterator& IT, const TopAbs_State TB, TopOpeBRepBuild_PaveSet& PVS) const;
578 
579   //! Returns True if the shape <S> has not already been split
580   Standard_EXPORT Standard_Boolean ToSplit (const TopoDS_Shape& S, const TopAbs_State TB) const;
581 
582   //! add the shape <S> to the map of split shapes.
583   //! mark <S> as split/not split on <state>, according to B value.
584   Standard_EXPORT void MarkSplit (const TopoDS_Shape& S, const TopAbs_State TB, const Standard_Boolean B = Standard_True);
585 
586   //! Returns a ref. on the list of shapes connected to <S> as
587   //! <TB> merged parts of <S>.
588   Standard_EXPORT TopTools_ListOfShape& ChangeMerged (const TopoDS_Shape& S, const TopAbs_State TB);
589 
590   //! Returns a ref. on the vertex created on point <I>.
591   Standard_EXPORT TopoDS_Shape& ChangeNewVertex (const Standard_Integer I);
592 
593   //! Returns a ref. on the list of edges created on curve <I>.
594   Standard_EXPORT TopTools_ListOfShape& ChangeNewEdges (const Standard_Integer I);
595 
596   //! Returns a ref. on the list of faces created on surface <I>.
597   Standard_EXPORT TopTools_ListOfShape& ChangeNewFaces (const Standard_Integer I);
598 
599   Standard_EXPORT void AddIntersectionEdges (TopoDS_Shape& F, const TopAbs_State TB, const Standard_Boolean RevOri, TopOpeBRepBuild_ShapeSet& ES) const;
600 
601   Standard_EXPORT void UpdateSplitAndMerged (const TopTools_DataMapOfIntegerListOfShape& mle, const TopTools_DataMapOfIntegerShape& mre, const TopTools_DataMapOfShapeShape& mlf, const TopAbs_State state);
602 
603 
604   TopAbs_State myState1;
605   TopAbs_State myState2;
606   TopoDS_Shape myShape1;
607   TopoDS_Shape myShape2;
608   Handle(TopOpeBRepDS_HDataStructure) myDataStructure;
609   TopOpeBRepDS_BuildTool myBuildTool;
610   Handle(TopTools_HArray1OfShape) myNewVertices;
611   TopTools_DataMapOfIntegerListOfShape myNewEdges;
612   Handle(TopTools_HArray1OfListOfShape) myNewFaces;
613   TopOpeBRepDS_DataMapOfShapeListOfShapeOn1State mySplitIN;
614   TopOpeBRepDS_DataMapOfShapeListOfShapeOn1State mySplitON;
615   TopOpeBRepDS_DataMapOfShapeListOfShapeOn1State mySplitOUT;
616   TopOpeBRepDS_DataMapOfShapeListOfShapeOn1State myMergedIN;
617   TopOpeBRepDS_DataMapOfShapeListOfShapeOn1State myMergedON;
618   TopOpeBRepDS_DataMapOfShapeListOfShapeOn1State myMergedOUT;
619   TopTools_ListOfShape myEmptyShapeList;
620   TopTools_ListOfShape myListOfSolid;
621   TopTools_ListOfShape myListOfFace;
622   TopTools_ListOfShape myListOfEdge;
623   TopTools_DataMapOfShapeListOfShape myFSplits;
624   TopTools_DataMapOfShapeListOfShape myESplits;
625   Standard_Boolean mySectionDone;
626   Standard_Boolean mySplitSectionEdgesDone;
627   TopTools_ListOfShape mySection;
628   TopoDS_Solid mySolidReference;
629   TopoDS_Solid mySolidToFill;
630   TopTools_ListOfShape myFaceAvoid;
631   TopoDS_Face myFaceReference;
632   TopoDS_Face myFaceToFill;
633   TopTools_ListOfShape myEdgeAvoid;
634   TopoDS_Edge myEdgeReference;
635   TopoDS_Edge myEdgeToFill;
636   TopTools_ListOfShape myVertexAvoid;
637   TopTools_IndexedMapOfShape myMAP1;
638   TopTools_IndexedMapOfShape myMAP2;
639   Standard_Integer myIsKPart;
640   TopTools_DataMapOfShapeListOfShape myKPMAPf1f2;
641   Standard_Integer mySHASETindex;
642   Standard_Boolean myClassifyDef;
643   Standard_Boolean myClassifyVal;
644   TopOpeBRepTool_ShapeClassifier myShapeClassifier;
645   TopTools_MapOfShape myMemoSplit;
646   TCollection_AsciiString myEmptyAS;
647   Standard_Boolean myProcessON;
648   TopTools_IndexedDataMapOfShapeShape myONFacesMap;
649   TopTools_IndexedMapOfOrientedShape myONElemMap;
650 
651 
652 private:
653 
654 
655 
656 
657 
658 };
659 
660 
661 
662 
663 
664 
665 
666 #endif // _TopOpeBRepBuild_Builder_HeaderFile
667