1 // Created on: 2000-08-15
2 // Created by: data exchange team
3 // Copyright (c) 2000-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
17 #include <Standard_GUID.hxx>
18 #include <Standard_Type.hxx>
19 #include <TDF_Attribute.hxx>
20 #include <TDF_Label.hxx>
21 #include <TDF_RelocationTable.hxx>
22 #include <TopLoc_Location.hxx>
23 #include <XCAFDoc_Location.hxx>
25 IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_Location,TDF_Attribute)
27 //=======================================================================
28 //function : Constructor
30 //=======================================================================
31 XCAFDoc_Location::XCAFDoc_Location()
35 //=======================================================================
38 //=======================================================================
40 const Standard_GUID& XCAFDoc_Location::GetID()
42 static Standard_GUID LocationID ("efd212ef-6dfd-11d4-b9c8-0060b0ee281b");
46 //=======================================================================
49 //=======================================================================
51 Handle(XCAFDoc_Location) XCAFDoc_Location::Set(const TDF_Label& L,const TopLoc_Location& Loc)
53 Handle(XCAFDoc_Location) A;
54 if (!L.FindAttribute (XCAFDoc_Location::GetID(), A)) {
55 A = new XCAFDoc_Location ();
62 //=======================================================================
65 //=======================================================================
67 void XCAFDoc_Location::Set(const TopLoc_Location& Loc)
73 //=======================================================================
76 //=======================================================================
78 const TopLoc_Location& XCAFDoc_Location::Get() const
83 //=======================================================================
86 //=======================================================================
88 const Standard_GUID& XCAFDoc_Location::ID() const
93 //=======================================================================
96 //=======================================================================
98 void XCAFDoc_Location::Restore(const Handle(TDF_Attribute)& With)
100 myLocation = Handle(XCAFDoc_Location)::DownCast(With)->Get();
103 //=======================================================================
104 //function : NewEmpty
106 //=======================================================================
108 Handle(TDF_Attribute) XCAFDoc_Location::NewEmpty() const
110 return new XCAFDoc_Location();
113 //=======================================================================
116 //=======================================================================
118 void XCAFDoc_Location::Paste(const Handle(TDF_Attribute)& Into,const Handle(TDF_RelocationTable)& /* RT */) const
120 Handle(XCAFDoc_Location)::DownCast(Into)->Set(myLocation);