1 // Created on: 1999-09-08
2 // Created by: Andrey BETENEV
3 // Copyright (c) 1999-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <Interface_Check.hxx>
19 #include <Interface_EntityIterator.hxx>
20 #include <Interface_MSG.hxx>
21 #include <RWStepRepr_RWMeasureRepresentationItem.hxx>
22 #include <StepBasic_MeasureValueMember.hxx>
23 #include <StepBasic_MeasureWithUnit.hxx>
24 #include <StepData_StepReaderData.hxx>
25 #include <StepData_StepWriter.hxx>
26 #include <StepRepr_MeasureRepresentationItem.hxx>
28 //=======================================================================
29 //function : RWStepRepr_RWMeasureRepresentationItem
31 //=======================================================================
32 RWStepRepr_RWMeasureRepresentationItem::RWStepRepr_RWMeasureRepresentationItem () {}
34 //=======================================================================
37 //=======================================================================
39 void RWStepRepr_RWMeasureRepresentationItem::ReadStep (const Handle(StepData_StepReaderData)& data,
40 const Standard_Integer num,
41 Handle(Interface_Check)& ach,
42 const Handle(StepRepr_MeasureRepresentationItem)& ent) const
44 // --- Number of Parameter Control ---
46 if (!data->CheckNbParams(num,3,ach,"measure_representation_item")) return;
48 // --- inherited from representation_item : name ---
49 Handle(TCollection_HAsciiString) aName;
50 data->ReadString (num,1,"name",ach,aName);
52 // --- inherited from measure_with_unit : value_component ---
53 Handle(StepBasic_MeasureValueMember) mvc = new StepBasic_MeasureValueMember;
54 data->ReadMember (num,2, "value_component", ach, mvc);
56 // --- inherited from measure_with_unit : unit_component ---
57 StepBasic_Unit aUnitComponent;
58 data->ReadEntity(num, 3,"unit_component", ach, aUnitComponent);
60 //--- Initialisation of the read entity ---
62 ent->Init(aName, mvc, aUnitComponent);
65 //=======================================================================
66 //function : WriteStep
68 //=======================================================================
70 void RWStepRepr_RWMeasureRepresentationItem::WriteStep (StepData_StepWriter& SW,
71 const Handle(StepRepr_MeasureRepresentationItem)& ent) const
73 // --- inherited from representation_item : name ---
76 // --- inherited from measure_with_unit : value_component ---
77 SW.Send(ent->Measure()->ValueComponentMember());
79 // --- inherited from measure_with_unit : unit_component ---
80 SW.Send(ent->Measure()->UnitComponent().Value());
83 //=======================================================================
86 //=======================================================================
88 void RWStepRepr_RWMeasureRepresentationItem::Share(const Handle(StepRepr_MeasureRepresentationItem)& ent,
89 Interface_EntityIterator& iter) const
92 iter.GetOneItem(ent->Measure()->UnitComponent().Value());