1 // Created on: 2008-12-10
2 // Created by: Pavel TELKOV
3 // Copyright (c) 2008-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 #include <MXCAFDoc_MaterialStorageDriver.ixx>
17 #include <XCAFDoc_Material.hxx>
18 #include <PXCAFDoc_Material.hxx>
20 #include <TCollection_HAsciiString.hxx>
21 #include <TColStd_HArray1OfReal.hxx>
22 #include <PCollection_HAsciiString.hxx>
23 #include <PColStd_HArray1OfReal.hxx>
25 //=======================================================================
26 //function : MXCAFDoc_MaterialStorageDriver
28 //=======================================================================
30 MXCAFDoc_MaterialStorageDriver::MXCAFDoc_MaterialStorageDriver
31 (const Handle(CDM_MessageDriver)& theMsgDriver) : MDF_ASDriver (theMsgDriver)
34 //=======================================================================
35 //function : VersionNumber
37 //=======================================================================
39 Standard_Integer MXCAFDoc_MaterialStorageDriver::VersionNumber() const
42 //=======================================================================
43 //function : SourceType
45 //=======================================================================
47 Handle(Standard_Type) MXCAFDoc_MaterialStorageDriver::SourceType() const
49 static Handle(Standard_Type) sourceType = STANDARD_TYPE(XCAFDoc_Material);
53 //=======================================================================
56 //=======================================================================
58 Handle(PDF_Attribute) MXCAFDoc_MaterialStorageDriver::NewEmpty() const
60 return new PXCAFDoc_Material();
63 //=======================================================================
66 //=======================================================================
68 void MXCAFDoc_MaterialStorageDriver::Paste(const Handle(TDF_Attribute)& Source,
69 const Handle(PDF_Attribute)& Target,
70 const Handle(MDF_SRelocationTable)& /*RelocTable*/) const
72 Handle(XCAFDoc_Material) S = Handle(XCAFDoc_Material)::DownCast (Source);
73 Handle(PXCAFDoc_Material) T = Handle(PXCAFDoc_Material)::DownCast (Target);
74 Handle(TCollection_HAsciiString) aNameStr = S->GetName();
75 Handle(TCollection_HAsciiString) aDescrStr = S->GetDescription();
76 Handle(TCollection_HAsciiString) aDensNameStr = S->GetDensName();
77 Handle(TCollection_HAsciiString) aDensValTypeStr = S->GetDensValType();
79 Handle(PCollection_HAsciiString) aName, aDescr, aDensName, aDensValType;
80 if ( !aNameStr.IsNull() )
81 aName = new PCollection_HAsciiString (aNameStr->String());
82 if ( !aDescrStr.IsNull() )
83 aDescr = new PCollection_HAsciiString (aDescrStr->String());
84 if ( !aDensNameStr.IsNull() )
85 aDensName = new PCollection_HAsciiString (aDensNameStr->String());
86 if ( !aDensValTypeStr.IsNull() )
87 aDensValType = new PCollection_HAsciiString (aDensValTypeStr->String());
89 T->Set(aName, aDescr, S->GetDensity(), aDensName, aDensValType);