0023024: Update headers of OCCT files
[occt.git] / src / BOP / BOP_HistoryCollector.cxx
CommitLineData
b311480e 1// Copyright (c) 1999-2012 OPEN CASCADE SAS
2//
3// The content of this file is subject to the Open CASCADE Technology Public
4// License Version 6.5 (the "License"). You may not use the content of this file
5// except in compliance with the License. Please obtain a copy of the License
6// at http://www.opencascade.org and read it completely before using this file.
7//
8// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
10//
11// The Original Code and all software distributed under the License is
12// distributed on an "AS IS" basis, without warranty of any kind, and the
13// Initial Developer hereby disclaims all such warranties, including without
14// limitation, any warranties of merchantability, fitness for a particular
15// purpose or non-infringement. Please see the License for the specific terms
16// and conditions governing the rights and limitations under the License.
17
7fd59977 18#include <BOP_HistoryCollector.ixx>
19
20#include <TopExp_Explorer.hxx>
21
22BOP_HistoryCollector::BOP_HistoryCollector()
23{
24 myOp = BOP_UNKNOWN;
25 myHasDeleted = Standard_False;
26}
27
28BOP_HistoryCollector::BOP_HistoryCollector(const TopoDS_Shape& theShape1,
29 const TopoDS_Shape& theShape2,
30 const BOP_Operation theOperation)
31{
32 myOp = theOperation;
33 myS1 = theShape1;
34 myS2 = theShape2;
35 myHasDeleted = Standard_False;
36}
37
38void BOP_HistoryCollector::SetResult(const TopoDS_Shape& theResult,
39 const BOPTools_PDSFiller& theDSFiller)
40{
41 myResult = theResult;
42}
43
44const TopTools_ListOfShape& BOP_HistoryCollector::Generated(const TopoDS_Shape& S)
45{
46 if(S.IsNull())
47 return myEmptyList;
48
49 if(myGenMap.IsBound(S)) {
50 return myGenMap.Find(S);
51 }
52 return myEmptyList;
53}
54
55const TopTools_ListOfShape& BOP_HistoryCollector::Modified(const TopoDS_Shape& S)
56{
57 if(S.IsNull())
58 return myEmptyList;
59
60 if(myModifMap.IsBound(S)) {
61 return myModifMap.Find(S);
62 }
63 return myEmptyList;
64}
65
66Standard_Boolean BOP_HistoryCollector::IsDeleted(const TopoDS_Shape& S)
67{
68 if(S.IsNull())
69 return Standard_True;
70
71 TopAbs_ShapeEnum aType = S.ShapeType();
72 TopExp_Explorer anExp(myResult, aType);
73
74 for(; anExp.More(); anExp.Next()) {
75 if(S.IsSame(anExp.Current()))
76 return Standard_False;
77 }
78
79 if(myModifMap.IsBound(S)) {
80 if(!myModifMap(S).IsEmpty())
81 return Standard_False;
82 }
83
84 if(myGenMap.IsBound(S)) {
85 if(!myGenMap(S).IsEmpty())
86 return Standard_False;
87 }
88 return Standard_True;
89}
90
91Standard_Boolean BOP_HistoryCollector::HasGenerated() const
92{
93 if(!myGenMap.IsEmpty()) {
94 return Standard_True;
95 }
96 return Standard_False;
97}
98
99Standard_Boolean BOP_HistoryCollector::HasModified() const
100{
101 if(!myModifMap.IsEmpty()) {
102 return Standard_True;
103 }
104 return Standard_False;
105}
106
107Standard_Boolean BOP_HistoryCollector::HasDeleted() const
108{
109 return myHasDeleted;
110}