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.
17 #include <Interface_Check.hxx>
18 #include <Interface_EntityIterator.hxx>
19 #include <RWStepVisual_RWAnnotationOccurrence.hxx>
20 #include <StepData_StepReaderData.hxx>
21 #include <StepData_StepWriter.hxx>
22 #include <StepRepr_RepresentationItem.hxx>
23 #include <StepVisual_HArray1OfPresentationStyleAssignment.hxx>
24 #include <StepVisual_PresentationStyleAssignment.hxx>
25 #include <StepVisual_AnnotationOccurrence.hxx>
27 //=======================================================================
28 //function : RWStepVisual_RWAnnotationOccurrence
30 //=======================================================================
31 RWStepVisual_RWAnnotationOccurrence::RWStepVisual_RWAnnotationOccurrence () {}
33 //=======================================================================
36 //=======================================================================
37 void RWStepVisual_RWAnnotationOccurrence::ReadStep
38 (const Handle(StepData_StepReaderData)& data,
39 const Standard_Integer num,
40 Handle(Interface_Check)& ach,
41 const Handle(StepVisual_AnnotationOccurrence)& ent) const
43 // Number of Parameter Control
44 if (!data->CheckNbParams(num, 3, ach, "annotation_occurrence")) return;
46 // Inherited field : name
47 Handle(TCollection_HAsciiString) aName;
48 data->ReadString (num, 1, "name", ach, aName);
50 // Inherited field : styles
51 Handle(StepVisual_HArray1OfPresentationStyleAssignment) aStyles;
52 Handle(StepVisual_PresentationStyleAssignment) anent2;
53 Standard_Integer nsub2;
54 if (data->ReadSubList (num,2,"styles",ach,nsub2)) {
55 Standard_Integer nb2 = data->NbParams(nsub2);
56 aStyles = new StepVisual_HArray1OfPresentationStyleAssignment (1, nb2);
57 for (Standard_Integer i2 = 1; i2 <= nb2; i2 ++) {
58 if (data->ReadEntity (nsub2, i2,"presentation_style_assignment", ach,
59 STANDARD_TYPE(StepVisual_PresentationStyleAssignment), anent2))
60 aStyles->SetValue(i2, anent2);
64 // Inherited field : item
65 Handle(Standard_Transient) aItem;
66 data->ReadEntity(num, 3,"item", ach, STANDARD_TYPE(Standard_Transient), aItem);
68 // Initialisation of the read entity
69 ent->Init(aName, aStyles, aItem);
72 //=======================================================================
73 //function : WriteStep
75 //=======================================================================
76 void RWStepVisual_RWAnnotationOccurrence::WriteStep
77 (StepData_StepWriter& SW,
78 const Handle(StepVisual_AnnotationOccurrence)& ent) const
80 // Inherited field : name
83 // Inherited field : styles
86 for (Standard_Integer i2 = 1; i2 <= ent->NbStyles(); i2 ++) {
87 SW.Send(ent->StylesValue(i2));
91 // Inherited field : item
96 //=======================================================================
99 //=======================================================================
100 void RWStepVisual_RWAnnotationOccurrence::Share(const Handle(StepVisual_AnnotationOccurrence)& ent, Interface_EntityIterator& iter) const
102 Standard_Integer nbElem1 = ent->NbStyles();
103 for (Standard_Integer is1=1; is1<=nbElem1; is1 ++) {
104 iter.GetOneItem(ent->StylesValue(is1));
106 iter.GetOneItem(ent->Item());