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