1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
|
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to
// this header file considered to be the "object code" form of the original source.
#ifndef _UnitsAPI_HeaderFile
#define _UnitsAPI_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#endif
#ifndef _Standard_CString_HeaderFile
#include <Standard_CString.hxx>
#endif
#ifndef _Handle_Units_Dimensions_HeaderFile
#include <Handle_Units_Dimensions.hxx>
#endif
#ifndef _UnitsAPI_SystemUnits_HeaderFile
#include <UnitsAPI_SystemUnits.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
class Units_Dimensions;
//! The UnitsAPI global functions are used to <br>
//! convert a value from any unit into another unit. <br>
//! Principles <br>
//! Conversion is executed among three unit systems: <br>
//! - the SI System <br>
//! - the user's Local System <br>
//! - the user's Current System. <br>
//! The SI System is the standard international unit <br>
//! system. It is indicated by SI in the synopses of <br>
//! the UnitsAPI functions. <br>
//! The MDTV System corresponds to the SI <br>
//! international standard but the length unit and all <br>
//! its derivatives use millimeters instead of the meters. <br>
//! Both systems are proposed by Open CASCADE; <br>
//! the SI System is the standard option. By <br>
//! selecting one of these two systems, the user <br>
//! defines his Local System through the <br>
//! SetLocalSystem function. The Local System is <br>
//! indicated by LS in the synopses of the UnitsAPI functions. <br>
//! The user's Local System units can be modified in <br>
//! the working environment. The user defines his <br>
//! Current System by modifying its units through <br>
//! the SetCurrentUnit function. The Current <br>
//! System is indicated by Current in the synopses <br>
//! of the UnitsAPI functions. <br>
class UnitsAPI {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
//! Converts the current unit value to the local system units value. <br>
//! Example: CurrentToLS(1.,"LENGTH") returns 1000. if the current length unit <br>
//! is meter and LocalSystem is MDTV. <br>
Standard_EXPORT static Standard_Real CurrentToLS(const Standard_Real aData,const Standard_CString aQuantity) ;
//! Converts the current unit value to the SI system units value. <br>
//! Example: CurrentToSI(1.,"LENGTH") returns 0.001 if current length unit <br>
//! is millimeter. <br>
Standard_EXPORT static Standard_Real CurrentToSI(const Standard_Real aData,const Standard_CString aQuantity) ;
//! Converts the local system units value to the current unit value. <br>
//! Example: CurrentFromLS(1000.,"LENGTH") returns 1. if current length unit <br>
//! is meter and LocalSystem is MDTV. <br>
Standard_EXPORT static Standard_Real CurrentFromLS(const Standard_Real aData,const Standard_CString aQuantity) ;
//! Converts the SI system units value to the current unit value. <br>
//! Example: CurrentFromSI(0.001,"LENGTH") returns 1 if current length unit <br>
//! is millimeter. <br>
Standard_EXPORT static Standard_Real CurrentFromSI(const Standard_Real aData,const Standard_CString aQuantity) ;
//! Converts the local unit value to the local system units value. <br>
//! Example: AnyToLS(1.,"in.") returns 25.4 if the LocalSystem is MDTV. <br>
Standard_EXPORT static Standard_Real AnyToLS(const Standard_Real aData,const Standard_CString aUnit) ;
//! Converts the local unit value to the local system units value. <br>
//! and gives the associated dimension of the unit <br>
Standard_EXPORT static Standard_Real AnyToLS(const Standard_Real aData,const Standard_CString aUnit,Handle(Units_Dimensions)& aDim) ;
//! Converts the local unit value to the SI system units value. <br>
//! Example: AnyToSI(1.,"in.") returns 0.0254 <br>
Standard_EXPORT static Standard_Real AnyToSI(const Standard_Real aData,const Standard_CString aUnit) ;
//! Converts the local unit value to the SI system units value. <br>
//! and gives the associated dimension of the unit <br>
Standard_EXPORT static Standard_Real AnyToSI(const Standard_Real aData,const Standard_CString aUnit,Handle(Units_Dimensions)& aDim) ;
//! Converts the local system units value to the local unit value. <br>
//! Example: AnyFromLS(25.4,"in.") returns 1. if the LocalSystem is MDTV. <br>
//! Note: aUnit is also used to identify the type of physical quantity to convert. <br>
Standard_EXPORT static Standard_Real AnyFromLS(const Standard_Real aData,const Standard_CString aUnit) ;
//! Converts the SI system units value to the local unit value. <br>
//! Example: AnyFromSI(0.0254,"in.") returns 0.001 <br>
//! Note: aUnit is also used to identify the type of physical quantity to convert. <br>
Standard_EXPORT static Standard_Real AnyFromSI(const Standard_Real aData,const Standard_CString aUnit) ;
//! Converts the aData value expressed in the <br>
//! current unit for the working environment, as <br>
//! defined for the physical quantity aQuantity by the <br>
//! last call to the SetCurrentUnit function, into the unit aUnit. <br>
Standard_EXPORT static Standard_Real CurrentToAny(const Standard_Real aData,const Standard_CString aQuantity,const Standard_CString aUnit) ;
//! Converts the aData value expressed in the unit <br>
//! aUnit, into the current unit for the working <br>
//! environment, as defined for the physical quantity <br>
//! aQuantity by the last call to the SetCurrentUnit function. <br>
Standard_EXPORT static Standard_Real CurrentFromAny(const Standard_Real aData,const Standard_CString aQuantity,const Standard_CString aUnit) ;
//! Converts the local unit value to another local unit value. <br>
//! Example: AnyToAny(0.0254,"in.","millimeter") returns 1. ; <br>
Standard_EXPORT static Standard_Real AnyToAny(const Standard_Real aData,const Standard_CString aUnit1,const Standard_CString aUnit2) ;
//! Converts the local system units value to the SI system unit value. <br>
//! Example: LSToSI(1.,"LENGTH") returns 0.001 if the local system <br>
//! length unit is millimeter. <br>
Standard_EXPORT static Standard_Real LSToSI(const Standard_Real aData,const Standard_CString aQuantity) ;
//! Converts the SI system unit value to the local system units value. <br>
//! Example: SIToLS(1.,"LENGTH") returns 1000. if the local system <br>
//! length unit is millimeter. <br>
Standard_EXPORT static Standard_Real SIToLS(const Standard_Real aData,const Standard_CString aQuantity) ;
//! Sets the local system units. <br>
//! Example: SetLocalSystem(UnitsAPI_MDTV) <br>
Standard_EXPORT static void SetLocalSystem(const UnitsAPI_SystemUnits aSystemUnit = UnitsAPI_SI) ;
//! Returns the current local system units. <br>
Standard_EXPORT static UnitsAPI_SystemUnits LocalSystem() ;
//! Sets the current unit dimension <aUnit> to the unit quantity <aQuantity>. <br>
//! Example: SetCurrentUnit("LENGTH","millimeter") <br>
Standard_EXPORT static void SetCurrentUnit(const Standard_CString aQuantity,const Standard_CString aUnit) ;
//! Returns the current unit dimension <aUnit> from the unit quantity <aQuantity>. <br>
Standard_EXPORT static Standard_CString CurrentUnit(const Standard_CString aQuantity) ;
//! saves the units in the file .CurrentUnits of the directory pointed by the <br>
//! CSF_CurrentUnitsUserDefaults environment variable. <br>
Standard_EXPORT static void Save() ;
Standard_EXPORT static void Reload() ;
//! return the dimension associated to the quantity <br>
Standard_EXPORT static Handle_Units_Dimensions Dimensions(const Standard_CString aQuantity) ;
Standard_EXPORT static Handle_Units_Dimensions DimensionLess() ;
Standard_EXPORT static Handle_Units_Dimensions DimensionMass() ;
Standard_EXPORT static Handle_Units_Dimensions DimensionLength() ;
Standard_EXPORT static Handle_Units_Dimensions DimensionTime() ;
Standard_EXPORT static Handle_Units_Dimensions DimensionElectricCurrent() ;
Standard_EXPORT static Handle_Units_Dimensions DimensionThermodynamicTemperature() ;
Standard_EXPORT static Handle_Units_Dimensions DimensionAmountOfSubstance() ;
Standard_EXPORT static Handle_Units_Dimensions DimensionLuminousIntensity() ;
Standard_EXPORT static Handle_Units_Dimensions DimensionPlaneAngle() ;
//! Returns the basic dimensions. <br>
Standard_EXPORT static Handle_Units_Dimensions DimensionSolidAngle() ;
//! Checks the coherence between the quantity <aQuantity> <br>
//! and the unit <aUnits> in the current system and <br>
//! returns FALSE when it's WRONG. <br>
Standard_EXPORT static Standard_Boolean Check(const Standard_CString aQuantity,const Standard_CString aUnit) ;
protected:
private:
Standard_EXPORT static void CheckLoading(const UnitsAPI_SystemUnits aSystemUnit) ;
};
// other Inline functions and methods (like "C++: function call" methods)
#endif
|