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