0026371: Implementation of new entities for GD&T
[occt.git] / src / RWStepDimTol / RWStepDimTol_RWSymmetryTolerance.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
42cf5bc1 18#include <Interface_Check.hxx>
19#include <Interface_EntityIterator.hxx>
20#include <RWStepDimTol_RWSymmetryTolerance.hxx>
ec357c5c 21#include <StepBasic_MeasureWithUnit.hxx>
42cf5bc1 22#include <StepData_StepReaderData.hxx>
23#include <StepData_StepWriter.hxx>
24#include <StepDimTol_DatumReference.hxx>
28a73c1f 25#include <StepDimTol_GeometricToleranceTarget.hxx>
26#include <StepDimTol_HArray1OfDatumSystemOrReference.hxx>
42cf5bc1 27#include <StepDimTol_SymmetryTolerance.hxx>
7fd59977 28
29//=======================================================================
30//function : RWStepDimTol_RWSymmetryTolerance
31//purpose :
32//=======================================================================
7fd59977 33RWStepDimTol_RWSymmetryTolerance::RWStepDimTol_RWSymmetryTolerance ()
34{
35}
36
37//=======================================================================
38//function : ReadStep
39//purpose :
40//=======================================================================
41
42void RWStepDimTol_RWSymmetryTolerance::ReadStep (const Handle(StepData_StepReaderData)& data,
43 const Standard_Integer num,
44 Handle(Interface_Check)& ach,
45 const Handle(StepDimTol_SymmetryTolerance) &ent) const
46{
47 // Check number of parameters
48 if ( ! data->CheckNbParams(num,5,ach,"symmetry_tolerance") ) return;
49
50 // Inherited fields of GeometricTolerance
51
52 Handle(TCollection_HAsciiString) aGeometricTolerance_Name;
53 data->ReadString (num, 1, "geometric_tolerance.name", ach, aGeometricTolerance_Name);
54
55 Handle(TCollection_HAsciiString) aGeometricTolerance_Description;
56 data->ReadString (num, 2, "geometric_tolerance.description", ach, aGeometricTolerance_Description);
57
58 Handle(StepBasic_MeasureWithUnit) aGeometricTolerance_Magnitude;
59 data->ReadEntity (num, 3, "geometric_tolerance.magnitude", ach, STANDARD_TYPE(StepBasic_MeasureWithUnit), aGeometricTolerance_Magnitude);
60
28a73c1f 61 StepDimTol_GeometricToleranceTarget aGeometricTolerance_TolerancedShapeAspect;
62 data->ReadEntity (num, 4, "geometric_tolerance.toleranced_shape_aspect", ach, aGeometricTolerance_TolerancedShapeAspect);
7fd59977 63
64 // Inherited fields of GeometricToleranceWithDatumReference
65
28a73c1f 66 Handle(StepDimTol_HArray1OfDatumSystemOrReference) aGeometricToleranceWithDatumReference_DatumSystem;
7fd59977 67 Standard_Integer sub5 = 0;
68 if ( data->ReadSubList (num, 5, "geometric_tolerance_with_datum_reference.datum_system", ach, sub5) ) {
69 Standard_Integer nb0 = data->NbParams(sub5);
28a73c1f 70 aGeometricToleranceWithDatumReference_DatumSystem = new StepDimTol_HArray1OfDatumSystemOrReference (1, nb0);
7fd59977 71 Standard_Integer num2 = sub5;
72 for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
28a73c1f 73 StepDimTol_DatumSystemOrReference anIt0;
74 data->ReadEntity (num2, i0, "datum_system_or_reference", ach, anIt0);
7fd59977 75 aGeometricToleranceWithDatumReference_DatumSystem->SetValue(i0, anIt0);
76 }
77 }
78
79 // Initialize entity
80 ent->Init(aGeometricTolerance_Name,
81 aGeometricTolerance_Description,
82 aGeometricTolerance_Magnitude,
83 aGeometricTolerance_TolerancedShapeAspect,
84 aGeometricToleranceWithDatumReference_DatumSystem);
85}
86
87//=======================================================================
88//function : WriteStep
89//purpose :
90//=======================================================================
91
92void RWStepDimTol_RWSymmetryTolerance::WriteStep (StepData_StepWriter& SW,
93 const Handle(StepDimTol_SymmetryTolerance) &ent) const
94{
95
96 // Inherited fields of GeometricTolerance
97
98 SW.Send (ent->StepDimTol_GeometricTolerance::Name());
99
100 SW.Send (ent->StepDimTol_GeometricTolerance::Description());
101
102 SW.Send (ent->StepDimTol_GeometricTolerance::Magnitude());
103
28a73c1f 104 SW.Send (ent->StepDimTol_GeometricTolerance::TolerancedShapeAspect().Value());
7fd59977 105
106 // Inherited fields of GeometricToleranceWithDatumReference
107
108 SW.OpenSub();
28a73c1f 109 for (Standard_Integer i4=1; i4 <= ent->StepDimTol_GeometricToleranceWithDatumReference::DatumSystemAP242()->Length(); i4++ ) {
110 StepDimTol_DatumSystemOrReference Var0 = ent->StepDimTol_GeometricToleranceWithDatumReference::DatumSystemAP242()->Value(i4);
111 SW.Send (Var0.Value());
7fd59977 112 }
113 SW.CloseSub();
114}
115
116//=======================================================================
117//function : Share
118//purpose :
119//=======================================================================
120
121void RWStepDimTol_RWSymmetryTolerance::Share (const Handle(StepDimTol_SymmetryTolerance) &ent,
122 Interface_EntityIterator& iter) const
123{
124
125 // Inherited fields of GeometricTolerance
126
127 iter.AddItem (ent->StepDimTol_GeometricTolerance::Magnitude());
128
28a73c1f 129 iter.AddItem (ent->StepDimTol_GeometricTolerance::TolerancedShapeAspect().Value());
7fd59977 130
131 // Inherited fields of GeometricToleranceWithDatumReference
132
28a73c1f 133 for (Standard_Integer i3=1; i3 <= ent->StepDimTol_GeometricToleranceWithDatumReference::DatumSystemAP242()->Length(); i3++ ) {
134 StepDimTol_DatumSystemOrReference Var0 = ent->StepDimTol_GeometricToleranceWithDatumReference::DatumSystemAP242()->Value(i3);
135 iter.AddItem (Var0.Value());
7fd59977 136 }
137}