Class: StyleService

StyleService

Domain service for managing map styles and layers with event-driven notifications.

new StyleService()

MapboxViewer/domain/services/StyleService.ts, line 6

Methods

asyncaddIcons(map, iconsMeta)

MapboxViewer/domain/services/StyleService.ts, line 64

Adds icons from metadata and emits an event on completion.

Name Type Description
map

The map instance.

iconsMeta

Optional metadata for icons to add.

addLayerSafe(map, layer)

MapboxViewer/domain/services/StyleService.ts, line 98

Adds layer safely to the map.

Name Type Description
map

The map instance.

layer

The layer configuration.

addSourceSafe(map, id, source)

MapboxViewer/domain/services/StyleService.ts, line 89

Adds source safely to the map.

Name Type Description
map

The map instance.

id

The source ID.

source

The source data.

asyncapplyLayer(map, layer)

MapboxViewer/domain/services/StyleService.ts, line 26

Applies a layer to the map with business logic validations and emits an event on success.

Name Type Description
map

The map instance to apply the layer to.

layer

The layer configuration to apply.

Throws:

Error if layer configuration is invalid.

getEventEmitter()

MapboxViewer/domain/services/StyleService.ts, line 106

Gets the event emitter for subscribing to domain events.

Returns:
The event emitter instance.

setLayerVisibility(map, layerId, visible)

MapboxViewer/domain/services/StyleService.ts, line 47

Sets layer visibility with domain rules and emits an event on change.

Name Type Description
map

The map instance.

layerId

The ID of the layer to modify.

visible

The visibility state to set.

asyncwaitForStyle(map, timeoutMs)

MapboxViewer/domain/services/StyleService.ts, line 79

Waits for style to load with optional timeout.

Name Type Description
map

The map instance.

timeoutMs

Optional timeout in milliseconds.