1 // Created on: 2016-12-28
2 // Created by: Irina KRYLOVA
3 // Copyright (c) 2016 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_RWAnnotationFillAreaOccurrence.hxx>
20 #include <StepData_StepReaderData.hxx>
21 #include <StepData_StepWriter.hxx>
22 #include <StepGeom_GeometricRepresentationItem.hxx>
23 #include <StepVisual_HArray1OfPresentationStyleAssignment.hxx>
24 #include <StepVisual_PresentationStyleAssignment.hxx>
25 #include <StepVisual_AnnotationFillAreaOccurrence.hxx>
27 //=======================================================================
28 //function : RWStepVisual_RWAnnotationFillAreaOccurrence
30 //=======================================================================
31 RWStepVisual_RWAnnotationFillAreaOccurrence::RWStepVisual_RWAnnotationFillAreaOccurrence () {}
33 //=======================================================================
36 //=======================================================================
37 void RWStepVisual_RWAnnotationFillAreaOccurrence::ReadStep
38 (const Handle(StepData_StepReaderData)& data,
39 const Standard_Integer num,
40 Handle(Interface_Check)& ach,
41 const Handle(StepVisual_AnnotationFillAreaOccurrence)& ent) const
43 // Number of Parameter Control
44 if (!data->CheckNbParams(num, 4, ach, "annotation_fill_area_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) anent;
53 Standard_Integer nsub;
54 if (data->ReadSubList(num, 2, "styles", ach, nsub)) {
55 Standard_Integer nb = data->NbParams(nsub);
56 aStyles = new StepVisual_HArray1OfPresentationStyleAssignment(1, nb);
57 for (Standard_Integer i = 1; i <= nb; i++) {
58 if (data->ReadEntity(nsub, i, "presentation_style_assignment", ach,
59 STANDARD_TYPE(StepVisual_PresentationStyleAssignment), anent))
60 aStyles->SetValue(i, anent);
64 // Inherited field : item
65 Handle(Standard_Transient) aItem;
66 data->ReadEntity(num, 3, "item", ach, STANDARD_TYPE(Standard_Transient), aItem);
68 // Own field : fill_style_target
69 Handle(StepGeom_GeometricRepresentationItem) aFillStyleTarget;
70 data->ReadEntity(num, 4, "item", ach, STANDARD_TYPE(StepGeom_GeometricRepresentationItem), aFillStyleTarget);
72 // Initialisation of the read entity
73 ent->Init(aName, aStyles, aItem, aFillStyleTarget);
76 //=======================================================================
77 //function : WriteStep
79 //=======================================================================
80 void RWStepVisual_RWAnnotationFillAreaOccurrence::WriteStep
81 (StepData_StepWriter& SW,
82 const Handle(StepVisual_AnnotationFillAreaOccurrence)& ent) const
84 // Inherited field : name
87 // Inherited field : styles
89 for (Standard_Integer i = 1; i <= ent->NbStyles(); i++) {
90 SW.Send(ent->StylesValue(i));
94 // Inherited field : item
97 // Own field: fill_area_target
98 SW.Send(ent->FillStyleTarget());
101 //=======================================================================
104 //=======================================================================
105 void RWStepVisual_RWAnnotationFillAreaOccurrence::Share(const Handle(StepVisual_AnnotationFillAreaOccurrence)& ent, Interface_EntityIterator& iter) const
107 Standard_Integer nbElem1 = ent->NbStyles();
108 for (Standard_Integer i = 1; i <= nbElem1; i++) {
109 iter.GetOneItem(ent->StylesValue(i));
111 iter.GetOneItem(ent->Item());
112 iter.GetOneItem(ent->FillStyleTarget());