Class: G3XUnitFormatter
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Graphics/Text/G3XUnitFormatter.ts:11
A utility class for creating G3X Touch unit formatters.
Each unit formatter is a function which generates output strings from input measurement units.
Constructors
Constructor
new G3XUnitFormatter():
G3XUnitFormatter
Returns
G3XUnitFormatter
Methods
create()
staticcreate(defaultString): (unit) =>string
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Graphics/Text/G3XUnitFormatter.ts:202
Creates a function which formats measurement units to G3X-style strings representing their abbreviated names.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
defaultString | string | '' | The string to output when the input unit cannot be formatted. Defaults to the empty string. |
Returns
A function which formats measurement units to G3X-style strings representing their abbreviated names.
(
unit):string
Parameters
| Parameter | Type |
|---|---|
unit | Unit<any> |
Returns
string
createBasic()
staticcreateBasic(defaultString): (unit) =>string
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Graphics/Text/G3XUnitFormatter.ts:211
Creates a function which formats measurement units to basic-style strings representing their abbreviated names.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
defaultString | string | '' | The string to output when the input unit cannot be formatted. Defaults to the empty string. |
Returns
A function which formats measurement units to basic-style strings representing their abbreviated names.
(
unit):string
Parameters
| Parameter | Type |
|---|---|
unit | Unit<any> |
Returns
string
getBasicUnitTextMap()
staticgetBasicUnitTextMap():Readonly<Partial<Record<string,Readonly<Partial<Record<string,string>>>>>>
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Graphics/Text/G3XUnitFormatter.ts:229
Gets a mapping of unit family and name to basic-style text used by G3XUnitFormatter to format units. The returned object maps unit families to objects that map unit names within each family to formatted text.
Returns
Readonly<Partial<Record<string, Readonly<Partial<Record<string, string>>>>>>
A mapping of unit family and name to basic-style text used by G3XUnitFormatter to format units.
getUnitTextMap()
staticgetUnitTextMap():Readonly<Partial<Record<string,Readonly<Partial<Record<string,string>>>>>>
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Graphics/Text/G3XUnitFormatter.ts:220
Gets a mapping of unit family and name to G3X-style text used by G3XUnitFormatter to format units. The returned object maps unit families to objects that map unit names within each family to formatted text.
Returns
Readonly<Partial<Record<string, Readonly<Partial<Record<string, string>>>>>>
A mapping of unit family and name to G3X-style text used by G3XUnitFormatter to format units.