1 // File : BinTObjDrivers_XYZDriver.cxx
2 // Created : Wed Nov 24 11:23:54 2004
3 // Author : Michael SAZONOV
4 // Copyright: Open CASCADE 2007
5 // The original implementation Copyright: (C) RINA S.p.A
8 #include <BinTObjDrivers_XYZDriver.hxx>
9 #include <CDM_MessageDriver.hxx>
10 #include <TDF_Attribute.hxx>
11 #include <BinObjMgt_Persistent.hxx>
12 #include <TObj_TXYZ.hxx>
14 IMPLEMENT_STANDARD_HANDLE(BinTObjDrivers_XYZDriver,BinMDF_ADriver)
15 IMPLEMENT_STANDARD_RTTIEXT(BinTObjDrivers_XYZDriver,BinMDF_ADriver)
17 //=======================================================================
18 //function : BinTObjDrivers_XYZDriver
19 //purpose : constructor
20 //=======================================================================
22 BinTObjDrivers_XYZDriver::BinTObjDrivers_XYZDriver
23 (const Handle(CDM_MessageDriver)& theMessageDriver)
24 : BinMDF_ADriver( theMessageDriver, NULL)
28 //=======================================================================
30 //purpose : Creates a new attribute
31 //=======================================================================
33 Handle(TDF_Attribute) BinTObjDrivers_XYZDriver::NewEmpty() const
38 //=======================================================================
40 //purpose : Retrieve. Translate the contents of <theSource> and put it
42 //=======================================================================
44 Standard_Boolean BinTObjDrivers_XYZDriver::Paste
45 (const BinObjMgt_Persistent& theSource,
46 const Handle(TDF_Attribute)& theTarget,
47 BinObjMgt_RRelocationTable&) const
49 Handle(TObj_TXYZ) aTarget = Handle(TObj_TXYZ)::DownCast(theTarget);
50 Standard_Real aX, aY, aZ;
51 if (! (theSource >> aX >> aY >> aZ))
52 return Standard_False;
53 aTarget->Set (gp_XYZ (aX, aY, aZ));
57 //=======================================================================
59 //purpose : Store. Translate the contents of <theSource> and put it
61 //=======================================================================
63 void BinTObjDrivers_XYZDriver::Paste
64 (const Handle(TDF_Attribute)& theSource,
65 BinObjMgt_Persistent& theTarget,
66 BinObjMgt_SRelocationTable&) const
68 Handle(TObj_TXYZ) aSource = Handle(TObj_TXYZ)::DownCast (theSource);
69 gp_XYZ aXYZ = aSource->Get();
70 theTarget << aXYZ.X() << aXYZ.Y() << aXYZ.Z();