Class: FacilityLoader
Defined in: src/sdk/navigation/FacilityLoader.ts:181
A class that handles loading facility data from the simulator.
Constructors
Constructor
new FacilityLoader(
facilityRepo,onInitialized):FacilityLoader
Defined in: src/sdk/navigation/FacilityLoader.ts:214
Creates an instance of the FacilityLoader.
Parameters
| Parameter | Type | Description |
|---|---|---|
facilityRepo | FacilityRepository | A local facility repository. |
onInitialized | () => void | A callback to call when the facility loader has completed initialization. |
Returns
FacilityLoader
Properties
onInitialized()
readonlyonInitialized: () =>void
Defined in: src/sdk/navigation/FacilityLoader.ts:216
A callback to call when the facility loader has completed initialization.
Returns
void
Methods
awaitInitialization()
awaitInitialization():
Promise<void>
Defined in: src/sdk/navigation/FacilityLoader.ts:250
Waits until this facility loader is initialized.
Returns
Promise<void>
A Promise which is fulfilled when this facility loader is initialized.
findNearestFacilitiesByIdent()
findNearestFacilitiesByIdent<
T>(filter,ident,lat,lon,maxItems):Promise<SearchTypeMap[T][]>
Defined in: src/sdk/navigation/FacilityLoader.ts:584
Searches for facilities matching a given ident, and returns the matching facilities, with nearest at the beginning of the array.
Type Parameters
| Type Parameter |
|---|
T extends FacilitySearchTypeLatLon |
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
filter | T | undefined | The type of facility to filter by. Selecting ALL will search all facility type ICAOs, except for boundary facilities. |
ident | string | undefined | The exact ident to search for. (ex: DEN, KDEN, ITADO) |
lat | number | undefined | The latitude to find facilities nearest to. |
lon | number | undefined | The longitude to find facilities nearest to. |
maxItems | number | 40 | The maximum number of matches to return. Defaults to 40. |
Returns
Promise<SearchTypeMap[T][]>
An array of matching facilities, sorted by distance to the given lat/lon, with nearest at the beginning of the array.
getAirway()
getAirway(
airwayName,airwayType,icao):Promise<AirwayObject>
Defined in: src/sdk/navigation/FacilityLoader.ts:376
Gets airway data from the sim.
Parameters
| Parameter | Type | Description |
|---|---|---|
airwayName | string | The airway name. |
airwayType | number | The airway type. |
icao | string | The 12 character FS ICAO of at least one intersection in the airway. |
Returns
Promise<AirwayObject>
The retrieved airway.
Throws
an error if no airway is returned
getFacility()
getFacility<
T>(type,icao):Promise<FacilityTypeMap[T]>
Defined in: src/sdk/navigation/FacilityLoader.ts:267
Retrieves a facility.
Type Parameters
| Type Parameter |
|---|
T extends FacilityType |
Parameters
| Parameter | Type | Description |
|---|---|---|
type | T | The type of facility to retrieve. |
icao | string | The ICAO of the facility to retrieve. |
Returns
Promise<FacilityTypeMap[T]>
A Promise which will be fulfilled with the requested facility, or rejected if the facility could not be retrieved.
getMetar()
Call Signature
getMetar(
airport):Promise<undefined|Metar>
Defined in: src/sdk/navigation/FacilityLoader.ts:484
Gets a METAR for an airport.
Parameters
| Parameter | Type | Description |
|---|---|---|
airport | AirportFacility | An airport. |
Returns
Promise<undefined | Metar>
The METAR for the airport, or undefined if none could be obtained.
Call Signature
getMetar(
ident):Promise<undefined|Metar>
Defined in: src/sdk/navigation/FacilityLoader.ts:490
Gets a METAR for an airport.
Parameters
| Parameter | Type | Description |
|---|---|---|
ident | string | An airport ident. |
Returns
Promise<undefined | Metar>
The METAR for the airport, or undefined if none could be obtained.
searchByIdent()
searchByIdent(
filter,ident,maxItems):Promise<string[]>
Defined in: src/sdk/navigation/FacilityLoader.ts:546
Searches for ICAOs by their ident portion only.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
filter | FacilitySearchType | undefined | The type of facility to filter by. Selecting ALL will search all facility type ICAOs. |
ident | string | undefined | The partial or complete ident to search for. |
maxItems | number | 40 | The maximum number of matches to return. Defaults to 40. |
Returns
Promise<string[]>
An array of matched ICAOs. Exact matches are sorted before partial matches.
searchMetar()
searchMetar(
lat,lon):Promise<undefined|Metar>
Defined in: src/sdk/navigation/FacilityLoader.ts:508
Searches for the METAR issued for the closest airport to a given location.
Parameters
| Parameter | Type | Description |
|---|---|---|
lat | number | The latitude of the center of the search, in degrees. |
lon | number | The longitude of the center of the search, in degrees. |
Returns
Promise<undefined | Metar>
The METAR issued for the closest airport to the given location, or undefined if none could be found.
startNearestSearchSession()
startNearestSearchSession<
T>(type):Promise<SessionTypeMap[T]>
Defined in: src/sdk/navigation/FacilityLoader.ts:411
Starts a nearest facilities search session.
Type Parameters
| Type Parameter |
|---|
T extends FacilitySearchType |
Parameters
| Parameter | Type | Description |
|---|---|---|
type | T | The type of facilities for which to search. |
Returns
Promise<SessionTypeMap[T]>
A Promise which will be fulfilled with the new nearest search session.
getDatabaseCycles()
staticgetDatabaseCycles():FacilityDatabaseCycles
Defined in: src/sdk/navigation/FacilityLoader.ts:677
Gets the AIRAC cycles associated with the facility database.
Returns
an object containing the previous, current, and next cycles. If an error occurs and the MSFS facility cycle cannot be determined, the effective cycle for the current date is used instead.