Skip to content

ui/map/MapDisplay

Classes

MapDisplay

Defined in: ui/map/MapDisplay.ts:31

MapDisplay - Core map functionality

Handles MapLibre GL map initialization, base map management, and map style selection. This is the foundation for the radar display, providing the canvas for aircraft and other visualizations.

Constructors

Constructor
new MapDisplay(containerId?): MapDisplay;

Defined in: ui/map/MapDisplay.ts:78

Constructor

Parameters
containerId?

string = 'map'

The ID of the HTML element to contain the map

Returns

MapDisplay

Methods

initialize()
initialize(): void;

Defined in: ui/map/MapDisplay.ts:92

Initialize the map Creates and configures the MapLibre GL map instance

Returns

void

changeMapStyle()
changeMapStyle(styleUrl): void;

Defined in: ui/map/MapDisplay.ts:305

Change the map style (delegates to MapStyleManager)

Parameters
styleUrl

string

URL of the new map style

Returns

void

setupStyleSelector()
setupStyleSelector(): void;

Defined in: ui/map/MapDisplay.ts:312

Wire the settings-modal style selector (delegates to MapStyleManager)

Returns

void

toggleProjection()
toggleProjection(): void;

Defined in: ui/map/MapDisplay.ts:322

Toggle map projection between mercator and globe

Returns

void

getProjection()
getProjection(): "mercator" | "globe";

Defined in: ui/map/MapDisplay.ts:345

Get the current projection type

Returns

"mercator" | "globe"

getMap()
getMap(): Map$1 | null;

Defined in: ui/map/MapDisplay.ts:352

Get the MapLibre GL map instance

Returns

Map$1 | null

getMapTheme()
getMapTheme(): "light" | "dark";

Defined in: ui/map/MapDisplay.ts:363

Classify the active basemap as 'light' or 'dark' so overlays (e.g. the navdata renderer) can pick a palette that reads well against it. The known dark styles are the bundled offline-dark style, Dark Matter, and the OpenFreeMap dark/fiord styles; everything else (Positron, Bright, Liberty, MapTiler, custom URLs) uses the light palette.

Returns

"light" | "dark"

isInitialized()
isInitialized(): boolean;

Defined in: ui/map/MapDisplay.ts:374

Check if map is initialized

Returns

boolean

resize()
resize(): void;

Defined in: ui/map/MapDisplay.ts:382

Resize the map Should be called when the container size changes

Returns

void

getCenter()
getCenter(): [number, number];

Defined in: ui/map/MapDisplay.ts:456

Get the map center

Returns

[number, number]

setCenter()
setCenter(
   lng, 
   lat, 
   zoom?): void;

Defined in: ui/map/MapDisplay.ts:465

Set the map center

Parameters
lng

number

lat

number

zoom?

number

Returns

void

getZoom()
getZoom(): number;

Defined in: ui/map/MapDisplay.ts:479

Get the current zoom level

Returns

number

setZoom()
setZoom(zoom): void;

Defined in: ui/map/MapDisplay.ts:487

Set the zoom level

Parameters
zoom

number

Returns

void

zoomIn()
zoomIn(): void;

Defined in: ui/map/MapDisplay.ts:495

Zoom in by one level

Returns

void

zoomOut()
zoomOut(): void;

Defined in: ui/map/MapDisplay.ts:503

Zoom out by one level

Returns

void

panTo()
panTo(lat, lon): void;

Defined in: ui/map/MapDisplay.ts:511

Pan to a specific location (animated)

Parameters
lat

number

lon

number

Returns

void

getCurrentBounds()
getCurrentBounds(): number[] | null;

Defined in: ui/map/MapDisplay.ts:520

Get current map bounds Returns [west, south, east, north] for MCRE commands

Returns

number[] | null

fitBounds()
fitBounds(bounds, options?): void;

Defined in: ui/map/MapDisplay.ts:533

Fit the map to bounds

Parameters
bounds

[[number, number], [number, number]]

options?

FitBoundsOptions

Returns

void

onStyleChange()
onStyleChange(callback): void;

Defined in: ui/map/MapDisplay.ts:542

Set a callback to be invoked when the map style changes

Parameters
callback

() => void

Function to call when style loads

Returns

void

onBeforeStyleChange()
onBeforeStyleChange(callback): void;

Defined in: ui/map/MapDisplay.ts:552

Set a callback to be invoked right before every style swap starts (map.setStyle is about to be called), so listeners can tear down layers they attached to the outgoing style's sources first.

Parameters
callback

() => void

Function to call before the style change

Returns

void

setMapLoadCallback()
setMapLoadCallback(callback): void;

Defined in: ui/map/MapDisplay.ts:560

Set a callback to be invoked when the map finishes loading

Parameters
callback

() => void

Function to call when map loads

Returns

void

destroy()
destroy(): void;

Defined in: ui/map/MapDisplay.ts:572

Destroy the map and clean up resources

Returns

void