b311480e |
1 | // Created on: 2002-12-12 |
2 | // Created by: data exchange team |
3 | // Copyright (c) 2002-2012 OPEN CASCADE SAS |
4 | // |
5 | // The content of this file is subject to the Open CASCADE Technology Public |
6 | // License Version 6.5 (the "License"). You may not use the content of this file |
7 | // except in compliance with the License. Please obtain a copy of the License |
8 | // at http://www.opencascade.org and read it completely before using this file. |
9 | // |
10 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
11 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
12 | // |
13 | // The Original Code and all software distributed under the License is |
14 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
15 | // Initial Developer hereby disclaims all such warranties, including without |
16 | // limitation, any warranties of merchantability, fitness for a particular |
17 | // purpose or non-infringement. Please see the License for the specific terms |
18 | // and conditions governing the rights and limitations under the License. |
19 | |
7fd59977 |
20 | // Generator: ExpToCas (EXPRESS -> CASCADE/XSTEP Translator) V1.2 |
7fd59977 |
21 | |
22 | #include <RWStepElement_RWCurve3dElementDescriptor.ixx> |
23 | #include <StepElement_CurveElementPurposeMember.hxx> |
24 | #include <StepElement_HArray1OfHSequenceOfCurveElementPurposeMember.hxx> |
25 | #include <StepElement_HSequenceOfCurveElementPurposeMember.hxx> |
26 | |
27 | //======================================================================= |
28 | //function : RWStepElement_RWCurve3dElementDescriptor |
29 | //purpose : |
30 | //======================================================================= |
31 | |
32 | RWStepElement_RWCurve3dElementDescriptor::RWStepElement_RWCurve3dElementDescriptor () |
33 | { |
34 | } |
35 | |
36 | //======================================================================= |
37 | //function : ReadStep |
38 | //purpose : |
39 | //======================================================================= |
40 | |
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 |
45 | { |
46 | // Check number of parameters |
47 | if ( ! data->CheckNbParams(num,3,ach,"curve3d_element_descriptor") ) return; |
48 | |
49 | // Inherited fields of ElementDescriptor |
50 | |
1d47d8d0 |
51 | StepElement_ElementOrder aElementDescriptor_TopologyOrder = StepElement_Linear; |
7fd59977 |
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"); |
58 | } |
59 | else ach->AddFail("Parameter #1 (element_descriptor.topology_order) is not enumeration"); |
60 | |
61 | Handle(TCollection_HAsciiString) aElementDescriptor_Description; |
62 | data->ReadString (num, 2, "element_descriptor.description", ach, aElementDescriptor_Description); |
63 | |
64 | // Own fields of Curve3dElementDescriptor |
65 | |
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); |
84 | } |
85 | } |
86 | aPurpose->SetValue(i0, HSCEPM); |
87 | } |
88 | } |
89 | |
90 | // Initialize entity |
91 | ent->Init(aElementDescriptor_TopologyOrder, |
92 | aElementDescriptor_Description, |
93 | aPurpose); |
94 | } |
95 | |
96 | //======================================================================= |
97 | //function : WriteStep |
98 | //purpose : |
99 | //======================================================================= |
100 | |
101 | void RWStepElement_RWCurve3dElementDescriptor::WriteStep (StepData_StepWriter& SW, |
102 | const Handle(StepElement_Curve3dElementDescriptor) &ent) const |
103 | { |
104 | |
105 | // Inherited fields of ElementDescriptor |
106 | |
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; |
111 | } |
112 | |
113 | SW.Send (ent->StepElement_ElementDescriptor::Description()); |
114 | |
115 | // Own fields of Curve3dElementDescriptor |
116 | |
117 | SW.OpenSub(); |
118 | for (Standard_Integer i2=1; i2 <= ent->Purpose()->Length(); i2++ ) { |
119 | SW.NewLine(Standard_False); |
120 | SW.OpenSub(); |
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); |
124 | SW.Send (Var0); |
125 | } |
126 | SW.CloseSub(); |
127 | } |
128 | SW.CloseSub(); |
129 | } |
130 | |
131 | //======================================================================= |
132 | //function : Share |
133 | //purpose : |
134 | //======================================================================= |
135 | |
35e08fe8 |
136 | void RWStepElement_RWCurve3dElementDescriptor::Share (const Handle(StepElement_Curve3dElementDescriptor)&, |
137 | Interface_EntityIterator&) const |
7fd59977 |
138 | { |
139 | |
140 | // Inherited fields of ElementDescriptor |
141 | |
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); |
148 | iter.AddItem (Var1); |
149 | } |
150 | } |
151 | */ |
152 | } |