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