0024624: Lost word in license statement in source files
[occt.git] / src / BOPTools / BOPTools.cxx
CommitLineData
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 <BOPTools.ixx>
16#include <TopExp_Explorer.hxx>
17#include <BOPCol_ListOfShape.hxx>
18
19//=======================================================================
20//function : MapShapes
21//purpose :
22//=======================================================================
23 void BOPTools::MapShapes(const TopoDS_Shape& S,
24 BOPCol_MapOfShape& M)
25{
26 M.Add(S);
27 TopoDS_Iterator It(S);
28 while (It.More()) {
29 MapShapes(It.Value(),M);
30 It.Next();
31 }
32}
33
34
35//=======================================================================
36//function : MapShapes
37//purpose :
38//=======================================================================
39 void BOPTools::MapShapes(const TopoDS_Shape& S,
40 BOPCol_IndexedMapOfShape& M)
41{
42 M.Add(S);
43 TopoDS_Iterator It(S);
44 while (It.More()) {
45 MapShapes(It.Value(),M);
46 It.Next();
47 }
48}
49
50//=======================================================================
51//function : MapShapes
52//purpose :
53//=======================================================================
54 void BOPTools::MapShapes(const TopoDS_Shape& S,
55 const TopAbs_ShapeEnum T,
56 BOPCol_IndexedMapOfShape& M)
57{
58 TopExp_Explorer Ex(S,T);
59 while (Ex.More()) {
60 M.Add(Ex.Current());
61 Ex.Next();
62 }
63}
64
65
66
67//=======================================================================
68//function : MapShapesAndAncestors
69//purpose :
70//=======================================================================
71 void BOPTools::MapShapesAndAncestors(const TopoDS_Shape& S,
72 const TopAbs_ShapeEnum TS,
73 const TopAbs_ShapeEnum TA,
74 BOPCol_IndexedDataMapOfShapeListOfShape& M)
75{
76 BOPCol_ListOfShape empty;
77
78 // visit ancestors
79 TopExp_Explorer exa(S,TA);
80 while (exa.More()) {
81 // visit shapes
82 const TopoDS_Shape& anc = exa.Current();
83 TopExp_Explorer exs(anc,TS);
84 while (exs.More()) {
85 Standard_Integer index = M.FindIndex(exs.Current());
86 if (index == 0) index = M.Add(exs.Current(),empty);
87 M(index).Append(anc);
88 exs.Next();
89 }
90 exa.Next();
91 }
92
93 // visit shapes not under ancestors
94 TopExp_Explorer ex(S,TS,TA);
95 while (ex.More()) {
96 Standard_Integer index = M.FindIndex(ex.Current());
97 if (index == 0) index = M.Add(ex.Current(),empty);
98 ex.Next();
99 }
100}