0027232: Configuration - fix mblen missing building issue on Android
[occt.git] / src / RWStepShape / RWStepShape_RWFacetedBrepAndBrepWithVoids.cxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14
15 #include <Interface_Check.hxx>
16 #include <Interface_EntityIterator.hxx>
17 #include <RWStepShape_RWFacetedBrepAndBrepWithVoids.hxx>
18 #include <StepData_StepReaderData.hxx>
19 #include <StepData_StepWriter.hxx>
20 #include <StepShape_BrepWithVoids.hxx>
21 #include <StepShape_ClosedShell.hxx>
22 #include <StepShape_FacetedBrep.hxx>
23 #include <StepShape_FacetedBrepAndBrepWithVoids.hxx>
24 #include <StepShape_HArray1OfOrientedClosedShell.hxx>
25 #include <StepShape_OrientedClosedShell.hxx>
26
27 RWStepShape_RWFacetedBrepAndBrepWithVoids::RWStepShape_RWFacetedBrepAndBrepWithVoids () {}
28
29 void RWStepShape_RWFacetedBrepAndBrepWithVoids::ReadStep
30         (const Handle(StepData_StepReaderData)& data,
31          const Standard_Integer num0,
32          Handle(Interface_Check)& ach,
33          const Handle(StepShape_FacetedBrepAndBrepWithVoids)& ent) const
34 {
35
36         Standard_Integer num = num0;
37
38
39         // --- Instance of plex componant BrepWithVoids ---
40
41         if (!data->CheckNbParams(num,1,ach,"brep_with_voids")) return;
42
43         // --- field : voids ---
44
45         Handle(StepShape_HArray1OfOrientedClosedShell) aVoids;
46         Handle(StepShape_OrientedClosedShell) anent;
47         Standard_Integer nsub1;
48         if (data->ReadSubList (num,1,"voids",ach,nsub1)) {
49           Standard_Integer nb1 = data->NbParams(nsub1);
50           aVoids = new StepShape_HArray1OfOrientedClosedShell (1, nb1);
51           for (Standard_Integer i1 = 1; i1 <= nb1; i1 ++) {
52             //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed
53             if (data->ReadEntity (nsub1, i1,"oriented_closed_shell", ach,
54                                   STANDARD_TYPE(StepShape_OrientedClosedShell), anent))
55               aVoids->SetValue(i1, anent);
56           }
57         }
58
59         num = data->NextForComplex(num);
60
61         // --- Instance of plex componant FacetedBrep ---
62
63         if (!data->CheckNbParams(num,0,ach,"faceted_brep")) return;
64
65         num = data->NextForComplex(num);
66
67         // --- Instance of plex componant GeometricRepresentationItem ---
68
69         if (!data->CheckNbParams(num,0,ach,"geometric_representation_item")) return;
70
71         num = data->NextForComplex(num);
72
73         // --- Instance of common supertype ManifoldSolidBrep ---
74
75         if (!data->CheckNbParams(num,1,ach,"manifold_solid_brep")) return;
76         // --- field : outer ---
77
78
79         Handle(StepShape_ClosedShell) aOuter;
80         //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed
81         data->ReadEntity(num, 1,"outer", ach, STANDARD_TYPE(StepShape_ClosedShell), aOuter);
82
83         num = data->NextForComplex(num);
84
85         // --- Instance of plex componant RepresentationItem ---
86
87         if (!data->CheckNbParams(num,1,ach,"representation_item")) return;
88
89
90         // --- field : name ---
91
92         Handle(TCollection_HAsciiString) aName;
93         //szv#4:S4163:12Mar99 `Standard_Boolean stat10 =` not needed
94         data->ReadString (num,1,"name",ach,aName);
95         
96         num = data->NextForComplex(num);
97
98         // --- Instance of plex componant SolidModel ---
99
100         if (!data->CheckNbParams(num,0,ach,"solid_model")) return;
101
102         //--- Initialisation of the red entity ---
103
104         ent->Init(aName, aOuter,aVoids);
105 }
106
107
108 void RWStepShape_RWFacetedBrepAndBrepWithVoids::WriteStep
109         (StepData_StepWriter& SW,
110          const Handle(StepShape_FacetedBrepAndBrepWithVoids)& ent) const
111 {
112
113         // --- Instance of plex componant BrepWithVoids ---
114
115         SW.StartEntity("BREP_WITH_VOIDS");
116         // --- field : voids ---
117
118         SW.OpenSub();
119         for (Standard_Integer i1 = 1;  i1 <= ent->NbVoids();  i1 ++) {
120           SW.Send(ent->VoidsValue(i1));
121         }
122         SW.CloseSub();
123
124         // --- Instance of plex componant FacetedBrep ---
125
126         SW.StartEntity("FACETED_BREP");
127
128         // --- Instance of plex componant GeometricRepresentationItem ---
129
130         SW.StartEntity("GEOMETRIC_REPRESENTATION_ITEM");
131
132         // --- Instance of common supertype ManifoldSolidBrep ---
133
134         SW.StartEntity("MANIFOLD_SOLID_BREP");
135         // --- field : outer ---
136
137         SW.Send(ent->Outer());
138
139         // --- Instance of plex componant RepresentationItem ---
140
141         SW.StartEntity("REPRESENTATION_ITEM");
142         // --- field : name ---
143
144         SW.Send(ent->Name());
145
146         // --- Instance of plex componant SolidModel ---
147
148         SW.StartEntity("SOLID_MODEL");
149 }
150
151
152 void RWStepShape_RWFacetedBrepAndBrepWithVoids::Share(const Handle(StepShape_FacetedBrepAndBrepWithVoids)& ent, Interface_EntityIterator& iter) const
153 {
154
155         iter.GetOneItem(ent->Outer());
156         
157         Standard_Integer nbElem2 = ent->NbVoids();
158         for (Standard_Integer is2=1; is2<=nbElem2; is2 ++) {
159           iter.GetOneItem(ent->VoidsValue(is2));
160         }
161
162 }
163