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 <RWStepFEA_RWElementRepresentation.ixx> |
23 | #include <StepRepr_HArray1OfRepresentationItem.hxx> |
24 | #include <StepRepr_RepresentationItem.hxx> |
25 | #include <StepFEA_HArray1OfNodeRepresentation.hxx> |
26 | #include <StepFEA_NodeRepresentation.hxx> |
27 | |
28 | //======================================================================= |
29 | //function : RWStepFEA_RWElementRepresentation |
30 | //purpose : |
31 | //======================================================================= |
32 | |
33 | RWStepFEA_RWElementRepresentation::RWStepFEA_RWElementRepresentation () |
34 | { |
35 | } |
36 | |
37 | //======================================================================= |
38 | //function : ReadStep |
39 | //purpose : |
40 | //======================================================================= |
41 | |
42 | void RWStepFEA_RWElementRepresentation::ReadStep (const Handle(StepData_StepReaderData)& data, |
43 | const Standard_Integer num, |
44 | Handle(Interface_Check)& ach, |
45 | const Handle(StepFEA_ElementRepresentation) &ent) const |
46 | { |
47 | // Check number of parameters |
48 | if ( ! data->CheckNbParams(num,4,ach,"element_representation") ) return; |
49 | |
50 | // Inherited fields of Representation |
51 | |
52 | Handle(TCollection_HAsciiString) aRepresentation_Name; |
53 | data->ReadString (num, 1, "representation.name", ach, aRepresentation_Name); |
54 | |
55 | Handle(StepRepr_HArray1OfRepresentationItem) aRepresentation_Items; |
56 | Standard_Integer sub2 = 0; |
57 | if ( data->ReadSubList (num, 2, "representation.items", ach, sub2) ) { |
58 | Standard_Integer nb0 = data->NbParams(sub2); |
59 | aRepresentation_Items = new StepRepr_HArray1OfRepresentationItem (1, nb0); |
60 | Standard_Integer num2 = sub2; |
61 | for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) { |
62 | Handle(StepRepr_RepresentationItem) anIt0; |
63 | data->ReadEntity (num2, i0, "representation_item", ach, STANDARD_TYPE(StepRepr_RepresentationItem), anIt0); |
64 | aRepresentation_Items->SetValue(i0, anIt0); |
65 | } |
66 | } |
67 | |
68 | Handle(StepRepr_RepresentationContext) aRepresentation_ContextOfItems; |
69 | data->ReadEntity (num, 3, "representation.context_of_items", ach, STANDARD_TYPE(StepRepr_RepresentationContext), aRepresentation_ContextOfItems); |
70 | |
71 | // Own fields of ElementRepresentation |
72 | |
73 | Handle(StepFEA_HArray1OfNodeRepresentation) aNodeList; |
74 | Standard_Integer sub4 = 0; |
75 | if ( data->ReadSubList (num, 4, "node_list", ach, sub4) ) { |
76 | Standard_Integer nb0 = data->NbParams(sub4); |
77 | aNodeList = new StepFEA_HArray1OfNodeRepresentation (1, nb0); |
78 | Standard_Integer num2 = sub4; |
79 | for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) { |
80 | Handle(StepFEA_NodeRepresentation) anIt0; |
81 | data->ReadEntity (num2, i0, "node_representation", ach, STANDARD_TYPE(StepFEA_NodeRepresentation), anIt0); |
82 | aNodeList->SetValue(i0, anIt0); |
83 | } |
84 | } |
85 | |
86 | // Initialize entity |
87 | ent->Init(aRepresentation_Name, |
88 | aRepresentation_Items, |
89 | aRepresentation_ContextOfItems, |
90 | aNodeList); |
91 | } |
92 | |
93 | //======================================================================= |
94 | //function : WriteStep |
95 | //purpose : |
96 | //======================================================================= |
97 | |
98 | void RWStepFEA_RWElementRepresentation::WriteStep (StepData_StepWriter& SW, |
99 | const Handle(StepFEA_ElementRepresentation) &ent) const |
100 | { |
101 | |
102 | // Inherited fields of Representation |
103 | |
104 | SW.Send (ent->StepRepr_Representation::Name()); |
105 | |
106 | SW.OpenSub(); |
107 | for (Standard_Integer i1=1; i1 <= ent->StepRepr_Representation::Items()->Length(); i1++ ) { |
108 | Handle(StepRepr_RepresentationItem) Var0 = ent->StepRepr_Representation::Items()->Value(i1); |
109 | SW.Send (Var0); |
110 | } |
111 | SW.CloseSub(); |
112 | |
113 | SW.Send (ent->StepRepr_Representation::ContextOfItems()); |
114 | |
115 | // Own fields of ElementRepresentation |
116 | |
117 | SW.OpenSub(); |
118 | for (Standard_Integer i3=1; i3 <= ent->NodeList()->Length(); i3++ ) { |
119 | Handle(StepFEA_NodeRepresentation) Var0 = ent->NodeList()->Value(i3); |
120 | SW.Send (Var0); |
121 | } |
122 | SW.CloseSub(); |
123 | } |
124 | |
125 | //======================================================================= |
126 | //function : Share |
127 | //purpose : |
128 | //======================================================================= |
129 | |
130 | void RWStepFEA_RWElementRepresentation::Share (const Handle(StepFEA_ElementRepresentation) &ent, |
131 | Interface_EntityIterator& iter) const |
132 | { |
133 | |
134 | // Inherited fields of Representation |
135 | |
136 | for (Standard_Integer i1=1; i1 <= ent->StepRepr_Representation::Items()->Length(); i1++ ) { |
137 | Handle(StepRepr_RepresentationItem) Var0 = ent->StepRepr_Representation::Items()->Value(i1); |
138 | iter.AddItem (Var0); |
139 | } |
140 | |
141 | iter.AddItem (ent->StepRepr_Representation::ContextOfItems()); |
142 | |
143 | // Own fields of ElementRepresentation |
144 | |
145 | for (Standard_Integer i3=1; i3 <= ent->NodeList()->Length(); i3++ ) { |
146 | Handle(StepFEA_NodeRepresentation) Var0 = ent->NodeList()->Value(i3); |
147 | iter.AddItem (Var0); |
148 | } |
149 | } |