Class: FacilityRepository
Defined in: src/sdk/navigation/FacilityRepository.ts:107
A repository of facilities.
Methods
add()
add(
fac):void
Defined in: src/sdk/navigation/FacilityRepository.ts:234
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
| Parameter | Type | Description |
|---|---|---|
fac | Facility | The 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:249
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
| Parameter | Type | Description |
|---|---|---|
facs | readonly Facility[] | The facilities to add. |
Returns
void
forEach()
forEach(
fn,types?):void
Defined in: src/sdk/navigation/FacilityRepository.ts:283
Iterates over every facility in this respository with a visitor function.
Parameters
| Parameter | Type | Description |
|---|---|---|
fn | (fac) => void | A 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:166
Retrieves a facility from this repository.
Parameters
| Parameter | Type | Description |
|---|---|---|
icao | IcaoValue | The 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:259
Removes a facility from this repository and all other repositories synced with this one.
Parameters
| Parameter | Type | Description |
|---|---|---|
fac | IcaoValue | Facility | The 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:273
Removes multiple facilities from this repository and all other repositories synced with this one.
Parameters
| Parameter | Type | Description |
|---|---|---|
facs | readonly (IcaoValue | Facility)[] | The facilities to remove, or the ICAOs of the facilties to remove. |
Returns
void
search()
Call Signature
search(
type,lat,lon,radius,visitor):void
Defined in: src/sdk/navigation/FacilityRepository.ts:185
Searches for facilities around a point. Only supported for USR and VIS facilities.
Parameters
| Parameter | Type | Description |
|---|---|---|
type | FacilityRepositorySearchableTypes | The type of facility for which to search. |
lat | number | The latitude of the query point, in degrees. |
lon | number | The longitude of the query point, in degrees. |
radius | number | The radius of the search, in great-arc radians. |
visitor | GeoKdTreeSearchVisitor<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:197
Searches for facilities around a point. Only supported for USR and VIS facilities.
Parameters
| Parameter | Type | Description |
|---|---|---|
type | FacilityRepositorySearchableTypes | The type of facility for which to search. |
lat | number | The latitude of the query point, in degrees. |
lon | number | The longitude of the query point, in degrees. |
radius | number | The radius of the search, in great-arc radians. |
maxResultCount | number | The maximum number of search results to return. |
out | Facility[] | 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:145
Gets the number of facilities stored in this repository.
Parameters
| Parameter | Type | Description |
|---|---|---|
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()
staticgetRepository(bus):FacilityRepository
Defined in: src/sdk/navigation/FacilityRepository.ts:523
Gets an instance of FacilityRepository.
Parameters
| Parameter | Type | Description |
|---|---|---|
bus | EventBus | The event bus. |
Returns
FacilityRepository
an instance of FacilityRepository.