0030675: Visualization - remove redundant proxy classes in hierarchy of PrsMgr_Presen...
[occt.git] / src / RWStepFEA / RWStepFEA_RWFeaModel.cxx
1 // Created on: 2002-12-12
2 // Created by: data exchange team
3 // Copyright (c) 2002-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 // Generator:   ExpToCas (EXPRESS -> CASCADE/XSTEP Translator) V1.2
17
18 #include <Interface_Check.hxx>
19 #include <Interface_EntityIterator.hxx>
20 #include <RWStepFEA_RWFeaModel.hxx>
21 #include <StepData_StepReaderData.hxx>
22 #include <StepData_StepWriter.hxx>
23 #include <StepFEA_FeaModel.hxx>
24 #include <StepRepr_HArray1OfRepresentationItem.hxx>
25 #include <StepRepr_RepresentationContext.hxx>
26 #include <StepRepr_RepresentationItem.hxx>
27 #include <TCollection_HAsciiString.hxx>
28 #include <TColStd_HArray1OfAsciiString.hxx>
29
30 //=======================================================================
31 //function : RWStepFEA_RWFeaModel
32 //purpose  : 
33 //=======================================================================
34 RWStepFEA_RWFeaModel::RWStepFEA_RWFeaModel ()
35 {
36 }
37
38 //=======================================================================
39 //function : ReadStep
40 //purpose  : 
41 //=======================================================================
42
43 void RWStepFEA_RWFeaModel::ReadStep (const Handle(StepData_StepReaderData)& data,
44                                      const Standard_Integer num,
45                                      Handle(Interface_Check)& ach,
46                                      const Handle(StepFEA_FeaModel) &ent) const
47 {
48   // Check number of parameters
49   if ( ! data->CheckNbParams(num,7,ach,"fea_model") ) return;
50
51   // Inherited fields of Representation
52
53   Handle(TCollection_HAsciiString) aRepresentation_Name;
54   data->ReadString (num, 1, "representation.name", ach, aRepresentation_Name);
55
56   Handle(StepRepr_HArray1OfRepresentationItem) aRepresentation_Items;
57   Standard_Integer sub2 = 0;
58   if ( data->ReadSubList (num, 2, "representation.items", ach, sub2) ) {
59     Standard_Integer nb0 = data->NbParams(sub2);
60     aRepresentation_Items = new StepRepr_HArray1OfRepresentationItem (1, nb0);
61     Standard_Integer num2 = sub2;
62     for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
63       Handle(StepRepr_RepresentationItem) anIt0;
64       data->ReadEntity (num2, i0, "representation_item", ach, STANDARD_TYPE(StepRepr_RepresentationItem), anIt0);
65       aRepresentation_Items->SetValue(i0, anIt0);
66     }
67   }
68
69   Handle(StepRepr_RepresentationContext) aRepresentation_ContextOfItems;
70   data->ReadEntity (num, 3, "representation.context_of_items", ach, STANDARD_TYPE(StepRepr_RepresentationContext), aRepresentation_ContextOfItems);
71
72   // Own fields of FeaModel
73
74   Handle(TCollection_HAsciiString) aCreatingSoftware;
75   data->ReadString (num, 4, "creating_software", ach, aCreatingSoftware);
76
77   Handle(TColStd_HArray1OfAsciiString) aIntendedAnalysisCode;
78   Standard_Integer sub5 = 0;
79   if ( data->ReadSubList (num, 5, "intended_analysis_code", ach, sub5) ) {
80     Standard_Integer nb0 = data->NbParams(sub5);
81     aIntendedAnalysisCode = new TColStd_HArray1OfAsciiString (1, nb0);
82     Standard_Integer num2 = sub5;
83     for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
84       Handle(TCollection_HAsciiString) anIt0;
85       data->ReadString (num2, i0, "h_ascii_string", ach, anIt0);
86       aIntendedAnalysisCode->SetValue(i0, anIt0->String());
87     }
88   }
89
90   Handle(TCollection_HAsciiString) aDescription;
91   data->ReadString (num, 6, "description", ach, aDescription);
92
93   Handle(TCollection_HAsciiString) aAnalysisType;
94   data->ReadString (num, 7, "analysis_type", ach, aAnalysisType);
95
96   // Initialize entity
97   ent->Init(aRepresentation_Name,
98             aRepresentation_Items,
99             aRepresentation_ContextOfItems,
100             aCreatingSoftware,
101             aIntendedAnalysisCode,
102             aDescription,
103             aAnalysisType);
104 }
105
106 //=======================================================================
107 //function : WriteStep
108 //purpose  : 
109 //=======================================================================
110
111 void RWStepFEA_RWFeaModel::WriteStep (StepData_StepWriter& SW,
112                                       const Handle(StepFEA_FeaModel) &ent) const
113 {
114
115   // Inherited fields of Representation
116
117   SW.Send (ent->StepRepr_Representation::Name());
118
119   SW.OpenSub();
120   for (Standard_Integer i1=1; i1 <= ent->StepRepr_Representation::NbItems(); i1++ ) {
121     Handle(StepRepr_RepresentationItem) Var0 = ent->StepRepr_Representation::Items()->Value(i1);
122     SW.Send (Var0);
123   }
124   SW.CloseSub();
125
126   SW.Send (ent->StepRepr_Representation::ContextOfItems());
127
128   // Own fields of FeaModel
129
130   SW.Send (ent->CreatingSoftware());
131
132   SW.OpenSub();
133   for (Standard_Integer i4=1; i4 <= ent->IntendedAnalysisCode()->Length(); i4++ ) {
134     Handle(TCollection_HAsciiString) Var0 = 
135       new TCollection_HAsciiString(ent->IntendedAnalysisCode()->Value(i4));
136     SW.Send (Var0);
137   }
138   SW.CloseSub();
139
140   SW.Send (ent->Description());
141
142   SW.Send (ent->AnalysisType());
143 }
144
145 //=======================================================================
146 //function : Share
147 //purpose  : 
148 //=======================================================================
149
150 void RWStepFEA_RWFeaModel::Share (const Handle(StepFEA_FeaModel) &ent,
151                                   Interface_EntityIterator& iter) const
152 {
153
154   // Inherited fields of Representation
155
156   for (Standard_Integer i1=1; i1 <= ent->StepRepr_Representation::NbItems(); i1++ ) {
157     Handle(StepRepr_RepresentationItem) Var0 = ent->StepRepr_Representation::Items()->Value(i1);
158     iter.AddItem (Var0);
159   }
160
161   iter.AddItem (ent->StepRepr_Representation::ContextOfItems());
162
163   // Own fields of FeaModel
164 }