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_RWVolume3dElementDescriptor.ixx> |
23 | #include <StepElement_HArray1OfVolumeElementPurposeMember.hxx> |
24 | #include <StepElement_VolumeElementPurposeMember.hxx> |
25 | |
26 | //======================================================================= |
27 | //function : RWStepElement_RWVolume3dElementDescriptor |
28 | //purpose : |
29 | //======================================================================= |
30 | |
31 | RWStepElement_RWVolume3dElementDescriptor::RWStepElement_RWVolume3dElementDescriptor () |
32 | { |
33 | } |
34 | |
35 | //======================================================================= |
36 | //function : ReadStep |
37 | //purpose : |
38 | //======================================================================= |
39 | |
40 | void RWStepElement_RWVolume3dElementDescriptor::ReadStep (const Handle(StepData_StepReaderData)& data, |
41 | const Standard_Integer num, |
42 | Handle(Interface_Check)& ach, |
43 | const Handle(StepElement_Volume3dElementDescriptor) &ent) const |
44 | { |
45 | // Check number of parameters |
46 | if ( ! data->CheckNbParams(num,4,ach,"volume3d_element_descriptor") ) return; |
47 | |
48 | // Inherited fields of ElementDescriptor |
49 | |
50 | StepElement_ElementOrder aElementDescriptor_TopologyOrder; |
51 | if (data->ParamType (num, 1) == Interface_ParamEnum) { |
52 | Standard_CString text = data->ParamCValue(num, 1); |
53 | if (!strcmp(text, ".LINEAR.")) aElementDescriptor_TopologyOrder = StepElement_Linear; |
54 | else if (!strcmp(text, ".QUADRATIC.")) aElementDescriptor_TopologyOrder = StepElement_Quadratic; |
55 | else if (!strcmp(text, ".CUBIC.")) aElementDescriptor_TopologyOrder = StepElement_Cubic; |
56 | else ach->AddFail("Parameter #1 (element_descriptor.topology_order) has not allowed value"); |
57 | } |
58 | else ach->AddFail("Parameter #1 (element_descriptor.topology_order) is not enumeration"); |
59 | |
60 | Handle(TCollection_HAsciiString) aElementDescriptor_Description; |
61 | data->ReadString (num, 2, "element_descriptor.description", ach, aElementDescriptor_Description); |
62 | |
63 | // Own fields of Volume3dElementDescriptor |
64 | |
65 | Handle(StepElement_HArray1OfVolumeElementPurposeMember) aPurpose; |
66 | Standard_Integer sub3 = 0; |
67 | if ( data->ReadSubList (num, 3, "purpose", ach, sub3) ) { |
68 | Standard_Integer nb0 = data->NbParams(sub3); |
69 | aPurpose = new StepElement_HArray1OfVolumeElementPurposeMember (1, nb0); |
70 | Standard_Integer num2 = sub3; |
71 | for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) { |
72 | //StepElement_VolumeElementPurpose anIt0; |
73 | Handle(StepElement_VolumeElementPurposeMember) aMember = new StepElement_VolumeElementPurposeMember; |
74 | //data->ReadEntity (num2, i0, "volume_element_purpose", ach, anIt0); |
75 | data->ReadMember (num2, i0, "volume_element_purpose", ach, aMember); |
76 | aPurpose->SetValue(i0, aMember); |
77 | } |
78 | } |
79 | |
80 | StepElement_Volume3dElementShape aShape; |
81 | if (data->ParamType (num, 4) == Interface_ParamEnum) { |
82 | Standard_CString text = data->ParamCValue(num, 4); |
83 | if (!strcmp(text, ".HEXAHEDRON.")) aShape = StepElement_Hexahedron; |
84 | else if (!strcmp(text, ".WEDGE.")) aShape = StepElement_Wedge; |
85 | else if (!strcmp(text, ".TETRAHEDRON.")) aShape = StepElement_Tetrahedron; |
86 | else if (!strcmp(text, ".PYRAMID.")) aShape = StepElement_Pyramid; |
87 | else ach->AddFail("Parameter #4 (shape) has not allowed value"); |
88 | } |
89 | else ach->AddFail("Parameter #4 (shape) is not enumeration"); |
90 | |
91 | // Initialize entity |
92 | ent->Init(aElementDescriptor_TopologyOrder, |
93 | aElementDescriptor_Description, |
94 | aPurpose, |
95 | aShape); |
96 | } |
97 | |
98 | //======================================================================= |
99 | //function : WriteStep |
100 | //purpose : |
101 | //======================================================================= |
102 | |
103 | void RWStepElement_RWVolume3dElementDescriptor::WriteStep (StepData_StepWriter& SW, |
104 | const Handle(StepElement_Volume3dElementDescriptor) &ent) const |
105 | { |
106 | |
107 | // Inherited fields of ElementDescriptor |
108 | |
109 | switch (ent->StepElement_ElementDescriptor::TopologyOrder()) { |
110 | case StepElement_Linear: SW.SendEnum (".LINEAR."); break; |
111 | case StepElement_Quadratic: SW.SendEnum (".QUADRATIC."); break; |
112 | case StepElement_Cubic: SW.SendEnum (".CUBIC."); break; |
113 | } |
114 | |
115 | SW.Send (ent->StepElement_ElementDescriptor::Description()); |
116 | |
117 | // Own fields of Volume3dElementDescriptor |
118 | |
119 | SW.OpenSub(); |
120 | for (Standard_Integer i2=1; i2 <= ent->Purpose()->Length(); i2++ ) { |
121 | Handle(StepElement_VolumeElementPurposeMember) Var0 = ent->Purpose()->Value(i2); |
122 | SW.Send (Var0); |
123 | } |
124 | SW.CloseSub(); |
125 | |
126 | switch (ent->Shape()) { |
127 | case StepElement_Hexahedron: SW.SendEnum (".HEXAHEDRON."); break; |
128 | case StepElement_Wedge: SW.SendEnum (".WEDGE."); break; |
129 | case StepElement_Tetrahedron: SW.SendEnum (".TETRAHEDRON."); break; |
130 | case StepElement_Pyramid: SW.SendEnum (".PYRAMID."); break; |
131 | } |
132 | } |
133 | |
134 | //======================================================================= |
135 | //function : Share |
136 | //purpose : |
137 | //======================================================================= |
138 | |
35e08fe8 |
139 | void RWStepElement_RWVolume3dElementDescriptor::Share (const Handle(StepElement_Volume3dElementDescriptor) &, |
140 | Interface_EntityIterator&) const |
7fd59977 |
141 | { |
142 | |
143 | // Inherited fields of ElementDescriptor |
144 | |
145 | // Own fields of Volume3dElementDescriptor |
146 | /* CKY 17JUN04 : content is made of STRINGS and ENUMS. No entity ! |
147 | for (Standard_Integer i1=1; i1 <= ent->Purpose()->Length(); i1++ ) { |
148 | Handle(StepElement_VolumeElementPurposeMember) Var0 = ent->Purpose()->Value(i1); |
149 | iter.AddItem (Var0); |
150 | } |
151 | */ |
152 | } |