0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / RWStepFEA / RWStepFEA_RWElementGroup.cxx
CommitLineData
b311480e 1// Created on: 2002-12-12
2// Created by: data exchange team
973c2be1 3// Copyright (c) 2002-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 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
973c2be1 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.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
b311480e 15
7fd59977 16// Generator: ExpToCas (EXPRESS -> CASCADE/XSTEP Translator) V1.2
7fd59977 17
42cf5bc1 18#include <Interface_Check.hxx>
19#include <Interface_EntityIterator.hxx>
20#include <RWStepFEA_RWElementGroup.hxx>
21#include <StepData_StepReaderData.hxx>
22#include <StepData_StepWriter.hxx>
23#include <StepFEA_ElementGroup.hxx>
7fd59977 24#include <StepFEA_ElementRepresentation.hxx>
ec357c5c 25#include <StepFEA_FeaModel.hxx>
42cf5bc1 26#include <StepFEA_HArray1OfElementRepresentation.hxx>
7fd59977 27
28//=======================================================================
29//function : RWStepFEA_RWElementGroup
30//purpose :
31//=======================================================================
7fd59977 32RWStepFEA_RWElementGroup::RWStepFEA_RWElementGroup ()
33{
34}
35
36//=======================================================================
37//function : ReadStep
38//purpose :
39//=======================================================================
40
41void RWStepFEA_RWElementGroup::ReadStep (const Handle(StepData_StepReaderData)& data,
42 const Standard_Integer num,
43 Handle(Interface_Check)& ach,
44 const Handle(StepFEA_ElementGroup) &ent) const
45{
46 // Check number of parameters
47 if ( ! data->CheckNbParams(num,4,ach,"element_group") ) return;
48
49 // Inherited fields of Group
50
51 Handle(TCollection_HAsciiString) aGroup_Name;
52 data->ReadString (num, 1, "group.name", ach, aGroup_Name);
53
54 Handle(TCollection_HAsciiString) aGroup_Description;
55 data->ReadString (num, 2, "group.description", ach, aGroup_Description);
56
57 // Inherited fields of FeaGroup
58
59 Handle(StepFEA_FeaModel) aFeaGroup_ModelRef;
60 data->ReadEntity (num, 3, "fea_group.model_ref", ach, STANDARD_TYPE(StepFEA_FeaModel), aFeaGroup_ModelRef);
61
62 // Own fields of ElementGroup
63
64 Handle(StepFEA_HArray1OfElementRepresentation) aElements;
65 Standard_Integer sub4 = 0;
66 if ( data->ReadSubList (num, 4, "elements", ach, sub4) ) {
67 Standard_Integer nb0 = data->NbParams(sub4);
68 aElements = new StepFEA_HArray1OfElementRepresentation (1, nb0);
69 Standard_Integer num2 = sub4;
70 for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
71 Handle(StepFEA_ElementRepresentation) anIt0;
72 data->ReadEntity (num2, i0, "element_representation", ach, STANDARD_TYPE(StepFEA_ElementRepresentation), anIt0);
73 aElements->SetValue(i0, anIt0);
74 }
75 }
76
77 // Initialize entity
78 ent->Init(aGroup_Name,
79 aGroup_Description,
80 aFeaGroup_ModelRef,
81 aElements);
82}
83
84//=======================================================================
85//function : WriteStep
86//purpose :
87//=======================================================================
88
89void RWStepFEA_RWElementGroup::WriteStep (StepData_StepWriter& SW,
90 const Handle(StepFEA_ElementGroup) &ent) const
91{
92
93 // Inherited fields of Group
94
95 SW.Send (ent->StepBasic_Group::Name());
96
97 SW.Send (ent->StepBasic_Group::Description());
98
99 // Inherited fields of FeaGroup
100
101 SW.Send (ent->StepFEA_FeaGroup::ModelRef());
102
103 // Own fields of ElementGroup
104
105 SW.OpenSub();
106 for (Standard_Integer i3=1; i3 <= ent->Elements()->Length(); i3++ ) {
107 Handle(StepFEA_ElementRepresentation) Var0 = ent->Elements()->Value(i3);
108 SW.Send (Var0);
109 }
110 SW.CloseSub();
111}
112
113//=======================================================================
114//function : Share
115//purpose :
116//=======================================================================
117
118void RWStepFEA_RWElementGroup::Share (const Handle(StepFEA_ElementGroup) &ent,
119 Interface_EntityIterator& iter) const
120{
121
122 // Inherited fields of Group
123
124 // Inherited fields of FeaGroup
125
126 iter.AddItem (ent->StepFEA_FeaGroup::ModelRef());
127
128 // Own fields of ElementGroup
129
130 for (Standard_Integer i2=1; i2 <= ent->Elements()->Length(); i2++ ) {
131 Handle(StepFEA_ElementRepresentation) Var0 = ent->Elements()->Value(i2);
132 iter.AddItem (Var0);
133 }
134}