b311480e |
1 | // Created on: 2002-12-12 |
2 | // Created by: data exchange team |
3 | // Copyright (c) 2002-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 | // Generator: ExpToCas (EXPRESS -> CASCADE/XSTEP Translator) V1.2 |
7fd59977 |
21 | |
22 | #include <RWStepElement_RWElementMaterial.ixx> |
23 | #include <StepRepr_HArray1OfMaterialPropertyRepresentation.hxx> |
24 | #include <StepRepr_MaterialPropertyRepresentation.hxx> |
25 | |
26 | //======================================================================= |
27 | //function : RWStepElement_RWElementMaterial |
28 | //purpose : |
29 | //======================================================================= |
30 | |
31 | RWStepElement_RWElementMaterial::RWStepElement_RWElementMaterial () |
32 | { |
33 | } |
34 | |
35 | //======================================================================= |
36 | //function : ReadStep |
37 | //purpose : |
38 | //======================================================================= |
39 | |
40 | void RWStepElement_RWElementMaterial::ReadStep (const Handle(StepData_StepReaderData)& data, |
41 | const Standard_Integer num, |
42 | Handle(Interface_Check)& ach, |
43 | const Handle(StepElement_ElementMaterial) &ent) const |
44 | { |
45 | // Check number of parameters |
46 | if ( ! data->CheckNbParams(num,3,ach,"element_material") ) return; |
47 | |
48 | // Own fields of ElementMaterial |
49 | |
50 | Handle(TCollection_HAsciiString) aMaterialId; |
51 | data->ReadString (num, 1, "material_id", ach, aMaterialId); |
52 | |
53 | Handle(TCollection_HAsciiString) aDescription; |
54 | data->ReadString (num, 2, "description", ach, aDescription); |
55 | |
56 | Handle(StepRepr_HArray1OfMaterialPropertyRepresentation) aProperties; |
57 | Standard_Integer sub3 = 0; |
58 | if ( data->ReadSubList (num, 3, "properties", ach, sub3) ) { |
59 | Standard_Integer nb0 = data->NbParams(sub3); |
60 | aProperties = new StepRepr_HArray1OfMaterialPropertyRepresentation (1, nb0); |
61 | Standard_Integer num2 = sub3; |
62 | for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) { |
63 | Handle(StepRepr_MaterialPropertyRepresentation) anIt0; |
64 | data->ReadEntity (num2, i0, "material_property_representation", ach, STANDARD_TYPE(StepRepr_MaterialPropertyRepresentation), anIt0); |
65 | aProperties->SetValue(i0, anIt0); |
66 | } |
67 | } |
68 | |
69 | // Initialize entity |
70 | ent->Init(aMaterialId, |
71 | aDescription, |
72 | aProperties); |
73 | } |
74 | |
75 | //======================================================================= |
76 | //function : WriteStep |
77 | //purpose : |
78 | //======================================================================= |
79 | |
80 | void RWStepElement_RWElementMaterial::WriteStep (StepData_StepWriter& SW, |
81 | const Handle(StepElement_ElementMaterial) &ent) const |
82 | { |
83 | |
84 | // Own fields of ElementMaterial |
85 | |
86 | SW.Send (ent->MaterialId()); |
87 | |
88 | SW.Send (ent->Description()); |
89 | |
90 | SW.OpenSub(); |
91 | for (Standard_Integer i2=1; i2 <= ent->Properties()->Length(); i2++ ) { |
92 | Handle(StepRepr_MaterialPropertyRepresentation) Var0 = ent->Properties()->Value(i2); |
93 | SW.Send (Var0); |
94 | } |
95 | SW.CloseSub(); |
96 | } |
97 | |
98 | //======================================================================= |
99 | //function : Share |
100 | //purpose : |
101 | //======================================================================= |
102 | |
103 | void RWStepElement_RWElementMaterial::Share (const Handle(StepElement_ElementMaterial) &ent, |
104 | Interface_EntityIterator& iter) const |
105 | { |
106 | |
107 | // Own fields of ElementMaterial |
108 | |
109 | for (Standard_Integer i1=1; i1 <= ent->Properties()->Length(); i1++ ) { |
110 | Handle(StepRepr_MaterialPropertyRepresentation) Var0 = ent->Properties()->Value(i1); |
111 | iter.AddItem (Var0); |
112 | } |
113 | } |