Skip to main content

Class: NearestContext

Defined in: src/sdk/navigation/NearestContext.ts:17

A singleton context of all nearest facility information.

Properties

airportRadius

airportRadius: number = 50

Defined in: src/sdk/navigation/NearestContext.ts:50

The search radius for airports, in nautical miles.


airports

readonly airports: NearestAirportSubscription

Defined in: src/sdk/navigation/NearestContext.ts:20

The nearest airports.


intersectionRadius

intersectionRadius: number = 10

Defined in: src/sdk/navigation/NearestContext.ts:56

The search radius for intersections, in nautical miles.


intersections

readonly intersections: NearestIntersectionSubscription

Defined in: src/sdk/navigation/NearestContext.ts:26

The nearest intersections.


maxAirports

maxAirports: number = 25

Defined in: src/sdk/navigation/NearestContext.ts:35

The max number of airports in the context.


maxIntersections

maxIntersections: number = 25

Defined in: src/sdk/navigation/NearestContext.ts:41

The max number of intersections in the context.


maxNdbs

maxNdbs: number = 25

Defined in: src/sdk/navigation/NearestContext.ts:44

The max number of NDBs in the context.


maxUsrs

maxUsrs: number = 25

Defined in: src/sdk/navigation/NearestContext.ts:47

The max number of user facilities in the context.


maxVors

maxVors: number = 25

Defined in: src/sdk/navigation/NearestContext.ts:38

The max number of VORs in the context.


ndbRadius

ndbRadius: number = 150

Defined in: src/sdk/navigation/NearestContext.ts:59

The search radius for NDBs, in nautical miles.


ndbs

readonly ndbs: NearestNdbSubscription

Defined in: src/sdk/navigation/NearestContext.ts:29

The nearest NDB stations.


usrRadius

usrRadius: number = 150

Defined in: src/sdk/navigation/NearestContext.ts:62

The search radius for user facilities, in nautical miles


usrs

readonly usrs: NearestUsrSubscription

Defined in: src/sdk/navigation/NearestContext.ts:32

The nearest USR facilities.


vorRadius

vorRadius: number = 150

Defined in: src/sdk/navigation/NearestContext.ts:53

The search radius for VORs, in nautical miles.


vors

readonly vors: NearestVorSubscription

Defined in: src/sdk/navigation/NearestContext.ts:23

The nearest VOR stations.

Accessors

isInitialized

Get Signature

get static isInitialized(): boolean

Defined in: src/sdk/navigation/NearestContext.ts:119

Whether the NearestContext is initialized.

Returns

boolean

true if initialized.

Methods

getNearest()

getNearest<T>(facilityType): undefined | FacilityTypeMap[T]

Defined in: src/sdk/navigation/NearestContext.ts:213

Gets the nearest facility for a given type.

Type Parameters

Type Parameter
T extends FacilityType

Parameters

ParameterTypeDescription
facilityTypeTThe type of facility.

Returns

undefined | FacilityTypeMap[T]

The nearest facility for a given type.


getRegionCode()

getRegionCode(): undefined | string

Defined in: src/sdk/navigation/NearestContext.ts:172

Get the local ICAO region code based on nearby facility data.

Returns

undefined | string

The region code.


getRegionIdent()

getRegionIdent(): undefined | string

Defined in: src/sdk/navigation/NearestContext.ts:190

Get the variant of the region code used in airport idents. Generally this will be the region code except for the case of the US, where it will just be 'K'.

Returns

undefined | string

The region code or just 'K' for the US.


getRegionLetter()

getRegionLetter(): undefined | string

Defined in: src/sdk/navigation/NearestContext.ts:202

Gets the first letter of the local ICAO region code.

Returns

undefined | string

The airport region letter.


update()

update(): Promise<void>

Defined in: src/sdk/navigation/NearestContext.ts:158

Updates the NearestContext.

Returns

Promise<void>


getInstance()

static getInstance(): NearestContext

Defined in: src/sdk/navigation/NearestContext.ts:74

Gets an instance of the NearestContext.

Returns

NearestContext

An instance of the NearestContext.

Throws

An error if the NearestContext has not yet been initailized.


initialize()

static initialize(facilityLoader, bus, planePos?): void

Defined in: src/sdk/navigation/NearestContext.ts:90

Initialized the NearestContext instance.

Parameters

ParameterTypeDescription
facilityLoaderFacilityLoaderThe facility loader to use for the instance.
busEventBusThe EventBus to use with this instance.
planePos?Subscribable<GeoPointInterface>A subscribable which provides the current position of the airplane. If not defined, the context will automatically retrieve the position from the event bus.

Returns

void

Throws

An error if the NearestContext is already initialized.


onInitialized()

static onInitialized(handler): null | Subscription

Defined in: src/sdk/navigation/NearestContext.ts:106

Subscribes to this NearestContext being initialized, or invokes the handler immediately if it is already initialized

Parameters

ParameterTypeDescription
handler(instance) => voidthe handler

Returns

null | Subscription

the subscription, if the action was not immediately performed