1 // Created on: 2000-04-18
2 // Created by: Andrey BETENEV
3 // Copyright (c) 2000-2014 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 // Generator: ExpToCas (EXPRESS -> CASCADE/XSTEP Translator) V1.0
18 #include <Interface_Check.hxx>
19 #include <Interface_EntityIterator.hxx>
20 #include <RWStepShape_RWShapeDimensionRepresentation.hxx>
21 #include <StepData_StepReaderData.hxx>
22 #include <StepData_StepWriter.hxx>
23 #include <StepRepr_HArray1OfRepresentationItem.hxx>
24 #include <StepRepr_RepresentationContext.hxx>
25 #include <StepRepr_RepresentationItem.hxx>
26 #include <StepShape_HArray1OfShapeDimensionRepresentationItem.hxx>
27 #include <StepShape_ShapeDimensionRepresentation.hxx>
29 //=======================================================================
30 //function : RWStepShape_RWShapeDimensionRepresentation
32 //=======================================================================
33 RWStepShape_RWShapeDimensionRepresentation::RWStepShape_RWShapeDimensionRepresentation ()
37 //=======================================================================
40 //=======================================================================
42 void RWStepShape_RWShapeDimensionRepresentation::ReadStep (const Handle(StepData_StepReaderData)& data,
43 const Standard_Integer num,
44 Handle(Interface_Check)& ach,
45 const Handle(StepShape_ShapeDimensionRepresentation) &ent) const
47 // Check number of parameters
48 if ( ! data->CheckNbParams(num,3,ach,"shape_dimension_representation") ) return;
50 // Inherited fields of Representation
52 Handle(TCollection_HAsciiString) aRepresentation_Name;
53 data->ReadString (num, 1, "representation.name", ach, aRepresentation_Name);
55 Handle(StepRepr_HArray1OfRepresentationItem) aRepresentation_Items;
56 Handle(StepShape_HArray1OfShapeDimensionRepresentationItem) anItems;
57 Standard_Integer sub2 = 0;
58 if ( data->ReadSubList (num, 2, "representation.items", ach, sub2) ) {
59 Standard_Integer num2 = sub2;
60 Standard_Integer nb0 = data->NbParams(num2);
61 Handle(StepRepr_RepresentationItem) anIt0;
62 StepShape_ShapeDimensionRepresentationItem anIt0AP242;
63 if (data->ReadEntity (num2, 1, "representation.items", ach, STANDARD_TYPE(StepRepr_RepresentationItem), anIt0)) {
64 aRepresentation_Items = new StepRepr_HArray1OfRepresentationItem (1, nb0);
65 for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
66 data->ReadEntity (num2, i0, "representation.items", ach, STANDARD_TYPE(StepRepr_RepresentationItem), anIt0);
67 aRepresentation_Items->SetValue(i0, anIt0);
71 anItems = new StepShape_HArray1OfShapeDimensionRepresentationItem (1, nb0);
72 for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
73 data->ReadEntity (num2, i0, "representation.items", ach, anIt0AP242);
74 anItems->SetValue(i0, anIt0AP242);
79 Handle(StepRepr_RepresentationContext) aRepresentation_ContextOfItems;
80 data->ReadEntity (num, 3, "representation.context_of_items", ach, STANDARD_TYPE(StepRepr_RepresentationContext), aRepresentation_ContextOfItems);
83 if (anItems.IsNull()) {
84 ent->Init(aRepresentation_Name,
85 aRepresentation_Items,
86 aRepresentation_ContextOfItems);
89 ent->Init(aRepresentation_Name,
91 aRepresentation_ContextOfItems);
95 //=======================================================================
96 //function : WriteStep
98 //=======================================================================
100 void RWStepShape_RWShapeDimensionRepresentation::WriteStep (StepData_StepWriter& SW,
101 const Handle(StepShape_ShapeDimensionRepresentation) &ent) const
104 // Inherited fields of Representation
106 SW.Send (ent->StepRepr_Representation::Name());
109 if (ent->ItemsAP242().IsNull()) {
110 for (Standard_Integer i1=1; i1 <= ent->StepRepr_Representation::NbItems(); i1++ ) {
111 Handle(StepRepr_RepresentationItem) Var0 = ent->StepRepr_Representation::Items()->Value(i1);
116 for (Standard_Integer i1=1; i1 <= ent->ItemsAP242()->Length(); i1++ ) {
117 StepShape_ShapeDimensionRepresentationItem Var0 = ent->ItemsAP242()->Value(i1);
118 SW.Send (Var0.Value());
123 SW.Send (ent->StepRepr_Representation::ContextOfItems());
126 //=======================================================================
129 //=======================================================================
131 void RWStepShape_RWShapeDimensionRepresentation::Share (const Handle(StepShape_ShapeDimensionRepresentation) &ent,
132 Interface_EntityIterator& iter) const
135 // Inherited fields of Representation
137 if (ent->ItemsAP242().IsNull()) {
138 for (Standard_Integer i1=1; i1 <= ent->StepRepr_Representation::NbItems(); i1++ ) {
139 Handle(StepRepr_RepresentationItem) Var0 = ent->StepRepr_Representation::Items()->Value(i1);
144 for (Standard_Integer i1=1; i1 <= ent->ItemsAP242()->Length(); i1++ ) {
145 StepShape_ShapeDimensionRepresentationItem Var0 = ent->ItemsAP242()->Value(i1);
146 iter.AddItem (Var0.Value());
150 iter.AddItem (ent->StepRepr_Representation::ContextOfItems());