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_RWTessellatedShapeRepresentationWithAccuracyParameters.hxx>
18 #include <StepVisual_TessellatedShapeRepresentationWithAccuracyParameters.hxx>
19 #include <Interface_EntityIterator.hxx>
20 #include <StepData_StepReaderData.hxx>
21 #include <StepData_StepWriter.hxx>
22 #include <TCollection_HAsciiString.hxx>
23 #include <StepRepr_HArray1OfRepresentationItem.hxx>
24 #include <StepRepr_RepresentationItem.hxx>
25 #include <StepRepr_RepresentationContext.hxx>
27 //=======================================================================
28 //function : RWStepVisual_RWTessellatedShapeRepresentationWithAccuracyParameters
30 //=======================================================================
32 RWStepVisual_RWTessellatedShapeRepresentationWithAccuracyParameters::RWStepVisual_RWTessellatedShapeRepresentationWithAccuracyParameters() {}
35 //=======================================================================
38 //=======================================================================
40 void RWStepVisual_RWTessellatedShapeRepresentationWithAccuracyParameters::ReadStep(
41 const Handle(StepData_StepReaderData)& theData,
42 const Standard_Integer theNum,
43 Handle(Interface_Check)& theCheck,
44 const Handle(StepVisual_TessellatedShapeRepresentationWithAccuracyParameters)& theEnt) const
46 // Check number of parameters
47 if (!theData->CheckNbParams(theNum, 4, theCheck, "tessellated_shape_representation_with_accuracy_parameters"))
52 // Inherited fields of Representation
54 Handle(TCollection_HAsciiString) aRepresentation_Name;
55 theData->ReadString(theNum, 1, "representation.name", theCheck, aRepresentation_Name);
57 Handle(StepRepr_HArray1OfRepresentationItem) aRepresentation_Items;
58 Standard_Integer sub2 = 0;
59 if (theData->ReadSubList(theNum, 2, "representation.items", theCheck, sub2))
61 Standard_Integer nb0 = theData->NbParams(sub2);
62 aRepresentation_Items = new StepRepr_HArray1OfRepresentationItem(1, nb0);
63 Standard_Integer num2 = sub2;
64 for (Standard_Integer i0 = 1; i0 <= nb0; i0++)
66 Handle(StepRepr_RepresentationItem) anIt0;
67 theData->ReadEntity(num2, i0, "representation_item", theCheck,
68 STANDARD_TYPE(StepRepr_RepresentationItem), anIt0);
69 aRepresentation_Items->SetValue(i0, anIt0);
73 Handle(StepRepr_RepresentationContext) aRepresentation_ContextOfItems;
74 theData->ReadEntity(theNum, 3, "representation.context_of_items", theCheck,
75 STANDARD_TYPE(StepRepr_RepresentationContext), aRepresentation_ContextOfItems);
77 // Own fields of TessellatedShapeRepresentationWithAccuracyParameters
79 Handle(TColStd_HArray1OfReal) aTessellationAccuracyParameters;
80 Standard_Integer sub4 = 0;
81 if (theData->ReadSubList(theNum, 4, "tessellation_accuracy_parameters", theCheck, sub4))
83 Standard_Integer nb0 = theData->NbParams(sub4);
84 aTessellationAccuracyParameters = new TColStd_HArray1OfReal(1, nb0);
85 Standard_Integer num2 = sub4;
86 for (Standard_Integer i0 = 1; i0 <= nb0; i0++)
89 theData->ReadReal(num2, i0, "tessellation_accuracy_parameter_item", theCheck, anIt0);
90 aTessellationAccuracyParameters->SetValue(i0, anIt0);
95 theEnt->Init(aRepresentation_Name, aRepresentation_Items, aRepresentation_ContextOfItems, aTessellationAccuracyParameters);
98 //=======================================================================
99 //function : WriteStep
101 //=======================================================================
103 void RWStepVisual_RWTessellatedShapeRepresentationWithAccuracyParameters::WriteStep(
104 StepData_StepWriter& theSW,
105 const Handle(StepVisual_TessellatedShapeRepresentationWithAccuracyParameters)& theEnt) const
108 // Own fields of Representation
110 theSW.Send(theEnt->Name());
113 for (Standard_Integer i1 = 1; i1 <= theEnt->Items()->Length(); i1++)
115 Handle(StepRepr_RepresentationItem) Var0 = theEnt->Items()->Value(i1);
120 theSW.Send(theEnt->ContextOfItems());
122 // Own fields of TessellatedShapeRepresentationWithAccuracyParameters
125 for (Standard_Integer i3 = 1; i3 <= theEnt->TessellationAccuracyParameters()->Length(); i3++)
127 Standard_Real Var0 = theEnt->TessellationAccuracyParameters()->Value(i3);
133 //=======================================================================
136 //=======================================================================
138 void RWStepVisual_RWTessellatedShapeRepresentationWithAccuracyParameters::Share(
139 const Handle(StepVisual_TessellatedShapeRepresentationWithAccuracyParameters)&theEnt,
140 Interface_EntityIterator& theIter) const
143 // Inherited fields of Representation
145 for (Standard_Integer i1 = 1; i1 <= theEnt->StepRepr_Representation::Items()->Length(); i1++)
147 Handle(StepRepr_RepresentationItem) Var0 = theEnt->StepRepr_Representation::Items()->Value(i1);
148 theIter.AddItem(Var0);
151 theIter.AddItem(theEnt->StepRepr_Representation::ContextOfItems());