1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
15 #include <Interface_Check.hxx>
16 #include <Interface_EntityIterator.hxx>
17 #include <RWStepShape_RWToleranceValue.hxx>
18 #include <StepBasic_MeasureWithUnit.hxx>
19 #include <StepData_StepReaderData.hxx>
20 #include <StepData_StepWriter.hxx>
21 #include <StepShape_ToleranceValue.hxx>
22 #include <StepRepr_MeasureRepresentationItem.hxx>
23 #include <StepRepr_ReprItemAndMeasureWithUnit.hxx>
25 RWStepShape_RWToleranceValue::RWStepShape_RWToleranceValue () {}
27 void RWStepShape_RWToleranceValue::ReadStep
28 (const Handle(StepData_StepReaderData)& data,
29 const Standard_Integer num,
30 Handle(Interface_Check)& ach,
31 const Handle(StepShape_ToleranceValue)& ent) const
33 // --- Number of Parameter Control ---
35 if (!data->CheckNbParams(num,2,ach,"tolerance_value")) return;
37 // --- own field : lower_bound ---
39 Handle(Standard_Transient) LB;
40 if(!data->ReadEntity (num,1,"lower_bound",ach,
41 STANDARD_TYPE(StepBasic_MeasureWithUnit),LB))
43 Handle(StepRepr_MeasureRepresentationItem) aMSR;
44 Handle(StepRepr_ReprItemAndMeasureWithUnit) aRIMU;
46 if(data->ReadEntity (num,1,"lower_bound",ach,
47 STANDARD_TYPE(StepRepr_MeasureRepresentationItem),aMSR) ||
48 data->ReadEntity (num,1,"lower_bound",ach,STANDARD_TYPE(StepRepr_ReprItemAndMeasureWithUnit), aRIMU))
52 else if(!aRIMU.IsNull())
57 // --- own field : upper_bound ---
59 Handle(Standard_Transient) UB;
60 if(!data->ReadEntity (num,2,"upper_bound",ach,
61 STANDARD_TYPE(StepBasic_MeasureWithUnit),UB))
63 Handle(StepRepr_MeasureRepresentationItem) aMSR1;
64 Handle(StepRepr_ReprItemAndMeasureWithUnit) aRIMU1;
65 if(data->ReadEntity (num,2,"upper_bound",ach,STANDARD_TYPE(StepRepr_MeasureRepresentationItem),aMSR1) ||
66 data->ReadEntity (num,2,"upper_bound",ach,STANDARD_TYPE(StepRepr_ReprItemAndMeasureWithUnit), aRIMU1))
70 else if(!aRIMU1.IsNull())
75 //--- Initialisation of the read entity ---
76 if( !LB.IsNull() && !UB.IsNull())
82 void RWStepShape_RWToleranceValue::WriteStep
83 (StepData_StepWriter& SW,
84 const Handle(StepShape_ToleranceValue)& ent) const
86 SW.Send (ent->LowerBound());
87 SW.Send (ent->UpperBound());
91 void RWStepShape_RWToleranceValue::Share(const Handle(StepShape_ToleranceValue)& ent, Interface_EntityIterator& iter) const
93 iter.AddItem (ent->LowerBound());
94 iter.AddItem (ent->UpperBound());