@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.
Files changed (111) hide show
  1. package/LICENSE +1 -0
  2. package/README.md +3 -2
  3. package/api/apigeogirafeapp.js +3 -1
  4. package/assets/i18n/de.json +34 -3
  5. package/assets/i18n/en.json +33 -2
  6. package/assets/i18n/fr.json +35 -4
  7. package/assets/i18n/it.json +37 -6
  8. package/assets/icons/edit.svg +1 -1
  9. package/assets/icons/lock.svg +1 -0
  10. package/assets/icons/streetview-marker-mapillary.svg +1 -0
  11. package/components/cross-section/cross-section-settings/component.js +1 -1
  12. package/components/edit/component.d.ts +52 -36
  13. package/components/edit/component.js +340 -292
  14. package/components/edit/editcomponentstate.d.ts +1 -0
  15. package/components/edit/editcomponentstate.js +1 -0
  16. package/components/edit/editform/component.d.ts +34 -4
  17. package/components/edit/editform/component.js +224 -37
  18. package/components/edit/editform/style.css +51 -16
  19. package/components/edit/geometryedithelper.d.ts +47 -0
  20. package/components/edit/geometryedithelper.js +324 -0
  21. package/components/edit/style.css +71 -28
  22. package/components/layout/component.d.ts +5 -0
  23. package/components/main.d.ts +1 -1
  24. package/components/main.js +1 -1
  25. package/components/map-grid/component.d.ts +4 -0
  26. package/components/map-grid/component.js +6 -0
  27. package/components/print/component.d.ts +1 -1
  28. package/components/streetview/component.d.ts +9 -2
  29. package/components/streetview/component.js +20 -8
  30. package/components/streetview/google.js +1 -1
  31. package/components/streetview/mapillary.d.ts +8 -0
  32. package/components/streetview/mapillary.js +20 -0
  33. package/components/streetview/style.css +16 -0
  34. package/components/streetview/tools/googleprovider.js +9 -2
  35. package/components/streetview/tools/mapillaryprovider.d.ts +70 -0
  36. package/components/streetview/tools/mapillaryprovider.js +150 -0
  37. package/components/treeview/tools/treeviewelement.d.ts +1 -0
  38. package/components/treeview/tools/treeviewelement.js +22 -0
  39. package/components/treeview/treeviewitem/component.js +7 -1
  40. package/models/gmf.d.ts +18 -2
  41. package/models/gmf.js +3 -1
  42. package/models/layers/editablelayer.d.ts +7 -0
  43. package/models/layers/editablelayer.js +7 -0
  44. package/models/layers/layerwms.d.ts +1 -2
  45. package/models/layers/layerwms.js +4 -8
  46. package/models/main.d.ts +9 -4
  47. package/models/main.js +6 -2
  48. package/models/oapiflayer.d.ts +25 -0
  49. package/models/oapiflayer.js +36 -0
  50. package/models/oapiftypes.d.ts +71 -0
  51. package/models/oapiftypes.js +29 -0
  52. package/models/serverogc.d.ts +5 -3
  53. package/models/serverogc.js +19 -6
  54. package/models/serverogcapi.d.ts +2 -0
  55. package/models/serverogcapi.js +2 -0
  56. package/models/serverogcapifeatures.d.ts +5 -62
  57. package/models/serverogcapifeatures.js +8 -4
  58. package/package.json +1 -1
  59. package/templates/iframe.html +1 -0
  60. package/templates/index.html +2 -0
  61. package/templates/mobile.html +1 -0
  62. package/templates/public/about.json +1 -1
  63. package/tools/app/geogirafeapp-mobile.js +2 -0
  64. package/tools/app/geogirafeapp.js +4 -2
  65. package/tools/configuration/girafeconfig.js +1 -8
  66. package/tools/configuration/streetviewconfig.d.ts +12 -1
  67. package/tools/configuration/streetviewconfig.js +26 -4
  68. package/tools/drawing/olDrawing.js +2 -22
  69. package/tools/drawing/shapeConstraints.d.ts +2 -1
  70. package/tools/drawing/shapeConstraints.js +18 -2
  71. package/tools/main.d.ts +9 -7
  72. package/tools/main.js +8 -6
  73. package/tools/ogcapi/ogcapiclient.d.ts +7 -3
  74. package/tools/ogcapi/ogcapiclient.js +49 -4
  75. package/tools/ogcapi/ogcapiconformance.d.ts +2 -2
  76. package/tools/ogcapi/ogcapiconformance.js +7 -13
  77. package/tools/ogcapi/ogcapifeaturesclient.d.ts +65 -30
  78. package/tools/ogcapi/ogcapifeaturesclient.js +265 -139
  79. package/tools/ogcapi/ogcapifeaturesclientgeorama.d.ts +0 -5
  80. package/tools/ogcapi/ogcapifeaturesclientgeorama.js +0 -11
  81. package/tools/ogcapi/ogcapifeaturesclientqgis.d.ts +8 -0
  82. package/tools/ogcapi/ogcapifeaturesclientqgis.js +13 -0
  83. package/tools/ogcapi/ogcapifeaturesmanager.d.ts +61 -8
  84. package/tools/ogcapi/ogcapifeaturesmanager.js +179 -30
  85. package/tools/ogcapi/ogcapifeaturesschema.d.ts +31 -13
  86. package/tools/ogcapi/ogcapifeaturesschema.js +69 -39
  87. package/tools/ogcapi/ogcapifeaturesschemaproperty.d.ts +44 -0
  88. package/tools/ogcapi/ogcapifeaturesschemaproperty.js +137 -0
  89. package/tools/ogcapi/ogcapifeaturesschemavalidator.d.ts +22 -0
  90. package/tools/ogcapi/ogcapifeaturesschemavalidator.js +121 -0
  91. package/tools/state/layout.d.ts +5 -0
  92. package/tools/state/layout.js +2 -1
  93. package/tools/state/state.d.ts +6 -0
  94. package/tools/state/state.js +4 -0
  95. package/tools/state/streetview.d.ts +1 -1
  96. package/tools/state/streetview.js +1 -1
  97. package/tools/themes/themesmanager.d.ts +10 -3
  98. package/tools/themes/themesmanager.js +29 -9
  99. package/tools/time/layertimeformatter.d.ts +0 -5
  100. package/tools/time/layertimeformatter.js +10 -19
  101. package/tools/utils/dateutils.d.ts +40 -0
  102. package/tools/utils/dateutils.js +111 -0
  103. package/tools/utils/utils.d.ts +4 -0
  104. package/tools/utils/utils.js +12 -0
  105. package/tools/wfs/wfsmanager.js +3 -0
  106. package/tools/wms/wmsclient.d.ts +1 -0
  107. package/tools/wms/wmsclient.js +4 -0
  108. package/tools/ogcapi/demolayers.d.ts +0 -1
  109. package/tools/ogcapi/demolayers.js +0 -99
  110. package/tools/ogcapi/ogcapifeaturesclientgmf.d.ts +0 -13
  111. 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
  }
@@ -22,6 +22,11 @@ declare class LayoutComponent extends GirafeHTMLElement implements IGirafePanel
22
22
  readonly tagName: "girafe-streetview-google";
23
23
  readonly label: "Google Street View";
24
24
  readonly provider: "google";
25
+ } | {
26
+ readonly id: "streetview-mapillary";
27
+ readonly tagName: "girafe-streetview-mapillary";
28
+ readonly label: "Mapillary";
29
+ readonly provider: "mapillary";
25
30
  })[];
26
31
  constructor();
27
32
  private get layout();
@@ -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';
@@ -36,6 +36,10 @@ declare class MapGridComponent extends GirafeHTMLElement {
36
36
  /** The splitter that is currently dragged, if any. */
37
37
  private draggedSplitter;
38
38
  constructor();
39
+ /**
40
+ * The Grid contains the Maps, which need to be displayed in Fullscreen Mode.
41
+ */
42
+ protected get isFullscreenComponent(): boolean;
39
43
  private get layout();
40
44
  private get grid();
41
45
  protected connectedCallback(): void;
@@ -31,6 +31,12 @@ ${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
31
31
  constructor() {
32
32
  super('map-grid');
33
33
  }
34
+ /**
35
+ * The Grid contains the Maps, which need to be displayed in Fullscreen Mode.
36
+ */
37
+ get isFullscreenComponent() {
38
+ return true;
39
+ }
34
40
  get layout() {
35
41
  return this.state.layout;
36
42
  }
@@ -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
  */
@@ -15,6 +15,9 @@ export default abstract class StreetViewComponent extends GirafeHTMLElement {
15
15
  template: () => import("uhtml").Hole;
16
16
  loading: boolean;
17
17
  hasFootage: boolean;
18
+ isFullscreen: boolean;
19
+ /** The Fullscreen API is not available everywhere: on iPhone, only videos can be displayed in fullscreen. */
20
+ readonly canBeFullscreen: boolean;
18
21
  protected readonly provider: StreetViewProvider;
19
22
  private adapter;
20
23
  /** Promise of the currently running adapter creation, to prevent creating it twice. */
@@ -26,11 +29,11 @@ export default abstract class StreetViewComponent extends GirafeHTMLElement {
26
29
  private readonly marker;
27
30
  private readonly markerSource;
28
31
  private readonly markerLayer;
29
- protected constructor(provider: StreetViewProvider);
32
+ protected constructor(provider: StreetViewProvider, markerIconSrc: string);
30
33
  private get olMap();
31
34
  private get cellId();
32
35
  private get isDisplayed();
33
- private get searchRadius();
36
+ protected get searchRadius(): number;
34
37
  /** Creates the adapter of the provider, loading its module on demand. */
35
38
  protected abstract createAdapter(): Promise<StreetViewProviderAdapter>;
36
39
  /** The StreetView is displayed in a Cell of the Grid, like the Maps. */
@@ -45,6 +48,10 @@ export default abstract class StreetViewComponent extends GirafeHTMLElement {
45
48
  */
46
49
  private onDisplayToggled;
47
50
  private createAdapterOnce;
51
+ /** Displays the StreetView alone on the whole screen, or leaves the fullscreen when it is already displayed so. */
52
+ toggleFullscreen(): void;
53
+ /** The fullscreen can also be left with the keyboard (Esc), without the button. */
54
+ onFullscreenChanged(): void;
48
55
  private onMapClick;
49
56
  private showClosestFootage;
50
57
  private onFootageChanged;
@@ -22,32 +22,32 @@ export default class StreetViewComponent extends GirafeHTMLElement {
22
22
  return uHtml `<style>
23
23
  .hidden{display:none!important}.gg-rotate90{transform:rotate(90deg)}.gg-rotate180{transform:rotate(180deg)}.gg-rotate270{transform:rotate(270deg)}img{filter:var(--svg-filter)}img.legend-image{filter:var(--svg-map-filter);background:var(--svg-legend-bkg)}div{scrollbar-width:thin}a,a:visited{color:var(--link-color)}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes spin-wait{0%{transform:rotate(0)}7%{transform:rotate(360deg)}to{transform:rotate(360deg)}}.gg-spin{animation-name:spin;animation-duration:2s;animation-timing-function:linear;animation-iteration-count:infinite}.gg-spin-wait{animation-name:spin-wait;animation-duration:10s;animation-timing-function:linear;animation-iteration-count:infinite}::-webkit-scrollbar{width:5px}::-webkit-scrollbar-thumb{background:#999}button,input,select,textarea{font:inherit}.gg-button,.gg-select,.gg-input,.gg-textarea{background-color:var(--bkg-color);color:var(--text-color);border:var(--app-standard-border);box-sizing:border-box;cursor:pointer;border-radius:3px;outline:0;margin:0;padding:0 0 0 .5rem;display:inline-block}.gg-label{background-color:var(--bkg-color);color:var(--text-color);border:none;align-items:center;margin:0;padding:0;display:flex}.gg-button,.gg-select,.gg-input,.gg-label{min-height:calc(var(--app-standard-height) / 1.5)}.gg-textarea{max-height:initial;resize:vertical;height:6rem;padding:.5rem;line-height:1.3rem}.gg-input{cursor:text}.gg-checkbox{accent-color:var(--text-color);cursor:pointer;width:1.2rem}.gg-range{accent-color:var(--text-color)}.gg-button{padding:0 .5rem}.gg-button.active{border:solid 1px var(--text-color-grad1);background-color:var(--bkg-color-grad2)}.gg-button:disabled{background-color:var(--bkg-color-grad1);color:var(--text-color-grad2);cursor:not-allowed;border:none}.gg-button:disabled img{filter:opacity(.6)}.gg-input:disabled,.gg-select:disabled,.gg-textarea:disabled{background-color:var(--bkg-color-grad1);color:var(--text-color-grad2);cursor:not-allowed}.gg-button>img{vertical-align:middle}.gg-icon-button{color:var(--text-color);cursor:pointer;background-color:#0000;border:none;flex-direction:column;justify-content:center;align-items:center;padding:0;display:flex}.gg-icon{justify-content:center;align-items:center;display:flex}.gg-big,.gg-big-withtext{min-width:var(--app-standard-height);min-height:var(--app-standard-height);max-height:var(--app-standard-height)}.gg-big img,.gg-big-withtext img{width:calc(var(--app-standard-height) - 1.5rem);margin:0}.gg-big-withtext span{font-variant:small-caps;padding:0 1rem;font-size:.9rem}.gg-medium,.gg-medium-withtext{min-width:calc(var(--app-standard-height) / 1.2);min-height:calc(var(--app-standard-height) / 1.2);max-height:calc(var(--app-standard-height) / 1.2);flex-direction:row}.gg-medium img{width:calc(var(--app-standard-height) / 2.4);margin:0}.gg-medium-withtext img{width:calc(var(--app-standard-height) / 2.4);margin-left:.5rem}.gg-medium-withtext span{padding:0 1rem 0 .5rem;font-size:.9rem}.gg-small,.gg-small-withtext{min-width:calc(var(--app-standard-height) / 2);min-height:calc(var(--app-standard-height) / 2);max-height:calc(var(--app-standard-height) / 2);flex-direction:row}.gg-small img{width:calc(var(--app-standard-height) / 3);margin:0}.gg-small-withtext img{width:calc(var(--app-standard-height) / 3);margin-left:.5rem}.gg-small-withtext span{padding:0 .5rem 0 .3rem;font-size:.9rem}.gg-button:hover:not(:disabled),.gg-select:hover:not(:disabled),.gg-input:hover:not(:disabled),.gg-textarea:hover:not(:disabled),.gg-icon-button:hover:not(:disabled){background-color:var(--bkg-color-grad1)}.gg-opacity{opacity:.5}.gg-opacity:hover{opacity:1;background-color:#0000}.gg-tabs{cursor:pointer;grid-auto-flow:column;padding-bottom:1rem;font-size:1rem;display:grid}.gg-tab{border:none;border-bottom:var(--app-standard-border);cursor:pointer;color:var(--text-color);background:0 0;padding:.5rem}.gg-tab.active{border-bottom:solid 1px var(--text-color)}.girafe-button-big,.girafe-button-large,.girafe-button-small,.girafe-button-tiny{color:var(--text-color);background-color:#0000;border:none;flex-direction:column;display:flex}.girafe-button-big:hover,.girafe-button-large:hover,.girafe-button-small:hover,.girafe-button-tiny:hover{background-color:var(--bkg-color-grad1);cursor:pointer}.girafe-button-big.dark,.girafe-button-large.dark,.girafe-button-small.dark,.girafe-button-tiny.dark{background-color:var(--bkg-color);filter:invert()}.girafe-button-big{width:var(--app-standard-height);height:var(--app-standard-height);align-items:center;padding:1rem}.girafe-button-big img{overflow:hidden}.girafe-button-large{flex-direction:row}.girafe-button-large img{height:2rem;margin:.3rem}.girafe-button-large span{height:2rem;margin:.3rem;line-height:2rem}.girafe-button-small{min-width:calc(var(--app-standard-height) / 2);height:calc(var(--app-standard-height) / 2);align-items:center;padding:.5rem}.girafe-button-small img{overflow:hidden}.girafe-button-small span{text-align:left;text-overflow:ellipsis;width:100%;overflow:hidden}.girafe-button-tiny{align-items:center;width:1rem;height:1rem;padding:0}.girafe-button-tiny img{overflow:hidden}.girafe-onboarding-theme{background-color:var(--bkg-color)!important;color:var(--text-color)!important}.girafe-onboarding-theme button{background-color:var(--bkg-color)!important;color:var(--text-color)!important;text-shadow:none!important}.girafe-onboarding-theme button.driver-popover-close-btn{z-index:10000}.tippy-box{background-color:var(--bkg-color)!important;border:var(--app-standard-border)!important}.tippy-content{color:var(--text-color)!important}.tippy-arrow{color:var(--bkg-color)!important}.tippy-box[data-theme~=error]{background-color:var(--error-color);white-space:pre-line}div.tippy-box[data-theme=image-popup]{border:var(--app-standard-border)!important;& div.tippy-content{background-color:var(--bkg-color)!important;& img{max-width:20rem;max-height:20rem}}& div.tippy-arrow{color:var(--bkg-color)!important}}
24
24
  </style><style>
25
- #streetview{background-color:var(--bkg-color);width:100%;height:100%;position:relative;overflow:hidden}#viewer{position:absolute;inset:0}.overlay{text-align:center;color:var(--text-color);pointer-events:none;z-index:1;flex-direction:column;justify-content:center;align-items:center;gap:1rem;padding:1rem;font-weight:600;display:flex;position:absolute;inset:0}.no-data{color:#999;font-variant:small-caps;gap:.3rem;font-size:1rem;font-weight:400}.hidden{display:none}
25
+ #streetview{background-color:var(--bkg-color);width:100%;height:100%;position:relative;overflow:hidden}#viewer{position:absolute;inset:0}.overlay{text-align:center;color:var(--text-color);pointer-events:none;z-index:1;flex-direction:column;justify-content:center;align-items:center;gap:1rem;padding:1rem;font-weight:600;display:flex;position:absolute;inset:0}.no-data{color:#999;font-variant:small-caps;gap:.3rem;font-size:1rem;font-weight:400}.fullscreen-button{z-index:2;background-color:var(--bkg-color);border-radius:.25rem;width:2rem;height:2rem;position:absolute;top:.5rem;right:.5rem}.fullscreen-button>img{width:55%;height:auto}.hidden{display:none}
26
26
  </style>
27
27
  <style>${this.customStyle}</style>
28
- <div id="streetview"><div id="viewer"></div><div class="${this.loading ? 'overlay' : 'overlay hidden'}"><img alt="loading-icon" src="icons/loading.svg" class="gg-spin"> <span i18n="Loading StreetView...">Loading StreetView...</span></div><div class="${!this.loading && !this.hasFootage ? 'overlay no-data' : 'overlay no-data hidden'}"><span i18n="Click on the map to display the StreetView at this location">Click on the map to display the StreetView at this location</span></div></div>
28
+ <div id="streetview" onfullscreenchange="${() => this.onFullscreenChanged()}"><div id="viewer"></div><div class="${this.loading ? 'overlay' : 'overlay hidden'}"><img alt="loading-icon" src="icons/loading.svg" class="gg-spin"> <span i18n="Loading StreetView...">Loading StreetView...</span></div><div class="${!this.loading && !this.hasFootage ? 'overlay no-data' : 'overlay no-data hidden'}"><span i18n="Click on the map to display the StreetView at this location">Click on the map to display the StreetView at this location</span></div><button tip="fullscreen-on" class="${this.canBeFullscreen && this.hasFootage && !this.isFullscreen ? 'gg-icon-button fullscreen-button' : 'gg-icon-button fullscreen-button hidden'}" onclick="${() => this.toggleFullscreen()}"><img alt="fullscreen-icon" src="icons/fullscreen.svg"></button> <button tip="fullscreen-off" class="${this.isFullscreen ? 'gg-icon-button fullscreen-button' : 'gg-icon-button fullscreen-button hidden'}" onclick="${() => this.toggleFullscreen()}"><img alt="fullscreen-exit-icon" src="icons/fullscreen-exit.svg"></button></div>
29
29
  ${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
30
30
  };
31
31
  loading = false;
32
32
  hasFootage = false;
33
+ isFullscreen = false;
34
+ /** The Fullscreen API is not available everywhere: on iPhone, only videos can be displayed in fullscreen. */
35
+ canBeFullscreen = document.fullscreenEnabled;
33
36
  provider;
34
37
  adapter = null;
35
38
  /** Promise of the currently running adapter creation, to prevent creating it twice. */
36
39
  adapterCreation = null;
37
40
  /** The view of the footage displayed by the adapter, to tell the views coming from a shared state apart. */
38
41
  displayedView = null;
39
- markerIcon = new Icon({
40
- src: 'icons/streetview-marker.svg',
41
- anchor: [0.5, 0.5],
42
- rotateWithView: true
43
- });
42
+ markerIcon;
44
43
  markerGeometry = new Point([0, 0]);
45
44
  marker = new Feature(this.markerGeometry);
46
45
  markerSource = new VectorSource();
47
46
  markerLayer = new VectorLayer({ source: this.markerSource, zIndex: 2000 });
48
- constructor(provider) {
47
+ constructor(provider, markerIconSrc) {
49
48
  super(`streetview-${provider}`);
50
49
  this.provider = provider;
50
+ this.markerIcon = new Icon({ src: markerIconSrc, anchor: [0.5, 0.5], rotateWithView: true });
51
51
  this.marker.setStyle(new Style({ image: this.markerIcon }));
52
52
  this.onMapClick = this.onMapClick.bind(this);
53
53
  }
@@ -130,6 +130,18 @@ ${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
130
130
  })();
131
131
  return this.adapterCreation;
132
132
  }
133
+ /** Displays the StreetView alone on the whole screen, or leaves the fullscreen when it is already displayed so. */
134
+ toggleFullscreen() {
135
+ const fullscreenToggle = this.isFullscreen
136
+ ? document.exitFullscreen()
137
+ : this.getById('streetview').requestFullscreen();
138
+ fullscreenToggle.catch((error) => console.error(error));
139
+ }
140
+ /** The fullscreen can also be left with the keyboard (Esc), without the button. */
141
+ onFullscreenChanged() {
142
+ this.isFullscreen = this.shadow.fullscreenElement !== null;
143
+ this.refreshRender();
144
+ }
133
145
  onMapClick(event) {
134
146
  if (!this.adapter || !this.isDisplayed || !this.canExecute('map.mouseclick')) {
135
147
  return;
@@ -3,7 +3,7 @@ import StreetViewComponent from './component.js';
3
3
  /** The StreetView displaying the footage of Google Street View. */
4
4
  export default class GoogleStreetViewComponent extends StreetViewComponent {
5
5
  constructor() {
6
- super('google');
6
+ super('google', 'icons/streetview-marker.svg');
7
7
  }
8
8
  async createAdapter() {
9
9
  const apiKey = this.context.configManager.Config.streetview?.google?.apiKey;
@@ -0,0 +1,8 @@
1
+ import StreetViewComponent from './component.js';
2
+ import type { StreetViewProviderAdapter } from './tools/provider.js';
3
+ /** The StreetView displaying the footage of Mapillary. */
4
+ export default class MapillaryStreetViewComponent extends StreetViewComponent {
5
+ constructor();
6
+ protected get searchRadius(): number;
7
+ protected createAdapter(): Promise<StreetViewProviderAdapter>;
8
+ }