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 <RWStepElement_RWVolume3dElementDescriptor.ixx>
19 #include <StepElement_HArray1OfVolumeElementPurposeMember.hxx>
20 #include <StepElement_VolumeElementPurposeMember.hxx>
22 //=======================================================================
23 //function : RWStepElement_RWVolume3dElementDescriptor
25 //=======================================================================
27 RWStepElement_RWVolume3dElementDescriptor::RWStepElement_RWVolume3dElementDescriptor ()
31 //=======================================================================
34 //=======================================================================
36 void RWStepElement_RWVolume3dElementDescriptor::ReadStep (const Handle(StepData_StepReaderData)& data,
37 const Standard_Integer num,
38 Handle(Interface_Check)& ach,
39 const Handle(StepElement_Volume3dElementDescriptor) &ent) const
41 // Check number of parameters
42 if ( ! data->CheckNbParams(num,4,ach,"volume3d_element_descriptor") ) return;
44 // Inherited fields of ElementDescriptor
46 StepElement_ElementOrder aElementDescriptor_TopologyOrder = StepElement_Linear;
47 if (data->ParamType (num, 1) == Interface_ParamEnum) {
48 Standard_CString text = data->ParamCValue(num, 1);
49 if (!strcmp(text, ".LINEAR.")) aElementDescriptor_TopologyOrder = StepElement_Linear;
50 else if (!strcmp(text, ".QUADRATIC.")) aElementDescriptor_TopologyOrder = StepElement_Quadratic;
51 else if (!strcmp(text, ".CUBIC.")) aElementDescriptor_TopologyOrder = StepElement_Cubic;
52 else ach->AddFail("Parameter #1 (element_descriptor.topology_order) has not allowed value");
54 else ach->AddFail("Parameter #1 (element_descriptor.topology_order) is not enumeration");
56 Handle(TCollection_HAsciiString) aElementDescriptor_Description;
57 data->ReadString (num, 2, "element_descriptor.description", ach, aElementDescriptor_Description);
59 // Own fields of Volume3dElementDescriptor
61 Handle(StepElement_HArray1OfVolumeElementPurposeMember) aPurpose;
62 Standard_Integer sub3 = 0;
63 if ( data->ReadSubList (num, 3, "purpose", ach, sub3) ) {
64 Standard_Integer nb0 = data->NbParams(sub3);
65 aPurpose = new StepElement_HArray1OfVolumeElementPurposeMember (1, nb0);
66 Standard_Integer num2 = sub3;
67 for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
68 //StepElement_VolumeElementPurpose anIt0;
69 Handle(StepElement_VolumeElementPurposeMember) aMember = new StepElement_VolumeElementPurposeMember;
70 //data->ReadEntity (num2, i0, "volume_element_purpose", ach, anIt0);
71 data->ReadMember (num2, i0, "volume_element_purpose", ach, aMember);
72 aPurpose->SetValue(i0, aMember);
76 StepElement_Volume3dElementShape aShape = StepElement_Hexahedron;
77 if (data->ParamType (num, 4) == Interface_ParamEnum) {
78 Standard_CString text = data->ParamCValue(num, 4);
79 if (!strcmp(text, ".HEXAHEDRON.")) aShape = StepElement_Hexahedron;
80 else if (!strcmp(text, ".WEDGE.")) aShape = StepElement_Wedge;
81 else if (!strcmp(text, ".TETRAHEDRON.")) aShape = StepElement_Tetrahedron;
82 else if (!strcmp(text, ".PYRAMID.")) aShape = StepElement_Pyramid;
83 else ach->AddFail("Parameter #4 (shape) has not allowed value");
85 else ach->AddFail("Parameter #4 (shape) is not enumeration");
88 ent->Init(aElementDescriptor_TopologyOrder,
89 aElementDescriptor_Description,
94 //=======================================================================
95 //function : WriteStep
97 //=======================================================================
99 void RWStepElement_RWVolume3dElementDescriptor::WriteStep (StepData_StepWriter& SW,
100 const Handle(StepElement_Volume3dElementDescriptor) &ent) const
103 // Inherited fields of ElementDescriptor
105 switch (ent->StepElement_ElementDescriptor::TopologyOrder()) {
106 case StepElement_Linear: SW.SendEnum (".LINEAR."); break;
107 case StepElement_Quadratic: SW.SendEnum (".QUADRATIC."); break;
108 case StepElement_Cubic: SW.SendEnum (".CUBIC."); break;
111 SW.Send (ent->StepElement_ElementDescriptor::Description());
113 // Own fields of Volume3dElementDescriptor
116 for (Standard_Integer i2=1; i2 <= ent->Purpose()->Length(); i2++ ) {
117 Handle(StepElement_VolumeElementPurposeMember) Var0 = ent->Purpose()->Value(i2);
122 switch (ent->Shape()) {
123 case StepElement_Hexahedron: SW.SendEnum (".HEXAHEDRON."); break;
124 case StepElement_Wedge: SW.SendEnum (".WEDGE."); break;
125 case StepElement_Tetrahedron: SW.SendEnum (".TETRAHEDRON."); break;
126 case StepElement_Pyramid: SW.SendEnum (".PYRAMID."); break;
130 //=======================================================================
133 //=======================================================================
135 void RWStepElement_RWVolume3dElementDescriptor::Share (const Handle(StepElement_Volume3dElementDescriptor) &,
136 Interface_EntityIterator&) const
139 // Inherited fields of ElementDescriptor
141 // Own fields of Volume3dElementDescriptor
142 /* CKY 17JUN04 : content is made of STRINGS and ENUMS. No entity !
143 for (Standard_Integer i1=1; i1 <= ent->Purpose()->Length(); i1++ ) {
144 Handle(StepElement_VolumeElementPurposeMember) Var0 = ent->Purpose()->Value(i1);