0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / BinMXCAFDoc / BinMXCAFDoc_DatumDriver.cxx
CommitLineData
b311480e 1// Created on: 2008-12-10
2// Created by: Pavel TELKOV
973c2be1 3// Copyright (c) 2008-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 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
973c2be1 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.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
7fd59977 15
7fd59977 16
42cf5bc1 17#include <BinMXCAFDoc_DatumDriver.hxx>
18#include <BinObjMgt_Persistent.hxx>
83ae3591 19#include <Message_Messenger.hxx>
42cf5bc1 20#include <Standard_Type.hxx>
7fd59977 21#include <TCollection_HAsciiString.hxx>
22#include <TColStd_Array1OfReal.hxx>
23#include <TColStd_HArray1OfReal.hxx>
42cf5bc1 24#include <TDF_Attribute.hxx>
25#include <XCAFDoc_Datum.hxx>
7fd59977 26
92efcf78 27IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_DatumDriver,BinMDF_ADriver)
28
7fd59977 29//=======================================================================
30//function : Constructor
31//purpose :
32//=======================================================================
33BinMXCAFDoc_DatumDriver::BinMXCAFDoc_DatumDriver
83ae3591 34 (const Handle(Message_Messenger)& theMsgDriver)
7fd59977 35: BinMDF_ADriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_Datum)->Name())
36{
37}
38
39//=======================================================================
40//function : NewEmpty
41//purpose :
42//=======================================================================
43Handle(TDF_Attribute) BinMXCAFDoc_DatumDriver::NewEmpty() const
44{
45 return new XCAFDoc_Datum();
46}
47
48//=======================================================================
49//function : Paste
50//purpose :
51//=======================================================================
52Standard_Boolean BinMXCAFDoc_DatumDriver::Paste(const BinObjMgt_Persistent& theSource,
53 const Handle(TDF_Attribute)& theTarget,
54 BinObjMgt_RRelocationTable& /*theRelocTable*/) const
55{
56 Handle(XCAFDoc_Datum) anAtt = Handle(XCAFDoc_Datum)::DownCast(theTarget);
57 TCollection_AsciiString aName, aDescr, anId;
58 if ( !(theSource >> aName >> aDescr >> anId) )
59 return Standard_False;
60
61 anAtt->Set(new TCollection_HAsciiString( aName ),
62 new TCollection_HAsciiString( aDescr ),
63 new TCollection_HAsciiString( anId ));
64 return Standard_True;
65}
66
67//=======================================================================
68//function : Paste
69//purpose :
70//=======================================================================
71void BinMXCAFDoc_DatumDriver::Paste(const Handle(TDF_Attribute)& theSource,
72 BinObjMgt_Persistent& theTarget,
73 BinObjMgt_SRelocationTable& /*theRelocTable*/) const
74{
75 Handle(XCAFDoc_Datum) anAtt = Handle(XCAFDoc_Datum)::DownCast(theSource);
76 if ( !anAtt->GetName().IsNull() )
77 theTarget << anAtt->GetName()->String();
78 else
79 theTarget << TCollection_AsciiString("");
80
81 if ( !anAtt->GetDescription().IsNull() )
82 theTarget << anAtt->GetDescription()->String();
83 else
84 theTarget << TCollection_AsciiString("");
85
86 if ( !anAtt->GetIdentification().IsNull() )
87 theTarget << anAtt->GetIdentification()->String();
88 else
89 theTarget << TCollection_AsciiString("");
90}