1 // Created on: 1997-02-18
2 // Created by: Yves FRICAUD
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
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>
23 #include <TDF_DeltaOnAddition.hxx>
24 #include <TDF_DeltaOnRemoval.hxx>
25 #include <TDF_RelocationTable.hxx>
26 #include <TDF_Tool.hxx>
27 #include <TNaming_DataMapIteratorOfDataMapOfShapePtrRefShape.hxx>
28 #include <TNaming_RefShape.hxx>
29 #include <TNaming_UsedShapes.hxx>
30 #include <TopoDS_Shape.hxx>
32 IMPLEMENT_STANDARD_RTTIEXT(TNaming_UsedShapes,TDF_Attribute)
34 //=======================================================================
37 //=======================================================================
38 const Standard_GUID& TNaming_UsedShapes::GetID()
40 static Standard_GUID TNaming_UsedShapesID("c4ef4201-568f-11d1-8940-080009dc3333");
41 return TNaming_UsedShapesID;
44 //=======================================================================
47 //=======================================================================
49 TNaming_UsedShapes::TNaming_UsedShapes()
54 //=======================================================================
57 //=======================================================================
59 void TNaming_UsedShapes::Destroy()
64 //=======================================================================
65 //function : BackupCopy
67 //=======================================================================
69 Handle(TDF_Attribute) TNaming_UsedShapes::BackupCopy() const
71 Handle(TNaming_UsedShapes) Att;
75 //=======================================================================
76 //function : BeforeRemoval
78 //=======================================================================
80 void TNaming_UsedShapes::BeforeRemoval()
86 //=======================================================================
87 //function : AfterUndo
88 //purpose : After application of a TDF_Delta.
89 //=======================================================================
91 Standard_Boolean TNaming_UsedShapes::AfterUndo
92 (const Handle(TDF_AttributeDelta)& anAttDelta,
93 const Standard_Boolean /*forceIt*/)
95 if (anAttDelta->IsKind(STANDARD_TYPE(TDF_DeltaOnAddition))) {
96 anAttDelta->Attribute()->BeforeRemoval();
101 //=======================================================================
102 //function : DeltaOnAddition
104 //=======================================================================
106 Handle(TDF_DeltaOnAddition) TNaming_UsedShapes::DeltaOnAddition() const
108 Handle(TDF_DeltaOnAddition) aDelta;
111 //=======================================================================
112 //function : DeltaOnRemoval
114 //=======================================================================
116 Handle(TDF_DeltaOnRemoval) TNaming_UsedShapes::DeltaOnRemoval() const
118 Handle(TDF_DeltaOnRemoval) aDelta;
122 //=======================================================================
125 //=======================================================================
127 void TNaming_UsedShapes::Restore(const Handle(TDF_Attribute)& /*anAttribute*/)
131 //=======================================================================
132 //function : NewEmpty
134 //=======================================================================
136 Handle(TDF_Attribute) TNaming_UsedShapes::NewEmpty () const
138 return new TNaming_UsedShapes();
141 //=======================================================================
144 //=======================================================================
146 void TNaming_UsedShapes::Paste(const Handle(TDF_Attribute)&,
147 const Handle(TDF_RelocationTable)&) const
151 //=======================================================================
154 //=======================================================================
156 Standard_OStream& TNaming_UsedShapes::Dump(Standard_OStream& anOS) const
158 anOS<<"The content of UsedShapes attribute:"<<std::endl;
159 TNaming_DataMapIteratorOfDataMapOfShapePtrRefShape itr(myMap);
160 for (; itr.More(); itr.Next()) {
161 if (itr.Key().IsNull())
163 anOS << "Empty Shape at label =";
164 itr.Value()->Label().EntryDump(anOS);
169 TopAbs::Print(itr.Key().ShapeType(),anOS);
171 itr.Value()->Label().EntryDump(anOS);
172 anOS << " Key_TShape = " <<itr.Key().TShape()->This();
173 anOS << " Value_TShape = " <<itr.Value()->Shape().TShape()->This();
179 //=======================================================================
180 //function : References
182 //=======================================================================
184 void TNaming_UsedShapes::References(const Handle(TDF_DataSet)& ) const
188 //=======================================================================
189 //function : DumpJson
191 //=======================================================================
192 void TNaming_UsedShapes::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
194 OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
196 OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDF_Attribute)