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 | #include <Interface_Check.hxx> |
17 | #include <Interface_EntityIterator.hxx> |
18 | #include <RWStepVisual_RWTessellatedAnnotationOccurrence.hxx> |
19 | #include <StepData_StepReaderData.hxx> |
20 | #include <StepData_StepWriter.hxx> |
21 | #include <StepRepr_RepresentationItem.hxx> |
22 | #include <StepVisual_HArray1OfPresentationStyleAssignment.hxx> |
23 | #include <StepVisual_PresentationStyleAssignment.hxx> |
24 | #include <StepVisual_TessellatedAnnotationOccurrence.hxx> |
25 | |
26 | //======================================================================= |
27 | //function : RWStepVisual_RWTessellatedAnnotationOccurrence |
28 | //purpose : |
29 | //======================================================================= |
30 | RWStepVisual_RWTessellatedAnnotationOccurrence::RWStepVisual_RWTessellatedAnnotationOccurrence () {} |
31 | |
32 | //======================================================================= |
33 | //function : ReadStep |
34 | //purpose : |
35 | //======================================================================= |
36 | void RWStepVisual_RWTessellatedAnnotationOccurrence::ReadStep |
37 | (const Handle(StepData_StepReaderData)& data, |
38 | const Standard_Integer num, |
39 | Handle(Interface_Check)& ach, |
40 | const Handle(StepVisual_TessellatedAnnotationOccurrence)& ent) const |
41 | { |
42 | |
43 | // Number of Parameter Control |
44 | if (!data->CheckNbParams(num, 3, ach, "styled_item")) return; |
45 | |
46 | // Inherited field : name |
47 | Handle(TCollection_HAsciiString) aName; |
48 | data->ReadString (num, 1, "name", ach, aName); |
49 | |
50 | // Inherited field : styles |
51 | Handle(StepVisual_HArray1OfPresentationStyleAssignment) aStyles; |
52 | Handle(StepVisual_PresentationStyleAssignment) anent2; |
53 | Standard_Integer nsub2; |
54 | if (data->ReadSubList (num,2,"styles",ach,nsub2)) { |
55 | Standard_Integer nb2 = data->NbParams(nsub2); |
56 | aStyles = new StepVisual_HArray1OfPresentationStyleAssignment (1, nb2); |
57 | for (Standard_Integer i2 = 1; i2 <= nb2; i2 ++) { |
58 | if (data->ReadEntity (nsub2, i2,"presentation_style_assignment", ach, |
59 | STANDARD_TYPE(StepVisual_PresentationStyleAssignment), anent2)) |
60 | aStyles->SetValue(i2, anent2); |
61 | } |
62 | } |
63 | |
64 | // Inherited field : item |
d658f275 |
65 | Handle(MMgt_TShared) aItem; |
66 | data->ReadEntity(num, 3,"item", ach, STANDARD_TYPE(MMgt_TShared), aItem); |
5df609e7 |
67 | |
68 | // Initialisation of the read entity |
69 | ent->Init(aName, aStyles, aItem); |
70 | } |
71 | |
72 | //======================================================================= |
73 | //function : WriteStep |
74 | //purpose : |
75 | //======================================================================= |
76 | void RWStepVisual_RWTessellatedAnnotationOccurrence::WriteStep |
77 | (StepData_StepWriter& SW, |
78 | const Handle(StepVisual_TessellatedAnnotationOccurrence)& ent) const |
79 | { |
80 | //Inherited field : name |
81 | SW.Send(ent->Name()); |
82 | |
83 | // Inherited field : styles |
84 | SW.OpenSub(); |
85 | for (Standard_Integer i2 = 1; i2 <= ent->NbStyles(); i2 ++) { |
86 | SW.Send(ent->StylesValue(i2)); |
87 | } |
88 | SW.CloseSub(); |
89 | |
90 | // Inherited field : item |
91 | |
92 | SW.Send(ent->Item()); |
93 | } |
94 | |
95 | //======================================================================= |
96 | //function : Share |
97 | //purpose : |
98 | //======================================================================= |
99 | void RWStepVisual_RWTessellatedAnnotationOccurrence::Share(const Handle(StepVisual_TessellatedAnnotationOccurrence)& ent, Interface_EntityIterator& iter) const |
100 | { |
101 | |
102 | Standard_Integer nbElem1 = ent->NbStyles(); |
103 | for (Standard_Integer is1=1; is1<=nbElem1; is1 ++) { |
104 | iter.GetOneItem(ent->StylesValue(is1)); |
105 | } |
106 | |
107 | iter.GetOneItem(ent->Item()); |
108 | } |