1 // Created on: 2002-12-12
2 // Created by: data exchange team
3 // Copyright (c) 2002-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.2
18 #include <Interface_Check.hxx>
19 #include <Interface_EntityIterator.hxx>
20 #include <RWStepElement_RWCurve3dElementDescriptor.hxx>
21 #include <StepData_StepReaderData.hxx>
22 #include <StepData_StepWriter.hxx>
23 #include <StepElement_Curve3dElementDescriptor.hxx>
24 #include <StepElement_CurveElementPurposeMember.hxx>
25 #include <StepElement_HArray1OfHSequenceOfCurveElementPurposeMember.hxx>
26 #include <StepElement_HSequenceOfCurveElementPurposeMember.hxx>
28 //=======================================================================
29 //function : RWStepElement_RWCurve3dElementDescriptor
31 //=======================================================================
32 RWStepElement_RWCurve3dElementDescriptor::RWStepElement_RWCurve3dElementDescriptor ()
36 //=======================================================================
39 //=======================================================================
41 void RWStepElement_RWCurve3dElementDescriptor::ReadStep (const Handle(StepData_StepReaderData)& data,
42 const Standard_Integer num,
43 Handle(Interface_Check)& ach,
44 const Handle(StepElement_Curve3dElementDescriptor) &ent) const
46 // Check number of parameters
47 if ( ! data->CheckNbParams(num,3,ach,"curve3d_element_descriptor") ) return;
49 // Inherited fields of ElementDescriptor
51 StepElement_ElementOrder aElementDescriptor_TopologyOrder = StepElement_Linear;
52 if (data->ParamType (num, 1) == Interface_ParamEnum) {
53 Standard_CString text = data->ParamCValue(num, 1);
54 if (strcmp(text, ".LINEAR.")==0) aElementDescriptor_TopologyOrder = StepElement_Linear;
55 else if (strcmp(text, ".QUADRATIC.")==0) aElementDescriptor_TopologyOrder = StepElement_Quadratic;
56 else if (strcmp(text, ".CUBIC.")==0) aElementDescriptor_TopologyOrder = StepElement_Cubic;
57 else ach->AddFail("Parameter #1 (element_descriptor.topology_order) has not allowed value");
59 else ach->AddFail("Parameter #1 (element_descriptor.topology_order) is not enumeration");
61 Handle(TCollection_HAsciiString) aElementDescriptor_Description;
62 data->ReadString (num, 2, "element_descriptor.description", ach, aElementDescriptor_Description);
64 // Own fields of Curve3dElementDescriptor
66 Handle(StepElement_HArray1OfHSequenceOfCurveElementPurposeMember) aPurpose;
67 Standard_Integer sub3 = 0;
68 if ( data->ReadSubList (num, 3, "purpose", ach, sub3) ) {
69 Standard_Integer nb0 = data->NbParams(sub3);
70 //Standard_Integer nbj0 = data->NbParams(data->ParamNumber(sub3,1));
71 aPurpose = new StepElement_HArray1OfHSequenceOfCurveElementPurposeMember (1, nb0);
72 for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
73 Handle(StepElement_HSequenceOfCurveElementPurposeMember) HSCEPM =
74 new StepElement_HSequenceOfCurveElementPurposeMember;
75 Standard_Integer subj3 = 0;
76 if ( data->ReadSubList (sub3, i0, "sub-part(purpose)", ach, subj3) ) {
77 Standard_Integer num4 = subj3;
78 Standard_Integer nbj0 = data->NbParams(data->ParamNumber(sub3,i0));
79 for ( Standard_Integer j0=1; j0 <= nbj0; j0++ ) {
80 Handle(StepElement_CurveElementPurposeMember) aMember = new StepElement_CurveElementPurposeMember;
81 data->ReadMember(num4, j0, "curve_element_purpose", ach, aMember);
82 //data->ReadEntity (num4, j0, "curve_element_purpose", ach, anIt0);
83 HSCEPM->Append(aMember);
86 aPurpose->SetValue(i0, HSCEPM);
91 ent->Init(aElementDescriptor_TopologyOrder,
92 aElementDescriptor_Description,
96 //=======================================================================
97 //function : WriteStep
99 //=======================================================================
101 void RWStepElement_RWCurve3dElementDescriptor::WriteStep (StepData_StepWriter& SW,
102 const Handle(StepElement_Curve3dElementDescriptor) &ent) const
105 // Inherited fields of ElementDescriptor
107 switch (ent->StepElement_ElementDescriptor::TopologyOrder()) {
108 case StepElement_Linear: SW.SendEnum (".LINEAR."); break;
109 case StepElement_Quadratic: SW.SendEnum (".QUADRATIC."); break;
110 case StepElement_Cubic: SW.SendEnum (".CUBIC."); break;
113 SW.Send (ent->StepElement_ElementDescriptor::Description());
115 // Own fields of Curve3dElementDescriptor
118 for (Standard_Integer i2=1; i2 <= ent->Purpose()->Length(); i2++ ) {
119 SW.NewLine(Standard_False);
121 Handle(StepElement_HSequenceOfCurveElementPurposeMember) HSCEPM = ent->Purpose()->Value(i2);
122 for (Standard_Integer j2=1; j2 <= HSCEPM->Length(); j2++ ) {
123 Handle(StepElement_CurveElementPurposeMember) Var0 = HSCEPM->Value(j2);
131 //=======================================================================
134 //=======================================================================
136 void RWStepElement_RWCurve3dElementDescriptor::Share (const Handle(StepElement_Curve3dElementDescriptor)&,
137 Interface_EntityIterator&) const
140 // Inherited fields of ElementDescriptor
142 // Own fields of Curve3dElementDescriptor
143 /* CKY 17JUN04. Content is made of strings and enums. No entity !
144 for (Standard_Integer i1=1; i1 <= ent->Purpose()->Length(); i1++ ) {
145 Handle(StepElement_HSequenceOfCurveElementPurposeMember) HSCEPM = ent->Purpose()->Value(i1);
146 for (Standard_Integer i2=1; i2 <= HSCEPM->Length(); i2++ ) {
147 Handle(StepElement_CurveElementPurposeMember) Var1 = HSCEPM->Value(i2);