Class: StyleApplier

StyleApplier

Utility class for applying styles and managing layers/sources in Mapbox maps.

new StyleApplier()

MapboxViewer/infrastructure/adapters/mapbox/StyleApplier.ts, line 5

Methods

asyncaddIconsFromMeta(map, iconsMeta)

MapboxViewer/infrastructure/adapters/mapbox/StyleApplier.ts, line 65

Adds icons from metadata to the map.

Name Type Description
map

The Mapbox map.

iconsMeta

Icons metadata.

addLayerSafe(map, layer)

MapboxViewer/infrastructure/adapters/mapbox/StyleApplier.ts, line 44

Adds a layer to the map if it doesn't exist.

Name Type Description
map

The Mapbox map.

layer

Layer configuration.

addSourceSafe(map, id, source)

MapboxViewer/infrastructure/adapters/mapbox/StyleApplier.ts, line 34

Adds a source to the map if it doesn't exist.

Name Type Description
map

The Mapbox map.

id

Source ID.

source

Source data.

setVisibility(map, layerId, visible)

MapboxViewer/infrastructure/adapters/mapbox/StyleApplier.ts, line 55

Sets the visibility of a layer.

Name Type Description
map

The Mapbox map.

layerId

Layer ID.

visible

Visibility flag.

waitForStyle(map, timeoutMs)

MapboxViewer/infrastructure/adapters/mapbox/StyleApplier.ts, line 17

Waits for the map style to load.

Name Type Default Description
map

The Mapbox map instance.

timeoutMs 20000

Timeout in milliseconds.

Returns:
Promise that resolves when style is loaded.