1 // Created on: 2008-12-10
2 // Created by: Pavel TELKOV
3 // Copyright (c) 2008-2012 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
21 #include <MXCAFDoc_MaterialStorageDriver.ixx>
22 #include <XCAFDoc_Material.hxx>
23 #include <PXCAFDoc_Material.hxx>
25 #include <TCollection_HAsciiString.hxx>
26 #include <TColStd_HArray1OfReal.hxx>
27 #include <PCollection_HAsciiString.hxx>
28 #include <PColStd_HArray1OfReal.hxx>
30 //=======================================================================
31 //function : MXCAFDoc_MaterialStorageDriver
33 //=======================================================================
35 MXCAFDoc_MaterialStorageDriver::MXCAFDoc_MaterialStorageDriver
36 (const Handle(CDM_MessageDriver)& theMsgDriver) : MDF_ASDriver (theMsgDriver)
39 //=======================================================================
40 //function : VersionNumber
42 //=======================================================================
44 Standard_Integer MXCAFDoc_MaterialStorageDriver::VersionNumber() const
47 //=======================================================================
48 //function : SourceType
50 //=======================================================================
52 Handle(Standard_Type) MXCAFDoc_MaterialStorageDriver::SourceType() const
54 static Handle(Standard_Type) sourceType = STANDARD_TYPE(XCAFDoc_Material);
58 //=======================================================================
61 //=======================================================================
63 Handle(PDF_Attribute) MXCAFDoc_MaterialStorageDriver::NewEmpty() const
65 return new PXCAFDoc_Material();
68 //=======================================================================
71 //=======================================================================
73 void MXCAFDoc_MaterialStorageDriver::Paste(const Handle(TDF_Attribute)& Source,
74 const Handle(PDF_Attribute)& Target,
75 const Handle(MDF_SRelocationTable)& /*RelocTable*/) const
77 Handle(XCAFDoc_Material) S = Handle(XCAFDoc_Material)::DownCast (Source);
78 Handle(PXCAFDoc_Material) T = Handle(PXCAFDoc_Material)::DownCast (Target);
79 Handle(TCollection_HAsciiString) aNameStr = S->GetName();
80 Handle(TCollection_HAsciiString) aDescrStr = S->GetDescription();
81 Handle(TCollection_HAsciiString) aDensNameStr = S->GetDensName();
82 Handle(TCollection_HAsciiString) aDensValTypeStr = S->GetDensValType();
84 Handle(PCollection_HAsciiString) aName, aDescr, aDensName, aDensValType;
85 if ( !aNameStr.IsNull() )
86 aName = new PCollection_HAsciiString (aNameStr->String());
87 if ( !aDescrStr.IsNull() )
88 aDescr = new PCollection_HAsciiString (aDescrStr->String());
89 if ( !aDensNameStr.IsNull() )
90 aDensName = new PCollection_HAsciiString (aDensNameStr->String());
91 if ( !aDensValTypeStr.IsNull() )
92 aDensValType = new PCollection_HAsciiString (aDensValTypeStr->String());
94 T->Set(aName, aDescr, S->GetDensity(), aDensName, aDensValType);