Integration of OCCT 6.5.0 from SVN
[occt.git] / src / RWStepFEA / RWStepFEA_RWCurve3dElementRepresentation.cxx
1 // File:        RWStepFEA_RWCurve3dElementRepresentation.cxx
2 // Created:     Thu Dec 12 17:51:03 2002 
3 // Author:      data exchange team
4 // Generator:   ExpToCas (EXPRESS -> CASCADE/XSTEP Translator) V1.2
5 // Copyright:   Open CASCADE 2002
6
7 #include <RWStepFEA_RWCurve3dElementRepresentation.ixx>
8 #include <StepRepr_HArray1OfRepresentationItem.hxx>
9 #include <StepRepr_RepresentationItem.hxx>
10 #include <StepFEA_HArray1OfNodeRepresentation.hxx>
11 #include <StepFEA_NodeRepresentation.hxx>
12
13 //=======================================================================
14 //function : RWStepFEA_RWCurve3dElementRepresentation
15 //purpose  : 
16 //=======================================================================
17
18 RWStepFEA_RWCurve3dElementRepresentation::RWStepFEA_RWCurve3dElementRepresentation ()
19 {
20 }
21
22 //=======================================================================
23 //function : ReadStep
24 //purpose  : 
25 //=======================================================================
26
27 void RWStepFEA_RWCurve3dElementRepresentation::ReadStep (const Handle(StepData_StepReaderData)& data,
28                                                          const Standard_Integer num,
29                                                          Handle(Interface_Check)& ach,
30                                                          const Handle(StepFEA_Curve3dElementRepresentation) &ent) const
31 {
32   // Check number of parameters
33   if ( ! data->CheckNbParams(num,8,ach,"curve3d_element_representation") ) return;
34
35   // Inherited fields of Representation
36
37   Handle(TCollection_HAsciiString) aRepresentation_Name;
38   data->ReadString (num, 1, "representation.name", ach, aRepresentation_Name);
39
40   Handle(StepRepr_HArray1OfRepresentationItem) aRepresentation_Items;
41   Standard_Integer sub2 = 0;
42   if ( data->ReadSubList (num, 2, "representation.items", ach, sub2) ) {
43     Standard_Integer nb0 = data->NbParams(sub2);
44     aRepresentation_Items = new StepRepr_HArray1OfRepresentationItem (1, nb0);
45     Standard_Integer num2 = sub2;
46     for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
47       Handle(StepRepr_RepresentationItem) anIt0;
48       data->ReadEntity (num2, i0, "representation_item", ach, STANDARD_TYPE(StepRepr_RepresentationItem), anIt0);
49       aRepresentation_Items->SetValue(i0, anIt0);
50     }
51   }
52
53   Handle(StepRepr_RepresentationContext) aRepresentation_ContextOfItems;
54   data->ReadEntity (num, 3, "representation.context_of_items", ach, STANDARD_TYPE(StepRepr_RepresentationContext), aRepresentation_ContextOfItems);
55
56   // Inherited fields of ElementRepresentation
57
58   Handle(StepFEA_HArray1OfNodeRepresentation) aElementRepresentation_NodeList;
59   Standard_Integer sub4 = 0;
60   if ( data->ReadSubList (num, 4, "element_representation.node_list", ach, sub4) ) {
61     Standard_Integer nb0 = data->NbParams(sub4);
62     aElementRepresentation_NodeList = new StepFEA_HArray1OfNodeRepresentation (1, nb0);
63     Standard_Integer num2 = sub4;
64     for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
65       Handle(StepFEA_NodeRepresentation) anIt0;
66       data->ReadEntity (num2, i0, "node_representation", ach, STANDARD_TYPE(StepFEA_NodeRepresentation), anIt0);
67       aElementRepresentation_NodeList->SetValue(i0, anIt0);
68     }
69   }
70
71   // Own fields of Curve3dElementRepresentation
72
73   Handle(StepFEA_FeaModel3d) aModelRef;
74   data->ReadEntity (num, 5, "model_ref", ach, STANDARD_TYPE(StepFEA_FeaModel3d), aModelRef);
75
76   Handle(StepElement_Curve3dElementDescriptor) aElementDescriptor;
77   data->ReadEntity (num, 6, "element_descriptor", ach, STANDARD_TYPE(StepElement_Curve3dElementDescriptor), aElementDescriptor);
78
79   Handle(StepFEA_Curve3dElementProperty) aProperty;
80   data->ReadEntity (num, 7, "property", ach, STANDARD_TYPE(StepFEA_Curve3dElementProperty), aProperty);
81
82   Handle(StepElement_ElementMaterial) aMaterial;
83   data->ReadEntity (num, 8, "material", ach, STANDARD_TYPE(StepElement_ElementMaterial), aMaterial);
84
85   // Initialize entity
86   ent->Init(aRepresentation_Name,
87             aRepresentation_Items,
88             aRepresentation_ContextOfItems,
89             aElementRepresentation_NodeList,
90             aModelRef,
91             aElementDescriptor,
92             aProperty,
93             aMaterial);
94 }
95
96 //=======================================================================
97 //function : WriteStep
98 //purpose  : 
99 //=======================================================================
100
101 void RWStepFEA_RWCurve3dElementRepresentation::WriteStep (StepData_StepWriter& SW,
102                                                           const Handle(StepFEA_Curve3dElementRepresentation) &ent) const
103 {
104
105   // Inherited fields of Representation
106
107   SW.Send (ent->StepRepr_Representation::Name());
108
109   SW.OpenSub();
110   for (Standard_Integer i1=1; i1 <= ent->StepRepr_Representation::Items()->Length(); i1++ ) {
111     Handle(StepRepr_RepresentationItem) Var0 = ent->StepRepr_Representation::Items()->Value(i1);
112     SW.Send (Var0);
113   }
114   SW.CloseSub();
115
116   SW.Send (ent->StepRepr_Representation::ContextOfItems());
117
118   // Inherited fields of ElementRepresentation
119
120   SW.OpenSub();
121   for (Standard_Integer i3=1; i3 <= ent->StepFEA_ElementRepresentation::NodeList()->Length(); i3++ ) {
122     Handle(StepFEA_NodeRepresentation) Var0 = ent->StepFEA_ElementRepresentation::NodeList()->Value(i3);
123     SW.Send (Var0);
124   }
125   SW.CloseSub();
126
127   // Own fields of Curve3dElementRepresentation
128
129   SW.Send (ent->ModelRef());
130
131   SW.Send (ent->ElementDescriptor());
132
133   SW.Send (ent->Property());
134
135   SW.Send (ent->Material());
136 }
137
138 //=======================================================================
139 //function : Share
140 //purpose  : 
141 //=======================================================================
142
143 void RWStepFEA_RWCurve3dElementRepresentation::Share (const Handle(StepFEA_Curve3dElementRepresentation) &ent,
144                                                       Interface_EntityIterator& iter) const
145 {
146
147   // Inherited fields of Representation
148
149   for (Standard_Integer i1=1; i1 <= ent->StepRepr_Representation::Items()->Length(); i1++ ) {
150     Handle(StepRepr_RepresentationItem) Var0 = ent->StepRepr_Representation::Items()->Value(i1);
151     iter.AddItem (Var0);
152   }
153
154   iter.AddItem (ent->StepRepr_Representation::ContextOfItems());
155
156   // Inherited fields of ElementRepresentation
157
158   for (Standard_Integer i3=1; i3 <= ent->StepFEA_ElementRepresentation::NodeList()->Length(); i3++ ) {
159     Handle(StepFEA_NodeRepresentation) Var0 = ent->StepFEA_ElementRepresentation::NodeList()->Value(i3);
160     iter.AddItem (Var0);
161   }
162
163   // Own fields of Curve3dElementRepresentation
164
165   iter.AddItem (ent->ModelRef());
166
167   iter.AddItem (ent->ElementDescriptor());
168
169   iter.AddItem (ent->Property());
170
171   iter.AddItem (ent->Material());
172 }