c4fa1c2c |
1 | // Created on: 2017-02-06 |
2 | // Created by: Irina KRYLOVA |
3 | // Copyright (c) 2017 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 | #include <Interface_Check.hxx> |
17 | #include <Interface_EntityIterator.hxx> |
210914d5 |
18 | #include <RWStepVisual_RWAnnotationCurveOccurrenceAndGeomReprItem.hxx> |
c4fa1c2c |
19 | #include <StepData_StepReaderData.hxx> |
20 | #include <StepData_StepWriter.hxx> |
21 | #include <StepRepr_RepresentationItem.hxx> |
22 | #include <StepVisual_HArray1OfPresentationStyleAssignment.hxx> |
23 | #include <StepVisual_PresentationStyleAssignment.hxx> |
210914d5 |
24 | #include <StepVisual_AnnotationCurveOccurrenceAndGeomReprItem.hxx> |
c4fa1c2c |
25 | |
26 | //======================================================================= |
210914d5 |
27 | //function : RWStepVisual_RWAnnotationCurveOccurrenceAndGeomReprItem |
c4fa1c2c |
28 | //purpose : |
29 | //======================================================================= |
210914d5 |
30 | RWStepVisual_RWAnnotationCurveOccurrenceAndGeomReprItem:: |
31 | RWStepVisual_RWAnnotationCurveOccurrenceAndGeomReprItem() {} |
c4fa1c2c |
32 | |
33 | //======================================================================= |
34 | //function : ReadStep |
35 | //purpose : |
36 | //======================================================================= |
210914d5 |
37 | void RWStepVisual_RWAnnotationCurveOccurrenceAndGeomReprItem::ReadStep |
c4fa1c2c |
38 | (const Handle(StepData_StepReaderData)& data, |
39 | const Standard_Integer num0, |
40 | Handle(Interface_Check)& ach, |
210914d5 |
41 | const Handle(StepVisual_AnnotationCurveOccurrenceAndGeomReprItem)& ent) const |
c4fa1c2c |
42 | { |
43 | Standard_Integer num = 0; |
44 | data->NamedForComplex("REPRESENTATION_ITEM", "RPRITM", num0, num, ach); |
45 | // Inherited field : name |
46 | Handle(TCollection_HAsciiString) aName; |
47 | data->ReadString(num, 1, "name", ach, aName); |
48 | |
49 | data->NamedForComplex("STYLED_ITEM", "STYITM", num0, num, ach); |
50 | // Inherited field : styles |
51 | Handle(StepVisual_HArray1OfPresentationStyleAssignment) aStyles; |
52 | Handle(StepVisual_PresentationStyleAssignment) anEnt; |
53 | Standard_Integer nsub; |
54 | if (data->ReadSubList(num, 1, "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 |
25e59720 |
65 | Handle(Standard_Transient) aItem; |
66 | data->ReadEntity(num, 2, "item", ach, STANDARD_TYPE(Standard_Transient), aItem); |
c4fa1c2c |
67 | |
68 | // Initialization of the read entity |
69 | ent->Init(aName, aStyles, aItem); |
70 | } |
71 | |
72 | //======================================================================= |
73 | //function : WriteStep |
74 | //purpose : |
75 | //======================================================================= |
210914d5 |
76 | void RWStepVisual_RWAnnotationCurveOccurrenceAndGeomReprItem::WriteStep |
c4fa1c2c |
77 | (StepData_StepWriter& SW, |
210914d5 |
78 | const Handle(StepVisual_AnnotationCurveOccurrenceAndGeomReprItem)& ent) const |
c4fa1c2c |
79 | { |
80 | SW.StartEntity("ANNOTATION_CURVE_OCCURRENCE"); |
81 | SW.StartEntity("ANNOTATION_OCCURRENCE"); |
82 | SW.StartEntity("GEOMETRIC_REPRESENTATION_ITEM"); |
83 | SW.StartEntity("REPRESENTATION_ITEM"); |
84 | //Inherited field : name |
85 | SW.Send(ent->Name()); |
86 | |
87 | SW.StartEntity("STYLED_ITEM"); |
88 | // Inherited field : styles |
89 | SW.OpenSub(); |
90 | for (Standard_Integer i = 1; i <= ent->NbStyles(); i++) { |
91 | SW.Send(ent->StylesValue(i)); |
92 | } |
93 | SW.CloseSub(); |
94 | |
95 | // Inherited field : item |
96 | SW.Send(ent->Item()); |
97 | } |
98 | |
99 | //======================================================================= |
100 | //function : Share |
101 | //purpose : |
102 | //======================================================================= |
210914d5 |
103 | void RWStepVisual_RWAnnotationCurveOccurrenceAndGeomReprItem::Share( |
104 | const Handle(StepVisual_AnnotationCurveOccurrenceAndGeomReprItem)& ent, |
c4fa1c2c |
105 | Interface_EntityIterator& iter) const |
106 | { |
107 | |
108 | Standard_Integer nbElem = ent->NbStyles(); |
109 | for (Standard_Integer i = 1; i <= nbElem; i++) { |
110 | iter.GetOneItem(ent->StylesValue(i)); |
111 | } |
112 | |
113 | iter.GetOneItem(ent->Item()); |
114 | } |