Skip to main content

Class: FacilityRepository

A repository of facilities.

Methods

add

add(fac): void

Adds a facility to this repository and all other repositories synced with this one. If this repository already contains a facility with the same ICAO as the facility to add, the existing facility will be replaced with the new one.

Parameters

NameTypeDescription
facFacilityThe facility to add.

Returns

void

Throws

Error if the facility has an invalid ICAO.

Defined in

src/sdk/navigation/FacilityRepository.ts:229


addMultiple

addMultiple(facs): void

Adds multiple facilities from this repository and all other repositories synced with this one. For each added facility, if this repository already contains a facility with the same ICAO, the existing facility will be replaced with the new one.

Parameters

NameTypeDescription
facsreadonly Facility[]The facilities to add.

Returns

void

Defined in

src/sdk/navigation/FacilityRepository.ts:244


forEach

forEach(fn, types?): void

Iterates over every facility in this respository with a visitor function.

Parameters

NameTypeDescription
fn(fac: Facility) => voidA visitor function.
types?readonly FacilityType[]The types of facilities over which to iterate. Defaults to all facility types.

Returns

void

Defined in

src/sdk/navigation/FacilityRepository.ts:278


get

get(icao): undefined | Facility

Retrieves a facility from this repository.

Parameters

NameTypeDescription
icaostringThe ICAO of the facility to retrieve.

Returns

undefined | Facility

The requested user facility, or undefined if it was not found in this repository.

Defined in

src/sdk/navigation/FacilityRepository.ts:161


remove

remove(fac): void

Removes a facility from this repository and all other repositories synced with this one.

Parameters

NameTypeDescription
facstring | FacilityThe facility to remove, or the ICAO of the facility to remove.

Returns

void

Throws

Error if the facility has an invalid ICAO.

Defined in

src/sdk/navigation/FacilityRepository.ts:254


removeMultiple

removeMultiple(facs): void

Removes multiple facilities from this repository and all other repositories synced with this one.

Parameters

NameTypeDescription
facsreadonly (string | Facility)[]The facilities to remove, or the ICAOs of the facilties to remove.

Returns

void

Defined in

src/sdk/navigation/FacilityRepository.ts:268


search(type, lat, lon, radius, visitor): void

Searches for facilities around a point. Only supported for USR and VIS facilities.

Parameters

NameTypeDescription
typeSearchableFacilityTypesThe type of facility for which to search.
latnumberThe latitude of the query point, in degrees.
lonnumberThe longitude of the query point, in degrees.
radiusnumberThe radius of the search, in great-arc radians.
visitorGeoKdTreeSearchVisitor<Facility>A visitor function. This function will be called once per element found within the search radius. If the visitor returns true, then the search will continue; if the visitor returns false, the search will immediately halt.

Returns

void

Throws

Error if spatial searches are not supported for the specified facility type.

Defined in

src/sdk/navigation/FacilityRepository.ts:180

search(type, lat, lon, radius, maxResultCount, out, filter?): Facility[]

Searches for facilities around a point. Only supported for USR and VIS facilities.

Parameters

NameTypeDescription
typeSearchableFacilityTypesThe type of facility for which to search.
latnumberThe latitude of the query point, in degrees.
lonnumberThe longitude of the query point, in degrees.
radiusnumberThe radius of the search, in great-arc radians.
maxResultCountnumberThe maximum number of search results to return.
outFacility[]An array in which to store the search results.
filter?GeoKdTreeSearchFilter<Facility>A function to filter the search results.

Returns

Facility[]

Throws

Error if spatial searches are not supported for the specified facility type.

Defined in

src/sdk/navigation/FacilityRepository.ts:192


size

size(types?): number

Gets the number of facilities stored in this repository.

Parameters

NameTypeDescription
types?readonly FacilityType[]The types of facilities to count. Defaults to all facility types.

Returns

number

The number of facilities stored in this repository.

Defined in

src/sdk/navigation/FacilityRepository.ts:140


getRepository

getRepository(bus): FacilityRepository

Gets an instance of FacilityRepository.

Parameters

NameTypeDescription
busEventBusThe event bus.

Returns

FacilityRepository

an instance of FacilityRepository.

Defined in

src/sdk/navigation/FacilityRepository.ts:514