Class: FlightPlanner<ID>
Manages the active flightplans of the navigational systems.
Type parameters
Name | Type |
---|---|
ID | extends string = any |
Properties
flightPlanSynced
• flightPlanSynced: SubEvent
<FlightPlanner
<ID
>, boolean
>
Invoked when we receive a flight plan response event.
Defined in
src/sdk/flightplan/FlightPlanner.ts:449
id
• Readonly
id: ID
This planner's ID.
Defined in
src/sdk/flightplan/FlightPlanner.ts:476
Accessors
activePlanIndex
• get
activePlanIndex(): number
Get the active plan index.
Returns
number
The active plan index number.
Defined in
src/sdk/flightplan/FlightPlanner.ts:463
• set
activePlanIndex(planIndex
): void
Set a new active plan index.
Parameters
Name | Type | Description |
---|---|---|
planIndex | number | The new active plan index. |
Returns
void
Defined in
src/sdk/flightplan/FlightPlanner.ts:455
Methods
copyFlightPlan
▸ copyFlightPlan(sourcePlanIndex
, targetPlanIndex
, copyCalcs?
, notify?
): void
Copies a flight plan to another flight plan slot.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
sourcePlanIndex | number | undefined | The source flight plan index. |
targetPlanIndex | number | undefined | The target flight plan index. |
copyCalcs | boolean | false | Whether to copy leg calculations (defaults to false). |
notify | boolean | true | Whether or not to notify subscribers that the plan has been copied. |
Returns
void
Defined in
src/sdk/flightplan/FlightPlanner.ts:748
createFlightPlan
▸ createFlightPlan(planIndex
, notify?
): FlightPlan
Creates a new flight plan at a specified index if one does not already exist.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
planIndex | number | undefined | The index at which to create the new flight plan. |
notify | boolean | true | Whether to send an event notification. True by default. |
Returns
The new flight plan, or the existing flight plan at planIndex
.
Defined in
src/sdk/flightplan/FlightPlanner.ts:627
deleteFlightPlan
▸ deleteFlightPlan(planIndex
, notify?
): void
Deletes a flight plan from the flight planner.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
planIndex | number | undefined | The index of the flight plan to delete. |
notify | boolean | true | Whether to send an event notification. True by default. |
Returns
void
Defined in
src/sdk/flightplan/FlightPlanner.ts:666
getActiveFlightPlan
▸ getActiveFlightPlan(): FlightPlan
Gets the currently active flight plan from the flight planner.
Returns
The currently active flight plan.
Throws
Error if no active flight plan exists.
Defined in
src/sdk/flightplan/FlightPlanner.ts:737
getEventSubscriber
▸ getEventSubscriber(): EventSubscriber
<FlightPlannerEventsForId
<ID
>>
Gets an event bus subscriber for topics published by this flight planner.
Returns
EventSubscriber
<FlightPlannerEventsForId
<ID
>>
An event bus subscriber for topics published by this flight planner.
Defined in
src/sdk/flightplan/FlightPlanner.ts:512
getFlightPlan
▸ getFlightPlan(planIndex
): FlightPlan
Gets a flight plan from the flight planner.
Parameters
Name | Type | Description |
---|---|---|
planIndex | number | The index of the flight plan. |
Returns
The requested flight plan.
Throws
Error if a flight plan does not exist at planIndex
.
Defined in
src/sdk/flightplan/FlightPlanner.ts:612
hasActiveFlightPlan
▸ hasActiveFlightPlan(): boolean
Checks whether an active flight plan exists.
Returns
boolean
Whether an active flight plan exists.
Defined in
src/sdk/flightplan/FlightPlanner.ts:728
hasFlightPlan
▸ hasFlightPlan(planIndex
): boolean
Checks whether a flight plan exists at a specified index.
Parameters
Name | Type | Description |
---|---|---|
planIndex | number | The index to check. |
Returns
boolean
Whether a a flight plan exists at planIndex
.
Defined in
src/sdk/flightplan/FlightPlanner.ts:602
onEvent
▸ onEvent<K
>(baseTopic
): Consumer
<BaseFlightPlannerEvents
[K
]>
Subscribes to one of the event bus topics published by this flight planner.
Type parameters
Name | Type |
---|---|
K | extends keyof BaseFlightPlannerEvents |
Parameters
Name | Type | Description |
---|---|---|
baseTopic | K | The base name of the topic to which to subscribe. |
Returns
Consumer
<BaseFlightPlannerEvents
[K
]>
A consumer for the specified event bus topic.
Defined in
src/sdk/flightplan/FlightPlanner.ts:521
requestSync
▸ requestSync(): void
Requests synchronization from other FlightPlanner instances.
Returns
void
Defined in
src/sdk/flightplan/FlightPlanner.ts:530
setActivePlanIndex
▸ setActivePlanIndex(planIndex
): void
Method to set an active flight plan index.
Parameters
Name | Type | Description |
---|---|---|
planIndex | number | The index of the flight plan to make active. |
Returns
void
Defined in
src/sdk/flightplan/FlightPlanner.ts:1393
buildDefaultLegName
▸ buildDefaultLegName(leg
): string
Default Method for leg naming - builds leg names using default nomenclature.
Parameters
Name | Type | Description |
---|---|---|
leg | FlightPlanLeg | The leg to build a name for. |
Returns
string
The name of the leg.
Defined in
src/sdk/flightplan/FlightPlanner.ts:1480
getPlanner
▸ getPlanner<ID
>(id
, bus
, options
): FlightPlanner
<ID
>
Gets an instance of FlightPlanner. If the requested instance does not exist, then a new instance will be created and returned.
Type parameters
Name | Type |
---|---|
ID | extends string |
Parameters
Name | Type | Description |
---|---|---|
id | ID | The ID of the flight planner to get. |
bus | EventBus | The event bus. |
options | Readonly <FlightPlannerOptions > | Options with which to configure the flight planner if a new one must be created. |
Returns
FlightPlanner
<ID
>
The instance of FlightPlanner with the specified ID.
Defined in
src/sdk/flightplan/FlightPlanner.ts:1424
▸ getPlanner(bus
, calculator
, getLegName?
): FlightPlanner
<""
>
Gets an instance of FlightPlanner with the empty ID (''
). If the instance does not exist, then a new instance
will be created and returned.
Parameters
Name | Type | Description |
---|---|---|
bus | EventBus | The event bus. |
calculator | FlightPathCalculator | The flight path calculator to use to compute flight paths for the planner's flight plans if a new one must be created. |
getLegName? | (leg : FlightPlanLeg ) => undefined | string | A function which generates flight plan leg names for the planner's flight plans if a new one must be created. |
Returns
FlightPlanner
<""
>
The instance of FlightPlanner with the empty ID.
Defined in
src/sdk/flightplan/FlightPlanner.ts:1439