0023022: This is desirable to access OpenGl extensions and core API (1.2+) in one...
[occt.git] / src / RWStepShape / RWStepShape_RWPolyLoop.cxx
1
2 #include <RWStepShape_RWPolyLoop.ixx>
3 #include <StepGeom_HArray1OfCartesianPoint.hxx>
4 #include <StepGeom_CartesianPoint.hxx>
5
6
7 #include <Interface_EntityIterator.hxx>
8
9
10 #include <StepShape_PolyLoop.hxx>
11
12
13 RWStepShape_RWPolyLoop::RWStepShape_RWPolyLoop () {}
14
15 void RWStepShape_RWPolyLoop::ReadStep
16         (const Handle(StepData_StepReaderData)& data,
17          const Standard_Integer num,
18          Handle(Interface_Check)& ach,
19          const Handle(StepShape_PolyLoop)& ent) const
20 {
21
22
23         // --- Number of Parameter Control ---
24
25         if (!data->CheckNbParams(num,2,ach,"poly_loop")) 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         // --- own field : polygon ---
34
35         Handle(StepGeom_HArray1OfCartesianPoint) aPolygon;
36         Handle(StepGeom_CartesianPoint) anent2;
37         Standard_Integer nsub2;
38         if (data->ReadSubList (num,2,"polygon",ach,nsub2)) {
39           Standard_Integer nb2 = data->NbParams(nsub2);
40           aPolygon = new StepGeom_HArray1OfCartesianPoint (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,"cartesian_point", ach, STANDARD_TYPE(StepGeom_CartesianPoint), anent2))
44               aPolygon->SetValue(i2, anent2);
45           }
46         }
47
48         //--- Initialisation of the read entity ---
49
50
51         ent->Init(aName, aPolygon);
52 }
53
54
55 void RWStepShape_RWPolyLoop::WriteStep
56         (StepData_StepWriter& SW,
57          const Handle(StepShape_PolyLoop)& ent) const
58 {
59
60         // --- inherited field name ---
61
62         SW.Send(ent->Name());
63
64         // --- own field : polygon ---
65
66         SW.OpenSub();
67         for (Standard_Integer i2 = 1;  i2 <= ent->NbPolygon();  i2 ++) {
68           SW.Send(ent->PolygonValue(i2));
69         }
70         SW.CloseSub();
71 }
72
73
74 void RWStepShape_RWPolyLoop::Share(const Handle(StepShape_PolyLoop)& ent, Interface_EntityIterator& iter) const
75 {
76
77         Standard_Integer nbElem1 = ent->NbPolygon();
78         for (Standard_Integer is1=1; is1<=nbElem1; is1 ++) {
79           iter.GetOneItem(ent->PolygonValue(is1));
80         }
81
82 }
83