1 // Created on: 2015-10-29
2 // Created by: Irina KRYLOVA
3 // Copyright (c) 2015 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
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>
23 //=======================================================================
24 //function : RWStepVisual_RWDraughtingCallout
26 //=======================================================================
27 RWStepVisual_RWDraughtingCallout::RWStepVisual_RWDraughtingCallout () {}
29 //=======================================================================
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
38 if (!data->CheckNbParams(num, 2, ach, "draughting_callout")) return;
40 // Inherited field : name
41 Handle(TCollection_HAsciiString) aName;
42 data->ReadString (num, 1, "name" ,ach, aName);
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);
57 // Initialisation of the read entity
58 ent->Init(aName, aContents);
61 //=======================================================================
62 //function : WriteStep
64 //=======================================================================
65 void RWStepVisual_RWDraughtingCallout::WriteStep
66 (StepData_StepWriter& SW,
67 const Handle(StepVisual_DraughtingCallout)& ent) const
69 // Inherited field: name
72 // Own field: contents
74 for (Standard_Integer i = 1; i <= ent->NbContents(); i++) {
75 SW.Send(ent->ContentsValue(i).Value());
80 //=======================================================================
83 //=======================================================================
85 void RWStepVisual_RWDraughtingCallout::Share (const Handle(StepVisual_DraughtingCallout) &ent,
86 Interface_EntityIterator& iter) const
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());