Skip to main content

Class: FlightPlanner<ID>

Defined in: src/sdk/flightplan/FlightPlanner.ts:602

Manages the active flightplans of the navigational systems.

Type Parameters​

Type ParameterDefault type
ID extends stringany

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​

readonly id: 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​
ParameterTypeDescription
planIndexnumberThe 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​

ParameterTypeDefault valueDescription
sourcePlanIndexnumberundefinedThe source flight plan index.
targetPlanIndexnumberundefinedThe target flight plan index.
copyCalcsbooleanfalseWhether to copy leg calculations (defaults to false).
notifybooleantrueWhether 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​

ParameterTypeDefault valueDescription
planIndexnumberundefinedThe index at which to create the new flight plan.
notifybooleantrueWhether to send an event notification. True by default.

Returns​

FlightPlan

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​

ParameterTypeDefault valueDescription
planIndexnumberundefinedThe index of the flight plan to delete.
notifybooleantrueWhether 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​

FlightPlan

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​

ParameterTypeDescription
planIndexnumberThe index of the flight plan.

Returns​

FlightPlan

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​

ParameterTypeDescription
planIndexnumberThe 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​

ParameterTypeDescription
baseTopicKThe 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​

ParameterTypeDescription
planIndexnumberThe index of the flight plan to make active.

Returns​

void


buildDefaultLegName()​

static buildDefaultLegName(leg): string

Defined in: src/sdk/flightplan/FlightPlanner.ts:1769

Default Method for leg naming - builds leg names using default nomenclature.

Parameters​

ParameterTypeDescription
legFlightPlanLegThe leg to build a name for.

Returns​

string

The name of the leg.


getPlanner()​

Call Signature​

static getPlanner<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​
ParameterTypeDescription
idIDThe ID of the flight planner to get.
busEventBusThe event bus.
optionsReadonly<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​

static getPlanner(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​
ParameterTypeDescription
busEventBusThe event bus.
calculatorFlightPathCalculatorThe flight path calculator to use to compute flight paths for the planner's flight plans if a new one must be created.
getLegName?(leg, flags) => string | undefinedA 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.