1 // File: BinMPrsStd_PositionDriver.cxx
2 // Created: Mon May 17 11:36:11 2004
3 // Author: Sergey ZARITCHNY <szy@opencascade.com>
4 // Copyright: Open CasCade S.A. 2004
5 // modified 13.04.2009 Sergey ZARITCHNY
7 #include <BinMPrsStd_PositionDriver.ixx>
9 #include <TDataXtd_Position.hxx>
10 #include <CDM_MessageDriver.hxx>
12 //=======================================================================
13 //function : BinMDataStd_PositionDriver
14 //purpose : Constructor
15 //=======================================================================
17 BinMPrsStd_PositionDriver::BinMPrsStd_PositionDriver
18 (const Handle(CDM_MessageDriver)& theMsgDriver)
19 : BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataXtd_Position)->Name())
23 //=======================================================================
26 //=======================================================================
28 Handle(TDF_Attribute) BinMPrsStd_PositionDriver::NewEmpty() const
30 return new TDataXtd_Position();
33 //=======================================================================
35 //purpose : persistent -> transient (retrieve)
36 //=======================================================================
38 Standard_Boolean BinMPrsStd_PositionDriver::Paste
39 (const BinObjMgt_Persistent& theSource,
40 const Handle(TDF_Attribute)& theTarget,
41 BinObjMgt_RRelocationTable& ) const
43 Handle(TDataXtd_Position) anAtt = Handle(TDataXtd_Position)::DownCast(theTarget);
45 Standard_Boolean ok = theSource >> aValue;
47 gp_Pnt aPosition(0., 0., 0.);
48 aPosition.SetX(aValue);
50 ok = theSource >> aValue;
52 aPosition.SetY(aValue);
54 ok = theSource >> aValue;
56 aPosition.SetZ(aValue);
58 anAtt->SetPosition(aPosition);
63 //=======================================================================
65 //purpose : transient -> persistent (store)
66 //=======================================================================
68 void BinMPrsStd_PositionDriver::Paste (const Handle(TDF_Attribute)& theSource,
69 BinObjMgt_Persistent& theTarget,
70 BinObjMgt_SRelocationTable& ) const
72 Handle(TDataXtd_Position) anAtt = Handle(TDataXtd_Position)::DownCast(theSource);
74 theTarget << anAtt->GetPosition().X();
75 theTarget << anAtt->GetPosition().Y();
76 theTarget << anAtt->GetPosition().Z();