0030675: Visualization - remove redundant proxy classes in hierarchy of PrsMgr_Presen...
[occt.git] / src / TopOpeBRepBuild / TopOpeBRepBuild_Builder1.hxx
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
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_Builder1_HeaderFile
18 #define _TopOpeBRepBuild_Builder1_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
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;
41 class TopoDS_Shape;
42 class TopOpeBRepBuild_GTopo;
43 class TopOpeBRepBuild_ShellFaceSet;
44 class TopOpeBRepBuild_WireEdgeSet;
45 class TopOpeBRepBuild_PaveSet;
46 class TopoDS_Edge;
47 class TopoDS_Face;
48
49
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
53 {
54 public:
55
56   DEFINE_STANDARD_ALLOC
57
58   
59   Standard_EXPORT TopOpeBRepBuild_Builder1(const TopOpeBRepDS_BuildTool& BT);
60   
61   Standard_EXPORT virtual ~TopOpeBRepBuild_Builder1();
62   
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;
66   
67   Standard_EXPORT virtual void Perform (const Handle(TopOpeBRepDS_HDataStructure)& HDS) Standard_OVERRIDE;
68   
69   Standard_EXPORT virtual void Perform (const Handle(TopOpeBRepDS_HDataStructure)& HDS, const TopoDS_Shape& S1, const TopoDS_Shape& S2) Standard_OVERRIDE;
70   
71   Standard_EXPORT virtual void MergeKPart() Standard_OVERRIDE;
72   
73   Standard_EXPORT virtual void MergeKPart (const TopAbs_State TB1, const TopAbs_State TB2) Standard_OVERRIDE;
74   
75   Standard_EXPORT virtual void GFillSolidSFS (const TopoDS_Shape& SO1, const TopTools_ListOfShape& LSO2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_ShellFaceSet& SFS) Standard_OVERRIDE;
76   
77   Standard_EXPORT virtual void GFillShellSFS (const TopoDS_Shape& SH1, const TopTools_ListOfShape& LSO2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_ShellFaceSet& SFS) Standard_OVERRIDE;
78   
79   Standard_EXPORT virtual void GWESMakeFaces (const TopoDS_Shape& FF, TopOpeBRepBuild_WireEdgeSet& WES, TopTools_ListOfShape& LOF) Standard_OVERRIDE;
80   
81   Standard_EXPORT void GFillSplitsPVS (const TopoDS_Shape& anEdge, const TopOpeBRepBuild_GTopo& G1, TopOpeBRepBuild_PaveSet& PVS);
82   
83   Standard_EXPORT void GFillFaceNotSameDomSFS (const TopoDS_Shape& F1, const TopTools_ListOfShape& LSO2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_ShellFaceSet& SFS);
84   
85   Standard_EXPORT void GFillFaceNotSameDomWES (const TopoDS_Shape& F1, const TopTools_ListOfShape& LSO2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_WireEdgeSet& WES);
86   
87   Standard_EXPORT void GFillWireNotSameDomWES (const TopoDS_Shape& W1, const TopTools_ListOfShape& LSO2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_WireEdgeSet& WES);
88   
89   Standard_EXPORT void GFillEdgeNotSameDomWES (const TopoDS_Shape& E1, const TopTools_ListOfShape& LSO2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_WireEdgeSet& WES);
90   
91   Standard_EXPORT void GFillFaceSameDomSFS (const TopoDS_Shape& F1, const TopTools_ListOfShape& LSO2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_ShellFaceSet& SFS);
92   
93   Standard_EXPORT void GFillFaceSameDomWES (const TopoDS_Shape& F1, const TopTools_ListOfShape& LSO2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_WireEdgeSet& WES);
94   
95   Standard_EXPORT void GFillWireSameDomWES (const TopoDS_Shape& W1, const TopTools_ListOfShape& LSO2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_WireEdgeSet& WES);
96   
97   Standard_EXPORT void GFillEdgeSameDomWES (const TopoDS_Shape& E1, const TopTools_ListOfShape& LSO2, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_WireEdgeSet& WES);
98   
99   Standard_EXPORT void PerformONParts (const TopoDS_Shape& F, const TopTools_IndexedMapOfShape& SDfaces, const TopOpeBRepBuild_GTopo& G, TopOpeBRepBuild_WireEdgeSet& WES);
100   
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);
102   
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);
104   
105   Standard_EXPORT Standard_Integer TwoPiecesON (const TopTools_SequenceOfShape& aSeq, TopTools_ListOfShape& aListOfPieces, TopTools_ListOfShape& aListOfFaces, TopTools_ListOfShape& aListOfPiecesOut2d);
106   
107   Standard_EXPORT Standard_Integer CorrectResult2d (TopoDS_Shape& aResult);
108
109
110 friend class TopOpeBRepBuild_HBuilder;
111
112
113 protected:
114
115   
116   Standard_EXPORT void PerformShapeWithStates();
117   
118   Standard_EXPORT void PerformShapeWithStates (const TopoDS_Shape& anObj, const TopoDS_Shape& aTool);
119   
120   Standard_EXPORT void StatusEdgesToSplit (const TopoDS_Shape& anObj, const TopTools_IndexedMapOfShape& anEdgesToSplitMap, const TopTools_IndexedMapOfShape& anEdgesToRestMap);
121   
122   Standard_EXPORT void SplitEdge (const TopoDS_Shape& anEdge, TopTools_ListOfShape& aLNew, TopOpeBRepDS_DataMapOfShapeState& aDataMapOfShapeState);
123   
124   Standard_EXPORT void PerformFacesWithStates (const TopoDS_Shape& anObj, const TopTools_IndexedMapOfShape& aFaces, TopOpeBRepDS_DataMapOfShapeState& aSplF);
125   
126   Standard_EXPORT Standard_Integer IsSame2d (const TopTools_SequenceOfShape& aSeq, TopTools_ListOfShape& aListOfPiecesOut2d);
127   
128   Standard_EXPORT void OrientateEdgeOnFace (TopoDS_Edge& EdgeToPerform, const TopoDS_Face& baseFace, const TopoDS_Face& edgeFace, const TopOpeBRepBuild_GTopo& G1, Standard_Boolean& stateOfFaceOri) const;
129
130
131   TopTools_DataMapOfShapeListOfShape myFSplits;
132   TopTools_DataMapOfShapeListOfShape myESplits;
133
134
135 private:
136
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;
147
148 };
149
150 #endif // _TopOpeBRepBuild_Builder1_HeaderFile