Integration of OCCT 6.5.0 from SVN
[occt.git] / src / RWStepVisual / RWStepVisual_RWPresentationRepresentation.cxx
1
2 #include <RWStepVisual_RWPresentationRepresentation.ixx>
3 #include <StepRepr_HArray1OfRepresentationItem.hxx>
4 #include <StepRepr_RepresentationItem.hxx>
5 #include <StepRepr_RepresentationContext.hxx>
6
7
8 #include <Interface_EntityIterator.hxx>
9
10
11 #include <StepVisual_PresentationRepresentation.hxx>
12
13
14 RWStepVisual_RWPresentationRepresentation::RWStepVisual_RWPresentationRepresentation () {}
15
16 void RWStepVisual_RWPresentationRepresentation::ReadStep
17         (const Handle(StepData_StepReaderData)& data,
18          const Standard_Integer num,
19          Handle(Interface_Check)& ach,
20          const Handle(StepVisual_PresentationRepresentation)& ent) const
21 {
22
23
24         // --- Number of Parameter Control ---
25
26         if (!data->CheckNbParams(num,3,ach,"presentation_representation")) return;
27
28         // --- inherited field : name ---
29
30         Handle(TCollection_HAsciiString) aName;
31         //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed
32         data->ReadString (num,1,"name",ach,aName);
33
34         // --- inherited field : items ---
35
36         Handle(StepRepr_HArray1OfRepresentationItem) aItems;
37         Handle(StepRepr_RepresentationItem) anent2;
38         Standard_Integer nsub2;
39         if (data->ReadSubList (num,2,"items",ach,nsub2)) {
40           Standard_Integer nb2 = data->NbParams(nsub2);
41           aItems = new StepRepr_HArray1OfRepresentationItem (1, nb2);
42           for (Standard_Integer i2 = 1; i2 <= nb2; i2 ++) {
43             //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed
44             if (data->ReadEntity (nsub2, i2,"representation_item", ach,
45                                   STANDARD_TYPE(StepRepr_RepresentationItem), anent2))
46               aItems->SetValue(i2, anent2);
47           }
48         }
49
50         // --- inherited field : contextOfItems ---
51
52         Handle(StepRepr_RepresentationContext) aContextOfItems;
53         //szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed
54         data->ReadEntity(num, 3,"context_of_items", ach, STANDARD_TYPE(StepRepr_RepresentationContext), aContextOfItems);
55
56         //--- Initialisation of the read entity ---
57
58
59         ent->Init(aName, aItems, aContextOfItems);
60 }
61
62
63 void RWStepVisual_RWPresentationRepresentation::WriteStep
64         (StepData_StepWriter& SW,
65          const Handle(StepVisual_PresentationRepresentation)& ent) const
66 {
67
68         // --- inherited field name ---
69
70         SW.Send(ent->Name());
71
72         // --- inherited field items ---
73
74         SW.OpenSub();
75         for (Standard_Integer i2 = 1;  i2 <= ent->NbItems();  i2 ++) {
76           SW.Send(ent->ItemsValue(i2));
77         }
78         SW.CloseSub();
79
80         // --- inherited field contextOfItems ---
81
82         SW.Send(ent->ContextOfItems());
83 }
84
85
86 void RWStepVisual_RWPresentationRepresentation::Share(const Handle(StepVisual_PresentationRepresentation)& ent, Interface_EntityIterator& iter) const
87 {
88
89         Standard_Integer nbElem1 = ent->NbItems();
90         for (Standard_Integer is1=1; is1<=nbElem1; is1 ++) {
91           iter.GetOneItem(ent->ItemsValue(is1));
92         }
93
94
95
96         iter.GetOneItem(ent->ContextOfItems());
97 }
98