@panoramax/web-viewer 3.2.3-develop-eb68a0ea → 3.2.3-develop-e277ccb9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,13 +42,13 @@ Component properties.
42
42
 
43
43
  | Name | Type | Default | Description |
44
44
  | --- | --- | --- | --- |
45
+ | endpoint | <code>string</code> | | URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md)) |
45
46
  | [picture] | <code>string</code> | | The picture ID to display |
46
47
  | [sequence] | <code>string</code> | | The sequence ID of the picture displayed |
47
48
  | [fetchOptions] | <code>object</code> | | Set custom options for fetch calls made against API ([same syntax as fetch options parameter](https://developer.mozilla.org/en-US/docs/Web/API/fetch#parameters)) |
48
49
  | [users] | <code>Array.&lt;string&gt;</code> | <code>[geovisio]</code> | List of users IDs to use for map display (defaults to general map, identified as "geovisio") |
49
50
  | [mapstyle] | <code>string</code> \| <code>object</code> | | The map's MapLibre style. This can be an a JSON object conforming to the schema described in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/), or a URL string pointing to one. Defaults to OSM vector tiles. |
50
51
  | [lang] | <code>string</code> | | To override language used for labels. Defaults to using user's preferred languages. |
51
- | endpoint | <code>string</code> | | URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md)) |
52
52
 
53
53
  <a name="Panoramax.components.core.Basic+onceReady"></a>
54
54
 
@@ -16,7 +16,7 @@
16
16
 
17
17
  * [.CoverageMap](#Panoramax.components.core.CoverageMap) ⇐ [<code>Basic</code>](Basic.md/#Panoramax.components.core.Basic)
18
18
  * [new CoverageMap()](#new_Panoramax.components.core.CoverageMap_new)
19
- * [.properties](Basic.md/#Panoramax.components.core.Basic+properties) : <code>Object</code>
19
+ * [.properties](#Panoramax.components.core.CoverageMap+properties) : <code>Object</code>
20
20
  * [.onceReady()](Basic.md/#Panoramax.components.core.Basic+onceReady) ⇒ <code>Promise</code>
21
21
  * [.onceAPIReady()](Basic.md/#Panoramax.components.core.Basic+onceAPIReady) ⇒ <code>Promise</code>
22
22
  * [.getClassName()](Basic.md/#Panoramax.components.core.Basic+getClassName) ⇒ <code>string</code>
@@ -37,25 +37,29 @@ Coverage Map is a basic map showing Panoramax coverage.
37
37
  ```html
38
38
  <pnx-coverage-map
39
39
  endpoint="https://panoramax.openstreetmap.fr/"
40
+ map='{"bounds": [[-73.9876, 40.7661], [-73.9397, 40.8002]]}'
40
41
  />
41
42
  ```
42
- <a name="Panoramax.components.core.Basic+properties"></a>
43
+ <a name="Panoramax.components.core.CoverageMap+properties"></a>
43
44
 
44
45
  ### coverageMap.properties : <code>Object</code>
45
46
  Component properties.
46
47
 
47
- **Kind**: instance mixin of [<code>CoverageMap</code>](#Panoramax.components.core.CoverageMap)
48
+ **Kind**: instance property of [<code>CoverageMap</code>](#Panoramax.components.core.CoverageMap)
49
+ **Mixes**: [<code>properties</code>](Basic.md/#Panoramax.components.core.Basic+properties)
50
+ **Overrides**: [<code>properties</code>](Basic.md/#Panoramax.components.core.Basic+properties)
48
51
  **Properties**
49
52
 
50
53
  | Name | Type | Default | Description |
51
54
  | --- | --- | --- | --- |
55
+ | endpoint | <code>string</code> | | URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md)) |
52
56
  | [picture] | <code>string</code> | | The picture ID to display |
53
57
  | [sequence] | <code>string</code> | | The sequence ID of the picture displayed |
54
58
  | [fetchOptions] | <code>object</code> | | Set custom options for fetch calls made against API ([same syntax as fetch options parameter](https://developer.mozilla.org/en-US/docs/Web/API/fetch#parameters)) |
55
59
  | [users] | <code>Array.&lt;string&gt;</code> | <code>[geovisio]</code> | List of users IDs to use for map display (defaults to general map, identified as "geovisio") |
56
60
  | [mapstyle] | <code>string</code> \| <code>object</code> | | The map's MapLibre style. This can be an a JSON object conforming to the schema described in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/), or a URL string pointing to one. Defaults to OSM vector tiles. |
57
61
  | [lang] | <code>string</code> | | To override language used for labels. Defaults to using user's preferred languages. |
58
- | endpoint | <code>string</code> | | URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md)) |
62
+ | [map] | <code>object</code> | | [Any map option available in Map class](../ui/Map.md/#Panoramax.components.ui.Map).<br />Example: `map='{"bounds": [[-73.9876, 40.7661], [-73.9397, 40.8002]]}'` |
59
63
 
60
64
  <a name="Panoramax.components.core.Basic+onceReady"></a>
61
65
 
@@ -54,13 +54,13 @@ Component properties. All of [Basic properties](Basic.md/#Panoramax.components.c
54
54
 
55
55
  | Name | Type | Default | Description |
56
56
  | --- | --- | --- | --- |
57
+ | endpoint | <code>string</code> | | URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md)) |
57
58
  | [picture] | <code>string</code> | | The picture ID to display |
58
59
  | [sequence] | <code>string</code> | | The sequence ID of the picture displayed |
59
60
  | [fetchOptions] | <code>object</code> | | Set custom options for fetch calls made against API ([same syntax as fetch options parameter](https://developer.mozilla.org/en-US/docs/Web/API/fetch#parameters)) |
60
61
  | [users] | <code>Array.&lt;string&gt;</code> | <code>[geovisio]</code> | List of users IDs to use for map display (defaults to general map, identified as "geovisio") |
61
62
  | [mapstyle] | <code>string</code> \| <code>object</code> | | The map's MapLibre style. This can be an a JSON object conforming to the schema described in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/), or a URL string pointing to one. Defaults to OSM vector tiles. |
62
63
  | [lang] | <code>string</code> | | To override language used for labels. Defaults to using user's preferred languages. |
63
- | endpoint | <code>string</code> | | URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md)) |
64
64
  | [raster] | <code>object</code> | | The MapLibre raster source for aerial background. This must be a JSON object following [MapLibre raster source definition](https://maplibre.org/maplibre-style-spec/sources/#raster). |
65
65
  | [background] | <code>string</code> | <code>&quot;streets&quot;</code> | Choose default map background to display (streets or aerial, if raster aerial background available). Defaults to street. |
66
66
 
@@ -98,6 +98,7 @@ Component properties. All of [Basic properties](Basic.md/#Panoramax.components.c
98
98
 
99
99
  | Name | Type | Default | Description |
100
100
  | --- | --- | --- | --- |
101
+ | endpoint | <code>string</code> | | URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md)) |
101
102
  | [map] | <code>boolean</code> \| <code>object</code> | <code>true</code> | Should map be used (true/false), or an object with [any map option available in Map or MapMore class](../ui/MapMore.md/#Panoramax.components.ui.MapMore).<br />Example: `map="{'background': 'aerial', 'theme': 'age'}"` |
102
103
  | [psv] | <code>object</code> | | [Any option to pass to Photo component](../ui/Photo.md/#Panoramax.components.ui.Photo) as an object.<br />Example: `psv="{'transitionDuration': 500, 'picturesNavigation': 'pic'}"` |
103
104
  | [url-parameters] | <code>string</code> | <code>true</code> | Should the component add and update URL query parameters to save viewer state ? |
@@ -110,7 +111,6 @@ Component properties. All of [Basic properties](Basic.md/#Panoramax.components.c
110
111
  | [users] | <code>Array.&lt;string&gt;</code> | <code>[geovisio]</code> | List of users IDs to use for map display (defaults to general map, identified as "geovisio") |
111
112
  | [mapstyle] | <code>string</code> \| <code>object</code> | | The map's MapLibre style. This can be an a JSON object conforming to the schema described in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/), or a URL string pointing to one. Defaults to OSM vector tiles. |
112
113
  | [lang] | <code>string</code> | | To override language used for labels. Defaults to using user's preferred languages. |
113
- | endpoint | <code>string</code> | | URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md)) |
114
114
 
115
115
  <a name="Panoramax.components.core.Viewer+onceReady"></a>
116
116
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panoramax/web-viewer",
3
- "version": "3.2.3-develop-eb68a0ea",
3
+ "version": "3.2.3-develop-e277ccb9",
4
4
  "description": "Panoramax web viewer for geolocated pictures",
5
5
  "main": "build/index.js",
6
6
  "author": "Panoramax team",
@@ -33,13 +33,13 @@ export default class Basic extends LitElement {
33
33
  * @memberof Panoramax.components.core.Basic#
34
34
  * @type {Object}
35
35
  * @mixin
36
+ * @property {string} endpoint URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md))
36
37
  * @property {string} [picture] The picture ID to display
37
38
  * @property {string} [sequence] The sequence ID of the picture displayed
38
39
  * @property {object} [fetchOptions] Set custom options for fetch calls made against API ([same syntax as fetch options parameter](https://developer.mozilla.org/en-US/docs/Web/API/fetch#parameters))
39
40
  * @property {string[]} [users=[geovisio]] List of users IDs to use for map display (defaults to general map, identified as "geovisio")
40
41
  * @property {string|object} [mapstyle] The map's MapLibre style. This can be an a JSON object conforming to the schema described in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/), or a URL string pointing to one. Defaults to OSM vector tiles.
41
42
  * @property {string} [lang] To override language used for labels. Defaults to using user's preferred languages.
42
- * @property {string} endpoint URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md))
43
43
  */
44
44
  static properties = {
45
45
  picture: {type: String, reflect: true},
@@ -3,6 +3,7 @@ import Map from "../ui/Map";
3
3
  import { getUserLayerId } from "../../utils/map";
4
4
  import { NavigationControl } from "!maplibre-gl"; // DO NOT REMOVE THE "!": bundled builds breaks otherwise !!!
5
5
  import "./CoverageMap.css";
6
+ import { default as InitParameters, alterMapState } from "../../utils/InitParameters";
6
7
 
7
8
 
8
9
  /**
@@ -20,16 +21,37 @@ import "./CoverageMap.css";
20
21
  * ```html
21
22
  * <pnx-coverage-map
22
23
  * endpoint="https://panoramax.openstreetmap.fr/"
24
+ * map='{"bounds": [[-73.9876, 40.7661], [-73.9397, 40.8002]]}'
23
25
  * />
24
26
  * ```
25
27
  */
26
28
  export default class CoverageMap extends Basic {
29
+ /**
30
+ * Component properties.
31
+ * @memberof Panoramax.components.core.CoverageMap#
32
+ * @type {Object}
33
+ * @mixes Panoramax.components.core.Basic#properties
34
+ * @property {string} endpoint URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md))
35
+ * @property {string} [picture] The picture ID to display
36
+ * @property {string} [sequence] The sequence ID of the picture displayed
37
+ * @property {object} [fetchOptions] Set custom options for fetch calls made against API ([same syntax as fetch options parameter](https://developer.mozilla.org/en-US/docs/Web/API/fetch#parameters))
38
+ * @property {string[]} [users=[geovisio]] List of users IDs to use for map display (defaults to general map, identified as "geovisio")
39
+ * @property {string|object} [mapstyle] The map's MapLibre style. This can be an a JSON object conforming to the schema described in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/), or a URL string pointing to one. Defaults to OSM vector tiles.
40
+ * @property {string} [lang] To override language used for labels. Defaults to using user's preferred languages.
41
+ * @property {object} [map] [Any map option available in Map class](#Panoramax.components.ui.Map).<br />Example: `map='{"bounds": [[-73.9876, 40.7661], [-73.9397, 40.8002]]}'`
42
+ */
43
+ static properties = {
44
+ map: {type: Object},
45
+ ...Basic.properties
46
+ };
47
+
27
48
  constructor() {
28
49
  super();
29
50
 
30
51
  this._mapContainer = document.createElement("div");
31
52
  this.onceAPIReady().then(() => {
32
53
  this.loader.setAttribute("value", 30);
54
+ this._initParams = new InitParameters(InitParameters.GetComponentProperties(CoverageMap, this));
33
55
  this._initMap();
34
56
  });
35
57
 
@@ -60,8 +82,6 @@ export default class CoverageMap extends Basic {
60
82
  * @private
61
83
  */
62
84
  _initMap() {
63
- const mapOptions = { hash: true };
64
-
65
85
  // Override to avoid display of pictures symbols
66
86
  class MyMap extends Map {
67
87
  _getLayerStyleProperties(layer) {
@@ -74,10 +94,11 @@ export default class CoverageMap extends Basic {
74
94
  }
75
95
  }
76
96
 
77
- this.map = new MyMap(this, this._mapContainer, mapOptions);
97
+ this.map = new MyMap(this, this._mapContainer, Object.assign({}, this._initParams.getMapInit(), { hash: true }));
78
98
  this.map.addControl(new NavigationControl({ showCompass: false }));
79
99
  this.loader.setAttribute("value", 70);
80
100
  this.map.waitForEnoughMapLoaded().then(() => {
101
+ alterMapState(this.map, this._initParams.getMapPostInit());
81
102
  this.map.reloadLayersStyles();
82
103
  this.loader.dismiss();
83
104
  });
@@ -40,13 +40,13 @@ export default class Editor extends Basic {
40
40
  * @memberof Panoramax.components.core.Editor#
41
41
  * @mixes Panoramax.components.core.Basic#properties
42
42
  * @type {Object}
43
+ * @property {string} endpoint URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md))
43
44
  * @property {string} [picture] The picture ID to display
44
45
  * @property {string} [sequence] The sequence ID of the picture displayed
45
46
  * @property {object} [fetchOptions] Set custom options for fetch calls made against API ([same syntax as fetch options parameter](https://developer.mozilla.org/en-US/docs/Web/API/fetch#parameters))
46
47
  * @property {string[]} [users=[geovisio]] List of users IDs to use for map display (defaults to general map, identified as "geovisio")
47
48
  * @property {string|object} [mapstyle] The map's MapLibre style. This can be an a JSON object conforming to the schema described in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/), or a URL string pointing to one. Defaults to OSM vector tiles.
48
49
  * @property {string} [lang] To override language used for labels. Defaults to using user's preferred languages.
49
- * @property {string} endpoint URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md))
50
50
  * @property {object} [raster] The MapLibre raster source for aerial background. This must be a JSON object following [MapLibre raster source definition](https://maplibre.org/maplibre-style-spec/sources/#raster).
51
51
  * @property {string} [background=streets] Choose default map background to display (streets or aerial, if raster aerial background available). Defaults to street.
52
52
  */
@@ -83,6 +83,7 @@ export default class Viewer extends Basic {
83
83
  * @memberof Panoramax.components.core.Viewer#
84
84
  * @mixes Panoramax.components.core.Basic#properties
85
85
  * @type {Object}
86
+ * @property {string} endpoint URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md))
86
87
  * @property {boolean|object} [map=true] Should map be used (true/false), or an object with [any map option available in Map or MapMore class](#Panoramax.components.ui.MapMore).<br />Example: `map="{'background': 'aerial', 'theme': 'age'}"`
87
88
  * @property {object} [psv] [Any option to pass to Photo component](#Panoramax.components.ui.Photo) as an object.<br />Example: `psv="{'transitionDuration': 500, 'picturesNavigation': 'pic'}"`
88
89
  * @property {string} [url-parameters=true] Should the component add and update URL query parameters to save viewer state ?
@@ -95,7 +96,6 @@ export default class Viewer extends Basic {
95
96
  * @property {string[]} [users=[geovisio]] List of users IDs to use for map display (defaults to general map, identified as "geovisio")
96
97
  * @property {string|object} [mapstyle] The map's MapLibre style. This can be an a JSON object conforming to the schema described in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/), or a URL string pointing to one. Defaults to OSM vector tiles.
97
98
  * @property {string} [lang] To override language used for labels. Defaults to using user's preferred languages.
98
- * @property {string} endpoint URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md))
99
99
  */
100
100
  static properties = {
101
101
  map: {type: Object},
@@ -17,22 +17,6 @@ import * as pmtiles from "pmtiles";
17
17
  maplibregl.workerClass = maplibreglWorker;
18
18
  maplibregl.addProtocol("pmtiles", new pmtiles.Protocol().tile);
19
19
 
20
- // No "style" option as it's handled by combineStyles function
21
- // and no "attributionControl" as its handled manually
22
- const MAPLIBRE_OPTIONS = [
23
- "antialias", "bearing", "bearingSnap", "bounds",
24
- "boxZoom", "center", "clickTolerance", "collectResourceTiming",
25
- "cooperativeGestures", "crossSourceCollisions", "doubleClickZoom", "dragPan",
26
- "dragRotate", "fadeDuration", "failIfMajorPerformanceCaveat", "fitBoundsOptions",
27
- "hash", "interactive", "keyboard", "localIdeographFontFamily", "locale", "logoPosition",
28
- "maplibreLogo", "maxBounds", "maxCanvasSize", "maxPitch", "maxTileCacheSize",
29
- "maxTileCacheZoomLevels", "maxZoom", "minPitch", "minZoom", "pitch", "pitchWithRotate",
30
- "pixelRatio", "preserveDrawingBuffer", "refreshExpiredTiles", "renderWorldCopies",
31
- "scrollZoom", "touchPitch", "touchZoomRotate", "trackResize",
32
- "transformCameraUpdate", "transformRequest", "validateStyle", "zoom"
33
- ];
34
- const filterMapLibreOptions = opts => Object.fromEntries(Object.entries(opts).filter(([key]) => MAPLIBRE_OPTIONS.includes(key)));
35
-
36
20
 
37
21
  /**
38
22
  * Map is the component showing pictures and sequences geolocation.
@@ -80,7 +64,7 @@ export default class Map extends maplibregl.Map {
80
64
  transformRequest: parent.api._getMapRequestTransform(),
81
65
  locale: parent._t.maplibre,
82
66
  hash: false,
83
- ...filterMapLibreOptions(options)
67
+ ...options
84
68
  });
85
69
  this._loadMarkerImages();
86
70
 
@@ -10,6 +10,24 @@ export const MAP_FILTERS_JS2URL = {
10
10
  const MAP_FILTERS_URL2JS = Object.fromEntries(Object.entries(MAP_FILTERS_JS2URL).map(v => [v[1], v[0]]));
11
11
  const MAP_NONE = ["none", "null", "false", false];
12
12
 
13
+ const MAPLIBRE_OPTIONS = [
14
+ "antialias", "bearing", "bearingSnap", "bounds",
15
+ "boxZoom", "clickTolerance", "collectResourceTiming",
16
+ "cooperativeGestures", "crossSourceCollisions", "doubleClickZoom", "dragPan",
17
+ "dragRotate", "fadeDuration", "failIfMajorPerformanceCaveat", "fitBoundsOptions",
18
+ "hash", "interactive", "keyboard", "localIdeographFontFamily", "locale", "logoPosition",
19
+ "maplibreLogo", "maxBounds", "maxCanvasSize", "maxPitch", "maxTileCacheSize",
20
+ "maxTileCacheZoomLevels", "maxZoom", "minPitch", "minZoom", "pitch", "pitchWithRotate",
21
+ "pixelRatio", "preserveDrawingBuffer", "refreshExpiredTiles", "renderWorldCopies",
22
+ "scrollZoom", "touchPitch", "touchZoomRotate", "trackResize",
23
+ "transformCameraUpdate", "transformRequest", "validateStyle"
24
+ ];
25
+
26
+ function filterMapLibreOptions(opts) {
27
+ return Object.fromEntries(Object.entries(opts).filter(([key]) => MAPLIBRE_OPTIONS.includes(key)));
28
+ }
29
+
30
+
13
31
  /**
14
32
  * Merges all URL parameters and component attributes into a single set of coherent settings.
15
33
  *
@@ -61,6 +79,7 @@ export default class InitParameters { // eslint-disable-line import/no-unused-mo
61
79
  let endpoint = componentAttrs.endpoint;
62
80
  let map_raster = componentMap.raster;
63
81
  let map_attribution = componentMap.attributionControl;
82
+ let map_others = filterMapLibreOptions(componentMap);
64
83
 
65
84
  // - URL only
66
85
  let psv_xyz = urlParams.xyz;
@@ -102,7 +121,11 @@ export default class InitParameters { // eslint-disable-line import/no-unused-mo
102
121
  };
103
122
  this._psvPostInit = { xyz: psv_xyz };
104
123
 
105
- this._mapInit = { raster: map_raster, attributionControl: map_attribution };
124
+ this._mapInit = {
125
+ raster: map_raster,
126
+ attributionControl: map_attribution,
127
+ ...map_others
128
+ };
106
129
  this._mapAny = {
107
130
  theme: map_theme,
108
131
  background: map_background,
@@ -311,7 +334,7 @@ export function alterMapState(map, params) {
311
334
  map.setVisibleUsers(vu);
312
335
 
313
336
  // Change map filters
314
- map.setFilters(paramsToMapFilters(params));
337
+ map.setFilters?.(paramsToMapFilters(params));
315
338
 
316
339
  // Change map background
317
340
  if(["aerial", "streets"].includes(params.background)) {