0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[occt.git] / src / RWStepVisual / RWStepVisual_RWDraughtingCallout.cxx
1 // Created on: 2015-10-29
2 // Created by: Irina KRYLOVA
3 // Copyright (c) 2015 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #include <Interface_Check.hxx>
17 #include <Interface_EntityIterator.hxx>
18 #include <RWStepVisual_RWDraughtingCallout.hxx>
19 #include <StepData_StepReaderData.hxx>
20 #include <StepData_StepWriter.hxx>
21 #include <StepVisual_DraughtingCallout.hxx>
22
23 //=======================================================================
24 //function : RWStepVisual_RWDraughtingCallout
25 //purpose  : 
26 //=======================================================================
27 RWStepVisual_RWDraughtingCallout::RWStepVisual_RWDraughtingCallout () {}
28
29 //=======================================================================
30 //function : ReadStep
31 //purpose  : 
32 //=======================================================================
33 void RWStepVisual_RWDraughtingCallout::ReadStep(const Handle(StepData_StepReaderData)& data,
34                                                 const Standard_Integer num,
35                                                 Handle(Interface_Check)& ach,
36                                                 const Handle(StepVisual_DraughtingCallout)& ent) const
37 {
38   if (!data->CheckNbParams(num, 2, ach, "draughting_callout")) return;
39
40   // Inherited field : name
41   Handle(TCollection_HAsciiString) aName;
42   data->ReadString (num, 1, "name" ,ach, aName);
43     
44   // Own field: contents
45   Handle(StepVisual_HArray1OfDraughtingCalloutElement) aContents;
46   StepVisual_DraughtingCalloutElement anEnt;
47   Standard_Integer nbSub;
48   if (data->ReadSubList (num, 2, "contents", ach, nbSub)) {
49     Standard_Integer nbElements = data->NbParams(nbSub);
50     aContents = new StepVisual_HArray1OfDraughtingCalloutElement (1, nbElements);
51     for (Standard_Integer i = 1; i <= nbElements; i++) {
52       if (data->ReadEntity(nbSub, i,"content", ach, anEnt))
53         aContents->SetValue(i, anEnt);
54     }
55   }
56
57   // Initialisation of the read entity
58   ent->Init(aName, aContents);
59 }
60
61 //=======================================================================
62 //function : WriteStep
63 //purpose  : 
64 //=======================================================================
65 void RWStepVisual_RWDraughtingCallout::WriteStep
66   (StepData_StepWriter& SW,
67    const Handle(StepVisual_DraughtingCallout)& ent) const
68 {
69   // Inherited field: name
70   SW.Send(ent->Name());
71     
72   // Own field: contents
73   SW.OpenSub();
74   for (Standard_Integer i = 1;  i <= ent->NbContents();  i++) {
75     SW.Send(ent->ContentsValue(i).Value());
76   }
77   SW.CloseSub();
78 }
79
80 //=======================================================================
81 //function : Share
82 //purpose  : 
83 //=======================================================================
84
85 void RWStepVisual_RWDraughtingCallout::Share (const Handle(StepVisual_DraughtingCallout) &ent,
86                                               Interface_EntityIterator& iter) const
87 {
88   // Own field: contents
89   Standard_Integer i, nb = ent->NbContents();
90   for (i = 1; i <= nb; i++)  
91     iter.AddItem (ent->ContentsValue(i).Value());
92 }
93