Options
All
• Public
• Public/Protected
• All

# Class UnitOfMeasure

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:
• DegreeAngle
• Raster size:
• Pixels

### Hierarchy

• UnitOfMeasure

## Constructors

### Private constructor

• This class should not be instantiated by users of LuciadRIA.

## Accessors

### conversionMultiplier

• 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.

### conversionOffset

• 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.

### name

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

### 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.

### standardUnitOfMeasure

• 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.

### symbol

• 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.

## Methods

### convertFromStandard

• (value: number): number
• 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.

### convertToStandard

• (value: number): number
• 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.

### convertToUnit

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

throws

Error if the given unit's QuantityKind is not compatible with the QuantityKind of this UnitOfMeasure.

#### 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

## Legend

• Module
• Object literal
• Variable
• Function
• Function with type parameter
• Index signature
• Type alias
• Type alias with type parameter
• Enumeration
• Enumeration member
• Property
• Method
• Interface
• Interface with type parameter
• Constructor
• Property
• Method
• Index signature
• Class
• Class with type parameter
• Constructor
• Property
• Method
• Accessor
• Index signature
• Inherited constructor
• Inherited property
• Inherited method
• Inherited accessor
• Protected property
• Protected method
• Protected accessor
• Private property
• Private method
• Private accessor
• Static property
• Static method