1 // Created on: 2017-02-06
2 // Created by: Irina KRYLOVA
3 // Copyright (c) 2017 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.
16 #include <Interface_Check.hxx>
17 #include <Interface_EntityIterator.hxx>
18 #include <RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem.hxx>
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>
24 #include <StepVisual_AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem.hxx>
26 //=======================================================================
27 //function : RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem
29 //=======================================================================
30 RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem::
31 RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem () {}
33 //=======================================================================
36 //=======================================================================
37 void RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem::ReadStep
38 (const Handle(StepData_StepReaderData)& data,
39 const Standard_Integer num0,
40 Handle(Interface_Check)& ach,
41 const Handle(StepVisual_AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem)& ent) const
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);
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);
64 // Inherited field : item
65 Handle(Standard_Transient) aItem;
66 data->ReadEntity(num, 2, "item", ach, STANDARD_TYPE(Standard_Transient), aItem);
68 // Initialization of the read entity
69 ent->Init(aName, aStyles, aItem);
72 //=======================================================================
73 //function : WriteStep
75 //=======================================================================
76 void RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem::WriteStep
77 (StepData_StepWriter& SW,
78 const Handle(StepVisual_AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem)& ent) const
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
87 SW.StartEntity("STYLED_ITEM");
88 // Inherited field : styles
90 for (Standard_Integer i = 1; i <= ent->NbStyles(); i++) {
91 SW.Send(ent->StylesValue(i));
95 // Inherited field : item
99 //=======================================================================
102 //=======================================================================
103 void RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem::Share(
104 const Handle(StepVisual_AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem)& ent,
105 Interface_EntityIterator& iter) const
108 Standard_Integer nbElem = ent->NbStyles();
109 for (Standard_Integer i = 1; i <= nbElem; i++) {
110 iter.GetOneItem(ent->StylesValue(i));
113 iter.GetOneItem(ent->Item());