1 // Created on: 2004-05-17
2 // Created by: Sergey ZARITCHNY
3 // Copyright (c) 2004-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.
16 // modified 13.04.2009 Sergey ZARITCHNY
18 #include <BinMDataXtd_PositionDriver.hxx>
21 #include <Standard_Type.hxx>
22 #include <TDataXtd_Position.hxx>
23 #include <TDF_Attribute.hxx>
24 #include <BinObjMgt_Persistent.hxx>
26 IMPLEMENT_STANDARD_RTTIEXT(BinMDataXtd_PositionDriver,BinMDF_ADriver)
28 //=======================================================================
29 //function : BinMDataStd_PositionDriver
30 //purpose : Constructor
31 //=======================================================================
32 BinMDataXtd_PositionDriver::BinMDataXtd_PositionDriver
33 (const Handle(CDM_MessageDriver)& theMsgDriver)
34 : BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataXtd_Position)->Name())
38 //=======================================================================
41 //=======================================================================
43 Handle(TDF_Attribute) BinMDataXtd_PositionDriver::NewEmpty() const
45 return new TDataXtd_Position();
48 //=======================================================================
50 //purpose : persistent -> transient (retrieve)
51 //=======================================================================
53 Standard_Boolean BinMDataXtd_PositionDriver::Paste
54 (const BinObjMgt_Persistent& theSource,
55 const Handle(TDF_Attribute)& theTarget,
56 BinObjMgt_RRelocationTable& ) const
58 Handle(TDataXtd_Position) anAtt = Handle(TDataXtd_Position)::DownCast(theTarget);
60 Standard_Boolean ok = theSource >> aValue;
62 gp_Pnt aPosition(0., 0., 0.);
63 aPosition.SetX(aValue);
65 ok = theSource >> aValue;
67 aPosition.SetY(aValue);
69 ok = theSource >> aValue;
71 aPosition.SetZ(aValue);
73 anAtt->SetPosition(aPosition);
78 //=======================================================================
80 //purpose : transient -> persistent (store)
81 //=======================================================================
83 void BinMDataXtd_PositionDriver::Paste (const Handle(TDF_Attribute)& theSource,
84 BinObjMgt_Persistent& theTarget,
85 BinObjMgt_SRelocationTable& ) const
87 Handle(TDataXtd_Position) anAtt = Handle(TDataXtd_Position)::DownCast(theSource);
89 theTarget << anAtt->GetPosition().X();
90 theTarget << anAtt->GetPosition().Y();
91 theTarget << anAtt->GetPosition().Z();