0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / RWStepVisual / RWStepVisual_RWContextDependentInvisibility.cxx
CommitLineData
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
7fd59977 14
42cf5bc1 15#include <Interface_Check.hxx>
7fd59977 16#include <Interface_EntityIterator.hxx>
42cf5bc1 17#include <RWStepVisual_RWContextDependentInvisibility.hxx>
18#include <StepData_StepReaderData.hxx>
19#include <StepData_StepWriter.hxx>
7fd59977 20#include <StepVisual_ContextDependentInvisibility.hxx>
42cf5bc1 21#include <StepVisual_HArray1OfInvisibleItem.hxx>
22#include <StepVisual_InvisibilityContext.hxx>
23#include <StepVisual_InvisibleItem.hxx>
7fd59977 24
25RWStepVisual_RWContextDependentInvisibility::RWStepVisual_RWContextDependentInvisibility () {}
26
27void RWStepVisual_RWContextDependentInvisibility::ReadStep
28 (const Handle(StepData_StepReaderData)& data,
29 const Standard_Integer num,
30 Handle(Interface_Check)& ach,
31 const Handle(StepVisual_ContextDependentInvisibility)& ent) const
32{
33
34
35 // --- Number of Parameter Control ---
36
37 if (!data->CheckNbParams(num,2,ach,"context_dependent_invisibility")) return;
38
39 // --- inherited field : invisibleItems ---
40
41 Handle(StepVisual_HArray1OfInvisibleItem) aInvisibleItems;
42 StepVisual_InvisibleItem aInvisibleItemsItem;
43 Standard_Integer nsub1;
44 if (data->ReadSubList (num,1,"invisible_items",ach,nsub1)) {
45 Standard_Integer nb1 = data->NbParams(nsub1);
46 aInvisibleItems = new StepVisual_HArray1OfInvisibleItem (1, nb1);
47 for (Standard_Integer i1 = 1; i1 <= nb1; i1 ++) {
48 //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed
49 if (data->ReadEntity (nsub1,i1,"invisible_items",ach,aInvisibleItemsItem))
50 aInvisibleItems->SetValue(i1,aInvisibleItemsItem);
51 }
52 }
53
54 // --- own field : presentationContext ---
55
56 StepVisual_InvisibilityContext aPresentationContext;
57 //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed
58 data->ReadEntity(num,2,"presentation_context",ach,aPresentationContext);
59
60 //--- Initialisation of the read entity ---
61
62
63 ent->Init(aInvisibleItems, aPresentationContext);
64}
65
66
67void RWStepVisual_RWContextDependentInvisibility::WriteStep
68 (StepData_StepWriter& SW,
69 const Handle(StepVisual_ContextDependentInvisibility)& ent) const
70{
71
72 // --- inherited field invisibleItems ---
73
74 SW.OpenSub();
75 for (Standard_Integer i1 = 1; i1 <= ent->NbInvisibleItems(); i1 ++) {
76 SW.Send(ent->InvisibleItemsValue(i1).Value());
77 }
78 SW.CloseSub();
79
80 // --- own field : presentationContext ---
81
82 SW.Send(ent->PresentationContext().Value());
83}
84
85
86void RWStepVisual_RWContextDependentInvisibility::Share(const Handle(StepVisual_ContextDependentInvisibility)& ent, Interface_EntityIterator& iter) const
87{
88
89 Standard_Integer nbElem1 = ent->NbInvisibleItems();
90 for (Standard_Integer is1=1; is1<=nbElem1; is1 ++) {
91 iter.GetOneItem(ent->InvisibleItemsValue(is1).Value());
92 }
93
94
95
96 iter.GetOneItem(ent->PresentationContext().Value());
97}
98