0033018: Coding - get rid of unused headers [Plugin to ShapeAnalysis]
[occt.git] / src / RWStepShape / RWStepShape_RWAngularSize.cxx
1 // Created on: 2000-04-18
2 // Created by: Andrey BETENEV
3 // Copyright (c) 2000-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
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.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 // Generator:   ExpToCas (EXPRESS -> CASCADE/XSTEP Translator) V1.0
17
18 #include <Interface_EntityIterator.hxx>
19 #include <RWStepShape_RWAngularSize.hxx>
20 #include <StepData_StepReaderData.hxx>
21 #include <StepData_StepWriter.hxx>
22 #include <StepRepr_ShapeAspect.hxx>
23 #include <StepShape_AngularSize.hxx>
24
25 //=======================================================================
26 //function : RWStepShape_RWAngularSize
27 //purpose  : 
28 //=======================================================================
29 RWStepShape_RWAngularSize::RWStepShape_RWAngularSize ()
30 {
31 }
32
33 //=======================================================================
34 //function : ReadStep
35 //purpose  : 
36 //=======================================================================
37
38 void RWStepShape_RWAngularSize::ReadStep (const Handle(StepData_StepReaderData)& data,
39                                           const Standard_Integer num,
40                                           Handle(Interface_Check)& ach,
41                                           const Handle(StepShape_AngularSize) &ent) const
42 {
43   // Check number of parameters
44   if ( ! data->CheckNbParams(num,3,ach,"angular_size") ) return;
45
46   // Inherited fields of DimensionalSize
47
48   Handle(StepRepr_ShapeAspect) aDimensionalSize_AppliesTo;
49   data->ReadEntity (num, 1, "dimensional_size.applies_to", ach, STANDARD_TYPE(StepRepr_ShapeAspect), aDimensionalSize_AppliesTo);
50
51   Handle(TCollection_HAsciiString) aDimensionalSize_Name;
52   data->ReadString (num, 2, "dimensional_size.name", ach, aDimensionalSize_Name);
53
54   // Own fields of AngularSize
55
56 // PTV 16.09.2000
57 // default value set as StepShape_Small, cause there wasn`t default value, but may be situation when
58 // value will not be initialized and returned in ent->Init.
59
60   StepShape_AngleRelator aAngleSelection = StepShape_Small;
61   if (data->ParamType (num, 3) == Interface_ParamEnum) {
62     Standard_CString text = data->ParamCValue(num, 3);
63     if      (strcmp(text, ".EQUAL.") == 0) aAngleSelection = StepShape_Equal;
64     else if (strcmp(text, ".LARGE.") == 0) aAngleSelection = StepShape_Large;
65     else if (strcmp(text, ".SMALL.") == 0) aAngleSelection = StepShape_Small;
66     else ach->AddFail("Parameter #3 (angle_selection) has not allowed value");
67   }
68   else ach->AddFail("Parameter #3 (angle_selection) is not enumeration");
69
70   // Initialize entity
71   ent->Init(aDimensionalSize_AppliesTo,
72             aDimensionalSize_Name,
73             aAngleSelection);
74 }
75
76 //=======================================================================
77 //function : WriteStep
78 //purpose  : 
79 //=======================================================================
80
81 void RWStepShape_RWAngularSize::WriteStep (StepData_StepWriter& SW,
82                                            const Handle(StepShape_AngularSize) &ent) const
83 {
84
85   // Inherited fields of DimensionalSize
86
87   SW.Send (ent->StepShape_DimensionalSize::AppliesTo());
88
89   SW.Send (ent->StepShape_DimensionalSize::Name());
90
91   // Own fields of AngularSize
92
93   switch (ent->AngleSelection()) {
94     case StepShape_Equal: SW.SendEnum (".EQUAL."); break;
95     case StepShape_Large: SW.SendEnum (".LARGE."); break;
96     case StepShape_Small: SW.SendEnum (".SMALL."); break;
97   }
98 }
99
100 //=======================================================================
101 //function : Share
102 //purpose  : 
103 //=======================================================================
104
105 void RWStepShape_RWAngularSize::Share (const Handle(StepShape_AngularSize) &ent,
106                                        Interface_EntityIterator& iter) const
107 {
108
109   // Inherited fields of DimensionalSize
110
111   iter.AddItem (ent->StepShape_DimensionalSize::AppliesTo());
112
113   // Own fields of AngularSize
114 }