1 // Created on: 2015-07-16
2 // Created by: Irina KRYLOVA
3 // Copyright (c) 2015 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 #include <RWStepDimTol_RWDatumReferenceModifierWithValue.hxx>
18 #include <Interface_Check.hxx>
19 #include <Interface_EntityIterator.hxx>
20 #include <StepData_StepReaderData.hxx>
21 #include <StepData_StepWriter.hxx>
22 #include <StepBasic_LengthMeasureWithUnit.hxx>
23 #include <StepDimTol_DatumReferenceModifierType.hxx>
24 #include <StepDimTol_DatumReferenceModifierWithValue.hxx>
26 //=======================================================================
27 //function : RWStepDimTol_RWGeometricTolerance
29 //=======================================================================
31 RWStepDimTol_RWDatumReferenceModifierWithValue::RWStepDimTol_RWDatumReferenceModifierWithValue ()
35 //=======================================================================
38 //=======================================================================
40 void RWStepDimTol_RWDatumReferenceModifierWithValue::
41 ReadStep (const Handle(StepData_StepReaderData)& data,
42 const Standard_Integer num,
43 Handle(Interface_Check)& ach,
44 const Handle(StepDimTol_DatumReferenceModifierWithValue) &ent) const
46 // Check number of parameters
47 if ( ! data->CheckNbParams(num, 2, ach, "datum_reference_modifier_with_value") ) return;
49 // own fields of DatumReferenceModifierWithValue
51 StepDimTol_DatumReferenceModifierType aModifierType = StepDimTol_CircularOrCylindrical;
52 if (data->ParamType (num, 1) == Interface_ParamEnum) {
53 Standard_CString text = data->ParamCValue(num, 1);
54 if (strcmp(text, ".CIRCULAR_OR_CYLINDRICAL.")==0) aModifierType = StepDimTol_CircularOrCylindrical;
55 else if (strcmp(text, ".DISTANCE.")==0) aModifierType = StepDimTol_Distance;
56 else if (strcmp(text, ".PROJECTED.")==0) aModifierType = StepDimTol_Projected;
57 else if (strcmp(text, ".SPHERICAL.")==0) aModifierType = StepDimTol_Spherical;
58 else ach->AddFail("Parameter #1 (modifier_type) has not allowed value");
60 else ach->AddFail("Parameter #1 (modifier_type) is not an enumeration");
62 Handle(StepBasic_LengthMeasureWithUnit) aModifierValue;
63 data->ReadEntity (num, 2, "modifier_value", ach, STANDARD_TYPE(StepBasic_LengthMeasureWithUnit), aModifierValue);
66 ent->Init(aModifierType,
70 //=======================================================================
71 //function : WriteStep
73 //=======================================================================
75 void RWStepDimTol_RWDatumReferenceModifierWithValue::
76 WriteStep (StepData_StepWriter& SW,
77 const Handle(StepDimTol_DatumReferenceModifierWithValue) &ent) const
79 // own fields of DatumReferenceModifierWithValue
81 switch (ent->ModifierType()) {
82 case StepDimTol_CircularOrCylindrical: SW.SendEnum (".CIRCULAR_OR_CYLINDRICAL."); break;
83 case StepDimTol_Distance: SW.SendEnum (".DISTANCE."); break;
84 case StepDimTol_Projected: SW.SendEnum (".PROJECTED."); break;
85 case StepDimTol_Spherical: SW.SendEnum (".SPHERICAL."); break;
88 SW.Send (ent->ModifierValue());