@geogirafe/lib-geoportal 1.3.0-dev.3053452205 → 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.
Files changed (86) hide show
  1. package/LICENSE +1 -0
  2. package/assets/i18n/de.json +33 -3
  3. package/assets/i18n/en.json +32 -2
  4. package/assets/i18n/fr.json +34 -4
  5. package/assets/i18n/it.json +36 -6
  6. package/assets/icons/edit.svg +1 -1
  7. package/assets/icons/lock.svg +1 -0
  8. package/components/cross-section/cross-section-settings/component.js +1 -1
  9. package/components/edit/component.d.ts +52 -36
  10. package/components/edit/component.js +340 -292
  11. package/components/edit/editcomponentstate.d.ts +1 -0
  12. package/components/edit/editcomponentstate.js +1 -0
  13. package/components/edit/editform/component.d.ts +34 -4
  14. package/components/edit/editform/component.js +224 -37
  15. package/components/edit/editform/style.css +51 -16
  16. package/components/edit/geometryedithelper.d.ts +47 -0
  17. package/components/edit/geometryedithelper.js +324 -0
  18. package/components/edit/style.css +71 -28
  19. package/components/main.d.ts +1 -1
  20. package/components/main.js +1 -1
  21. package/components/print/component.d.ts +1 -1
  22. package/components/treeview/tools/treeviewelement.d.ts +1 -0
  23. package/components/treeview/tools/treeviewelement.js +22 -0
  24. package/components/treeview/treeviewitem/component.js +7 -1
  25. package/models/gmf.d.ts +18 -2
  26. package/models/gmf.js +3 -1
  27. package/models/layers/editablelayer.d.ts +7 -0
  28. package/models/layers/editablelayer.js +7 -0
  29. package/models/layers/layerwms.d.ts +1 -2
  30. package/models/layers/layerwms.js +4 -8
  31. package/models/main.d.ts +9 -4
  32. package/models/main.js +6 -2
  33. package/models/oapiflayer.d.ts +25 -0
  34. package/models/oapiflayer.js +36 -0
  35. package/models/oapiftypes.d.ts +71 -0
  36. package/models/oapiftypes.js +29 -0
  37. package/models/serverogc.d.ts +5 -3
  38. package/models/serverogc.js +19 -6
  39. package/models/serverogcapi.d.ts +2 -0
  40. package/models/serverogcapi.js +2 -0
  41. package/models/serverogcapifeatures.d.ts +5 -62
  42. package/models/serverogcapifeatures.js +8 -4
  43. package/package.json +1 -1
  44. package/templates/index.html +1 -0
  45. package/templates/public/about.json +1 -1
  46. package/tools/app/geogirafeapp.js +2 -2
  47. package/tools/drawing/olDrawing.js +2 -22
  48. package/tools/drawing/shapeConstraints.d.ts +2 -1
  49. package/tools/drawing/shapeConstraints.js +18 -2
  50. package/tools/main.d.ts +7 -5
  51. package/tools/main.js +7 -5
  52. package/tools/ogcapi/ogcapiclient.d.ts +7 -3
  53. package/tools/ogcapi/ogcapiclient.js +49 -4
  54. package/tools/ogcapi/ogcapiconformance.d.ts +2 -2
  55. package/tools/ogcapi/ogcapiconformance.js +7 -13
  56. package/tools/ogcapi/ogcapifeaturesclient.d.ts +65 -30
  57. package/tools/ogcapi/ogcapifeaturesclient.js +265 -139
  58. package/tools/ogcapi/ogcapifeaturesclientgeorama.d.ts +0 -5
  59. package/tools/ogcapi/ogcapifeaturesclientgeorama.js +0 -11
  60. package/tools/ogcapi/ogcapifeaturesclientqgis.d.ts +8 -0
  61. package/tools/ogcapi/ogcapifeaturesclientqgis.js +13 -0
  62. package/tools/ogcapi/ogcapifeaturesmanager.d.ts +61 -8
  63. package/tools/ogcapi/ogcapifeaturesmanager.js +179 -30
  64. package/tools/ogcapi/ogcapifeaturesschema.d.ts +31 -13
  65. package/tools/ogcapi/ogcapifeaturesschema.js +69 -39
  66. package/tools/ogcapi/ogcapifeaturesschemaproperty.d.ts +44 -0
  67. package/tools/ogcapi/ogcapifeaturesschemaproperty.js +137 -0
  68. package/tools/ogcapi/ogcapifeaturesschemavalidator.d.ts +22 -0
  69. package/tools/ogcapi/ogcapifeaturesschemavalidator.js +121 -0
  70. package/tools/state/state.d.ts +6 -0
  71. package/tools/state/state.js +4 -0
  72. package/tools/themes/themesmanager.d.ts +10 -3
  73. package/tools/themes/themesmanager.js +29 -9
  74. package/tools/time/layertimeformatter.d.ts +0 -5
  75. package/tools/time/layertimeformatter.js +10 -19
  76. package/tools/utils/dateutils.d.ts +40 -0
  77. package/tools/utils/dateutils.js +111 -0
  78. package/tools/utils/utils.d.ts +4 -0
  79. package/tools/utils/utils.js +12 -0
  80. package/tools/wfs/wfsmanager.js +3 -0
  81. package/tools/wms/wmsclient.d.ts +1 -0
  82. package/tools/wms/wmsclient.js +4 -0
  83. package/tools/ogcapi/demolayers.d.ts +0 -1
  84. package/tools/ogcapi/demolayers.js +0 -99
  85. package/tools/ogcapi/ogcapifeaturesclientgmf.d.ts +0 -13
  86. package/tools/ogcapi/ogcapifeaturesclientgmf.js +0 -30
@@ -0,0 +1,324 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ import { Draw, Modify, Select } from 'ol/interaction.js';
3
+ import VectorLayer from 'ol/layer/Vector.js';
4
+ import VectorSource from 'ol/source/Vector.js';
5
+ import { Fill, RegularShape, Stroke, Style, Circle as CircleStyle } from 'ol/style.js';
6
+ import { extractVerticesFromGeometry, getGeometryForRendering } from '../../tools/drawing/shapeConstraints.js';
7
+ import { toRadians } from 'ol/math.js';
8
+ import { Geometry, Point, MultiPoint, MultiPolygon, MultiLineString } from 'ol/geom.js';
9
+ import { bbox } from 'ol/loadingstrategy.js';
10
+ import { colorToRgbaArray, rgbaArrayToString } from '../../tools/utils/utils.js';
11
+ import { singleClick } from 'ol/events/condition.js';
12
+ /**
13
+ * Helper class for map interactions in the edit component.
14
+ * Controls map interactions for selecting a feature, drawing, and modifying geometries.
15
+ */
16
+ export default class GeometryEditingHelper {
17
+ context;
18
+ map;
19
+ draw;
20
+ modify;
21
+ select;
22
+ // This layer provides selectable features in the map
23
+ selectionLayer;
24
+ // This layer is used to draw and modify the feature geometry
25
+ drawingLayer;
26
+ drawingSource;
27
+ multiGeomDrawingFeature;
28
+ originalGeometries = new Map();
29
+ geometryIsModified = false;
30
+ onSelectCallback;
31
+ onDrawCallback;
32
+ canExecuteCallback;
33
+ constructor(context, onSelectCallback, onDrawCallback, canExecuteCallback) {
34
+ this.context = context;
35
+ this.map = this.context.mapManager.getMap();
36
+ this.onSelectCallback = onSelectCallback;
37
+ this.onDrawCallback = onDrawCallback;
38
+ this.canExecuteCallback = canExecuteCallback;
39
+ }
40
+ updateMapInteractionsByState(editState) {
41
+ switch (editState) {
42
+ case 'Idle':
43
+ this.disableAllMapInteractions();
44
+ return;
45
+ case 'LayerSelected':
46
+ this.enableSelectFeatureInteraction();
47
+ return;
48
+ case 'FeatureSelected':
49
+ this.enableGeometryModifyInteractions();
50
+ return;
51
+ case 'CreateGeometry':
52
+ this.enableGeometryDrawingInteractions();
53
+ return;
54
+ }
55
+ }
56
+ disableAllMapInteractions() {
57
+ this.draw?.setActive(false);
58
+ this.select?.setActive(false);
59
+ this.modify?.setActive(false);
60
+ }
61
+ enableSelectFeatureInteraction() {
62
+ this.draw?.setActive(false);
63
+ this.select?.setActive(true);
64
+ this.modify?.setActive(false);
65
+ }
66
+ enableGeometryDrawingInteractions() {
67
+ this.draw?.setActive(true);
68
+ this.select?.setActive(false);
69
+ this.modify?.setActive(false);
70
+ }
71
+ enableGeometryModifyInteractions() {
72
+ this.draw?.setActive(false);
73
+ this.select?.setActive(true);
74
+ this.modify?.setActive(true);
75
+ }
76
+ setupMapInteractions(layer) {
77
+ this.reset();
78
+ if (!layer) {
79
+ return;
80
+ }
81
+ this.setupSelectInteraction(layer);
82
+ this.drawingSource = new VectorSource({});
83
+ this.drawingLayer = new VectorLayer({
84
+ source: this.drawingSource,
85
+ style: (f) => this.getEditStyle(f),
86
+ zIndex: 2002
87
+ });
88
+ this.map.addLayer(this.drawingLayer);
89
+ this.setupDrawInteraction(layer);
90
+ this.setupModifyInteraction();
91
+ }
92
+ setupSelectInteraction(layer) {
93
+ const selectionSource = new VectorSource({
94
+ loader: async (extent, _resolution, projection) => {
95
+ const features = await this.context.ogcApiFeaturesManager.getItems(layer, {
96
+ crsCode: projection.getCode(),
97
+ bbox: extent
98
+ });
99
+ if (features) {
100
+ selectionSource.addFeatures(features);
101
+ }
102
+ },
103
+ strategy: bbox
104
+ });
105
+ this.selectionLayer = new VectorLayer({
106
+ source: selectionSource,
107
+ style: this.createBaseStyle(true),
108
+ zIndex: 2001
109
+ });
110
+ this.map.addLayer(this.selectionLayer);
111
+ // Interactions - Select
112
+ this.select = new Select({
113
+ layers: [this.selectionLayer],
114
+ condition: (evt) => singleClick(evt) && this.canExecuteCallback('map.select'),
115
+ style: null,
116
+ hitTolerance: 10,
117
+ multi: false
118
+ });
119
+ this.select.on('select', (evt) => {
120
+ this.onSelectCallback(evt.selected);
121
+ this.select?.getFeatures()?.clear();
122
+ });
123
+ this.map.addInteraction(this.select);
124
+ this.select.setActive(false);
125
+ }
126
+ setupDrawInteraction(layer) {
127
+ if (!layer.geometryType) {
128
+ console.warn('The geometry type of the edit layer is not defined, falling back to `Point`');
129
+ }
130
+ const geometryType = layer.geometryType ?? 'Point';
131
+ // Interactions - Draw
132
+ this.draw = new Draw({
133
+ source: this.drawingSource,
134
+ condition: () => this.canExecuteCallback('map.draw'),
135
+ type: geometryType,
136
+ geometryLayout: layer.geometryLayout,
137
+ stopClick: true,
138
+ style: (f) => this.getEditStyle(f)
139
+ });
140
+ this.draw.on('drawend', (evt) => {
141
+ this.geometryIsModified = true;
142
+ if (geometryType.includes('Multi')) {
143
+ evt.stopPropagation();
144
+ this.addDrawingToMultiGeometry(evt.feature);
145
+ }
146
+ else {
147
+ this.onDrawCallback(evt.feature);
148
+ }
149
+ });
150
+ this.draw.setActive(false);
151
+ this.map.addInteraction(this.draw);
152
+ }
153
+ setupModifyInteraction() {
154
+ // Interactions - Modify
155
+ this.modify = new Modify({
156
+ source: this.drawingSource,
157
+ condition: () => this.canExecuteCallback('map.modify'),
158
+ style: (f) => this.getEditStyle(f)
159
+ });
160
+ this.modify.on('modifystart', (event) => {
161
+ this.geometryIsModified = true;
162
+ event.features.forEach((feature) => {
163
+ const geometry = feature.getGeometry();
164
+ if (geometry && !this.originalGeometries.has(feature)) {
165
+ this.originalGeometries.set(feature, geometry.clone());
166
+ }
167
+ });
168
+ });
169
+ this.modify.setActive(false);
170
+ this.map.addInteraction(this.modify);
171
+ }
172
+ addDrawingToMultiGeometry(drawingFeature) {
173
+ const geometry = drawingFeature.getGeometry();
174
+ if (this.multiGeomDrawingFeature && geometry) {
175
+ const multiGeometry = this.multiGeomDrawingFeature.getGeometry();
176
+ if (multiGeometry instanceof MultiPoint) {
177
+ multiGeometry.appendPoint(geometry.getPoint(0));
178
+ }
179
+ if (multiGeometry instanceof MultiLineString) {
180
+ multiGeometry.appendLineString(geometry.getLineString(0));
181
+ }
182
+ if (multiGeometry instanceof MultiPolygon) {
183
+ multiGeometry.appendPolygon(geometry.getPolygon(0));
184
+ }
185
+ this.multiGeomDrawingFeature.setGeometry(multiGeometry);
186
+ return;
187
+ }
188
+ this.multiGeomDrawingFeature = drawingFeature;
189
+ }
190
+ refreshLayers() {
191
+ this.geometryIsModified = false;
192
+ this.multiGeomDrawingFeature = undefined;
193
+ this.originalGeometries.clear();
194
+ this.selectionLayer?.getSource()?.refresh();
195
+ this.drawingLayer?.getSource()?.clear();
196
+ }
197
+ reset() {
198
+ this.geometryIsModified = false;
199
+ this.multiGeomDrawingFeature = undefined;
200
+ this.originalGeometries.clear();
201
+ if (this.select)
202
+ this.map.removeInteraction(this.select);
203
+ if (this.draw)
204
+ this.map.removeInteraction(this.draw);
205
+ if (this.modify)
206
+ this.map.removeInteraction(this.modify);
207
+ this.select = undefined;
208
+ this.draw = undefined;
209
+ this.modify = undefined;
210
+ if (this.drawingLayer) {
211
+ this.map.removeLayer(this.drawingLayer);
212
+ this.drawingSource?.clear();
213
+ this.drawingLayer = undefined;
214
+ this.drawingSource = undefined;
215
+ }
216
+ if (this.selectionLayer) {
217
+ this.map.removeLayer(this.selectionLayer);
218
+ this.selectionLayer = undefined;
219
+ }
220
+ }
221
+ finishDrawing() {
222
+ return this.multiGeomDrawingFeature ?? this.draw?.finishDrawing() ?? undefined;
223
+ }
224
+ revertModifications() {
225
+ this.originalGeometries.forEach((geometry, feature) => {
226
+ feature.setGeometry(geometry);
227
+ });
228
+ this.originalGeometries.clear();
229
+ }
230
+ setEditFeature(feature) {
231
+ if (this.geometryIsModified) {
232
+ this.revertModifications();
233
+ this.geometryIsModified = false;
234
+ }
235
+ this.select?.getFeatures().clear();
236
+ this.drawingSource?.clear();
237
+ this.multiGeomDrawingFeature = undefined;
238
+ if (feature) {
239
+ this.drawingSource?.addFeature(feature);
240
+ }
241
+ }
242
+ getEditFeature() {
243
+ return this.drawingSource?.getFeatures()[0];
244
+ }
245
+ registerInteractions(componentName) {
246
+ this.context.userInteractionManager.registerListener('map.draw', true, componentName);
247
+ this.context.userInteractionManager.registerListener('map.modify', true, componentName);
248
+ this.context.userInteractionManager.registerListener('map.snap', true, componentName);
249
+ this.context.userInteractionManager.registerListener('map.select', true, componentName);
250
+ this.context.userInteractionManager.registerListener('map.contextmenu', true, componentName);
251
+ this.context.stateManager.state.layers.isSnappingActive = true;
252
+ }
253
+ unregisterInteractions(componentName) {
254
+ this.disableAllMapInteractions();
255
+ this.context.userInteractionManager.unregisterListener('map.draw', componentName);
256
+ this.context.userInteractionManager.unregisterListener('map.modify', componentName);
257
+ this.context.userInteractionManager.unregisterListener('map.snap', componentName);
258
+ this.context.userInteractionManager.unregisterListener('map.select', componentName);
259
+ this.context.userInteractionManager.unregisterListener('map.contextmenu', componentName);
260
+ this.context.stateManager.state.layers.isSnappingActive = false;
261
+ }
262
+ createBaseStyle(addPointStyle = false) {
263
+ const drawingConfig = this.context.configManager.Config.drawing;
264
+ const rgbaColor = colorToRgbaArray(drawingConfig.defaultFillColor);
265
+ if (rgbaColor) {
266
+ rgbaColor[3] = 0.1;
267
+ }
268
+ const transparentFillColor = rgbaArrayToString(rgbaColor ?? []) ?? drawingConfig.defaultFillColor;
269
+ const stroke = new Stroke({
270
+ color: drawingConfig.defaultStrokeColor,
271
+ width: drawingConfig.defaultStrokeWidth,
272
+ lineCap: 'round'
273
+ });
274
+ const fill = new Fill({
275
+ color: transparentFillColor
276
+ });
277
+ const style = new Style({
278
+ stroke: stroke,
279
+ fill: fill
280
+ });
281
+ if (addPointStyle) {
282
+ style.setImage(new CircleStyle({
283
+ radius: drawingConfig.defaultVertexRadius / 3,
284
+ fill: fill,
285
+ stroke: stroke
286
+ }));
287
+ }
288
+ return style;
289
+ }
290
+ createVertexStyle() {
291
+ const drawingConfig = this.context.configManager.Config.drawing;
292
+ return new Style({
293
+ image: new RegularShape({
294
+ points: 4,
295
+ radius: drawingConfig.defaultVertexRadius,
296
+ angle: toRadians(45),
297
+ rotateWithView: false,
298
+ stroke: new Stroke({
299
+ color: drawingConfig.defaultStrokeColor,
300
+ width: drawingConfig.defaultVertexStrokeWidth
301
+ })
302
+ })
303
+ });
304
+ }
305
+ getEditStyle(olFeature) {
306
+ const geometry = getGeometryForRendering(olFeature);
307
+ const baseStyle = this.createBaseStyle();
308
+ if (!geometry) {
309
+ return [baseStyle];
310
+ }
311
+ baseStyle.setGeometry(geometry);
312
+ const vertexStyle = this.createVertexStyle();
313
+ if (geometry instanceof Point || geometry instanceof MultiPoint) {
314
+ return vertexStyle;
315
+ }
316
+ vertexStyle.setGeometry(function (f) {
317
+ const geom = getGeometryForRendering(f);
318
+ if (geom && geom instanceof Geometry) {
319
+ return extractVerticesFromGeometry(geom);
320
+ }
321
+ });
322
+ return [baseStyle, vertexStyle];
323
+ }
324
+ }
@@ -2,61 +2,104 @@
2
2
  #content {
3
3
  background: var(--bkg-color);
4
4
  color: var(--text-color);
5
- padding: 1rem;
6
5
  margin: 0;
7
6
  display: flex;
8
7
  flex-direction: column;
9
- gap: 1rem;
10
- }
11
-
12
- .girafe-prototype {
13
- line-height: 40px;
14
- color: white;
15
- background: #ec5555;
16
- text-align: center;
17
- font-weight: bold;
18
- font-size: 1rem;
8
+ min-width: 0;
9
+ gap: 0.5rem;
10
+ overflow: hidden;
11
+ width: 100%;
12
+ box-sizing: border-box;
13
+ height: 100%;
14
+ min-height: 0;
19
15
  }
20
16
 
21
17
  .editing {
22
18
  display: flex;
23
19
  flex-direction: column;
24
- gap: 1rem;
20
+ overflow: hidden;
21
+ padding: 1rem;
22
+ gap: 0.5rem;
25
23
  }
26
24
 
27
- #layer-selector {
25
+ .separator {
28
26
  width: 100%;
27
+ margin: 8px 0;
28
+ height: 1px;
29
+ background: var(--app-color-grey);
29
30
  }
30
31
 
31
- .draw-btn {
32
- text-align: right;
32
+ .section-title {
33
+ font-size: 1.1rem;
33
34
  }
34
35
 
35
- .current-feature {
36
- border-top: var(--app-standard-border);
37
- margin-top: 2rem;
36
+ #layer-selector {
37
+ width: 100%;
38
38
  }
39
- .current-feature-row {
39
+
40
+ .action-bar {
40
41
  display: flex;
41
- gap: 0.5em;
42
- align-items: center;
42
+ gap: 1rem;
43
+ justify-content: center;
44
+ &.vertical {
45
+ flex-direction: column;
46
+ align-items: center;
47
+ margin: 1rem 0;
48
+ }
43
49
  }
44
50
 
45
- .current-feature-row > button {
46
- margin-left: auto;
51
+ .gg-medium-withtext {
52
+ display: flex;
53
+ align-items: center;
47
54
  }
48
55
 
49
- .current-feature-row > div:first-child {
50
- font-weight: bold;
56
+ .drawing-help {
57
+ color: var(--text-color-grad1);
58
+ gap: 0.5rem;
59
+ padding: 0.5rem 2rem;
60
+ display: flex;
61
+ flex-direction: column;
62
+ font-style: italic;
63
+ font-size: 0.9rem;
64
+ align-items: center;
65
+ text-align: center;
51
66
  }
52
67
 
53
68
  .attribute-form-btns {
54
- margin-top: 1rem;
69
+ margin-top: 2rem;
55
70
  display: flex;
56
71
  gap: 0.5rem;
57
72
  justify-content: flex-end;
58
73
  }
59
74
 
60
- .btn-active {
61
- background-color: var(--bkg-color-grad2);
75
+ #delete-btn {
76
+ border-color: var(--error-color);
77
+ color: var(--error-color);
78
+ margin-left: auto;
79
+ border-width: 2px;
80
+ }
81
+
82
+ .scrollable-form-container {
83
+ overflow-y: auto;
84
+ padding-right: 0.5rem;
85
+ }
86
+
87
+ @keyframes fadeOut {
88
+ 0% {
89
+ opacity: 1;
90
+ }
91
+ 100% {
92
+ opacity: 0;
93
+ pointer-events: none;
94
+ }
95
+ }
96
+
97
+ .successMsg {
98
+ display: flex;
99
+ align-items: center;
100
+ justify-content: center;
101
+ padding: 0.5rem;
102
+ background: var(--success-color);
103
+ color: var(--text-color);
104
+ animation: fadeOut 2s ease-out 5s forwards;
62
105
  }
@@ -19,7 +19,7 @@ export { default as FixedDimensionComponent } from './drawing/fixed-dimension/co
19
19
  export { default as DrawingContainerMobile } from './drawing-container-mobile/component.js';
20
20
  export { default as DrawingToolbarComponent } from './drawing-toolbar/component.js';
21
21
  export { default as EditComponent } from './edit/component.js';
22
- export { default as EditFromComponent } from './edit/editform/component.js';
22
+ export { default as EditFormComponent, EditingFormChange } from './edit/editform/component.js';
23
23
  export { default as ExternalLayersComponent } from './extlayers/component.js';
24
24
  export { default as FeedbackButtonComponent } from './feedbackbutton/component.js';
25
25
  export type { GeolocationIcons } from './geolocation-mobile/component.js';
@@ -18,7 +18,7 @@ export { default as FixedDimensionComponent } from './drawing/fixed-dimension/co
18
18
  export { default as DrawingContainerMobile } from './drawing-container-mobile/component.js';
19
19
  export { default as DrawingToolbarComponent } from './drawing-toolbar/component.js';
20
20
  export { default as EditComponent } from './edit/component.js';
21
- export { default as EditFromComponent } from './edit/editform/component.js';
21
+ export { default as EditFormComponent, EditingFormChange } from './edit/editform/component.js';
22
22
  export { default as ExternalLayersComponent } from './extlayers/component.js';
23
23
  export { default as FeedbackButtonComponent } from './feedbackbutton/component.js';
24
24
  export { default as GeolocationMobile } from './geolocation-mobile/component.js';
@@ -101,7 +101,7 @@ declare class PrintComponent extends GirafeHTMLElement implements IGirafePanel {
101
101
  * Used to know the matching HTML element.
102
102
  * @returns An arbitrary type based on the matching "capabilities" attribute.
103
103
  */
104
- getAttributeInputType(attributeName: string): "number" | "text" | "textarea" | "checkbox";
104
+ getAttributeInputType(attributeName: string): "number" | "text" | "checkbox" | "textarea";
105
105
  /**
106
106
  * Legacy fix for attrName i18n.
107
107
  */
@@ -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 {};