1 // Created by: Peter KURNEV
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
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
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.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 #include <BOPTools.ixx>
16 #include <TopExp_Explorer.hxx>
17 #include <BOPCol_ListOfShape.hxx>
19 //=======================================================================
20 //function : MapShapes
22 //=======================================================================
23 void BOPTools::MapShapes(const TopoDS_Shape& S,
27 TopoDS_Iterator It(S);
29 MapShapes(It.Value(),M);
35 //=======================================================================
36 //function : MapShapes
38 //=======================================================================
39 void BOPTools::MapShapes(const TopoDS_Shape& S,
40 BOPCol_IndexedMapOfShape& M)
43 TopoDS_Iterator It(S);
45 MapShapes(It.Value(),M);
50 //=======================================================================
51 //function : MapShapes
53 //=======================================================================
54 void BOPTools::MapShapes(const TopoDS_Shape& S,
55 const TopAbs_ShapeEnum T,
56 BOPCol_IndexedMapOfShape& M)
58 TopExp_Explorer Ex(S,T);
67 //=======================================================================
68 //function : MapShapesAndAncestors
70 //=======================================================================
71 void BOPTools::MapShapesAndAncestors(const TopoDS_Shape& S,
72 const TopAbs_ShapeEnum TS,
73 const TopAbs_ShapeEnum TA,
74 BOPCol_IndexedDataMapOfShapeListOfShape& M)
76 BOPCol_ListOfShape empty;
79 TopExp_Explorer exa(S,TA);
82 const TopoDS_Shape& anc = exa.Current();
83 TopExp_Explorer exs(anc,TS);
85 Standard_Integer index = M.FindIndex(exs.Current());
86 if (index == 0) index = M.Add(exs.Current(),empty);
93 // visit shapes not under ancestors
94 TopExp_Explorer ex(S,TS,TA);
96 Standard_Integer index = M.FindIndex(ex.Current());
97 if (index == 0) index = M.Add(ex.Current(),empty);