Skip to main content

Class: NearestContext

A singleton context of all nearest facility information.

Properties

airportRadius

airportRadius: number = 50

The search radius for airports, in nautical miles.

Defined in

src/sdk/navigation/NearestContext.ts:50


airports

Readonly airports: NearestAirportSubscription

The nearest airports.

Defined in

src/sdk/navigation/NearestContext.ts:20


intersectionRadius

intersectionRadius: number = 10

The search radius for intersections, in nautical miles.

Defined in

src/sdk/navigation/NearestContext.ts:56


intersections

Readonly intersections: NearestIntersectionSubscription

The nearest intersections.

Defined in

src/sdk/navigation/NearestContext.ts:26


maxAirports

maxAirports: number = 25

The max number of airports in the context.

Defined in

src/sdk/navigation/NearestContext.ts:35


maxIntersections

maxIntersections: number = 25

The max number of intersections in the context.

Defined in

src/sdk/navigation/NearestContext.ts:41


maxNdbs

maxNdbs: number = 25

The max number of NDBs in the context.

Defined in

src/sdk/navigation/NearestContext.ts:44


maxUsrs

maxUsrs: number = 25

The max number of user facilities in the context.

Defined in

src/sdk/navigation/NearestContext.ts:47


maxVors

maxVors: number = 25

The max number of VORs in the context.

Defined in

src/sdk/navigation/NearestContext.ts:38


ndbRadius

ndbRadius: number = 150

The search radius for NDBs, in nautical miles.

Defined in

src/sdk/navigation/NearestContext.ts:59


ndbs

Readonly ndbs: NearestNdbSubscription

The nearest NDB stations.

Defined in

src/sdk/navigation/NearestContext.ts:29


usrRadius

usrRadius: number = 150

The search radius for user facilities, in nautical miles

Defined in

src/sdk/navigation/NearestContext.ts:62


usrs

Readonly usrs: NearestUsrSubscription

The nearest USR facilities.

Defined in

src/sdk/navigation/NearestContext.ts:32


vorRadius

vorRadius: number = 150

The search radius for VORs, in nautical miles.

Defined in

src/sdk/navigation/NearestContext.ts:53


vors

Readonly vors: NearestVorSubscription

The nearest VOR stations.

Defined in

src/sdk/navigation/NearestContext.ts:23

Accessors

isInitialized

get isInitialized(): boolean

Whether the NearestContext is initialized.

Returns

boolean

true if initialized.

Defined in

src/sdk/navigation/NearestContext.ts:119

Methods

getNearest

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

Gets the nearest facility for a given type.

Type parameters

NameType
Textends FacilityType

Parameters

NameTypeDescription
facilityTypeTThe type of facility.

Returns

undefined | FacilityTypeMap[T]

The nearest facility for a given type.

Defined in

src/sdk/navigation/NearestContext.ts:213


getRegionCode

getRegionCode(): undefined | string

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

Returns

undefined | string

The region code.

Defined in

src/sdk/navigation/NearestContext.ts:172


getRegionIdent

getRegionIdent(): undefined | string

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.

Defined in

src/sdk/navigation/NearestContext.ts:190


getRegionLetter

getRegionLetter(): undefined | string

Gets the first letter of the local ICAO region code.

Returns

undefined | string

The airport region letter.

Defined in

src/sdk/navigation/NearestContext.ts:202


update

update(): Promise<void>

Updates the NearestContext.

Returns

Promise<void>

Defined in

src/sdk/navigation/NearestContext.ts:158


getInstance

getInstance(): NearestContext

Gets an instance of the NearestContext.

Returns

NearestContext

An instance of the NearestContext.

Throws

An error if the NearestContext has not yet been initailized.

Defined in

src/sdk/navigation/NearestContext.ts:74


initialize

initialize(facilityLoader, bus, planePos?): void

Initialized the NearestContext instance.

Parameters

NameTypeDescription
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.

Defined in

src/sdk/navigation/NearestContext.ts:90


onInitialized

onInitialized(handler): null | Subscription

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

Parameters

NameTypeDescription
handler(instance: NearestContext) => voidthe handler

Returns

null | Subscription

the subscription, if the action was not immediately performed

Defined in

src/sdk/navigation/NearestContext.ts:106