973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
5 | // This library is free software; you can redistribute it and/or modify it under |
6 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
9 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
7fd59977 |
13 | |
14 | #include <RWStepVisual_RWOverRidingStyledItem.ixx> |
15 | #include <StepVisual_StyledItem.hxx> |
16 | #include <StepVisual_HArray1OfPresentationStyleAssignment.hxx> |
17 | #include <StepVisual_PresentationStyleAssignment.hxx> |
18 | #include <StepRepr_RepresentationItem.hxx> |
19 | |
20 | |
21 | #include <Interface_EntityIterator.hxx> |
22 | |
23 | |
24 | #include <StepVisual_OverRidingStyledItem.hxx> |
25 | |
26 | |
27 | RWStepVisual_RWOverRidingStyledItem::RWStepVisual_RWOverRidingStyledItem () {} |
28 | |
29 | void RWStepVisual_RWOverRidingStyledItem::ReadStep |
30 | (const Handle(StepData_StepReaderData)& data, |
31 | const Standard_Integer num, |
32 | Handle(Interface_Check)& ach, |
33 | const Handle(StepVisual_OverRidingStyledItem)& ent) const |
34 | { |
35 | |
36 | |
37 | // --- Number of Parameter Control --- |
38 | |
39 | if (!data->CheckNbParams(num,4,ach,"over_riding_styled_item")) return; |
40 | |
41 | // --- inherited field : name --- |
42 | |
43 | Handle(TCollection_HAsciiString) aName; |
44 | //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed |
45 | data->ReadString (num,1,"name",ach,aName); |
46 | |
47 | // --- inherited field : styles --- |
48 | |
49 | Handle(StepVisual_HArray1OfPresentationStyleAssignment) aStyles; |
50 | Handle(StepVisual_PresentationStyleAssignment) anent2; |
51 | Standard_Integer nsub2; |
52 | if (data->ReadSubList (num,2,"styles",ach,nsub2)) { |
53 | Standard_Integer nb2 = data->NbParams(nsub2); |
54 | aStyles = new StepVisual_HArray1OfPresentationStyleAssignment (1, nb2); |
55 | for (Standard_Integer i2 = 1; i2 <= nb2; i2 ++) { |
56 | //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed |
57 | if (data->ReadEntity (nsub2, i2,"presentation_style_assignment", ach, |
58 | STANDARD_TYPE(StepVisual_PresentationStyleAssignment), anent2)) |
59 | aStyles->SetValue(i2, anent2); |
60 | } |
61 | } |
62 | |
63 | // --- inherited field : item --- |
64 | |
65 | Handle(StepRepr_RepresentationItem) aItem; |
66 | //szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed |
67 | data->ReadEntity(num, 3,"item", ach, STANDARD_TYPE(StepRepr_RepresentationItem), aItem); |
68 | |
69 | // --- own field : overRiddenStyle --- |
70 | |
71 | Handle(StepVisual_StyledItem) aOverRiddenStyle; |
72 | //szv#4:S4163:12Mar99 `Standard_Boolean stat4 =` not needed |
73 | data->ReadEntity(num, 4,"over_ridden_style", ach, STANDARD_TYPE(StepVisual_StyledItem), aOverRiddenStyle); |
74 | |
75 | //--- Initialisation of the read entity --- |
76 | |
77 | |
78 | ent->Init(aName, aStyles, aItem, aOverRiddenStyle); |
79 | } |
80 | |
81 | |
82 | void RWStepVisual_RWOverRidingStyledItem::WriteStep |
83 | (StepData_StepWriter& SW, |
84 | const Handle(StepVisual_OverRidingStyledItem)& ent) const |
85 | { |
86 | |
87 | // --- inherited field name --- |
88 | |
89 | SW.Send(ent->Name()); |
90 | |
91 | // --- inherited field styles --- |
92 | |
93 | SW.OpenSub(); |
94 | for (Standard_Integer i2 = 1; i2 <= ent->NbStyles(); i2 ++) { |
95 | SW.Send(ent->StylesValue(i2)); |
96 | } |
97 | SW.CloseSub(); |
98 | |
99 | // --- inherited field item --- |
100 | |
101 | SW.Send(ent->Item()); |
102 | |
103 | // --- own field : overRiddenStyle --- |
104 | |
105 | SW.Send(ent->OverRiddenStyle()); |
106 | } |
107 | |
108 | |
109 | void RWStepVisual_RWOverRidingStyledItem::Share(const Handle(StepVisual_OverRidingStyledItem)& ent, Interface_EntityIterator& iter) const |
110 | { |
111 | |
112 | Standard_Integer nbElem1 = ent->NbStyles(); |
113 | for (Standard_Integer is1=1; is1<=nbElem1; is1 ++) { |
114 | iter.GetOneItem(ent->StylesValue(is1)); |
115 | } |
116 | |
117 | |
118 | |
119 | iter.GetOneItem(ent->Item()); |
120 | |
121 | |
122 | iter.GetOneItem(ent->OverRiddenStyle()); |
123 | } |
124 | |