b311480e |
1 | // Created on: 2008-12-10 |
2 | // Created by: Pavel TELKOV |
3 | // Copyright (c) 2008-2012 OPEN CASCADE SAS |
4 | // |
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. |
9 | // |
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. |
12 | // |
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. |
19 | |
7fd59977 |
20 | |
21 | #include <MXCAFDoc_MaterialStorageDriver.ixx> |
22 | #include <XCAFDoc_Material.hxx> |
23 | #include <PXCAFDoc_Material.hxx> |
24 | |
25 | #include <TCollection_HAsciiString.hxx> |
26 | #include <TColStd_HArray1OfReal.hxx> |
27 | #include <PCollection_HAsciiString.hxx> |
28 | #include <PColStd_HArray1OfReal.hxx> |
29 | |
30 | //======================================================================= |
31 | //function : MXCAFDoc_MaterialStorageDriver |
32 | //purpose : |
33 | //======================================================================= |
34 | |
35 | MXCAFDoc_MaterialStorageDriver::MXCAFDoc_MaterialStorageDriver |
36 | (const Handle(CDM_MessageDriver)& theMsgDriver) : MDF_ASDriver (theMsgDriver) |
37 | {} |
38 | |
39 | //======================================================================= |
40 | //function : VersionNumber |
41 | //purpose : |
42 | //======================================================================= |
43 | |
44 | Standard_Integer MXCAFDoc_MaterialStorageDriver::VersionNumber() const |
45 | { return 0; } |
46 | |
47 | //======================================================================= |
48 | //function : SourceType |
49 | //purpose : |
50 | //======================================================================= |
51 | |
52 | Handle(Standard_Type) MXCAFDoc_MaterialStorageDriver::SourceType() const |
53 | { |
54 | static Handle(Standard_Type) sourceType = STANDARD_TYPE(XCAFDoc_Material); |
55 | return sourceType; |
56 | } |
57 | |
58 | //======================================================================= |
59 | //function : NewEmpty |
60 | //purpose : |
61 | //======================================================================= |
62 | |
63 | Handle(PDF_Attribute) MXCAFDoc_MaterialStorageDriver::NewEmpty() const |
64 | { |
65 | return new PXCAFDoc_Material(); |
66 | } |
67 | |
68 | //======================================================================= |
69 | //function : Paste |
70 | //purpose : |
71 | //======================================================================= |
72 | |
73 | void MXCAFDoc_MaterialStorageDriver::Paste(const Handle(TDF_Attribute)& Source, |
74 | const Handle(PDF_Attribute)& Target, |
35e08fe8 |
75 | const Handle(MDF_SRelocationTable)& /*RelocTable*/) const |
7fd59977 |
76 | { |
77 | Handle(XCAFDoc_Material) S = Handle(XCAFDoc_Material)::DownCast (Source); |
78 | Handle(PXCAFDoc_Material) T = Handle(PXCAFDoc_Material)::DownCast (Target); |
7fd59977 |
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(); |
83 | |
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()); |
93 | |
94 | T->Set(aName, aDescr, S->GetDensity(), aDensName, aDensValType); |
95 | } |