@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.
- package/README.md +3 -2
- package/api/apigeogirafeapp.js +3 -1
- package/assets/i18n/de.json +1 -0
- package/assets/i18n/en.json +1 -0
- package/assets/i18n/fr.json +1 -0
- package/assets/i18n/it.json +1 -0
- package/assets/icons/streetview-marker-mapillary.svg +1 -0
- package/components/layout/component.d.ts +5 -0
- package/components/map-grid/component.d.ts +4 -0
- package/components/map-grid/component.js +6 -0
- package/components/print/tools/MFPEncoder.d.ts +22 -10
- package/components/print/tools/MFPEncoder.js +75 -43
- package/components/streetview/component.d.ts +9 -2
- package/components/streetview/component.js +20 -8
- package/components/streetview/google.js +1 -1
- package/components/streetview/mapillary.d.ts +8 -0
- package/components/streetview/mapillary.js +20 -0
- package/components/streetview/style.css +16 -0
- package/components/streetview/tools/googleprovider.js +9 -2
- package/components/streetview/tools/mapillaryprovider.d.ts +70 -0
- package/components/streetview/tools/mapillaryprovider.js +150 -0
- package/models/layers/grouplayer.d.ts +3 -3
- package/models/layers/grouplayer.js +5 -48
- package/package.json +1 -1
- package/templates/iframe.html +1 -0
- package/templates/index.html +1 -0
- package/templates/mobile.html +1 -0
- package/templates/public/about.json +1 -1
- package/tools/app/geogirafeapp-mobile.js +2 -0
- package/tools/app/geogirafeapp.js +2 -0
- package/tools/configuration/girafeconfig.js +1 -8
- package/tools/configuration/streetviewconfig.d.ts +12 -1
- package/tools/configuration/streetviewconfig.js +26 -4
- package/tools/main.d.ts +3 -2
- package/tools/main.js +1 -1
- package/tools/state/layout.d.ts +5 -0
- package/tools/state/layout.js +2 -1
- package/tools/state/streetview.d.ts +1 -1
- package/tools/state/streetview.js +1 -1
- package/tools/tests/wmswfsmanagermocking.d.ts +2 -2
- package/tools/tests/wmswfsmanagermocking.js +68 -61
- package/tools/wms/wmsclient.d.ts +164 -26
- package/tools/wms/wmsclient.js +415 -233
package/README.md
CHANGED
|
@@ -263,8 +263,9 @@ Contribution guidelines are available here: [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
|
263
263
|
|
|
264
264
|
There are many ways to support GeoGirafe.
|
|
265
265
|
|
|
266
|
-
- You can use the following tag on your project to help promote GeoGirafe:
|
|
267
|
-
[](https://geogirafe.org)
|
|
266
|
+
- You can use the following tag on your project to help promote GeoGirafe: [](https://geogirafe.org)
|
|
267
|
+
code: `[](https://geogirafe.org)`
|
|
268
|
+
|
|
268
269
|
- If you are interested in providing financial assistance, please reach out to us at contact@geogirafe.org.
|
|
269
270
|
- If you have another idea how to support the project, we invite you to join us on the dedicaced discord server: https://discord.gg/kdrXjaqBbH.
|
|
270
271
|
|
package/api/apigeogirafeapp.js
CHANGED
|
@@ -5,6 +5,7 @@ import GirafeHTMLElement from '../base/GirafeHTMLElement.js';
|
|
|
5
5
|
import Map2dComponent from '../components/map-2d/component.js';
|
|
6
6
|
import Map3dComponent from '../components/map-3d/component.js';
|
|
7
7
|
import GoogleStreetViewComponent from '../components/streetview/google.js';
|
|
8
|
+
import MapillaryStreetViewComponent from '../components/streetview/mapillary.js';
|
|
8
9
|
import MapGridComponent from '../components/map-grid/component.js';
|
|
9
10
|
import { register } from 'ol/proj/proj4.js';
|
|
10
11
|
import GirafeApiContext from './apicontext.js';
|
|
@@ -40,7 +41,7 @@ export default class GeoGirafeApi extends GirafeHTMLElement {
|
|
|
40
41
|
:host{position:relative}girafe-map-grid,girafe-map-2d,girafe-map-3d{width:100%;height:100%;display:block;position:relative;overflow:hidden}girafe-basemap{display:block;position:absolute;bottom:.5rem;left:.5rem}girafe-search{width:50%;height:2.25rem;display:block;position:absolute;top:.5rem;left:.5rem;box-shadow:0 1px 4px #0000004d}girafe-selection-window{z-index:100;width:400px;height:240px;position:absolute;bottom:1rem;right:1rem}
|
|
41
42
|
</style>
|
|
42
43
|
<style>${this.customStyle}</style>
|
|
43
|
-
<girafe-map-grid><girafe-map-2d></girafe-map-2d><girafe-map-3d></girafe-map-3d><girafe-streetview-google></girafe-streetview-google></girafe-map-grid>
|
|
44
|
+
<girafe-map-grid><girafe-map-2d></girafe-map-2d><girafe-map-3d></girafe-map-3d><girafe-streetview-google></girafe-streetview-google><girafe-streetview-mapillary></girafe-streetview-mapillary></girafe-map-grid>
|
|
44
45
|
${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
|
|
45
46
|
};
|
|
46
47
|
isInitialized = false;
|
|
@@ -110,6 +111,7 @@ ${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
|
|
|
110
111
|
customElements.define('girafe-map-2d', Map2dComponent);
|
|
111
112
|
customElements.define('girafe-map-3d', Map3dComponent);
|
|
112
113
|
customElements.define('girafe-streetview-google', GoogleStreetViewComponent);
|
|
114
|
+
customElements.define('girafe-streetview-mapillary', MapillaryStreetViewComponent);
|
|
113
115
|
customElements.define('girafe-map-grid', MapGridComponent);
|
|
114
116
|
}
|
|
115
117
|
}
|
package/assets/i18n/de.json
CHANGED
|
@@ -328,6 +328,7 @@
|
|
|
328
328
|
"map": "Karte",
|
|
329
329
|
"Map orientation": "Kartenorientierung",
|
|
330
330
|
"map.geo.admin.ch": "map.geo.admin.ch",
|
|
331
|
+
"Mapillary": "Mapillary",
|
|
331
332
|
"Material": "Material",
|
|
332
333
|
"measure-information-full": "Vollständig",
|
|
333
334
|
"measure-information-mixed": "Unterschiedliche",
|
package/assets/i18n/en.json
CHANGED
package/assets/i18n/fr.json
CHANGED
|
@@ -328,6 +328,7 @@
|
|
|
328
328
|
"map": "Carte",
|
|
329
329
|
"Map orientation": "Orientation de la carte",
|
|
330
330
|
"map.geo.admin.ch": "map.geo.admin.ch",
|
|
331
|
+
"Mapillary": "Mapillary",
|
|
331
332
|
"Material": "Matériel",
|
|
332
333
|
"measure-information-full": "Complète",
|
|
333
334
|
"measure-information-mixed": "Mixte",
|
package/assets/i18n/it.json
CHANGED
|
@@ -328,6 +328,7 @@
|
|
|
328
328
|
"map": "Mappa",
|
|
329
329
|
"Map orientation": "Orientamento della mappa",
|
|
330
330
|
"map.geo.admin.ch": "map.geo.admin.ch",
|
|
331
|
+
"Mapillary": "Mapillary",
|
|
331
332
|
"Material": "Materiale",
|
|
332
333
|
"measure-information-full": "Completa",
|
|
333
334
|
"measure-information-mixed": "Misto",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48"><path fill="#05cb63" fill-opacity=".35" d="M24 24 10 4a24 24 0 0 1 28 0Z"/><circle cx="24" cy="24" r="6" fill="#05cb63" stroke="#fff" stroke-width="2"/></svg>
|
|
@@ -22,6 +22,11 @@ declare class LayoutComponent extends GirafeHTMLElement implements IGirafePanel
|
|
|
22
22
|
readonly tagName: "girafe-streetview-google";
|
|
23
23
|
readonly label: "Google Street View";
|
|
24
24
|
readonly provider: "google";
|
|
25
|
+
} | {
|
|
26
|
+
readonly id: "streetview-mapillary";
|
|
27
|
+
readonly tagName: "girafe-streetview-mapillary";
|
|
28
|
+
readonly label: "Mapillary";
|
|
29
|
+
readonly provider: "mapillary";
|
|
25
30
|
})[];
|
|
26
31
|
constructor();
|
|
27
32
|
private get layout();
|
|
@@ -36,6 +36,10 @@ declare class MapGridComponent extends GirafeHTMLElement {
|
|
|
36
36
|
/** The splitter that is currently dragged, if any. */
|
|
37
37
|
private draggedSplitter;
|
|
38
38
|
constructor();
|
|
39
|
+
/**
|
|
40
|
+
* The Grid contains the Maps, which need to be displayed in Fullscreen Mode.
|
|
41
|
+
*/
|
|
42
|
+
protected get isFullscreenComponent(): boolean;
|
|
39
43
|
private get layout();
|
|
40
44
|
private get grid();
|
|
41
45
|
protected connectedCallback(): void;
|
|
@@ -31,6 +31,12 @@ ${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
|
|
|
31
31
|
constructor() {
|
|
32
32
|
super('map-grid');
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* The Grid contains the Maps, which need to be displayed in Fullscreen Mode.
|
|
36
|
+
*/
|
|
37
|
+
get isFullscreenComponent() {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
34
40
|
get layout() {
|
|
35
41
|
return this.state.layout;
|
|
36
42
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { BaseCustomizer, MFPLayer, MFPMap, MFPWmtsLayer, MFPWmsLayer } from '@geoblocks/mapfishprint';
|
|
2
2
|
import type BaseLayer from '../../../models/layers/baselayer.js';
|
|
3
|
-
import GroupLayer from '../../../models/layers/grouplayer.js';
|
|
4
3
|
import MapManager from '../../../tools/state/mapManager.js';
|
|
5
4
|
import State from '../../../tools/state/state.js';
|
|
6
5
|
import LayerLocalFile from '../../../models/layers/layerlocalfile.js';
|
|
7
6
|
import LayerWms from '../../../models/layers/layerwms.js';
|
|
8
7
|
import LayerWmts from '../../../models/layers/layerwmts.js';
|
|
8
|
+
import WmsClient from '../../../tools/wms/wmsclient.js';
|
|
9
9
|
/** Options for encoding a map. */
|
|
10
10
|
export interface EncodeMapOptions {
|
|
11
11
|
state: State;
|
|
@@ -21,6 +21,8 @@ export interface EncodeMapOptions {
|
|
|
21
21
|
export default class MFPEncoder {
|
|
22
22
|
private printResolution;
|
|
23
23
|
private options?;
|
|
24
|
+
private wmsClients;
|
|
25
|
+
private mapInternal;
|
|
24
26
|
/**
|
|
25
27
|
* Sets the options for encoding the map.
|
|
26
28
|
*/
|
|
@@ -30,6 +32,10 @@ export default class MFPEncoder {
|
|
|
30
32
|
* @returns A Promise that resolves with the encoded map object.
|
|
31
33
|
*/
|
|
32
34
|
encodeMap(options: EncodeMapOptions): MFPMap;
|
|
35
|
+
/**
|
|
36
|
+
* @returns an appropriate (existing or new) WMS client for the layer.
|
|
37
|
+
*/
|
|
38
|
+
getWmsClient(layer: LayerWms): WmsClient;
|
|
33
39
|
/**
|
|
34
40
|
* @returns An array of all active layers from the state object in the right order
|
|
35
41
|
*/
|
|
@@ -38,6 +44,20 @@ export default class MFPEncoder {
|
|
|
38
44
|
* @returns The flattened array of base layers.
|
|
39
45
|
*/
|
|
40
46
|
getFlatLayers(baseLayers: BaseLayer[]): BaseLayer[];
|
|
47
|
+
/**
|
|
48
|
+
* See "getFlatLayers".
|
|
49
|
+
* Flatten the array of layer but without WMS layers (added to
|
|
50
|
+
* a WMS client and collected later).
|
|
51
|
+
* @returns The flattened array of base layers without WMS.
|
|
52
|
+
*/
|
|
53
|
+
getFlatLayersCollect(baseLayers: BaseLayer[]): BaseLayer[];
|
|
54
|
+
/**
|
|
55
|
+
* See "getFlatLayers".
|
|
56
|
+
* Add the previously collected WMS layers to the list of layers.
|
|
57
|
+
* This is needed to "group" WMS Layers together.
|
|
58
|
+
* @returns The flattened array of WMS layers.
|
|
59
|
+
*/
|
|
60
|
+
getFlatLayersAddWms(): BaseLayer[];
|
|
41
61
|
/**
|
|
42
62
|
* Encode special layers, meaning not-in-the-layer-tree layers.
|
|
43
63
|
* These layers are from the mapManager.getLayersToPrint method.
|
|
@@ -54,15 +74,6 @@ export default class MFPEncoder {
|
|
|
54
74
|
* @returns A promise that resolves to an array of MFP layers, a single MFP layer, or null.
|
|
55
75
|
*/
|
|
56
76
|
encodeLayer(layer: BaseLayer): MFPLayer[] | MFPLayer | null;
|
|
57
|
-
/**
|
|
58
|
-
* Only non mixed groups of WMS layers are supported.
|
|
59
|
-
*
|
|
60
|
-
* Will convert a group of WMS layers sharing the same OGC server into a single MFPWmsLayer
|
|
61
|
-
* where its 'layers' property is a concatenation of all child layers' 'layers' property.
|
|
62
|
-
*
|
|
63
|
-
* @param groupLayer
|
|
64
|
-
*/
|
|
65
|
-
encodeGroupLayer(groupLayer: GroupLayer): MFPWmsLayer | null;
|
|
66
77
|
/**
|
|
67
78
|
* Encodes an image layer from a WMS layer object.
|
|
68
79
|
* @returns The encoded image layer or null if the layer is not visible.
|
|
@@ -83,4 +94,5 @@ export default class MFPEncoder {
|
|
|
83
94
|
* @returns The encoded WMS layer or null if the ogcServer is missing.
|
|
84
95
|
*/
|
|
85
96
|
encodeWmsFromWmtsLayer(layerWmts: LayerWmts): MFPWmsLayer | null;
|
|
97
|
+
private clear;
|
|
86
98
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import GroupLayer from '../../../models/layers/grouplayer.js';
|
|
1
|
+
import OlMap from 'ol/Map.js';
|
|
3
2
|
import { toDegrees } from 'ol/math.js';
|
|
3
|
+
import { getAbsoluteUrl, getWmtsMatrices, getWmtsUrl, MFPVectorEncoder } from '@geoblocks/mapfishprint';
|
|
4
4
|
import LayerLocalFile from '../../../models/layers/layerlocalfile.js';
|
|
5
5
|
import LayerWms from '../../../models/layers/layerwms.js';
|
|
6
6
|
import LayerWmts from '../../../models/layers/layerwmts.js';
|
|
@@ -9,7 +9,7 @@ import { isLayerVisible } from './printUtils.js';
|
|
|
9
9
|
import VectorSource from 'ol/source/Vector.js';
|
|
10
10
|
import LayerWmtsExternal from '../../../models/layers/layerwmtsexternal.js';
|
|
11
11
|
import LayerWmsExternal from '../../../models/layers/layerwmsexternal.js';
|
|
12
|
-
import WmsClient from '../../../tools/wms/wmsclient.js';
|
|
12
|
+
import WmsClient, { WmsClientDefault } from '../../../tools/wms/wmsclient.js';
|
|
13
13
|
/** Supported MapFishPRint servers
|
|
14
14
|
* see https://github.com/mapfish/mapfish-print/blob/master/core/src/main/java/org/mapfish/print/map/image/wms/WmsLayerParam.java#L123
|
|
15
15
|
*/
|
|
@@ -20,6 +20,8 @@ const MFPSupportedServerType = new Set(['mapserver', 'geoserver', 'qgisserver'])
|
|
|
20
20
|
export default class MFPEncoder {
|
|
21
21
|
printResolution = 100;
|
|
22
22
|
options;
|
|
23
|
+
wmsClients = null;
|
|
24
|
+
mapInternal = null;
|
|
23
25
|
/**
|
|
24
26
|
* Sets the options for encoding the map.
|
|
25
27
|
*/
|
|
@@ -31,6 +33,7 @@ export default class MFPEncoder {
|
|
|
31
33
|
* @returns A Promise that resolves with the encoded map object.
|
|
32
34
|
*/
|
|
33
35
|
encodeMap(options) {
|
|
36
|
+
this.clear();
|
|
34
37
|
this.setOptions(options);
|
|
35
38
|
const mapManager = options.mapManager;
|
|
36
39
|
const view = mapManager.getMap().getView();
|
|
@@ -41,6 +44,7 @@ export default class MFPEncoder {
|
|
|
41
44
|
const allLayers = this.getAllLayers(options.state);
|
|
42
45
|
const mfpLayers = this.encodeLayers(allLayers);
|
|
43
46
|
mfpLayers.unshift(...this.encodeSpecialLayers(mapManager, options.customizer));
|
|
47
|
+
this.clear();
|
|
44
48
|
return {
|
|
45
49
|
center,
|
|
46
50
|
dpi: options.dpi,
|
|
@@ -51,6 +55,24 @@ export default class MFPEncoder {
|
|
|
51
55
|
useNearestScale: false
|
|
52
56
|
};
|
|
53
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* @returns an appropriate (existing or new) WMS client for the layer.
|
|
60
|
+
*/
|
|
61
|
+
getWmsClient(layer) {
|
|
62
|
+
if (!this.mapInternal || !this.wmsClients) {
|
|
63
|
+
this.mapInternal = new OlMap();
|
|
64
|
+
this.wmsClients = new Map();
|
|
65
|
+
}
|
|
66
|
+
let wmsClient = this.wmsClients.get(layer.ogcServer.name);
|
|
67
|
+
if (!wmsClient) {
|
|
68
|
+
wmsClient = new WmsClientDefault(layer.ogcServer, this.mapInternal, {
|
|
69
|
+
stateManager: { state: this.options?.state },
|
|
70
|
+
configManager: { Config: {} }
|
|
71
|
+
});
|
|
72
|
+
this.wmsClients.set(layer.ogcServer.name, wmsClient);
|
|
73
|
+
}
|
|
74
|
+
return wmsClient;
|
|
75
|
+
}
|
|
54
76
|
/**
|
|
55
77
|
* @returns An array of all active layers from the state object in the right order
|
|
56
78
|
*/
|
|
@@ -66,19 +88,27 @@ export default class MFPEncoder {
|
|
|
66
88
|
* @returns The flattened array of base layers.
|
|
67
89
|
*/
|
|
68
90
|
getFlatLayers(baseLayers) {
|
|
91
|
+
const flatLayers = this.getFlatLayersCollect(baseLayers);
|
|
92
|
+
flatLayers.push(...this.getFlatLayersAddWms());
|
|
93
|
+
return flatLayers;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* See "getFlatLayers".
|
|
97
|
+
* Flatten the array of layer but without WMS layers (added to
|
|
98
|
+
* a WMS client and collected later).
|
|
99
|
+
* @returns The flattened array of base layers without WMS.
|
|
100
|
+
*/
|
|
101
|
+
getFlatLayersCollect(baseLayers) {
|
|
69
102
|
return baseLayers.reduce((layers, layer) => {
|
|
70
103
|
const children = layer.children;
|
|
71
104
|
if (children) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const resultLayers = this.getFlatLayers(group.children);
|
|
80
|
-
layers.push(...resultLayers);
|
|
81
|
-
}
|
|
105
|
+
// Flat layers recursively.
|
|
106
|
+
layers.push(...this.getFlatLayersCollect(children));
|
|
107
|
+
}
|
|
108
|
+
else if (layer instanceof LayerWms) {
|
|
109
|
+
// Use the WMS client to group layers.
|
|
110
|
+
const wmsClient = this.getWmsClient(layer);
|
|
111
|
+
wmsClient.addLayer(layer);
|
|
82
112
|
}
|
|
83
113
|
else {
|
|
84
114
|
layers.push(layer);
|
|
@@ -86,6 +116,34 @@ export default class MFPEncoder {
|
|
|
86
116
|
return layers;
|
|
87
117
|
}, []);
|
|
88
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* See "getFlatLayers".
|
|
121
|
+
* Add the previously collected WMS layers to the list of layers.
|
|
122
|
+
* This is needed to "group" WMS Layers together.
|
|
123
|
+
* @returns The flattened array of WMS layers.
|
|
124
|
+
*/
|
|
125
|
+
getFlatLayersAddWms() {
|
|
126
|
+
if (!this.wmsClients) {
|
|
127
|
+
return [];
|
|
128
|
+
}
|
|
129
|
+
const wmsLayers = [];
|
|
130
|
+
Array.from(this.wmsClients.values()).forEach((wmsClient) => {
|
|
131
|
+
wmsClient.getLayerWmsArrays().forEach((layerWmsArray) => {
|
|
132
|
+
// Keep only one LayerWms, but push every layer "layers" of its group in the LayerWms, keep order.
|
|
133
|
+
layerWmsArray.sort((lWms1, lWms2) => lWms1.order - lWms2.order);
|
|
134
|
+
const layersLayers = [];
|
|
135
|
+
layerWmsArray.forEach((lWms) => {
|
|
136
|
+
if (lWms.layers) {
|
|
137
|
+
layersLayers.push(lWms.layers);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
const firstLayerClone = layerWmsArray[0].clone();
|
|
141
|
+
firstLayerClone.layers = [...layersLayers].reverse().join(',');
|
|
142
|
+
wmsLayers.push(firstLayerClone);
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
return wmsLayers;
|
|
146
|
+
}
|
|
89
147
|
/**
|
|
90
148
|
* Encode special layers, meaning not-in-the-layer-tree layers.
|
|
91
149
|
* These layers are from the mapManager.getLayersToPrint method.
|
|
@@ -130,9 +188,6 @@ export default class MFPEncoder {
|
|
|
130
188
|
* @returns A promise that resolves to an array of MFP layers, a single MFP layer, or null.
|
|
131
189
|
*/
|
|
132
190
|
encodeLayer(layer) {
|
|
133
|
-
if (layer instanceof GroupLayer) {
|
|
134
|
-
return this.encodeGroupLayer(layer);
|
|
135
|
-
}
|
|
136
191
|
if (layer instanceof LayerWms || layer instanceof LayerWmsExternal) {
|
|
137
192
|
return this.encodeWmsLayer(layer);
|
|
138
193
|
}
|
|
@@ -145,33 +200,6 @@ export default class MFPEncoder {
|
|
|
145
200
|
console.warn('Unsupported layer type for encoding: ', layer);
|
|
146
201
|
return null;
|
|
147
202
|
}
|
|
148
|
-
/**
|
|
149
|
-
* Only non mixed groups of WMS layers are supported.
|
|
150
|
-
*
|
|
151
|
-
* Will convert a group of WMS layers sharing the same OGC server into a single MFPWmsLayer
|
|
152
|
-
* where its 'layers' property is a concatenation of all child layers' 'layers' property.
|
|
153
|
-
*
|
|
154
|
-
* @param groupLayer
|
|
155
|
-
*/
|
|
156
|
-
encodeGroupLayer(groupLayer) {
|
|
157
|
-
if (groupLayer.isMixed) {
|
|
158
|
-
console.error("A mixed group layer is passed to print and shouldn't", groupLayer);
|
|
159
|
-
return null;
|
|
160
|
-
}
|
|
161
|
-
if (groupLayer.hasGrandChildren) {
|
|
162
|
-
console.error("A group layer that has grandchildren is passed to print and shouldn't", groupLayer);
|
|
163
|
-
return null;
|
|
164
|
-
}
|
|
165
|
-
const firstWmsLayer = groupLayer.children.shift();
|
|
166
|
-
const spec = this.encodeWmsLayer(firstWmsLayer);
|
|
167
|
-
if (!spec) {
|
|
168
|
-
return this.encodeGroupLayer(groupLayer);
|
|
169
|
-
}
|
|
170
|
-
for (const childLayer of groupLayer.children) {
|
|
171
|
-
spec.layers.push(childLayer.layers || '');
|
|
172
|
-
}
|
|
173
|
-
return spec;
|
|
174
|
-
}
|
|
175
203
|
/**
|
|
176
204
|
* Encodes an image layer from a WMS layer object.
|
|
177
205
|
* @returns The encoded image layer or null if the layer is not visible.
|
|
@@ -289,4 +317,8 @@ export default class MFPEncoder {
|
|
|
289
317
|
layerWms.opacity = layerWmts.opacity;
|
|
290
318
|
return this.encodeWmsLayer(layerWms);
|
|
291
319
|
}
|
|
320
|
+
clear() {
|
|
321
|
+
this.mapInternal = null;
|
|
322
|
+
this.wmsClients = null;
|
|
323
|
+
}
|
|
292
324
|
}
|
|
@@ -15,6 +15,9 @@ export default abstract class StreetViewComponent extends GirafeHTMLElement {
|
|
|
15
15
|
template: () => import("uhtml").Hole;
|
|
16
16
|
loading: boolean;
|
|
17
17
|
hasFootage: boolean;
|
|
18
|
+
isFullscreen: boolean;
|
|
19
|
+
/** The Fullscreen API is not available everywhere: on iPhone, only videos can be displayed in fullscreen. */
|
|
20
|
+
readonly canBeFullscreen: boolean;
|
|
18
21
|
protected readonly provider: StreetViewProvider;
|
|
19
22
|
private adapter;
|
|
20
23
|
/** Promise of the currently running adapter creation, to prevent creating it twice. */
|
|
@@ -26,11 +29,11 @@ export default abstract class StreetViewComponent extends GirafeHTMLElement {
|
|
|
26
29
|
private readonly marker;
|
|
27
30
|
private readonly markerSource;
|
|
28
31
|
private readonly markerLayer;
|
|
29
|
-
protected constructor(provider: StreetViewProvider);
|
|
32
|
+
protected constructor(provider: StreetViewProvider, markerIconSrc: string);
|
|
30
33
|
private get olMap();
|
|
31
34
|
private get cellId();
|
|
32
35
|
private get isDisplayed();
|
|
33
|
-
|
|
36
|
+
protected get searchRadius(): number;
|
|
34
37
|
/** Creates the adapter of the provider, loading its module on demand. */
|
|
35
38
|
protected abstract createAdapter(): Promise<StreetViewProviderAdapter>;
|
|
36
39
|
/** The StreetView is displayed in a Cell of the Grid, like the Maps. */
|
|
@@ -45,6 +48,10 @@ export default abstract class StreetViewComponent extends GirafeHTMLElement {
|
|
|
45
48
|
*/
|
|
46
49
|
private onDisplayToggled;
|
|
47
50
|
private createAdapterOnce;
|
|
51
|
+
/** Displays the StreetView alone on the whole screen, or leaves the fullscreen when it is already displayed so. */
|
|
52
|
+
toggleFullscreen(): void;
|
|
53
|
+
/** The fullscreen can also be left with the keyboard (Esc), without the button. */
|
|
54
|
+
onFullscreenChanged(): void;
|
|
48
55
|
private onMapClick;
|
|
49
56
|
private showClosestFootage;
|
|
50
57
|
private onFootageChanged;
|
|
@@ -22,32 +22,32 @@ export default class StreetViewComponent extends GirafeHTMLElement {
|
|
|
22
22
|
return uHtml `<style>
|
|
23
23
|
.hidden{display:none!important}.gg-rotate90{transform:rotate(90deg)}.gg-rotate180{transform:rotate(180deg)}.gg-rotate270{transform:rotate(270deg)}img{filter:var(--svg-filter)}img.legend-image{filter:var(--svg-map-filter);background:var(--svg-legend-bkg)}div{scrollbar-width:thin}a,a:visited{color:var(--link-color)}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes spin-wait{0%{transform:rotate(0)}7%{transform:rotate(360deg)}to{transform:rotate(360deg)}}.gg-spin{animation-name:spin;animation-duration:2s;animation-timing-function:linear;animation-iteration-count:infinite}.gg-spin-wait{animation-name:spin-wait;animation-duration:10s;animation-timing-function:linear;animation-iteration-count:infinite}::-webkit-scrollbar{width:5px}::-webkit-scrollbar-thumb{background:#999}button,input,select,textarea{font:inherit}.gg-button,.gg-select,.gg-input,.gg-textarea{background-color:var(--bkg-color);color:var(--text-color);border:var(--app-standard-border);box-sizing:border-box;cursor:pointer;border-radius:3px;outline:0;margin:0;padding:0 0 0 .5rem;display:inline-block}.gg-label{background-color:var(--bkg-color);color:var(--text-color);border:none;align-items:center;margin:0;padding:0;display:flex}.gg-button,.gg-select,.gg-input,.gg-label{min-height:calc(var(--app-standard-height) / 1.5)}.gg-textarea{max-height:initial;resize:vertical;height:6rem;padding:.5rem;line-height:1.3rem}.gg-input{cursor:text}.gg-checkbox{accent-color:var(--text-color);cursor:pointer;width:1.2rem}.gg-range{accent-color:var(--text-color)}.gg-button{padding:0 .5rem}.gg-button.active{border:solid 1px var(--text-color-grad1);background-color:var(--bkg-color-grad2)}.gg-button:disabled{background-color:var(--bkg-color-grad1);color:var(--text-color-grad2);cursor:not-allowed;border:none}.gg-button:disabled img{filter:opacity(.6)}.gg-input:disabled,.gg-select:disabled,.gg-textarea:disabled{background-color:var(--bkg-color-grad1);color:var(--text-color-grad2);cursor:not-allowed}.gg-button>img{vertical-align:middle}.gg-icon-button{color:var(--text-color);cursor:pointer;background-color:#0000;border:none;flex-direction:column;justify-content:center;align-items:center;padding:0;display:flex}.gg-icon{justify-content:center;align-items:center;display:flex}.gg-big,.gg-big-withtext{min-width:var(--app-standard-height);min-height:var(--app-standard-height);max-height:var(--app-standard-height)}.gg-big img,.gg-big-withtext img{width:calc(var(--app-standard-height) - 1.5rem);margin:0}.gg-big-withtext span{font-variant:small-caps;padding:0 1rem;font-size:.9rem}.gg-medium,.gg-medium-withtext{min-width:calc(var(--app-standard-height) / 1.2);min-height:calc(var(--app-standard-height) / 1.2);max-height:calc(var(--app-standard-height) / 1.2);flex-direction:row}.gg-medium img{width:calc(var(--app-standard-height) / 2.4);margin:0}.gg-medium-withtext img{width:calc(var(--app-standard-height) / 2.4);margin-left:.5rem}.gg-medium-withtext span{padding:0 1rem 0 .5rem;font-size:.9rem}.gg-small,.gg-small-withtext{min-width:calc(var(--app-standard-height) / 2);min-height:calc(var(--app-standard-height) / 2);max-height:calc(var(--app-standard-height) / 2);flex-direction:row}.gg-small img{width:calc(var(--app-standard-height) / 3);margin:0}.gg-small-withtext img{width:calc(var(--app-standard-height) / 3);margin-left:.5rem}.gg-small-withtext span{padding:0 .5rem 0 .3rem;font-size:.9rem}.gg-button:hover:not(:disabled),.gg-select:hover:not(:disabled),.gg-input:hover:not(:disabled),.gg-textarea:hover:not(:disabled),.gg-icon-button:hover:not(:disabled){background-color:var(--bkg-color-grad1)}.gg-opacity{opacity:.5}.gg-opacity:hover{opacity:1;background-color:#0000}.gg-tabs{cursor:pointer;grid-auto-flow:column;padding-bottom:1rem;font-size:1rem;display:grid}.gg-tab{border:none;border-bottom:var(--app-standard-border);cursor:pointer;color:var(--text-color);background:0 0;padding:.5rem}.gg-tab.active{border-bottom:solid 1px var(--text-color)}.girafe-button-big,.girafe-button-large,.girafe-button-small,.girafe-button-tiny{color:var(--text-color);background-color:#0000;border:none;flex-direction:column;display:flex}.girafe-button-big:hover,.girafe-button-large:hover,.girafe-button-small:hover,.girafe-button-tiny:hover{background-color:var(--bkg-color-grad1);cursor:pointer}.girafe-button-big.dark,.girafe-button-large.dark,.girafe-button-small.dark,.girafe-button-tiny.dark{background-color:var(--bkg-color);filter:invert()}.girafe-button-big{width:var(--app-standard-height);height:var(--app-standard-height);align-items:center;padding:1rem}.girafe-button-big img{overflow:hidden}.girafe-button-large{flex-direction:row}.girafe-button-large img{height:2rem;margin:.3rem}.girafe-button-large span{height:2rem;margin:.3rem;line-height:2rem}.girafe-button-small{min-width:calc(var(--app-standard-height) / 2);height:calc(var(--app-standard-height) / 2);align-items:center;padding:.5rem}.girafe-button-small img{overflow:hidden}.girafe-button-small span{text-align:left;text-overflow:ellipsis;width:100%;overflow:hidden}.girafe-button-tiny{align-items:center;width:1rem;height:1rem;padding:0}.girafe-button-tiny img{overflow:hidden}.girafe-onboarding-theme{background-color:var(--bkg-color)!important;color:var(--text-color)!important}.girafe-onboarding-theme button{background-color:var(--bkg-color)!important;color:var(--text-color)!important;text-shadow:none!important}.girafe-onboarding-theme button.driver-popover-close-btn{z-index:10000}.tippy-box{background-color:var(--bkg-color)!important;border:var(--app-standard-border)!important}.tippy-content{color:var(--text-color)!important}.tippy-arrow{color:var(--bkg-color)!important}.tippy-box[data-theme~=error]{background-color:var(--error-color);white-space:pre-line}div.tippy-box[data-theme=image-popup]{border:var(--app-standard-border)!important;& div.tippy-content{background-color:var(--bkg-color)!important;& img{max-width:20rem;max-height:20rem}}& div.tippy-arrow{color:var(--bkg-color)!important}}
|
|
24
24
|
</style><style>
|
|
25
|
-
#streetview{background-color:var(--bkg-color);width:100%;height:100%;position:relative;overflow:hidden}#viewer{position:absolute;inset:0}.overlay{text-align:center;color:var(--text-color);pointer-events:none;z-index:1;flex-direction:column;justify-content:center;align-items:center;gap:1rem;padding:1rem;font-weight:600;display:flex;position:absolute;inset:0}.no-data{color:#999;font-variant:small-caps;gap:.3rem;font-size:1rem;font-weight:400}.hidden{display:none}
|
|
25
|
+
#streetview{background-color:var(--bkg-color);width:100%;height:100%;position:relative;overflow:hidden}#viewer{position:absolute;inset:0}.overlay{text-align:center;color:var(--text-color);pointer-events:none;z-index:1;flex-direction:column;justify-content:center;align-items:center;gap:1rem;padding:1rem;font-weight:600;display:flex;position:absolute;inset:0}.no-data{color:#999;font-variant:small-caps;gap:.3rem;font-size:1rem;font-weight:400}.fullscreen-button{z-index:2;background-color:var(--bkg-color);border-radius:.25rem;width:2rem;height:2rem;position:absolute;top:.5rem;right:.5rem}.fullscreen-button>img{width:55%;height:auto}.hidden{display:none}
|
|
26
26
|
</style>
|
|
27
27
|
<style>${this.customStyle}</style>
|
|
28
|
-
<div id="streetview"><div id="viewer"></div><div class="${this.loading ? 'overlay' : 'overlay hidden'}"><img alt="loading-icon" src="icons/loading.svg" class="gg-spin"> <span i18n="Loading StreetView...">Loading StreetView...</span></div><div class="${!this.loading && !this.hasFootage ? 'overlay no-data' : 'overlay no-data hidden'}"><span i18n="Click on the map to display the StreetView at this location">Click on the map to display the StreetView at this location</span></div></div>
|
|
28
|
+
<div id="streetview" onfullscreenchange="${() => this.onFullscreenChanged()}"><div id="viewer"></div><div class="${this.loading ? 'overlay' : 'overlay hidden'}"><img alt="loading-icon" src="icons/loading.svg" class="gg-spin"> <span i18n="Loading StreetView...">Loading StreetView...</span></div><div class="${!this.loading && !this.hasFootage ? 'overlay no-data' : 'overlay no-data hidden'}"><span i18n="Click on the map to display the StreetView at this location">Click on the map to display the StreetView at this location</span></div><button tip="fullscreen-on" class="${this.canBeFullscreen && this.hasFootage && !this.isFullscreen ? 'gg-icon-button fullscreen-button' : 'gg-icon-button fullscreen-button hidden'}" onclick="${() => this.toggleFullscreen()}"><img alt="fullscreen-icon" src="icons/fullscreen.svg"></button> <button tip="fullscreen-off" class="${this.isFullscreen ? 'gg-icon-button fullscreen-button' : 'gg-icon-button fullscreen-button hidden'}" onclick="${() => this.toggleFullscreen()}"><img alt="fullscreen-exit-icon" src="icons/fullscreen-exit.svg"></button></div>
|
|
29
29
|
${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
|
|
30
30
|
};
|
|
31
31
|
loading = false;
|
|
32
32
|
hasFootage = false;
|
|
33
|
+
isFullscreen = false;
|
|
34
|
+
/** The Fullscreen API is not available everywhere: on iPhone, only videos can be displayed in fullscreen. */
|
|
35
|
+
canBeFullscreen = document.fullscreenEnabled;
|
|
33
36
|
provider;
|
|
34
37
|
adapter = null;
|
|
35
38
|
/** Promise of the currently running adapter creation, to prevent creating it twice. */
|
|
36
39
|
adapterCreation = null;
|
|
37
40
|
/** The view of the footage displayed by the adapter, to tell the views coming from a shared state apart. */
|
|
38
41
|
displayedView = null;
|
|
39
|
-
markerIcon
|
|
40
|
-
src: 'icons/streetview-marker.svg',
|
|
41
|
-
anchor: [0.5, 0.5],
|
|
42
|
-
rotateWithView: true
|
|
43
|
-
});
|
|
42
|
+
markerIcon;
|
|
44
43
|
markerGeometry = new Point([0, 0]);
|
|
45
44
|
marker = new Feature(this.markerGeometry);
|
|
46
45
|
markerSource = new VectorSource();
|
|
47
46
|
markerLayer = new VectorLayer({ source: this.markerSource, zIndex: 2000 });
|
|
48
|
-
constructor(provider) {
|
|
47
|
+
constructor(provider, markerIconSrc) {
|
|
49
48
|
super(`streetview-${provider}`);
|
|
50
49
|
this.provider = provider;
|
|
50
|
+
this.markerIcon = new Icon({ src: markerIconSrc, anchor: [0.5, 0.5], rotateWithView: true });
|
|
51
51
|
this.marker.setStyle(new Style({ image: this.markerIcon }));
|
|
52
52
|
this.onMapClick = this.onMapClick.bind(this);
|
|
53
53
|
}
|
|
@@ -130,6 +130,18 @@ ${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
|
|
|
130
130
|
})();
|
|
131
131
|
return this.adapterCreation;
|
|
132
132
|
}
|
|
133
|
+
/** Displays the StreetView alone on the whole screen, or leaves the fullscreen when it is already displayed so. */
|
|
134
|
+
toggleFullscreen() {
|
|
135
|
+
const fullscreenToggle = this.isFullscreen
|
|
136
|
+
? document.exitFullscreen()
|
|
137
|
+
: this.getById('streetview').requestFullscreen();
|
|
138
|
+
fullscreenToggle.catch((error) => console.error(error));
|
|
139
|
+
}
|
|
140
|
+
/** The fullscreen can also be left with the keyboard (Esc), without the button. */
|
|
141
|
+
onFullscreenChanged() {
|
|
142
|
+
this.isFullscreen = this.shadow.fullscreenElement !== null;
|
|
143
|
+
this.refreshRender();
|
|
144
|
+
}
|
|
133
145
|
onMapClick(event) {
|
|
134
146
|
if (!this.adapter || !this.isDisplayed || !this.canExecute('map.mouseclick')) {
|
|
135
147
|
return;
|
|
@@ -3,7 +3,7 @@ import StreetViewComponent from './component.js';
|
|
|
3
3
|
/** The StreetView displaying the footage of Google Street View. */
|
|
4
4
|
export default class GoogleStreetViewComponent extends StreetViewComponent {
|
|
5
5
|
constructor() {
|
|
6
|
-
super('google');
|
|
6
|
+
super('google', 'icons/streetview-marker.svg');
|
|
7
7
|
}
|
|
8
8
|
async createAdapter() {
|
|
9
9
|
const apiKey = this.context.configManager.Config.streetview?.google?.apiKey;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import StreetViewComponent from './component.js';
|
|
2
|
+
import type { StreetViewProviderAdapter } from './tools/provider.js';
|
|
3
|
+
/** The StreetView displaying the footage of Mapillary. */
|
|
4
|
+
export default class MapillaryStreetViewComponent extends StreetViewComponent {
|
|
5
|
+
constructor();
|
|
6
|
+
protected get searchRadius(): number;
|
|
7
|
+
protected createAdapter(): Promise<StreetViewProviderAdapter>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import { MAPILLARY_MAX_SEARCH_RADIUS } from '../../tools/configuration/streetviewconfig.js';
|
|
3
|
+
import StreetViewComponent from './component.js';
|
|
4
|
+
/** The StreetView displaying the footage of Mapillary. */
|
|
5
|
+
export default class MapillaryStreetViewComponent extends StreetViewComponent {
|
|
6
|
+
constructor() {
|
|
7
|
+
super('mapillary', 'icons/streetview-marker-mapillary.svg');
|
|
8
|
+
}
|
|
9
|
+
get searchRadius() {
|
|
10
|
+
return this.context.configManager.Config.streetview?.mapillary?.searchRadius ?? MAPILLARY_MAX_SEARCH_RADIUS;
|
|
11
|
+
}
|
|
12
|
+
async createAdapter() {
|
|
13
|
+
const accessToken = this.context.configManager.Config.streetview?.mapillary?.accessToken;
|
|
14
|
+
if (!accessToken) {
|
|
15
|
+
throw new Error('The Mapillary StreetView cannot be displayed: streetview.mapillary.accessToken is not configured');
|
|
16
|
+
}
|
|
17
|
+
const { default: MapillaryStreetViewProvider } = await import('./tools/mapillaryprovider');
|
|
18
|
+
return new MapillaryStreetViewProvider(accessToken);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -36,6 +36,22 @@
|
|
|
36
36
|
gap: 0.3rem;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
.fullscreen-button {
|
|
40
|
+
position: absolute;
|
|
41
|
+
top: 0.5rem;
|
|
42
|
+
right: 0.5rem;
|
|
43
|
+
z-index: 2;
|
|
44
|
+
width: 2rem;
|
|
45
|
+
height: 2rem;
|
|
46
|
+
border-radius: 0.25rem;
|
|
47
|
+
background-color: var(--bkg-color);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.fullscreen-button > img {
|
|
51
|
+
width: 55%;
|
|
52
|
+
height: auto;
|
|
53
|
+
}
|
|
54
|
+
|
|
39
55
|
.hidden {
|
|
40
56
|
display: none;
|
|
41
57
|
}
|
|
@@ -22,7 +22,12 @@ function loadMapsApi(apiKey) {
|
|
|
22
22
|
});
|
|
23
23
|
script.src = `https://maps.googleapis.com/maps/api/js?${params}`;
|
|
24
24
|
script.async = true;
|
|
25
|
-
script.addEventListener('error', () =>
|
|
25
|
+
script.addEventListener('error', () => {
|
|
26
|
+
// Allows the StreetView Component to try again
|
|
27
|
+
mapsApiLoading = null;
|
|
28
|
+
script.remove();
|
|
29
|
+
reject(new Error('The Google Maps JavaScript API could not be loaded'));
|
|
30
|
+
});
|
|
26
31
|
document.head.appendChild(script);
|
|
27
32
|
});
|
|
28
33
|
return mapsApiLoading;
|
|
@@ -51,7 +56,9 @@ export default class GoogleStreetViewProvider {
|
|
|
51
56
|
this.service = new library.StreetViewService();
|
|
52
57
|
this.panorama = new library.StreetViewPanorama(target, {
|
|
53
58
|
visible: false,
|
|
54
|
-
pov: { heading: 0, pitch: 0 }
|
|
59
|
+
pov: { heading: 0, pitch: 0 },
|
|
60
|
+
// The StreetView Component provides the same fullscreen button for every provider
|
|
61
|
+
fullscreenControl: false
|
|
55
62
|
});
|
|
56
63
|
const notifyFootageChanged = () => {
|
|
57
64
|
const footage = this.getFootage();
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { Coordinate } from 'ol/coordinate.js';
|
|
2
|
+
import type { Footage, PointOfView, StreetViewProviderAdapter } from './provider.js';
|
|
3
|
+
type MapillaryImage = {
|
|
4
|
+
lngLat: {
|
|
5
|
+
lng: number;
|
|
6
|
+
lat: number;
|
|
7
|
+
};
|
|
8
|
+
computedCompassAngle: number;
|
|
9
|
+
cameraType: string;
|
|
10
|
+
};
|
|
11
|
+
type MapillaryViewer = {
|
|
12
|
+
on(type: 'image', handler: (event: {
|
|
13
|
+
image: MapillaryImage;
|
|
14
|
+
}) => void): void;
|
|
15
|
+
on(type: 'pov', handler: () => void): void;
|
|
16
|
+
moveTo(imageId: string): Promise<MapillaryImage>;
|
|
17
|
+
getPointOfView(): Promise<{
|
|
18
|
+
bearing: number;
|
|
19
|
+
tilt: number;
|
|
20
|
+
}>;
|
|
21
|
+
setCenter(center: number[]): void;
|
|
22
|
+
resize(): void;
|
|
23
|
+
};
|
|
24
|
+
type MapillaryJs = {
|
|
25
|
+
Viewer: new (options: {
|
|
26
|
+
accessToken: string;
|
|
27
|
+
container: HTMLElement;
|
|
28
|
+
component: {
|
|
29
|
+
cover: boolean;
|
|
30
|
+
};
|
|
31
|
+
}) => MapillaryViewer;
|
|
32
|
+
};
|
|
33
|
+
declare global {
|
|
34
|
+
interface Window {
|
|
35
|
+
mapillary?: MapillaryJs;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The center of the viewport, in the coordinates of a 360° image (from 0 to 1, from its top-left corner),
|
|
40
|
+
* for a direction of sight. The center of the image is in the direction it was taken (its compass angle).
|
|
41
|
+
*/
|
|
42
|
+
export declare function getSphericalImageCenter(pov: PointOfView, compassAngle: number): number[];
|
|
43
|
+
/**
|
|
44
|
+
* The Mapillary footage, displayed by a MapillaryJS Viewer.
|
|
45
|
+
* This module is the only place where MapillaryJS and the Mapillary API are used. It is loaded on demand
|
|
46
|
+
* by the StreetView Component, so that MapillaryJS stays out of the application as long as
|
|
47
|
+
* no Mapillary StreetView is displayed.
|
|
48
|
+
* The access token is visible to the user: it must be a client token.
|
|
49
|
+
*/
|
|
50
|
+
export default class MapillaryStreetViewProvider implements StreetViewProviderAdapter {
|
|
51
|
+
private readonly accessToken;
|
|
52
|
+
private target;
|
|
53
|
+
private viewer;
|
|
54
|
+
private image;
|
|
55
|
+
constructor(accessToken: string);
|
|
56
|
+
initialize(target: HTMLElement, onFootageChanged: (footage: Footage) => void): Promise<void>;
|
|
57
|
+
private getFootage;
|
|
58
|
+
/**
|
|
59
|
+
* The Mapillary API returns the "best" images within the radius, not the closest one:
|
|
60
|
+
* the closest one is chosen among them.
|
|
61
|
+
*/
|
|
62
|
+
private findClosestImageId;
|
|
63
|
+
/**
|
|
64
|
+
* The direction of sight can only be applied to 360° images:
|
|
65
|
+
* the other images are displayed in the direction they were taken.
|
|
66
|
+
*/
|
|
67
|
+
showClosestFootage(lonLat: Coordinate, radius: number, pov?: PointOfView): Promise<boolean>;
|
|
68
|
+
setVisible(visible: boolean): void;
|
|
69
|
+
}
|
|
70
|
+
export {};
|