Skip to content

MapStyleComposer

Panoramax.utils.MapStyleComposer

Kind: static class of Panoramax.utils
Emits: basemap-added, basemap-changed, dataunderlay-added, dataunderlay-changed, panoramax-added, panoramax-changed, theme-changed, filters-changed, dataoverlay-added, dataoverlay-changed
Properties

Name Type Description
basemap string The selected basemap
dataUnderlays Set The visible data underlays
panoramax string The selected Panoramax endpoint
dataOverlays Set The visible data overlays

new MapStyleComposer(parent)

Map Style Composer allows an easy management of MapLibre styles. As Panoramax Viewer composes with many sources and layers, it's helpful. There are several "Layer Ranges" (from bottom to top): - Basemap: contextual background, either raster of vector - Data Underlay: vector data below Panoramax data (indoor maps) - Panoramax: pictures, sequences, grid statistics - Data Overlay: vector data on top of Panoramax data (traffic signs...) The composer offers helpers to switch between any layer in a specific range.

Param Type Description
parent Panoramax.components.core.basic The parent view

Example

const msc = new Panoramax.utils.MapStyleComposer(viewer)

mapStyleComposer.getMapStyle() ⇒ object

Gives MapLibre JSON style to pass to Map constructor or setStyle function. This gives ready-to-use sources and layers.

Kind: instance method of MapStyleComposer
Returns: object - The MapLibre style object

mapStyleComposer.updateMapStyle([reloadSem])

Throttled function to force map data refresh. This allows to make actual effect of layers adds/switches.

Kind: instance method of MapStyleComposer

Param Type Default Description
[reloadSem] boolean false Force reload of semantics layers (in case of API switch)

mapStyleComposer.registerSource(id, source)

Checks if given source already exists in composer, or add it as detached to wait. This is useful for sources added directly to MapLibre not through the MapStyleComposer.

Kind: instance method of MapStyleComposer

Param Type Description
id string The source ID
source object The MapLibre source definition

mapStyleComposer.registerLayer(layer, [beforeId])

Checks if given layer already exists in composer, or add it as data under/overlay. This is useful for layers added directly to MapLibre not through the MapStyleComposer.

Kind: instance method of MapStyleComposer

Param Type Description
layer object The MapLibre layer definition
[beforeId] string The ID of an existing layer to put this one before

mapStyleComposer.waitFor(type, id) ⇒ Promise

Wait for some layer to be available

Kind: instance method of MapStyleComposer
Returns: Promise - Resolves when layer is ready

Param Type Description
type string The kind of layer (panoramax, dataOverlays, dataUnderlays, basemaps)
id string The ID of layer to wait for

mapStyleComposer.addBasemap(id, style, [switchOn])

Creates a new basemap

Kind: instance method of MapStyleComposer

Param Type Default Description
id string Identifier for this basemap
style object The MapLibre-like style definition (object with sources and layers)
[switchOn] boolean false Immediate map display ?

mapStyleComposer.switchBasemap(id)

Makes this basemap now visible, instead of current one.

Kind: instance method of MapStyleComposer

Param Type Description
id string The basemap ID

mapStyleComposer.hasManyBasemaps() ⇒ boolean

Does this style contain many different basemaps ?

Kind: instance method of MapStyleComposer
Returns: boolean - True if 2 or more basemaps are available

mapStyleComposer.addDataUnderlay(id, style, [switchOn])

Creates a new data underlay

Kind: instance method of MapStyleComposer

Param Type Default Description
id string Identifier for this basemap
style object The MapLibre-like style definition (object with sources and layers)
[switchOn] boolean false Immediate map display ?

mapStyleComposer.switchDataUnderlayVisibility(id, visible)

Change visibility of a given data underlay.

Kind: instance method of MapStyleComposer

Param Type Description
id string The Identifier of data underlay to change
visible boolean Set to true to make visible, false to hide

mapStyleComposer.addPanoramaxEndpoint(id, style, [switchOn])

Creates a new Panoramax Vector Tile endpoint.

Kind: instance method of MapStyleComposer

Param Type Default Description
id string The identifier for this endpoint
style object The MapLibre Style JSON object
[switchOn] boolean false Immediate map display ?

mapStyleComposer.switchPanoramaxEndpoint(id)

Uses this Panoramax Vector Tile endpoint instead of current one.

Kind: instance method of MapStyleComposer

Param Type Description
id string The endpoint ID

mapStyleComposer.isPanoramaxEndpointSingleUser() ⇒ boolean

Is the currently selected Panoramax endpoint showing data of a single user ?

Kind: instance method of MapStyleComposer
Returns: boolean - True if single user

mapStyleComposer.setPanoramaxTheme(theme)

Changes the selected Panoramax map theme

Kind: instance method of MapStyleComposer

Param Type Description
theme string One of "default", "age", "type", "score", "gps"

mapStyleComposer.setPanoramaxFilters(filters)

Changes the selected Panoramax filters

Kind: instance method of MapStyleComposer

Param Type Description
filters object Filtering values
[filters.minDate] string Start date for pictures (format YYYY-MM-DD)
[filters.maxDate] string End date for pictures (format YYYY-MM-DD)
[filters.pic_type] string Type of picture to keep (flat, equirectangular)
[filters.qualityscore] Array.<number> QualityScore values, as a list of 1 to 5 grades
[filters.gps] Array.<number> GPS precision grades, as a list of 1 to 5 grades
[filters.featuresRestrictions] object Rules to restrict display of pictures & sequences

mapStyleComposer.addDataOverlay(id, style, [switchOn])

Creates a new data overlay

Kind: instance method of MapStyleComposer

Param Type Default Description
id string Identifier for this basemap
style object The MapLibre-like style definition (object with sources and layers)
[switchOn] boolean false Immediate map display ?

mapStyleComposer.switchDataOverlayVisibility(id, visible)

Change visibility of a given data Overlay.

Kind: instance method of MapStyleComposer

Param Type Description
id string The Identifier of data Overlay to change
visible boolean Set to true to make visible, false to hide

"basemap-added"

Event for basemap added

Kind: event emitted by MapStyleComposer
Properties

Name Type Description
[detail.basemap] string The added basemap ID

"basemap-changed"

Event for basemap changes

Kind: event emitted by MapStyleComposer
Properties

Name Type Description
[detail.basemap] string The basemap ID

"dataunderlay-added"

Event for data underlay added

Kind: event emitted by MapStyleComposer
Properties

Name Type Description
[detail.dataUnderlay] string The added data underlay ID

"dataunderlay-changed"

Event for data underlays changes

Kind: event emitted by MapStyleComposer
Properties

Name Type Description
[detail.dataUnderlay] string The data underlay ID
[detail.visible] boolean True if visible

"panoramax-added"

Event for Panoramax endpoint added

Kind: event emitted by MapStyleComposer
Properties

Name Type Description
[detail.endpoint] string The added Panoramax endpoint ID

"panoramax-changed"

Event for Panoramax endpoint changes

Kind: event emitted by MapStyleComposer
Properties

Name Type Description
[detail.endpoint] string The new selected Panoramax endpoint

"theme-changed"

Event for Panoramax theme changes

Kind: event emitted by MapStyleComposer
Properties

Name Type Description
[detail.theme] string The new selected theme

"filters-changed"

Event for Panoramax filters changes

Kind: event emitted by MapStyleComposer
Properties

Name Type Description
[detail.minDate] string The minimum date in time range (ISO format)
[detail.maxDate] string The maximum date in time range (ISO format)
[detail.pic_type] string Camera type (equirectangular, flat, null/empty string for both)
[detail.qualityscore] Array.<number> QualityScore values, as a list of 1 to 5 grades
[detail.gps] Array.<number> GPS precision grades, as a list of 1 to 5 grades
[detail.featuresRestrictions] object Rules to restrict display of pictures & sequences

"dataoverlay-added"

Event for data overlay added

Kind: event emitted by MapStyleComposer
Properties

Name Type Description
[detail.dataOverlay] string The added data overlay ID

"dataoverlay-changed"

Event for data overlays changes

Kind: event emitted by MapStyleComposer
Properties

Name Type Description
[detail.dataOverlay] string The data overlay ID
[detail.visible] boolean True if visible