A Unit Of Measure is a particular scale for measuring quantities of the same kind (see QuantityKind).

You can discern two types of Units Of Measure: Standard and non-standard Units of Measure.

  • Standard Units define a standard measure for a QuantityKind (See QuantityKind).
  • A non-standard Unit is always defined in terms of a standard Unit, but applies a conversion factor and offset.
For example, "Meter" is a base Unit Of Measure that measures quantities of kind "Length" (and also of "Distance", "Height", ... which are subtypes of "Length"). An example non-standard Unit related to the "Meter" Unit Of Measure is the "Foot", which is 0.3048 "Meter".

A Unit of measure cannot by created, it can only be retrieved from the UnitOfMeasureRegistry

An overview of the Unites of Measure currently supported by LuciadRIA :

  • Dimensionless:
    • Number
  • Time:
    • Second
    • Minute
    • Hour
    • Day
  • Temperature:
    • Kelvin
    • Celcius
    • Fahrenheit
  • Distance:
    • Meter
    • FlightLevel
    • Centimeter
    • Foot
    • FootUSSurvey
    • Kilometer
    • Mile
    • NauticalMile
  • Angle:
    • Radian
    • DegreeAngle
  • Raster size:
    • Pixels

Hierarchy

  • UnitOfMeasure

Constructors

Accessors

  • get conversionMultiplier(): number
  • The factor to convert a quantity expressed in this UnitOfMeasure to a quantity expressed in the standard UnitOfMeasure. This factor is used in combination with the conversionOffset. For a standard Unit Of Measure this multiplier is 1. For a non standard UnitOfMeasure, this is the value which must be used to convert a value in this UnitOfMeasure to the standard UnitOfMeasure. For example, for the "Foot" UnitOfMeasure, the conversionMultiplier is 0.3048 to convert feet to meters.

    Returns number

  • get conversionOffset(): number
  • The conversion offset for this Unit Of Measure. For a standard Unit Of Measure the offset is 0.

    For a non standard Unit Of Measure, this is the value which must be used to convert a value in this UnitOfMeasure to the standard UnitOfMeasure. For example, for the "DegreesCelcius" UnitOfMeasure, the conversion offset is 273.15 to convert degrees Celcius to degrees Kelvin (0 degrees celcius corresponds with 273.15 degrees Kelvin).

    A more complex example is degrees Fahrenheit: the conversionOffset to calculate convert degrees Fahrenheit to Kelvin is 273.15 - (32 * 5 / 9). The conversionMultiplier is 5 / 9.

    Returns number

  • get name(): string
  • The name of this UnitOfMeasure. The name is used to identify the UnitOfMeasure in the UnitOfMeasureRegistry

    Returns string

  • get quantityKind(): QuantityKind
  • The QuantityKind this UnitOfMeasure is a measure for. Although this is not strictly necessary, a Unit Of Measure typically refers to a base QuantityKind. An example: the "Meter" UnitOfMeasure is a measure for the "Length" QuantityKind.

    Returns QuantityKind

  • get standardUnitOfMeasure(): UnitOfMeasure
  • In case of a non-standard UnitOfMeasure, this property refers to its standard Unit Of Measure. For example the "Foot" UnitOfMeasure would refer to the "Meter" UnitOfMeasure. If the UnitOfMeasure is a standard UnitOfMeasure, this property refers to itself.

    Returns UnitOfMeasure

  • get symbol(): string
  • The symbol of a UnitOfMeasure is typically a shorthand notation of it's name. Example symbols are "m" for Meter", "ft" for Foot and "°C" for degrees Celcius.

    Returns string

Methods

  • Converts a measure expressed in the standard UnitOfMeasure to this standard UnitOfMeasure (see standardUnitOfMeasure).

    Parameters

    • value: number

      The value to be converted.

    Returns number

    The converted value.

  • Converts a measure expressed in this UnitOfMeasure to the standard UnitOfMeasure (see standardUnitOfMeasure). *

    Parameters

    • value: number

      The value to be converted.

    Returns number

    The converted value.

  • Converts a measure expressed in this UnitOfMeasure to the corresponding measure in another, compatible UnitOfMeasure. Compatible UnitOfMeasures share the same base QuantityKind.

    Parameters

    • value: number

      The value to be converted

    • unit: UnitOfMeasure

      the target UnitOfMeasure. This UnitOfMeasure must be a measure for a compatible QuantityKind (i.e. they must share a common base QuantityKind).

    Returns number

    The converted measure

    Throws

    QuantityKind is not compatible with the QuantityKind of this UnitOfMeasure.