0021762: Integration of new Boolean Operation algorithm to OCCT.
[occt.git] / src / BOPAlgo / BOPAlgo_WireSplitter.lxx
1 // Created by: Peter KURNEV
2 // Copyright (c) 1999-2012 OPEN CASCADE SAS
3 //
4 // The content of this file is subject to the Open CASCADE Technology Public
5 // License Version 6.5 (the "License"). You may not use the content of this file
6 // except in compliance with the License. Please obtain a copy of the License
7 // at http://www.opencascade.org and read it completely before using this file.
8 //
9 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
10 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
11 //
12 // The Original Code and all software distributed under the License is
13 // distributed on an "AS IS" basis, without warranty of any kind, and the
14 // Initial Developer hereby disclaims all such warranties, including without
15 // limitation, any warranties of merchantability, fitness for a particular
16 // purpose or non-infringement. Please see the License for the specific terms
17 // and conditions governing the rights and limitations under the License.
18
19
20 #include <BRep_Builder.hxx>
21
22 #include <TopoDS_Edge.hxx>
23
24 //=======================================================================
25 //function : BOPAlgo_EdgeInfo
26 //purpose  : 
27 //=======================================================================
28 class BOPAlgo_EdgeInfo {
29  public:
30   //
31   BOPAlgo_EdgeInfo() : 
32     myPassed(Standard_False),
33     myInFlag(Standard_False),
34     myAngle (-1.) {
35   };
36   //
37   void SetEdge(const TopoDS_Edge& theE) {
38     myEdge=theE;
39   };
40   //
41   const TopoDS_Edge& Edge() const{
42     return myEdge;
43   };
44   //
45   void SetPassed(const Standard_Boolean theFlag) {
46     myPassed=theFlag;
47   };
48   //
49   Standard_Boolean Passed()const {
50     return myPassed;
51   };
52   //
53   void SetInFlag(const Standard_Boolean theFlag) {
54     myInFlag=theFlag;
55   };
56   //
57   Standard_Boolean IsIn()const {
58     return myInFlag;
59   };
60   //
61   void SetAngle(const Standard_Real theAngle) {
62     myAngle=theAngle;
63   };
64   //
65   Standard_Real Angle()const {
66     return myAngle;
67   };
68   //
69  protected:
70   TopoDS_Edge myEdge;
71   Standard_Boolean myPassed;
72   Standard_Boolean myInFlag;
73   Standard_Real myAngle;
74 };
75
76
77 #include <NCollection_List.hxx> 
78 typedef NCollection_List<BOPAlgo_EdgeInfo> BOPAlgo_ListOfEdgeInfo; 
79 typedef BOPAlgo_ListOfEdgeInfo::Iterator BOPAlgo_ListIteratorOfListOfEdgeInfo;  
80
81 #define _NCollection_MapHasher
82 #include <NCollection_IndexedDataMap.hxx>
83 #include <TopTools_ShapeMapHasher.hxx>
84
85 typedef NCollection_IndexedDataMap<TopoDS_Shape, \
86   BOPAlgo_ListOfEdgeInfo, \
87   TopTools_ShapeMapHasher> BOPAlgo_IndexedDataMapOfShapeListOfEdgeInfo; 
88 #undef _NCollection_MapHasher
89
90
91 //=======================================================================
92 //function : MakeWire
93 //purpose  : 
94 //=======================================================================
95   inline void BOPAlgo_WireSplitter::MakeWire(BOPCol_ListOfShape& aLE, 
96                                              TopoDS_Wire& aWire)
97 {
98   BRep_Builder aBB;
99   aBB.MakeWire(aWire);
100   //
101   BOPCol_ListIteratorOfListOfShape aIt(aLE);
102   for (; aIt.More(); aIt.Next()){
103     aBB.Add(aWire, aIt.Value());
104   }
105 }