1 // Created on: 1999-09-29
2 // Created by: Maxim ZVEREV
3 // Copyright (c) 1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _TopOpeBRepBuild_Builder1_HeaderFile
18 #define _TopOpeBRepBuild_Builder1_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <TopTools_IndexedMapOfShape.hxx>
25 #include <TopoDS_Shape.hxx>
26 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
27 #include <TopTools_DataMapOfOrientedShapeInteger.hxx>
28 #include <TopTools_IndexedMapOfOrientedShape.hxx>
29 #include <TopTools_IndexedDataMapOfShapeShape.hxx>
30 #include <TopTools_DataMapOfShapeListOfShape.hxx>
31 #include <TopOpeBRepBuild_Builder.hxx>
32 #include <TopAbs_State.hxx>
33 #include <TopTools_ListOfShape.hxx>
34 #include <TopOpeBRepDS_DataMapOfShapeState.hxx>
35 #include <Standard_Boolean.hxx>
36 #include <Standard_Integer.hxx>
37 #include <TopTools_SequenceOfShape.hxx>
38 class TopOpeBRepBuild_HBuilder;
39 class TopOpeBRepDS_BuildTool;
40 class TopOpeBRepDS_HDataStructure;
42 class TopOpeBRepBuild_GTopo;
43 class TopOpeBRepBuild_ShellFaceSet;
44 class TopOpeBRepBuild_WireEdgeSet;
45 class TopOpeBRepBuild_PaveSet;
50 //! extension of the class TopOpeBRepBuild_Builder dedicated
51 //! to avoid bugs in "Rebuilding Result" algorithm for the case of SOLID/SOLID Boolean Operations
52 class TopOpeBRepBuild_Builder1 : public TopOpeBRepBuild_Builder
59 Standard_EXPORT TopOpeBRepBuild_Builder1(const TopOpeBRepDS_BuildTool& BT);
61 Standard_EXPORT virtual ~TopOpeBRepBuild_Builder1();
63 //! Removes all splits and merges already performed.
64 //! Does NOT clear the handled DS (except ShapeWithStatesMaps).
65 Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
67 Standard_EXPORT virtual void Perform (const Handle(TopOpeBRepDS_HDataStructure)& HDS) Standard_OVERRIDE;
69 Standard_EXPORT virtual void Perform (const Handle(TopOpeBRepDS_HDataStructure)& HDS, const TopoDS_Shape& S1, const TopoDS_Shape& S2) Standard_OVERRIDE;
71 Standard_EXPORT virtual void MergeKPart() Standard_OVERRIDE;
73 Standard_EXPORT virtual void MergeKPart (const TopAbs_State TB1, const TopAbs_State TB2) Standard_OVERRIDE;
75 Standard_EXPORT virtual void GFillSolidSFS (const TopoDS_Shape& SO1, const TopTools_ListOfShape& LSO2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_ShellFaceSet& SFS) Standard_OVERRIDE;
77 Standard_EXPORT virtual void GFillShellSFS (const TopoDS_Shape& SH1, const TopTools_ListOfShape& LSO2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_ShellFaceSet& SFS) Standard_OVERRIDE;
79 Standard_EXPORT virtual void GWESMakeFaces (const TopoDS_Shape& FF, TopOpeBRepBuild_WireEdgeSet& WES, TopTools_ListOfShape& LOF) Standard_OVERRIDE;
81 Standard_EXPORT void GFillSplitsPVS (const TopoDS_Shape& anEdge, const TopOpeBRepBuild_GTopo& G1, TopOpeBRepBuild_PaveSet& PVS);
83 Standard_EXPORT void GFillFaceNotSameDomSFS (const TopoDS_Shape& F1, const TopTools_ListOfShape& LSO2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_ShellFaceSet& SFS);
85 Standard_EXPORT void GFillFaceNotSameDomWES (const TopoDS_Shape& F1, const TopTools_ListOfShape& LSO2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_WireEdgeSet& WES);
87 Standard_EXPORT void GFillWireNotSameDomWES (const TopoDS_Shape& W1, const TopTools_ListOfShape& LSO2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_WireEdgeSet& WES);
89 Standard_EXPORT void GFillEdgeNotSameDomWES (const TopoDS_Shape& E1, const TopTools_ListOfShape& LSO2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_WireEdgeSet& WES);
91 Standard_EXPORT void GFillFaceSameDomSFS (const TopoDS_Shape& F1, const TopTools_ListOfShape& LSO2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_ShellFaceSet& SFS);
93 Standard_EXPORT void GFillFaceSameDomWES (const TopoDS_Shape& F1, const TopTools_ListOfShape& LSO2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_WireEdgeSet& WES);
95 Standard_EXPORT void GFillWireSameDomWES (const TopoDS_Shape& W1, const TopTools_ListOfShape& LSO2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_WireEdgeSet& WES);
97 Standard_EXPORT void GFillEdgeSameDomWES (const TopoDS_Shape& E1, const TopTools_ListOfShape& LSO2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_WireEdgeSet& WES);
99 Standard_EXPORT void PerformONParts (const TopoDS_Shape& F, const TopTools_IndexedMapOfShape& SDfaces, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_WireEdgeSet& WES);
101 Standard_EXPORT void PerformPieceIn2D (const TopoDS_Edge& aPieceToPerform, const TopoDS_Edge& aOriginalEdge, const TopoDS_Face& edgeFace, const TopoDS_Face& toFace, const TopOpeBRepBuild_GTopo& G, Standard_Boolean& keep);
103 Standard_EXPORT Standard_Integer PerformPieceOn2D (const TopoDS_Shape& aPieceObj, const TopoDS_Shape& aFaceObj, const TopoDS_Shape& aEdgeObj, TopTools_ListOfShape& aListOfPieces, TopTools_ListOfShape& aListOfFaces, TopTools_ListOfShape& aListOfPiecesOut2d);
105 Standard_EXPORT Standard_Integer TwoPiecesON (const TopTools_SequenceOfShape& aSeq, TopTools_ListOfShape& aListOfPieces, TopTools_ListOfShape& aListOfFaces, TopTools_ListOfShape& aListOfPiecesOut2d);
107 Standard_EXPORT Standard_Integer CorrectResult2d (TopoDS_Shape& aResult);
110 friend class TopOpeBRepBuild_HBuilder;
116 Standard_EXPORT void PerformShapeWithStates();
118 Standard_EXPORT void PerformShapeWithStates (const TopoDS_Shape& anObj, const TopoDS_Shape& aTool);
120 Standard_EXPORT void StatusEdgesToSplit (const TopoDS_Shape& anObj, const TopTools_IndexedMapOfShape& anEdgesToSplitMap, const TopTools_IndexedMapOfShape& anEdgesToRestMap);
122 Standard_EXPORT void SplitEdge (const TopoDS_Shape& anEdge, TopTools_ListOfShape& aLNew, TopOpeBRepDS_DataMapOfShapeState& aDataMapOfShapeState);
124 Standard_EXPORT void PerformFacesWithStates (const TopoDS_Shape& anObj, const TopTools_IndexedMapOfShape& aFaces, TopOpeBRepDS_DataMapOfShapeState& aSplF);
126 Standard_EXPORT Standard_Integer IsSame2d (const TopTools_SequenceOfShape& aSeq, TopTools_ListOfShape& aListOfPiecesOut2d);
128 Standard_EXPORT void OrientateEdgeOnFace (TopoDS_Edge& EdgeToPerform, const TopoDS_Face& baseFace, const TopoDS_Face& edgeFace, const TopOpeBRepBuild_GTopo& G1, Standard_Boolean& stateOfFaceOri) const;
131 TopTools_DataMapOfShapeListOfShape myFSplits;
132 TopTools_DataMapOfShapeListOfShape myESplits;
137 TopTools_IndexedMapOfShape mySameDomMap;
138 TopoDS_Shape mySDFaceToFill;
139 TopoDS_Shape myBaseFaceToFill;
140 TopTools_IndexedDataMapOfShapeListOfShape myMapOfEdgeFaces;
141 NCollection_DataMap<TopoDS_Shape, Standard_Boolean, TopTools_OrientedShapeMapHasher> myMapOfEdgeWithFaceState;
142 TopTools_IndexedMapOfShape myProcessedPartsOut2d;
143 TopTools_IndexedMapOfShape myProcessedPartsON2d;
144 TopTools_IndexedMapOfShape mySplitsONtoKeep;
145 TopTools_IndexedMapOfOrientedShape mySourceShapes;
146 TopTools_IndexedDataMapOfShapeShape myMapOfCorrect2dEdges;
150 #endif // _TopOpeBRepBuild_Builder1_HeaderFile