1 // Created on: 2015-10-29
2 // Created by: Irina KRYLOVA
3 // Copyright (c) 2015 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
17 #include <Interface_Check.hxx>
18 #include <Interface_EntityIterator.hxx>
19 #include <RWStepVisual_RWTessellatedGeometricSet.hxx>
20 #include <StepData_StepReaderData.hxx>
21 #include <StepData_StepWriter.hxx>
22 #include <StepRepr_RepresentationItem.hxx>
23 #include <StepVisual_HArray1OfPresentationStyleAssignment.hxx>
24 #include <StepVisual_PresentationStyleAssignment.hxx>
25 #include <StepVisual_TessellatedGeometricSet.hxx>
26 #include <StepVisual_TessellatedItem.hxx>
28 //=======================================================================
29 //function : RWStepVisual_RWTessellatedGeometricSet
31 //=======================================================================
32 RWStepVisual_RWTessellatedGeometricSet::RWStepVisual_RWTessellatedGeometricSet () {}
34 //=======================================================================
37 //=======================================================================
38 void RWStepVisual_RWTessellatedGeometricSet::ReadStep
39 (const Handle(StepData_StepReaderData)& data,
40 const Standard_Integer num,
41 Handle(Interface_Check)& ach,
42 const Handle(StepVisual_TessellatedGeometricSet)& ent) const
44 // Number of Parameter Control
45 if (!data->CheckNbParams(num, 2, ach, "tessellated_geometric_set")) return;
47 // Inherited field : name
48 Handle(TCollection_HAsciiString) aName;
49 data->ReadString (num, 1, "name", ach, aName);
51 NCollection_Handle<StepVisual_Array1OfTessellaltedItem> anItems;
52 Standard_Integer nsub2;
53 if (data->ReadSubList (num,2,"items",ach,nsub2)) {
54 Standard_Integer nb2 = data->NbParams(nsub2);
55 anItems = new StepVisual_Array1OfTessellaltedItem(1, nb2);
56 for (Standard_Integer i2 = 1; i2 <= nb2; i2 ++) {
57 Handle(StepVisual_TessellatedItem) anItem;// = new StepVisual_TesselatedItem;
58 if (data->ReadEntity (nsub2,i2,"item",ach,STANDARD_TYPE(StepVisual_TessellatedItem), anItem))
59 anItems->SetValue(i2,anItem);
63 //--- Initialisation of the read entity ---
66 ent->Init(aName, anItems);
69 //=======================================================================
70 //function : WriteStep
72 //=======================================================================
73 void RWStepVisual_RWTessellatedGeometricSet::WriteStep
74 (StepData_StepWriter& SW,
75 const Handle(StepVisual_TessellatedGeometricSet)& ent) const
77 // Inherited field : name
80 // Own field : children
82 for (Standard_Integer i = 1; i <= ent->Items()->Length(); i++)
83 SW.Send(ent->Items()->Value(i));
87 //=======================================================================
90 //=======================================================================
91 void RWStepVisual_RWTessellatedGeometricSet::Share(const Handle(StepVisual_TessellatedGeometricSet)& ent, Interface_EntityIterator& iter) const
93 // Own field : children
94 for (Standard_Integer i = 1; i <= ent->Items()->Length(); i++)
95 iter.AddItem(ent->Items()->Value(i));