@geogirafe/lib-geoportal 1.3.0-dev.3046054236 → 1.3.0-dev.3060317043
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/LICENSE +1 -0
- package/README.md +3 -2
- package/api/apigeogirafeapp.js +3 -1
- package/assets/i18n/de.json +34 -3
- package/assets/i18n/en.json +33 -2
- package/assets/i18n/fr.json +35 -4
- package/assets/i18n/it.json +37 -6
- package/assets/icons/edit.svg +1 -1
- package/assets/icons/lock.svg +1 -0
- package/assets/icons/streetview-marker-mapillary.svg +1 -0
- package/components/cross-section/cross-section-settings/component.js +1 -1
- package/components/edit/component.d.ts +52 -36
- package/components/edit/component.js +340 -292
- package/components/edit/editcomponentstate.d.ts +1 -0
- package/components/edit/editcomponentstate.js +1 -0
- package/components/edit/editform/component.d.ts +34 -4
- package/components/edit/editform/component.js +224 -37
- package/components/edit/editform/style.css +51 -16
- package/components/edit/geometryedithelper.d.ts +47 -0
- package/components/edit/geometryedithelper.js +324 -0
- package/components/edit/style.css +71 -28
- package/components/layout/component.d.ts +5 -0
- package/components/main.d.ts +1 -1
- package/components/main.js +1 -1
- package/components/map-grid/component.d.ts +4 -0
- package/components/map-grid/component.js +6 -0
- package/components/print/component.d.ts +1 -1
- 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/components/treeview/tools/treeviewelement.d.ts +1 -0
- package/components/treeview/tools/treeviewelement.js +22 -0
- package/components/treeview/treeviewitem/component.js +7 -1
- package/models/gmf.d.ts +18 -2
- package/models/gmf.js +3 -1
- package/models/layers/editablelayer.d.ts +7 -0
- package/models/layers/editablelayer.js +7 -0
- package/models/layers/layerwms.d.ts +1 -2
- package/models/layers/layerwms.js +4 -8
- package/models/main.d.ts +9 -4
- package/models/main.js +6 -2
- package/models/oapiflayer.d.ts +25 -0
- package/models/oapiflayer.js +36 -0
- package/models/oapiftypes.d.ts +71 -0
- package/models/oapiftypes.js +29 -0
- package/models/serverogc.d.ts +5 -3
- package/models/serverogc.js +19 -6
- package/models/serverogcapi.d.ts +2 -0
- package/models/serverogcapi.js +2 -0
- package/models/serverogcapifeatures.d.ts +5 -62
- package/models/serverogcapifeatures.js +8 -4
- package/package.json +1 -1
- package/templates/iframe.html +1 -0
- package/templates/index.html +2 -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 +4 -2
- package/tools/configuration/girafeconfig.js +1 -8
- package/tools/configuration/streetviewconfig.d.ts +12 -1
- package/tools/configuration/streetviewconfig.js +26 -4
- package/tools/drawing/olDrawing.js +2 -22
- package/tools/drawing/shapeConstraints.d.ts +2 -1
- package/tools/drawing/shapeConstraints.js +18 -2
- package/tools/main.d.ts +9 -7
- package/tools/main.js +8 -6
- package/tools/ogcapi/ogcapiclient.d.ts +7 -3
- package/tools/ogcapi/ogcapiclient.js +49 -4
- package/tools/ogcapi/ogcapiconformance.d.ts +2 -2
- package/tools/ogcapi/ogcapiconformance.js +7 -13
- package/tools/ogcapi/ogcapifeaturesclient.d.ts +65 -30
- package/tools/ogcapi/ogcapifeaturesclient.js +265 -139
- package/tools/ogcapi/ogcapifeaturesclientgeorama.d.ts +0 -5
- package/tools/ogcapi/ogcapifeaturesclientgeorama.js +0 -11
- package/tools/ogcapi/ogcapifeaturesclientqgis.d.ts +8 -0
- package/tools/ogcapi/ogcapifeaturesclientqgis.js +13 -0
- package/tools/ogcapi/ogcapifeaturesmanager.d.ts +61 -8
- package/tools/ogcapi/ogcapifeaturesmanager.js +179 -30
- package/tools/ogcapi/ogcapifeaturesschema.d.ts +31 -13
- package/tools/ogcapi/ogcapifeaturesschema.js +69 -39
- package/tools/ogcapi/ogcapifeaturesschemaproperty.d.ts +44 -0
- package/tools/ogcapi/ogcapifeaturesschemaproperty.js +137 -0
- package/tools/ogcapi/ogcapifeaturesschemavalidator.d.ts +22 -0
- package/tools/ogcapi/ogcapifeaturesschemavalidator.js +121 -0
- package/tools/state/layout.d.ts +5 -0
- package/tools/state/layout.js +2 -1
- package/tools/state/state.d.ts +6 -0
- package/tools/state/state.js +4 -0
- package/tools/state/streetview.d.ts +1 -1
- package/tools/state/streetview.js +1 -1
- package/tools/themes/themesmanager.d.ts +10 -3
- package/tools/themes/themesmanager.js +29 -9
- package/tools/time/layertimeformatter.d.ts +0 -5
- package/tools/time/layertimeformatter.js +10 -19
- package/tools/utils/dateutils.d.ts +40 -0
- package/tools/utils/dateutils.js +111 -0
- package/tools/utils/utils.d.ts +4 -0
- package/tools/utils/utils.js +12 -0
- package/tools/wfs/wfsmanager.js +3 -0
- package/tools/wms/wmsclient.d.ts +1 -0
- package/tools/wms/wmsclient.js +4 -0
- package/tools/ogcapi/demolayers.d.ts +0 -1
- package/tools/ogcapi/demolayers.js +0 -99
- package/tools/ogcapi/ogcapifeaturesclientgmf.d.ts +0 -13
- package/tools/ogcapi/ogcapifeaturesclientgmf.js +0 -30
|
@@ -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 {};
|
|
@@ -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
|
+
}
|
|
@@ -14,6 +14,7 @@ export default abstract class TreeViewElement extends GirafeHTMLElement {
|
|
|
14
14
|
refreshRender(): void;
|
|
15
15
|
refreshRender(layer: BaseLayer): void;
|
|
16
16
|
protected showMetadata(): void;
|
|
17
|
+
protected toggleEditPanel(): void;
|
|
17
18
|
protected initializeDrag(): void;
|
|
18
19
|
private dragStart;
|
|
19
20
|
private dragEnd;
|
|
@@ -1,13 +1,21 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
1
7
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
8
|
import GirafeHTMLElement from '../../../base/GirafeHTMLElement.js';
|
|
3
9
|
import { isTimeAwareLayer } from '../../../models/layers/timeawarelayer.js';
|
|
4
10
|
import { isSnappableLayer } from '../../../models/layers/snappablelayer.js';
|
|
11
|
+
import { isEditableLayer } from '../../../models/layers/editablelayer.js';
|
|
5
12
|
import tippy from 'tippy.js';
|
|
6
13
|
import TimeRestrictionComponent from '../../timerestriction/component.js';
|
|
7
14
|
import LayerWms from '../../../models/layers/layerwms.js';
|
|
8
15
|
import Layer from '../../../models/layers/layer.js';
|
|
9
16
|
import GroupLayer from '../../../models/layers/grouplayer.js';
|
|
10
17
|
import LayerGroup from 'ol/layer/Group.js';
|
|
18
|
+
import { UsedInTemplateOnly } from '../../../decorators.js';
|
|
11
19
|
export default class TreeViewElement extends GirafeHTMLElement {
|
|
12
20
|
dragManager;
|
|
13
21
|
layer;
|
|
@@ -69,6 +77,12 @@ export default class TreeViewElement extends GirafeHTMLElement {
|
|
|
69
77
|
const metadataTitle = this.context.configManager.Config.infoWindow.defaultMetadataTitle ?? this.layer.name;
|
|
70
78
|
window.gOpenWindow(metadataTitle, this.layer.metadataUrl);
|
|
71
79
|
}
|
|
80
|
+
toggleEditPanel() {
|
|
81
|
+
if (!isEditableLayer(this.layer))
|
|
82
|
+
return;
|
|
83
|
+
this.state.editing.layer = this.state.editing.layer?.treeItemId === this.layer.treeItemId ? null : this.layer;
|
|
84
|
+
this.state.interface.editPanelVisible = !!this.state.editing.layer;
|
|
85
|
+
}
|
|
72
86
|
initializeDrag() {
|
|
73
87
|
if (!this.layer.isDraggable) {
|
|
74
88
|
return;
|
|
@@ -176,6 +190,11 @@ export default class TreeViewElement extends GirafeHTMLElement {
|
|
|
176
190
|
else {
|
|
177
191
|
return 'hidden';
|
|
178
192
|
}
|
|
193
|
+
case 'editable':
|
|
194
|
+
if (isEditableLayer(this.layer)) {
|
|
195
|
+
return this.state.editing.layer?.treeItemId === this.layer.treeItemId ? activeButtonClasses : buttonClasses;
|
|
196
|
+
}
|
|
197
|
+
return 'hidden';
|
|
179
198
|
default:
|
|
180
199
|
throw Error('Unsupported type: ' + button);
|
|
181
200
|
}
|
|
@@ -247,3 +266,6 @@ export default class TreeViewElement extends GirafeHTMLElement {
|
|
|
247
266
|
}
|
|
248
267
|
}
|
|
249
268
|
}
|
|
269
|
+
__decorate([
|
|
270
|
+
UsedInTemplateOnly()
|
|
271
|
+
], TreeViewElement.prototype, "getButtonClass", null);
|
|
@@ -34,7 +34,7 @@ class TreeViewItemComponent extends TreeViewElement {
|
|
|
34
34
|
header{border-top:1px solid #ddd;align-items:center;height:2rem;display:flex}.tool{display:none!important}.tool.visible,header:hover .tool{display:flex!important}.tool.active{order:100;opacity:1!important;display:flex!important}.label-container{flex-grow:1;align-items:center;display:flex;overflow:auto}.label-out-resolution span{font-style:italic}.resolution-tool{margin-left:.5rem}.legend{display:flex}.legend img{background:var(--svg-legend-bkg);height:fit-content;filter:var(--svg-map-filter)}.legend-icon{background:var(--svg-legend-bkg);max-height:1.5rem;filter:var(--svg-map-filter);margin-left:.5rem}.children{flex-basis:100%;order:10;padding-left:1.3rem}.dragAfter{border-bottom:1rem dashed #ccc}.dragBefore{border-top:1rem dashed #ccc}.gg-checkbox{width:1.2rem}.gg-caret,.gg-spacer{text-align:center;width:1.5rem;padding:0}.gg-caret{transform:scale(1.3)}.gg-caret.gg-rotate90{transform:scale(1.3)rotate(90deg)}.gg-small.gg-lock{min-width:1rem}.gg-opacity.gg-lock:hover{opacity:.5!important}.gg-tree-label{text-align:left;white-space:nowrap;text-overflow:ellipsis;padding-left:0;overflow:hidden}.gg-grab:hover{cursor:grab}.gg-selected{opacity:1}.legend-file{color:var(--text-color);font-style:italic;display:flex}@keyframes headerFade{0%{background-color:var(--highlight-color)}to{background-color:#0000}}.highlight{animation:3s ease-in-out forwards headerFade}
|
|
35
35
|
</style>
|
|
36
36
|
<style>${this.customStyle}</style>
|
|
37
|
-
<div id="container"><header><div class="gg-spacer gg-small"><img class="${this.layer.restricted ? (this.layer.active ? 'gg-small gg-lock gg-selected' : 'gg-small gg-lock gg-opacity') : 'hidden'}" alt="Protected layer" src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8bWFzayBpZD0ibWFzazBfMzdfNDUxNyIgc3R5bGU9Im1hc2stdHlwZTphbHBoYSIgbWFza1VuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeD0iMCIgeT0iMCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0Ij4KICA8cmVjdCB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIGZpbGw9IiNEOUQ5RDkiLz4KICA8L21hc2s+CiAgPGcgbWFzaz0idXJsKCNtYXNrMF8zN180NTE3KSI+CiAgPHBhdGggZD0iTTYgMjJDNS40NSAyMiA0Ljk3OTE3IDIxLjgwNDIgNC41ODc1IDIxLjQxMjVDNC4xOTU4MyAyMS4wMjA4IDQgMjAuNTUgNCAyMFYxMEM0IDkuNDUgNC4xOTU4MyA4Ljk3OTE3IDQuNTg3NSA4LjU4NzVDNC45NzkxNyA4LjE5NTgzIDUuNDUgOCA2IDhIN1Y2QzcgNC42MTY2NyA3LjQ4NzUgMy40Mzc1IDguNDYyNSAyLjQ2MjVDOS40Mzc1IDEuNDg3NSAxMC42MTY3IDEgMTIgMUMxMy4zODMzIDEgMTQuNTYyNSAxLjQ4NzUgMTUuNTM3NSAyLjQ2MjVDMTYuNTEyNSAzLjQzNzUgMTcgNC42MTY2NyAxNyA2VjhIMThDMTguNTUgOCAxOS4wMjA4IDguMTk1ODMgMTkuNDEyNSA4LjU4NzVDMTkuODA0MiA4Ljk3OTE3IDIwIDkuNDUgMjAgMTBWMjBDMjAgMjAuNTUgMTkuODA0MiAyMS4wMjA4IDE5LjQxMjUgMjEuNDEyNUMxOS4wMjA4IDIxLjgwNDIgMTguNTUgMjIgMTggMjJINlpNNiAyMEgxOFYxMEg2VjIwWk0xMiAxN0MxMi41NSAxNyAxMy4wMjA4IDE2LjgwNDIgMTMuNDEyNSAxNi40MTI1QzEzLjgwNDIgMTYuMDIwOCAxNCAxNS41NSAxNCAxNUMxNCAxNC40NSAxMy44MDQyIDEzLjk3OTIgMTMuNDEyNSAxMy41ODc1QzEzLjAyMDggMTMuMTk1OCAxMi41NSAxMyAxMiAxM0MxMS40NSAxMyAxMC45NzkyIDEzLjE5NTggMTAuNTg3NSAxMy41ODc1QzEwLjE5NTggMTMuOTc5MiAxMCAxNC40NSAxMCAxNUMxMCAxNS41NSAxMC4xOTU4IDE2LjAyMDggMTAuNTg3NSAxNi40MTI1QzEwLjk3OTIgMTYuODA0MiAxMS40NSAxNyAxMiAxN1pNOSA4SDE1VjZDMTUgNS4xNjY2NyAxNC43MDgzIDQuNDU4MzMgMTQuMTI1IDMuODc1QzEzLjU0MTcgMy4yOTE2NyAxMi44MzMzIDMgMTIgM0MxMS4xNjY3IDMgMTAuNDU4MyAzLjI5MTY3IDkuODc1IDMuODc1QzkuMjkxNjcgNC40NTgzMyA5IDUuMTY2NjcgOSA2VjhaIiBmaWxsPSIjMUMxQjFGIi8+CiAgPC9nPgo8L3N2Zz4KICA="></div><button class="${this.layer.active ? 'gg-icon-button gg-small gg-selected' : 'gg-icon-button gg-small gg-opacity'}" tip="Activate / Deactivate" onclick="${() => this.toggle()}"><img class="${this.layer.active ? 'gg-checkbox' : 'hidden'}" alt="Expand/Collapse button" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NDggNTEyIj48IS0tIUZvbnQgQXdlc29tZSBGcmVlIDYuNi4wIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tIExpY2Vuc2UgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbS9saWNlbnNlL2ZyZWUgQ29weXJpZ2h0IDIwMjQgRm9udGljb25zLCBJbmMuLS0+PHBhdGggZD0iTTY0IDMyQzI4LjcgMzIgMCA2MC43IDAgOTZMMCA0MTZjMCAzNS4zIDI4LjcgNjQgNjQgNjRsMzIwIDBjMzUuMyAwIDY0LTI4LjcgNjQtNjRsMC0zMjBjMC0zNS4zLTI4LjctNjQtNjQtNjRMNjQgMzJ6TTMzNyAyMDlMMjA5IDMzN2MtOS40IDkuNC0yNC42IDkuNC0zMy45IDBsLTY0LTY0Yy05LjQtOS40LTkuNC0yNC42IDAtMzMuOXMyNC42LTkuNCAzMy45IDBsNDcgNDdMMzAzIDE3NWM5LjQtOS40IDI0LjYtOS40IDMzLjkgMHM5LjQgMjQuNiAwIDMzLjl6Ii8+PC9zdmc+"> <img class="${!this.layer.active ? 'gg-checkbox' : 'hidden'}" alt="Expand/Collapse button" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NDggNTEyIj48IS0tIUZvbnQgQXdlc29tZSBGcmVlIDYuNi4wIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tIExpY2Vuc2UgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbS9saWNlbnNlL2ZyZWUgQ29weXJpZ2h0IDIwMjQgRm9udGljb25zLCBJbmMuLS0+PHBhdGggZD0iTTM4NCA4MGM4LjggMCAxNiA3LjIgMTYgMTZsMCAzMjBjMCA4LjgtNy4yIDE2LTE2IDE2TDY0IDQzMmMtOC44IDAtMTYtNy4yLTE2LTE2TDQ4IDk2YzAtOC44IDcuMi0xNiAxNi0xNmwzMjAgMHpNNjQgMzJDMjguNyAzMiAwIDYwLjcgMCA5NkwwIDQxNmMwIDM1LjMgMjguNyA2NCA2NCA2NGwzMjAgMGMzNS4zIDAgNjQtMjguNyA2NC02NGwwLTMyMGMwLTM1LjMtMjguNy02NC02NC02NEw2NCAzMnoiLz48L3N2Zz4="></button><div class="${this.layer.hasError ? 'gg-icon gg-small gg-opacity' : 'hidden'}" tip="${this.layer.errorMessage ? this.layer.errorMessage : 'Error on layer'}"><img alt="Error on layer" src="icons/error.svg"></div><div class="${this.isVisibleInCurrentResolution() ? 'label-container' : 'label-container label-out-resolution'}"><button class="${this.layer.active ? 'gg-icon-button gg-small gg-selected' : 'gg-icon-button gg-small gg-opacity'}" onclick="${() => this.toggle()}"><span i18n="${this.layer.name}" class="gg-tree-label">${this.layer.name}</span></button> <button class="${this.layer.active && this.layer instanceof LayerWms && !this.isVisibleInCurrentResolution() ? 'gg-icon-button gg-small resolution-tool' : 'hidden'}" tip="Zoom to visible resolution" onclick="${() => this.zoomToVisibleResolution()}"><img alt="Zoom to visible resolution" src="icons/zoom.svg"></button> <img class="${this.layer.active && this.iconUrl ? 'legend-icon' : 'hidden'}" alt="${'Icon for ' + this.layer.name}" src="${this.iconUrl}" loading="lazy" crossorigin="${this.getCrossOrigin(this.iconUrl)}"></div><button class="${this.layer.active && this.layer instanceof LayerLocalFile ? 'gg-icon-button gg-small gg-opacity tool' : 'hidden'}" tip="Zoom to full extent" onclick="${() => this.zoomToFullExtent()}"><img alt="Zoom to full extent" src="icons/zoom.svg"></button> <button class="${this.layer.active && this.layer instanceof LayerLocalFile ? 'gg-icon-button gg-small gg-opacity tool' : 'hidden'}" tip="Convert to drawing" onclick="${() => this.convertToDrawing()}"><img alt="draw-icon" src="icons/draw.svg"></button> <button class="${this.getButtonClass('swipedLeft')}" tip="Swipe layer to the left" onclick="${() => this.layer.swiped = (this.layer.swiped === 'left') ? 'no' : 'left'}"><img alt="Swipe layer to the left" src="icons/swipe-left.svg"></button> <button class="${this.getButtonClass('swipedRight')}" tip="Swipe layer to the right" onclick="${() => this.layer.swiped = (this.layer.swiped === 'right') ? 'no' : 'right'}"><img alt="Swipe layer to the right" src="icons/swipe-right.svg"></button> <button id="opacity" class="${this.getButtonClass('opacity')}" tip="Control opacity"><img alt="Control opacity" src="icons/opacity.svg"></button> <button id="filter" class="${this.getButtonClass('filter')}" tip="Filter layer"><img alt="Filter layer" src="icons/filter.svg"></button> <button id="advanced-filter" class="${this.getButtonClass('advanced-filter')}" tip="Open advanced filter tool" onclick="${() => this.state.interface.advancedFilterPanelVisible = !this.state.interface.advancedFilterPanelVisible}"><img alt="Advanced filter" src="icons/advanced-filter.svg"></button> <button id="timeRestriction" class="${this.getButtonClass('timeRestriction')}" tip="Define time restriction on layer"><img alt="Define time restriction on layer" src="icons/clock.svg"></button> <button class="${this.getButtonClass('snappable')}" onclick="${() => this.toggleSnap()}" tip="Snap to layer features"><img alt="Enable snapping" src="icons/snapping.svg"></button> <button class="${this.hasLegend ? (this.layer.isLegendExpanded ? 'gg-icon-button gg-small tool' : 'gg-icon-button gg-small gg-opacity tool') : 'hidden'}" tip="Toggle legend" onclick="${() => this.toggleLegend()}"><img alt="Toggle legend" src="icons/legend.svg" loading="lazy"></button> <button class="${this.layer.hasMetadata ? 'metadata gg-icon-button gg-small gg-opacity tool' : 'hidden'}" tip="Show metadata" onclick="${() => this.showMetadata()}"><img alt="Metadata" src="icons/info.svg"></button> <button id="drag-button" class="${this.getButtonClass('draggable')}" tip="Move"><img alt="Move layer" src="icons/drag.svg"></button> <button class="${this.getButtonClass('removable')}" tip="Remove layer" onclick="${() => this.deleteLayer()}"><img alt="Remove layer" src="icons/trash.svg"></button></header>${Object.keys(this.legendUrls).map((l) => uHtml `<div class="${this.isLegendExpanded ? 'legend' : 'hidden'}"><div class="gg-spacer gg-small"></div><img alt="${'Legend for ' + l}" src="${this.legendUrls[l]}" loading="lazy" crossorigin="${this.getCrossOrigin(this.legendUrls[l])}"></div>`)}<div class="${this.layer instanceof LayerLocalFile && this.isLegendExpanded ? 'legend-file' : 'legend-file hidden'}"><div class="gg-spacer gg-small"></div><div class="gg-spacer gg-small"></div><div><span i18n="File from">File from</span> <span>${this.layer.lastModifiedDate}</span> <span>[</span> <span>${this.layer._features?.length}</span> <span i18n="features">features</span> <span>]</span></div></div></div>
|
|
37
|
+
<div id="container"><header><div class="gg-spacer gg-small"><img class="${this.layer.restricted ? (this.layer.active ? 'gg-small gg-lock gg-selected' : 'gg-small gg-lock gg-opacity') : 'hidden'}" alt="Protected layer" src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8bWFzayBpZD0ibWFzazBfMzdfNDUxNyIgc3R5bGU9Im1hc2stdHlwZTphbHBoYSIgbWFza1VuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeD0iMCIgeT0iMCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0Ij4KICA8cmVjdCB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIGZpbGw9IiNEOUQ5RDkiLz4KICA8L21hc2s+CiAgPGcgbWFzaz0idXJsKCNtYXNrMF8zN180NTE3KSI+CiAgPHBhdGggZD0iTTYgMjJDNS40NSAyMiA0Ljk3OTE3IDIxLjgwNDIgNC41ODc1IDIxLjQxMjVDNC4xOTU4MyAyMS4wMjA4IDQgMjAuNTUgNCAyMFYxMEM0IDkuNDUgNC4xOTU4MyA4Ljk3OTE3IDQuNTg3NSA4LjU4NzVDNC45NzkxNyA4LjE5NTgzIDUuNDUgOCA2IDhIN1Y2QzcgNC42MTY2NyA3LjQ4NzUgMy40Mzc1IDguNDYyNSAyLjQ2MjVDOS40Mzc1IDEuNDg3NSAxMC42MTY3IDEgMTIgMUMxMy4zODMzIDEgMTQuNTYyNSAxLjQ4NzUgMTUuNTM3NSAyLjQ2MjVDMTYuNTEyNSAzLjQzNzUgMTcgNC42MTY2NyAxNyA2VjhIMThDMTguNTUgOCAxOS4wMjA4IDguMTk1ODMgMTkuNDEyNSA4LjU4NzVDMTkuODA0MiA4Ljk3OTE3IDIwIDkuNDUgMjAgMTBWMjBDMjAgMjAuNTUgMTkuODA0MiAyMS4wMjA4IDE5LjQxMjUgMjEuNDEyNUMxOS4wMjA4IDIxLjgwNDIgMTguNTUgMjIgMTggMjJINlpNNiAyMEgxOFYxMEg2VjIwWk0xMiAxN0MxMi41NSAxNyAxMy4wMjA4IDE2LjgwNDIgMTMuNDEyNSAxNi40MTI1QzEzLjgwNDIgMTYuMDIwOCAxNCAxNS41NSAxNCAxNUMxNCAxNC40NSAxMy44MDQyIDEzLjk3OTIgMTMuNDEyNSAxMy41ODc1QzEzLjAyMDggMTMuMTk1OCAxMi41NSAxMyAxMiAxM0MxMS40NSAxMyAxMC45NzkyIDEzLjE5NTggMTAuNTg3NSAxMy41ODc1QzEwLjE5NTggMTMuOTc5MiAxMCAxNC40NSAxMCAxNUMxMCAxNS41NSAxMC4xOTU4IDE2LjAyMDggMTAuNTg3NSAxNi40MTI1QzEwLjk3OTIgMTYuODA0MiAxMS40NSAxNyAxMiAxN1pNOSA4SDE1VjZDMTUgNS4xNjY2NyAxNC43MDgzIDQuNDU4MzMgMTQuMTI1IDMuODc1QzEzLjU0MTcgMy4yOTE2NyAxMi44MzMzIDMgMTIgM0MxMS4xNjY3IDMgMTAuNDU4MyAzLjI5MTY3IDkuODc1IDMuODc1QzkuMjkxNjcgNC40NTgzMyA5IDUuMTY2NjcgOSA2VjhaIiBmaWxsPSIjMUMxQjFGIi8+CiAgPC9nPgo8L3N2Zz4KICA="></div><button class="${this.layer.active ? 'gg-icon-button gg-small gg-selected' : 'gg-icon-button gg-small gg-opacity'}" tip="Activate / Deactivate" onclick="${() => this.toggle()}"><img class="${this.layer.active ? 'gg-checkbox' : 'hidden'}" alt="Expand/Collapse button" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NDggNTEyIj48IS0tIUZvbnQgQXdlc29tZSBGcmVlIDYuNi4wIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tIExpY2Vuc2UgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbS9saWNlbnNlL2ZyZWUgQ29weXJpZ2h0IDIwMjQgRm9udGljb25zLCBJbmMuLS0+PHBhdGggZD0iTTY0IDMyQzI4LjcgMzIgMCA2MC43IDAgOTZMMCA0MTZjMCAzNS4zIDI4LjcgNjQgNjQgNjRsMzIwIDBjMzUuMyAwIDY0LTI4LjcgNjQtNjRsMC0zMjBjMC0zNS4zLTI4LjctNjQtNjQtNjRMNjQgMzJ6TTMzNyAyMDlMMjA5IDMzN2MtOS40IDkuNC0yNC42IDkuNC0zMy45IDBsLTY0LTY0Yy05LjQtOS40LTkuNC0yNC42IDAtMzMuOXMyNC42LTkuNCAzMy45IDBsNDcgNDdMMzAzIDE3NWM5LjQtOS40IDI0LjYtOS40IDMzLjkgMHM5LjQgMjQuNiAwIDMzLjl6Ii8+PC9zdmc+"> <img class="${!this.layer.active ? 'gg-checkbox' : 'hidden'}" alt="Expand/Collapse button" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NDggNTEyIj48IS0tIUZvbnQgQXdlc29tZSBGcmVlIDYuNi4wIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tIExpY2Vuc2UgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbS9saWNlbnNlL2ZyZWUgQ29weXJpZ2h0IDIwMjQgRm9udGljb25zLCBJbmMuLS0+PHBhdGggZD0iTTM4NCA4MGM4LjggMCAxNiA3LjIgMTYgMTZsMCAzMjBjMCA4LjgtNy4yIDE2LTE2IDE2TDY0IDQzMmMtOC44IDAtMTYtNy4yLTE2LTE2TDQ4IDk2YzAtOC44IDcuMi0xNiAxNi0xNmwzMjAgMHpNNjQgMzJDMjguNyAzMiAwIDYwLjcgMCA5NkwwIDQxNmMwIDM1LjMgMjguNyA2NCA2NCA2NGwzMjAgMGMzNS4zIDAgNjQtMjguNyA2NC02NGwwLTMyMGMwLTM1LjMtMjguNy02NC02NC02NEw2NCAzMnoiLz48L3N2Zz4="></button><div class="${this.layer.hasError ? 'gg-icon gg-small gg-opacity' : 'hidden'}" tip="${this.layer.errorMessage ? this.layer.errorMessage : 'Error on layer'}"><img alt="Error on layer" src="icons/error.svg"></div><div class="${this.isVisibleInCurrentResolution() ? 'label-container' : 'label-container label-out-resolution'}"><button class="${this.layer.active ? 'gg-icon-button gg-small gg-selected' : 'gg-icon-button gg-small gg-opacity'}" onclick="${() => this.toggle()}"><span i18n="${this.layer.name}" class="gg-tree-label">${this.layer.name}</span></button> <button class="${this.layer.active && this.layer instanceof LayerWms && !this.isVisibleInCurrentResolution() ? 'gg-icon-button gg-small resolution-tool' : 'hidden'}" tip="Zoom to visible resolution" onclick="${() => this.zoomToVisibleResolution()}"><img alt="Zoom to visible resolution" src="icons/zoom.svg"></button> <img class="${this.layer.active && this.iconUrl ? 'legend-icon' : 'hidden'}" alt="${'Icon for ' + this.layer.name}" src="${this.iconUrl}" loading="lazy" crossorigin="${this.getCrossOrigin(this.iconUrl)}"></div><button class="${this.layer.active && this.layer instanceof LayerLocalFile ? 'gg-icon-button gg-small gg-opacity tool' : 'hidden'}" tip="Zoom to full extent" onclick="${() => this.zoomToFullExtent()}"><img alt="Zoom to full extent" src="icons/zoom.svg"></button> <button class="${this.layer.active && this.layer instanceof LayerLocalFile ? 'gg-icon-button gg-small gg-opacity tool' : 'hidden'}" tip="Convert to drawing" onclick="${() => this.convertToDrawing()}"><img alt="draw-icon" src="icons/draw.svg"></button> <button class="${this.getButtonClass('swipedLeft')}" tip="Swipe layer to the left" onclick="${() => this.layer.swiped = (this.layer.swiped === 'left') ? 'no' : 'left'}"><img alt="Swipe layer to the left" src="icons/swipe-left.svg"></button> <button class="${this.getButtonClass('swipedRight')}" tip="Swipe layer to the right" onclick="${() => this.layer.swiped = (this.layer.swiped === 'right') ? 'no' : 'right'}"><img alt="Swipe layer to the right" src="icons/swipe-right.svg"></button> <button id="opacity" class="${this.getButtonClass('opacity')}" tip="Control opacity"><img alt="Control opacity" src="icons/opacity.svg"></button> <button id="filter" class="${this.getButtonClass('filter')}" tip="Filter layer"><img alt="Filter layer" src="icons/filter.svg"></button> <button id="advanced-filter" class="${this.getButtonClass('advanced-filter')}" tip="Open advanced filter tool" onclick="${() => this.state.interface.advancedFilterPanelVisible = !this.state.interface.advancedFilterPanelVisible}"><img alt="Advanced filter" src="icons/advanced-filter.svg"></button> <button id="timeRestriction" class="${this.getButtonClass('timeRestriction')}" tip="Define time restriction on layer"><img alt="Define time restriction on layer" src="icons/clock.svg"></button> <button class="${this.getButtonClass('snappable')}" onclick="${() => this.toggleSnap()}" tip="Snap to layer features"><img alt="Enable snapping" src="icons/snapping.svg"></button> <button class="${this.hasLegend ? (this.layer.isLegendExpanded ? 'gg-icon-button gg-small tool' : 'gg-icon-button gg-small gg-opacity tool') : 'hidden'}" tip="Toggle legend" onclick="${() => this.toggleLegend()}"><img alt="Toggle legend" src="icons/legend.svg" loading="lazy"></button> <button class="${this.layer.hasMetadata ? 'metadata gg-icon-button gg-small gg-opacity tool' : 'hidden'}" tip="Show metadata" onclick="${() => this.showMetadata()}"><img alt="Metadata" src="icons/info.svg"></button> <button class="${this.getButtonClass('editable')}" tip="Edit layer" onclick="${() => this.toggleEditPanel()}"><img alt="Edit layer" src="icons/edit.svg"></button> <button id="drag-button" class="${this.getButtonClass('draggable')}" tip="Move"><img alt="Move layer" src="icons/drag.svg"></button> <button class="${this.getButtonClass('removable')}" tip="Remove layer" onclick="${() => this.deleteLayer()}"><img alt="Remove layer" src="icons/trash.svg"></button></header>${Object.keys(this.legendUrls).map((l) => uHtml `<div class="${this.isLegendExpanded ? 'legend' : 'hidden'}"><div class="gg-spacer gg-small"></div><img alt="${'Legend for ' + l}" src="${this.legendUrls[l]}" loading="lazy" crossorigin="${this.getCrossOrigin(this.legendUrls[l])}"></div>`)}<div class="${this.layer instanceof LayerLocalFile && this.isLegendExpanded ? 'legend-file' : 'legend-file hidden'}"><div class="gg-spacer gg-small"></div><div class="gg-spacer gg-small"></div><div><span i18n="File from">File from</span> <span>${this.layer.lastModifiedDate}</span> <span>[</span> <span>${this.layer._features?.length}</span> <span i18n="features">features</span> <span>]</span></div></div></div>
|
|
38
38
|
${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
|
|
39
39
|
};
|
|
40
40
|
iconUrl = null;
|
|
@@ -168,6 +168,12 @@ ${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
|
|
|
168
168
|
});
|
|
169
169
|
this.subscribe('treeview.advanced', () => this.refreshRender(this.layer));
|
|
170
170
|
this.subscribe('position', () => this.refreshLegendsAndStyle(this.layer));
|
|
171
|
+
this.subscribe('editing.layer', (oldLayer, newLayer) => {
|
|
172
|
+
if (oldLayer?.treeItemId === this.layer.treeItemId)
|
|
173
|
+
this.refreshRender(this.layer);
|
|
174
|
+
if (newLayer?.treeItemId === this.layer.treeItemId)
|
|
175
|
+
this.refreshRender(this.layer);
|
|
176
|
+
});
|
|
171
177
|
}
|
|
172
178
|
refreshLegendsAndStyle(layer) {
|
|
173
179
|
if (layer !== this.layer) {
|
package/models/gmf.d.ts
CHANGED
|
@@ -80,14 +80,30 @@ export interface GMFServerOgc {
|
|
|
80
80
|
url: string;
|
|
81
81
|
wfsSupport: boolean;
|
|
82
82
|
urlWfs?: string;
|
|
83
|
-
oapifSupport?: boolean;
|
|
84
|
-
urlOapif?: string;
|
|
85
83
|
type: GMFServerOgcType;
|
|
86
84
|
imageType: string;
|
|
87
85
|
attributes?: GMFServerOgcAttributes;
|
|
86
|
+
uses?: GMFServerOgcServices;
|
|
88
87
|
}
|
|
89
88
|
export type GMFServerOgcAttributes = Record<string, GMFServerOgcObjectAttributes>;
|
|
90
89
|
export type GMFServerOgcObjectAttributes = Record<string, GMFServerOgcColumnAttributes>;
|
|
91
90
|
export interface GMFServerOgcColumnAttributes {
|
|
92
91
|
alias: string;
|
|
93
92
|
}
|
|
93
|
+
export declare const supportedOgcServicesForMap: string[];
|
|
94
|
+
export declare const supportedOgcServicesForQuery: string[];
|
|
95
|
+
export declare const supportedOgcServicesForEdit: string[];
|
|
96
|
+
export type GMFServerOgcServices = {
|
|
97
|
+
map?: {
|
|
98
|
+
protocol: (typeof supportedOgcServicesForMap)[number];
|
|
99
|
+
url: string;
|
|
100
|
+
};
|
|
101
|
+
query?: {
|
|
102
|
+
protocol: (typeof supportedOgcServicesForQuery)[number];
|
|
103
|
+
url: string;
|
|
104
|
+
};
|
|
105
|
+
edit?: {
|
|
106
|
+
protocol: (typeof supportedOgcServicesForEdit)[number];
|
|
107
|
+
url: string;
|
|
108
|
+
};
|
|
109
|
+
};
|
package/models/gmf.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const supportedOgcServicesForMap = ['WMS']; // Not supported yet: `OGC API - Maps`
|
|
2
|
+
export const supportedOgcServicesForQuery = ['WMS/GetFeatureInfo', 'WFS/GetFeature']; // Not supported yet: `OGC API - Features`
|
|
3
|
+
export const supportedOgcServicesForEdit = ['OGC API - Features'];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import Layer from './layer.js';
|
|
2
|
+
import BaseLayer from './baselayer.js';
|
|
3
|
+
import LayerWms from './layerwms.js';
|
|
4
|
+
declare const editableLayer: readonly [typeof LayerWms];
|
|
5
|
+
export type EditableLayer = InstanceType<(typeof editableLayer)[number]>;
|
|
6
|
+
export declare const isEditableLayer: (layer: Layer | BaseLayer) => layer is EditableLayer;
|
|
7
|
+
export {};
|
|
@@ -37,7 +37,6 @@ export type LayerWmsOptions = {
|
|
|
37
37
|
time?: ITimeOptions;
|
|
38
38
|
snappingConfig?: ISnappingConfig;
|
|
39
39
|
timeAttribute?: string;
|
|
40
|
-
editable?: string;
|
|
41
40
|
enumeratedAttributes?: string[];
|
|
42
41
|
};
|
|
43
42
|
declare class LayerWms extends Layer implements ILayerWithLegend, ILayerWithFilter, ILayerWithTime {
|
|
@@ -69,7 +68,7 @@ declare class LayerWms extends Layer implements ILayerWithLegend, ILayerWithFilt
|
|
|
69
68
|
timeRestriction?: string;
|
|
70
69
|
timeAttribute?: string;
|
|
71
70
|
enumeratedAttributes?: string[];
|
|
72
|
-
|
|
71
|
+
editLayers?: string[];
|
|
73
72
|
constructor(id: LayerId, name: string, order: number, ogcServer: ServerOgc, options?: TreeItemDefinition | LayerWmsOptions);
|
|
74
73
|
clone(): LayerWms;
|
|
75
74
|
static isResolutionRangeRestricted(minResolution: number | undefined, maxResolution: number | undefined): boolean | 0 | undefined;
|
|
@@ -41,7 +41,9 @@ class LayerWms extends Layer {
|
|
|
41
41
|
timeRestriction;
|
|
42
42
|
timeAttribute;
|
|
43
43
|
enumeratedAttributes;
|
|
44
|
-
|
|
44
|
+
// The corresponding layer name(s) in the edit service.
|
|
45
|
+
// This list is populated by the ogcApiFeaturesManager during initialization.
|
|
46
|
+
editLayers;
|
|
45
47
|
constructor(id, name, order, ogcServer, options) {
|
|
46
48
|
let opts = options ?? {};
|
|
47
49
|
opts = LayerWms.isTreeItemDefinition(opts) ? LayerWms.getOptionsFromDefinition(opts) : opts;
|
|
@@ -65,15 +67,9 @@ class LayerWms extends Layer {
|
|
|
65
67
|
this.queryLayersRanges = opts?.queryLayersRanges || {};
|
|
66
68
|
this.timeOptions = opts?.time;
|
|
67
69
|
this.timeAttribute = opts?.timeAttribute;
|
|
68
|
-
this.editable = opts?.editable;
|
|
69
70
|
this.snapOptions = opts?.snappingConfig;
|
|
70
71
|
this.snapActive = this.snapOptions !== undefined;
|
|
71
72
|
this.enumeratedAttributes = opts?.enumeratedAttributes;
|
|
72
|
-
if (this.editable && (!this.ogcServer.oapifSupport || this.ogcServer.urlOapif?.length === 0)) {
|
|
73
|
-
this.hasError = true;
|
|
74
|
-
this.errorMessage = 'This layer is defined as editable but no Url for OgcApiFeatures service has been defined.';
|
|
75
|
-
this.editable = undefined;
|
|
76
|
-
}
|
|
77
73
|
this.setDefaultTimeRestriction();
|
|
78
74
|
}
|
|
79
75
|
clone() {
|
|
@@ -102,12 +98,12 @@ class LayerWms extends Layer {
|
|
|
102
98
|
time: this.timeOptions,
|
|
103
99
|
snappingConfig: this.snapOptions,
|
|
104
100
|
timeAttribute: this.timeAttribute,
|
|
105
|
-
editable: this.editable,
|
|
106
101
|
enumeratedAttributes: this.enumeratedAttributes
|
|
107
102
|
};
|
|
108
103
|
const clonedObject = new LayerWms(this.id, this.name, this.order, this.ogcServer, options);
|
|
109
104
|
clonedObject.filter = this.filter;
|
|
110
105
|
clonedObject.activeState = this.activeState;
|
|
106
|
+
clonedObject.editLayers = this.editLayers;
|
|
111
107
|
clonedObject.timeRestriction = this.timeRestriction;
|
|
112
108
|
return clonedObject;
|
|
113
109
|
}
|
package/models/main.d.ts
CHANGED
|
@@ -6,9 +6,12 @@ export { default as CustomTheme } from './customtheme.js';
|
|
|
6
6
|
export type { FilterOperator, AttributeTypeGroup, LogicalFilterOperator } from './filter.js';
|
|
7
7
|
export { filterOperatorValues, filterOperators, isFilterOperator, isValuelessFilterOperator, isTwoSidedFilterOperator, isListFilterOperator, operatorsByAttributeTypeGroup, logicalFilterOperators, isLogicalFilterOperator } from './filter.js';
|
|
8
8
|
export type { GeoramaTreeItem, GeoramaTheme } from './georama.js';
|
|
9
|
-
export type { GMFMetadata, GMFChildLayer, GMFTreeItem, GMFThemeFunctionality, GMFThemeFunctionalities, GMFTheme, GMFGroup, GMFServerOgcType, GMFServerOgc, GMFServerOgcAttributes, GMFServerOgcObjectAttributes, GMFServerOgcColumnAttributes } from './gmf.js';
|
|
9
|
+
export type { GMFMetadata, GMFChildLayer, GMFTreeItem, GMFThemeFunctionality, GMFThemeFunctionalities, GMFTheme, GMFGroup, GMFServerOgcType, GMFServerOgc, GMFServerOgcAttributes, GMFServerOgcObjectAttributes, GMFServerOgcColumnAttributes, GMFServerOgcServices } from './gmf.js';
|
|
10
|
+
export { supportedOgcServicesForMap, supportedOgcServicesForQuery, supportedOgcServicesForEdit } from './gmf.js';
|
|
10
11
|
export type { LayerId, TreeItemDefinition, ThemeDefinition, BasemapDefinition } from './layerdefinitions.js';
|
|
11
12
|
export { default as BaseLayer } from './layers/baselayer.js';
|
|
13
|
+
export type { EditableLayer } from './layers/editablelayer.js';
|
|
14
|
+
export { isEditableLayer } from './layers/editablelayer.js';
|
|
12
15
|
export type { GroupLayerOptions } from './layers/grouplayer.js';
|
|
13
16
|
export { default as GroupLayer } from './layers/grouplayer.js';
|
|
14
17
|
export type { default as ILayerWithFilter } from './layers/ilayerwithfilter.js';
|
|
@@ -35,14 +38,16 @@ export { default as ThemeLayer } from './layers/themelayer.js';
|
|
|
35
38
|
export { default as ThemeLayerExternal } from './layers/themelayerexternal.js';
|
|
36
39
|
export type { TimeAwareLayer } from './layers/timeawarelayer.js';
|
|
37
40
|
export { isTimeAwareLayer } from './layers/timeawarelayer.js';
|
|
41
|
+
export { OapifLayer } from './oapiflayer.js';
|
|
42
|
+
export type { OapifPropertyTypes, OapifPropertyFormats, OapifSchemaResponse, OapifSchemaPropertyOptions, OapifReferenceList, OapifCollection, EditingPermission } from './oapiftypes.js';
|
|
43
|
+
export { oapifNumericFormats, oapifStringFormats, oapifTemporalFormats, oapifPropertyFormatList, supportedGeometryTypesForEditing, EditingOperations } from './oapiftypes.js';
|
|
38
44
|
export type { SearchResultsActions } from './searchresult.js';
|
|
39
45
|
export type { SelectionTool, SelectionMode } from './selection.js';
|
|
40
46
|
export { default as SelectionParam } from './selectionparam.js';
|
|
41
47
|
export { default as ServerOgc } from './serverogc.js';
|
|
42
48
|
export type { HttpMethod, OgcApiLinksResponse } from './serverogcapi.js';
|
|
43
|
-
export { default as ServerOgcApi, OgcApiDefaultEncoding } from './serverogcapi.js';
|
|
44
|
-
export
|
|
45
|
-
export { default as ServerOgcApiFeatures, oapifNumericTypes, oapifTextTypes, oapifTemporalTypes, oapifPropertyTypesList } from './serverogcapifeatures.js';
|
|
49
|
+
export { default as ServerOgcApi, OgcApiDefaultEncoding, OgcApiGeoJsonEncoding, OgcApiSchemaEncoding } from './serverogcapi.js';
|
|
50
|
+
export { default as ServerOgcApiFeatures } from './serverogcapifeatures.js';
|
|
46
51
|
export type { LayerAttribute } from './serverwfs.js';
|
|
47
52
|
export { default as ServerWfs } from './serverwfs.js';
|
|
48
53
|
export { default as Theme } from './theme.js';
|
package/models/main.js
CHANGED
|
@@ -4,7 +4,9 @@ export { default as BasemapOsm } from './basemaps/basemaposm.js';
|
|
|
4
4
|
export { default as BasemapSwisstopoVectorTiles } from './basemaps/basemapswisstopovectortiles.js';
|
|
5
5
|
export { default as CustomTheme } from './customtheme.js';
|
|
6
6
|
export { filterOperatorValues, filterOperators, isFilterOperator, isValuelessFilterOperator, isTwoSidedFilterOperator, isListFilterOperator, operatorsByAttributeTypeGroup, logicalFilterOperators, isLogicalFilterOperator } from './filter.js';
|
|
7
|
+
export { supportedOgcServicesForMap, supportedOgcServicesForQuery, supportedOgcServicesForEdit } from './gmf.js';
|
|
7
8
|
export { default as BaseLayer } from './layers/baselayer.js';
|
|
9
|
+
export { isEditableLayer } from './layers/editablelayer.js';
|
|
8
10
|
export { default as GroupLayer } from './layers/grouplayer.js';
|
|
9
11
|
export { default as Layer } from './layers/layer.js';
|
|
10
12
|
export { default as LayerCog } from './layers/layercog.js';
|
|
@@ -22,10 +24,12 @@ export { isSnappableLayer } from './layers/snappablelayer.js';
|
|
|
22
24
|
export { default as ThemeLayer } from './layers/themelayer.js';
|
|
23
25
|
export { default as ThemeLayerExternal } from './layers/themelayerexternal.js';
|
|
24
26
|
export { isTimeAwareLayer } from './layers/timeawarelayer.js';
|
|
27
|
+
export { OapifLayer } from './oapiflayer.js';
|
|
28
|
+
export { oapifNumericFormats, oapifStringFormats, oapifTemporalFormats, oapifPropertyFormatList, supportedGeometryTypesForEditing, EditingOperations } from './oapiftypes.js';
|
|
25
29
|
export { default as SelectionParam } from './selectionparam.js';
|
|
26
30
|
export { default as ServerOgc } from './serverogc.js';
|
|
27
|
-
export { default as ServerOgcApi, OgcApiDefaultEncoding } from './serverogcapi.js';
|
|
28
|
-
export { default as ServerOgcApiFeatures
|
|
31
|
+
export { default as ServerOgcApi, OgcApiDefaultEncoding, OgcApiGeoJsonEncoding, OgcApiSchemaEncoding } from './serverogcapi.js';
|
|
32
|
+
export { default as ServerOgcApiFeatures } from './serverogcapifeatures.js';
|
|
29
33
|
export { default as ServerWfs } from './serverwfs.js';
|
|
30
34
|
export { default as Theme } from './theme.js';
|
|
31
35
|
export { xmlNumberTypesStrList, xmlStringTypesStrList, xmlDatetimeTypesStrList, xmlGeometryTypesStrList, xmlTypesStrList, isStringNumeric, isString, isNumber, isDate, isGeometry, sanitizeGeometryType, isAreaLikeGeometryTypeOrUnknown, typeGroupFromAttributeType } from './xmlTypes.js';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import ServerOgc from './serverogc.js';
|
|
2
|
+
import { EditingPermission, OapifCollection } from './oapiftypes.js';
|
|
3
|
+
import OgcApiFeaturesSchema from '../tools/ogcapi/ogcapifeaturesschema.js';
|
|
4
|
+
import { Type as olGeometryType, GeometryLayout as olGeometryLayout } from 'ol/geom/Geometry.js';
|
|
5
|
+
export declare class OapifLayer {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly title?: string;
|
|
8
|
+
readonly description?: string;
|
|
9
|
+
readonly server: ServerOgc;
|
|
10
|
+
storageCrs?: string;
|
|
11
|
+
geometryLayout?: olGeometryLayout;
|
|
12
|
+
schema?: OgcApiFeaturesSchema;
|
|
13
|
+
permissions?: EditingPermission[];
|
|
14
|
+
constructor(server: ServerOgc, collection: OapifCollection);
|
|
15
|
+
get geometryType(): olGeometryType | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Generates a unique layer name by combining the server name and collection id
|
|
18
|
+
*/
|
|
19
|
+
get uniqueLayerName(): string;
|
|
20
|
+
/**
|
|
21
|
+
* Validity decides if this layer can be used for editing
|
|
22
|
+
*/
|
|
23
|
+
get valid(): boolean;
|
|
24
|
+
hasPermission(permission: EditingPermission): boolean;
|
|
25
|
+
}
|