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