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.
17 #include <TNaming_UsedShapes.ixx>
19 #include <TDF_DeltaOnAddition.hxx>
20 #include <TNaming_DataMapIteratorOfDataMapOfShapePtrRefShape.hxx>
21 #include <TNaming_RefShape.hxx>
22 #include <TNaming_PtrNode.hxx>
24 #include <TopoDS_Shape.hxx>
26 //=======================================================================
29 //=======================================================================
31 const Standard_GUID& TNaming_UsedShapes::GetID()
33 static Standard_GUID TNaming_UsedShapesID("c4ef4201-568f-11d1-8940-080009dc3333");
34 return TNaming_UsedShapesID;
37 //=======================================================================
40 //=======================================================================
42 TNaming_UsedShapes::TNaming_UsedShapes()
47 //=======================================================================
50 //=======================================================================
52 void TNaming_UsedShapes::Destroy()
57 //=======================================================================
58 //function : BackupCopy
60 //=======================================================================
62 Handle(TDF_Attribute) TNaming_UsedShapes::BackupCopy() const
64 Handle(TNaming_UsedShapes) Att;
68 //=======================================================================
69 //function : BeforeRemoval
71 //=======================================================================
73 void TNaming_UsedShapes::BeforeRemoval()
79 //=======================================================================
80 //function : AfterUndo
81 //purpose : After application of a TDF_Delta.
82 //=======================================================================
84 Standard_Boolean TNaming_UsedShapes::AfterUndo
85 (const Handle(TDF_AttributeDelta)& anAttDelta,
86 const Standard_Boolean /*forceIt*/)
88 if (anAttDelta->IsKind(STANDARD_TYPE(TDF_DeltaOnAddition))) {
89 anAttDelta->Attribute()->BeforeRemoval();
94 //=======================================================================
95 //function : DeltaOnAddition
97 //=======================================================================
99 Handle(TDF_DeltaOnAddition) TNaming_UsedShapes::DeltaOnAddition() const
101 Handle(TDF_DeltaOnAddition) aDelta;
104 //=======================================================================
105 //function : DeltaOnRemoval
107 //=======================================================================
109 Handle(TDF_DeltaOnRemoval) TNaming_UsedShapes::DeltaOnRemoval() const
111 Handle(TDF_DeltaOnRemoval) aDelta;
115 //=======================================================================
118 //=======================================================================
120 void TNaming_UsedShapes::Restore(const Handle(TDF_Attribute)& /*anAttribute*/)
124 //=======================================================================
125 //function : NewEmpty
127 //=======================================================================
129 Handle(TDF_Attribute) TNaming_UsedShapes::NewEmpty () const
131 return new TNaming_UsedShapes();
134 //=======================================================================
137 //=======================================================================
139 void TNaming_UsedShapes::Paste(const Handle(TDF_Attribute)&,
140 const Handle(TDF_RelocationTable)&) const
144 //=======================================================================
147 //=======================================================================
149 Standard_OStream& TNaming_UsedShapes::Dump(Standard_OStream& anOS) const
151 anOS<<"The content of UsedShapes attribute:"<<endl;
152 TNaming_DataMapIteratorOfDataMapOfShapePtrRefShape itr(myMap);
153 for (; itr.More(); itr.Next()) {
155 TopAbs::Print(itr.Key().ShapeType(),anOS);
157 itr.Value()->Label().EntryDump(anOS);
158 anOS << " Key_TShape = " <<itr.Key().TShape()->This();
159 anOS << " Value_TShape = " <<itr.Value()->Shape().TShape()->This();
165 //=======================================================================
166 //function : References
168 //=======================================================================
170 void TNaming_UsedShapes::References(const Handle(TDF_DataSet)& ) const