Skip to content

Map

Panoramax.components.ui.Map ⇐ maplibregl.Map

Kind: static class of Panoramax.components.ui
Extends: maplibregl.Map
Emits: background-changed, users-changed, sequence-hover, sequence-click, picture-click, ready

new Map(parent, container, [options])

Map is the component showing pictures and sequences geolocation.

Note that all functions of MapLibre GL JS class Map are also available.

A more complete version of Map (with filters & themes) is available through MapMore class

⚠️ This class doesn't inherit from EventTarget, so it doesn't have addEventListener and dispatchEvent functions. It uses instead on and fire functions from MapLibre Map class. fire function doesn't take directly Event objects, but a string and object data. A shorthand addEventListener function is added for simpler usage.

Param Type Default Description
parent Basic The parent view
container Element The DOM element to create into
[options] object The map options (any of MapLibre GL settings or any supplementary option defined here)
[options.raster] object The MapLibre raster source for aerial background. This must be a JSON object following MapLibre raster source definition.
[options.background] string "streets" Choose default map background to display (streets or aerial, if raster aerial background available). Defaults to street.
[options.attributionControl.customAttribution] string To override default map attribution.

Example

const map = new Panoramax.components.ui.Map(viewer, mapNode, {center: {lat: 48.7, lng: -1.7}});

map.destroy()

Destroy any form of life in this component

Kind: instance method of Map

map.waitForEnoughMapLoaded() ⇒ Promise

Helper to know when enough map background and Panoramax tiles are loaded for a proper display.

Kind: instance method of Map
Returns: Promise - Resolves when enough is loaded

map.reloadVectorTiles()

Force refresh of vector tiles data

Kind: instance method of Map

map.hasTwoBackgrounds() ⇒ boolean

Check if map offers aerial imagery as well as streets rendering.

Kind: instance method of Map
Returns: boolean - True if aerial imagery is available for display

map.getBackground() ⇒ string

Get the currently selected map background

Kind: instance method of Map
Returns: string - aerial or streets

map.setBackground(bg)

Change the shown background in map.

Kind: instance method of Map
Throws:

  • Error If not aerial imagery is available
Param Type Description
bg string The new background to display (aerial or streets)

map.getVisibleUsers() ⇒ Array.<string>

Get the currently visible users

Kind: instance method of Map
Returns: Array.<string> - List of visible users

map.setVisibleUsers(visibleIds)

Make given user layers visible on map, and hide all others (if any)

Kind: instance method of Map

Param Type Description
visibleIds string | Array.<string> The user layers IDs to display

map.filterUserLayersContent(dataType, filter)

Filter the visible data content in all visible map layers

Kind: instance method of Map

Param Type Description
dataType string sequences or pictures
filter object The MapLibre GL filter rule to apply

map.displayPictureMarker(lon, lat, heading, [skipCenter])

Shows on map a picture position and heading.

Kind: instance method of Map

Param Type Default Description
lon number The longitude
lat number The latitude
heading number The heading
[skipCenter] boolean false Set to true to avoid map centering on marker

map.reloadLayersStyles()

Forces reload of pictures/sequences layer styles. This is useful after a map theme change.

Kind: instance method of Map

map.addEventListener(type, listener)

Listen to map events. This is a binder to on and once MapLibre GL functions.

Kind: instance method of Map

Param Type Default Description
type string The event type to listen for
listener function The event handler
[options.once] boolean false Set to true to only listen to first event.

"ready"

Event when map is ready to display. This includes Maplibre initial load, enough map data display and styling.

Kind: event emitted by Map

"background-changed"

Event for map background changes

Kind: event emitted by Map
Properties

Name Type Description
[background] string The new selected background (aerial, streets)

"users-changed"

Event for visible users changes

Kind: event emitted by Map
Properties

Name Type Description
[usersIds] Array.<string> The list of newly selected users

"sequence-hover"

Event when a sequence on map is hovered (not selected)

Kind: event emitted by Map
Properties

Name Type Description
seqId string The hovered sequence ID

"sequence-click"

Event when a sequence on map is clicked

Kind: event emitted by Map
Properties

Name Type Description
seqId string The clicked sequence ID
coordinates maplibregl.LngLat The coordinates of user click

"picture-click"

Event when a picture on map is clicked

Kind: event emitted by Map
Properties

Name Type Description
picId string The clicked picture ID
seqId string The clicked picture's sequence ID
feature object The GeoJSON feature of the picture