@geogirafe/lib-geoportal 1.3.0-dev.3018313151 → 1.3.0-dev.3053452205

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.
Files changed (43) hide show
  1. package/README.md +3 -2
  2. package/api/apigeogirafeapp.js +3 -1
  3. package/assets/i18n/de.json +1 -0
  4. package/assets/i18n/en.json +1 -0
  5. package/assets/i18n/fr.json +1 -0
  6. package/assets/i18n/it.json +1 -0
  7. package/assets/icons/streetview-marker-mapillary.svg +1 -0
  8. package/components/layout/component.d.ts +5 -0
  9. package/components/map-grid/component.d.ts +4 -0
  10. package/components/map-grid/component.js +6 -0
  11. package/components/print/tools/MFPEncoder.d.ts +22 -10
  12. package/components/print/tools/MFPEncoder.js +75 -43
  13. package/components/streetview/component.d.ts +9 -2
  14. package/components/streetview/component.js +20 -8
  15. package/components/streetview/google.js +1 -1
  16. package/components/streetview/mapillary.d.ts +8 -0
  17. package/components/streetview/mapillary.js +20 -0
  18. package/components/streetview/style.css +16 -0
  19. package/components/streetview/tools/googleprovider.js +9 -2
  20. package/components/streetview/tools/mapillaryprovider.d.ts +70 -0
  21. package/components/streetview/tools/mapillaryprovider.js +150 -0
  22. package/models/layers/grouplayer.d.ts +3 -3
  23. package/models/layers/grouplayer.js +5 -48
  24. package/package.json +1 -1
  25. package/templates/iframe.html +1 -0
  26. package/templates/index.html +1 -0
  27. package/templates/mobile.html +1 -0
  28. package/templates/public/about.json +1 -1
  29. package/tools/app/geogirafeapp-mobile.js +2 -0
  30. package/tools/app/geogirafeapp.js +2 -0
  31. package/tools/configuration/girafeconfig.js +1 -8
  32. package/tools/configuration/streetviewconfig.d.ts +12 -1
  33. package/tools/configuration/streetviewconfig.js +26 -4
  34. package/tools/main.d.ts +3 -2
  35. package/tools/main.js +1 -1
  36. package/tools/state/layout.d.ts +5 -0
  37. package/tools/state/layout.js +2 -1
  38. package/tools/state/streetview.d.ts +1 -1
  39. package/tools/state/streetview.js +1 -1
  40. package/tools/tests/wmswfsmanagermocking.d.ts +2 -2
  41. package/tools/tests/wmswfsmanagermocking.js +68 -61
  42. package/tools/wms/wmsclient.d.ts +164 -26
  43. package/tools/wms/wmsclient.js +415 -233
@@ -0,0 +1,150 @@
1
+ import { getDistance } from 'ol/sphere.js';
2
+ const MAPILLARY_JS_URL = 'https://unpkg.com/mapillary-js@4.1.2/dist';
3
+ const MAPILLARY_JS_SCRIPT = {
4
+ url: `${MAPILLARY_JS_URL}/mapillary.js`,
5
+ integrity: 'sha384-1AlAxcgdzKreJ5f2K+t7SW3pEE0ek9u3lUwlZXX+v+FtEk1tWSg6DBVLb3ZKhpB+'
6
+ };
7
+ const MAPILLARY_JS_STYLESHEET = {
8
+ url: `${MAPILLARY_JS_URL}/mapillary.css`,
9
+ integrity: 'sha384-IamMZxz60pSNzUk3cW2nl3uYUdpiDoQpLJrBoAAezEE+QaOYCVA9rfi/8Cx0x15T'
10
+ };
11
+ const IMAGES_SEARCH_URL = 'https://graph.mapillary.com/images';
12
+ const MAX_SEARCHED_IMAGES = 100;
13
+ let mapillaryJsLoading = null;
14
+ /**
15
+ * Loads MapillaryJS once from the CDN, when the first Mapillary StreetView is displayed.
16
+ * The integrity of the script is checked, as it does not come from the application.
17
+ */
18
+ function loadMapillaryJs() {
19
+ mapillaryJsLoading ??= new Promise((resolve, reject) => {
20
+ const script = document.createElement('script');
21
+ script.src = MAPILLARY_JS_SCRIPT.url;
22
+ script.integrity = MAPILLARY_JS_SCRIPT.integrity;
23
+ script.crossOrigin = 'anonymous';
24
+ script.async = true;
25
+ script.addEventListener('load', () => window.mapillary ? resolve(window.mapillary) : reject(new Error('MapillaryJS is not available')));
26
+ script.addEventListener('error', () => {
27
+ // Allows the StreetView Component to try again
28
+ mapillaryJsLoading = null;
29
+ script.remove();
30
+ reject(new Error('MapillaryJS could not be loaded'));
31
+ });
32
+ document.head.appendChild(script);
33
+ });
34
+ return mapillaryJsLoading;
35
+ }
36
+ /** The stylesheet is added next to the viewer, as the global styles do not reach the Shadow DOM of the Component. */
37
+ function addMapillaryJsStylesheet(target) {
38
+ const link = document.createElement('link');
39
+ link.rel = 'stylesheet';
40
+ link.href = MAPILLARY_JS_STYLESHEET.url;
41
+ link.integrity = MAPILLARY_JS_STYLESHEET.integrity;
42
+ link.crossOrigin = 'anonymous';
43
+ target.appendChild(link);
44
+ }
45
+ /**
46
+ * The center of the viewport, in the coordinates of a 360° image (from 0 to 1, from its top-left corner),
47
+ * for a direction of sight. The center of the image is in the direction it was taken (its compass angle).
48
+ */
49
+ export function getSphericalImageCenter(pov, compassAngle) {
50
+ const x = (((0.5 + (pov.heading - compassAngle) / 360) % 1) + 1) % 1;
51
+ const y = 0.5 - pov.pitch / 180;
52
+ return [x, y];
53
+ }
54
+ /**
55
+ * The Mapillary footage, displayed by a MapillaryJS Viewer.
56
+ * This module is the only place where MapillaryJS and the Mapillary API are used. It is loaded on demand
57
+ * by the StreetView Component, so that MapillaryJS stays out of the application as long as
58
+ * no Mapillary StreetView is displayed.
59
+ * The access token is visible to the user: it must be a client token.
60
+ */
61
+ export default class MapillaryStreetViewProvider {
62
+ accessToken;
63
+ target;
64
+ viewer;
65
+ image = null;
66
+ constructor(accessToken) {
67
+ this.accessToken = accessToken;
68
+ }
69
+ async initialize(target, onFootageChanged) {
70
+ const mapillaryJs = await loadMapillaryJs();
71
+ addMapillaryJsStylesheet(target);
72
+ this.target = target;
73
+ this.setVisible(false);
74
+ // The cover asks for a click before displaying the footage: it is not needed, as the footage is chosen on the map
75
+ this.viewer = new mapillaryJs.Viewer({
76
+ accessToken: this.accessToken,
77
+ container: target,
78
+ component: { cover: false }
79
+ });
80
+ new ResizeObserver(() => this.viewer.resize()).observe(target);
81
+ const notifyFootageChanged = () => {
82
+ this.getFootage()
83
+ .then((footage) => footage && onFootageChanged(footage))
84
+ .catch((error) => console.error(error));
85
+ };
86
+ this.viewer.on('image', (event) => {
87
+ this.image = event.image;
88
+ notifyFootageChanged();
89
+ });
90
+ this.viewer.on('pov', notifyFootageChanged);
91
+ }
92
+ async getFootage() {
93
+ if (!this.image) {
94
+ return null;
95
+ }
96
+ const pov = await this.viewer.getPointOfView();
97
+ return { lonLat: [this.image.lngLat.lng, this.image.lngLat.lat], heading: pov.bearing, pitch: pov.tilt };
98
+ }
99
+ /**
100
+ * The Mapillary API returns the "best" images within the radius, not the closest one:
101
+ * the closest one is chosen among them.
102
+ */
103
+ async findClosestImageId(lonLat, radius) {
104
+ const params = new URLSearchParams({
105
+ access_token: this.accessToken,
106
+ fields: 'id,geometry,computed_geometry',
107
+ lng: String(lonLat[0]),
108
+ lat: String(lonLat[1]),
109
+ radius: String(radius),
110
+ limit: String(MAX_SEARCHED_IMAGES)
111
+ });
112
+ const response = await fetch(`${IMAGES_SEARCH_URL}?${params}`);
113
+ if (!response.ok) {
114
+ throw new Error(`The Mapillary images could not be searched (HTTP ${response.status})`);
115
+ }
116
+ const { data } = (await response.json());
117
+ let closestId = null;
118
+ let closestDistance = Infinity;
119
+ for (const image of data) {
120
+ const distance = getDistance(lonLat, (image.computed_geometry ?? image.geometry).coordinates);
121
+ if (distance < closestDistance) {
122
+ closestId = image.id;
123
+ closestDistance = distance;
124
+ }
125
+ }
126
+ return closestId;
127
+ }
128
+ /**
129
+ * The direction of sight can only be applied to 360° images:
130
+ * the other images are displayed in the direction they were taken.
131
+ */
132
+ async showClosestFootage(lonLat, radius, pov) {
133
+ const imageId = await this.findClosestImageId(lonLat, radius);
134
+ if (!imageId) {
135
+ return false;
136
+ }
137
+ const image = await this.viewer.moveTo(imageId);
138
+ this.image = image;
139
+ if (pov && image.cameraType === 'spherical') {
140
+ this.viewer.setCenter(getSphericalImageCenter(pov, image.computedCompassAngle));
141
+ }
142
+ this.setVisible(true);
143
+ return true;
144
+ }
145
+ setVisible(visible) {
146
+ if (this.target) {
147
+ this.target.style.visibility = visible && this.image !== null ? 'visible' : 'hidden';
148
+ }
149
+ }
150
+ }
@@ -28,12 +28,12 @@ declare class GroupLayer extends BaseLayer implements ILayerWithTime {
28
28
  get inactive(): boolean;
29
29
  get semiActive(): boolean;
30
30
  get hasTimeRestriction(): boolean;
31
- get hasGrandChildren(): boolean;
32
31
  isFirstLevelGroup(): boolean;
33
32
  setDefaultTimeRestriction(): void;
34
33
  /**
35
- * Checks if all the children are LayerWms with the same ogcServer, opacity
36
- * time
34
+ * This is not supposed to be used anymore.
35
+ * Now the WmsClient groups the layers itself.
36
+ * @deprecated
37
37
  */
38
38
  get isMixed(): boolean;
39
39
  }
@@ -1,7 +1,6 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  import BaseLayer from './baselayer.js';
3
3
  import LayerTimeFormatter from '../../tools/time/layertimeformatter.js';
4
- import LayerWms from './layerwms.js';
5
4
  /*
6
5
  * This class is used in the state of the application, which will be accessed behind a JavaScript proxy.
7
6
  * This means that each modification made to its properties must come from outside,
@@ -68,14 +67,6 @@ class GroupLayer extends BaseLayer {
68
67
  get hasTimeRestriction() {
69
68
  return !!this.timeRestriction;
70
69
  }
71
- get hasGrandChildren() {
72
- for (const child of this.children) {
73
- if (child.children?.length) {
74
- return true;
75
- }
76
- }
77
- return false;
78
- }
79
70
  isFirstLevelGroup() {
80
71
  return !(this.parent instanceof GroupLayer);
81
72
  }
@@ -86,47 +77,13 @@ class GroupLayer extends BaseLayer {
86
77
  }
87
78
  }
88
79
  /**
89
- * Checks if all the children are LayerWms with the same ogcServer, opacity
90
- * time
80
+ * This is not supposed to be used anymore.
81
+ * Now the WmsClient groups the layers itself.
82
+ * @deprecated
91
83
  */
92
84
  get isMixed() {
93
- // It was explicitly set to true, it can't be unmixed
94
- if (this._isMixed) {
95
- return this._isMixed;
96
- }
97
- // If any child is not a GroupLayer or LayerWms, return true immediately
98
- for (const child of this.children) {
99
- if (!(child instanceof GroupLayer) && !(child instanceof LayerWms)) {
100
- return true;
101
- }
102
- }
103
- // Collect all LayerWms children and grandchildren recursively
104
- const layerWmsList = [];
105
- function collectLayerWms(layer) {
106
- if (layer instanceof LayerWms) {
107
- layerWmsList.push(layer);
108
- }
109
- else if (layer instanceof GroupLayer) {
110
- for (const child of layer.children) {
111
- collectLayerWms(child);
112
- }
113
- }
114
- }
115
- for (const child of this.children) {
116
- collectLayerWms(child);
117
- }
118
- // Check if all LayerWms have the same properties
119
- if (layerWmsList.length > 0) {
120
- const first = layerWmsList[0];
121
- const allSame = layerWmsList.every((lw) => lw.opacity === first.opacity &&
122
- lw.ogcServer === first.ogcServer &&
123
- lw.filter === first.filter &&
124
- lw.timeRestriction === first.timeRestriction);
125
- if (allSame) {
126
- return false;
127
- }
128
- }
129
- return true;
85
+ console.error('This property must not be used.');
86
+ return !!this._isMixed;
130
87
  }
131
88
  }
132
89
  export default GroupLayer;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "name": "GeoGirafe PSC",
6
6
  "url": "https://doc.geogirafe.org"
7
7
  },
8
- "version": "1.3.0-dev.3018313151",
8
+ "version": "1.3.0-dev.3053452205",
9
9
  "type": "module",
10
10
  "engines": {
11
11
  "node": ">=20.19.0"
@@ -82,6 +82,7 @@
82
82
  <girafe-map-2d></girafe-map-2d>
83
83
  <girafe-map-3d></girafe-map-3d>
84
84
  <girafe-streetview-google></girafe-streetview-google>
85
+ <girafe-streetview-mapillary></girafe-streetview-mapillary>
85
86
  </girafe-map-grid>
86
87
  <girafe-basemap></girafe-basemap>
87
88
  <girafe-search id="search"></girafe-search>
@@ -110,6 +110,7 @@
110
110
  <girafe-map-2d></girafe-map-2d>
111
111
  <girafe-map-3d></girafe-map-3d>
112
112
  <girafe-streetview-google></girafe-streetview-google>
113
+ <girafe-streetview-mapillary></girafe-streetview-mapillary>
113
114
  </girafe-map-grid>
114
115
  <div class="info-area">
115
116
  <girafe-basemap data-tour="basemap-selection"></girafe-basemap>
@@ -97,6 +97,7 @@
97
97
  <girafe-map-2d></girafe-map-2d>
98
98
  <girafe-map-3d></girafe-map-3d>
99
99
  <girafe-streetview-google></girafe-streetview-google>
100
+ <girafe-streetview-mapillary></girafe-streetview-mapillary>
100
101
  </girafe-map-grid>
101
102
  <girafe-infobox></girafe-infobox>
102
103
  </div>
@@ -1 +1 @@
1
- {"version":"1.3.0-dev.3018313151", "build":"3018313151", "date":"02/11/2026"}
1
+ {"version":"1.3.0-dev.3053452205", "build":"3053452205", "date":"11/11/2026"}
@@ -12,6 +12,7 @@ import Map2dComponent from '../../components/map-2d/component.js';
12
12
  import DeprecatedMapComponent from '../../components/map-2d/deprecatedmapcomponent.js';
13
13
  import Map3dComponent from '../../components/map-3d/component.js';
14
14
  import GoogleStreetViewComponent from '../../components/streetview/google.js';
15
+ import MapillaryStreetViewComponent from '../../components/streetview/mapillary.js';
15
16
  import MapGridComponent from '../../components/map-grid/component.js';
16
17
  import MenuMobile3dButton from '../../components/menu-buttons-mobile/MenuMobile3dButton.js';
17
18
  import MenuMobileDrawingButton from '../../components/menu-buttons-mobile/MenuMobileDrawingButton.js';
@@ -52,6 +53,7 @@ export default class GeoGirafeAppMobile extends GeoGirafeApp {
52
53
  customElements.define('girafe-map-2d', Map2dComponent);
53
54
  customElements.define('girafe-map-3d', Map3dComponent);
54
55
  customElements.define('girafe-streetview-google', GoogleStreetViewComponent);
56
+ customElements.define('girafe-streetview-mapillary', MapillaryStreetViewComponent);
55
57
  customElements.define('girafe-map-grid', MapGridComponent);
56
58
  // Deprecated alias of <girafe-map-2d>, kept for the applications that were not migrated yet.
57
59
  customElements.define('girafe-map', DeprecatedMapComponent);
@@ -21,6 +21,7 @@ import Map2dComponent from '../../components/map-2d/component.js';
21
21
  import DeprecatedMapComponent from '../../components/map-2d/deprecatedmapcomponent.js';
22
22
  import Map3dComponent from '../../components/map-3d/component.js';
23
23
  import GoogleStreetViewComponent from '../../components/streetview/google.js';
24
+ import MapillaryStreetViewComponent from '../../components/streetview/mapillary.js';
24
25
  import MapGridComponent from '../../components/map-grid/component.js';
25
26
  import MenuButtonComponent from '../../components/menubutton/component.js';
26
27
  import ModalsComponent from '../../components/modals/component.js';
@@ -126,6 +127,7 @@ export default class GeoGirafeApp {
126
127
  customElements.define('girafe-map-2d', Map2dComponent);
127
128
  customElements.define('girafe-map-3d', Map3dComponent);
128
129
  customElements.define('girafe-streetview-google', GoogleStreetViewComponent);
130
+ customElements.define('girafe-streetview-mapillary', MapillaryStreetViewComponent);
129
131
  customElements.define('girafe-map-grid', MapGridComponent);
130
132
  // Deprecated alias of <girafe-map-2d>, kept for the applications that were not migrated yet.
131
133
  customElements.define('girafe-map', DeprecatedMapComponent);
@@ -117,14 +117,7 @@ class GirafeConfig {
117
117
  // We just display a warning in the console
118
118
  console.warn(e);
119
119
  }
120
- try {
121
- this.streetview = initConfigStreetView(config);
122
- }
123
- catch (e) {
124
- // The application can be started even if the StreetView is not correctly configured
125
- // We just display a warning in the console
126
- console.warn(e);
127
- }
120
+ this.streetview = initConfigStreetView(config);
128
121
  try {
129
122
  this.news = this.initConfigNews(config);
130
123
  }
@@ -1,13 +1,24 @@
1
1
  import type { StreetViewProvider } from '../state/streetview.js';
2
2
  /** Maximal distance, in meters, between a click on the map and the footage displayed for it. */
3
3
  export declare const DEFAULT_STREETVIEW_SEARCH_RADIUS = 100;
4
+ /** The Mapillary API does not search the images further than this distance, in meters. */
5
+ export declare const MAPILLARY_MAX_SEARCH_RADIUS = 50;
6
+ export type MapillaryConfig = {
7
+ accessToken: string;
8
+ searchRadius: number;
9
+ };
4
10
  export type StreetViewConfig = {
5
11
  searchRadius: number;
6
12
  google?: {
7
13
  apiKey: string;
8
14
  };
15
+ mapillary?: MapillaryConfig;
16
+ };
17
+ type StreetViewConfigInput = Partial<Omit<StreetViewConfig, 'mapillary'>> & {
18
+ mapillary?: Partial<MapillaryConfig>;
9
19
  };
10
20
  export declare function initConfigStreetView(config: {
11
- streetview?: Partial<StreetViewConfig>;
21
+ streetview?: StreetViewConfigInput;
12
22
  }): StreetViewConfig | undefined;
13
23
  export declare function isStreetViewProviderConfigured(config: StreetViewConfig | undefined, provider: StreetViewProvider): boolean;
24
+ export {};
@@ -1,16 +1,38 @@
1
1
  /** Maximal distance, in meters, between a click on the map and the footage displayed for it. */
2
2
  export const DEFAULT_STREETVIEW_SEARCH_RADIUS = 100;
3
+ /** The Mapillary API does not search the images further than this distance, in meters. */
4
+ export const MAPILLARY_MAX_SEARCH_RADIUS = 50;
5
+ function initConfigMapillary(mapillary) {
6
+ if (!mapillary) {
7
+ return undefined;
8
+ }
9
+ if (!mapillary.accessToken) {
10
+ console.warn(`Configuration for streetview.mapillary requires an accessToken. See https://doc.geogirafe.org/docs/configuration#streetview`);
11
+ return undefined;
12
+ }
13
+ const searchRadius = mapillary.searchRadius ?? MAPILLARY_MAX_SEARCH_RADIUS;
14
+ if (searchRadius > MAPILLARY_MAX_SEARCH_RADIUS) {
15
+ console.warn(`Configuration for streetview.mapillary.searchRadius cannot exceed ${MAPILLARY_MAX_SEARCH_RADIUS} meters. See https://doc.geogirafe.org/docs/configuration#streetview`);
16
+ return undefined;
17
+ }
18
+ return { accessToken: mapillary.accessToken, searchRadius: searchRadius };
19
+ }
20
+ function initConfigGoogle(google) {
21
+ if (google && !google.apiKey) {
22
+ console.warn(`Configuration for streetview.google requires an apiKey. See https://doc.geogirafe.org/docs/configuration#streetview`);
23
+ return undefined;
24
+ }
25
+ return google;
26
+ }
3
27
  export function initConfigStreetView(config) {
4
28
  const streetview = config.streetview;
5
29
  if (!streetview) {
6
30
  return undefined;
7
31
  }
8
- if (streetview.google && !streetview.google.apiKey) {
9
- throw new Error(`Configuration for streetview.google requires an apiKey. See https://doc.geogirafe.org/docs/configuration`);
10
- }
11
32
  return {
12
33
  searchRadius: streetview.searchRadius ?? DEFAULT_STREETVIEW_SEARCH_RADIUS,
13
- google: streetview.google
34
+ google: initConfigGoogle(streetview.google),
35
+ mapillary: initConfigMapillary(streetview.mapillary)
14
36
  };
15
37
  }
16
38
  export function isStreetViewProviderConfigured(config, provider) {
package/tools/main.d.ts CHANGED
@@ -13,8 +13,8 @@ export { default as ConfigManager } from './configuration/configmanager.js';
13
13
  export type { HighlightMode, UserDataConfig } from './configuration/girafeconfig.js';
14
14
  export { default as GirafeConfig } from './configuration/girafeconfig.js';
15
15
  export { defaultNewsSanitizeConfig, defaultPermalinkSanitizeConfig, defaultQuerySanitizeConfig } from './configuration/sanitizeconfig-defaults.js';
16
- export type { StreetViewConfig } from './configuration/streetviewconfig.js';
17
- export { DEFAULT_STREETVIEW_SEARCH_RADIUS, initConfigStreetView, isStreetViewProviderConfigured } from './configuration/streetviewconfig.js';
16
+ export type { MapillaryConfig, StreetViewConfig } from './configuration/streetviewconfig.js';
17
+ export { DEFAULT_STREETVIEW_SEARCH_RADIUS, MAPILLARY_MAX_SEARCH_RADIUS, initConfigStreetView, isStreetViewProviderConfigured } from './configuration/streetviewconfig.js';
18
18
  export { default as GirafeContext } from './context/context.js';
19
19
  export { default as ContextInitializationHelper } from './context/contexthelper.js';
20
20
  export type { default as IGirafeContext } from './context/icontext.js';
@@ -167,6 +167,7 @@ export type { WfsOperator } from './wfs/wfsfiltercondition.js';
167
167
  export { default as WfsFilterCondition, isWfsOperator } from './wfs/wfsfiltercondition.js';
168
168
  export { default as WfsManager } from './wfs/wfsmanager.js';
169
169
  export { default as WfsParser } from './wfs/wfsparser.js';
170
+ export type { PairedLayer, GroupLayerInfo } from './wms/wmsclient.js';
170
171
  export { default as WmsClient, WmsClientQgis, WmsClientMapServer, WmsClientDefault, WmsClientGeoServer } from './wms/wmsclient.js';
171
172
  export { default as WmsLegendHelper } from './wms/wmslegendhelper.js';
172
173
  export { default as WmsManager } from './wms/wmsmanager.js';
package/tools/main.js CHANGED
@@ -12,7 +12,7 @@ export { default as PluginManager } from './auth/pluginmanager.js';
12
12
  export { default as ConfigManager } from './configuration/configmanager.js';
13
13
  export { default as GirafeConfig } from './configuration/girafeconfig.js';
14
14
  export { defaultNewsSanitizeConfig, defaultPermalinkSanitizeConfig, defaultQuerySanitizeConfig } from './configuration/sanitizeconfig-defaults.js';
15
- export { DEFAULT_STREETVIEW_SEARCH_RADIUS, initConfigStreetView, isStreetViewProviderConfigured } from './configuration/streetviewconfig.js';
15
+ export { DEFAULT_STREETVIEW_SEARCH_RADIUS, MAPILLARY_MAX_SEARCH_RADIUS, initConfigStreetView, isStreetViewProviderConfigured } from './configuration/streetviewconfig.js';
16
16
  export { default as GirafeContext } from './context/context.js';
17
17
  export { default as ContextInitializationHelper } from './context/contexthelper.js';
18
18
  export { ContextMenu } from './drawing/contextmenu.js';
@@ -44,6 +44,11 @@ export declare const AVAILABLE_CELL_COMPONENTS: readonly [{
44
44
  readonly tagName: "girafe-streetview-google";
45
45
  readonly label: "Google Street View";
46
46
  readonly provider: "google";
47
+ }, {
48
+ readonly id: "streetview-mapillary";
49
+ readonly tagName: "girafe-streetview-mapillary";
50
+ readonly label: "Mapillary";
51
+ readonly provider: "mapillary";
47
52
  }];
48
53
  type CellComponentDefinition = (typeof AVAILABLE_CELL_COMPONENTS)[number];
49
54
  export type CellComponent = CellComponentDefinition['id'];
@@ -31,7 +31,8 @@ export const MAX_CELL_SIZE = 85;
31
31
  export const AVAILABLE_CELL_COMPONENTS = [
32
32
  { id: 'map-2d', tagName: 'girafe-map-2d', label: '2D Map' },
33
33
  { id: 'map-3d', tagName: 'girafe-map-3d', label: '3D Map' },
34
- { id: 'streetview-google', tagName: 'girafe-streetview-google', label: 'Google Street View', provider: 'google' }
34
+ { id: 'streetview-google', tagName: 'girafe-streetview-google', label: 'Google Street View', provider: 'google' },
35
+ { id: 'streetview-mapillary', tagName: 'girafe-streetview-mapillary', label: 'Mapillary', provider: 'mapillary' }
35
36
  ];
36
37
  export function isLayoutType(value) {
37
38
  return LAYOUT_TYPES.includes(value);
@@ -1,6 +1,6 @@
1
1
  import type { Coordinate } from 'ol/coordinate.js';
2
2
  /** The services that can provide the footage displayed by a StreetView Component. */
3
- export declare const STREETVIEW_PROVIDERS: readonly ["google"];
3
+ export declare const STREETVIEW_PROVIDERS: readonly ["google", "mapillary"];
4
4
  export type StreetViewProvider = (typeof STREETVIEW_PROVIDERS)[number];
5
5
  /** The footage displayed by a provider: where it was taken (in the map projection) and the direction of sight. */
6
6
  export type StreetViewView = {
@@ -1,5 +1,5 @@
1
1
  /** The services that can provide the footage displayed by a StreetView Component. */
2
- export const STREETVIEW_PROVIDERS = ['google'];
2
+ export const STREETVIEW_PROVIDERS = ['google', 'mapillary'];
3
3
  export function isStreetViewProvider(value) {
4
4
  return STREETVIEW_PROVIDERS.includes(value);
5
5
  }
@@ -1,4 +1,4 @@
1
1
  import LayerWms from '../../models/layers/layerwms';
2
2
  import ServerOgc from '../../models/serverogc';
3
- export declare const mockOgcServers: Record<string, ServerOgc>;
4
- export declare const mockWmsLayers: Record<string, LayerWms>;
3
+ export declare const createMockOgcServers: () => Record<string, ServerOgc>;
4
+ export declare const createMockWmsLayers: () => Record<string, LayerWms>;
@@ -1,66 +1,73 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  import LayerWms from '../../models/layers/layerwms';
3
3
  import ServerOgc from '../../models/serverogc';
4
- export const mockOgcServers = {
5
- 'QGIS-1-has-wfs': new ServerOgc('QGIS-1-has-wfs', {
6
- url: 'https://qgis-wms-1.test.url',
7
- wfsSupport: true,
8
- urlWfs: 'https://wfs-1.url',
9
- type: 'qgisserver',
10
- imageType: 'image/png'
11
- }),
12
- 'QGIS-2-has-wfs': new ServerOgc('QGIS-2-has-wfs', {
13
- url: 'https://qgis-wms-2.test.url',
14
- wfsSupport: true,
15
- urlWfs: 'https://qgis-wfs-2.url',
16
- type: 'qgisserver',
17
- imageType: 'image/png'
18
- }),
19
- 'QGIS-3-no-wfs': new ServerOgc('QGIS-3-no-wfs', {
20
- url: 'https://qgis-wms-3.test.url',
21
- wfsSupport: false,
22
- type: 'qgisserver',
23
- imageType: 'image/png'
24
- }),
25
- 'MapServer-1-has-wfs': new ServerOgc('MapServer-1-has-wfs', {
26
- url: 'https://ms-wms-1.test.url',
27
- wfsSupport: true,
28
- urlWfs: 'https://ms-wfs-1.url',
29
- type: 'mapserver',
30
- imageType: 'image/png'
31
- }),
32
- 'MapServer-2-has-wfs': new ServerOgc('MapServer-2-has-wfs', {
33
- url: 'https://ms-wms-2.test.url',
34
- wfsSupport: true,
35
- urlWfs: 'https://ms-wfs-2.url',
36
- type: 'mapserver',
37
- imageType: 'image/png'
38
- }),
39
- 'MapServer-3-no-wfs': new ServerOgc('MapServer-3-no-wfs', {
40
- url: 'https://ms-wms-3.test.url',
41
- wfsSupport: false,
42
- type: 'mapserver',
43
- imageType: 'image/png'
44
- })
4
+ export const createMockOgcServers = () => {
5
+ return {
6
+ 'QGIS-1-has-wfs': new ServerOgc('QGIS-1-has-wfs', {
7
+ url: 'https://qgis-wms-1.test.url',
8
+ wfsSupport: true,
9
+ urlWfs: 'https://wfs-1.url',
10
+ type: 'qgisserver',
11
+ imageType: 'image/png'
12
+ }),
13
+ 'QGIS-2-has-wfs': new ServerOgc('QGIS-2-has-wfs', {
14
+ url: 'https://qgis-wms-2.test.url',
15
+ wfsSupport: true,
16
+ urlWfs: 'https://qgis-wfs-2.url',
17
+ type: 'qgisserver',
18
+ imageType: 'image/png'
19
+ }),
20
+ 'QGIS-3-no-wfs': new ServerOgc('QGIS-3-no-wfs', {
21
+ url: 'https://qgis-wms-3.test.url',
22
+ wfsSupport: false,
23
+ type: 'qgisserver',
24
+ imageType: 'image/png'
25
+ }),
26
+ 'MapServer-1-has-wfs': new ServerOgc('MapServer-1-has-wfs', {
27
+ url: 'https://ms-wms-1.test.url',
28
+ wfsSupport: true,
29
+ urlWfs: 'https://ms-wfs-1.url',
30
+ type: 'mapserver',
31
+ imageType: 'image/png'
32
+ }),
33
+ 'MapServer-2-has-wfs': new ServerOgc('MapServer-2-has-wfs', {
34
+ url: 'https://ms-wms-2.test.url',
35
+ wfsSupport: true,
36
+ urlWfs: 'https://ms-wfs-2.url',
37
+ type: 'mapserver',
38
+ imageType: 'image/png'
39
+ }),
40
+ 'MapServer-3-no-wfs': new ServerOgc('MapServer-3-no-wfs', {
41
+ url: 'https://ms-wms-3.test.url',
42
+ wfsSupport: false,
43
+ type: 'mapserver',
44
+ imageType: 'image/png'
45
+ })
46
+ };
45
47
  };
46
- export const mockWmsLayers = {
47
- 'qgis1-layer1': new LayerWms(1, 'qgis1-layer1', 1, mockOgcServers['QGIS-1-has-wfs'], {
48
- queryable: true,
49
- queryLayers: 'qgis1-ql1,qgis1-ql2,qgis1-ql3'
50
- }), // multiple queryLayers
51
- 'qgis1-layer2': new LayerWms(1, 'qgis1-layer2', 1, mockOgcServers['QGIS-1-has-wfs'], {
52
- queryable: true,
53
- queryLayers: 'qgis1-ql3,qgis1-ql4',
54
- opacity: 0.5
55
- }), // opacity: wmsClient independantLayer
56
- 'qgis1-layer3': new LayerWms(1, 'qgis1-layer3', 1, mockOgcServers['QGIS-1-has-wfs'], {}), // layer without wfs on wfs-able server: should be ok
57
- 'qgis2-layer1': new LayerWms(1, 'qgis2-layer1', 1, mockOgcServers['QGIS-2-has-wfs'], {
58
- queryable: true,
59
- queryLayers: 'qgis2-ql3'
60
- }), //single queryLayer
61
- 'qgis3-layer1': new LayerWms(1, 'qgis3-layer1', 1, mockOgcServers['QGIS-3-no-wfs'], {}), // layer without wfs on server without wfs: no problemo
62
- 'qgis3-layer2': new LayerWms(1, 'qgis3-layer2', 1, mockOgcServers['QGIS-3-no-wfs'], {
63
- queryable: true,
64
- queryLayers: 'qgis3-ql1nono'
65
- }) // queryable layer on server without wfs: problemo
48
+ export const createMockWmsLayers = () => {
49
+ const mockOgcServers = createMockOgcServers();
50
+ return {
51
+ 'qgis1-layer1': new LayerWms(1, 'qgis1-layer1', 1, mockOgcServers['QGIS-1-has-wfs'], {
52
+ queryable: true,
53
+ queryLayers: 'qgis1-ql1,qgis1-ql2,qgis1-ql3'
54
+ }), // multiple queryLayers
55
+ 'qgis1-layer2': new LayerWms(1, 'qgis1-layer2', 2, mockOgcServers['QGIS-1-has-wfs'], {
56
+ queryable: true,
57
+ queryLayers: 'qgis1-ql3,qgis1-ql4',
58
+ opacity: 0.5
59
+ }), // opacity: another group of layers.
60
+ 'qgis1-layer3': new LayerWms(1, 'qgis1-layer3', 3, mockOgcServers['QGIS-1-has-wfs'], {}), // layer without wfs on wfs-able server: should be ok
61
+ 'qgis1-layer4': new LayerWms(1, 'qgis1-layer4', 4, mockOgcServers['QGIS-1-has-wfs'], {}), // Same layer, can be requested with the previous one.
62
+ 'qgis1-layer5': new LayerWms(1, 'qgis1-layer5', 0, mockOgcServers['QGIS-1-has-wfs'], {}), // Same but ORDER = 0! (change grouping)
63
+ 'qgis2-layer1': new LayerWms(1, 'qgis2-layer1', 6, mockOgcServers['QGIS-2-has-wfs'], {
64
+ queryable: true,
65
+ queryLayers: 'qgis2-ql3'
66
+ }), //single queryLayer
67
+ 'qgis3-layer1': new LayerWms(1, 'qgis3-layer1', 7, mockOgcServers['QGIS-3-no-wfs'], {}), // layer without wfs on server without wfs: no problemo
68
+ 'qgis3-layer2': new LayerWms(1, 'qgis3-layer2', 8, mockOgcServers['QGIS-3-no-wfs'], {
69
+ queryable: true,
70
+ queryLayers: 'qgis3-ql1nono'
71
+ }) // queryable layer on server without wfs: problemo
72
+ };
66
73
  };