API / geotoolkit / util / Unit / Unit
Defines an interface, which represents an unit of measure, the ratio for new unit is computed with: y=(a+bx)/(c+dx)
↳
Unit
Constructors
| [new Unit(name)](/solutions/geotoolkit/apis/classes/geotoolkit.util.unit.unit.md#new unit(name)) | [new Unit(name, quantityType, symbol, baseUnitSymbol, a, b, c, d, description)](/solutions/geotoolkit/apis/classes/geotoolkit.util.unit.unit.md#new unit(name, quantitytype, symbol, baseunitsymbol, a, b, c, d, description)) |
|---|
Methods
Css Properties
| Name | Type | Description |
|---|---|---|
a | number | Factor |
b | number | Factor |
baseunitsymbol | string | Represents the unit symbol of it's base unit (example for volume, 'm3' can be the base unit) |
c | number | Factor |
d | number | Factor |
description | string | It represents the description of unit |
name | string | Represent the name of the unit (example : 'pint') |
symbol | string | Symbol to represent the unit (example: 'pt' to represent pint) |
Constructors
• new Unit(name?)
| Name | Type |
|---|---|
Optional name | Options |
AbstractUnit.constructor
• new Unit(name?, quantityType?, symbol?, baseUnitSymbol?, a?, b?, c?, d?, description?)
| Name | Type | Description |
|---|---|---|
Optional name | string | Unit | represent the name of the unit (example : 'pint') or properties object |
Optional quantityType | string | string[] | represent the quantity type of the unit like length, time, pressure etc. (example: 'volume') |
Optional symbol | string | symbol to represent the unit (example: 'pt' to represent pint) |
Optional baseUnitSymbol | string | represents the unit symbol of it's base unit (example for volume, 'm3' can be the base unit) |
Optional a | number | factor |
Optional b | number | factor |
Optional c | number | factor |
Optional d | number | factor |
Optional description | string | It represents the description of unit |
AbstractUnit.constructor
Methods
▸ belongsTo(type): boolean
Returns whether current unit belongs to the specified type(s)
| Name | Type | Description |
|---|---|---|
type | string | string[] | quantityType(s) to be tested |
boolean
▸ canConvertTo(other): boolean
Returns whether the unit conversation is possible from this unit to other unit
| Name | Type | Description |
|---|---|---|
other | string | AbstractUnit | unit to be converted |
boolean
▸ clone(): Unit
Returns a clone of the unit.
clone
▸ convert(value, other): number
Convert value to other unit if conversation is possible and giver converted value(s) in other unit
| Name | Type | Description |
|---|---|---|
value | number | specific value(s) to be converted to other unit |
other | string | AbstractUnit | represents the other unit to which the values will be converted |
number
▸ convert(value, other): number[]
| Name | Type |
|---|---|
value | number[] |
other | string | AbstractUnit |
number[]
▸ fromBaseUnit(value): number
Converts value from base unit and gives value in current unit
| Name | Type | Description |
|---|---|---|
value | number | value to be converted |
number
▸ getBaseUnitSymbol(): string
Returns baseUnitSymbol of this unit
string
AbstractUnit.getBaseUnitSymbol
▸ getClassName(): string
string
▸ getDescription(): string
Returns the description of the unit
string
unit name
▸ getName(): string
Returns the name of the unit
string
▸ getProperties(): Options
Gets all the properties pertaining to this object
An object containing the properties to set
▸ getQuantityType(): string[]
Returns the quantityTypes of this unit
string[]
▸ getSymbol(): string
Returns the symbol of this unit
string
▸ sameAs(other): boolean
Returns whether this unit is similar to other unit
| Name | Type | Description |
|---|---|---|
other | string | AbstractUnit | other |
boolean
▸ setProperties(properties?): Unit
Sets all the properties pertaining to this object
| Name | Type | Description |
|---|---|---|
Optional properties | Options | An object containing the properties to set |
this
▸ toBaseUnit(value): number
Converts value from current unit to base unit
| Name | Type | Description |
|---|---|---|
value | number | value to be converted |
number
▸ toString(): string
Returns unit string representation
string
▸ Static getClassName(): string
string