Class: FacilityLoader
A class that handles loading facility data from the simulator.
Constructors
constructor
• new FacilityLoader(facilityRepo
, onInitialized?
): FacilityLoader
Creates an instance of the FacilityLoader.
Parameters
Name | Type | Description |
---|---|---|
facilityRepo | FacilityRepository | A local facility repository. |
onInitialized | () => void | A callback to call when the facility loader has completed initialization. |
Returns
Defined in
src/sdk/navigation/FacilityLoader.ts:214
Properties
onInitialized
• Readonly
onInitialized: () => void
A callback to call when the facility loader has completed initialization.
Type declaration
▸ (): void
A callback to call when the facility loader has completed initialization.
Returns
void
Defined in
src/sdk/navigation/FacilityLoader.ts:216
Methods
awaitInitialization
▸ awaitInitialization(): Promise
<void
>
Waits until this facility loader is initialized.
Returns
Promise
<void
>
A Promise which is fulfilled when this facility loader is initialized.
Defined in
src/sdk/navigation/FacilityLoader.ts:250
findNearestFacilitiesByIdent
▸ findNearestFacilitiesByIdent<T
>(filter
, ident
, lat
, lon
, maxItems?
): Promise
<SearchTypeMap
[T
][]>
Searches for facilities matching a given ident, and returns the matching facilities, with nearest at the beginning of the array.
Type parameters
Name | Type |
---|---|
T | extends FacilitySearchTypeLatLon |
Parameters
Name | 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.
Defined in
src/sdk/navigation/FacilityLoader.ts:584
getAirway
▸ getAirway(airwayName
, airwayType
, icao
): Promise
<AirwayObject
>
Gets airway data from the sim.
Parameters
Name | 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
Defined in
src/sdk/navigation/FacilityLoader.ts:376
getFacility
▸ getFacility<T
>(type
, icao
): Promise
<FacilityTypeMap
[T
]>
Retrieves a facility.
Type parameters
Name | Type |
---|---|
T | extends FacilityType |
Parameters
Name | 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.
Defined in
src/sdk/navigation/FacilityLoader.ts:267
getMetar
▸ getMetar(airport
): Promise
<undefined
| Metar
>
Gets a METAR for an airport.
Parameters
Name | Type | Description |
---|---|---|
airport | AirportFacility | An airport. |
Returns
Promise
<undefined
| Metar
>
The METAR for the airport, or undefined if none could be obtained.
Defined in
src/sdk/navigation/FacilityLoader.ts:484
▸ getMetar(ident
): Promise
<undefined
| Metar
>
Gets a METAR for an airport.
Parameters
Name | Type | Description |
---|---|---|
ident | string | An airport ident. |
Returns
Promise
<undefined
| Metar
>
The METAR for the airport, or undefined if none could be obtained.
Defined in
src/sdk/navigation/FacilityLoader.ts:490
searchByIdent
▸ searchByIdent(filter
, ident
, maxItems?
): Promise
<string
[]>
Searches for ICAOs by their ident portion only.
Parameters
Name | 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.
Defined in
src/sdk/navigation/FacilityLoader.ts:546
searchMetar
▸ searchMetar(lat
, lon
): Promise
<undefined
| Metar
>
Searches for the METAR issued for the closest airport to a given location.
Parameters
Name | 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.
Defined in
src/sdk/navigation/FacilityLoader.ts:508
startNearestSearchSession
▸ startNearestSearchSession<T
>(type
): Promise
<SessionTypeMap
[T
]>
Starts a nearest facilities search session.
Type parameters
Name | Type |
---|---|
T | extends FacilitySearchType |
Parameters
Name | 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.
Defined in
src/sdk/navigation/FacilityLoader.ts:411
getDatabaseCycles
▸ getDatabaseCycles(): FacilityDatabaseCycles
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.
Defined in
src/sdk/navigation/FacilityLoader.ts:677