4e57c75e |
1 | // Created by: Peter KURNEV |
973c2be1 |
2 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
4e57c75e |
3 | // |
973c2be1 |
4 | // This file is part of Open CASCADE Technology software library. |
4e57c75e |
5 | // |
d5f74e42 |
6 | // This library is free software; you can redistribute it and/or modify it under |
7 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
8 | // by the Free Software Foundation, with special exception defined in the file |
9 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
10 | // distribution for complete text of the license and disclaimer of any warranty. |
4e57c75e |
11 | // |
973c2be1 |
12 | // Alternatively, this file may be used under the terms of Open CASCADE |
13 | // commercial license or contractual agreement. |
4e57c75e |
14 | |
15 | #include <BRep_Builder.hxx> |
c5d8782c |
16 | #include <BRep_Tool.hxx> |
4e57c75e |
17 | |
18 | #include <TopoDS_Edge.hxx> |
19 | |
20 | //======================================================================= |
21 | //function : BOPAlgo_EdgeInfo |
22 | //purpose : |
23 | //======================================================================= |
24 | class BOPAlgo_EdgeInfo { |
25 | public: |
26 | // |
27 | BOPAlgo_EdgeInfo() : |
28 | myPassed(Standard_False), |
29 | myInFlag(Standard_False), |
30 | myAngle (-1.) { |
31 | }; |
32 | // |
33 | void SetEdge(const TopoDS_Edge& theE) { |
34 | myEdge=theE; |
35 | }; |
36 | // |
37 | const TopoDS_Edge& Edge() const{ |
38 | return myEdge; |
39 | }; |
40 | // |
41 | void SetPassed(const Standard_Boolean theFlag) { |
42 | myPassed=theFlag; |
43 | }; |
44 | // |
45 | Standard_Boolean Passed()const { |
46 | return myPassed; |
47 | }; |
48 | // |
49 | void SetInFlag(const Standard_Boolean theFlag) { |
50 | myInFlag=theFlag; |
51 | }; |
52 | // |
53 | Standard_Boolean IsIn()const { |
54 | return myInFlag; |
55 | }; |
56 | // |
57 | void SetAngle(const Standard_Real theAngle) { |
58 | myAngle=theAngle; |
59 | }; |
60 | // |
61 | Standard_Real Angle()const { |
62 | return myAngle; |
63 | }; |
64 | // |
65 | protected: |
66 | TopoDS_Edge myEdge; |
67 | Standard_Boolean myPassed; |
68 | Standard_Boolean myInFlag; |
69 | Standard_Real myAngle; |
70 | }; |
71 | |
72 | |
73 | #include <NCollection_List.hxx> |
74 | typedef NCollection_List<BOPAlgo_EdgeInfo> BOPAlgo_ListOfEdgeInfo; |
75 | typedef BOPAlgo_ListOfEdgeInfo::Iterator BOPAlgo_ListIteratorOfListOfEdgeInfo; |
76 | |
4e57c75e |
77 | #include <NCollection_IndexedDataMap.hxx> |
78 | #include <TopTools_ShapeMapHasher.hxx> |
79 | |
80 | typedef NCollection_IndexedDataMap<TopoDS_Shape, \ |
81 | BOPAlgo_ListOfEdgeInfo, \ |
82 | TopTools_ShapeMapHasher> BOPAlgo_IndexedDataMapOfShapeListOfEdgeInfo; |
4e57c75e |
83 | |
84 | //======================================================================= |
85 | //function : MakeWire |
86 | //purpose : |
87 | //======================================================================= |
88 | inline void BOPAlgo_WireSplitter::MakeWire(BOPCol_ListOfShape& aLE, |
c5d8782c |
89 | TopoDS_Wire& aWire) |
4e57c75e |
90 | { |
91 | BRep_Builder aBB; |
92 | aBB.MakeWire(aWire); |
93 | // |
94 | BOPCol_ListIteratorOfListOfShape aIt(aLE); |
95 | for (; aIt.More(); aIt.Next()){ |
96 | aBB.Add(aWire, aIt.Value()); |
97 | } |
c5d8782c |
98 | aWire.Closed(BRep_Tool::IsClosed(aWire)); |
4e57c75e |
99 | } |