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 <TNaming_Builder.hxx>
27 #include <TNaming_DataMapIteratorOfDataMapOfShapePtrRefShape.hxx>
28 #include <TNaming_PtrNode.hxx>
29 #include <TNaming_RefShape.hxx>
30 #include <TNaming_UsedShapes.hxx>
31 #include <TopoDS_Shape.hxx>
33 IMPLEMENT_STANDARD_RTTIEXT(TNaming_UsedShapes,TDF_Attribute)
35 //=======================================================================
38 //=======================================================================
39 const Standard_GUID& TNaming_UsedShapes::GetID()
41 static Standard_GUID TNaming_UsedShapesID("c4ef4201-568f-11d1-8940-080009dc3333");
42 return TNaming_UsedShapesID;
45 //=======================================================================
48 //=======================================================================
50 TNaming_UsedShapes::TNaming_UsedShapes()
55 //=======================================================================
58 //=======================================================================
60 void TNaming_UsedShapes::Destroy()
65 //=======================================================================
66 //function : BackupCopy
68 //=======================================================================
70 Handle(TDF_Attribute) TNaming_UsedShapes::BackupCopy() const
72 Handle(TNaming_UsedShapes) Att;
76 //=======================================================================
77 //function : BeforeRemoval
79 //=======================================================================
81 void TNaming_UsedShapes::BeforeRemoval()
87 //=======================================================================
88 //function : AfterUndo
89 //purpose : After application of a TDF_Delta.
90 //=======================================================================
92 Standard_Boolean TNaming_UsedShapes::AfterUndo
93 (const Handle(TDF_AttributeDelta)& anAttDelta,
94 const Standard_Boolean /*forceIt*/)
96 if (anAttDelta->IsKind(STANDARD_TYPE(TDF_DeltaOnAddition))) {
97 anAttDelta->Attribute()->BeforeRemoval();
102 //=======================================================================
103 //function : DeltaOnAddition
105 //=======================================================================
107 Handle(TDF_DeltaOnAddition) TNaming_UsedShapes::DeltaOnAddition() const
109 Handle(TDF_DeltaOnAddition) aDelta;
112 //=======================================================================
113 //function : DeltaOnRemoval
115 //=======================================================================
117 Handle(TDF_DeltaOnRemoval) TNaming_UsedShapes::DeltaOnRemoval() const
119 Handle(TDF_DeltaOnRemoval) aDelta;
123 //=======================================================================
126 //=======================================================================
128 void TNaming_UsedShapes::Restore(const Handle(TDF_Attribute)& /*anAttribute*/)
132 //=======================================================================
133 //function : NewEmpty
135 //=======================================================================
137 Handle(TDF_Attribute) TNaming_UsedShapes::NewEmpty () const
139 return new TNaming_UsedShapes();
142 //=======================================================================
145 //=======================================================================
147 void TNaming_UsedShapes::Paste(const Handle(TDF_Attribute)&,
148 const Handle(TDF_RelocationTable)&) const
152 //=======================================================================
155 //=======================================================================
157 Standard_OStream& TNaming_UsedShapes::Dump(Standard_OStream& anOS) const
159 anOS<<"The content of UsedShapes attribute:"<<std::endl;
160 TNaming_DataMapIteratorOfDataMapOfShapePtrRefShape itr(myMap);
161 for (; itr.More(); itr.Next()) {
162 if (itr.Key().IsNull())
164 anOS << "Empty Shape at label =";
165 itr.Value()->Label().EntryDump(anOS);
170 TopAbs::Print(itr.Key().ShapeType(),anOS);
172 itr.Value()->Label().EntryDump(anOS);
173 anOS << " Key_TShape = " <<itr.Key().TShape()->This();
174 anOS << " Value_TShape = " <<itr.Value()->Shape().TShape()->This();
180 //=======================================================================
181 //function : References
183 //=======================================================================
185 void TNaming_UsedShapes::References(const Handle(TDF_DataSet)& ) const