Skip to content

API / geotoolkit / util / AbstractUnit / AbstractUnit

Class: AbstractUnit

util.AbstractUnit.AbstractUnit

An interface that represents an unit

Hierarchy

  • AbstractUnit

    ↳ Unit

Table of contents

Constructors
  • [new AbstractUnit()](/solutions/geotoolkit/GeoToolkit_JS/apis/classes/geotoolkit.util.abstractunit.abstractunit.md#new abstractunit())
Methods

Contents

Constructors

new AbstractUnit()

• new AbstractUnit()

Methods

belongsTo

▸ Abstract belongsTo(type): boolean

Check if the unit belongs to the type(s)

Parameters

Name Type Description
typestring | string[]quantity type(s) to be tested

Returns

boolean

result


canConvertTo

▸ Abstract canConvertTo(other): boolean

Check if a unit can be converted from the current unit

Parameters

Name Type Description
otherstring | AbstractUnitunit to be converted

Returns

boolean

true if a unit can be converted from the specific unit


convert

▸ Abstract convert(value, other): number

Convert the value to a specific unit if <code>canConvertTo</code>

Parameters

Name Type Description
valuenumbervalue to be converted
otherstring | AbstractUnitother unit to be converted

Returns

number

converted

▸ Abstract convert(value, other): number[]

Parameters

Name Type
valuenumber[]
otherstring | AbstractUnit

Returns

number[]

▸ Abstract convert(value, other): number | number[]

Parameters

Name Type
valuenumber | number[]
otherstring | AbstractUnit

Returns

number | number[]


fromBaseUnit

▸ Abstract fromBaseUnit(value): number

Convert unit value from base unit

Parameters

Name Type Description
valuenumbervalue to be converted

Returns

number

converted


getBaseUnitSymbol

▸ Abstract getBaseUnitSymbol(): string

Returns base unit symbol

Returns

string

base unit symbol


getClassName

▸ getClassName(): string

Returns

string


getDescription

▸ Abstract getDescription(): string

Returns unit description

Returns

string

unit name


getName

▸ Abstract getName(): string

Returns unit name

Returns

string

unit name


getProperties

▸ getProperties(): Record<string, any&gt;

Gets the properties

Returns

Record<string, any&gt;

props properties


getQuantityType

▸ Abstract getQuantityType(): string[]

get the Quantity types of the unit

Returns

string[]

quantity types


getSymbol

▸ Abstract getSymbol(): string

Unit symbol

Returns

string

unit symbol


sameAs

▸ Abstract sameAs(other): boolean

Compares this unit with another unit

Parameters

Name Type
otherstring | AbstractUnit

Returns

boolean


setProperties

▸ setProperties(props?): AbstractUnit

Sets the properties

Parameters

Name Type Description
Optional propsRecord<string, any&gt;properties

Returns

AbstractUnit

this


toBaseUnit

▸ Abstract toBaseUnit(value): number

Convert unit value to base unit

Parameters

Name Type Description
valuenumbervalue to be converted

Returns

number

converted


getClassName

▸ Static getClassName(): string

Returns

string