0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / RWStepAP214 / RWStepAP214_RWAutoDesignDocumentReference.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.
b311480e 13
7fd59977 14
42cf5bc1 15#include <Interface_Check.hxx>
16#include <Interface_EntityIterator.hxx>
17#include <RWStepAP214_RWAutoDesignDocumentReference.hxx>
18#include <StepAP214_AutoDesignDocumentReference.hxx>
19#include <StepAP214_AutoDesignReferencingItem.hxx>
20#include <StepAP214_HArray1OfAutoDesignReferencingItem.hxx>
7fd59977 21#include <StepBasic_Document.hxx>
42cf5bc1 22#include <StepData_StepReaderData.hxx>
23#include <StepData_StepWriter.hxx>
7fd59977 24#include <TCollection_HAsciiString.hxx>
7fd59977 25
26RWStepAP214_RWAutoDesignDocumentReference::RWStepAP214_RWAutoDesignDocumentReference () { }
27
28void RWStepAP214_RWAutoDesignDocumentReference::ReadStep
29 (const Handle(StepData_StepReaderData)& data,
30 const Standard_Integer num,
31 Handle(Interface_Check)& ach,
32 const Handle(StepAP214_AutoDesignDocumentReference)& ent) const
33{
34 // --- Number of Parameter Control ---
35
36 if (!data->CheckNbParams(num,3,ach,"auto_deesign_document_reference")) return;
37
38 // --- inherited field : assigned_document
39
40 Handle(StepBasic_Document) adoc;
302f96fb 41 data->ReadEntity
7fd59977 42 (num, 1,"assigned_document", ach, STANDARD_TYPE(StepBasic_Document), adoc);
43
44 // --- inherited field : source ---
45
46 Handle(TCollection_HAsciiString) asource;
bcf50875 47 data->ReadString (num,2,"source",ach,asource);
7fd59977 48
49
50 // --- own field : items ---
51
52 Handle(StepAP214_HArray1OfAutoDesignReferencingItem) aItems;
53 StepAP214_AutoDesignReferencingItem anItem;
54 Standard_Integer nsub3;
55 if (data->ReadSubList (num,3,"items",ach,nsub3)) {
56 Standard_Integer nb3 = data->NbParams(nsub3);
57 aItems = new StepAP214_HArray1OfAutoDesignReferencingItem (1, nb3);
58 for (Standard_Integer i3 = 1; i3 <= nb3; i3 ++) {
59 Standard_Boolean stat3 = data->ReadEntity
60 (nsub3, i3,"item", ach, anItem);
61 if (stat3) aItems->SetValue(i3, anItem);
62 }
63 }
64
65 //--- Initialisation of the read entity ---
66
67 ent->Init (adoc,asource,aItems);
68}
69
70void RWStepAP214_RWAutoDesignDocumentReference::WriteStep
71 (StepData_StepWriter& SW,
72 const Handle(StepAP214_AutoDesignDocumentReference)& ent) const
73{
74
75 // --- inherited field : assigned_document ---
76
77 SW.Send(ent->AssignedDocument());
78
79 // --- inherited field : source ---
80
81 SW.Send(ent->Source());
82
83 // --- own field : items ---
84
85 SW.OpenSub();
86 for (Standard_Integer i3 = 1; i3 <= ent->NbItems(); i3 ++) {
87 SW.Send(ent->ItemsValue(i3).Value());
88 }
89 SW.CloseSub();
90}
91
92
93void RWStepAP214_RWAutoDesignDocumentReference::Share(const Handle(StepAP214_AutoDesignDocumentReference)& ent, Interface_EntityIterator& iter) const
94{
95 iter.AddItem (ent->AssignedDocument());
96 for (Standard_Integer i3 = 1; i3 <= ent->NbItems(); i3 ++)
97 iter.AddItem (ent->ItemsValue(i3).Value());
98}