0022627: Change OCCT memory management defaults
[occt.git] / src / BOP / BOP_HistoryCollector.cxx
CommitLineData
7fd59977 1#include <BOP_HistoryCollector.ixx>
2
3#include <TopExp_Explorer.hxx>
4
5BOP_HistoryCollector::BOP_HistoryCollector()
6{
7 myOp = BOP_UNKNOWN;
8 myHasDeleted = Standard_False;
9}
10
11BOP_HistoryCollector::BOP_HistoryCollector(const TopoDS_Shape& theShape1,
12 const TopoDS_Shape& theShape2,
13 const BOP_Operation theOperation)
14{
15 myOp = theOperation;
16 myS1 = theShape1;
17 myS2 = theShape2;
18 myHasDeleted = Standard_False;
19}
20
21void BOP_HistoryCollector::SetResult(const TopoDS_Shape& theResult,
22 const BOPTools_PDSFiller& theDSFiller)
23{
24 myResult = theResult;
25}
26
27const TopTools_ListOfShape& BOP_HistoryCollector::Generated(const TopoDS_Shape& S)
28{
29 if(S.IsNull())
30 return myEmptyList;
31
32 if(myGenMap.IsBound(S)) {
33 return myGenMap.Find(S);
34 }
35 return myEmptyList;
36}
37
38const TopTools_ListOfShape& BOP_HistoryCollector::Modified(const TopoDS_Shape& S)
39{
40 if(S.IsNull())
41 return myEmptyList;
42
43 if(myModifMap.IsBound(S)) {
44 return myModifMap.Find(S);
45 }
46 return myEmptyList;
47}
48
49Standard_Boolean BOP_HistoryCollector::IsDeleted(const TopoDS_Shape& S)
50{
51 if(S.IsNull())
52 return Standard_True;
53
54 TopAbs_ShapeEnum aType = S.ShapeType();
55 TopExp_Explorer anExp(myResult, aType);
56
57 for(; anExp.More(); anExp.Next()) {
58 if(S.IsSame(anExp.Current()))
59 return Standard_False;
60 }
61
62 if(myModifMap.IsBound(S)) {
63 if(!myModifMap(S).IsEmpty())
64 return Standard_False;
65 }
66
67 if(myGenMap.IsBound(S)) {
68 if(!myGenMap(S).IsEmpty())
69 return Standard_False;
70 }
71 return Standard_True;
72}
73
74Standard_Boolean BOP_HistoryCollector::HasGenerated() const
75{
76 if(!myGenMap.IsEmpty()) {
77 return Standard_True;
78 }
79 return Standard_False;
80}
81
82Standard_Boolean BOP_HistoryCollector::HasModified() const
83{
84 if(!myModifMap.IsEmpty()) {
85 return Standard_True;
86 }
87 return Standard_False;
88}
89
90Standard_Boolean BOP_HistoryCollector::HasDeleted() const
91{
92 return myHasDeleted;
93}