]> OCCT Git - occt-copy.git/blob
295a6e5b4361d47ccfff3a15475c4b87f99d31f2
[occt-copy.git] /
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>
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>
25
26 //=======================================================================
27 //function : RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem
28 //purpose  : 
29 //=======================================================================
30 RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem::
31   RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem () {}
32
33 //=======================================================================
34 //function : ReadStep
35 //purpose  : 
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
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
65   Handle(MMgt_TShared) aItem;
66   data->ReadEntity(num, 2, "item", ach, STANDARD_TYPE(MMgt_TShared), aItem);
67
68   // Initialization of the read entity
69   ent->Init(aName, aStyles, aItem);
70 }
71
72 //=======================================================================
73 //function : WriteStep
74 //purpose  : 
75 //=======================================================================
76 void RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem::WriteStep
77 (StepData_StepWriter& SW,
78 const Handle(StepVisual_AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem)& ent) const
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 //=======================================================================
103 void RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem::Share(
104   const Handle(StepVisual_AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem)& ent,
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 }