1 // Created by: Peter KURNEV
2 // Copyright (c) 1999-2012 OPEN CASCADE SAS
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.
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.
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.
20 #include <BOPTools.ixx>
21 #include <TopExp_Explorer.hxx>
22 #include <BOPCol_ListOfShape.hxx>
24 //=======================================================================
25 //function : MapShapes
27 //=======================================================================
28 void BOPTools::MapShapes(const TopoDS_Shape& S,
32 TopoDS_Iterator It(S);
34 MapShapes(It.Value(),M);
40 //=======================================================================
41 //function : MapShapes
43 //=======================================================================
44 void BOPTools::MapShapes(const TopoDS_Shape& S,
45 BOPCol_IndexedMapOfShape& M)
48 TopoDS_Iterator It(S);
50 MapShapes(It.Value(),M);
55 //=======================================================================
56 //function : MapShapes
58 //=======================================================================
59 void BOPTools::MapShapes(const TopoDS_Shape& S,
60 const TopAbs_ShapeEnum T,
61 BOPCol_IndexedMapOfShape& M)
63 TopExp_Explorer Ex(S,T);
72 //=======================================================================
73 //function : MapShapesAndAncestors
75 //=======================================================================
76 void BOPTools::MapShapesAndAncestors(const TopoDS_Shape& S,
77 const TopAbs_ShapeEnum TS,
78 const TopAbs_ShapeEnum TA,
79 BOPCol_IndexedDataMapOfShapeListOfShape& M)
81 BOPCol_ListOfShape empty;
84 TopExp_Explorer exa(S,TA);
87 const TopoDS_Shape& anc = exa.Current();
88 TopExp_Explorer exs(anc,TS);
90 Standard_Integer index = M.FindIndex(exs.Current());
91 if (index == 0) index = M.Add(exs.Current(),empty);
98 // visit shapes not under ancestors
99 TopExp_Explorer ex(S,TS,TA);
101 Standard_Integer index = M.FindIndex(ex.Current());
102 if (index == 0) index = M.Add(ex.Current(),empty);