5df609e7 |
1 | // Created on: 2015-10-29 |
2 | // Created by: Irina KRYLOVA |
3 | // Copyright (c) 2015 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
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. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | |
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> |
27 | |
28 | //======================================================================= |
29 | //function : RWStepVisual_RWTessellatedGeometricSet |
30 | //purpose : |
31 | //======================================================================= |
32 | RWStepVisual_RWTessellatedGeometricSet::RWStepVisual_RWTessellatedGeometricSet () {} |
33 | |
34 | //======================================================================= |
35 | //function : ReadStep |
36 | //purpose : |
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 |
43 | { |
44 | // Number of Parameter Control |
45 | if (!data->CheckNbParams(num, 2, ach, "tessellated_geometric_set")) return; |
46 | |
47 | // Inherited field : name |
48 | Handle(TCollection_HAsciiString) aName; |
49 | data->ReadString (num, 1, "name", ach, aName); |
50 | |
b0cef606 |
51 | NCollection_Handle<StepVisual_Array1OfTessellatedItem> anItems; |
5df609e7 |
52 | Standard_Integer nsub2; |
53 | if (data->ReadSubList (num,2,"items",ach,nsub2)) { |
54 | Standard_Integer nb2 = data->NbParams(nsub2); |
b0cef606 |
55 | anItems = new StepVisual_Array1OfTessellatedItem(1, nb2); |
5df609e7 |
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); |
60 | } |
61 | } |
62 | |
63 | //--- Initialisation of the read entity --- |
64 | |
65 | |
66 | ent->Init(aName, anItems); |
67 | } |
68 | |
69 | //======================================================================= |
70 | //function : WriteStep |
71 | //purpose : |
72 | //======================================================================= |
73 | void RWStepVisual_RWTessellatedGeometricSet::WriteStep |
74 | (StepData_StepWriter& SW, |
75 | const Handle(StepVisual_TessellatedGeometricSet)& ent) const |
76 | { |
77 | // Inherited field : name |
78 | SW.Send(ent->Name()); |
79 | |
80 | // Own field : children |
81 | SW.OpenSub(); |
82 | for (Standard_Integer i = 1; i <= ent->Items()->Length(); i++) |
83 | SW.Send(ent->Items()->Value(i)); |
84 | SW.CloseSub(); |
85 | } |
86 | |
87 | //======================================================================= |
88 | //function : Share |
89 | //purpose : |
90 | //======================================================================= |
91 | void RWStepVisual_RWTessellatedGeometricSet::Share(const Handle(StepVisual_TessellatedGeometricSet)& ent, Interface_EntityIterator& iter) const |
92 | { |
93 | // Own field : children |
94 | for (Standard_Integer i = 1; i <= ent->Items()->Length(); i++) |
95 | iter.AddItem(ent->Items()->Value(i)); |
96 | } |