7fd59977 |
1 | |
2 | #include <RWStepVisual_RWContextDependentOverRidingStyledItem.ixx> |
3 | #include <StepVisual_HArray1OfStyleContextSelect.hxx> |
4 | #include <StepVisual_StyleContextSelect.hxx> |
5 | #include <StepVisual_HArray1OfPresentationStyleAssignment.hxx> |
6 | #include <StepVisual_PresentationStyleAssignment.hxx> |
7 | #include <StepRepr_RepresentationItem.hxx> |
8 | #include <StepVisual_StyledItem.hxx> |
9 | |
10 | |
11 | #include <Interface_EntityIterator.hxx> |
12 | |
13 | |
14 | #include <StepVisual_ContextDependentOverRidingStyledItem.hxx> |
15 | |
16 | |
17 | RWStepVisual_RWContextDependentOverRidingStyledItem::RWStepVisual_RWContextDependentOverRidingStyledItem () {} |
18 | |
19 | void RWStepVisual_RWContextDependentOverRidingStyledItem::ReadStep |
20 | (const Handle(StepData_StepReaderData)& data, |
21 | const Standard_Integer num, |
22 | Handle(Interface_Check)& ach, |
23 | const Handle(StepVisual_ContextDependentOverRidingStyledItem)& ent) const |
24 | { |
25 | |
26 | |
27 | // --- Number of Parameter Control --- |
28 | |
29 | if (!data->CheckNbParams(num,5,ach,"context_dependent_over_riding_styled_item")) return; |
30 | |
31 | // --- inherited field : name --- |
32 | |
33 | Handle(TCollection_HAsciiString) aName; |
34 | //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed |
35 | data->ReadString (num,1,"name",ach,aName); |
36 | |
37 | // --- inherited field : styles --- |
38 | |
39 | Handle(StepVisual_HArray1OfPresentationStyleAssignment) aStyles; |
40 | Handle(StepVisual_PresentationStyleAssignment) anent2; |
41 | Standard_Integer nsub2; |
42 | if (data->ReadSubList (num,2,"styles",ach,nsub2)) { |
43 | Standard_Integer nb2 = data->NbParams(nsub2); |
44 | aStyles = new StepVisual_HArray1OfPresentationStyleAssignment (1, nb2); |
45 | for (Standard_Integer i2 = 1; i2 <= nb2; i2 ++) { |
46 | //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed |
47 | if (data->ReadEntity (nsub2, i2,"presentation_style_assignment", ach, |
48 | STANDARD_TYPE(StepVisual_PresentationStyleAssignment), anent2)) |
49 | aStyles->SetValue(i2, anent2); |
50 | } |
51 | } |
52 | |
53 | // --- inherited field : item --- |
54 | |
55 | Handle(StepRepr_RepresentationItem) aItem; |
56 | //szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed |
57 | data->ReadEntity(num, 3,"item", ach, STANDARD_TYPE(StepRepr_RepresentationItem), aItem); |
58 | |
59 | // --- inherited field : overRiddenStyle --- |
60 | |
61 | Handle(StepVisual_StyledItem) aOverRiddenStyle; |
62 | //szv#4:S4163:12Mar99 `Standard_Boolean stat4 =` not needed |
63 | data->ReadEntity(num, 4,"over_ridden_style", ach, STANDARD_TYPE(StepVisual_StyledItem), aOverRiddenStyle); |
64 | |
65 | // --- own field : styleContext --- |
66 | |
67 | Handle(StepVisual_HArray1OfStyleContextSelect) aStyleContext; |
68 | StepVisual_StyleContextSelect aStyleContextItem; |
69 | Standard_Integer nsub5; |
70 | if (data->ReadSubList (num,5,"style_context",ach,nsub5)) { |
71 | Standard_Integer nb5 = data->NbParams(nsub5); |
72 | aStyleContext = new StepVisual_HArray1OfStyleContextSelect (1, nb5); |
73 | for (Standard_Integer i5 = 1; i5 <= nb5; i5 ++) { |
74 | //szv#4:S4163:12Mar99 `Standard_Boolean stat5 =` not needed |
75 | if (data->ReadEntity (nsub5,i5,"style_context",ach,aStyleContextItem)) |
76 | aStyleContext->SetValue(i5,aStyleContextItem); |
77 | } |
78 | } |
79 | |
80 | //--- Initialisation of the read entity --- |
81 | |
82 | |
83 | ent->Init(aName, aStyles, aItem, aOverRiddenStyle, aStyleContext); |
84 | } |
85 | |
86 | |
87 | void RWStepVisual_RWContextDependentOverRidingStyledItem::WriteStep |
88 | (StepData_StepWriter& SW, |
89 | const Handle(StepVisual_ContextDependentOverRidingStyledItem)& ent) const |
90 | { |
91 | |
92 | // --- inherited field name --- |
93 | |
94 | SW.Send(ent->Name()); |
95 | |
96 | // --- inherited field styles --- |
97 | |
98 | SW.OpenSub(); |
99 | for (Standard_Integer i2 = 1; i2 <= ent->NbStyles(); i2 ++) { |
100 | SW.Send(ent->StylesValue(i2)); |
101 | } |
102 | SW.CloseSub(); |
103 | |
104 | // --- inherited field item --- |
105 | |
106 | SW.Send(ent->Item()); |
107 | |
108 | // --- inherited field overRiddenStyle --- |
109 | |
110 | SW.Send(ent->OverRiddenStyle()); |
111 | |
112 | // --- own field : styleContext --- |
113 | |
114 | SW.OpenSub(); |
115 | for (Standard_Integer i5 = 1; i5 <= ent->NbStyleContext(); i5 ++) { |
116 | SW.Send(ent->StyleContextValue(i5).Value()); |
117 | } |
118 | SW.CloseSub(); |
119 | } |
120 | |
121 | |
122 | void RWStepVisual_RWContextDependentOverRidingStyledItem::Share(const Handle(StepVisual_ContextDependentOverRidingStyledItem)& ent, Interface_EntityIterator& iter) const |
123 | { |
124 | |
125 | Standard_Integer nbElem1 = ent->NbStyles(); |
126 | for (Standard_Integer is1=1; is1<=nbElem1; is1 ++) { |
127 | iter.GetOneItem(ent->StylesValue(is1)); |
128 | } |
129 | |
130 | |
131 | |
132 | iter.GetOneItem(ent->Item()); |
133 | |
134 | |
135 | iter.GetOneItem(ent->OverRiddenStyle()); |
136 | |
137 | |
138 | Standard_Integer nbElem4 = ent->NbStyleContext(); |
139 | for (Standard_Integer is4=1; is4<=nbElem4; is4 ++) { |
140 | iter.GetOneItem(ent->StyleContextValue(is4).Value()); |
141 | } |
142 | |
143 | } |
144 | |