Skip to main content

Class: FlightPlanner<ID>

Manages the active flightplans of the navigational systems.

Type parameters

NameType
IDextends 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

NameTypeDescription
planIndexnumberThe 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

NameTypeDefault 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

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

NameTypeDefault 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.

Defined in

src/sdk/flightplan/FlightPlanner.ts:627


deleteFlightPlan

deleteFlightPlan(planIndex, notify?): void

Deletes a flight plan from the flight planner.

Parameters

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

FlightPlan

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

NameTypeDescription
planIndexnumberThe index of the flight plan.

Returns

FlightPlan

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

NameTypeDescription
planIndexnumberThe 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

NameType
Kextends keyof BaseFlightPlannerEvents

Parameters

NameTypeDescription
baseTopicKThe 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

NameTypeDescription
planIndexnumberThe 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

NameTypeDescription
legFlightPlanLegThe 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

NameType
IDextends string

Parameters

NameTypeDescription
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.

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

NameTypeDescription
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: FlightPlanLeg) => undefined | stringA 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