b311480e |
1 | // Created on: 1997-02-18 |
2 | // Created by: Yves FRICAUD |
3 | // Copyright (c) 1997-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
7fd59977 |
17 | |
42cf5bc1 |
18 | #include <Standard_GUID.hxx> |
19 | #include <Standard_Type.hxx> |
20 | #include <TDF_Attribute.hxx> |
21 | #include <TDF_AttributeDelta.hxx> |
22 | #include <TDF_DataSet.hxx> |
7fd59977 |
23 | #include <TDF_DeltaOnAddition.hxx> |
42cf5bc1 |
24 | #include <TDF_DeltaOnRemoval.hxx> |
25 | #include <TDF_RelocationTable.hxx> |
26 | #include <TNaming_Builder.hxx> |
7fd59977 |
27 | #include <TNaming_DataMapIteratorOfDataMapOfShapePtrRefShape.hxx> |
997cf5f2 |
28 | #include <TNaming_PtrNode.hxx> |
42cf5bc1 |
29 | #include <TNaming_RefShape.hxx> |
30 | #include <TNaming_UsedShapes.hxx> |
7fd59977 |
31 | #include <TopoDS_Shape.hxx> |
7fd59977 |
32 | |
33 | //======================================================================= |
34 | //function : GetID |
35 | //purpose : |
36 | //======================================================================= |
7fd59977 |
37 | const Standard_GUID& TNaming_UsedShapes::GetID() |
38 | { |
39 | static Standard_GUID TNaming_UsedShapesID("c4ef4201-568f-11d1-8940-080009dc3333"); |
40 | return TNaming_UsedShapesID; |
41 | } |
42 | |
43 | //======================================================================= |
44 | //function : |
45 | //purpose : |
46 | //======================================================================= |
47 | |
48 | TNaming_UsedShapes::TNaming_UsedShapes() |
49 | { |
50 | } |
51 | |
52 | |
53 | //======================================================================= |
54 | //function : Destroy |
55 | //purpose : |
56 | //======================================================================= |
57 | |
58 | void TNaming_UsedShapes::Destroy() |
59 | { |
7fd59977 |
60 | myMap.Clear(); |
61 | } |
62 | |
63 | //======================================================================= |
64 | //function : BackupCopy |
65 | //purpose : No Backup |
66 | //======================================================================= |
67 | |
68 | Handle(TDF_Attribute) TNaming_UsedShapes::BackupCopy() const |
69 | { |
70 | Handle(TNaming_UsedShapes) Att; |
71 | return Att; |
72 | } |
73 | |
74 | //======================================================================= |
75 | //function : BeforeRemoval |
76 | //purpose : |
77 | //======================================================================= |
78 | |
79 | void TNaming_UsedShapes::BeforeRemoval() |
80 | { |
7fd59977 |
81 | Destroy(); |
7fd59977 |
82 | } |
83 | |
84 | |
85 | //======================================================================= |
86 | //function : AfterUndo |
87 | //purpose : After application of a TDF_Delta. |
88 | //======================================================================= |
89 | |
90 | Standard_Boolean TNaming_UsedShapes::AfterUndo |
91 | (const Handle(TDF_AttributeDelta)& anAttDelta, |
35e08fe8 |
92 | const Standard_Boolean /*forceIt*/) |
7fd59977 |
93 | { |
94 | if (anAttDelta->IsKind(STANDARD_TYPE(TDF_DeltaOnAddition))) { |
95 | anAttDelta->Attribute()->BeforeRemoval(); |
96 | } |
97 | return Standard_True; |
98 | } |
99 | |
100 | //======================================================================= |
101 | //function : DeltaOnAddition |
102 | //purpose : no delta |
103 | //======================================================================= |
104 | |
105 | Handle(TDF_DeltaOnAddition) TNaming_UsedShapes::DeltaOnAddition() const |
106 | { |
107 | Handle(TDF_DeltaOnAddition) aDelta; |
108 | return aDelta; |
109 | } |
110 | //======================================================================= |
111 | //function : DeltaOnRemoval |
112 | //purpose : no delta |
113 | //======================================================================= |
114 | |
115 | Handle(TDF_DeltaOnRemoval) TNaming_UsedShapes::DeltaOnRemoval() const |
116 | { |
117 | Handle(TDF_DeltaOnRemoval) aDelta; |
118 | return aDelta; |
119 | } |
120 | |
121 | //======================================================================= |
122 | //function : Restore |
123 | //purpose : |
124 | //======================================================================= |
125 | |
35e08fe8 |
126 | void TNaming_UsedShapes::Restore(const Handle(TDF_Attribute)& /*anAttribute*/) |
7fd59977 |
127 | { |
128 | } |
129 | |
130 | //======================================================================= |
131 | //function : NewEmpty |
132 | //purpose : |
133 | //======================================================================= |
134 | |
135 | Handle(TDF_Attribute) TNaming_UsedShapes::NewEmpty () const |
136 | { |
137 | return new TNaming_UsedShapes(); |
138 | } |
139 | |
140 | //======================================================================= |
141 | //function : Paste |
142 | //purpose : |
143 | //======================================================================= |
144 | |
35e08fe8 |
145 | void TNaming_UsedShapes::Paste(const Handle(TDF_Attribute)&, |
146 | const Handle(TDF_RelocationTable)&) const |
7fd59977 |
147 | { |
148 | } |
149 | |
150 | //======================================================================= |
151 | //function : Dump |
152 | //purpose : |
153 | //======================================================================= |
154 | |
155 | Standard_OStream& TNaming_UsedShapes::Dump(Standard_OStream& anOS) const |
156 | { |
7fd59977 |
157 | anOS<<"The content of UsedShapes attribute:"<<endl; |
158 | TNaming_DataMapIteratorOfDataMapOfShapePtrRefShape itr(myMap); |
159 | for (; itr.More(); itr.Next()) { |
160 | anOS<<" "; |
161 | TopAbs::Print(itr.Key().ShapeType(),anOS); |
162 | anOS<<" "; |
163 | itr.Value()->Label().EntryDump(anOS); |
164 | anOS << " Key_TShape = " <<itr.Key().TShape()->This(); |
165 | anOS << " Value_TShape = " <<itr.Value()->Shape().TShape()->This(); |
166 | anOS<<endl; |
167 | } |
7fd59977 |
168 | return anOS; |
169 | } |
170 | |
171 | //======================================================================= |
172 | //function : References |
173 | //purpose : |
174 | //======================================================================= |
175 | |
35e08fe8 |
176 | void TNaming_UsedShapes::References(const Handle(TDF_DataSet)& ) const |
7fd59977 |
177 | { |
178 | } |