Skip to main content

Class: MapComponent<P>

A component which displays a map. A map projects geographic coordinates onto a planar pixel grid. Each map component maintains a MapProjection instance which handles the details of the projection. MapLayer objects added to the map as children determine what is drawn on the map.

Type parameters

NameType
Pextends MapComponentProps<any> = MapComponentProps<any>

Hierarchy

Constructors

constructor

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

Type parameters

NameType
Pextends MapComponentProps<any> = MapComponentProps<any>

Parameters

NameType
propsP

Returns

MapComponent<P>

Inherit Doc

Overrides

DisplayComponent.constructor

Defined in

src/sdk/components/map/MapComponent.ts:57

Properties

context

Optional context: [] = undefined

The context on this component, if any.

Inherited from

DisplayComponent.context

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

DisplayComponent.contextType

Defined in

src/sdk/components/FSComponent.ts:67


mapProjection

Readonly mapProjection: MapProjection

This map component's projection model.

Defined in

src/sdk/components/map/MapComponent.ts:42


props

props: P & ComponentProps

The properties of the component.

Inherited from

DisplayComponent.props

Defined in

src/sdk/components/FSComponent.ts:61

Accessors

isAwake

get isAwake(): boolean

Whether this map is awake.

Returns

boolean

Defined in

src/sdk/components/map/MapComponent.ts:82

Methods

attachLayer

attachLayer(layer): void

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

Parameters

NameTypeDescription
layerMapLayer<MapLayerProps<any>>The layer to attach.

Returns

void

Defined in

src/sdk/components/map/MapComponent.ts:209


attachLayers

attachLayers(thisNode): void

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

Parameters

NameTypeDescription
thisNodeVNodeThis component's VNode.

Returns

void

Defined in

src/sdk/components/map/MapComponent.ts:140


destroy

destroy(): void

Destroys this component.

Returns

void

Overrides

DisplayComponent.destroy

Defined in

src/sdk/components/map/MapComponent.ts:272


detachLayer

detachLayer(layer): boolean

Detaches a layer from this map component.

Parameters

NameTypeDescription
layerMapLayer<MapLayerProps<any>>The layer to detach.

Returns

boolean

Whether the layer was succesfully detached.

Defined in

src/sdk/components/map/MapComponent.ts:224


getContext

getContext(context): never

Gets a context data subscription from the context collection.

Parameters

NameTypeDescription
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

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/map/MapComponent.ts:74


onAfterRender

onAfterRender(thisNode): void

A callback that is called after the component is rendered.

Parameters

NameTypeDescription
thisNodeVNodeThe component's VNode.

Returns

void

Overrides

DisplayComponent.onAfterRender

Defined in

src/sdk/components/map/MapComponent.ts:115


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


onMapProjectionChanged

onMapProjectionChanged(mapProjection, changeFlags): void

This method is called when the map projection changes.

Parameters

NameTypeDescription
mapProjectionMapProjectionThis layer's map projection.
changeFlagsnumberThe types of changes made to the projection.

Returns

void

Defined in

src/sdk/components/map/MapComponent.ts:189


onProjectedSizeChanged

onProjectedSizeChanged(): void

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

Returns

void

Defined in

src/sdk/components/map/MapComponent.ts:203


onSleep

onSleep(): void

This method is called when the map is put to sleep.

Returns

void

Defined in

src/sdk/components/map/MapComponent.ts:170


onUpdated

onUpdated(time, elapsed): void

This method is called once every update cycle.

Parameters

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

Returns

void

Defined in

src/sdk/components/map/MapComponent.ts:254


onWake

onWake(): void

This method is called when the map is awakened.

Returns

void

Defined in

src/sdk/components/map/MapComponent.ts:153


render

render(): null | VNode

Renders the component.

Returns

null | VNode

A JSX element to be rendered.

Inherited from

DisplayComponent.render

Defined in

src/sdk/components/FSComponent.ts:93


sleep

sleep(): void

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

Returns

void

Defined in

src/sdk/components/map/MapComponent.ts:89


sleepLayers

sleepLayers(): void

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

Returns

void

Defined in

src/sdk/components/map/MapComponent.ts:177


update

update(time): void

Updates this map.

Parameters

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

Returns

void

Defined in

src/sdk/components/map/MapComponent.ts:240


updateLayers

updateLayers(time, elapsed): void

Updates this map's attached layers.

Parameters

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

Returns

void

Defined in

src/sdk/components/map/MapComponent.ts:264


wake

wake(): void

Wakes this map, allowing it to be updated.

Returns

void

Defined in

src/sdk/components/map/MapComponent.ts:96


wakeLayers

wakeLayers(): void

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

Returns

void

Defined in

src/sdk/components/map/MapComponent.ts:160