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_RWVolume3dElementDescriptor.hxx>
21 #include <StepData_StepReaderData.hxx>
22 #include <StepData_StepWriter.hxx>
23 #include <StepElement_HArray1OfVolumeElementPurposeMember.hxx>
24 #include <StepElement_Volume3dElementDescriptor.hxx>
25 #include <StepElement_VolumeElementPurposeMember.hxx>
27 //=======================================================================
28 //function : RWStepElement_RWVolume3dElementDescriptor
30 //=======================================================================
31 RWStepElement_RWVolume3dElementDescriptor::RWStepElement_RWVolume3dElementDescriptor ()
35 //=======================================================================
38 //=======================================================================
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
45 // Check number of parameters
46 if ( ! data->CheckNbParams(num,4,ach,"volume3d_element_descriptor") ) return;
48 // Inherited fields of ElementDescriptor
50 StepElement_ElementOrder aElementDescriptor_TopologyOrder = StepElement_Linear;
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");
58 else ach->AddFail("Parameter #1 (element_descriptor.topology_order) is not enumeration");
60 Handle(TCollection_HAsciiString) aElementDescriptor_Description;
61 data->ReadString (num, 2, "element_descriptor.description", ach, aElementDescriptor_Description);
63 // Own fields of Volume3dElementDescriptor
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);
80 StepElement_Volume3dElementShape aShape = StepElement_Hexahedron;
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");
89 else ach->AddFail("Parameter #4 (shape) is not enumeration");
92 ent->Init(aElementDescriptor_TopologyOrder,
93 aElementDescriptor_Description,
98 //=======================================================================
99 //function : WriteStep
101 //=======================================================================
103 void RWStepElement_RWVolume3dElementDescriptor::WriteStep (StepData_StepWriter& SW,
104 const Handle(StepElement_Volume3dElementDescriptor) &ent) const
107 // Inherited fields of ElementDescriptor
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;
115 SW.Send (ent->StepElement_ElementDescriptor::Description());
117 // Own fields of Volume3dElementDescriptor
120 for (Standard_Integer i2=1; i2 <= ent->Purpose()->Length(); i2++ ) {
121 Handle(StepElement_VolumeElementPurposeMember) Var0 = ent->Purpose()->Value(i2);
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;
134 //=======================================================================
137 //=======================================================================
139 void RWStepElement_RWVolume3dElementDescriptor::Share (const Handle(StepElement_Volume3dElementDescriptor) &,
140 Interface_EntityIterator&) const
143 // Inherited fields of ElementDescriptor
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);