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.
14 // sln 09.10.2001. BUC61003. Correction of looking for items of complex entity in case of them do not saticfy to alphabetical order
16 #include <Interface_Check.hxx>
17 #include <Interface_EntityIterator.hxx>
18 #include <RWStepBasic_RWConversionBasedUnitAndPlaneAngleUnit.hxx>
19 #include <StepBasic_ConversionBasedUnit.hxx>
20 #include <StepBasic_ConversionBasedUnitAndPlaneAngleUnit.hxx>
21 #include <StepBasic_DimensionalExponents.hxx>
22 #include <StepBasic_MeasureWithUnit.hxx>
23 #include <StepBasic_PlaneAngleUnit.hxx>
24 #include <StepData_StepReaderData.hxx>
25 #include <StepData_StepWriter.hxx>
27 RWStepBasic_RWConversionBasedUnitAndPlaneAngleUnit::RWStepBasic_RWConversionBasedUnitAndPlaneAngleUnit () {}
29 void RWStepBasic_RWConversionBasedUnitAndPlaneAngleUnit::ReadStep
30 (const Handle(StepData_StepReaderData)& data,
31 const Standard_Integer num0,
32 Handle(Interface_Check)& ach,
33 const Handle(StepBasic_ConversionBasedUnitAndPlaneAngleUnit)& ent) const
35 // sln 09.10.2001. BUC61003. Correction of looking for items of complex entity in case of them do not saticfy to alphabetical order
36 // CONVERSION_BASED_UNIT
37 Standard_Integer num = 0;//num0;
38 data->NamedForComplex("CONVERSION_BASED_UNIT", "CNBSUN",num0,num,ach);
39 if (!data->CheckNbParams(num,2,ach,"conversion_based_unit")) return;
40 Handle(TCollection_HAsciiString) aName;
41 data->ReadString (num,1,"name",ach,aName);
42 Handle(StepBasic_MeasureWithUnit) aConversionFactor;
43 data->ReadEntity(num, 2,"conversion_factor", ach, STANDARD_TYPE(StepBasic_MeasureWithUnit), aConversionFactor);
46 //num = 0; //gka TRJ9 c2-id-214.stp
47 data->NamedForComplex("NAMED_UNIT", "NMDUNT",num0,num,ach);
48 if (!data->CheckNbParams(num,1,ach,"named_unit")) return;
49 Handle(StepBasic_DimensionalExponents) aDimensions;
50 data->ReadEntity(num, 1,"dimensions", ach, STANDARD_TYPE(StepBasic_DimensionalExponents), aDimensions);
54 data->NamedForComplex("PLANE_ANGLE_UNIT", "PLANUN",num0,num,ach);
55 if (!data->CheckNbParams(num,0,ach,"plane_angle_unit")) return;
57 ent->Init(aDimensions,aName,aConversionFactor);
61 void RWStepBasic_RWConversionBasedUnitAndPlaneAngleUnit::WriteStep
62 (StepData_StepWriter& SW,
63 const Handle(StepBasic_ConversionBasedUnitAndPlaneAngleUnit)& ent) const
66 // --- Instance of plex componant ConversionBasedUnit ---
68 SW.StartEntity("CONVERSION_BASED_UNIT");
69 // --- field : name ---
72 // --- field : conversionFactor ---
74 SW.Send(ent->ConversionFactor());
76 // --- Instance of common supertype NamedUnit ---
78 SW.StartEntity("NAMED_UNIT");
79 // --- field : dimensions ---
81 SW.Send(ent->Dimensions());
83 // --- Instance of plex componant PlaneAngleUnit ---
85 SW.StartEntity("PLANE_ANGLE_UNIT");
89 void RWStepBasic_RWConversionBasedUnitAndPlaneAngleUnit::Share(const Handle(StepBasic_ConversionBasedUnitAndPlaneAngleUnit)& ent, Interface_EntityIterator& iter) const
92 iter.GetOneItem(ent->Dimensions());
95 iter.GetOneItem(ent->ConversionFactor());