Class: FlightPlanner<ID>
Defined in: src/sdk/flightplan/FlightPlanner.ts:602
Manages the active flightplans of the navigational systems.
Type Parameters
| Type Parameter | Default type |
|---|---|
ID extends string | any |
Properties
flightPlanSynced
flightPlanSynced:
SubEvent<FlightPlanner<ID>,boolean>
Defined in: src/sdk/flightplan/FlightPlanner.ts:627
Invoked when we receive a flight plan response event.
id
readonlyid:ID
Defined in: src/sdk/flightplan/FlightPlanner.ts:654
This planner's ID.
Accessors
activePlanIndex
Get Signature
get activePlanIndex():
number
Defined in: src/sdk/flightplan/FlightPlanner.ts:641
Get the active plan index.
Returns
number
The active plan index number.
Set Signature
set activePlanIndex(
planIndex):void
Defined in: src/sdk/flightplan/FlightPlanner.ts:633
Set a new active plan index.
Parameters
| Parameter | Type | Description |
|---|---|---|
planIndex | number | The new active plan index. |
Returns
void
Methods
copyFlightPlan()
copyFlightPlan(
sourcePlanIndex,targetPlanIndex,copyCalcs,notify):void
Defined in: src/sdk/flightplan/FlightPlanner.ts:932
Copies a flight plan to another flight plan slot.
Parameters
| Parameter | 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
createFlightPlan()
createFlightPlan(
planIndex,notify):FlightPlan
Defined in: src/sdk/flightplan/FlightPlanner.ts:809
Creates a new flight plan at a specified index if one does not already exist.
Parameters
| Parameter | 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.
deleteFlightPlan()
deleteFlightPlan(
planIndex,notify):void
Defined in: src/sdk/flightplan/FlightPlanner.ts:849
Deletes a flight plan from the flight planner.
Parameters
| Parameter | 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
getActiveFlightPlan()
getActiveFlightPlan():
FlightPlan
Defined in: src/sdk/flightplan/FlightPlanner.ts:921
Gets the currently active flight plan from the flight planner.
Returns
The currently active flight plan.
Throws
Error if no active flight plan exists.
getEventSubscriber()
getEventSubscriber():
EventSubscriber<FlightPlannerEventsForId<ID>>
Defined in: src/sdk/flightplan/FlightPlanner.ts:690
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.
getFlightPlan()
getFlightPlan(
planIndex):FlightPlan
Defined in: src/sdk/flightplan/FlightPlanner.ts:794
Gets a flight plan from the flight planner.
Parameters
| Parameter | 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.
hasActiveFlightPlan()
hasActiveFlightPlan():
boolean
Defined in: src/sdk/flightplan/FlightPlanner.ts:912
Checks whether an active flight plan exists.
Returns
boolean
Whether an active flight plan exists.
hasFlightPlan()
hasFlightPlan(
planIndex):boolean
Defined in: src/sdk/flightplan/FlightPlanner.ts:784
Checks whether a flight plan exists at a specified index.
Parameters
| Parameter | Type | Description |
|---|---|---|
planIndex | number | The index to check. |
Returns
boolean
Whether a a flight plan exists at planIndex.
onEvent()
onEvent<
K>(baseTopic):Consumer<BaseFlightPlannerEvents[K]>
Defined in: src/sdk/flightplan/FlightPlanner.ts:699
Subscribes to one of the event bus topics published by this flight planner.
Type Parameters
| Type Parameter |
|---|
K extends keyof BaseFlightPlannerEvents |
Parameters
| Parameter | 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.
requestSync()
requestSync():
void
Defined in: src/sdk/flightplan/FlightPlanner.ts:708
Requests synchronization from other FlightPlanner instances.
Returns
void
setActivePlanIndex()
setActivePlanIndex(
planIndex):void
Defined in: src/sdk/flightplan/FlightPlanner.ts:1678
Method to set an active flight plan index.
Parameters
| Parameter | Type | Description |
|---|---|---|
planIndex | number | The index of the flight plan to make active. |
Returns
void
buildDefaultLegName()
staticbuildDefaultLegName(leg):string
Defined in: src/sdk/flightplan/FlightPlanner.ts:1769
Default Method for leg naming - builds leg names using default nomenclature.
Parameters
| Parameter | Type | Description |
|---|---|---|
leg | FlightPlanLeg | The leg to build a name for. |
Returns
string
The name of the leg.
getPlanner()
Call Signature
staticgetPlanner<ID>(id,bus,options):FlightPlanner<ID>
Defined in: src/sdk/flightplan/FlightPlanner.ts:1713
Gets an instance of FlightPlanner. If the requested instance does not exist, then a new instance will be created and returned.
Type Parameters
| Type Parameter |
|---|
ID extends string |
Parameters
| Parameter | 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.
Call Signature
staticgetPlanner(bus,calculator,getLegName?):FlightPlanner<"">
Defined in: src/sdk/flightplan/FlightPlanner.ts:1728
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
| Parameter | 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) => 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.