Open CASCADE Technology  7.2.0
Static Public Member Functions
UnitsAPI Class Reference

The UnitsAPI global functions are used to convert a value from any unit into another unit. Principles Conversion is executed among three unit systems: More...

#include <UnitsAPI.hxx>

Static Public Member Functions

static Standard_Real CurrentToLS (const Standard_Real aData, const Standard_CString aQuantity)
 Converts the current unit value to the local system units value. Example: CurrentToLS(1.,"LENGTH") returns 1000. if the current length unit is meter and LocalSystem is MDTV. More...
 
static Standard_Real CurrentToSI (const Standard_Real aData, const Standard_CString aQuantity)
 Converts the current unit value to the SI system units value. Example: CurrentToSI(1.,"LENGTH") returns 0.001 if current length unit is millimeter. More...
 
static Standard_Real CurrentFromLS (const Standard_Real aData, const Standard_CString aQuantity)
 Converts the local system units value to the current unit value. Example: CurrentFromLS(1000.,"LENGTH") returns 1. if current length unit is meter and LocalSystem is MDTV. More...
 
static Standard_Real CurrentFromSI (const Standard_Real aData, const Standard_CString aQuantity)
 Converts the SI system units value to the current unit value. Example: CurrentFromSI(0.001,"LENGTH") returns 1 if current length unit is millimeter. More...
 
static Standard_Real AnyToLS (const Standard_Real aData, const Standard_CString aUnit)
 Converts the local unit value to the local system units value. Example: AnyToLS(1.,"in.") returns 25.4 if the LocalSystem is MDTV. More...
 
static Standard_Real AnyToLS (const Standard_Real aData, const Standard_CString aUnit, Handle< Units_Dimensions > &aDim)
 Converts the local unit value to the local system units value. and gives the associated dimension of the unit. More...
 
static Standard_Real AnyToSI (const Standard_Real aData, const Standard_CString aUnit)
 Converts the local unit value to the SI system units value. Example: AnyToSI(1.,"in.") returns 0.0254. More...
 
static Standard_Real AnyToSI (const Standard_Real aData, const Standard_CString aUnit, Handle< Units_Dimensions > &aDim)
 Converts the local unit value to the SI system units value. and gives the associated dimension of the unit. More...
 
static Standard_Real AnyFromLS (const Standard_Real aData, const Standard_CString aUnit)
 Converts the local system units value to the local unit value. Example: AnyFromLS(25.4,"in.") returns 1. if the LocalSystem is MDTV. Note: aUnit is also used to identify the type of physical quantity to convert. More...
 
static Standard_Real AnyFromSI (const Standard_Real aData, const Standard_CString aUnit)
 Converts the SI system units value to the local unit value. Example: AnyFromSI(0.0254,"in.") returns 0.001 Note: aUnit is also used to identify the type of physical quantity to convert. More...
 
static Standard_Real CurrentToAny (const Standard_Real aData, const Standard_CString aQuantity, const Standard_CString aUnit)
 Converts the aData value expressed in the current unit for the working environment, as defined for the physical quantity aQuantity by the last call to the SetCurrentUnit function, into the unit aUnit. More...
 
static Standard_Real CurrentFromAny (const Standard_Real aData, const Standard_CString aQuantity, const Standard_CString aUnit)
 Converts the aData value expressed in the unit aUnit, into the current unit for the working environment, as defined for the physical quantity aQuantity by the last call to the SetCurrentUnit function. More...
 
static Standard_Real AnyToAny (const Standard_Real aData, const Standard_CString aUnit1, const Standard_CString aUnit2)
 Converts the local unit value to another local unit value. Example: AnyToAny(0.0254,"in.","millimeter") returns 1. ;. More...
 
static Standard_Real LSToSI (const Standard_Real aData, const Standard_CString aQuantity)
 Converts the local system units value to the SI system unit value. Example: LSToSI(1.,"LENGTH") returns 0.001 if the local system length unit is millimeter. More...
 
static Standard_Real SIToLS (const Standard_Real aData, const Standard_CString aQuantity)
 Converts the SI system unit value to the local system units value. Example: SIToLS(1.,"LENGTH") returns 1000. if the local system length unit is millimeter. More...
 
static void SetLocalSystem (const UnitsAPI_SystemUnits aSystemUnit=UnitsAPI_SI)
 Sets the local system units. Example: SetLocalSystem(UnitsAPI_MDTV) More...
 
static UnitsAPI_SystemUnits LocalSystem ()
 Returns the current local system units. More...
 
static void SetCurrentUnit (const Standard_CString aQuantity, const Standard_CString aUnit)
 Sets the current unit dimension <aUnit> to the unit quantity <aQuantity>. Example: SetCurrentUnit("LENGTH","millimeter") More...
 
static Standard_CString CurrentUnit (const Standard_CString aQuantity)
 Returns the current unit dimension <aUnit> from the unit quantity <aQuantity>. More...
 
static void Save ()
 saves the units in the file .CurrentUnits of the directory pointed by the CSF_CurrentUnitsUserDefaults environment variable. More...
 
static void Reload ()
 
static Handle< Units_DimensionsDimensions (const Standard_CString aQuantity)
 return the dimension associated to the quantity More...
 
static Handle< Units_DimensionsDimensionLess ()
 
static Handle< Units_DimensionsDimensionMass ()
 
static Handle< Units_DimensionsDimensionLength ()
 
static Handle< Units_DimensionsDimensionTime ()
 
static Handle< Units_DimensionsDimensionElectricCurrent ()
 
static Handle< Units_DimensionsDimensionThermodynamicTemperature ()
 
static Handle< Units_DimensionsDimensionAmountOfSubstance ()
 
static Handle< Units_DimensionsDimensionLuminousIntensity ()
 
static Handle< Units_DimensionsDimensionPlaneAngle ()
 
static Handle< Units_DimensionsDimensionSolidAngle ()
 Returns the basic dimensions. More...
 
static Standard_Boolean Check (const Standard_CString aQuantity, const Standard_CString aUnit)
 Checks the coherence between the quantity <aQuantity> and the unit <aUnits> in the current system and returns FALSE when it's WRONG. More...
 

Detailed Description

The UnitsAPI global functions are used to convert a value from any unit into another unit. Principles Conversion is executed among three unit systems:

Member Function Documentation

◆ AnyFromLS()

static Standard_Real UnitsAPI::AnyFromLS ( const Standard_Real  aData,
const Standard_CString  aUnit 
)
static

Converts the local system units value to the local unit value. Example: AnyFromLS(25.4,"in.") returns 1. if the LocalSystem is MDTV. Note: aUnit is also used to identify the type of physical quantity to convert.

◆ AnyFromSI()

static Standard_Real UnitsAPI::AnyFromSI ( const Standard_Real  aData,
const Standard_CString  aUnit 
)
static

Converts the SI system units value to the local unit value. Example: AnyFromSI(0.0254,"in.") returns 0.001 Note: aUnit is also used to identify the type of physical quantity to convert.

◆ AnyToAny()

static Standard_Real UnitsAPI::AnyToAny ( const Standard_Real  aData,
const Standard_CString  aUnit1,
const Standard_CString  aUnit2 
)
static

Converts the local unit value to another local unit value. Example: AnyToAny(0.0254,"in.","millimeter") returns 1. ;.

◆ AnyToLS() [1/2]

static Standard_Real UnitsAPI::AnyToLS ( const Standard_Real  aData,
const Standard_CString  aUnit 
)
static

Converts the local unit value to the local system units value. Example: AnyToLS(1.,"in.") returns 25.4 if the LocalSystem is MDTV.

◆ AnyToLS() [2/2]

static Standard_Real UnitsAPI::AnyToLS ( const Standard_Real  aData,
const Standard_CString  aUnit,
Handle< Units_Dimensions > &  aDim 
)
static

Converts the local unit value to the local system units value. and gives the associated dimension of the unit.

◆ AnyToSI() [1/2]

static Standard_Real UnitsAPI::AnyToSI ( const Standard_Real  aData,
const Standard_CString  aUnit 
)
static

Converts the local unit value to the SI system units value. Example: AnyToSI(1.,"in.") returns 0.0254.

◆ AnyToSI() [2/2]

static Standard_Real UnitsAPI::AnyToSI ( const Standard_Real  aData,
const Standard_CString  aUnit,
Handle< Units_Dimensions > &  aDim 
)
static

Converts the local unit value to the SI system units value. and gives the associated dimension of the unit.

◆ Check()

static Standard_Boolean UnitsAPI::Check ( const Standard_CString  aQuantity,
const Standard_CString  aUnit 
)
static

Checks the coherence between the quantity <aQuantity> and the unit <aUnits> in the current system and returns FALSE when it's WRONG.

◆ CurrentFromAny()

static Standard_Real UnitsAPI::CurrentFromAny ( const Standard_Real  aData,
const Standard_CString  aQuantity,
const Standard_CString  aUnit 
)
static

Converts the aData value expressed in the unit aUnit, into the current unit for the working environment, as defined for the physical quantity aQuantity by the last call to the SetCurrentUnit function.

◆ CurrentFromLS()

static Standard_Real UnitsAPI::CurrentFromLS ( const Standard_Real  aData,
const Standard_CString  aQuantity 
)
static

Converts the local system units value to the current unit value. Example: CurrentFromLS(1000.,"LENGTH") returns 1. if current length unit is meter and LocalSystem is MDTV.

◆ CurrentFromSI()

static Standard_Real UnitsAPI::CurrentFromSI ( const Standard_Real  aData,
const Standard_CString  aQuantity 
)
static

Converts the SI system units value to the current unit value. Example: CurrentFromSI(0.001,"LENGTH") returns 1 if current length unit is millimeter.

◆ CurrentToAny()

static Standard_Real UnitsAPI::CurrentToAny ( const Standard_Real  aData,
const Standard_CString  aQuantity,
const Standard_CString  aUnit 
)
static

Converts the aData value expressed in the current unit for the working environment, as defined for the physical quantity aQuantity by the last call to the SetCurrentUnit function, into the unit aUnit.

◆ CurrentToLS()

static Standard_Real UnitsAPI::CurrentToLS ( const Standard_Real  aData,
const Standard_CString  aQuantity 
)
static

Converts the current unit value to the local system units value. Example: CurrentToLS(1.,"LENGTH") returns 1000. if the current length unit is meter and LocalSystem is MDTV.

◆ CurrentToSI()

static Standard_Real UnitsAPI::CurrentToSI ( const Standard_Real  aData,
const Standard_CString  aQuantity 
)
static

Converts the current unit value to the SI system units value. Example: CurrentToSI(1.,"LENGTH") returns 0.001 if current length unit is millimeter.

◆ CurrentUnit()

static Standard_CString UnitsAPI::CurrentUnit ( const Standard_CString  aQuantity)
static

Returns the current unit dimension <aUnit> from the unit quantity <aQuantity>.

◆ DimensionAmountOfSubstance()

static Handle< Units_Dimensions > UnitsAPI::DimensionAmountOfSubstance ( )
static

◆ DimensionElectricCurrent()

static Handle< Units_Dimensions > UnitsAPI::DimensionElectricCurrent ( )
static

◆ DimensionLength()

static Handle< Units_Dimensions > UnitsAPI::DimensionLength ( )
static

◆ DimensionLess()

static Handle< Units_Dimensions > UnitsAPI::DimensionLess ( )
static

◆ DimensionLuminousIntensity()

static Handle< Units_Dimensions > UnitsAPI::DimensionLuminousIntensity ( )
static

◆ DimensionMass()

static Handle< Units_Dimensions > UnitsAPI::DimensionMass ( )
static

◆ DimensionPlaneAngle()

static Handle< Units_Dimensions > UnitsAPI::DimensionPlaneAngle ( )
static

◆ Dimensions()

static Handle< Units_Dimensions > UnitsAPI::Dimensions ( const Standard_CString  aQuantity)
static

return the dimension associated to the quantity

◆ DimensionSolidAngle()

static Handle< Units_Dimensions > UnitsAPI::DimensionSolidAngle ( )
static

Returns the basic dimensions.

◆ DimensionThermodynamicTemperature()

static Handle< Units_Dimensions > UnitsAPI::DimensionThermodynamicTemperature ( )
static

◆ DimensionTime()

static Handle< Units_Dimensions > UnitsAPI::DimensionTime ( )
static

◆ LocalSystem()

static UnitsAPI_SystemUnits UnitsAPI::LocalSystem ( )
static

Returns the current local system units.

◆ LSToSI()

static Standard_Real UnitsAPI::LSToSI ( const Standard_Real  aData,
const Standard_CString  aQuantity 
)
static

Converts the local system units value to the SI system unit value. Example: LSToSI(1.,"LENGTH") returns 0.001 if the local system length unit is millimeter.

◆ Reload()

static void UnitsAPI::Reload ( )
static

◆ Save()

static void UnitsAPI::Save ( )
static

saves the units in the file .CurrentUnits of the directory pointed by the CSF_CurrentUnitsUserDefaults environment variable.

◆ SetCurrentUnit()

static void UnitsAPI::SetCurrentUnit ( const Standard_CString  aQuantity,
const Standard_CString  aUnit 
)
static

Sets the current unit dimension <aUnit> to the unit quantity <aQuantity>. Example: SetCurrentUnit("LENGTH","millimeter")

◆ SetLocalSystem()

static void UnitsAPI::SetLocalSystem ( const UnitsAPI_SystemUnits  aSystemUnit = UnitsAPI_SI)
static

Sets the local system units. Example: SetLocalSystem(UnitsAPI_MDTV)

◆ SIToLS()

static Standard_Real UnitsAPI::SIToLS ( const Standard_Real  aData,
const Standard_CString  aQuantity 
)
static

Converts the SI system unit value to the local system units value. Example: SIToLS(1.,"LENGTH") returns 1000. if the local system length unit is millimeter.


The documentation for this class was generated from the following file: