Skip to main content

Class: HorizonComponent<P>

Defined in: src/sdk/components/horizon/HorizonComponent.tsx:43

A component which displays an artificial horizon. A horizon tracks the position, altitude, heading, pitch, and roll of an airplane and uses a persepctive projection to project points in space to a planar pixel grid. Each horizon component maintains a HorizonComponent instance which handles the details of the projection. HorizonLayer objects added to the horizon as children determine what is drawn in the horizon window.

Extends

Type Parameters

Type ParameterDefault type
P extends HorizonComponentPropsHorizonComponentProps

Constructors

Constructor

new HorizonComponent<P>(props): HorizonComponent<P>

Defined in: src/sdk/components/horizon/HorizonComponent.tsx:65

Parameters

ParameterType
propsP

Returns

HorizonComponent<P>

Inherit Doc

Overrides

DisplayComponent.constructor

Properties

context?

optional context: [] = undefined

Defined in: src/sdk/components/FSComponent.ts:64

The context on this component, if any.

Inherited from

DisplayComponent.context


contextType?

readonly optional contextType: readonly [] = undefined

Defined in: src/sdk/components/FSComponent.ts:67

The type of context for this component, if any.

Inherited from

DisplayComponent.contextType


projection

readonly projection: HorizonProjection

Defined in: src/sdk/components/horizon/HorizonComponent.tsx:47

This horizon component's projection.


props

props: P & ComponentProps

Defined in: src/sdk/components/FSComponent.ts:61

The properties of the component.

Inherited from

DisplayComponent.props

Accessors

isAwake

Get Signature

get isAwake(): boolean

Defined in: src/sdk/components/horizon/HorizonComponent.tsx:98

Whether this horizon is awake.

Returns

boolean

Methods

attachLayer()

protected attachLayer(layer): void

Defined in: src/sdk/components/horizon/HorizonComponent.tsx:234

Attaches a layer to this horizon component. If the layer is already attached, then this method has no effect.

Parameters

ParameterTypeDescription
layerHorizonLayerThe layer to attach.

Returns

void


attachLayers()

protected attachLayers(thisNode): void

Defined in: src/sdk/components/horizon/HorizonComponent.tsx:163

Scans this component's VNode sub-tree for HorizonLayer components and attaches them when found. Only the top-most level of HorizonLayer components are attached; layers that are themselves children of other layers are not attached.

Parameters

ParameterTypeDescription
thisNodeVNodeThis component's VNode.

Returns

void


destroy()

destroy(): void

Defined in: src/sdk/components/horizon/HorizonComponent.tsx:306

Destroys this component.

Returns

void

Overrides

DisplayComponent.destroy


detachLayer()

protected detachLayer(layer): boolean

Defined in: src/sdk/components/horizon/HorizonComponent.tsx:249

Detaches a layer from this horizon component.

Parameters

ParameterTypeDescription
layerHorizonLayerThe layer to detach.

Returns

boolean

Whether the layer was succesfully detached.


getContext()

protected getContext(context): never

Defined in: src/sdk/components/FSComponent.ts:106

Gets a context data subscription from the context collection.

Parameters

ParameterTypeDescription
contextneverThe context to get the subscription for.

Returns

never

The requested context.

Throws

An error if no data for the specified context type could be found.

Inherited from

DisplayComponent.getContext


getProjectedSize()

getProjectedSize(): ReadonlyFloat64Array

Defined in: src/sdk/components/horizon/HorizonComponent.tsx:90

Gets the size of this map's projected window, in pixels.

Returns

ReadonlyFloat64Array

The size of this map's projected window.


onAfterRender()

onAfterRender(thisNode): void

Defined in: src/sdk/components/horizon/HorizonComponent.tsx:131

A callback that is called after the component is rendered.

Parameters

ParameterTypeDescription
thisNodeVNodeThe component's VNode.

Returns

void

Overrides

DisplayComponent.onAfterRender


onBeforeRender()

onBeforeRender(): void

Defined in: src/sdk/components/FSComponent.ts:80

A callback that is called before the component is rendered.

Returns

void

Inherited from

DisplayComponent.onBeforeRender


onProjectedSizeChanged()

protected onProjectedSizeChanged(): void

Defined in: src/sdk/components/horizon/HorizonComponent.tsx:226

This method is called when the size of this horizon's projected window changes.

Returns

void


onProjectionChanged()

protected onProjectionChanged(projection, changeFlags): void

Defined in: src/sdk/components/horizon/HorizonComponent.tsx:212

This method is called when this horizon's projection changes.

Parameters

ParameterTypeDescription
projectionHorizonProjectionThis horizon's projection.
changeFlagsnumberThe types of changes made to the projection.

Returns

void


onSleep()

protected onSleep(): void

Defined in: src/sdk/components/horizon/HorizonComponent.tsx:193

This method is called when this horizon is put to sleep.

Returns

void


onUpdated()

protected onUpdated(time, elapsed): void

Defined in: src/sdk/components/horizon/HorizonComponent.tsx:279

This method is called once every update cycle.

Parameters

ParameterTypeDescription
timenumberThe current real time as a UNIX timestamp in milliseconds.
elapsednumberThe elapsed time, in milliseconds, since the last update.

Returns

void


onWake()

protected onWake(): void

Defined in: src/sdk/components/horizon/HorizonComponent.tsx:176

This method is called when this horizon is awakened.

Returns

void


render()

render(): VNode

Defined in: src/sdk/components/horizon/HorizonComponent.tsx:297

Renders the component.

Returns

VNode

A JSX element to be rendered.

Overrides

DisplayComponent.render


sleep()

sleep(): void

Defined in: src/sdk/components/horizon/HorizonComponent.tsx:105

Puts this horizon to sleep. While asleep, this horizon will not be updated.

Returns

void


sleepLayers()

protected sleepLayers(): void

Defined in: src/sdk/components/horizon/HorizonComponent.tsx:200

Calls the onSleep() method of this horizon's layers.

Returns

void


update()

update(time): void

Defined in: src/sdk/components/horizon/HorizonComponent.tsx:265

Updates this horizon.

Parameters

ParameterTypeDescription
timenumberThe current real time as a UNIX timestamp in milliseconds.

Returns

void


updateLayers()

protected updateLayers(time, elapsed): void

Defined in: src/sdk/components/horizon/HorizonComponent.tsx:289

Updates this horizon's attached layers.

Parameters

ParameterTypeDescription
timenumberThe current real time as a UNIX timestamp in milliseconds.
elapsednumberThe elapsed time, in milliseconds, since the last update.

Returns

void


wake()

wake(): void

Defined in: src/sdk/components/horizon/HorizonComponent.tsx:112

Wakes this horizon, allowing it to be updated.

Returns

void


wakeLayers()

protected wakeLayers(): void

Defined in: src/sdk/components/horizon/HorizonComponent.tsx:183

Calls the onWake() method of this horizon's layers.

Returns

void