0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[occt.git] / src / RWStepBasic / RWStepBasic_RWConversionBasedUnitAndVolumeUnit.cxx
CommitLineData
b311480e 1// Created on: 1999-10-12
2// Created by: data exchange team
3// Copyright (c) 1999-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 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
973c2be1 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.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
42cf5bc1 17
18#include <Interface_Check.hxx>
19#include <Interface_EntityIterator.hxx>
20#include <RWStepBasic_RWConversionBasedUnitAndVolumeUnit.hxx>
21#include <StepBasic_ConversionBasedUnitAndVolumeUnit.hxx>
ec357c5c 22#include <StepBasic_DimensionalExponents.hxx>
42cf5bc1 23#include <StepBasic_MeasureWithUnit.hxx>
24#include <StepData_StepReaderData.hxx>
25#include <StepData_StepWriter.hxx>
7fd59977 26
27RWStepBasic_RWConversionBasedUnitAndVolumeUnit::RWStepBasic_RWConversionBasedUnitAndVolumeUnit ()
28{
29}
30
31void RWStepBasic_RWConversionBasedUnitAndVolumeUnit::ReadStep(const Handle(StepData_StepReaderData)& data,
32 const Standard_Integer num0,
33 Handle(Interface_Check)& ach,
34 const Handle(StepBasic_ConversionBasedUnitAndVolumeUnit)& ent) const
35{
36 Standard_Integer num = num0;
37 // --- Instance of plex componant ConversionBasedUnit ---
38 if (!data->CheckNbParams(num,2,ach,"conversion_based_unit")) return;
39 Handle(TCollection_HAsciiString) aName;
40 data->ReadString (num,1,"name",ach,aName);
41
42 // --- field : conversionFactor ---
43 Handle(StepBasic_MeasureWithUnit) aConversionFactor;
44 data->ReadEntity(num, 2,"conversion_factor", ach, STANDARD_TYPE(StepBasic_MeasureWithUnit), aConversionFactor);
45
46 num = data->NextForComplex(num);
47 if (!data->CheckNbParams(num,1,ach,"named_unit")) return;
48 Handle(StepBasic_DimensionalExponents) aDimensions;
49 data->ReadEntity(num, 1,"dimensions", ach, STANDARD_TYPE(StepBasic_DimensionalExponents), aDimensions);
50
a7197ef3 51 data->NamedForComplex("VOLUME_UNIT","VLMUNT",num0,num,ach);
7fd59977 52 if (!data->CheckNbParams(num,0,ach,"volume_unit")) return;
53
54 ent->Init(aDimensions,aName,aConversionFactor);
55}
56
57void RWStepBasic_RWConversionBasedUnitAndVolumeUnit::WriteStep(StepData_StepWriter& SW,
58 const Handle(StepBasic_ConversionBasedUnitAndVolumeUnit)& ent) const
59{
60 SW.StartEntity("CONVERSION_BASED_UNIT");
61 SW.Send(ent->Name());
62 SW.Send(ent->ConversionFactor());
63 SW.StartEntity("NAMED_UNIT");
64 SW.Send(ent->Dimensions());
65 SW.StartEntity("VOLUME_UNIT");
66}
67
68void RWStepBasic_RWConversionBasedUnitAndVolumeUnit::Share(const Handle(StepBasic_ConversionBasedUnitAndVolumeUnit)& ent,
69 Interface_EntityIterator& iter) const
70{
71 iter.GetOneItem(ent->Dimensions());
72 iter.GetOneItem(ent->ConversionFactor());
73}