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 <RWStepRepr_RWReprItemAndLengthMeasureWithUnit.hxx>
17 #include <StepBasic_MeasureValueMember.hxx>
18 #include <StepBasic_MeasureWithUnit.hxx>
19 #include <StepBasic_Unit.hxx>
20 #include <StepData_StepReaderData.hxx>
21 #include <StepData_StepWriter.hxx>
22 #include <StepRepr_ReprItemAndLengthMeasureWithUnit.hxx>
24 //=======================================================================
25 //function : RWSteprepr_RWReprItemAndLengthMeasureWithUnit
27 //=======================================================================
28 RWStepRepr_RWReprItemAndLengthMeasureWithUnit::RWStepRepr_RWReprItemAndLengthMeasureWithUnit() {}
31 //=======================================================================
34 //=======================================================================
36 void 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
42 Standard_Integer num = 0;//num0;
43 data->NamedForComplex("MEASURE_WITH_UNIT",num0,num,ach);
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);
54 data->NamedForComplex("REPRESENTATION_ITEM",num0,num,ach);
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);
62 //--- Initialisation of the read entity ---
63 ent->Init(aMeasureWithUnit,aReprItem);
67 //=======================================================================
68 //function : WriteStep
70 //=======================================================================
72 void RWStepRepr_RWReprItemAndLengthMeasureWithUnit::WriteStep
73 (StepData_StepWriter& SW,
74 const Handle(StepRepr_ReprItemAndLengthMeasureWithUnit)& ent) const
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");