Class: HorizonComponent<P>
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.
Type parameters
Name | Type |
---|---|
P | extends HorizonComponentProps = HorizonComponentProps |
Hierarchy
↳
HorizonComponent
Constructors
constructor
• new HorizonComponent<P
>(props
): HorizonComponent
<P
>
Type parameters
Name | Type |
---|---|
P | extends HorizonComponentProps = HorizonComponentProps |
Parameters
Name | Type |
---|---|
props | P |
Returns
Inherit Doc
Overrides
Defined in
src/sdk/components/horizon/HorizonComponent.tsx:65
Properties
context
• Optional
context: [] = undefined
The context on this component, if any.
Inherited from
Defined in
src/sdk/components/FSComponent.ts:64
contextType
• Optional
Readonly
contextType: readonly [] = undefined
The type of context for this component, if any.
Inherited from
Defined in
src/sdk/components/FSComponent.ts:67
projection
• Readonly
projection: HorizonProjection
This horizon component's projection.
Defined in
src/sdk/components/horizon/HorizonComponent.tsx:47
props
• props: P
& ComponentProps
The properties of the component.
Inherited from
Defined in
src/sdk/components/FSComponent.ts:61
Accessors
isAwake
• get
isAwake(): boolean
Whether this horizon is awake.
Returns
boolean
Defined in
src/sdk/components/horizon/HorizonComponent.tsx:98
Methods
attachLayer
▸ attachLayer(layer
): void
Attaches a layer to this horizon component. If the layer is already attached, then this method has no effect.
Parameters
Name | Type | Description |
---|---|---|
layer | HorizonLayer <HorizonLayerProps > | The layer to attach. |
Returns
void
Defined in
src/sdk/components/horizon/HorizonComponent.tsx:234
attachLayers
▸ attachLayers(thisNode
): void
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
Name | Type | Description |
---|---|---|
thisNode | VNode | This component's VNode. |
Returns
void
Defined in
src/sdk/components/horizon/HorizonComponent.tsx:163
destroy
▸ destroy(): void
Destroys this component.
Returns
void
Overrides
Defined in
src/sdk/components/horizon/HorizonComponent.tsx:306
detachLayer
▸ detachLayer(layer
): boolean
Detaches a layer from this horizon component.
Parameters
Name | Type | Description |
---|---|---|
layer | HorizonLayer <HorizonLayerProps > | The layer to detach. |
Returns
boolean
Whether the layer was succesfully detached.
Defined in
src/sdk/components/horizon/HorizonComponent.tsx:249
getContext
▸ getContext(context
): never
Gets a context data subscription from the context collection.
Parameters
Name | Type | Description |
---|---|---|
context | never | The 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
Defined in
src/sdk/components/FSComponent.ts:106
getProjectedSize
▸ getProjectedSize(): Readonly
<Omit
<Float64Array
, "set"
| "sort"
| "copyWithin"
>>
Gets the size of this map's projected window, in pixels.
Returns
Readonly
<Omit
<Float64Array
, "set"
| "sort"
| "copyWithin"
>>
The size of this map's projected window.
Defined in
src/sdk/components/horizon/HorizonComponent.tsx:90
onAfterRender
▸ onAfterRender(thisNode
): void
A callback that is called after the component is rendered.
Parameters
Name | Type | Description |
---|---|---|
thisNode | VNode | The component's VNode. |
Returns
void
Overrides
DisplayComponent.onAfterRender
Defined in
src/sdk/components/horizon/HorizonComponent.tsx:131
onBeforeRender
▸ onBeforeRender(): void
A callback that is called before the component is rendered.
Returns
void
Inherited from
DisplayComponent.onBeforeRender
Defined in
src/sdk/components/FSComponent.ts:80
onProjectedSizeChanged
▸ onProjectedSizeChanged(): void
This method is called when the size of this horizon's projected window changes.
Returns
void
Defined in
src/sdk/components/horizon/HorizonComponent.tsx:226
onProjectionChanged
▸ onProjectionChanged(projection
, changeFlags
): void
This method is called when this horizon's projection changes.
Parameters
Name | Type | Description |
---|---|---|
projection | HorizonProjection | This horizon's projection. |
changeFlags | number | The types of changes made to the projection. |
Returns
void
Defined in
src/sdk/components/horizon/HorizonComponent.tsx:212
onSleep
▸ onSleep(): void
This method is called when this horizon is put to sleep.
Returns
void
Defined in
src/sdk/components/horizon/HorizonComponent.tsx:193
onUpdated
▸ onUpdated(time
, elapsed
): void
This method is called once every update cycle.
Parameters
Name | Type | Description |
---|---|---|
time | number | The current real time as a UNIX timestamp in milliseconds. |
elapsed | number | The elapsed time, in milliseconds, since the last update. |
Returns
void
Defined in
src/sdk/components/horizon/HorizonComponent.tsx:279
onWake
▸ onWake(): void
This method is called when this horizon is awakened.
Returns
void
Defined in
src/sdk/components/horizon/HorizonComponent.tsx:176
render
▸ render(): VNode
Renders the component.
Returns
A JSX element to be rendered.
Overrides
Defined in
src/sdk/components/horizon/HorizonComponent.tsx:297
sleep
▸ sleep(): void
Puts this horizon to sleep. While asleep, this horizon will not be updated.
Returns
void
Defined in
src/sdk/components/horizon/HorizonComponent.tsx:105
sleepLayers
▸ sleepLayers(): void
Calls the onSleep() method of this horizon's layers.
Returns
void
Defined in
src/sdk/components/horizon/HorizonComponent.tsx:200
update
▸ update(time
): void
Updates this horizon.
Parameters
Name | Type | Description |
---|---|---|
time | number | The current real time as a UNIX timestamp in milliseconds. |
Returns
void
Defined in
src/sdk/components/horizon/HorizonComponent.tsx:265
updateLayers
▸ updateLayers(time
, elapsed
): void
Updates this horizon's attached layers.
Parameters
Name | Type | Description |
---|---|---|
time | number | The current real time as a UNIX timestamp in milliseconds. |
elapsed | number | The elapsed time, in milliseconds, since the last update. |
Returns
void
Defined in
src/sdk/components/horizon/HorizonComponent.tsx:289
wake
▸ wake(): void
Wakes this horizon, allowing it to be updated.
Returns
void
Defined in
src/sdk/components/horizon/HorizonComponent.tsx:112
wakeLayers
▸ wakeLayers(): void
Calls the onWake() method of this horizon's layers.
Returns
void
Defined in
src/sdk/components/horizon/HorizonComponent.tsx:183