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 | // sln 09.10.2001. BUC61003. Correction of looking for items of complex entity in case of them do not saticfy to alphabetical order |
7fd59977 |
15 | |
42cf5bc1 |
16 | #include <Interface_Check.hxx> |
7fd59977 |
17 | #include <Interface_EntityIterator.hxx> |
42cf5bc1 |
18 | #include <RWStepBasic_RWConversionBasedUnitAndPlaneAngleUnit.hxx> |
19 | #include <StepBasic_ConversionBasedUnit.hxx> |
7fd59977 |
20 | #include <StepBasic_ConversionBasedUnitAndPlaneAngleUnit.hxx> |
42cf5bc1 |
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> |
7fd59977 |
26 | |
27 | RWStepBasic_RWConversionBasedUnitAndPlaneAngleUnit::RWStepBasic_RWConversionBasedUnitAndPlaneAngleUnit () {} |
28 | |
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 |
34 | { |
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; |
a7197ef3 |
38 | data->NamedForComplex("CONVERSION_BASED_UNIT", "CNBSUN",num0,num,ach); |
7fd59977 |
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); |
44 | |
45 | // NAMED_UNIT |
46 | //num = 0; //gka TRJ9 c2-id-214.stp |
a7197ef3 |
47 | data->NamedForComplex("NAMED_UNIT", "NMDUNT",num0,num,ach); |
7fd59977 |
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); |
51 | |
52 | // PLANE_ANGLE_UNIT |
53 | //num = 0; //gka |
a7197ef3 |
54 | data->NamedForComplex("PLANE_ANGLE_UNIT", "PLANUN",num0,num,ach); |
7fd59977 |
55 | if (!data->CheckNbParams(num,0,ach,"plane_angle_unit")) return; |
56 | |
57 | ent->Init(aDimensions,aName,aConversionFactor); |
58 | } |
59 | |
60 | |
61 | void RWStepBasic_RWConversionBasedUnitAndPlaneAngleUnit::WriteStep |
62 | (StepData_StepWriter& SW, |
63 | const Handle(StepBasic_ConversionBasedUnitAndPlaneAngleUnit)& ent) const |
64 | { |
65 | |
66 | // --- Instance of plex componant ConversionBasedUnit --- |
67 | |
68 | SW.StartEntity("CONVERSION_BASED_UNIT"); |
69 | // --- field : name --- |
70 | |
71 | SW.Send(ent->Name()); |
72 | // --- field : conversionFactor --- |
73 | |
74 | SW.Send(ent->ConversionFactor()); |
75 | |
76 | // --- Instance of common supertype NamedUnit --- |
77 | |
78 | SW.StartEntity("NAMED_UNIT"); |
79 | // --- field : dimensions --- |
80 | |
81 | SW.Send(ent->Dimensions()); |
82 | |
83 | // --- Instance of plex componant PlaneAngleUnit --- |
84 | |
85 | SW.StartEntity("PLANE_ANGLE_UNIT"); |
86 | } |
87 | |
88 | |
89 | void RWStepBasic_RWConversionBasedUnitAndPlaneAngleUnit::Share(const Handle(StepBasic_ConversionBasedUnitAndPlaneAngleUnit)& ent, Interface_EntityIterator& iter) const |
90 | { |
91 | |
92 | iter.GetOneItem(ent->Dimensions()); |
93 | |
94 | |
95 | iter.GetOneItem(ent->ConversionFactor()); |
96 | } |
97 | |