0023022: This is desirable to access OpenGl extensions and core API (1.2+) in one...
[occt.git] / src / RWStepShape / RWStepShape_RWGeometricCurveSet.cxx
1
2 #include <RWStepShape_RWGeometricCurveSet.ixx>
3 #include <StepShape_HArray1OfGeometricSetSelect.hxx>
4 #include <StepShape_GeometricSetSelect.hxx>
5
6
7 #include <Interface_EntityIterator.hxx>
8
9
10 #include <StepShape_GeometricCurveSet.hxx>
11
12
13 RWStepShape_RWGeometricCurveSet::RWStepShape_RWGeometricCurveSet () {}
14
15 void RWStepShape_RWGeometricCurveSet::ReadStep
16         (const Handle(StepData_StepReaderData)& data,
17          const Standard_Integer num,
18          Handle(Interface_Check)& ach,
19          const Handle(StepShape_GeometricCurveSet)& ent) const
20 {
21
22
23         // --- Number of Parameter Control ---
24
25         if (!data->CheckNbParams(num,2,ach,"geometric_curve_set")) return;
26
27         // --- inherited field : name ---
28
29         Handle(TCollection_HAsciiString) aName;
30         //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed
31         data->ReadString (num,1,"name",ach,aName);
32
33         // --- inherited field : elements ---
34
35         Handle(StepShape_HArray1OfGeometricSetSelect) aElements;
36         StepShape_GeometricSetSelect aElementsItem;
37         Standard_Integer nsub2;
38         if (data->ReadSubList (num,2,"elements",ach,nsub2)) {
39           Standard_Integer nb2 = data->NbParams(nsub2);
40           aElements = new StepShape_HArray1OfGeometricSetSelect (1, nb2);
41           for (Standard_Integer i2 = 1; i2 <= nb2; i2 ++) {
42             //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed
43             if (data->ReadEntity (nsub2,i2,"elements",ach,aElementsItem))
44               aElements->SetValue(i2,aElementsItem);
45           }
46         }
47
48         //--- Initialisation of the read entity ---
49
50
51         ent->Init(aName, aElements);
52 }
53
54
55 void RWStepShape_RWGeometricCurveSet::WriteStep
56         (StepData_StepWriter& SW,
57          const Handle(StepShape_GeometricCurveSet)& ent) const
58 {
59
60         // --- inherited field name ---
61
62         SW.Send(ent->Name());
63
64         // --- inherited field elements ---
65
66         SW.OpenSub();
67         for (Standard_Integer i2 = 1;  i2 <= ent->NbElements();  i2 ++) {
68           SW.Send(ent->ElementsValue(i2).Value());
69         }
70         SW.CloseSub();
71 }
72
73
74 void RWStepShape_RWGeometricCurveSet::Share(const Handle(StepShape_GeometricCurveSet)& ent, Interface_EntityIterator& iter) const
75 {
76
77         Standard_Integer nbElem1 = ent->NbElements();
78         for (Standard_Integer is1=1; is1<=nbElem1; is1 ++) {
79           iter.GetOneItem(ent->ElementsValue(is1).Value());
80         }
81
82 }
83