1 // Created on: 2000-04-18
2 // Created by: Andrey BETENEV
3 // Copyright (c) 2000-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.0
18 #include <Interface_Check.hxx>
19 #include <Interface_EntityIterator.hxx>
20 #include <RWStepShape_RWAngularSize.hxx>
21 #include <StepData_StepReaderData.hxx>
22 #include <StepData_StepWriter.hxx>
23 #include <StepRepr_ShapeAspect.hxx>
24 #include <StepShape_AngularSize.hxx>
26 //=======================================================================
27 //function : RWStepShape_RWAngularSize
29 //=======================================================================
30 RWStepShape_RWAngularSize::RWStepShape_RWAngularSize ()
34 //=======================================================================
37 //=======================================================================
39 void RWStepShape_RWAngularSize::ReadStep (const Handle(StepData_StepReaderData)& data,
40 const Standard_Integer num,
41 Handle(Interface_Check)& ach,
42 const Handle(StepShape_AngularSize) &ent) const
44 // Check number of parameters
45 if ( ! data->CheckNbParams(num,3,ach,"angular_size") ) return;
47 // Inherited fields of DimensionalSize
49 Handle(StepRepr_ShapeAspect) aDimensionalSize_AppliesTo;
50 data->ReadEntity (num, 1, "dimensional_size.applies_to", ach, STANDARD_TYPE(StepRepr_ShapeAspect), aDimensionalSize_AppliesTo);
52 Handle(TCollection_HAsciiString) aDimensionalSize_Name;
53 data->ReadString (num, 2, "dimensional_size.name", ach, aDimensionalSize_Name);
55 // Own fields of AngularSize
58 // defaul value set as StepShape_Small, cause there wasn`t default value, but may be situation when
59 // value will not be initialized and returnd in ent->Init.
61 StepShape_AngleRelator aAngleSelection = StepShape_Small;
62 if (data->ParamType (num, 3) == Interface_ParamEnum) {
63 Standard_CString text = data->ParamCValue(num, 3);
64 if (strcmp(text, ".EQUAL.") == 0) aAngleSelection = StepShape_Equal;
65 else if (strcmp(text, ".LARGE.") == 0) aAngleSelection = StepShape_Large;
66 else if (strcmp(text, ".SMALL.") == 0) aAngleSelection = StepShape_Small;
67 else ach->AddFail("Parameter #3 (angle_selection) has not allowed value");
69 else ach->AddFail("Parameter #3 (angle_selection) is not enumeration");
72 ent->Init(aDimensionalSize_AppliesTo,
73 aDimensionalSize_Name,
77 //=======================================================================
78 //function : WriteStep
80 //=======================================================================
82 void RWStepShape_RWAngularSize::WriteStep (StepData_StepWriter& SW,
83 const Handle(StepShape_AngularSize) &ent) const
86 // Inherited fields of DimensionalSize
88 SW.Send (ent->StepShape_DimensionalSize::AppliesTo());
90 SW.Send (ent->StepShape_DimensionalSize::Name());
92 // Own fields of AngularSize
94 switch (ent->AngleSelection()) {
95 case StepShape_Equal: SW.SendEnum (".EQUAL."); break;
96 case StepShape_Large: SW.SendEnum (".LARGE."); break;
97 case StepShape_Small: SW.SendEnum (".SMALL."); break;
101 //=======================================================================
104 //=======================================================================
106 void RWStepShape_RWAngularSize::Share (const Handle(StepShape_AngularSize) &ent,
107 Interface_EntityIterator& iter) const
110 // Inherited fields of DimensionalSize
112 iter.AddItem (ent->StepShape_DimensionalSize::AppliesTo());
114 // Own fields of AngularSize