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
Name | Type | Description |
---|---|---|
fac | Facility | The 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
Name | Type | Description |
---|---|---|
facs | readonly 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
Name | Type | Description |
---|---|---|
fn | (fac : Facility ) => void | A 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
Name | Type | Description |
---|---|---|
icao | string | The 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
Name | Type | Description |
---|---|---|
fac | string | Facility | The 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
Name | Type | Description |
---|---|---|
facs | readonly (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
▸ search(type
, lat
, lon
, radius
, visitor
): void
Searches for facilities around a point. Only supported for USR and VIS facilities.
Parameters
Name | Type | Description |
---|---|---|
type | SearchableFacilityTypes | 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.
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
Name | Type | Description |
---|---|---|
type | SearchableFacilityTypes | 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.
Defined in
src/sdk/navigation/FacilityRepository.ts:192
size
▸ size(types?
): number
Gets the number of facilities stored in this repository.
Parameters
Name | 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.
Defined in
src/sdk/navigation/FacilityRepository.ts:140
getRepository
▸ getRepository(bus
): FacilityRepository
Gets an instance of FacilityRepository.
Parameters
Name | Type | Description |
---|---|---|
bus | EventBus | The event bus. |
Returns
an instance of FacilityRepository.
Defined in
src/sdk/navigation/FacilityRepository.ts:514