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