Skip to main content

Class: FacilityRepository

Defined in: src/sdk/navigation/FacilityRepository.ts:102

A repository of facilities.

Methods

add()

add(fac): void

Defined in: src/sdk/navigation/FacilityRepository.ts:229

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

ParameterTypeDescription
facFacilityThe facility to add.

Returns

void

Throws

Error if the facility has an invalid ICAO.


addMultiple()

addMultiple(facs): void

Defined in: src/sdk/navigation/FacilityRepository.ts:244

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

ParameterTypeDescription
facsreadonly Facility[]The facilities to add.

Returns

void


forEach()

forEach(fn, types?): void

Defined in: src/sdk/navigation/FacilityRepository.ts:278

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

Parameters

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

Returns

void


get()

get(icao): undefined | Facility

Defined in: src/sdk/navigation/FacilityRepository.ts:161

Retrieves a facility from this repository.

Parameters

ParameterTypeDescription
icaostringThe ICAO of the facility to retrieve.

Returns

undefined | Facility

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


remove()

remove(fac): void

Defined in: src/sdk/navigation/FacilityRepository.ts:254

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

Parameters

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

Returns

void

Throws

Error if the facility has an invalid ICAO.


removeMultiple()

removeMultiple(facs): void

Defined in: src/sdk/navigation/FacilityRepository.ts:268

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

Parameters

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

Returns

void


Call Signature

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

Defined in: src/sdk/navigation/FacilityRepository.ts:180

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

Parameters
ParameterTypeDescription
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.

Call Signature

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

Defined in: src/sdk/navigation/FacilityRepository.ts:192

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

Parameters
ParameterTypeDescription
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.


size()

size(types?): number

Defined in: src/sdk/navigation/FacilityRepository.ts:140

Gets the number of facilities stored in this repository.

Parameters

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

Returns

number

The number of facilities stored in this repository.


getRepository()

static getRepository(bus): FacilityRepository

Defined in: src/sdk/navigation/FacilityRepository.ts:514

Gets an instance of FacilityRepository.

Parameters

ParameterTypeDescription
busEventBusThe event bus.

Returns

FacilityRepository

an instance of FacilityRepository.