0024947: Redesign OCCT legacy type system -- automatic
[occt.git] / src / RWStepDimTol / RWStepDimTol_RWModifiedGeometricTolerance.cxx
CommitLineData
b311480e 1// Created on: 2003-06-04
2// Created by: Galina KULIKOVA
973c2be1 3// Copyright (c) 2003-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
18#include <RWStepDimTol_RWModifiedGeometricTolerance.ixx>
ec357c5c 19#include <StepBasic_MeasureWithUnit.hxx>
20#include <StepRepr_ShapeAspect.hxx>
7fd59977 21
22//=======================================================================
23//function : RWStepDimTol_RWModifiedGeometricTolerance
24//purpose :
25//=======================================================================
26
27RWStepDimTol_RWModifiedGeometricTolerance::RWStepDimTol_RWModifiedGeometricTolerance ()
28{
29}
30
31//=======================================================================
32//function : ReadStep
33//purpose :
34//=======================================================================
35
36void RWStepDimTol_RWModifiedGeometricTolerance::ReadStep (const Handle(StepData_StepReaderData)& data,
37 const Standard_Integer num,
38 Handle(Interface_Check)& ach,
39 const Handle(StepDimTol_ModifiedGeometricTolerance) &ent) const
40{
41 // Check number of parameters
42 if ( ! data->CheckNbParams(num,5,ach,"modified_geometric_tolerance") ) return;
43
44 // Inherited fields of GeometricTolerance
45
46 Handle(TCollection_HAsciiString) aGeometricTolerance_Name;
47 data->ReadString (num, 1, "geometric_tolerance.name", ach, aGeometricTolerance_Name);
48
49 Handle(TCollection_HAsciiString) aGeometricTolerance_Description;
50 data->ReadString (num, 2, "geometric_tolerance.description", ach, aGeometricTolerance_Description);
51
52 Handle(StepBasic_MeasureWithUnit) aGeometricTolerance_Magnitude;
53 data->ReadEntity (num, 3, "geometric_tolerance.magnitude", ach, STANDARD_TYPE(StepBasic_MeasureWithUnit), aGeometricTolerance_Magnitude);
54
55 Handle(StepRepr_ShapeAspect) aGeometricTolerance_TolerancedShapeAspect;
56 data->ReadEntity (num, 4, "geometric_tolerance.toleranced_shape_aspect", ach, STANDARD_TYPE(StepRepr_ShapeAspect), aGeometricTolerance_TolerancedShapeAspect);
57
58 // Own fields of ModifiedGeometricTolerance
59
1d47d8d0 60 StepDimTol_LimitCondition aModifier = StepDimTol_MaximumMaterialCondition;
7fd59977 61 if (data->ParamType (num, 5) == Interface_ParamEnum) {
62 Standard_CString text = data->ParamCValue(num, 5);
63 if (strcmp(text, ".MAXIMUM_MATERIAL_CONDITION.")==0) aModifier = StepDimTol_MaximumMaterialCondition;
64 else if (strcmp(text, ".LEAST_MATERIAL_CONDITION.")==0) aModifier = StepDimTol_LeastMaterialCondition;
65 else if (strcmp(text, ".REGARDLESS_OF_FEATURE_SIZE.")==0) aModifier = StepDimTol_RegardlessOfFeatureSize;
66 else ach->AddFail("Parameter #5 (modifier) has not allowed value");
67 }
68 else ach->AddFail("Parameter #5 (modifier) is not enumeration");
69
70 // Initialize entity
71 ent->Init(aGeometricTolerance_Name,
72 aGeometricTolerance_Description,
73 aGeometricTolerance_Magnitude,
74 aGeometricTolerance_TolerancedShapeAspect,
75 aModifier);
76}
77
78//=======================================================================
79//function : WriteStep
80//purpose :
81//=======================================================================
82
83void RWStepDimTol_RWModifiedGeometricTolerance::WriteStep (StepData_StepWriter& SW,
84 const Handle(StepDimTol_ModifiedGeometricTolerance) &ent) const
85{
86
87 // Inherited fields of GeometricTolerance
88
89 SW.Send (ent->StepDimTol_GeometricTolerance::Name());
90
91 SW.Send (ent->StepDimTol_GeometricTolerance::Description());
92
93 SW.Send (ent->StepDimTol_GeometricTolerance::Magnitude());
94
95 SW.Send (ent->StepDimTol_GeometricTolerance::TolerancedShapeAspect());
96
97 // Own fields of ModifiedGeometricTolerance
98
99 switch (ent->Modifier()) {
100 case StepDimTol_MaximumMaterialCondition: SW.SendEnum (".MAXIMUM_MATERIAL_CONDITION."); break;
101 case StepDimTol_LeastMaterialCondition: SW.SendEnum (".LEAST_MATERIAL_CONDITION."); break;
102 case StepDimTol_RegardlessOfFeatureSize: SW.SendEnum (".REGARDLESS_OF_FEATURE_SIZE."); break;
103 }
104}
105
106//=======================================================================
107//function : Share
108//purpose :
109//=======================================================================
110
111void RWStepDimTol_RWModifiedGeometricTolerance::Share (const Handle(StepDimTol_ModifiedGeometricTolerance) &ent,
112 Interface_EntityIterator& iter) const
113{
114
115 // Inherited fields of GeometricTolerance
116
117 iter.AddItem (ent->StepDimTol_GeometricTolerance::Magnitude());
118
119 iter.AddItem (ent->StepDimTol_GeometricTolerance::TolerancedShapeAspect());
120
121 // Own fields of ModifiedGeometricTolerance
122}