0026715: Problems in reading STEP short names in complex entities
[occt.git] / src / RWStepRepr / RWStepRepr_RWReprItemAndPlaneAngleMeasureWithUnit.cxx
1 // Created on: 2015-07-22
2 // Created by: Irina KRYLOVA
3 // Copyright (c) 2015 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
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.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #include <Interface_Check.hxx>
17 #include <RWStepRepr_RWReprItemAndPlaneAngleMeasureWithUnit.hxx>
18 #include <StepBasic_MeasureValueMember.hxx>
19 #include <StepBasic_MeasureWithUnit.hxx>
20 #include <StepBasic_Unit.hxx>
21 #include <StepData_StepReaderData.hxx>
22 #include <StepData_StepWriter.hxx>
23 #include <StepRepr_ReprItemAndPlaneAngleMeasureWithUnit.hxx>
24
25 //=======================================================================
26 //function : RWSteprepr_RWReprItemAndPlaneAngleMeasureWithUnit
27 //purpose  : 
28 //=======================================================================
29 RWStepRepr_RWReprItemAndPlaneAngleMeasureWithUnit::RWStepRepr_RWReprItemAndPlaneAngleMeasureWithUnit() {}
30
31
32 //=======================================================================
33 //function : ReadStep
34 //purpose  : 
35 //=======================================================================
36
37 void RWStepRepr_RWReprItemAndPlaneAngleMeasureWithUnit::ReadStep
38         (const Handle(StepData_StepReaderData)& data,
39          const Standard_Integer num0,
40          Handle(Interface_Check)& ach,
41          const Handle(StepRepr_ReprItemAndPlaneAngleMeasureWithUnit)& ent) const
42 {
43   Standard_Integer num = 0;//num0;
44   data->NamedForComplex("MEASURE_WITH_UNIT","MSWTUN",num0,num,ach);
45   if (!data->CheckNbParams(num,2,ach,"measure_with_unit")) return;
46   // --- own field : valueComponent ---
47   Handle(StepBasic_MeasureValueMember) mvc = new StepBasic_MeasureValueMember;
48   data->ReadMember (num,1, "value_component", ach, mvc);
49   // --- own field : unitComponent ---
50   StepBasic_Unit aUnitComponent;
51   data->ReadEntity(num, 2,"unit_component", ach, aUnitComponent);
52   Handle(StepBasic_MeasureWithUnit) aMeasureWithUnit = new StepBasic_MeasureWithUnit;
53   aMeasureWithUnit->Init(mvc, aUnitComponent);
54
55   data->NamedForComplex("REPRESENTATION_ITEM","RPRITM",num0,num,ach);
56   if (!data->CheckNbParams(num,1,ach,"representation_item")) return;
57   // --- own field : name ---
58   Handle(TCollection_HAsciiString) aName;
59   data->ReadString (num,1,"name",ach,aName);
60   Handle(StepRepr_RepresentationItem) aReprItem = new StepRepr_RepresentationItem;
61   aReprItem->Init(aName);
62
63   //--- Initialisation of the read entity ---
64   ent->Init(aMeasureWithUnit,aReprItem);
65 }
66
67
68 //=======================================================================
69 //function : WriteStep
70 //purpose  : 
71 //=======================================================================
72
73 void RWStepRepr_RWReprItemAndPlaneAngleMeasureWithUnit::WriteStep
74         (StepData_StepWriter& SW,
75          const Handle(StepRepr_ReprItemAndPlaneAngleMeasureWithUnit)& ent) const
76 {
77   SW.StartEntity("MEASURE_REPRESENTATION_ITEM");
78   SW.StartEntity("MEASURE_WITH_UNIT");
79   SW.Send(ent->GetMeasureWithUnit()->ValueComponentMember());
80   SW.Send(ent->GetMeasureWithUnit()->UnitComponent().Value());
81   SW.StartEntity("PLANE_ANGLE_MEASURE_WITH_UNIT");
82   SW.StartEntity("REPRESENTATION_ITEM");
83   SW.Send(ent->Name());
84 }