Module EDUtilsUnit :: Class EDUtilsUnit
[hide private]
[frames] | no frames]

Class EDUtilsUnit

source code

This is a static utility class for handling unit (meter ... and subunit) in XSData / XML data structures.

Static Methods [hide private]
float
getSIValue(_object)
convert any object into the international System unit.
source code
float
getValue(_object, _strUnit)
convert any object into the international System unit.
source code
 
toXSD(_classXSData, _strObject)
Convert a string or possibly any object to an XSD object
source code
string
getClassName(_object)
Retrieves the name of the class
source code
 
getUnitScaleLength(_unit)
Return the fScale factor of an unit versus SI unit (meter)
source code
 
getUnitScaleAngle(_unit)
Return the fScale factor of an unit versus SI unit (radian)
source code
 
getUnitScaleTime(_unit)
Return the fScale factor of an unit versus SI unit (seconds)
source code
 
getValueLength(_value, _unit)
Convert a length like fValue to meter (SI)
source code
 
getValueAngle(_value, _unit)
Convert an angle like fValue to radian (SI)
source code
 
getValueTime(_value, _unit)
Convert an time like fValue to seconds (SI)
source code
Class Variables [hide private]
  dictLength = {('A', 'Angstrom', 'angstrom'): 1e-10, ('cm', 'ce...
  dictAngle = {('deg', '\xc2\xb0'): 0.0174532925199, ('grad', 'g...
  dictTime = {('h', 'hour', 'heure'): 3600.0, ('mn', 'min', 'min...
Method Details [hide private]

getSIValue(_object)
Static Method

source code 

convert any object into the international System unit.

Parameters:
  • _object - any object
Returns: float
value in the international system

getValue(_object, _strUnit)
Static Method

source code 

convert any object into the international System unit.

Parameters:
  • _object - any object
  • _strUnit - unit name like "um" or "deg"
Returns: float
value in the international system

toXSD(_classXSData, _strObject)
Static Method

source code 

Convert a string or possibly any object to an XSD object

Parameters:
  • _classXSData (class derived from XSData) - the XSDataClass to be forced into
  • _strObject (string (floats are accepted)) - the string representation of a physical object like "1.54 A"

getClassName(_object)
Static Method

source code 

Retrieves the name of the class

Returns: string
the name of the class

getUnitScaleLength(_unit)
Static Method

source code 

Return the fScale factor of an unit versus SI unit (meter)

Parameters:
  • _unit - the name of the unit @return : the numeric fScale factor (0.001 for mm)

getUnitScaleAngle(_unit)
Static Method

source code 

Return the fScale factor of an unit versus SI unit (radian)

Parameters:
  • _unit - the name of the unit @return : the numeric fScale factor (0.001 for mm)

getUnitScaleTime(_unit)
Static Method

source code 

Return the fScale factor of an unit versus SI unit (seconds)

Parameters:
  • _unit - the name of the unit @return : the numeric fScale factor (60 for mn)

getValueLength(_value, _unit)
Static Method

source code 

Convert a length like fValue to meter (SI)

Parameters:
  • _value (float) - the fValue in unit
  • _unit (string) - the name of the unit

getValueAngle(_value, _unit)
Static Method

source code 

Convert an angle like fValue to radian (SI)

Parameters:
  • _value (float) - the fValue in unit
  • _unit (string) - the name of the unit

getValueTime(_value, _unit)
Static Method

source code 

Convert an time like fValue to seconds (SI)

Parameters:
  • _value (float) - the fValue in unit
  • _unit (string) - the name of the unit

Class Variable Details [hide private]

dictLength

Value:
{('A', 'Angstrom', 'angstrom'): 1e-10,
 ('cm', 'centimeter'): 0.01,
 ('km', 'kilometer'): 1000.0,
 ('m', 'meter', None): 1.0,
 ('mm', 'millimeter'): 0.001,
 ('nm', 'nanometer'): 1e-09,
 ('pm', 'picometer'): 1e-12,
 ('um', '\xc2\xb5m', 'micron', 'micrometer'): 1e-06}

dictAngle

Value:
{('deg', '\xc2\xb0'): 0.0174532925199,
 ('grad', 'g'): 0.0157079632679,
 ('rad', 'r', None): 1.0}

dictTime

Value:
{('h', 'hour', 'heure'): 3600.0,
 ('mn', 'min', 'minute'): 60.0,
 ('ms', 'millisec', 'millisecond'): 0.001,
 ('s', 'sec', 'second', None): 1.0}