Skip to main content

Class: G3XUnitFormatter

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

create(defaultString?): (unit: Unit<any>) => string

Creates a function which formats measurement units to G3X-style strings representing their abbreviated names.

Parameters

NameTypeDefault valueDescription
defaultStringstring''The string to output when the input unit cannot be formatted. Defaults to the empty string.

Returns

fn

A function which formats measurement units to G3X-style strings representing their abbreviated names.

▸ (unit): string

Parameters
NameType
unitUnit<any>
Returns

string

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/Graphics/Text/G3XUnitFormatter.ts:137


createBasic

createBasic(defaultString?): (unit: Unit<any>) => string

Creates a function which formats measurement units to basic-style strings representing their abbreviated names.

Parameters

NameTypeDefault valueDescription
defaultStringstring''The string to output when the input unit cannot be formatted. Defaults to the empty string.

Returns

fn

A function which formats measurement units to basic-style strings representing their abbreviated names.

▸ (unit): string

Parameters
NameType
unitUnit<any>
Returns

string

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/Graphics/Text/G3XUnitFormatter.ts:146


getBasicUnitTextMap

getBasicUnitTextMap(): Readonly<Partial<Record<string, Readonly<Partial<Record<string, string>>>>>>

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.

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/Graphics/Text/G3XUnitFormatter.ts:164


getUnitTextMap

getUnitTextMap(): Readonly<Partial<Record<string, Readonly<Partial<Record<string, string>>>>>>

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.

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/Graphics/Text/G3XUnitFormatter.ts:155