Class: ActiveFlightPlanDataArray
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/FlightPlan/ActiveFlightPlanDataArray.ts:14
An implementation of FlightPlanDataArray
that sources flight plan data from a flight planner's active flight plan.
The flight planner from which data is sourced can be changed freely.
Implements
Constructors
Constructor
new ActiveFlightPlanDataArray(
dataFieldFactory
,dataFieldCalculatorRepo
,options?
):ActiveFlightPlanDataArray
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/FlightPlan/ActiveFlightPlanDataArray.ts:46
Creates a new instance of ActiveFlightPlanDataArray. Upon creation, the array is paused and has a null flight planner source, the 'Add Waypoint' data item is flagged as hidden, and all data fields are cleared.
Parameters
Parameter | Type | Description |
---|---|---|
dataFieldFactory | FlightPlanDataFieldFactory | The factory used to create flight plan data fields for this array. |
dataFieldCalculatorRepo | FlightPlanDataFieldCalculatorRepo | The repository used by this array to retrieve calculators for flight plan data fields. |
options? | Readonly <FlightPlannerFlightPlanDataArrayOptions > | Options with which to configure this array. |
Returns
ActiveFlightPlanDataArray
Properties
cumulativeDataFields
readonly
cumulativeDataFields: readonlySubscribable
<null
|FlightPlanDataField
<FlightPlanDataFieldType
>>[]
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/FlightPlan/ActiveFlightPlanDataArray.ts:28
The data fields representing cumulative total values over this array's entire flight plan.
Implementation of
FlightPlanDataArray
.cumulativeDataFields
fromLegIndex
readonly
fromLegIndex:Subscribable
<number
>
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/FlightPlan/ActiveFlightPlanDataArray.ts:22
The index of the data item associated with the FROM flight plan leg, or -1
if there is no such leg.
Implementation of
FlightPlanDataArray
.fromLegIndex
toLegIndex
readonly
toLegIndex:Subscribable
<number
>
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/FlightPlan/ActiveFlightPlanDataArray.ts:25
The index of the data item associated with the TO flight plan leg, or -1
if there is no such leg.
Implementation of
FlightPlanDataArray
.toLegIndex
Accessors
length
Get Signature
get length():
number
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/FlightPlan/ActiveFlightPlanDataArray.ts:31
The length of this array.
Returns
number
The length of this array.
Implementation of
Methods
calculateDataFields()
calculateDataFields():
void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/FlightPlan/ActiveFlightPlanDataArray.ts:183
Calculates this array's flight plan data fields. This method does nothing if this array is paused.
Returns
void
Throws
Error if this array has been destroyed.
destroy()
destroy():
void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/FlightPlan/ActiveFlightPlanDataArray.ts:207
Destroys this array. Once destroyed, this array can no longer be manipulated and any further changes in the source flight plan will not be reflected in the array.
Returns
void
get()
get(
index
):FlightPlanDataItem
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/FlightPlan/ActiveFlightPlanDataArray.ts:59
Retrieves an element from this array.
Parameters
Parameter | Type | Description |
---|---|---|
index | number | The index of the element. |
Returns
the element at the specified index.
Throws
Error if index is out of bounds.
Implementation of
getArray()
getArray(): readonly
FlightPlanDataItem
[]
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/FlightPlan/ActiveFlightPlanDataArray.ts:69
Gets a read-only version of this array.
Returns
readonly FlightPlanDataItem
[]
a read-only version of this array.
Implementation of
pause()
pause():
void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/FlightPlan/ActiveFlightPlanDataArray.ts:107
Pauses this array. When this array is paused, it will not re-calculate its data fields when its source flight plan
is changed or calculated. In addition, calling calculateDataFields()
has no effect when the array is paused.
Returns
void
Throws
Error if this array has been destroyed.
resume()
resume():
void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/FlightPlan/ActiveFlightPlanDataArray.ts:88
Resumes this array. When this array is resumed, it will automatically re-calculate its data fields when its source flight plan is changed or calculated.
Returns
void
Throws
Error if this array has been destroyed.
setAddWaypointItemVisible()
setAddWaypointItemVisible(
visible
):void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/FlightPlan/ActiveFlightPlanDataArray.ts:157
Sets whether the 'Add Waypoint' data item at the end of this array should be flagged as visible.
Parameters
Parameter | Type | Description |
---|---|---|
visible | boolean | Whether the 'Add Waypoint' data item should be flagged as visible. |
Returns
void
Throws
Error if this array has been destroyed.
setDataFieldType()
setDataFieldType(
index
,type
):void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/FlightPlan/ActiveFlightPlanDataArray.ts:171
Sets the type of one of this array's flight plan data fields.
Parameters
Parameter | Type | Description |
---|---|---|
index | number | The index of the data field to change. |
type | null | FlightPlanDataFieldType | The data field type to set, or null to clear the data field. |
Returns
void
Throws
Error if this array has been destroyed.
setFlightPlanner()
setFlightPlanner(
isExternal
,flightPlanner
):void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/FlightPlan/ActiveFlightPlanDataArray.ts:128
Sets the flight plan from which this array sources data.
Parameters
Parameter | Type | Description |
---|---|---|
isExternal | boolean | Whether the new source flight plan is an external flight plan. |
flightPlanner | null | FlightPlanner <any > | The flight planner containing the source flight plan. If null is specified instead, then the array will behave as if it were sourcing data from an empty flight plan. |
Returns
void
Throws
Error if this array has been destroyed.
sub()
sub(
handler
,initialNotify?
,paused?
):Subscription
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/FlightPlan/ActiveFlightPlanDataArray.ts:74
Subscribes to changes in this array's state.
Parameters
Parameter | Type | Description |
---|---|---|
handler | SubscribableArrayHandler <FlightPlanDataItem > | A function which is called when this array's state changes. |
initialNotify? | boolean | Whether to immediately invoke the callback function with this array's current state. Defaults to false . This argument is ignored if the subscription is initialized as paused. |
paused? | boolean | Whether the new subscription should be initialized as paused. Defaults to false . |
Returns
Subscription
The new subscription.
Implementation of
tryGet()
tryGet(
index
):undefined
|FlightPlanDataItem
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/FlightPlan/ActiveFlightPlanDataArray.ts:64
Attempts to retrieve an element from this array.
Parameters
Parameter | Type | Description |
---|---|---|
index | number | The index of the element. |
Returns
undefined
| FlightPlanDataItem
the element at the specified index, or undefined if index is out of bounds.
Implementation of
unsub()
unsub(
handler
):void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/FlightPlan/ActiveFlightPlanDataArray.ts:79
Unsubscribes a callback function from this array.
Parameters
Parameter | Type | Description |
---|---|---|
handler | SubscribableArrayHandler <FlightPlanDataItem > | The function to unsubscribe. |
Returns
void
Deprecated
This method has been deprecated in favor of using the Subscription object returned by .sub()
to manage subscriptions.