1 // Created on : Thu Mar 24 18:30:12 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_RWTessellatedConnectingEdge.hxx>
18 #include <StepVisual_TessellatedConnectingEdge.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 <StepVisual_EdgeOrCurve.hxx>
25 #include <TColStd_HArray1OfInteger.hxx>
26 #include <Standard_Integer.hxx>
27 #include <StepData_Logical.hxx>
28 #include <StepVisual_TessellatedFace.hxx>
30 //=======================================================================
31 //function : RWStepVisual_RWTessellatedConnectingEdge
33 //=======================================================================
35 RWStepVisual_RWTessellatedConnectingEdge::RWStepVisual_RWTessellatedConnectingEdge() {}
38 //=======================================================================
41 //=======================================================================
43 void RWStepVisual_RWTessellatedConnectingEdge::ReadStep(
44 const Handle(StepData_StepReaderData)& theData,
45 const Standard_Integer theNum,
46 Handle(Interface_Check)& theCheck,
47 const Handle(StepVisual_TessellatedConnectingEdge)& theEnt) const
49 // Check number of parameters
50 if (!theData->CheckNbParams(theNum, 9, theCheck, "tessellated_connecting_edge"))
55 // Inherited fields of RepresentationItem
57 Handle(TCollection_HAsciiString) aRepresentationItem_Name;
58 theData->ReadString(theNum, 1, "representation_item.name", theCheck, aRepresentationItem_Name);
60 // Inherited fields of TessellatedEdge
62 Handle(StepVisual_CoordinatesList) aTessellatedEdge_Coordinates;
63 theData->ReadEntity(theNum, 2, "tessellated_edge.coordinates", theCheck,
64 STANDARD_TYPE(StepVisual_CoordinatesList), aTessellatedEdge_Coordinates);
66 StepVisual_EdgeOrCurve aTessellatedEdge_GeometricLink;
67 Standard_Boolean hasTessellatedEdge_GeometricLink = Standard_True;
68 if (theData->IsParamDefined(theNum, 3))
70 theData->ReadEntity(theNum, 3, "tessellated_edge.geometric_link", theCheck, aTessellatedEdge_GeometricLink);
74 hasTessellatedEdge_GeometricLink = Standard_False;
75 aTessellatedEdge_GeometricLink = StepVisual_EdgeOrCurve();
78 Handle(TColStd_HArray1OfInteger) aTessellatedEdge_LineStrip;
79 Standard_Integer sub4 = 0;
80 if (theData->ReadSubList(theNum, 4, "tessellated_edge.line_strip", theCheck, sub4))
82 Standard_Integer nb0 = theData->NbParams(sub4);
83 aTessellatedEdge_LineStrip = new TColStd_HArray1OfInteger(1, nb0);
84 Standard_Integer num2 = sub4;
85 for (Standard_Integer i0 = 1; i0 <= nb0; i0++)
87 Standard_Integer anIt0;
88 theData->ReadInteger(num2, i0, "integer", theCheck, anIt0);
89 aTessellatedEdge_LineStrip->SetValue(i0, anIt0);
93 // Own fields of TessellatedConnectingEdge
95 StepData_Logical aSmooth;
96 theData->ReadLogical(theNum, 5, "smooth", theCheck, aSmooth);
98 Handle(StepVisual_TessellatedFace) aFace1;
99 theData->ReadEntity(theNum, 6, "face1", theCheck,
100 STANDARD_TYPE(StepVisual_TessellatedFace), aFace1);
102 Handle(StepVisual_TessellatedFace) aFace2;
103 theData->ReadEntity(theNum, 7, "face2", theCheck,
104 STANDARD_TYPE(StepVisual_TessellatedFace), aFace2);
106 Handle(TColStd_HArray1OfInteger) aLineStripFace1;
107 Standard_Integer sub8 = 0;
108 if (theData->ReadSubList(theNum, 8, "line_strip_face1", theCheck, sub8))
110 Standard_Integer nb0 = theData->NbParams(sub8);
111 aLineStripFace1 = new TColStd_HArray1OfInteger(1, nb0);
112 Standard_Integer num2 = sub8;
113 for (Standard_Integer i0 = 1; i0 <= nb0; i0++)
115 Standard_Integer anIt0;
116 theData->ReadInteger(num2, i0, "integer", theCheck, anIt0);
117 aLineStripFace1->SetValue(i0, anIt0);
121 Handle(TColStd_HArray1OfInteger) aLineStripFace2;
122 Standard_Integer sub9 = 0;
123 if (theData->ReadSubList(theNum, 9, "line_strip_face2", theCheck, sub9))
125 Standard_Integer nb0 = theData->NbParams(sub9);
126 aLineStripFace2 = new TColStd_HArray1OfInteger(1, nb0);
127 Standard_Integer num2 = sub9;
128 for (Standard_Integer i0 = 1; i0 <= nb0; i0++)
130 Standard_Integer anIt0;
131 theData->ReadInteger(num2, i0, "integer", theCheck, anIt0);
132 aLineStripFace2->SetValue(i0, anIt0);
137 theEnt->Init(aRepresentationItem_Name, aTessellatedEdge_Coordinates, hasTessellatedEdge_GeometricLink, aTessellatedEdge_GeometricLink, aTessellatedEdge_LineStrip, aSmooth, aFace1, aFace2, aLineStripFace1, aLineStripFace2);
140 //=======================================================================
141 //function : WriteStep
143 //=======================================================================
145 void RWStepVisual_RWTessellatedConnectingEdge::WriteStep(
146 StepData_StepWriter& theSW,
147 const Handle(StepVisual_TessellatedConnectingEdge)& theEnt) const
150 // Own fields of RepresentationItem
152 theSW.Send(theEnt->Name());
154 // Own fields of TessellatedEdge
156 theSW.Send(theEnt->Coordinates());
158 if (theEnt->HasGeometricLink())
160 theSW.Send(theEnt->GeometricLink().Value());
168 for (Standard_Integer i3 = 1; i3 <= theEnt->LineStrip()->Length(); i3++)
170 Standard_Integer Var0 = theEnt->LineStrip()->Value(i3);
175 // Own fields of TessellatedConnectingEdge
177 theSW.SendLogical(theEnt->Smooth());
179 theSW.Send(theEnt->Face1());
181 theSW.Send(theEnt->Face2());
184 for (Standard_Integer i7 = 1; i7 <= theEnt->LineStripFace1()->Length(); i7++)
186 Standard_Integer Var0 = theEnt->LineStripFace1()->Value(i7);
192 for (Standard_Integer i8 = 1; i8 <= theEnt->LineStripFace2()->Length(); i8++)
194 Standard_Integer Var0 = theEnt->LineStripFace2()->Value(i8);
200 //=======================================================================
203 //=======================================================================
205 void RWStepVisual_RWTessellatedConnectingEdge::Share(
206 const Handle(StepVisual_TessellatedConnectingEdge)&theEnt,
207 Interface_EntityIterator& theIter) const
210 // Inherited fields of RepresentationItem
212 // Inherited fields of TessellatedEdge
214 theIter.AddItem(theEnt->StepVisual_TessellatedEdge::Coordinates());
216 if (theEnt->StepVisual_TessellatedEdge::HasGeometricLink())
218 theIter.AddItem(theEnt->StepVisual_TessellatedEdge::GeometricLink().Value());
221 // Own fields of TessellatedConnectingEdge
223 theIter.AddItem(theEnt->Face1());
225 theIter.AddItem(theEnt->Face2());