Class: MapCachedCanvasLayer<P>
A canvas map layer whose image can be cached and transformed as the map projection changes.
Type parameters
Name | Type |
---|---|
P | extends MapCachedCanvasLayerProps <any > = MapCachedCanvasLayerProps <any > |
Hierarchy
MapCanvasLayer
<P
,MapCachedCanvasLayerCanvasInstance
>↳
MapCachedCanvasLayer
Constructors
constructor
• new MapCachedCanvasLayer<P
>(props
): MapCachedCanvasLayer
<P
>
Type parameters
Name | Type |
---|---|
P | extends MapCachedCanvasLayerProps <any > = MapCachedCanvasLayerProps <any > |
Parameters
Name | Type |
---|---|
props | P |
Returns
Inherit Doc
Overrides
Defined in
src/sdk/components/map/layers/MapCachedCanvasLayer.ts:329
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
isInit
• Protected
isInit: boolean
= false
Inherited from
Defined in
src/sdk/components/map/layers/MapCanvasLayer.tsx:78
props
• props: P
& ComponentProps
The properties of the component.
Inherited from
Defined in
src/sdk/components/FSComponent.ts:61
Accessors
buffer
• get
buffer(): C
Gets this layer's buffer canvas instance.
Returns
C
This layer's buffer canvas instance.
Throws
Error if this layer's buffer canvas instance has not been initialized.
Inherited from
MapCanvasLayer.buffer
Defined in
src/sdk/components/map/layers/MapCanvasLayer.tsx:98
display
• get
display(): C
Gets this layer's display canvas instance.
Returns
C
This layer's display canvas instance.
Throws
Error if this layer's display canvas instance has not been initialized.
Inherited from
MapCanvasLayer.display
Defined in
src/sdk/components/map/layers/MapCanvasLayer.tsx:85
Methods
copyBufferToDisplay
▸ copyBufferToDisplay(): void
Copies the contents of the buffer to the display. Has no effect if this layer does not have a buffer.
Returns
void
Inherited from
MapCanvasLayer.copyBufferToDisplay
Defined in
src/sdk/components/map/layers/MapCanvasLayer.tsx:171
createCanvasInstance
▸ createCanvasInstance(canvas
, context
, isDisplayed
): MapCachedCanvasLayerCanvasInstanceClass
Creates a canvas instance.
Parameters
Name | Type | Description |
---|---|---|
canvas | HTMLCanvasElement | The canvas element. |
context | CanvasRenderingContext2D | The canvas 2D rendering context. |
isDisplayed | boolean | Whether the canvas is displayed. |
Returns
MapCachedCanvasLayerCanvasInstanceClass
a canvas instance.
Overrides
MapCanvasLayer.createCanvasInstance
Defined in
src/sdk/components/map/layers/MapCachedCanvasLayer.ts:361
destroy
▸ destroy(): void
Destroys this component.
Returns
void
Inherited from
Defined in
src/sdk/components/FSComponent.ts:98
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
getHeight
▸ getHeight(): number
Gets the height of the canvas element, in pixels.
Returns
number
the height of the canvas element.
Inherited from
Defined in
src/sdk/components/map/layers/MapCanvasLayer.tsx:134
getReferenceMargin
▸ getReferenceMargin(): number
Gets the reference translation margin, in pixels, of this layer's display canvas. This value is the maximum amount the display canvas can be translated in the x or y direction at a scale factor of 1 without invalidation.
Returns
number
the reference translation margin of this layer's display canvas.
Defined in
src/sdk/components/map/layers/MapCachedCanvasLayer.ts:348
getSize
▸ getSize(): number
Gets the size, in pixels, of this layer's canvas.
Returns
number
the size of this layer's canvas.
Defined in
src/sdk/components/map/layers/MapCachedCanvasLayer.ts:339
getWidth
▸ getWidth(): number
Gets the width of the canvas element, in pixels.
Returns
number
the width of the canvas element.
Inherited from
Defined in
src/sdk/components/map/layers/MapCanvasLayer.tsx:126
isVisible
▸ isVisible(): boolean
Checks whether this layer is visible.
Returns
boolean
whether this layer is visible.
Inherited from
Defined in
src/sdk/components/map/MapLayer.ts:38
onAfterRender
▸ onAfterRender(): void
A callback called after the component renders.
Returns
void
Inherited from
Defined in
src/sdk/components/map/layers/MapCanvasLayer.tsx:182
onAttached
▸ onAttached(): void
This method is called when this layer is attached to its parent map component.
Returns
void
Overrides
Defined in
src/sdk/components/map/layers/MapCachedCanvasLayer.ts:353
onBeforeRender
▸ onBeforeRender(): void
A callback that is called before the component is rendered.
Returns
void
Inherited from
Defined in
src/sdk/components/FSComponent.ts:80
onDetached
▸ onDetached(): void
This method is called when this layer is detached from its parent map component.
Returns
void
Inherited from
Defined in
src/sdk/components/map/MapLayer.ts:108
onMapProjectionChanged
▸ onMapProjectionChanged(mapProjection
, changeFlags
): void
This method is called when the map projection changes.
Parameters
Name | Type | Description |
---|---|---|
mapProjection | MapProjection | this layer's map projection. |
changeFlags | number | The types of changes made to the projection. |
Returns
void
Overrides
MapCanvasLayer.onMapProjectionChanged
Defined in
src/sdk/components/map/layers/MapCachedCanvasLayer.ts:389
onSleep
▸ onSleep(): void
This method is called when this layer's parent map is put to sleep.
Returns
void
Inherited from
Defined in
src/sdk/components/map/MapLayer.ts:81
onUpdated
▸ onUpdated(time
, elapsed
): void
This method is called once every map update cycle.
Parameters
Name | Type | Description |
---|---|---|
time | number | The current time as a UNIX timestamp. |
elapsed | number | The elapsed time, in milliseconds, since the last update. |
Returns
void
Overrides
Defined in
src/sdk/components/map/layers/MapCachedCanvasLayer.ts:400
onVisibilityChanged
▸ onVisibilityChanged(isVisible
): void
This method is called when this layer's visibility changes.
Parameters
Name | Type | Description |
---|---|---|
isVisible | boolean | Whether the layer is now visible. |
Returns
void
Inherited from
MapCanvasLayer.onVisibilityChanged
Defined in
src/sdk/components/map/layers/MapCanvasLayer.tsx:187
onWake
▸ onWake(): void
This method is called when this layer's parent map is woken.
Returns
void
Inherited from
Defined in
src/sdk/components/map/MapLayer.ts:74
render
▸ render(): null
| VNode
Renders the component.
Returns
null
| VNode
A JSX element to be rendered.
Inherited from
Defined in
src/sdk/components/map/layers/MapCanvasLayer.tsx:256
setHeight
▸ setHeight(height
): void
Sets the height of the canvas element, in pixels.
Parameters
Name | Type | Description |
---|---|---|
height | number | The new height. |
Returns
void
Inherited from
Defined in
src/sdk/components/map/layers/MapCanvasLayer.tsx:157
setVisible
▸ setVisible(val
): void
Sets this layer's visibility.
Parameters
Name | Type | Description |
---|---|---|
val | boolean | Whether this layer should be visible. |
Returns
void
Inherited from
Defined in
src/sdk/components/map/MapLayer.ts:46
setWidth
▸ setWidth(width
): void
Sets the width of the canvas element, in pixels.
Parameters
Name | Type | Description |
---|---|---|
width | number | The new width. |
Returns
void
Inherited from
Defined in
src/sdk/components/map/layers/MapCanvasLayer.tsx:142
tryGetBuffer
▸ tryGetBuffer(): undefined
| MapCachedCanvasLayerCanvasInstance
Attempts to get this layer's buffer canvas instance.
Returns
undefined
| MapCachedCanvasLayerCanvasInstance
This layer's buffer canvas instance, or undefined if it has not been initialized.
Inherited from
Defined in
src/sdk/components/map/layers/MapCanvasLayer.tsx:118
tryGetDisplay
▸ tryGetDisplay(): undefined
| MapCachedCanvasLayerCanvasInstance
Attempts to get this layer's display canvas instance.
Returns
undefined
| MapCachedCanvasLayerCanvasInstance
This layer's display canvas instance, or undefined if it has not been initialized.
Inherited from
Defined in
src/sdk/components/map/layers/MapCanvasLayer.tsx:110
updateCanvasSize
▸ updateCanvasSize(): void
Updates the canvas element's size.
Returns
void
Inherited from
MapCanvasLayer.updateCanvasSize
Defined in
src/sdk/components/map/layers/MapCanvasLayer.tsx:234
updateFromProjectedSize
▸ updateFromProjectedSize(projectedSize
): void
Updates this layer according to the current size of the projected map window.
Parameters
Name | Type | Description |
---|---|---|
projectedSize | Readonly <Omit <Float64Array , "set" | "sort" | "copyWithin" >> | The size of the projected map window. |
Returns
void
Defined in
src/sdk/components/map/layers/MapCachedCanvasLayer.ts:369
updateFromVisibility
▸ updateFromVisibility(): void
Updates this layer according to its current visibility.
Returns
void
Inherited from
MapCanvasLayer.updateFromVisibility
Defined in
src/sdk/components/map/layers/MapCanvasLayer.tsx:196
updateTransforms
▸ updateTransforms(): void
Updates this layer's canvas instances' transforms.
Returns
void
Defined in
src/sdk/components/map/layers/MapCachedCanvasLayer.ts:413