1 // Created on : Thu Mar 24 18:30:11 2022
3 // Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0
4 // Copyright (c) Open CASCADE 2022
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <RWStepVisual_RWComplexTriangulatedSurfaceSet.hxx>
18 #include <StepVisual_ComplexTriangulatedSurfaceSet.hxx>
19 #include <Interface_EntityIterator.hxx>
20 #include <StepData_StepReaderData.hxx>
21 #include <StepData_StepWriter.hxx>
22 #include <TCollection_HAsciiString.hxx>
23 #include <StepVisual_CoordinatesList.hxx>
24 #include <Standard_Integer.hxx>
25 #include <TColStd_HArray2OfReal.hxx>
26 #include <TColStd_HArray1OfReal.hxx>
27 #include <Standard_Real.hxx>
28 #include <TColStd_HArray1OfInteger.hxx>
29 #include <TColStd_HArray2OfInteger.hxx>
31 //=======================================================================
32 //function : RWStepVisual_RWComplexTriangulatedSurfaceSet
34 //=======================================================================
36 RWStepVisual_RWComplexTriangulatedSurfaceSet::RWStepVisual_RWComplexTriangulatedSurfaceSet() {}
39 //=======================================================================
42 //=======================================================================
44 void RWStepVisual_RWComplexTriangulatedSurfaceSet::ReadStep(
45 const Handle(StepData_StepReaderData)& theData,
46 const Standard_Integer theNum,
47 Handle(Interface_Check)& theCheck,
48 const Handle(StepVisual_ComplexTriangulatedSurfaceSet)& theEnt) const
50 // Check number of parameters
51 if (!theData->CheckNbParams(theNum, 7, theCheck, "complex_triangulated_surface_set"))
56 // Inherited fields of RepresentationItem
58 Handle(TCollection_HAsciiString) aRepresentationItem_Name;
59 theData->ReadString(theNum, 1, "representation_item.name", theCheck, aRepresentationItem_Name);
61 // Inherited fields of TessellatedSurfaceSet
63 Handle(StepVisual_CoordinatesList) aTessellatedSurfaceSet_Coordinates;
64 theData->ReadEntity(theNum, 2, "tessellated_surface_set.coordinates", theCheck,
65 STANDARD_TYPE(StepVisual_CoordinatesList), aTessellatedSurfaceSet_Coordinates);
67 Standard_Integer aTessellatedSurfaceSet_Pnmax;
68 theData->ReadInteger(theNum, 3, "tessellated_surface_set.pnmax", theCheck, aTessellatedSurfaceSet_Pnmax);
70 Handle(TColStd_HArray2OfReal) aTessellatedSurfaceSet_Normals;
71 Standard_Integer sub4 = 0;
72 if (theData->ReadSubList(theNum, 4, "tessellated_surface_set.normals", theCheck, sub4))
74 Standard_Integer nb0 = theData->NbParams(sub4);
75 Standard_Integer nbj0 = theData->NbParams(theData->ParamNumber(sub4,1));
76 aTessellatedSurfaceSet_Normals = new TColStd_HArray2OfReal(1, nb0, 1, nbj0);
77 for (Standard_Integer i0 = 1; i0 <= nb0; i0++)
79 Standard_Integer subj4 = 0;
80 if ( theData->ReadSubList (sub4, i0, "sub-part(tessellated_surface_set.normals)", theCheck, subj4) ) {
81 Standard_Integer num4 = subj4;
82 for (Standard_Integer j0 = 1; j0 <= nbj0; j0++)
85 theData->ReadReal(num4, j0, "real", theCheck, anIt0);
86 aTessellatedSurfaceSet_Normals->SetValue(i0,j0, anIt0);
92 // Own fields of ComplexTriangulatedSurfaceSet
94 Handle(TColStd_HArray1OfInteger) aPnindex;
95 Standard_Integer sub5 = 0;
96 if (theData->ReadSubList(theNum, 5, "pnindex", theCheck, sub5))
98 Standard_Integer nb0 = theData->NbParams(sub5);
99 aPnindex = new TColStd_HArray1OfInteger(1, nb0);
100 Standard_Integer num2 = sub5;
101 for (Standard_Integer i0 = 1; i0 <= nb0; i0++)
103 Standard_Integer anIt0;
104 theData->ReadInteger(num2, i0, "integer", theCheck, anIt0);
105 aPnindex->SetValue(i0, anIt0);
109 Handle(TColStd_HArray2OfInteger) aTriangleStrips;
110 Standard_Integer sub6 = 0;
111 if (theData->ReadSubList(theNum, 6, "triangle_strips", theCheck, sub6))
113 Standard_Integer nb0 = theData->NbParams(sub6);
114 Standard_Integer nbj0 = theData->NbParams(theData->ParamNumber(sub6,1));
115 aTriangleStrips = new TColStd_HArray2OfInteger(1, nb0, 1, nbj0);
116 for (Standard_Integer i0 = 1; i0 <= nb0; i0++)
118 Standard_Integer subj6 = 0;
119 if ( theData->ReadSubList (sub6, i0, "sub-part(triangle_strips)", theCheck, subj6) ) {
120 Standard_Integer num4 = subj6;
121 for (Standard_Integer j0 = 1; j0 <= nbj0; j0++)
123 Standard_Integer anIt0;
124 theData->ReadInteger(num4, j0, "integer", theCheck, anIt0);
125 aTriangleStrips->SetValue(i0,j0, anIt0);
131 Handle(TColStd_HArray2OfInteger) aTriangleFans;
132 Standard_Integer sub7 = 0;
133 if (theData->ReadSubList(theNum, 7, "triangle_fans", theCheck, sub7))
135 Standard_Integer nb0 = theData->NbParams(sub7);
136 Standard_Integer nbj0 = theData->NbParams(theData->ParamNumber(sub7,1));
137 aTriangleFans = new TColStd_HArray2OfInteger(1, nb0, 1, nbj0);
138 for (Standard_Integer i0 = 1; i0 <= nb0; i0++)
140 Standard_Integer subj7 = 0;
141 if ( theData->ReadSubList (sub7, i0, "sub-part(triangle_fans)", theCheck, subj7) ) {
142 Standard_Integer num4 = subj7;
143 for (Standard_Integer j0 = 1; j0 <= nbj0; j0++)
145 Standard_Integer anIt0;
146 theData->ReadInteger(num4, j0, "integer", theCheck, anIt0);
147 aTriangleFans->SetValue(i0,j0, anIt0);
154 theEnt->Init(aRepresentationItem_Name, aTessellatedSurfaceSet_Coordinates, aTessellatedSurfaceSet_Pnmax, aTessellatedSurfaceSet_Normals, aPnindex, aTriangleStrips, aTriangleFans);
157 //=======================================================================
158 //function : WriteStep
160 //=======================================================================
162 void RWStepVisual_RWComplexTriangulatedSurfaceSet::WriteStep(
163 StepData_StepWriter& theSW,
164 const Handle(StepVisual_ComplexTriangulatedSurfaceSet)& theEnt) const
167 // Own fields of RepresentationItem
169 theSW.Send(theEnt->Name());
171 // Own fields of TessellatedSurfaceSet
173 theSW.Send(theEnt->Coordinates());
175 theSW.Send(theEnt->Pnmax());
178 for (Standard_Integer i3 = 1; i3 <= theEnt->Normals()->RowLength(); i3++)
180 theSW.NewLine(Standard_False);
182 for (Standard_Integer j3 = 1; j3 <= theEnt->Normals()->ColLength(); j3++)
184 Standard_Real Var0 = theEnt->Normals()->Value(i3,j3);
191 // Own fields of ComplexTriangulatedSurfaceSet
194 for (Standard_Integer i4 = 1; i4 <= theEnt->Pnindex()->Length(); i4++)
196 Standard_Integer Var0 = theEnt->Pnindex()->Value(i4);
202 for (Standard_Integer i5 = 1; i5 <= theEnt->TriangleStrips()->RowLength(); i5++)
204 theSW.NewLine(Standard_False);
206 for (Standard_Integer j5 = 1; j5 <= theEnt->TriangleStrips()->ColLength(); j5++)
208 Standard_Integer Var0 = theEnt->TriangleStrips()->Value(i5,j5);
216 for (Standard_Integer i6 = 1; i6 <= theEnt->TriangleFans()->RowLength(); i6++)
218 theSW.NewLine(Standard_False);
220 for (Standard_Integer j6 = 1; j6 <= theEnt->TriangleFans()->ColLength(); j6++)
222 Standard_Integer Var0 = theEnt->TriangleFans()->Value(i6,j6);
230 //=======================================================================
233 //=======================================================================
235 void RWStepVisual_RWComplexTriangulatedSurfaceSet::Share(
236 const Handle(StepVisual_ComplexTriangulatedSurfaceSet)&theEnt,
237 Interface_EntityIterator& theIter) const
240 // Inherited fields of RepresentationItem
242 // Inherited fields of TessellatedSurfaceSet
244 theIter.AddItem(theEnt->StepVisual_TessellatedSurfaceSet::Coordinates());
246 // Own fields of ComplexTriangulatedSurfaceSet