summaryrefslogtreecommitdiff
path: root/src/BOP/BOP_HistoryCollector.cxx
blob: e7edc40862ec46afe01ceb2f7a57c1e84918989c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#include <BOP_HistoryCollector.ixx>

#include <TopExp_Explorer.hxx>

BOP_HistoryCollector::BOP_HistoryCollector()
{
  myOp = BOP_UNKNOWN;
  myHasDeleted = Standard_False;
}

BOP_HistoryCollector::BOP_HistoryCollector(const TopoDS_Shape& theShape1,
					   const TopoDS_Shape& theShape2,
					   const BOP_Operation theOperation)
{
  myOp = theOperation;
  myS1 = theShape1;
  myS2 = theShape2;
  myHasDeleted = Standard_False;
}

void BOP_HistoryCollector::SetResult(const TopoDS_Shape&       theResult,
				     const BOPTools_PDSFiller& theDSFiller) 
{
  myResult = theResult;
}

const TopTools_ListOfShape& BOP_HistoryCollector::Generated(const TopoDS_Shape& S) 
{
  if(S.IsNull())
    return myEmptyList;

  if(myGenMap.IsBound(S)) {
    return myGenMap.Find(S);
  }
  return myEmptyList;
}

const TopTools_ListOfShape& BOP_HistoryCollector::Modified(const TopoDS_Shape& S) 
{
  if(S.IsNull())
    return myEmptyList;

  if(myModifMap.IsBound(S)) {
    return myModifMap.Find(S);
  }
  return myEmptyList;
}

Standard_Boolean BOP_HistoryCollector::IsDeleted(const TopoDS_Shape& S) 
{
  if(S.IsNull())
    return Standard_True;

  TopAbs_ShapeEnum aType = S.ShapeType();
  TopExp_Explorer anExp(myResult, aType);

  for(; anExp.More(); anExp.Next()) {
    if(S.IsSame(anExp.Current()))
      return Standard_False;
  }

  if(myModifMap.IsBound(S)) {
    if(!myModifMap(S).IsEmpty())
      return Standard_False;
  }

  if(myGenMap.IsBound(S)) {
    if(!myGenMap(S).IsEmpty())
      return Standard_False;
  }
  return Standard_True;
}

Standard_Boolean BOP_HistoryCollector::HasGenerated() const
{
  if(!myGenMap.IsEmpty()) {
    return Standard_True;
  }
  return Standard_False;
}

Standard_Boolean BOP_HistoryCollector::HasModified() const
{
  if(!myModifMap.IsEmpty()) {
    return Standard_True;
  }
  return Standard_False;
}

Standard_Boolean BOP_HistoryCollector::HasDeleted() const
{
  return myHasDeleted;
}