0033018: Coding - get rid of unused headers [Plugin to ShapeAnalysis]
[occt.git] / src / RWStepRepr / RWStepRepr_RWMeasureRepresentationItem.cxx
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
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17
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>
27
28 //=======================================================================
29 //function : RWStepRepr_RWMeasureRepresentationItem
30 //purpose  : 
31 //=======================================================================
32 RWStepRepr_RWMeasureRepresentationItem::RWStepRepr_RWMeasureRepresentationItem () {}
33
34 //=======================================================================
35 //function : ReadStep
36 //purpose  : 
37 //=======================================================================
38
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
43 {
44   // --- Number of Parameter Control ---
45
46   if (!data->CheckNbParams(num,3,ach,"measure_representation_item")) return;
47
48   // --- inherited from representation_item : name ---
49   Handle(TCollection_HAsciiString) aName;
50   data->ReadString (num,1,"name",ach,aName);
51
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);
55
56   // --- inherited from measure_with_unit : unit_component ---
57   StepBasic_Unit aUnitComponent;
58   data->ReadEntity(num, 3,"unit_component", ach, aUnitComponent);
59
60   //--- Initialisation of the read entity ---
61
62   ent->Init(aName, mvc, aUnitComponent);
63 }
64
65 //=======================================================================
66 //function : WriteStep
67 //purpose  : 
68 //=======================================================================
69
70 void RWStepRepr_RWMeasureRepresentationItem::WriteStep (StepData_StepWriter& SW,
71                                                         const Handle(StepRepr_MeasureRepresentationItem)& ent) const
72 {
73   // --- inherited from representation_item : name ---
74   SW.Send(ent->Name());
75
76   // --- inherited from measure_with_unit : value_component ---
77   SW.Send(ent->Measure()->ValueComponentMember());
78   
79   // --- inherited from measure_with_unit : unit_component ---
80   SW.Send(ent->Measure()->UnitComponent().Value());
81 }
82
83 //=======================================================================
84 //function : Share
85 //purpose  : 
86 //=======================================================================
87
88 void RWStepRepr_RWMeasureRepresentationItem::Share(const Handle(StepRepr_MeasureRepresentationItem)& ent, 
89                                                    Interface_EntityIterator& iter) const
90 {
91   
92   iter.GetOneItem(ent->Measure()->UnitComponent().Value());
93 }
94