b311480e |
1 | // Created on: 2002-12-12 |
2 | // Created by: data exchange team |
973c2be1 |
3 | // Copyright (c) 2002-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
b311480e |
6 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
b311480e |
15 | |
7fd59977 |
16 | // Generator: ExpToCas (EXPRESS -> CASCADE/XSTEP Translator) V1.2 |
7fd59977 |
17 | |
18 | #include <RWStepElement_RWCurve3dElementDescriptor.ixx> |
19 | #include <StepElement_CurveElementPurposeMember.hxx> |
20 | #include <StepElement_HArray1OfHSequenceOfCurveElementPurposeMember.hxx> |
21 | #include <StepElement_HSequenceOfCurveElementPurposeMember.hxx> |
22 | |
23 | //======================================================================= |
24 | //function : RWStepElement_RWCurve3dElementDescriptor |
25 | //purpose : |
26 | //======================================================================= |
27 | |
28 | RWStepElement_RWCurve3dElementDescriptor::RWStepElement_RWCurve3dElementDescriptor () |
29 | { |
30 | } |
31 | |
32 | //======================================================================= |
33 | //function : ReadStep |
34 | //purpose : |
35 | //======================================================================= |
36 | |
37 | void RWStepElement_RWCurve3dElementDescriptor::ReadStep (const Handle(StepData_StepReaderData)& data, |
38 | const Standard_Integer num, |
39 | Handle(Interface_Check)& ach, |
40 | const Handle(StepElement_Curve3dElementDescriptor) &ent) const |
41 | { |
42 | // Check number of parameters |
43 | if ( ! data->CheckNbParams(num,3,ach,"curve3d_element_descriptor") ) return; |
44 | |
45 | // Inherited fields of ElementDescriptor |
46 | |
1d47d8d0 |
47 | StepElement_ElementOrder aElementDescriptor_TopologyOrder = StepElement_Linear; |
7fd59977 |
48 | if (data->ParamType (num, 1) == Interface_ParamEnum) { |
49 | Standard_CString text = data->ParamCValue(num, 1); |
50 | if (strcmp(text, ".LINEAR.")==0) aElementDescriptor_TopologyOrder = StepElement_Linear; |
51 | else if (strcmp(text, ".QUADRATIC.")==0) aElementDescriptor_TopologyOrder = StepElement_Quadratic; |
52 | else if (strcmp(text, ".CUBIC.")==0) aElementDescriptor_TopologyOrder = StepElement_Cubic; |
53 | else ach->AddFail("Parameter #1 (element_descriptor.topology_order) has not allowed value"); |
54 | } |
55 | else ach->AddFail("Parameter #1 (element_descriptor.topology_order) is not enumeration"); |
56 | |
57 | Handle(TCollection_HAsciiString) aElementDescriptor_Description; |
58 | data->ReadString (num, 2, "element_descriptor.description", ach, aElementDescriptor_Description); |
59 | |
60 | // Own fields of Curve3dElementDescriptor |
61 | |
62 | Handle(StepElement_HArray1OfHSequenceOfCurveElementPurposeMember) aPurpose; |
63 | Standard_Integer sub3 = 0; |
64 | if ( data->ReadSubList (num, 3, "purpose", ach, sub3) ) { |
65 | Standard_Integer nb0 = data->NbParams(sub3); |
66 | //Standard_Integer nbj0 = data->NbParams(data->ParamNumber(sub3,1)); |
67 | aPurpose = new StepElement_HArray1OfHSequenceOfCurveElementPurposeMember (1, nb0); |
68 | for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) { |
69 | Handle(StepElement_HSequenceOfCurveElementPurposeMember) HSCEPM = |
70 | new StepElement_HSequenceOfCurveElementPurposeMember; |
71 | Standard_Integer subj3 = 0; |
72 | if ( data->ReadSubList (sub3, i0, "sub-part(purpose)", ach, subj3) ) { |
73 | Standard_Integer num4 = subj3; |
74 | Standard_Integer nbj0 = data->NbParams(data->ParamNumber(sub3,i0)); |
75 | for ( Standard_Integer j0=1; j0 <= nbj0; j0++ ) { |
76 | Handle(StepElement_CurveElementPurposeMember) aMember = new StepElement_CurveElementPurposeMember; |
77 | data->ReadMember(num4, j0, "curve_element_purpose", ach, aMember); |
78 | //data->ReadEntity (num4, j0, "curve_element_purpose", ach, anIt0); |
79 | HSCEPM->Append(aMember); |
80 | } |
81 | } |
82 | aPurpose->SetValue(i0, HSCEPM); |
83 | } |
84 | } |
85 | |
86 | // Initialize entity |
87 | ent->Init(aElementDescriptor_TopologyOrder, |
88 | aElementDescriptor_Description, |
89 | aPurpose); |
90 | } |
91 | |
92 | //======================================================================= |
93 | //function : WriteStep |
94 | //purpose : |
95 | //======================================================================= |
96 | |
97 | void RWStepElement_RWCurve3dElementDescriptor::WriteStep (StepData_StepWriter& SW, |
98 | const Handle(StepElement_Curve3dElementDescriptor) &ent) const |
99 | { |
100 | |
101 | // Inherited fields of ElementDescriptor |
102 | |
103 | switch (ent->StepElement_ElementDescriptor::TopologyOrder()) { |
104 | case StepElement_Linear: SW.SendEnum (".LINEAR."); break; |
105 | case StepElement_Quadratic: SW.SendEnum (".QUADRATIC."); break; |
106 | case StepElement_Cubic: SW.SendEnum (".CUBIC."); break; |
107 | } |
108 | |
109 | SW.Send (ent->StepElement_ElementDescriptor::Description()); |
110 | |
111 | // Own fields of Curve3dElementDescriptor |
112 | |
113 | SW.OpenSub(); |
114 | for (Standard_Integer i2=1; i2 <= ent->Purpose()->Length(); i2++ ) { |
115 | SW.NewLine(Standard_False); |
116 | SW.OpenSub(); |
117 | Handle(StepElement_HSequenceOfCurveElementPurposeMember) HSCEPM = ent->Purpose()->Value(i2); |
118 | for (Standard_Integer j2=1; j2 <= HSCEPM->Length(); j2++ ) { |
119 | Handle(StepElement_CurveElementPurposeMember) Var0 = HSCEPM->Value(j2); |
120 | SW.Send (Var0); |
121 | } |
122 | SW.CloseSub(); |
123 | } |
124 | SW.CloseSub(); |
125 | } |
126 | |
127 | //======================================================================= |
128 | //function : Share |
129 | //purpose : |
130 | //======================================================================= |
131 | |
35e08fe8 |
132 | void RWStepElement_RWCurve3dElementDescriptor::Share (const Handle(StepElement_Curve3dElementDescriptor)&, |
133 | Interface_EntityIterator&) const |
7fd59977 |
134 | { |
135 | |
136 | // Inherited fields of ElementDescriptor |
137 | |
138 | // Own fields of Curve3dElementDescriptor |
139 | /* CKY 17JUN04. Content is made of strings and enums. No entity ! |
140 | for (Standard_Integer i1=1; i1 <= ent->Purpose()->Length(); i1++ ) { |
141 | Handle(StepElement_HSequenceOfCurveElementPurposeMember) HSCEPM = ent->Purpose()->Value(i1); |
142 | for (Standard_Integer i2=1; i2 <= HSCEPM->Length(); i2++ ) { |
143 | Handle(StepElement_CurveElementPurposeMember) Var1 = HSCEPM->Value(i2); |
144 | iter.AddItem (Var1); |
145 | } |
146 | } |
147 | */ |
148 | } |