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 | |
42cf5bc1 |
18 | #include <Interface_Check.hxx> |
19 | #include <Interface_EntityIterator.hxx> |
20 | #include <RWStepElement_RWVolume3dElementDescriptor.hxx> |
21 | #include <StepData_StepReaderData.hxx> |
22 | #include <StepData_StepWriter.hxx> |
7fd59977 |
23 | #include <StepElement_HArray1OfVolumeElementPurposeMember.hxx> |
42cf5bc1 |
24 | #include <StepElement_Volume3dElementDescriptor.hxx> |
7fd59977 |
25 | #include <StepElement_VolumeElementPurposeMember.hxx> |
26 | |
27 | //======================================================================= |
28 | //function : RWStepElement_RWVolume3dElementDescriptor |
29 | //purpose : |
30 | //======================================================================= |
7fd59977 |
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 | |
1d47d8d0 |
50 | StepElement_ElementOrder aElementDescriptor_TopologyOrder = StepElement_Linear; |
7fd59977 |
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 | |
1d47d8d0 |
80 | StepElement_Volume3dElementShape aShape = StepElement_Hexahedron; |
7fd59977 |
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 | } |