0028315: Data Exchange - Import/Export GD&Ts without semantic
[occt.git] / src / RWStepVisual / RWStepVisual_RWAnnotationFillAreaOccurrence.cxx
CommitLineData
1209c1b9 1// Created on: 2016-12-28
2// Created by: Irina KRYLOVA
3// Copyright (c) 2016 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
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>
26
27//=======================================================================
28//function : RWStepVisual_RWAnnotationFillAreaOccurrence
29//purpose :
30//=======================================================================
31RWStepVisual_RWAnnotationFillAreaOccurrence::RWStepVisual_RWAnnotationFillAreaOccurrence () {}
32
33//=======================================================================
34//function : ReadStep
35//purpose :
36//=======================================================================
37void RWStepVisual_RWAnnotationFillAreaOccurrence::ReadStep
38(const Handle(StepData_StepReaderData)& data,
39const Standard_Integer num,
40Handle(Interface_Check)& ach,
41const Handle(StepVisual_AnnotationFillAreaOccurrence)& ent) const
42{
43 // Number of Parameter Control
44 if (!data->CheckNbParams(num, 4, ach, "annotation_fill_area_occurrence")) return;
45
46 // Inherited field : name
47 Handle(TCollection_HAsciiString) aName;
48 data->ReadString(num, 1, "name", ach, aName);
49
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);
61 }
62 }
63
64 // Inherited field : item
65 Handle(MMgt_TShared) aItem;
66 data->ReadEntity(num, 3, "item", ach, STANDARD_TYPE(MMgt_TShared), aItem);
67
68 // Own field : fill_style_target
69 Handle(StepGeom_GeometricRepresentationItem) aFillStyleTarget;
70 data->ReadEntity(num, 4, "item", ach, STANDARD_TYPE(StepGeom_GeometricRepresentationItem), aFillStyleTarget);
71
72 // Initialisation of the read entity
73 ent->Init(aName, aStyles, aItem, aFillStyleTarget);
74}
75
76//=======================================================================
77//function : WriteStep
78//purpose :
79//=======================================================================
80void RWStepVisual_RWAnnotationFillAreaOccurrence::WriteStep
81(StepData_StepWriter& SW,
82const Handle(StepVisual_AnnotationFillAreaOccurrence)& ent) const
83{
84 // Inherited field : name
85 SW.Send(ent->Name());
86
87 // Inherited field : styles
88 SW.OpenSub();
89 for (Standard_Integer i = 1; i <= ent->NbStyles(); i++) {
90 SW.Send(ent->StylesValue(i));
91 }
92 SW.CloseSub();
93
94 // Inherited field : item
95 SW.Send(ent->Item());
96
97 // Own field: fill_area_target
98 SW.Send(ent->FillStyleTarget());
99}
100
101//=======================================================================
102//function : Share
103//purpose :
104//=======================================================================
105void RWStepVisual_RWAnnotationFillAreaOccurrence::Share(const Handle(StepVisual_AnnotationFillAreaOccurrence)& ent, Interface_EntityIterator& iter) const
106{
107 Standard_Integer nbElem1 = ent->NbStyles();
108 for (Standard_Integer i = 1; i <= nbElem1; i++) {
109 iter.GetOneItem(ent->StylesValue(i));
110 }
111 iter.GetOneItem(ent->Item());
112 iter.GetOneItem(ent->FillStyleTarget());
113}