0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / RWStepFEA / RWStepFEA_RWNodeGroup.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_RWNodeGroup.hxx>
21 #include <StepData_StepReaderData.hxx>
22 #include <StepData_StepWriter.hxx>
23 #include <StepFEA_FeaModel.hxx>
24 #include <StepFEA_HArray1OfNodeRepresentation.hxx>
25 #include <StepFEA_NodeGroup.hxx>
26 #include <StepFEA_NodeRepresentation.hxx>
27
28 //=======================================================================
29 //function : RWStepFEA_RWNodeGroup
30 //purpose  : 
31 //=======================================================================
32 RWStepFEA_RWNodeGroup::RWStepFEA_RWNodeGroup ()
33 {
34 }
35
36 //=======================================================================
37 //function : ReadStep
38 //purpose  : 
39 //=======================================================================
40
41 void RWStepFEA_RWNodeGroup::ReadStep (const Handle(StepData_StepReaderData)& data,
42                                       const Standard_Integer num,
43                                       Handle(Interface_Check)& ach,
44                                       const Handle(StepFEA_NodeGroup) &ent) const
45 {
46   // Check number of parameters
47   if ( ! data->CheckNbParams(num,4,ach,"node_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 NodeGroup
63
64   Handle(StepFEA_HArray1OfNodeRepresentation) aNodes;
65   Standard_Integer sub4 = 0;
66   if ( data->ReadSubList (num, 4, "nodes", ach, sub4) ) {
67     Standard_Integer nb0 = data->NbParams(sub4);
68     aNodes = new StepFEA_HArray1OfNodeRepresentation (1, nb0);
69     Standard_Integer num2 = sub4;
70     for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
71       Handle(StepFEA_NodeRepresentation) anIt0;
72       data->ReadEntity (num2, i0, "node_representation", ach, STANDARD_TYPE(StepFEA_NodeRepresentation), anIt0);
73       aNodes->SetValue(i0, anIt0);
74     }
75   }
76
77   // Initialize entity
78   ent->Init(aGroup_Name,
79             aGroup_Description,
80             aFeaGroup_ModelRef,
81             aNodes);
82 }
83
84 //=======================================================================
85 //function : WriteStep
86 //purpose  : 
87 //=======================================================================
88
89 void RWStepFEA_RWNodeGroup::WriteStep (StepData_StepWriter& SW,
90                                        const Handle(StepFEA_NodeGroup) &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 NodeGroup
104
105   SW.OpenSub();
106   for (Standard_Integer i3=1; i3 <= ent->Nodes()->Length(); i3++ ) {
107     Handle(StepFEA_NodeRepresentation) Var0 = ent->Nodes()->Value(i3);
108     SW.Send (Var0);
109   }
110   SW.CloseSub();
111 }
112
113 //=======================================================================
114 //function : Share
115 //purpose  : 
116 //=======================================================================
117
118 void RWStepFEA_RWNodeGroup::Share (const Handle(StepFEA_NodeGroup) &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 NodeGroup
129
130   for (Standard_Integer i2=1; i2 <= ent->Nodes()->Length(); i2++ ) {
131     Handle(StepFEA_NodeRepresentation) Var0 = ent->Nodes()->Value(i2);
132     iter.AddItem (Var0);
133   }
134 }