ol-wfst 4.0.5 → 4.1.0

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 (83) hide show
  1. package/README.md +367 -359
  2. package/dist/@types.d.ts +6 -0
  3. package/dist/@types.d.ts.map +1 -1
  4. package/dist/Geoserver.d.ts +20 -12
  5. package/dist/Geoserver.d.ts.map +1 -1
  6. package/dist/WfsLayer.d.ts +13 -13
  7. package/dist/WfsLayer.d.ts.map +1 -1
  8. package/dist/WmsLayer.d.ts +14 -13
  9. package/dist/WmsLayer.d.ts.map +1 -1
  10. package/dist/css/ol-wfst.bootstrap5.css +40 -11
  11. package/dist/css/ol-wfst.bootstrap5.min.css +1 -1
  12. package/dist/modules/EditControlChanges.d.ts +10 -10
  13. package/dist/modules/EditControlChanges.d.ts.map +1 -1
  14. package/dist/modules/EditFieldsModal.d.ts +3 -2
  15. package/dist/modules/EditFieldsModal.d.ts.map +1 -1
  16. package/dist/modules/EditOverlay.d.ts +4 -3
  17. package/dist/modules/EditOverlay.d.ts.map +1 -1
  18. package/dist/modules/LayersControl.d.ts +2 -3
  19. package/dist/modules/LayersControl.d.ts.map +1 -1
  20. package/dist/modules/Uploads.d.ts +6 -3
  21. package/dist/modules/Uploads.d.ts.map +1 -1
  22. package/dist/modules/base/BaseLayer.d.ts +5 -5
  23. package/dist/modules/base/BaseLayer.d.ts.map +1 -1
  24. package/dist/modules/base/WfsSource.d.ts +1 -1
  25. package/dist/modules/base/WfsSource.d.ts.map +1 -1
  26. package/dist/modules/base/WmsSource.d.ts +1 -1
  27. package/dist/modules/base/WmsSource.d.ts.map +1 -1
  28. package/dist/modules/editLayer.d.ts +2 -2
  29. package/dist/modules/editLayer.d.ts.map +1 -1
  30. package/dist/modules/errors.d.ts +2 -1
  31. package/dist/modules/errors.d.ts.map +1 -1
  32. package/dist/modules/state.d.ts +2 -2
  33. package/dist/modules/state.d.ts.map +1 -1
  34. package/dist/modules/styleFunction.d.ts +3 -3
  35. package/dist/modules/styleFunction.d.ts.map +1 -1
  36. package/dist/ol-wfst.d.ts +21 -15
  37. package/dist/ol-wfst.d.ts.map +1 -1
  38. package/dist/ol-wfst.js +219 -2785
  39. package/dist/ol-wfst.js.map +1 -1
  40. package/dist/ol-wfst.min.js +1 -1
  41. package/dist/ol-wfst.min.js.map +1 -1
  42. package/lib/@types.d.ts +6 -0
  43. package/lib/@types.d.ts.map +1 -1
  44. package/lib/Geoserver.d.ts +20 -12
  45. package/lib/Geoserver.d.ts.map +1 -1
  46. package/lib/WfsLayer.d.ts +13 -13
  47. package/lib/WfsLayer.d.ts.map +1 -1
  48. package/lib/WmsLayer.d.ts +14 -13
  49. package/lib/WmsLayer.d.ts.map +1 -1
  50. package/lib/modules/EditControlChanges.d.ts +10 -10
  51. package/lib/modules/EditControlChanges.d.ts.map +1 -1
  52. package/lib/modules/EditFieldsModal.d.ts +3 -2
  53. package/lib/modules/EditFieldsModal.d.ts.map +1 -1
  54. package/lib/modules/EditOverlay.d.ts +4 -3
  55. package/lib/modules/EditOverlay.d.ts.map +1 -1
  56. package/lib/modules/LayersControl.d.ts +2 -3
  57. package/lib/modules/LayersControl.d.ts.map +1 -1
  58. package/lib/modules/Uploads.d.ts +6 -3
  59. package/lib/modules/Uploads.d.ts.map +1 -1
  60. package/lib/modules/base/BaseLayer.d.ts +5 -5
  61. package/lib/modules/base/BaseLayer.d.ts.map +1 -1
  62. package/lib/modules/base/WfsSource.d.ts +1 -1
  63. package/lib/modules/base/WfsSource.d.ts.map +1 -1
  64. package/lib/modules/base/WmsSource.d.ts +1 -1
  65. package/lib/modules/base/WmsSource.d.ts.map +1 -1
  66. package/lib/modules/editLayer.d.ts +2 -2
  67. package/lib/modules/editLayer.d.ts.map +1 -1
  68. package/lib/modules/errors.d.ts +2 -1
  69. package/lib/modules/errors.d.ts.map +1 -1
  70. package/lib/modules/state.d.ts +2 -2
  71. package/lib/modules/state.d.ts.map +1 -1
  72. package/lib/modules/styleFunction.d.ts +3 -3
  73. package/lib/modules/styleFunction.d.ts.map +1 -1
  74. package/lib/ol-wfst.d.ts +21 -15
  75. package/lib/ol-wfst.d.ts.map +1 -1
  76. package/lib/ol-wfst.js +151 -236
  77. package/lib/ol-wfst.js.map +1 -1
  78. package/lib/style/css/ol-wfst.bootstrap5.css +40 -11
  79. package/lib/style/scss/-ol-wfst.bootstrap5.scss +10 -10
  80. package/lib/style/scss/_variables.scss +17 -17
  81. package/lib/style/scss/ol-wfst.scss +230 -230
  82. package/package.json +71 -72
  83. package/CHANGELOG.md +0 -103
package/dist/ol-wfst.js CHANGED
@@ -1,2495 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('ol/style'), require('ol/control'), require('ol/interaction'), require('ol/events/Event'), require('ol/events/condition'), require('ol/Observable'), require('ol/layer/Vector'), require('ol/layer/Base'), require('ol/format/GeoJSON'), require('ol/source/Vector'), require('ol/proj'), require('ol/loadingstrategy'), require('ol/layer/Tile'), require('ol/format'), require('ol/source/TileWMS'), require('ol/geom'), require('ol/Object'), require('ol/geom/Polygon'), require('ol/extent')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'ol/style', 'ol/control', 'ol/interaction', 'ol/events/Event', 'ol/events/condition', 'ol/Observable', 'ol/layer/Vector', 'ol/layer/Base', 'ol/format/GeoJSON', 'ol/source/Vector', 'ol/proj', 'ol/loadingstrategy', 'ol/layer/Tile', 'ol/format', 'ol/source/TileWMS', 'ol/geom', 'ol/Object', 'ol/geom/Polygon', 'ol/extent'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Wfst = {}, global.ol.style, global.ol.control, global.ol.interaction, global.ol.events.Event, global.ol.events.condition, global.ol.Observable, global.ol.layer.Vector, global.ol.layer.Base, global.ol.format.GeoJSON, global.ol.source.Vector, global.ol.proj, global.ol.loadingstrategy, global.ol.layer.Tile, global.ol.format, global.ol.source.TileWMS, global.ol.geom, global.ol.Object, global.ol.geom.Polygon, global.ol.extent));
5
- })(this, (function (exports, style, control, interaction, BaseEvent$1, condition, Observable$2, VectorLayer, Layer, GeoJSON, VectorSource, proj, loadingstrategy, TileLayer, format, TileWMS, geom, BaseObject$2, Polygon, extent) { 'use strict';
6
-
7
- /**
8
- * @module ol/AssertionError
9
- */
10
-
11
- /** @type {Object<number, string>} */
12
- const messages = {
13
- 1: 'The view center is not defined',
14
- 2: 'The view resolution is not defined',
15
- 3: 'The view rotation is not defined',
16
- 4: '`image` and `src` cannot be provided at the same time',
17
- 5: '`imgSize` must be set when `image` is provided',
18
- 7: '`format` must be set when `url` is set',
19
- 8: 'Unknown `serverType` configured',
20
- 9: '`url` must be configured or set using `#setUrl()`',
21
- 10: 'The default `geometryFunction` can only handle `Point` geometries',
22
- 11: '`options.featureTypes` must be an Array',
23
- 12: '`options.geometryName` must also be provided when `options.bbox` is set',
24
- 13: 'Invalid corner',
25
- 14: 'Invalid color',
26
- 15: 'Tried to get a value for a key that does not exist in the cache',
27
- 16: 'Tried to set a value for a key that is used already',
28
- 17: '`resolutions` must be sorted in descending order',
29
- 18: 'Either `origin` or `origins` must be configured, never both',
30
- 19: 'Number of `tileSizes` and `resolutions` must be equal',
31
- 20: 'Number of `origins` and `resolutions` must be equal',
32
- 22: 'Either `tileSize` or `tileSizes` must be configured, never both',
33
- 24: 'Invalid extent or geometry provided as `geometry`',
34
- 25: 'Cannot fit empty extent provided as `geometry`',
35
- 26: 'Features must have an id set',
36
- 27: 'Features must have an id set',
37
- 28: '`renderMode` must be `"hybrid"` or `"vector"`',
38
- 30: 'The passed `feature` was already added to the source',
39
- 31: 'Tried to enqueue an `element` that was already added to the queue',
40
- 32: 'Transformation matrix cannot be inverted',
41
- 33: 'Invalid units',
42
- 34: 'Invalid geometry layout',
43
- 36: 'Unknown SRS type',
44
- 37: 'Unknown geometry type found',
45
- 38: '`styleMapValue` has an unknown type',
46
- 39: 'Unknown geometry type',
47
- 40: 'Expected `feature` to have a geometry',
48
- 41: 'Expected an `ol/style/Style` or an array of `ol/style/Style.js`',
49
- 42: 'Question unknown, the answer is 42',
50
- 43: 'Expected `layers` to be an array or a `Collection`',
51
- 47: 'Expected `controls` to be an array or an `ol/Collection`',
52
- 48: 'Expected `interactions` to be an array or an `ol/Collection`',
53
- 49: 'Expected `overlays` to be an array or an `ol/Collection`',
54
- 50: '`options.featureTypes` should be an Array',
55
- 51: 'Either `url` or `tileJSON` options must be provided',
56
- 52: 'Unknown `serverType` configured',
57
- 53: 'Unknown `tierSizeCalculation` configured',
58
- 55: 'The {-y} placeholder requires a tile grid with extent',
59
- 56: 'mapBrowserEvent must originate from a pointer event',
60
- 57: 'At least 2 conditions are required',
61
- 59: 'Invalid command found in the PBF',
62
- 60: 'Missing or invalid `size`',
63
- 61: 'Cannot determine IIIF Image API version from provided image information JSON',
64
- 62: 'A `WebGLArrayBuffer` must either be of type `ELEMENT_ARRAY_BUFFER` or `ARRAY_BUFFER`',
65
- 64: 'Layer opacity must be a number',
66
- 66: '`forEachFeatureAtCoordinate` cannot be used on a WebGL layer if the hit detection logic has not been enabled. This is done by providing adequate shaders using the `hitVertexShader` and `hitFragmentShader` properties of `WebGLPointsLayerRenderer`',
67
- 67: 'A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both',
68
- 68: 'A VectorTile source can only be rendered if it has a projection compatible with the view projection',
69
- };
70
-
71
- /**
72
- * Error object thrown when an assertion failed. This is an ECMA-262 Error,
73
- * extended with a `code` property.
74
- * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error.
75
- */
76
- class AssertionError extends Error {
77
- /**
78
- * @param {number} code Error code.
79
- */
80
- constructor(code) {
81
- const message = messages[code];
82
-
83
- super(message);
84
-
85
- /**
86
- * Error code. The meaning of the code can be found on
87
- * https://openlayers.org/en/latest/doc/errors/ (replace `latest` with
88
- * the version found in the OpenLayers script's header comment if a version
89
- * other than the latest is used).
90
- * @type {number}
91
- * @deprecated ol/AssertionError and error codes will be removed in v8.0
92
- * @api
93
- */
94
- this.code = code;
95
-
96
- /**
97
- * @type {string}
98
- */
99
- this.name = 'AssertionError';
100
-
101
- // Re-assign message, see https://github.com/Rich-Harris/buble/issues/40
102
- this.message = message;
103
- }
104
- }
105
-
106
- var AssertionError$1 = AssertionError;
107
-
108
- /**
109
- * @module ol/events/Event
110
- */
111
-
112
- /**
113
- * @classdesc
114
- * Stripped down implementation of the W3C DOM Level 2 Event interface.
115
- * See https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-interface.
116
- *
117
- * This implementation only provides `type` and `target` properties, and
118
- * `stopPropagation` and `preventDefault` methods. It is meant as base class
119
- * for higher level events defined in the library, and works with
120
- * {@link module:ol/events/Target~Target}.
121
- */
122
- class BaseEvent {
123
- /**
124
- * @param {string} type Type.
125
- */
126
- constructor(type) {
127
- /**
128
- * @type {boolean}
129
- */
130
- this.propagationStopped;
131
-
132
- /**
133
- * @type {boolean}
134
- */
135
- this.defaultPrevented;
136
-
137
- /**
138
- * The event type.
139
- * @type {string}
140
- * @api
141
- */
142
- this.type = type;
143
-
144
- /**
145
- * The event target.
146
- * @type {Object}
147
- * @api
148
- */
149
- this.target = null;
150
- }
151
-
152
- /**
153
- * Prevent default. This means that no emulated `click`, `singleclick` or `doubleclick` events
154
- * will be fired.
155
- * @api
156
- */
157
- preventDefault() {
158
- this.defaultPrevented = true;
159
- }
160
-
161
- /**
162
- * Stop event propagation.
163
- * @api
164
- */
165
- stopPropagation() {
166
- this.propagationStopped = true;
167
- }
168
- }
169
-
170
- var Event$1 = BaseEvent;
171
-
172
- /**
173
- * @module ol/ObjectEventType
174
- */
175
-
176
- /**
177
- * @enum {string}
178
- */
179
- var ObjectEventType = {
180
- /**
181
- * Triggered when a property is changed.
182
- * @event module:ol/Object.ObjectEvent#propertychange
183
- * @api
184
- */
185
- PROPERTYCHANGE: 'propertychange',
186
- };
187
-
188
- /**
189
- * @typedef {'propertychange'} Types
190
- */
191
-
192
- /**
193
- * @module ol/Disposable
194
- */
195
-
196
- /**
197
- * @classdesc
198
- * Objects that need to clean up after themselves.
199
- */
200
- class Disposable {
201
- constructor() {
202
- /**
203
- * The object has already been disposed.
204
- * @type {boolean}
205
- * @protected
206
- */
207
- this.disposed = false;
208
- }
209
-
210
- /**
211
- * Clean up.
212
- */
213
- dispose() {
214
- if (!this.disposed) {
215
- this.disposed = true;
216
- this.disposeInternal();
217
- }
218
- }
219
-
220
- /**
221
- * Extension point for disposable objects.
222
- * @protected
223
- */
224
- disposeInternal() {}
225
- }
226
-
227
- var Disposable$1 = Disposable;
228
-
229
- /**
230
- * @module ol/functions
231
- */
232
-
233
- /**
234
- * A reusable function, used e.g. as a default for callbacks.
235
- *
236
- * @return {void} Nothing.
237
- */
238
- function VOID() {}
239
-
240
- /**
241
- * @module ol/obj
242
- */
243
-
244
- /**
245
- * Removes all properties from an object.
246
- * @param {Object} object The object to clear.
247
- */
248
- function clear(object) {
249
- for (const property in object) {
250
- delete object[property];
251
- }
252
- }
253
-
254
- /**
255
- * Determine if an object has any properties.
256
- * @param {Object} object The object to check.
257
- * @return {boolean} The object is empty.
258
- */
259
- function isEmpty(object) {
260
- let property;
261
- for (property in object) {
262
- return false;
263
- }
264
- return !property;
265
- }
266
-
267
- /**
268
- * @module ol/events/Target
269
- */
270
-
271
- /**
272
- * @typedef {EventTarget|Target} EventTargetLike
273
- */
274
-
275
- /**
276
- * @classdesc
277
- * A simplified implementation of the W3C DOM Level 2 EventTarget interface.
278
- * See https://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-EventTarget.
279
- *
280
- * There are two important simplifications compared to the specification:
281
- *
282
- * 1. The handling of `useCapture` in `addEventListener` and
283
- * `removeEventListener`. There is no real capture model.
284
- * 2. The handling of `stopPropagation` and `preventDefault` on `dispatchEvent`.
285
- * There is no event target hierarchy. When a listener calls
286
- * `stopPropagation` or `preventDefault` on an event object, it means that no
287
- * more listeners after this one will be called. Same as when the listener
288
- * returns false.
289
- */
290
- class Target extends Disposable$1 {
291
- /**
292
- * @param {*} [target] Default event target for dispatched events.
293
- */
294
- constructor(target) {
295
- super();
296
-
297
- /**
298
- * @private
299
- * @type {*}
300
- */
301
- this.eventTarget_ = target;
302
-
303
- /**
304
- * @private
305
- * @type {Object<string, number>}
306
- */
307
- this.pendingRemovals_ = null;
308
-
309
- /**
310
- * @private
311
- * @type {Object<string, number>}
312
- */
313
- this.dispatching_ = null;
314
-
315
- /**
316
- * @private
317
- * @type {Object<string, Array<import("../events.js").Listener>>}
318
- */
319
- this.listeners_ = null;
320
- }
321
-
322
- /**
323
- * @param {string} type Type.
324
- * @param {import("../events.js").Listener} listener Listener.
325
- */
326
- addEventListener(type, listener) {
327
- if (!type || !listener) {
328
- return;
329
- }
330
- const listeners = this.listeners_ || (this.listeners_ = {});
331
- const listenersForType = listeners[type] || (listeners[type] = []);
332
- if (!listenersForType.includes(listener)) {
333
- listenersForType.push(listener);
334
- }
335
- }
336
-
337
- /**
338
- * Dispatches an event and calls all listeners listening for events
339
- * of this type. The event parameter can either be a string or an
340
- * Object with a `type` property.
341
- *
342
- * @param {import("./Event.js").default|string} event Event object.
343
- * @return {boolean|undefined} `false` if anyone called preventDefault on the
344
- * event object or if any of the listeners returned false.
345
- * @api
346
- */
347
- dispatchEvent(event) {
348
- const isString = typeof event === 'string';
349
- const type = isString ? event : event.type;
350
- const listeners = this.listeners_ && this.listeners_[type];
351
- if (!listeners) {
352
- return;
353
- }
354
-
355
- const evt = isString ? new Event$1(event) : /** @type {Event} */ (event);
356
- if (!evt.target) {
357
- evt.target = this.eventTarget_ || this;
358
- }
359
- const dispatching = this.dispatching_ || (this.dispatching_ = {});
360
- const pendingRemovals =
361
- this.pendingRemovals_ || (this.pendingRemovals_ = {});
362
- if (!(type in dispatching)) {
363
- dispatching[type] = 0;
364
- pendingRemovals[type] = 0;
365
- }
366
- ++dispatching[type];
367
- let propagate;
368
- for (let i = 0, ii = listeners.length; i < ii; ++i) {
369
- if ('handleEvent' in listeners[i]) {
370
- propagate = /** @type {import("../events.js").ListenerObject} */ (
371
- listeners[i]
372
- ).handleEvent(evt);
373
- } else {
374
- propagate = /** @type {import("../events.js").ListenerFunction} */ (
375
- listeners[i]
376
- ).call(this, evt);
377
- }
378
- if (propagate === false || evt.propagationStopped) {
379
- propagate = false;
380
- break;
381
- }
382
- }
383
- if (--dispatching[type] === 0) {
384
- let pr = pendingRemovals[type];
385
- delete pendingRemovals[type];
386
- while (pr--) {
387
- this.removeEventListener(type, VOID);
388
- }
389
- delete dispatching[type];
390
- }
391
- return propagate;
392
- }
393
-
394
- /**
395
- * Clean up.
396
- */
397
- disposeInternal() {
398
- this.listeners_ && clear(this.listeners_);
399
- }
400
-
401
- /**
402
- * Get the listeners for a specified event type. Listeners are returned in the
403
- * order that they will be called in.
404
- *
405
- * @param {string} type Type.
406
- * @return {Array<import("../events.js").Listener>|undefined} Listeners.
407
- */
408
- getListeners(type) {
409
- return (this.listeners_ && this.listeners_[type]) || undefined;
410
- }
411
-
412
- /**
413
- * @param {string} [type] Type. If not provided,
414
- * `true` will be returned if this event target has any listeners.
415
- * @return {boolean} Has listeners.
416
- */
417
- hasListener(type) {
418
- if (!this.listeners_) {
419
- return false;
420
- }
421
- return type
422
- ? type in this.listeners_
423
- : Object.keys(this.listeners_).length > 0;
424
- }
425
-
426
- /**
427
- * @param {string} type Type.
428
- * @param {import("../events.js").Listener} listener Listener.
429
- */
430
- removeEventListener(type, listener) {
431
- const listeners = this.listeners_ && this.listeners_[type];
432
- if (listeners) {
433
- const index = listeners.indexOf(listener);
434
- if (index !== -1) {
435
- if (this.pendingRemovals_ && type in this.pendingRemovals_) {
436
- // make listener a no-op, and remove later in #dispatchEvent()
437
- listeners[index] = VOID;
438
- ++this.pendingRemovals_[type];
439
- } else {
440
- listeners.splice(index, 1);
441
- if (listeners.length === 0) {
442
- delete this.listeners_[type];
443
- }
444
- }
445
- }
446
- }
447
- }
448
- }
449
-
450
- var Target$1 = Target;
451
-
452
- /**
453
- * @module ol/events/EventType
454
- */
455
-
456
- /**
457
- * @enum {string}
458
- * @const
459
- */
460
- var EventType = {
461
- /**
462
- * Generic change event. Triggered when the revision counter is increased.
463
- * @event module:ol/events/Event~BaseEvent#change
464
- * @api
465
- */
466
- CHANGE: 'change',
467
-
468
- /**
469
- * Generic error event. Triggered when an error occurs.
470
- * @event module:ol/events/Event~BaseEvent#error
471
- * @api
472
- */
473
- ERROR: 'error',
474
-
475
- BLUR: 'blur',
476
- CLEAR: 'clear',
477
- CONTEXTMENU: 'contextmenu',
478
- CLICK: 'click',
479
- DBLCLICK: 'dblclick',
480
- DRAGENTER: 'dragenter',
481
- DRAGOVER: 'dragover',
482
- DROP: 'drop',
483
- FOCUS: 'focus',
484
- KEYDOWN: 'keydown',
485
- KEYPRESS: 'keypress',
486
- LOAD: 'load',
487
- RESIZE: 'resize',
488
- TOUCHMOVE: 'touchmove',
489
- WHEEL: 'wheel',
490
- };
491
-
492
- /**
493
- * @module ol/events
494
- */
495
-
496
- /**
497
- * Key to use with {@link module:ol/Observable.unByKey}.
498
- * @typedef {Object} EventsKey
499
- * @property {ListenerFunction} listener Listener.
500
- * @property {import("./events/Target.js").EventTargetLike} target Target.
501
- * @property {string} type Type.
502
- * @api
503
- */
504
-
505
- /**
506
- * Listener function. This function is called with an event object as argument.
507
- * When the function returns `false`, event propagation will stop.
508
- *
509
- * @typedef {function((Event|import("./events/Event.js").default)): (void|boolean)} ListenerFunction
510
- * @api
511
- */
512
-
513
- /**
514
- * @typedef {Object} ListenerObject
515
- * @property {ListenerFunction} handleEvent HandleEvent listener function.
516
- */
517
-
518
- /**
519
- * @typedef {ListenerFunction|ListenerObject} Listener
520
- */
521
-
522
- /**
523
- * Registers an event listener on an event target. Inspired by
524
- * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html
525
- *
526
- * This function efficiently binds a `listener` to a `this` object, and returns
527
- * a key for use with {@link module:ol/events.unlistenByKey}.
528
- *
529
- * @param {import("./events/Target.js").EventTargetLike} target Event target.
530
- * @param {string} type Event type.
531
- * @param {ListenerFunction} listener Listener.
532
- * @param {Object} [thisArg] Object referenced by the `this` keyword in the
533
- * listener. Default is the `target`.
534
- * @param {boolean} [once] If true, add the listener as one-off listener.
535
- * @return {EventsKey} Unique key for the listener.
536
- */
537
- function listen(target, type, listener, thisArg, once) {
538
- if (thisArg && thisArg !== target) {
539
- listener = listener.bind(thisArg);
540
- }
541
- if (once) {
542
- const originalListener = listener;
543
- listener = function () {
544
- target.removeEventListener(type, listener);
545
- originalListener.apply(this, arguments);
546
- };
547
- }
548
- const eventsKey = {
549
- target: target,
550
- type: type,
551
- listener: listener,
552
- };
553
- target.addEventListener(type, listener);
554
- return eventsKey;
555
- }
556
-
557
- /**
558
- * Registers a one-off event listener on an event target. Inspired by
559
- * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html
560
- *
561
- * This function efficiently binds a `listener` as self-unregistering listener
562
- * to a `this` object, and returns a key for use with
563
- * {@link module:ol/events.unlistenByKey} in case the listener needs to be
564
- * unregistered before it is called.
565
- *
566
- * When {@link module:ol/events.listen} is called with the same arguments after this
567
- * function, the self-unregistering listener will be turned into a permanent
568
- * listener.
569
- *
570
- * @param {import("./events/Target.js").EventTargetLike} target Event target.
571
- * @param {string} type Event type.
572
- * @param {ListenerFunction} listener Listener.
573
- * @param {Object} [thisArg] Object referenced by the `this` keyword in the
574
- * listener. Default is the `target`.
575
- * @return {EventsKey} Key for unlistenByKey.
576
- */
577
- function listenOnce(target, type, listener, thisArg) {
578
- return listen(target, type, listener, thisArg, true);
579
- }
580
-
581
- /**
582
- * Unregisters event listeners on an event target. Inspired by
583
- * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html
584
- *
585
- * The argument passed to this function is the key returned from
586
- * {@link module:ol/events.listen} or {@link module:ol/events.listenOnce}.
587
- *
588
- * @param {EventsKey} key The key.
589
- */
590
- function unlistenByKey(key) {
591
- if (key && key.target) {
592
- key.target.removeEventListener(key.type, key.listener);
593
- clear(key);
594
- }
595
- }
596
-
597
- /**
598
- * @module ol/Observable
599
- */
600
-
601
- /***
602
- * @template {string} Type
603
- * @template {Event|import("./events/Event.js").default} EventClass
604
- * @template Return
605
- * @typedef {(type: Type, listener: (event: EventClass) => ?) => Return} OnSignature
606
- */
607
-
608
- /***
609
- * @template {string} Type
610
- * @template Return
611
- * @typedef {(type: Type[], listener: (event: Event|import("./events/Event").default) => ?) => Return extends void ? void : Return[]} CombinedOnSignature
612
- */
613
-
614
- /**
615
- * @typedef {'change'|'error'} EventTypes
616
- */
617
-
618
- /***
619
- * @template Return
620
- * @typedef {OnSignature<EventTypes, import("./events/Event.js").default, Return> & CombinedOnSignature<EventTypes, Return>} ObservableOnSignature
621
- */
622
-
623
- /**
624
- * @classdesc
625
- * Abstract base class; normally only used for creating subclasses and not
626
- * instantiated in apps.
627
- * An event target providing convenient methods for listener registration
628
- * and unregistration. A generic `change` event is always available through
629
- * {@link module:ol/Observable~Observable#changed}.
630
- *
631
- * @fires import("./events/Event.js").default
632
- * @api
633
- */
634
- class Observable extends Target$1 {
635
- constructor() {
636
- super();
637
-
638
- this.on =
639
- /** @type {ObservableOnSignature<import("./events").EventsKey>} */ (
640
- this.onInternal
641
- );
642
-
643
- this.once =
644
- /** @type {ObservableOnSignature<import("./events").EventsKey>} */ (
645
- this.onceInternal
646
- );
647
-
648
- this.un = /** @type {ObservableOnSignature<void>} */ (this.unInternal);
649
-
650
- /**
651
- * @private
652
- * @type {number}
653
- */
654
- this.revision_ = 0;
655
- }
656
-
657
- /**
658
- * Increases the revision counter and dispatches a 'change' event.
659
- * @api
660
- */
661
- changed() {
662
- ++this.revision_;
663
- this.dispatchEvent(EventType.CHANGE);
664
- }
665
-
666
- /**
667
- * Get the version number for this object. Each time the object is modified,
668
- * its version number will be incremented.
669
- * @return {number} Revision.
670
- * @api
671
- */
672
- getRevision() {
673
- return this.revision_;
674
- }
675
-
676
- /**
677
- * @param {string|Array<string>} type Type.
678
- * @param {function((Event|import("./events/Event").default)): ?} listener Listener.
679
- * @return {import("./events.js").EventsKey|Array<import("./events.js").EventsKey>} Event key.
680
- * @protected
681
- */
682
- onInternal(type, listener) {
683
- if (Array.isArray(type)) {
684
- const len = type.length;
685
- const keys = new Array(len);
686
- for (let i = 0; i < len; ++i) {
687
- keys[i] = listen(this, type[i], listener);
688
- }
689
- return keys;
690
- } else {
691
- return listen(this, /** @type {string} */ (type), listener);
692
- }
693
- }
694
-
695
- /**
696
- * @param {string|Array<string>} type Type.
697
- * @param {function((Event|import("./events/Event").default)): ?} listener Listener.
698
- * @return {import("./events.js").EventsKey|Array<import("./events.js").EventsKey>} Event key.
699
- * @protected
700
- */
701
- onceInternal(type, listener) {
702
- let key;
703
- if (Array.isArray(type)) {
704
- const len = type.length;
705
- key = new Array(len);
706
- for (let i = 0; i < len; ++i) {
707
- key[i] = listenOnce(this, type[i], listener);
708
- }
709
- } else {
710
- key = listenOnce(this, /** @type {string} */ (type), listener);
711
- }
712
- /** @type {Object} */ (listener).ol_key = key;
713
- return key;
714
- }
715
-
716
- /**
717
- * Unlisten for a certain type of event.
718
- * @param {string|Array<string>} type Type.
719
- * @param {function((Event|import("./events/Event").default)): ?} listener Listener.
720
- * @protected
721
- */
722
- unInternal(type, listener) {
723
- const key = /** @type {Object} */ (listener).ol_key;
724
- if (key) {
725
- unByKey(key);
726
- } else if (Array.isArray(type)) {
727
- for (let i = 0, ii = type.length; i < ii; ++i) {
728
- this.removeEventListener(type[i], listener);
729
- }
730
- } else {
731
- this.removeEventListener(type, listener);
732
- }
733
- }
734
- }
735
-
736
- /**
737
- * Listen for a certain type of event.
738
- * @function
739
- * @param {string|Array<string>} type The event type or array of event types.
740
- * @param {function((Event|import("./events/Event").default)): ?} listener The listener function.
741
- * @return {import("./events.js").EventsKey|Array<import("./events.js").EventsKey>} Unique key for the listener. If
742
- * called with an array of event types as the first argument, the return
743
- * will be an array of keys.
744
- * @api
745
- */
746
- Observable.prototype.on;
747
-
748
- /**
749
- * Listen once for a certain type of event.
750
- * @function
751
- * @param {string|Array<string>} type The event type or array of event types.
752
- * @param {function((Event|import("./events/Event").default)): ?} listener The listener function.
753
- * @return {import("./events.js").EventsKey|Array<import("./events.js").EventsKey>} Unique key for the listener. If
754
- * called with an array of event types as the first argument, the return
755
- * will be an array of keys.
756
- * @api
757
- */
758
- Observable.prototype.once;
759
-
760
- /**
761
- * Unlisten for a certain type of event.
762
- * @function
763
- * @param {string|Array<string>} type The event type or array of event types.
764
- * @param {function((Event|import("./events/Event").default)): ?} listener The listener function.
765
- * @api
766
- */
767
- Observable.prototype.un;
768
-
769
- /**
770
- * Removes an event listener using the key returned by `on()` or `once()`.
771
- * @param {import("./events.js").EventsKey|Array<import("./events.js").EventsKey>} key The key returned by `on()`
772
- * or `once()` (or an array of keys).
773
- * @api
774
- */
775
- function unByKey(key) {
776
- if (Array.isArray(key)) {
777
- for (let i = 0, ii = key.length; i < ii; ++i) {
778
- unlistenByKey(key[i]);
779
- }
780
- } else {
781
- unlistenByKey(/** @type {import("./events.js").EventsKey} */ (key));
782
- }
783
- }
784
-
785
- var Observable$1 = Observable;
786
-
787
- /**
788
- * @module ol/util
789
- */
790
-
791
- /**
792
- * Counter for getUid.
793
- * @type {number}
794
- * @private
795
- */
796
- let uidCounter_ = 0;
797
-
798
- /**
799
- * Gets a unique ID for an object. This mutates the object so that further calls
800
- * with the same object as a parameter returns the same value. Unique IDs are generated
801
- * as a strictly increasing sequence. Adapted from goog.getUid.
802
- *
803
- * @param {Object} obj The object to get the unique ID for.
804
- * @return {string} The unique ID for the object.
805
- * @api
806
- */
807
- function getUid(obj) {
808
- return obj.ol_uid || (obj.ol_uid = String(++uidCounter_));
809
- }
810
-
811
- /**
812
- * @module ol/Object
813
- */
814
-
815
- /**
816
- * @classdesc
817
- * Events emitted by {@link module:ol/Object~BaseObject} instances are instances of this type.
818
- */
819
- class ObjectEvent extends Event$1 {
820
- /**
821
- * @param {string} type The event type.
822
- * @param {string} key The property name.
823
- * @param {*} oldValue The old value for `key`.
824
- */
825
- constructor(type, key, oldValue) {
826
- super(type);
827
-
828
- /**
829
- * The name of the property whose value is changing.
830
- * @type {string}
831
- * @api
832
- */
833
- this.key = key;
834
-
835
- /**
836
- * The old value. To get the new value use `e.target.get(e.key)` where
837
- * `e` is the event object.
838
- * @type {*}
839
- * @api
840
- */
841
- this.oldValue = oldValue;
842
- }
843
- }
844
-
845
- /***
846
- * @template Return
847
- * @typedef {import("./Observable").OnSignature<import("./Observable").EventTypes, import("./events/Event.js").default, Return> &
848
- * import("./Observable").OnSignature<import("./ObjectEventType").Types, ObjectEvent, Return> &
849
- * import("./Observable").CombinedOnSignature<import("./Observable").EventTypes|import("./ObjectEventType").Types, Return>} ObjectOnSignature
850
- */
851
-
852
- /**
853
- * @classdesc
854
- * Abstract base class; normally only used for creating subclasses and not
855
- * instantiated in apps.
856
- * Most non-trivial classes inherit from this.
857
- *
858
- * This extends {@link module:ol/Observable~Observable} with observable
859
- * properties, where each property is observable as well as the object as a
860
- * whole.
861
- *
862
- * Classes that inherit from this have pre-defined properties, to which you can
863
- * add your owns. The pre-defined properties are listed in this documentation as
864
- * 'Observable Properties', and have their own accessors; for example,
865
- * {@link module:ol/Map~Map} has a `target` property, accessed with
866
- * `getTarget()` and changed with `setTarget()`. Not all properties are however
867
- * settable. There are also general-purpose accessors `get()` and `set()`. For
868
- * example, `get('target')` is equivalent to `getTarget()`.
869
- *
870
- * The `set` accessors trigger a change event, and you can monitor this by
871
- * registering a listener. For example, {@link module:ol/View~View} has a
872
- * `center` property, so `view.on('change:center', function(evt) {...});` would
873
- * call the function whenever the value of the center property changes. Within
874
- * the function, `evt.target` would be the view, so `evt.target.getCenter()`
875
- * would return the new center.
876
- *
877
- * You can add your own observable properties with
878
- * `object.set('prop', 'value')`, and retrieve that with `object.get('prop')`.
879
- * You can listen for changes on that property value with
880
- * `object.on('change:prop', listener)`. You can get a list of all
881
- * properties with {@link module:ol/Object~BaseObject#getProperties}.
882
- *
883
- * Note that the observable properties are separate from standard JS properties.
884
- * You can, for example, give your map object a title with
885
- * `map.title='New title'` and with `map.set('title', 'Another title')`. The
886
- * first will be a `hasOwnProperty`; the second will appear in
887
- * `getProperties()`. Only the second is observable.
888
- *
889
- * Properties can be deleted by using the unset method. E.g.
890
- * object.unset('foo').
891
- *
892
- * @fires ObjectEvent
893
- * @api
894
- */
895
- class BaseObject extends Observable$1 {
896
- /**
897
- * @param {Object<string, *>} [values] An object with key-value pairs.
898
- */
899
- constructor(values) {
900
- super();
901
-
902
- /***
903
- * @type {ObjectOnSignature<import("./events").EventsKey>}
904
- */
905
- this.on;
906
-
907
- /***
908
- * @type {ObjectOnSignature<import("./events").EventsKey>}
909
- */
910
- this.once;
911
-
912
- /***
913
- * @type {ObjectOnSignature<void>}
914
- */
915
- this.un;
916
-
917
- // Call {@link module:ol/util.getUid} to ensure that the order of objects' ids is
918
- // the same as the order in which they were created. This also helps to
919
- // ensure that object properties are always added in the same order, which
920
- // helps many JavaScript engines generate faster code.
921
- getUid(this);
922
-
923
- /**
924
- * @private
925
- * @type {Object<string, *>}
926
- */
927
- this.values_ = null;
928
-
929
- if (values !== undefined) {
930
- this.setProperties(values);
931
- }
932
- }
933
-
934
- /**
935
- * Gets a value.
936
- * @param {string} key Key name.
937
- * @return {*} Value.
938
- * @api
939
- */
940
- get(key) {
941
- let value;
942
- if (this.values_ && this.values_.hasOwnProperty(key)) {
943
- value = this.values_[key];
944
- }
945
- return value;
946
- }
947
-
948
- /**
949
- * Get a list of object property names.
950
- * @return {Array<string>} List of property names.
951
- * @api
952
- */
953
- getKeys() {
954
- return (this.values_ && Object.keys(this.values_)) || [];
955
- }
956
-
957
- /**
958
- * Get an object of all property names and values.
959
- * @return {Object<string, *>} Object.
960
- * @api
961
- */
962
- getProperties() {
963
- return (this.values_ && Object.assign({}, this.values_)) || {};
964
- }
965
-
966
- /**
967
- * @return {boolean} The object has properties.
968
- */
969
- hasProperties() {
970
- return !!this.values_;
971
- }
972
-
973
- /**
974
- * @param {string} key Key name.
975
- * @param {*} oldValue Old value.
976
- */
977
- notify(key, oldValue) {
978
- let eventType;
979
- eventType = `change:${key}`;
980
- if (this.hasListener(eventType)) {
981
- this.dispatchEvent(new ObjectEvent(eventType, key, oldValue));
982
- }
983
- eventType = ObjectEventType.PROPERTYCHANGE;
984
- if (this.hasListener(eventType)) {
985
- this.dispatchEvent(new ObjectEvent(eventType, key, oldValue));
986
- }
987
- }
988
-
989
- /**
990
- * @param {string} key Key name.
991
- * @param {import("./events.js").Listener} listener Listener.
992
- */
993
- addChangeListener(key, listener) {
994
- this.addEventListener(`change:${key}`, listener);
995
- }
996
-
997
- /**
998
- * @param {string} key Key name.
999
- * @param {import("./events.js").Listener} listener Listener.
1000
- */
1001
- removeChangeListener(key, listener) {
1002
- this.removeEventListener(`change:${key}`, listener);
1003
- }
1004
-
1005
- /**
1006
- * Sets a value.
1007
- * @param {string} key Key name.
1008
- * @param {*} value Value.
1009
- * @param {boolean} [silent] Update without triggering an event.
1010
- * @api
1011
- */
1012
- set(key, value, silent) {
1013
- const values = this.values_ || (this.values_ = {});
1014
- if (silent) {
1015
- values[key] = value;
1016
- } else {
1017
- const oldValue = values[key];
1018
- values[key] = value;
1019
- if (oldValue !== value) {
1020
- this.notify(key, oldValue);
1021
- }
1022
- }
1023
- }
1024
-
1025
- /**
1026
- * Sets a collection of key-value pairs. Note that this changes any existing
1027
- * properties and adds new ones (it does not remove any existing properties).
1028
- * @param {Object<string, *>} values Values.
1029
- * @param {boolean} [silent] Update without triggering an event.
1030
- * @api
1031
- */
1032
- setProperties(values, silent) {
1033
- for (const key in values) {
1034
- this.set(key, values[key], silent);
1035
- }
1036
- }
1037
-
1038
- /**
1039
- * Apply any properties from another object without triggering events.
1040
- * @param {BaseObject} source The source object.
1041
- * @protected
1042
- */
1043
- applyProperties(source) {
1044
- if (!source.values_) {
1045
- return;
1046
- }
1047
- Object.assign(this.values_ || (this.values_ = {}), source.values_);
1048
- }
1049
-
1050
- /**
1051
- * Unsets a property.
1052
- * @param {string} key Key name.
1053
- * @param {boolean} [silent] Unset without triggering an event.
1054
- * @api
1055
- */
1056
- unset(key, silent) {
1057
- if (this.values_ && key in this.values_) {
1058
- const oldValue = this.values_[key];
1059
- delete this.values_[key];
1060
- if (isEmpty(this.values_)) {
1061
- this.values_ = null;
1062
- }
1063
- if (!silent) {
1064
- this.notify(key, oldValue);
1065
- }
1066
- }
1067
- }
1068
- }
1069
-
1070
- var BaseObject$1 = BaseObject;
1071
-
1072
- /**
1073
- * @module ol/CollectionEventType
1074
- */
1075
-
1076
- /**
1077
- * @enum {string}
1078
- */
1079
- var CollectionEventType = {
1080
- /**
1081
- * Triggered when an item is added to the collection.
1082
- * @event module:ol/Collection.CollectionEvent#add
1083
- * @api
1084
- */
1085
- ADD: 'add',
1086
- /**
1087
- * Triggered when an item is removed from the collection.
1088
- * @event module:ol/Collection.CollectionEvent#remove
1089
- * @api
1090
- */
1091
- REMOVE: 'remove',
1092
- };
1093
-
1094
- /**
1095
- * @module ol/Collection
1096
- */
1097
-
1098
- /**
1099
- * @enum {string}
1100
- * @private
1101
- */
1102
- const Property$1 = {
1103
- LENGTH: 'length',
1104
- };
1105
-
1106
- /**
1107
- * @classdesc
1108
- * Events emitted by {@link module:ol/Collection~Collection} instances are instances of this
1109
- * type.
1110
- * @template T
1111
- */
1112
- class CollectionEvent extends Event$1 {
1113
- /**
1114
- * @param {import("./CollectionEventType.js").default} type Type.
1115
- * @param {T} element Element.
1116
- * @param {number} index The index of the added or removed element.
1117
- */
1118
- constructor(type, element, index) {
1119
- super(type);
1120
-
1121
- /**
1122
- * The element that is added to or removed from the collection.
1123
- * @type {T}
1124
- * @api
1125
- */
1126
- this.element = element;
1127
-
1128
- /**
1129
- * The index of the added or removed element.
1130
- * @type {number}
1131
- * @api
1132
- */
1133
- this.index = index;
1134
- }
1135
- }
1136
-
1137
- /***
1138
- * @template T
1139
- * @template Return
1140
- * @typedef {import("./Observable").OnSignature<import("./Observable").EventTypes, import("./events/Event.js").default, Return> &
1141
- * import("./Observable").OnSignature<import("./ObjectEventType").Types|'change:length', import("./Object").ObjectEvent, Return> &
1142
- * import("./Observable").OnSignature<'add'|'remove', CollectionEvent<T>, Return> &
1143
- * import("./Observable").CombinedOnSignature<import("./Observable").EventTypes|import("./ObjectEventType").Types|
1144
- * 'change:length'|'add'|'remove',Return>} CollectionOnSignature
1145
- */
1146
-
1147
- /**
1148
- * @typedef {Object} Options
1149
- * @property {boolean} [unique=false] Disallow the same item from being added to
1150
- * the collection twice.
1151
- */
1152
-
1153
- /**
1154
- * @classdesc
1155
- * An expanded version of standard JS Array, adding convenience methods for
1156
- * manipulation. Add and remove changes to the Collection trigger a Collection
1157
- * event. Note that this does not cover changes to the objects _within_ the
1158
- * Collection; they trigger events on the appropriate object, not on the
1159
- * Collection as a whole.
1160
- *
1161
- * @fires CollectionEvent
1162
- *
1163
- * @template T
1164
- * @api
1165
- */
1166
- class Collection extends BaseObject$1 {
1167
- /**
1168
- * @param {Array<T>} [array] Array.
1169
- * @param {Options} [options] Collection options.
1170
- */
1171
- constructor(array, options) {
1172
- super();
1173
-
1174
- /***
1175
- * @type {CollectionOnSignature<T, import("./events").EventsKey>}
1176
- */
1177
- this.on;
1178
-
1179
- /***
1180
- * @type {CollectionOnSignature<T, import("./events").EventsKey>}
1181
- */
1182
- this.once;
1183
-
1184
- /***
1185
- * @type {CollectionOnSignature<T, void>}
1186
- */
1187
- this.un;
1188
-
1189
- options = options || {};
1190
-
1191
- /**
1192
- * @private
1193
- * @type {boolean}
1194
- */
1195
- this.unique_ = !!options.unique;
1196
-
1197
- /**
1198
- * @private
1199
- * @type {!Array<T>}
1200
- */
1201
- this.array_ = array ? array : [];
1202
-
1203
- if (this.unique_) {
1204
- for (let i = 0, ii = this.array_.length; i < ii; ++i) {
1205
- this.assertUnique_(this.array_[i], i);
1206
- }
1207
- }
1208
-
1209
- this.updateLength_();
1210
- }
1211
-
1212
- /**
1213
- * Remove all elements from the collection.
1214
- * @api
1215
- */
1216
- clear() {
1217
- while (this.getLength() > 0) {
1218
- this.pop();
1219
- }
1220
- }
1221
-
1222
- /**
1223
- * Add elements to the collection. This pushes each item in the provided array
1224
- * to the end of the collection.
1225
- * @param {!Array<T>} arr Array.
1226
- * @return {Collection<T>} This collection.
1227
- * @api
1228
- */
1229
- extend(arr) {
1230
- for (let i = 0, ii = arr.length; i < ii; ++i) {
1231
- this.push(arr[i]);
1232
- }
1233
- return this;
1234
- }
1235
-
1236
- /**
1237
- * Iterate over each element, calling the provided callback.
1238
- * @param {function(T, number, Array<T>): *} f The function to call
1239
- * for every element. This function takes 3 arguments (the element, the
1240
- * index and the array). The return value is ignored.
1241
- * @api
1242
- */
1243
- forEach(f) {
1244
- const array = this.array_;
1245
- for (let i = 0, ii = array.length; i < ii; ++i) {
1246
- f(array[i], i, array);
1247
- }
1248
- }
1249
-
1250
- /**
1251
- * Get a reference to the underlying Array object. Warning: if the array
1252
- * is mutated, no events will be dispatched by the collection, and the
1253
- * collection's "length" property won't be in sync with the actual length
1254
- * of the array.
1255
- * @return {!Array<T>} Array.
1256
- * @api
1257
- */
1258
- getArray() {
1259
- return this.array_;
1260
- }
1261
-
1262
- /**
1263
- * Get the element at the provided index.
1264
- * @param {number} index Index.
1265
- * @return {T} Element.
1266
- * @api
1267
- */
1268
- item(index) {
1269
- return this.array_[index];
1270
- }
1271
-
1272
- /**
1273
- * Get the length of this collection.
1274
- * @return {number} The length of the array.
1275
- * @observable
1276
- * @api
1277
- */
1278
- getLength() {
1279
- return this.get(Property$1.LENGTH);
1280
- }
1281
-
1282
- /**
1283
- * Insert an element at the provided index.
1284
- * @param {number} index Index.
1285
- * @param {T} elem Element.
1286
- * @api
1287
- */
1288
- insertAt(index, elem) {
1289
- if (index < 0 || index > this.getLength()) {
1290
- throw new Error('Index out of bounds: ' + index);
1291
- }
1292
- if (this.unique_) {
1293
- this.assertUnique_(elem);
1294
- }
1295
- this.array_.splice(index, 0, elem);
1296
- this.updateLength_();
1297
- this.dispatchEvent(
1298
- new CollectionEvent(CollectionEventType.ADD, elem, index)
1299
- );
1300
- }
1301
-
1302
- /**
1303
- * Remove the last element of the collection and return it.
1304
- * Return `undefined` if the collection is empty.
1305
- * @return {T|undefined} Element.
1306
- * @api
1307
- */
1308
- pop() {
1309
- return this.removeAt(this.getLength() - 1);
1310
- }
1311
-
1312
- /**
1313
- * Insert the provided element at the end of the collection.
1314
- * @param {T} elem Element.
1315
- * @return {number} New length of the collection.
1316
- * @api
1317
- */
1318
- push(elem) {
1319
- if (this.unique_) {
1320
- this.assertUnique_(elem);
1321
- }
1322
- const n = this.getLength();
1323
- this.insertAt(n, elem);
1324
- return this.getLength();
1325
- }
1326
-
1327
- /**
1328
- * Remove the first occurrence of an element from the collection.
1329
- * @param {T} elem Element.
1330
- * @return {T|undefined} The removed element or undefined if none found.
1331
- * @api
1332
- */
1333
- remove(elem) {
1334
- const arr = this.array_;
1335
- for (let i = 0, ii = arr.length; i < ii; ++i) {
1336
- if (arr[i] === elem) {
1337
- return this.removeAt(i);
1338
- }
1339
- }
1340
- return undefined;
1341
- }
1342
-
1343
- /**
1344
- * Remove the element at the provided index and return it.
1345
- * Return `undefined` if the collection does not contain this index.
1346
- * @param {number} index Index.
1347
- * @return {T|undefined} Value.
1348
- * @api
1349
- */
1350
- removeAt(index) {
1351
- if (index < 0 || index >= this.getLength()) {
1352
- return undefined;
1353
- }
1354
- const prev = this.array_[index];
1355
- this.array_.splice(index, 1);
1356
- this.updateLength_();
1357
- this.dispatchEvent(
1358
- /** @type {CollectionEvent<T>} */ (
1359
- new CollectionEvent(CollectionEventType.REMOVE, prev, index)
1360
- )
1361
- );
1362
- return prev;
1363
- }
1364
-
1365
- /**
1366
- * Set the element at the provided index.
1367
- * @param {number} index Index.
1368
- * @param {T} elem Element.
1369
- * @api
1370
- */
1371
- setAt(index, elem) {
1372
- const n = this.getLength();
1373
- if (index >= n) {
1374
- this.insertAt(index, elem);
1375
- return;
1376
- }
1377
- if (index < 0) {
1378
- throw new Error('Index out of bounds: ' + index);
1379
- }
1380
- if (this.unique_) {
1381
- this.assertUnique_(elem, index);
1382
- }
1383
- const prev = this.array_[index];
1384
- this.array_[index] = elem;
1385
- this.dispatchEvent(
1386
- /** @type {CollectionEvent<T>} */ (
1387
- new CollectionEvent(CollectionEventType.REMOVE, prev, index)
1388
- )
1389
- );
1390
- this.dispatchEvent(
1391
- /** @type {CollectionEvent<T>} */ (
1392
- new CollectionEvent(CollectionEventType.ADD, elem, index)
1393
- )
1394
- );
1395
- }
1396
-
1397
- /**
1398
- * @private
1399
- */
1400
- updateLength_() {
1401
- this.set(Property$1.LENGTH, this.array_.length);
1402
- }
1403
-
1404
- /**
1405
- * @private
1406
- * @param {T} elem Element.
1407
- * @param {number} [except] Optional index to ignore.
1408
- */
1409
- assertUnique_(elem, except) {
1410
- for (let i = 0, ii = this.array_.length; i < ii; ++i) {
1411
- if (this.array_[i] === elem && i !== except) {
1412
- throw new AssertionError$1(58);
1413
- }
1414
- }
1415
- }
1416
- }
1417
-
1418
- var Collection$1 = Collection;
1419
-
1420
- /**
1421
- * @module ol/asserts
1422
- */
1423
-
1424
- /**
1425
- * @param {*} assertion Assertion we expected to be truthy.
1426
- * @param {number} errorCode Error code.
1427
- */
1428
- function assert(assertion, errorCode) {
1429
- if (!assertion) {
1430
- throw new AssertionError$1(errorCode);
1431
- }
1432
- }
1433
-
1434
- /**
1435
- * @module ol/Feature
1436
- */
1437
-
1438
- /**
1439
- * @typedef {typeof Feature|typeof import("./render/Feature.js").default} FeatureClass
1440
- */
1441
-
1442
- /**
1443
- * @typedef {Feature|import("./render/Feature.js").default} FeatureLike
1444
- */
1445
-
1446
- /***
1447
- * @template Return
1448
- * @typedef {import("./Observable").OnSignature<import("./Observable").EventTypes, import("./events/Event.js").default, Return> &
1449
- * import("./Observable").OnSignature<import("./ObjectEventType").Types|'change:geometry', import("./Object").ObjectEvent, Return> &
1450
- * import("./Observable").CombinedOnSignature<import("./Observable").EventTypes|import("./ObjectEventType").Types
1451
- * |'change:geometry', Return>} FeatureOnSignature
1452
- */
1453
-
1454
- /***
1455
- * @template Geometry
1456
- * @typedef {Object<string, *> & { geometry?: Geometry }} ObjectWithGeometry
1457
- */
1458
-
1459
- /**
1460
- * @classdesc
1461
- * A vector object for geographic features with a geometry and other
1462
- * attribute properties, similar to the features in vector file formats like
1463
- * GeoJSON.
1464
- *
1465
- * Features can be styled individually with `setStyle`; otherwise they use the
1466
- * style of their vector layer.
1467
- *
1468
- * Note that attribute properties are set as {@link module:ol/Object~BaseObject} properties on
1469
- * the feature object, so they are observable, and have get/set accessors.
1470
- *
1471
- * Typically, a feature has a single geometry property. You can set the
1472
- * geometry using the `setGeometry` method and get it with `getGeometry`.
1473
- * It is possible to store more than one geometry on a feature using attribute
1474
- * properties. By default, the geometry used for rendering is identified by
1475
- * the property name `geometry`. If you want to use another geometry property
1476
- * for rendering, use the `setGeometryName` method to change the attribute
1477
- * property associated with the geometry for the feature. For example:
1478
- *
1479
- * ```js
1480
- *
1481
- * import Feature from 'ol/Feature';
1482
- * import Polygon from 'ol/geom/Polygon';
1483
- * import Point from 'ol/geom/Point';
1484
- *
1485
- * const feature = new Feature({
1486
- * geometry: new Polygon(polyCoords),
1487
- * labelPoint: new Point(labelCoords),
1488
- * name: 'My Polygon',
1489
- * });
1490
- *
1491
- * // get the polygon geometry
1492
- * const poly = feature.getGeometry();
1493
- *
1494
- * // Render the feature as a point using the coordinates from labelPoint
1495
- * feature.setGeometryName('labelPoint');
1496
- *
1497
- * // get the point geometry
1498
- * const point = feature.getGeometry();
1499
- * ```
1500
- *
1501
- * @api
1502
- * @template {import("./geom/Geometry.js").default} [Geometry=import("./geom/Geometry.js").default]
1503
- */
1504
- class Feature extends BaseObject$1 {
1505
- /**
1506
- * @param {Geometry|ObjectWithGeometry<Geometry>} [geometryOrProperties]
1507
- * You may pass a Geometry object directly, or an object literal containing
1508
- * properties. If you pass an object literal, you may include a Geometry
1509
- * associated with a `geometry` key.
1510
- */
1511
- constructor(geometryOrProperties) {
1512
- super();
1513
-
1514
- /***
1515
- * @type {FeatureOnSignature<import("./events").EventsKey>}
1516
- */
1517
- this.on;
1518
-
1519
- /***
1520
- * @type {FeatureOnSignature<import("./events").EventsKey>}
1521
- */
1522
- this.once;
1523
-
1524
- /***
1525
- * @type {FeatureOnSignature<void>}
1526
- */
1527
- this.un;
1528
-
1529
- /**
1530
- * @private
1531
- * @type {number|string|undefined}
1532
- */
1533
- this.id_ = undefined;
1534
-
1535
- /**
1536
- * @type {string}
1537
- * @private
1538
- */
1539
- this.geometryName_ = 'geometry';
1540
-
1541
- /**
1542
- * User provided style.
1543
- * @private
1544
- * @type {import("./style/Style.js").StyleLike}
1545
- */
1546
- this.style_ = null;
1547
-
1548
- /**
1549
- * @private
1550
- * @type {import("./style/Style.js").StyleFunction|undefined}
1551
- */
1552
- this.styleFunction_ = undefined;
1553
-
1554
- /**
1555
- * @private
1556
- * @type {?import("./events.js").EventsKey}
1557
- */
1558
- this.geometryChangeKey_ = null;
1559
-
1560
- this.addChangeListener(this.geometryName_, this.handleGeometryChanged_);
1561
-
1562
- if (geometryOrProperties) {
1563
- if (
1564
- typeof (
1565
- /** @type {?} */ (geometryOrProperties).getSimplifiedGeometry
1566
- ) === 'function'
1567
- ) {
1568
- const geometry = /** @type {Geometry} */ (geometryOrProperties);
1569
- this.setGeometry(geometry);
1570
- } else {
1571
- /** @type {Object<string, *>} */
1572
- const properties = geometryOrProperties;
1573
- this.setProperties(properties);
1574
- }
1575
- }
1576
- }
1577
-
1578
- /**
1579
- * Clone this feature. If the original feature has a geometry it
1580
- * is also cloned. The feature id is not set in the clone.
1581
- * @return {Feature<Geometry>} The clone.
1582
- * @api
1583
- */
1584
- clone() {
1585
- const clone = /** @type {Feature<Geometry>} */ (
1586
- new Feature(this.hasProperties() ? this.getProperties() : null)
1587
- );
1588
- clone.setGeometryName(this.getGeometryName());
1589
- const geometry = this.getGeometry();
1590
- if (geometry) {
1591
- clone.setGeometry(/** @type {Geometry} */ (geometry.clone()));
1592
- }
1593
- const style = this.getStyle();
1594
- if (style) {
1595
- clone.setStyle(style);
1596
- }
1597
- return clone;
1598
- }
1599
-
1600
- /**
1601
- * Get the feature's default geometry. A feature may have any number of named
1602
- * geometries. The "default" geometry (the one that is rendered by default) is
1603
- * set when calling {@link module:ol/Feature~Feature#setGeometry}.
1604
- * @return {Geometry|undefined} The default geometry for the feature.
1605
- * @api
1606
- * @observable
1607
- */
1608
- getGeometry() {
1609
- return /** @type {Geometry|undefined} */ (this.get(this.geometryName_));
1610
- }
1611
-
1612
- /**
1613
- * Get the feature identifier. This is a stable identifier for the feature and
1614
- * is either set when reading data from a remote source or set explicitly by
1615
- * calling {@link module:ol/Feature~Feature#setId}.
1616
- * @return {number|string|undefined} Id.
1617
- * @api
1618
- */
1619
- getId() {
1620
- return this.id_;
1621
- }
1622
-
1623
- /**
1624
- * Get the name of the feature's default geometry. By default, the default
1625
- * geometry is named `geometry`.
1626
- * @return {string} Get the property name associated with the default geometry
1627
- * for this feature.
1628
- * @api
1629
- */
1630
- getGeometryName() {
1631
- return this.geometryName_;
1632
- }
1633
-
1634
- /**
1635
- * Get the feature's style. Will return what was provided to the
1636
- * {@link module:ol/Feature~Feature#setStyle} method.
1637
- * @return {import("./style/Style.js").StyleLike|undefined} The feature style.
1638
- * @api
1639
- */
1640
- getStyle() {
1641
- return this.style_;
1642
- }
1643
-
1644
- /**
1645
- * Get the feature's style function.
1646
- * @return {import("./style/Style.js").StyleFunction|undefined} Return a function
1647
- * representing the current style of this feature.
1648
- * @api
1649
- */
1650
- getStyleFunction() {
1651
- return this.styleFunction_;
1652
- }
1653
-
1654
- /**
1655
- * @private
1656
- */
1657
- handleGeometryChange_() {
1658
- this.changed();
1659
- }
1660
-
1661
- /**
1662
- * @private
1663
- */
1664
- handleGeometryChanged_() {
1665
- if (this.geometryChangeKey_) {
1666
- unlistenByKey(this.geometryChangeKey_);
1667
- this.geometryChangeKey_ = null;
1668
- }
1669
- const geometry = this.getGeometry();
1670
- if (geometry) {
1671
- this.geometryChangeKey_ = listen(
1672
- geometry,
1673
- EventType.CHANGE,
1674
- this.handleGeometryChange_,
1675
- this
1676
- );
1677
- }
1678
- this.changed();
1679
- }
1680
-
1681
- /**
1682
- * Set the default geometry for the feature. This will update the property
1683
- * with the name returned by {@link module:ol/Feature~Feature#getGeometryName}.
1684
- * @param {Geometry|undefined} geometry The new geometry.
1685
- * @api
1686
- * @observable
1687
- */
1688
- setGeometry(geometry) {
1689
- this.set(this.geometryName_, geometry);
1690
- }
1691
-
1692
- /**
1693
- * Set the style for the feature to override the layer style. This can be a
1694
- * single style object, an array of styles, or a function that takes a
1695
- * resolution and returns an array of styles. To unset the feature style, call
1696
- * `setStyle()` without arguments or a falsey value.
1697
- * @param {import("./style/Style.js").StyleLike} [style] Style for this feature.
1698
- * @api
1699
- * @fires module:ol/events/Event~BaseEvent#event:change
1700
- */
1701
- setStyle(style) {
1702
- this.style_ = style;
1703
- this.styleFunction_ = !style ? undefined : createStyleFunction(style);
1704
- this.changed();
1705
- }
1706
-
1707
- /**
1708
- * Set the feature id. The feature id is considered stable and may be used when
1709
- * requesting features or comparing identifiers returned from a remote source.
1710
- * The feature id can be used with the
1711
- * {@link module:ol/source/Vector~VectorSource#getFeatureById} method.
1712
- * @param {number|string|undefined} id The feature id.
1713
- * @api
1714
- * @fires module:ol/events/Event~BaseEvent#event:change
1715
- */
1716
- setId(id) {
1717
- this.id_ = id;
1718
- this.changed();
1719
- }
1720
-
1721
- /**
1722
- * Set the property name to be used when getting the feature's default geometry.
1723
- * When calling {@link module:ol/Feature~Feature#getGeometry}, the value of the property with
1724
- * this name will be returned.
1725
- * @param {string} name The property name of the default geometry.
1726
- * @api
1727
- */
1728
- setGeometryName(name) {
1729
- this.removeChangeListener(this.geometryName_, this.handleGeometryChanged_);
1730
- this.geometryName_ = name;
1731
- this.addChangeListener(this.geometryName_, this.handleGeometryChanged_);
1732
- this.handleGeometryChanged_();
1733
- }
1734
- }
1735
-
1736
- /**
1737
- * Convert the provided object into a feature style function. Functions passed
1738
- * through unchanged. Arrays of Style or single style objects wrapped
1739
- * in a new feature style function.
1740
- * @param {!import("./style/Style.js").StyleFunction|!Array<import("./style/Style.js").default>|!import("./style/Style.js").default} obj
1741
- * A feature style function, a single style, or an array of styles.
1742
- * @return {import("./style/Style.js").StyleFunction} A style function.
1743
- */
1744
- function createStyleFunction(obj) {
1745
- if (typeof obj === 'function') {
1746
- return obj;
1747
- } else {
1748
- /**
1749
- * @type {Array<import("./style/Style.js").default>}
1750
- */
1751
- let styles;
1752
- if (Array.isArray(obj)) {
1753
- styles = obj;
1754
- } else {
1755
- assert(typeof (/** @type {?} */ (obj).getZIndex) === 'function', 41); // Expected an `import("./style/Style.js").Style` or an array of `import("./style/Style.js").Style`
1756
- const style = /** @type {import("./style/Style.js").default} */ (obj);
1757
- styles = [style];
1758
- }
1759
- return function () {
1760
- return styles;
1761
- };
1762
- }
1763
- }
1764
- var Feature$1 = Feature;
1765
-
1766
- /**
1767
- * @module ol/extent
1768
- */
1769
-
1770
- /**
1771
- * Check if one extent contains another.
1772
- *
1773
- * An extent is deemed contained if it lies completely within the other extent,
1774
- * including if they share one or more edges.
1775
- *
1776
- * @param {Extent} extent1 Extent 1.
1777
- * @param {Extent} extent2 Extent 2.
1778
- * @return {boolean} The second extent is contained by or on the edge of the
1779
- * first.
1780
- * @api
1781
- */
1782
- function containsExtent(extent1, extent2) {
1783
- return (
1784
- extent1[0] <= extent2[0] &&
1785
- extent2[2] <= extent1[2] &&
1786
- extent1[1] <= extent2[1] &&
1787
- extent2[3] <= extent1[3]
1788
- );
1789
- }
1790
-
1791
- /**
1792
- * Get the current computed width for the given element including margin,
1793
- * padding and border.
1794
- * Equivalent to jQuery's `$(el).outerWidth(true)`.
1795
- * @param {!HTMLElement} element Element.
1796
- * @return {number} The width.
1797
- */
1798
- function outerWidth(element) {
1799
- let width = element.offsetWidth;
1800
- const style = getComputedStyle(element);
1801
- width += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10);
1802
-
1803
- return width;
1804
- }
1805
-
1806
- /**
1807
- * Get the current computed height for the given element including margin,
1808
- * padding and border.
1809
- * Equivalent to jQuery's `$(el).outerHeight(true)`.
1810
- * @param {!HTMLElement} element Element.
1811
- * @return {number} The height.
1812
- */
1813
- function outerHeight(element) {
1814
- let height = element.offsetHeight;
1815
- const style = getComputedStyle(element);
1816
- height += parseInt(style.marginTop, 10) + parseInt(style.marginBottom, 10);
1817
-
1818
- return height;
1819
- }
1820
-
1821
- /**
1822
- * @param {Node} node The node to remove.
1823
- * @return {Node|null} The node that was removed or null.
1824
- */
1825
- function removeNode(node) {
1826
- return node && node.parentNode ? node.parentNode.removeChild(node) : null;
1827
- }
1828
-
1829
- /**
1830
- * @param {Node} node The node to remove the children from.
1831
- */
1832
- function removeChildren(node) {
1833
- while (node.lastChild) {
1834
- node.removeChild(node.lastChild);
1835
- }
1836
- }
1837
-
1838
- /**
1839
- * @module ol/css
1840
- */
1841
-
1842
- /**
1843
- * The CSS class that we'll give the DOM elements to have them selectable.
1844
- *
1845
- * @const
1846
- * @type {string}
1847
- */
1848
- const CLASS_SELECTABLE = 'ol-selectable';
1849
-
1850
- /**
1851
- * @module ol/TileState
1852
- */
1853
-
1854
- /**
1855
- * @enum {number}
1856
- */
1857
- var TileState = {
1858
- IDLE: 0,
1859
- LOADING: 1,
1860
- LOADED: 2,
1861
- /**
1862
- * Indicates that tile loading failed
1863
- * @type {number}
1864
- */
1865
- ERROR: 3,
1866
- EMPTY: 4,
1867
- };
1868
-
1869
- /**
1870
- * @module ol/MapEventType
1871
- */
1872
-
1873
- /**
1874
- * @enum {string}
1875
- */
1876
- var MapEventType = {
1877
- /**
1878
- * Triggered after a map frame is rendered.
1879
- * @event module:ol/MapEvent~MapEvent#postrender
1880
- * @api
1881
- */
1882
- POSTRENDER: 'postrender',
1883
-
1884
- /**
1885
- * Triggered when the map starts moving.
1886
- * @event module:ol/MapEvent~MapEvent#movestart
1887
- * @api
1888
- */
1889
- MOVESTART: 'movestart',
1890
-
1891
- /**
1892
- * Triggered after the map is moved.
1893
- * @event module:ol/MapEvent~MapEvent#moveend
1894
- * @api
1895
- */
1896
- MOVEEND: 'moveend',
1897
-
1898
- /**
1899
- * Triggered when loading of additional map data (tiles, images, features) starts.
1900
- * @event module:ol/MapEvent~MapEvent#loadstart
1901
- * @api
1902
- */
1903
- LOADSTART: 'loadstart',
1904
-
1905
- /**
1906
- * Triggered when loading of additional map data has completed.
1907
- * @event module:ol/MapEvent~MapEvent#loadend
1908
- * @api
1909
- */
1910
- LOADEND: 'loadend',
1911
- };
1912
-
1913
- /***
1914
- * @typedef {'postrender'|'movestart'|'moveend'|'loadstart'|'loadend'} Types
1915
- */
1916
-
1917
- /**
1918
- * @module ol/Overlay
1919
- */
1920
-
1921
- /**
1922
- * @typedef {'bottom-left' | 'bottom-center' | 'bottom-right' | 'center-left' | 'center-center' | 'center-right' | 'top-left' | 'top-center' | 'top-right'} Positioning
1923
- * The overlay position: `'bottom-left'`, `'bottom-center'`, `'bottom-right'`,
1924
- * `'center-left'`, `'center-center'`, `'center-right'`, `'top-left'`,
1925
- * `'top-center'`, or `'top-right'`.
1926
- */
1927
-
1928
- /**
1929
- * @typedef {Object} Options
1930
- * @property {number|string} [id] Set the overlay id. The overlay id can be used
1931
- * with the {@link module:ol/Map~Map#getOverlayById} method.
1932
- * @property {HTMLElement} [element] The overlay element.
1933
- * @property {Array<number>} [offset=[0, 0]] Offsets in pixels used when positioning
1934
- * the overlay. The first element in the
1935
- * array is the horizontal offset. A positive value shifts the overlay right.
1936
- * The second element in the array is the vertical offset. A positive value
1937
- * shifts the overlay down.
1938
- * @property {import("./coordinate.js").Coordinate} [position] The overlay position
1939
- * in map projection.
1940
- * @property {Positioning} [positioning='top-left'] Defines how
1941
- * the overlay is actually positioned with respect to its `position` property.
1942
- * Possible values are `'bottom-left'`, `'bottom-center'`, `'bottom-right'`,
1943
- * `'center-left'`, `'center-center'`, `'center-right'`, `'top-left'`,
1944
- * `'top-center'`, and `'top-right'`.
1945
- * @property {boolean} [stopEvent=true] Whether event propagation to the map
1946
- * viewport should be stopped. If `true` the overlay is placed in the same
1947
- * container as that of the controls (CSS class name
1948
- * `ol-overlaycontainer-stopevent`); if `false` it is placed in the container
1949
- * with CSS class name specified by the `className` property.
1950
- * @property {boolean} [insertFirst=true] Whether the overlay is inserted first
1951
- * in the overlay container, or appended. If the overlay is placed in the same
1952
- * container as that of the controls (see the `stopEvent` option) you will
1953
- * probably set `insertFirst` to `true` so the overlay is displayed below the
1954
- * controls.
1955
- * @property {PanIntoViewOptions|boolean} [autoPan=false] Pan the map when calling
1956
- * `setPosition`, so that the overlay is entirely visible in the current viewport.
1957
- * @property {string} [className='ol-overlay-container ol-selectable'] CSS class
1958
- * name.
1959
- */
1960
-
1961
- /**
1962
- * @typedef {Object} PanOptions
1963
- * @property {number} [duration=1000] The duration of the animation in
1964
- * milliseconds.
1965
- * @property {function(number):number} [easing] The easing function to use. Can
1966
- * be one from {@link module:ol/easing} or a custom function.
1967
- * Default is {@link module:ol/easing.inAndOut}.
1968
- */
1969
-
1970
- /**
1971
- * @typedef {Object} PanIntoViewOptions
1972
- * @property {PanOptions} [animation={}] The animation parameters for the pan
1973
- * @property {number} [margin=20] The margin (in pixels) between the
1974
- * overlay and the borders of the map when panning into view.
1975
- */
1976
-
1977
- /**
1978
- * @enum {string}
1979
- * @protected
1980
- */
1981
- const Property = {
1982
- ELEMENT: 'element',
1983
- MAP: 'map',
1984
- OFFSET: 'offset',
1985
- POSITION: 'position',
1986
- POSITIONING: 'positioning',
1987
- };
1988
-
1989
- /**
1990
- * @typedef {import("./ObjectEventType").Types|'change:element'|'change:map'|'change:offset'|'change:position'|
1991
- * 'change:positioning'} OverlayObjectEventTypes
1992
- */
1993
-
1994
- /***
1995
- * @template Return
1996
- * @typedef {import("./Observable").OnSignature<import("./Observable").EventTypes, import("./events/Event.js").default, Return> &
1997
- * import("./Observable").OnSignature<OverlayObjectEventTypes, import("./Object").ObjectEvent, Return> &
1998
- * import("./Observable").CombinedOnSignature<import("./Observable").EventTypes|OverlayObjectEventTypes, Return>} OverlayOnSignature
1999
- */
2000
-
2001
- /**
2002
- * @classdesc
2003
- * An element to be displayed over the map and attached to a single map
2004
- * location. Like {@link module:ol/control/Control~Control}, Overlays are
2005
- * visible widgets. Unlike Controls, they are not in a fixed position on the
2006
- * screen, but are tied to a geographical coordinate, so panning the map will
2007
- * move an Overlay but not a Control.
2008
- *
2009
- * Example:
2010
- *
2011
- * import Overlay from 'ol/Overlay';
2012
- *
2013
- * // ...
2014
- * const popup = new Overlay({
2015
- * element: document.getElementById('popup'),
2016
- * });
2017
- * popup.setPosition(coordinate);
2018
- * map.addOverlay(popup);
2019
- *
2020
- * @api
2021
- */
2022
- class Overlay extends BaseObject$1 {
2023
- /**
2024
- * @param {Options} options Overlay options.
2025
- */
2026
- constructor(options) {
2027
- super();
2028
-
2029
- /***
2030
- * @type {OverlayOnSignature<import("./events").EventsKey>}
2031
- */
2032
- this.on;
2033
-
2034
- /***
2035
- * @type {OverlayOnSignature<import("./events").EventsKey>}
2036
- */
2037
- this.once;
2038
-
2039
- /***
2040
- * @type {OverlayOnSignature<void>}
2041
- */
2042
- this.un;
2043
-
2044
- /**
2045
- * @protected
2046
- * @type {Options}
2047
- */
2048
- this.options = options;
2049
-
2050
- /**
2051
- * @protected
2052
- * @type {number|string|undefined}
2053
- */
2054
- this.id = options.id;
2055
-
2056
- /**
2057
- * @protected
2058
- * @type {boolean}
2059
- */
2060
- this.insertFirst =
2061
- options.insertFirst !== undefined ? options.insertFirst : true;
2062
-
2063
- /**
2064
- * @protected
2065
- * @type {boolean}
2066
- */
2067
- this.stopEvent = options.stopEvent !== undefined ? options.stopEvent : true;
2068
-
2069
- /**
2070
- * @protected
2071
- * @type {HTMLElement}
2072
- */
2073
- this.element = document.createElement('div');
2074
- this.element.className =
2075
- options.className !== undefined
2076
- ? options.className
2077
- : 'ol-overlay-container ' + CLASS_SELECTABLE;
2078
- this.element.style.position = 'absolute';
2079
- this.element.style.pointerEvents = 'auto';
2080
-
2081
- /**
2082
- * @protected
2083
- * @type {PanIntoViewOptions|undefined}
2084
- */
2085
- this.autoPan = options.autoPan === true ? {} : options.autoPan || undefined;
2086
-
2087
- /**
2088
- * @protected
2089
- * @type {{transform_: string,
2090
- * visible: boolean}}
2091
- */
2092
- this.rendered = {
2093
- transform_: '',
2094
- visible: true,
2095
- };
2096
-
2097
- /**
2098
- * @protected
2099
- * @type {?import("./events.js").EventsKey}
2100
- */
2101
- this.mapPostrenderListenerKey = null;
2102
-
2103
- this.addChangeListener(Property.ELEMENT, this.handleElementChanged);
2104
- this.addChangeListener(Property.MAP, this.handleMapChanged);
2105
- this.addChangeListener(Property.OFFSET, this.handleOffsetChanged);
2106
- this.addChangeListener(Property.POSITION, this.handlePositionChanged);
2107
- this.addChangeListener(Property.POSITIONING, this.handlePositioningChanged);
2108
-
2109
- if (options.element !== undefined) {
2110
- this.setElement(options.element);
2111
- }
2112
-
2113
- this.setOffset(options.offset !== undefined ? options.offset : [0, 0]);
2114
-
2115
- this.setPositioning(options.positioning || 'top-left');
2116
-
2117
- if (options.position !== undefined) {
2118
- this.setPosition(options.position);
2119
- }
2120
- }
2121
-
2122
- /**
2123
- * Get the DOM element of this overlay.
2124
- * @return {HTMLElement|undefined} The Element containing the overlay.
2125
- * @observable
2126
- * @api
2127
- */
2128
- getElement() {
2129
- return /** @type {HTMLElement|undefined} */ (this.get(Property.ELEMENT));
2130
- }
2131
-
2132
- /**
2133
- * Get the overlay identifier which is set on constructor.
2134
- * @return {number|string|undefined} Id.
2135
- * @api
2136
- */
2137
- getId() {
2138
- return this.id;
2139
- }
2140
-
2141
- /**
2142
- * Get the map associated with this overlay.
2143
- * @return {import("./Map.js").default|null} The map that the
2144
- * overlay is part of.
2145
- * @observable
2146
- * @api
2147
- */
2148
- getMap() {
2149
- return /** @type {import("./Map.js").default|null} */ (
2150
- this.get(Property.MAP) || null
2151
- );
2152
- }
2153
-
2154
- /**
2155
- * Get the offset of this overlay.
2156
- * @return {Array<number>} The offset.
2157
- * @observable
2158
- * @api
2159
- */
2160
- getOffset() {
2161
- return /** @type {Array<number>} */ (this.get(Property.OFFSET));
2162
- }
2163
-
2164
- /**
2165
- * Get the current position of this overlay.
2166
- * @return {import("./coordinate.js").Coordinate|undefined} The spatial point that the overlay is
2167
- * anchored at.
2168
- * @observable
2169
- * @api
2170
- */
2171
- getPosition() {
2172
- return /** @type {import("./coordinate.js").Coordinate|undefined} */ (
2173
- this.get(Property.POSITION)
2174
- );
2175
- }
2176
-
2177
- /**
2178
- * Get the current positioning of this overlay.
2179
- * @return {Positioning} How the overlay is positioned
2180
- * relative to its point on the map.
2181
- * @observable
2182
- * @api
2183
- */
2184
- getPositioning() {
2185
- return /** @type {Positioning} */ (this.get(Property.POSITIONING));
2186
- }
2187
-
2188
- /**
2189
- * @protected
2190
- */
2191
- handleElementChanged() {
2192
- removeChildren(this.element);
2193
- const element = this.getElement();
2194
- if (element) {
2195
- this.element.appendChild(element);
2196
- }
2197
- }
2198
-
2199
- /**
2200
- * @protected
2201
- */
2202
- handleMapChanged() {
2203
- if (this.mapPostrenderListenerKey) {
2204
- removeNode(this.element);
2205
- unlistenByKey(this.mapPostrenderListenerKey);
2206
- this.mapPostrenderListenerKey = null;
2207
- }
2208
- const map = this.getMap();
2209
- if (map) {
2210
- this.mapPostrenderListenerKey = listen(
2211
- map,
2212
- MapEventType.POSTRENDER,
2213
- this.render,
2214
- this
2215
- );
2216
- this.updatePixelPosition();
2217
- const container = this.stopEvent
2218
- ? map.getOverlayContainerStopEvent()
2219
- : map.getOverlayContainer();
2220
- if (this.insertFirst) {
2221
- container.insertBefore(this.element, container.childNodes[0] || null);
2222
- } else {
2223
- container.appendChild(this.element);
2224
- }
2225
- this.performAutoPan();
2226
- }
2227
- }
2228
-
2229
- /**
2230
- * @protected
2231
- */
2232
- render() {
2233
- this.updatePixelPosition();
2234
- }
2235
-
2236
- /**
2237
- * @protected
2238
- */
2239
- handleOffsetChanged() {
2240
- this.updatePixelPosition();
2241
- }
2242
-
2243
- /**
2244
- * @protected
2245
- */
2246
- handlePositionChanged() {
2247
- this.updatePixelPosition();
2248
- this.performAutoPan();
2249
- }
2250
-
2251
- /**
2252
- * @protected
2253
- */
2254
- handlePositioningChanged() {
2255
- this.updatePixelPosition();
2256
- }
2257
-
2258
- /**
2259
- * Set the DOM element to be associated with this overlay.
2260
- * @param {HTMLElement|undefined} element The Element containing the overlay.
2261
- * @observable
2262
- * @api
2263
- */
2264
- setElement(element) {
2265
- this.set(Property.ELEMENT, element);
2266
- }
2267
-
2268
- /**
2269
- * Set the map to be associated with this overlay.
2270
- * @param {import("./Map.js").default|null} map The map that the
2271
- * overlay is part of. Pass `null` to just remove the overlay from the current map.
2272
- * @observable
2273
- * @api
2274
- */
2275
- setMap(map) {
2276
- this.set(Property.MAP, map);
2277
- }
2278
-
2279
- /**
2280
- * Set the offset for this overlay.
2281
- * @param {Array<number>} offset Offset.
2282
- * @observable
2283
- * @api
2284
- */
2285
- setOffset(offset) {
2286
- this.set(Property.OFFSET, offset);
2287
- }
2288
-
2289
- /**
2290
- * Set the position for this overlay. If the position is `undefined` the
2291
- * overlay is hidden.
2292
- * @param {import("./coordinate.js").Coordinate|undefined} position The spatial point that the overlay
2293
- * is anchored at.
2294
- * @observable
2295
- * @api
2296
- */
2297
- setPosition(position) {
2298
- this.set(Property.POSITION, position);
2299
- }
2300
-
2301
- /**
2302
- * Pan the map so that the overlay is entirely visible in the current viewport
2303
- * (if necessary) using the configured autoPan parameters
2304
- * @protected
2305
- */
2306
- performAutoPan() {
2307
- if (this.autoPan) {
2308
- this.panIntoView(this.autoPan);
2309
- }
2310
- }
2311
-
2312
- /**
2313
- * Pan the map so that the overlay is entirely visible in the current viewport
2314
- * (if necessary).
2315
- * @param {PanIntoViewOptions} [panIntoViewOptions] Options for the pan action
2316
- * @api
2317
- */
2318
- panIntoView(panIntoViewOptions) {
2319
- const map = this.getMap();
2320
-
2321
- if (!map || !map.getTargetElement() || !this.get(Property.POSITION)) {
2322
- return;
2323
- }
2324
-
2325
- const mapRect = this.getRect(map.getTargetElement(), map.getSize());
2326
- const element = this.getElement();
2327
- const overlayRect = this.getRect(element, [
2328
- outerWidth(element),
2329
- outerHeight(element),
2330
- ]);
2331
-
2332
- panIntoViewOptions = panIntoViewOptions || {};
2333
-
2334
- const myMargin =
2335
- panIntoViewOptions.margin === undefined ? 20 : panIntoViewOptions.margin;
2336
- if (!containsExtent(mapRect, overlayRect)) {
2337
- // the overlay is not completely inside the viewport, so pan the map
2338
- const offsetLeft = overlayRect[0] - mapRect[0];
2339
- const offsetRight = mapRect[2] - overlayRect[2];
2340
- const offsetTop = overlayRect[1] - mapRect[1];
2341
- const offsetBottom = mapRect[3] - overlayRect[3];
2342
-
2343
- const delta = [0, 0];
2344
- if (offsetLeft < 0) {
2345
- // move map to the left
2346
- delta[0] = offsetLeft - myMargin;
2347
- } else if (offsetRight < 0) {
2348
- // move map to the right
2349
- delta[0] = Math.abs(offsetRight) + myMargin;
2350
- }
2351
- if (offsetTop < 0) {
2352
- // move map up
2353
- delta[1] = offsetTop - myMargin;
2354
- } else if (offsetBottom < 0) {
2355
- // move map down
2356
- delta[1] = Math.abs(offsetBottom) + myMargin;
2357
- }
2358
-
2359
- if (delta[0] !== 0 || delta[1] !== 0) {
2360
- const center = /** @type {import("./coordinate.js").Coordinate} */ (
2361
- map.getView().getCenterInternal()
2362
- );
2363
- const centerPx = map.getPixelFromCoordinateInternal(center);
2364
- if (!centerPx) {
2365
- return;
2366
- }
2367
- const newCenterPx = [centerPx[0] + delta[0], centerPx[1] + delta[1]];
2368
-
2369
- const panOptions = panIntoViewOptions.animation || {};
2370
- map.getView().animateInternal({
2371
- center: map.getCoordinateFromPixelInternal(newCenterPx),
2372
- duration: panOptions.duration,
2373
- easing: panOptions.easing,
2374
- });
2375
- }
2376
- }
2377
- }
2378
-
2379
- /**
2380
- * Get the extent of an element relative to the document
2381
- * @param {HTMLElement} element The element.
2382
- * @param {import("./size.js").Size} size The size of the element.
2383
- * @return {import("./extent.js").Extent} The extent.
2384
- * @protected
2385
- */
2386
- getRect(element, size) {
2387
- const box = element.getBoundingClientRect();
2388
- const offsetX = box.left + window.pageXOffset;
2389
- const offsetY = box.top + window.pageYOffset;
2390
- return [offsetX, offsetY, offsetX + size[0], offsetY + size[1]];
2391
- }
2392
-
2393
- /**
2394
- * Set the positioning for this overlay.
2395
- * @param {Positioning} positioning how the overlay is
2396
- * positioned relative to its point on the map.
2397
- * @observable
2398
- * @api
2399
- */
2400
- setPositioning(positioning) {
2401
- this.set(Property.POSITIONING, positioning);
2402
- }
2403
-
2404
- /**
2405
- * Modify the visibility of the element.
2406
- * @param {boolean} visible Element visibility.
2407
- * @protected
2408
- */
2409
- setVisible(visible) {
2410
- if (this.rendered.visible !== visible) {
2411
- this.element.style.display = visible ? '' : 'none';
2412
- this.rendered.visible = visible;
2413
- }
2414
- }
2415
-
2416
- /**
2417
- * Update pixel position.
2418
- * @protected
2419
- */
2420
- updatePixelPosition() {
2421
- const map = this.getMap();
2422
- const position = this.getPosition();
2423
- if (!map || !map.isRendered() || !position) {
2424
- this.setVisible(false);
2425
- return;
2426
- }
2427
-
2428
- const pixel = map.getPixelFromCoordinate(position);
2429
- const mapSize = map.getSize();
2430
- this.updateRenderedPosition(pixel, mapSize);
2431
- }
2432
-
2433
- /**
2434
- * @param {import("./pixel.js").Pixel} pixel The pixel location.
2435
- * @param {import("./size.js").Size|undefined} mapSize The map size.
2436
- * @protected
2437
- */
2438
- updateRenderedPosition(pixel, mapSize) {
2439
- const style = this.element.style;
2440
- const offset = this.getOffset();
2441
-
2442
- const positioning = this.getPositioning();
2443
-
2444
- this.setVisible(true);
2445
-
2446
- const x = Math.round(pixel[0] + offset[0]) + 'px';
2447
- const y = Math.round(pixel[1] + offset[1]) + 'px';
2448
- let posX = '0%';
2449
- let posY = '0%';
2450
- if (
2451
- positioning == 'bottom-right' ||
2452
- positioning == 'center-right' ||
2453
- positioning == 'top-right'
2454
- ) {
2455
- posX = '-100%';
2456
- } else if (
2457
- positioning == 'bottom-center' ||
2458
- positioning == 'center-center' ||
2459
- positioning == 'top-center'
2460
- ) {
2461
- posX = '-50%';
2462
- }
2463
- if (
2464
- positioning == 'bottom-left' ||
2465
- positioning == 'bottom-center' ||
2466
- positioning == 'bottom-right'
2467
- ) {
2468
- posY = '-100%';
2469
- } else if (
2470
- positioning == 'center-left' ||
2471
- positioning == 'center-center' ||
2472
- positioning == 'center-right'
2473
- ) {
2474
- posY = '-50%';
2475
- }
2476
- const transform = `translate(${posX}, ${posY}) translate(${x}, ${y})`;
2477
- if (this.rendered.transform_ != transform) {
2478
- this.rendered.transform_ = transform;
2479
- style.transform = transform;
2480
- }
2481
- }
2482
-
2483
- /**
2484
- * returns the options this Overlay has been created with
2485
- * @return {Options} overlay options
2486
- */
2487
- getOptions() {
2488
- return this.options;
2489
- }
2490
- }
2491
-
2492
- var Overlay$1 = Overlay;
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('ol/style/Circle.js'), require('ol/style/Fill.js'), require('ol/style/Stroke.js'), require('ol/style/Style.js'), require('ol/control/Control.js'), require('ol/interaction/Draw.js'), require('ol/interaction/Modify.js'), require('ol/interaction/Select.js'), require('ol/interaction/Snap.js'), require('ol/Collection.js'), require('ol/events/Event.js'), require('ol/events/condition.js'), require('ol/Observable.js'), require('ol/layer/Vector.js'), require('ol/layer/Base.js'), require('ol/format/GeoJSON.js'), require('ol/source/Vector.js'), require('ol/proj.js'), require('ol/loadingstrategy.js'), require('ol/layer/Tile.js'), require('ol/source/TileWMS.js'), require('ol/geom.js'), require('ol/format/KML.js'), require('ol/format/WFS.js'), require('ol/style.js'), require('ol/Object.js'), require('ol/geom/Circle.js'), require('ol/geom/GeometryCollection.js'), require('ol/Feature.js'), require('ol/geom/Polygon.js'), require('ol/extent.js'), require('ol/Overlay.js')) :
3
+ typeof define === 'function' && define.amd ? define(['ol/style/Circle.js', 'ol/style/Fill.js', 'ol/style/Stroke.js', 'ol/style/Style.js', 'ol/control/Control.js', 'ol/interaction/Draw.js', 'ol/interaction/Modify.js', 'ol/interaction/Select.js', 'ol/interaction/Snap.js', 'ol/Collection.js', 'ol/events/Event.js', 'ol/events/condition.js', 'ol/Observable.js', 'ol/layer/Vector.js', 'ol/layer/Base.js', 'ol/format/GeoJSON.js', 'ol/source/Vector.js', 'ol/proj.js', 'ol/loadingstrategy.js', 'ol/layer/Tile.js', 'ol/source/TileWMS.js', 'ol/geom.js', 'ol/format/KML.js', 'ol/format/WFS.js', 'ol/style.js', 'ol/Object.js', 'ol/geom/Circle.js', 'ol/geom/GeometryCollection.js', 'ol/Feature.js', 'ol/geom/Polygon.js', 'ol/extent.js', 'ol/Overlay.js'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Wfst = factory(global.ol.style.Circle, global.ol.style.Fill, global.ol.style.Stroke, global.ol.style.Style, global.ol.control.Control, global.ol.interaction.Draw, global.ol.interaction.Modify, global.ol.interaction.Select, global.ol.interaction.Snap, global.ol.Collection, global.ol.events.Event, global.ol.events.condition, global.ol.Observable, global.ol.layer.Vector, global.ol.layer.Base, global.ol.format.GeoJSON, global.ol.source.Vector, global.ol.proj, global.ol.loadingstrategy, global.ol.layer.Tile, global.ol.source.TileWMS, global.ol.geom, global.ol.format.KML, global.ol.format.WFS, global.ol.style, global.ol.Object, global.ol.geom.Circle, global.ol.geom.GeometryCollection, global.ol.Feature, global.ol.geom.Polygon, global.ol.extent, global.ol.Overlay));
5
+ })(this, (function (CircleStyle, Fill, Stroke, Style, Control, Draw, Modify, Select, Snap, Collection, BaseEvent, condition_js, Observable, VectorLayer, Layer, GeoJSON, VectorSource, proj_js, loadingstrategy_js, TileLayer, TileWMS, geom_js, KML, WFS, style_js, BaseObject, Circle, GeometryCollection, Feature, Polygon_js, extent_js, Overlay) { 'use strict';
2493
6
 
2494
7
  var domain;
2495
8
 
@@ -3586,9 +1099,11 @@
3586
1099
  const initModal = (opts) => {
3587
1100
  options = opts;
3588
1101
  };
3589
- const parseError = (geoserverError) => {
3590
- if ('exceptions' in geoserverError) {
3591
- return geoserverError.exceptions.map((e) => e.text).join(',');
1102
+ const parseError = (geoserverResponse) => {
1103
+ if ('exceptions' in geoserverResponse) {
1104
+ return geoserverResponse.exceptions
1105
+ .map((e) => e.text)
1106
+ .join(',');
3592
1107
  }
3593
1108
  else {
3594
1109
  return '';
@@ -3607,7 +1122,7 @@
3607
1122
  }
3608
1123
  isError.add(layerName);
3609
1124
  let err_msg = `<b>Error: ${msg}</b>`;
3610
- if (originalError) {
1125
+ if (originalError && originalError.message !== msg) {
3611
1126
  err_msg += `. ${originalError.message}`;
3612
1127
  }
3613
1128
  const al = Modal.alert(err_msg, options);
@@ -3651,9 +1166,9 @@
3651
1166
  geoserver: 'No se pudieron obtener datos desde el GeoServer',
3652
1167
  badFormat: 'Formato no soportado',
3653
1168
  badFile: 'Error al leer elementos del archivo',
3654
- lockFeature: 'No se pudieron bloquear elementos en el GeoServer.',
3655
- transaction: 'Error al hacer transacción con el GeoServer.',
3656
- getFeatures: 'Error al obtener elemento desde el GeoServer.'
1169
+ lockFeature: 'No se pudieron bloquear elementos en el GeoServer',
1170
+ transaction: 'Error al hacer transacción con el GeoServer',
1171
+ getFeatures: 'Error al obtener elemento desde el GeoServer'
3657
1172
  }
3658
1173
  };
3659
1174
 
@@ -3691,9 +1206,9 @@
3691
1206
  geoserver: 'Failed to get data from GeoServer',
3692
1207
  badFormat: 'Unsupported format',
3693
1208
  badFile: 'Error reading items from file',
3694
- lockFeature: 'Could not lock items on the GeoServer.',
3695
- transaction: 'Error when doing Transaction with GeoServer.',
3696
- getFeatures: 'Error getting elements from GeoServer.'
1209
+ lockFeature: 'Could not lock items on the GeoServer',
1210
+ transaction: 'Error when doing Transaction with GeoServer',
1211
+ getFeatures: 'Error getting elements from GeoServer'
3697
1212
  }
3698
1213
  };
3699
1214
 
@@ -3751,7 +1266,7 @@
3751
1266
  }
3752
1267
  // Check if customs translations are provided
3753
1268
  if (customI18n) {
3754
- I18N = { ...I18N, ...customI18n };
1269
+ I18N = Object.assign(Object.assign({}, I18N), customI18n);
3755
1270
  }
3756
1271
  };
3757
1272
 
@@ -4021,7 +1536,7 @@
4021
1536
  this.getAndUpdateDescribeFeatureType();
4022
1537
  }
4023
1538
  else {
4024
- geoserver.on('change:capabilities', () => {
1539
+ geoserver.on('change:capabilities', async () => {
4025
1540
  this.getAndUpdateDescribeFeatureType();
4026
1541
  });
4027
1542
  }
@@ -4056,6 +1571,9 @@
4056
1571
  if (!data) {
4057
1572
  throw new Error('');
4058
1573
  }
1574
+ if (data.exceptions) {
1575
+ throw new Error(parseError(data));
1576
+ }
4059
1577
  const targetNamespace = data.targetNamespace;
4060
1578
  const properties = data.featureTypes[0].properties;
4061
1579
  // Find the geometry field
@@ -4070,7 +1588,7 @@
4070
1588
  }
4071
1589
  catch (err) {
4072
1590
  console.error(err);
4073
- throw new Error(`${I18N.errors.layer} "${layerLabel}"`);
1591
+ showError(`${I18N.errors.layer} "${layerLabel}"`, err, layerName);
4074
1592
  }
4075
1593
  }
4076
1594
  /**
@@ -4139,21 +1657,12 @@
4139
1657
  * @param options
4140
1658
  */
4141
1659
  class WfsSource extends VectorSource {
4142
- urlParams = new URLSearchParams({
4143
- SERVICE: 'wfs',
4144
- REQUEST: 'GetFeature',
4145
- OUTPUTFORMAT: 'application/json',
4146
- EXCEPTIONS: 'application/json'
4147
- });
4148
1660
  constructor(options) {
4149
- super({
4150
- ...options,
4151
- format: new GeoJSON(),
4152
- loader: async (extent, resolution, projection, success, failure) => {
1661
+ super(Object.assign(Object.assign({}, options), { format: new GeoJSON(), loader: async (extent, resolution, projection, success, failure) => {
4153
1662
  try {
4154
1663
  // If bbox, add extent to the request
4155
- if (options.strategy == loadingstrategy.bbox) {
4156
- const extentGeoServer = proj.transformExtent(extent, projection.getCode(), options.geoServerAdvanced.projection);
1664
+ if (options.strategy == loadingstrategy_js.bbox) {
1665
+ const extentGeoServer = proj_js.transformExtent(extent, projection.getCode(), options.geoServerAdvanced.projection);
4157
1666
  // https://docs.geoserver.org/stable/en/user/services/wfs/reference.html
4158
1667
  // request features using a bounding box with CRS maybe different from featureTypes native CRS
4159
1668
  this.urlParams.set('bbox', extentGeoServer.toString() +
@@ -4187,7 +1696,12 @@
4187
1696
  showError(I18N.errors.geoserver, err, options.name);
4188
1697
  failure();
4189
1698
  }
4190
- }
1699
+ } }));
1700
+ this.urlParams = new URLSearchParams({
1701
+ SERVICE: 'wfs',
1702
+ REQUEST: 'GetFeature',
1703
+ OUTPUTFORMAT: 'application/json',
1704
+ EXCEPTIONS: 'application/json'
4191
1705
  });
4192
1706
  this.urlParams.set('version', options.geoServerAdvanced.getFeatureVersion);
4193
1707
  this.urlParams.set('typename', options.name);
@@ -4204,27 +1718,15 @@
4204
1718
  * @param options
4205
1719
  */
4206
1720
  class WfsLayer extends Mixin(BaseLayer, (VectorLayer)) {
4207
- _loadingCount = 0;
4208
- _loadedCount = 0;
4209
- beforeTransactFeature;
4210
1721
  constructor(options) {
4211
- super({
4212
- name: options.name,
4213
- label: options.label || options.name,
4214
- minZoom: options.minZoom,
4215
- ...options
4216
- });
1722
+ super(Object.assign({ name: options.name, label: options.label || options.name, minZoom: options.minZoom }, options));
1723
+ this._loadingCount = 0;
1724
+ this._loadedCount = 0;
4217
1725
  if (options.beforeTransactFeature) {
4218
1726
  this.beforeTransactFeature = options.beforeTransactFeature;
4219
1727
  }
4220
1728
  const geoserver = options.geoserver;
4221
- const source = new WfsSource({
4222
- name: options.name,
4223
- geoserverUrl: geoserver.getUrl(),
4224
- geoServerAdvanced: geoserver.getAdvanced(),
4225
- ...(options.strategy && { strategy: options.strategy }),
4226
- geoserverVendor: options.geoserverVendor
4227
- });
1729
+ const source = new WfsSource(Object.assign(Object.assign({ name: options.name, geoserverUrl: geoserver.getUrl(), geoServerAdvanced: geoserver.getAdvanced() }, (options.strategy && { strategy: options.strategy })), { geoserverVendor: options.geoserverVendor }));
4228
1730
  this._loadingCount = 0;
4229
1731
  this._loadedCount = 0;
4230
1732
  source.on('featuresloadstart', () => {
@@ -4284,6 +1786,25 @@
4284
1786
  }
4285
1787
  }
4286
1788
 
1789
+ /**
1790
+ * @module ol/TileState
1791
+ */
1792
+
1793
+ /**
1794
+ * @enum {number}
1795
+ */
1796
+ var TileState = {
1797
+ IDLE: 0,
1798
+ LOADING: 1,
1799
+ LOADED: 2,
1800
+ /**
1801
+ * Indicates that tile loading failed
1802
+ * @type {number}
1803
+ */
1804
+ ERROR: 3,
1805
+ EMPTY: 4,
1806
+ };
1807
+
4287
1808
  /**
4288
1809
  * Layer source to retrieve WMS information from geoservers
4289
1810
  * https://docs.geoserver.org/stable/en/user/services/wms/reference.html
@@ -4293,17 +1814,7 @@
4293
1814
  */
4294
1815
  class WmsSource extends TileWMS {
4295
1816
  constructor(options) {
4296
- super({
4297
- url: options.geoserverUrl,
4298
- serverType: 'geoserver',
4299
- params: {
4300
- SERVICE: 'wms',
4301
- TILED: true,
4302
- LAYERS: options.name,
4303
- EXCEPTIONS: 'application/json',
4304
- ...(options.geoserverVendor && options.geoserverVendor)
4305
- },
4306
- tileLoadFunction: async (tile, src) => {
1817
+ super(Object.assign({ url: options.geoserverUrl, serverType: 'geoserver', params: Object.assign({ SERVICE: 'wms', TILED: true, LAYERS: options.name, EXCEPTIONS: 'application/json' }, (options.geoserverVendor && options.geoserverVendor)), tileLoadFunction: async (tile, src) => {
4307
1818
  const blobToJson = (blob) => {
4308
1819
  return new Promise((resolve) => {
4309
1820
  const reader = new FileReader();
@@ -4333,9 +1844,7 @@
4333
1844
  showError(I18N.errors.geoserver, err, options.name);
4334
1845
  tile.setState(TileState.ERROR);
4335
1846
  }
4336
- },
4337
- ...options
4338
- });
1847
+ } }, options));
4339
1848
  }
4340
1849
  }
4341
1850
 
@@ -4348,22 +1857,14 @@
4348
1857
  * @param options
4349
1858
  */
4350
1859
  class WmsLayer extends Mixin(BaseLayer, (TileLayer)) {
4351
- _loadingCount = 0;
4352
- _loadedCount = 0;
4353
- beforeTransactFeature;
4354
- // Formats
4355
- _formatGeoJSON;
4356
1860
  constructor(options) {
4357
- super({
4358
- name: options.name,
4359
- label: options.label || options.name,
4360
- minZoom: options.minZoom,
4361
- ...options
4362
- });
1861
+ super(Object.assign({ name: options.name, label: options.label || options.name, minZoom: options.minZoom }, options));
1862
+ this._loadingCount = 0;
1863
+ this._loadedCount = 0;
4363
1864
  if (options.beforeTransactFeature) {
4364
1865
  this.beforeTransactFeature = options.beforeTransactFeature;
4365
1866
  }
4366
- this._formatGeoJSON = new format.GeoJSON();
1867
+ this._formatGeoJSON = new GeoJSON();
4367
1868
  const geoserver = options.geoserver;
4368
1869
  const source = new WmsSource({
4369
1870
  name: options.name,
@@ -4469,6 +1970,14 @@
4469
1970
  }
4470
1971
  }
4471
1972
 
1973
+ var img$5 = "data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='512' height='512' viewBox='0 0 512 512'%3e%3cpath d='M240 352h-240v128h480v-128h-240zM448 416h-64v-32h64v32zM112 160l128-128 128 128h-80v160h-96v-160z'%3e%3c/path%3e%3c/svg%3e";
1974
+
1975
+ var img$4 = "data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='768' height='768' viewBox='0 0 768 768'%3e %3cpath d='M663 225l-58.5 58.5-120-120 58.5-58.5q9-9 22.5-9t22.5 9l75 75q9 9 9 22.5t-9 22.5zM96 552l354-354 120 120-354 354h-120v-120z'%3e%3c/path%3e%3c/svg%3e";
1976
+
1977
+ var img$3 = "data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='768' height='768' viewBox='0 0 768 768'%3e%3cpath d='M384 288q39 0 67.5 28.5t28.5 67.5-28.5 67.5-67.5 28.5-67.5-28.5-28.5-67.5 28.5-67.5 67.5-28.5zM384 544.5q66 0 113.25-47.25t47.25-113.25-47.25-113.25-113.25-47.25-113.25 47.25-47.25 113.25 47.25 113.25 113.25 47.25zM384 144q118.5 0 214.5 66t138 174q-42 108-138 174t-214.5 66-214.5-66-138-174q42-108 138-174t214.5-66z'%3e%3c/path%3e%3c/svg%3e";
1978
+
1979
+ var img$2 = "data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='768' height='768' viewBox='0 0 768 768'%3e%3cpath d='M379.5 288h4.5q39 0 67.5 28.5t28.5 67.5v6zM241.5 313.5q-18 36-18 70.5 0 66 47.25 113.25t113.25 47.25q34.5 0 70.5-18l-49.5-49.5q-12 3-21 3-39 0-67.5-28.5t-28.5-67.5q0-9 3-21zM64.5 136.5l40.5-40.5 567 567-40.5 40.5q-7.5-7.5-47.25-46.5t-60.75-60q-64.5 27-139.5 27-118.5 0-214.5-66t-138-174q16.5-39 51.75-86.25t68.25-72.75q-18-18-50.25-51t-36.75-37.5zM384 223.5q-30 0-58.5 12l-69-69q58.5-22.5 127.5-22.5 118.5 0 213.75 66t137.25 174q-36 88.5-109.5 151.5l-93-93q12-28.5 12-58.5 0-66-47.25-113.25t-113.25-47.25z'%3e%3c/path%3e%3c/svg%3e";
1980
+
4472
1981
  function createElement(tagName, attrs = {}, ...children) {
4473
1982
  if (typeof tagName === 'function')
4474
1983
  return tagName(attrs, children);
@@ -4506,14 +2015,6 @@
4506
2015
  return elem;
4507
2016
  }
4508
2017
 
4509
- var img$5 = "data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='512' height='512' viewBox='0 0 512 512'%3e%3cpath d='M240 352h-240v128h480v-128h-240zM448 416h-64v-32h64v32zM112 160l128-128 128 128h-80v160h-96v-160z'%3e%3c/path%3e%3c/svg%3e";
4510
-
4511
- var img$4 = "data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='768' height='768' viewBox='0 0 768 768'%3e %3cpath d='M663 225l-58.5 58.5-120-120 58.5-58.5q9-9 22.5-9t22.5 9l75 75q9 9 9 22.5t-9 22.5zM96 552l354-354 120 120-354 354h-120v-120z'%3e%3c/path%3e%3c/svg%3e";
4512
-
4513
- var img$3 = "data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='768' height='768' viewBox='0 0 768 768'%3e%3cpath d='M384 288q39 0 67.5 28.5t28.5 67.5-28.5 67.5-67.5 28.5-67.5-28.5-28.5-67.5 28.5-67.5 67.5-28.5zM384 544.5q66 0 113.25-47.25t47.25-113.25-47.25-113.25-113.25-47.25-113.25 47.25-47.25 113.25 47.25 113.25 113.25 47.25zM384 144q118.5 0 214.5 66t138 174q-42 108-138 174t-214.5 66-214.5-66-138-174q42-108 138-174t214.5-66z'%3e%3c/path%3e%3c/svg%3e";
4514
-
4515
- var img$2 = "data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='768' height='768' viewBox='0 0 768 768'%3e%3cpath d='M379.5 288h4.5q39 0 67.5 28.5t28.5 67.5v6zM241.5 313.5q-18 36-18 70.5 0 66 47.25 113.25t113.25 47.25q34.5 0 70.5-18l-49.5-49.5q-12 3-21 3-39 0-67.5-28.5t-28.5-67.5q0-9 3-21zM64.5 136.5l40.5-40.5 567 567-40.5 40.5q-7.5-7.5-47.25-46.5t-60.75-60q-64.5 27-139.5 27-118.5 0-214.5-66t-138-174q16.5-39 51.75-86.25t68.25-72.75q-18-18-50.25-51t-36.75-37.5zM384 223.5q-30 0-58.5 12l-69-69q58.5-22.5 127.5-22.5 118.5 0 213.75 66t137.25 174q-36 88.5-109.5 151.5l-93-93q12-28.5 12-58.5 0-66-47.25-113.25t-113.25-47.25z'%3e%3c/path%3e%3c/svg%3e";
4516
-
4517
2018
  /**
4518
2019
  * Removes in the DOM the class of the tools
4519
2020
  * @private
@@ -4536,9 +2037,7 @@
4536
2037
  btn.classList.add('wfst--active');
4537
2038
  }
4538
2039
  };
4539
- class LayersControl extends Observable$1 {
4540
- _uploads;
4541
- _uploadFormats;
2040
+ class LayersControl extends Observable {
4542
2041
  constructor(uploads, uploadFormats) {
4543
2042
  super();
4544
2043
  this._uploads = uploads;
@@ -4552,17 +2051,17 @@
4552
2051
  addLayerEl(layer) {
4553
2052
  const container = document.querySelector('.wfst--tools-control--select-layers');
4554
2053
  const layerName = layer.get(BaseLayerProperty.NAME);
4555
- const checked = layer === getActiveLayerToInsertEls() ? { checked: 'checked' } : {};
4556
- const input = (createElement("input", { value: layerName, id: `wfst--${layerName}`, type: "radio", className: "ol-wfst--tools-control-input", name: "wfst--select-layer", ...checked, onchange: (evt) => this._layerChangeHandler(evt, layer) }));
4557
- const layerDom = (createElement("div", { className: `wfst--layer-control
4558
- ${layer.getVisible() ? 'ol-wfst--visible-on' : ''}
2054
+ const checked = layer === getActiveLayerToInsertEls() ? { checked: true } : {};
2055
+ const input = (createElement("input", Object.assign({ value: layerName, id: `wfst--${layerName}`, type: "radio", className: "ol-wfst--tools-control-input", name: "wfst--select-layer" }, checked, { onChange: (evt) => this._layerChangeHandler(evt, layer) })));
2056
+ const layerDom = (createElement("div", { className: `wfst--layer-control
2057
+ ${layer.getVisible() ? 'ol-wfst--visible-on' : ''}
4559
2058
  ${layer === getActiveLayerToInsertEls()
4560
2059
  ? 'ol-wfst--selected-on'
4561
2060
  : ''}`, "data-layer": layerName },
4562
2061
  createElement("div", { className: "ol-wfst--tools-control-visible" },
4563
- createElement("span", { className: "ol-wfst--tools-control-visible-btn ol-wfst--visible-btn-on", title: I18N.labels.toggleVisibility, onclick: (evt) => this._visibilityClickHandler(evt) },
2062
+ createElement("span", { className: "ol-wfst--tools-control-visible-btn ol-wfst--visible-btn-on", title: I18N.labels.toggleVisibility, onClick: (evt) => this._visibilityClickHandler(evt) },
4564
2063
  createElement("img", { src: img$3 })),
4565
- createElement("span", { className: "ol-wfst--tools-control-visible-btn ol-wfst--visible-btn-off", title: I18N.labels.toggleVisibility, onclick: (evt) => this._visibilityClickHandler(evt) },
2064
+ createElement("span", { className: "ol-wfst--tools-control-visible-btn ol-wfst--visible-btn-off", title: I18N.labels.toggleVisibility, onClick: (evt) => this._visibilityClickHandler(evt) },
4566
2065
  createElement("img", { src: img$2 }))),
4567
2066
  createElement("label", { htmlFor: `wfst--${layerName}` },
4568
2067
  input,
@@ -4661,17 +2160,16 @@
4661
2160
  return (createElement(null, null,
4662
2161
  createElement("div", { className: "wfst--tools-control--head" },
4663
2162
  this._uploads && (createElement("div", null,
4664
- createElement("input", { id: "ol-wfst--upload", type: "file", accept: this._uploadFormats, onchange: (evt) => this._uploads.process(evt) }),
2163
+ createElement("input", { id: "ol-wfst--upload", type: "file", accept: this._uploadFormats, onChange: (evt) => this._uploads.process(evt) }),
4665
2164
  createElement("label", { className: "ol-wfst--tools-control-btn ol-wfst--tools-control-btn-upload", htmlFor: "ol-wfst--upload", title: I18N.labels.uploadToLayer },
4666
2165
  createElement("img", { src: img$5 })))),
4667
2166
  createElement("div", { className: "ol-wfst--tools-control-draw-cnt" },
4668
- createElement("button", { className: "ol-wfst--tools-control-btn ol-wfst--tools-control-btn-draw", type: "button", title: I18N.labels.addElement, onclick: () => {
2167
+ createElement("button", { className: "ol-wfst--tools-control-btn ol-wfst--tools-control-btn-draw", type: "button", title: I18N.labels.addElement, onClick: () => {
4669
2168
  this.dispatchEvent('drawMode');
4670
2169
  } },
4671
2170
  createElement("img", { src: img$4 })),
4672
- createElement("select", { title: I18N.labels.selectDrawType, className: "wfst--tools-control--select-draw", onchange: (evt) => {
4673
- const selectedValue = evt.target
4674
- .value;
2171
+ createElement("select", { title: I18N.labels.selectDrawType, className: "wfst--tools-control--select-draw", onChange: (evt) => {
2172
+ const selectedValue = evt.target.value;
4675
2173
  this._changeStateSelect(getActiveLayerToInsertEls(), selectedValue);
4676
2174
  this.dispatchEvent('changeGeom');
4677
2175
  } }, [
@@ -4699,22 +2197,15 @@
4699
2197
  };
4700
2198
 
4701
2199
  // Ol
4702
- class Uploads extends Observable$1 {
4703
- _options;
4704
- // Formats
4705
- _formatWFS;
4706
- _formatGeoJSON;
4707
- _formatKml;
4708
- _xs;
4709
- _processUpload;
2200
+ class Uploads extends Observable {
4710
2201
  constructor(options) {
4711
2202
  super();
4712
2203
  this._options = options;
4713
2204
  this._processUpload = options.processUpload;
4714
2205
  // Formats
4715
- this._formatWFS = new format.WFS();
4716
- this._formatGeoJSON = new format.GeoJSON();
4717
- this._formatKml = new format.KML({
2206
+ this._formatWFS = new WFS();
2207
+ this._formatGeoJSON = new GeoJSON();
2208
+ this._formatKml = new KML({
4718
2209
  extractStyles: false,
4719
2210
  showPointNames: false
4720
2211
  });
@@ -4781,8 +2272,8 @@
4781
2272
  else {
4782
2273
  resetStateButtons();
4783
2274
  this.dispatchEvent(new VectorSource.VectorSourceEvent('loadedFeatures', null, featuresToInsert));
4784
- const content = `
4785
- ${I18N.labels.validFeatures}: ${validFeaturesCount}<br>
2275
+ const content = `
2276
+ ${I18N.labels.validFeatures}: ${validFeaturesCount}<br>
4786
2277
  ${invalidFeaturesCount
4787
2278
  ? `${I18N.labels.invalidFeatures}: ${invalidFeaturesCount}`
4788
2279
  : ''}`;
@@ -4824,34 +2315,34 @@
4824
2315
  const geomTypeLayer = getActiveLayerToInsertEls().getDescribeFeatureType()._parsed
4825
2316
  .geomType;
4826
2317
  const geomTypeFeature = feature.getGeometry().getType();
4827
- let geom$1;
2318
+ let geom;
4828
2319
  switch (geomTypeFeature) {
4829
2320
  case GeometryType.Point: {
4830
2321
  if (geomTypeLayer === GeometryType.MultiPoint) {
4831
2322
  const coords = feature.getGeometry().getCoordinates();
4832
- geom$1 = new geom.MultiPoint([coords]);
2323
+ geom = new geom_js.MultiPoint([coords]);
4833
2324
  }
4834
2325
  break;
4835
2326
  }
4836
2327
  case GeometryType.LineString:
4837
2328
  if (geomTypeLayer === GeometryType.MultiLineString) {
4838
2329
  const coords = feature.getGeometry().getCoordinates();
4839
- geom$1 = new geom.MultiLineString([coords]);
2330
+ geom = new geom_js.MultiLineString([coords]);
4840
2331
  }
4841
2332
  break;
4842
2333
  case GeometryType.Polygon:
4843
2334
  if (geomTypeLayer === GeometryType.MultiPolygon) {
4844
2335
  const coords = feature.getGeometry().getCoordinates();
4845
- geom$1 = new geom.MultiPolygon([coords]);
2336
+ geom = new geom_js.MultiPolygon([coords]);
4846
2337
  }
4847
2338
  break;
4848
2339
  default:
4849
- geom$1 = null;
2340
+ geom = null;
4850
2341
  }
4851
- if (!geom$1) {
2342
+ if (!geom) {
4852
2343
  return null;
4853
2344
  }
4854
- feature.setGeometry(geom$1);
2345
+ feature.setGeometry(geom);
4855
2346
  return feature;
4856
2347
  }
4857
2348
  /**
@@ -4878,25 +2369,17 @@
4878
2369
  * @private
4879
2370
  */
4880
2371
  _initModal(content, featuresToInsert) {
4881
- const footer = `
4882
- <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">
4883
- ${I18N.labels.cancel}
4884
- </button>
4885
- <button type="button" class="btn btn-sm btn-primary" data-action="save" data-dismiss="modal">
4886
- ${I18N.labels.upload}
4887
- </button>
2372
+ const footer = `
2373
+ <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">
2374
+ ${I18N.labels.cancel}
2375
+ </button>
2376
+ <button type="button" class="btn btn-sm btn-primary" data-action="save" data-dismiss="modal">
2377
+ ${I18N.labels.upload}
2378
+ </button>
4888
2379
  `;
4889
- const modal = new Modal({
4890
- ...this._options.modal,
4891
- header: true,
4892
- headerClose: false,
4893
- title: I18N.labels.uploadFeatures +
2380
+ const modal = new Modal(Object.assign(Object.assign({}, this._options.modal), { header: true, headerClose: false, title: I18N.labels.uploadFeatures +
4894
2381
  ' ' +
4895
- getActiveLayerToInsertEls().get(BaseLayerProperty.NAME),
4896
- content: content,
4897
- backdrop: 'static',
4898
- footer: footer
4899
- }).show();
2382
+ getActiveLayerToInsertEls().get(BaseLayerProperty.NAME), content: content, backdrop: 'static', footer: footer })).show();
4900
2383
  modal.on('dismiss', (modal, event) => {
4901
2384
  // On saving changes
4902
2385
  if (event.target.dataset.action === 'save') {
@@ -4956,7 +2439,7 @@
4956
2439
  };
4957
2440
  };
4958
2441
 
4959
- class EditControlChangesEl extends control.Control {
2442
+ class EditControlChangesEl extends Control {
4960
2443
  constructor(feature) {
4961
2444
  super({
4962
2445
  element: (createElement("div", { className: "ol-wfst--changes-control" },
@@ -4966,13 +2449,13 @@
4966
2449
  " -",
4967
2450
  ' ',
4968
2451
  createElement("i", null, String(feature.getId()))),
4969
- createElement("button", { type: "button", className: "btn btn-sm btn-secondary", onclick: () => {
2452
+ createElement("button", { type: "button", className: "btn btn-sm btn-secondary", onClick: () => {
4970
2453
  this.dispatchEvent(new VectorSource.VectorSourceEvent('cancel', feature));
4971
2454
  } }, I18N.labels.cancel),
4972
- createElement("button", { type: "button", className: "btn btn-sm btn-primary", onclick: () => {
2455
+ createElement("button", { type: "button", className: "btn btn-sm btn-primary", onClick: () => {
4973
2456
  this.dispatchEvent(new VectorSource.VectorSourceEvent('apply', feature));
4974
2457
  } }, I18N.labels.apply),
4975
- createElement("button", { type: "button", className: "btn btn-sm btn-danger-outline", onclick: () => {
2458
+ createElement("button", { type: "button", className: "btn btn-sm btn-danger-outline", onClick: () => {
4976
2459
  this.dispatchEvent(new VectorSource.VectorSourceEvent('delete', feature));
4977
2460
  } }, I18N.labels.delete))))
4978
2461
  });
@@ -4991,16 +2474,16 @@
4991
2474
  function styleFunction(feature) {
4992
2475
  const getVertexs = (feature) => {
4993
2476
  let geometry = feature.getGeometry();
4994
- if (geometry instanceof geom.GeometryCollection) {
2477
+ if (geometry instanceof geom_js.GeometryCollection) {
4995
2478
  geometry = geometry.getGeometries()[0];
4996
2479
  }
4997
2480
  const coordinates = geometry.getCoordinates();
4998
2481
  let flatCoordinates = null;
4999
- if (geometry instanceof geom.Polygon ||
5000
- geometry instanceof geom.MultiLineString) {
2482
+ if (geometry instanceof geom_js.Polygon ||
2483
+ geometry instanceof geom_js.MultiLineString) {
5001
2484
  flatCoordinates = coordinates.flat(1);
5002
2485
  }
5003
- else if (geometry instanceof geom.MultiPolygon) {
2486
+ else if (geometry instanceof geom_js.MultiPolygon) {
5004
2487
  flatCoordinates = coordinates.flat(2);
5005
2488
  }
5006
2489
  else {
@@ -5009,11 +2492,11 @@
5009
2492
  if (!flatCoordinates || !flatCoordinates.length) {
5010
2493
  return;
5011
2494
  }
5012
- return new geom.MultiPoint(flatCoordinates);
2495
+ return new geom_js.MultiPoint(flatCoordinates);
5013
2496
  };
5014
2497
  let geometry = feature.getGeometry();
5015
2498
  let type = geometry.getType();
5016
- if (geometry instanceof geom.GeometryCollection) {
2499
+ if (geometry instanceof geom_js.GeometryCollection) {
5017
2500
  geometry = geometry.getGeometries()[0];
5018
2501
  type = geometry.getType();
5019
2502
  }
@@ -5022,18 +2505,18 @@
5022
2505
  case GeometryType.MultiPoint:
5023
2506
  if (getMode() === Modes.Edit) {
5024
2507
  return [
5025
- new style.Style({
5026
- image: new style.Circle({
2508
+ new style_js.Style({
2509
+ image: new style_js.Circle({
5027
2510
  radius: 6,
5028
- fill: new style.Fill({
2511
+ fill: new style_js.Fill({
5029
2512
  color: '#000000'
5030
2513
  })
5031
2514
  })
5032
2515
  }),
5033
- new style.Style({
5034
- image: new style.Circle({
2516
+ new style_js.Style({
2517
+ image: new style_js.Circle({
5035
2518
  radius: 4,
5036
- fill: new style.Fill({
2519
+ fill: new style_js.Fill({
5037
2520
  color: '#ff0000'
5038
2521
  })
5039
2522
  })
@@ -5042,18 +2525,18 @@
5042
2525
  }
5043
2526
  else {
5044
2527
  return [
5045
- new style.Style({
5046
- image: new style.Circle({
2528
+ new style_js.Style({
2529
+ image: new style_js.Circle({
5047
2530
  radius: 5,
5048
- fill: new style.Fill({
2531
+ fill: new style_js.Fill({
5049
2532
  color: '#ff0000'
5050
2533
  })
5051
2534
  })
5052
2535
  }),
5053
- new style.Style({
5054
- image: new style.Circle({
2536
+ new style_js.Style({
2537
+ image: new style_js.Circle({
5055
2538
  radius: 2,
5056
- fill: new style.Fill({
2539
+ fill: new style_js.Fill({
5057
2540
  color: '#000000'
5058
2541
  })
5059
2542
  })
@@ -5064,30 +2547,30 @@
5064
2547
  // If editing mode is active, show bigger vertex
5065
2548
  if (getMode() == Modes.Draw || getMode() == Modes.Edit) {
5066
2549
  return [
5067
- new style.Style({
5068
- stroke: new style.Stroke({
2550
+ new style_js.Style({
2551
+ stroke: new style_js.Stroke({
5069
2552
  color: 'rgba( 255, 0, 0, 1)',
5070
2553
  width: 4
5071
2554
  }),
5072
- fill: new style.Fill({
2555
+ fill: new style_js.Fill({
5073
2556
  color: 'rgba(255, 0, 0, 0.7)'
5074
2557
  })
5075
2558
  }),
5076
- new style.Style({
5077
- image: new style.Circle({
2559
+ new style_js.Style({
2560
+ image: new style_js.Circle({
5078
2561
  radius: 4,
5079
- fill: new style.Fill({
2562
+ fill: new style_js.Fill({
5080
2563
  color: '#ff0000'
5081
2564
  }),
5082
- stroke: new style.Stroke({
2565
+ stroke: new style_js.Stroke({
5083
2566
  width: 2,
5084
2567
  color: 'rgba(5, 5, 5, 0.9)'
5085
2568
  })
5086
2569
  }),
5087
2570
  geometry: (feature) => getVertexs(feature)
5088
2571
  }),
5089
- new style.Style({
5090
- stroke: new style.Stroke({
2572
+ new style_js.Style({
2573
+ stroke: new style_js.Stroke({
5091
2574
  color: 'rgba(255, 255, 255, 0.7)',
5092
2575
  width: 2
5093
2576
  })
@@ -5096,21 +2579,21 @@
5096
2579
  }
5097
2580
  else {
5098
2581
  return [
5099
- new style.Style({
5100
- image: new style.Circle({
2582
+ new style_js.Style({
2583
+ image: new style_js.Circle({
5101
2584
  radius: 2,
5102
- fill: new style.Fill({
2585
+ fill: new style_js.Fill({
5103
2586
  color: '#000000'
5104
2587
  })
5105
2588
  }),
5106
2589
  geometry: (feature) => getVertexs(feature)
5107
2590
  }),
5108
- new style.Style({
5109
- stroke: new style.Stroke({
2591
+ new style_js.Style({
2592
+ stroke: new style_js.Stroke({
5110
2593
  color: '#ff0000',
5111
2594
  width: 4
5112
2595
  }),
5113
- fill: new style.Fill({
2596
+ fill: new style_js.Fill({
5114
2597
  color: 'rgba(255, 0, 0, 0.7)'
5115
2598
  })
5116
2599
  })
@@ -5126,32 +2609,22 @@
5126
2609
  * @param feature
5127
2610
  * @private
5128
2611
  */
5129
- class EditFieldsModal extends Observable$1 {
5130
- _options;
5131
- _modal;
5132
- _feature;
2612
+ class EditFieldsModal extends Observable {
5133
2613
  constructor(options) {
5134
2614
  super();
5135
2615
  this._options = options;
5136
- const footer = `
5137
- <button type="button" class="btn btn-sm btn-link btn-third" data-action="delete" data-dismiss="modal">
5138
- ${I18N.labels.delete}
5139
- </button>
5140
- <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">
5141
- ${I18N.labels.cancel}
5142
- </button>
5143
- <button type="button" class="btn btn-sm btn-primary" data-action="save" data-dismiss="modal">
5144
- ${I18N.labels.save}
5145
- </button>
2616
+ const footer = `
2617
+ <button type="button" class="btn btn-sm btn-link btn-third" data-action="delete" data-dismiss="modal">
2618
+ ${I18N.labels.delete}
2619
+ </button>
2620
+ <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">
2621
+ ${I18N.labels.cancel}
2622
+ </button>
2623
+ <button type="button" class="btn btn-sm btn-primary" data-action="save" data-dismiss="modal">
2624
+ ${I18N.labels.save}
2625
+ </button>
5146
2626
  `;
5147
- this._modal = new Modal({
5148
- ...this._options,
5149
- header: true,
5150
- headerClose: true,
5151
- title: '',
5152
- content: '<div></div>',
5153
- footer: footer
5154
- });
2627
+ this._modal = new Modal(Object.assign(Object.assign({}, this._options), { header: true, headerClose: true, title: '', content: '<div></div>', footer: footer }));
5155
2628
  this._modal.on('dismiss', (modal, event) => {
5156
2629
  // On saving changes
5157
2630
  if (event.target.dataset.action === 'save') {
@@ -5200,10 +2673,10 @@
5200
2673
  type = 'text';
5201
2674
  }
5202
2675
  if (type) {
5203
- content += `
5204
- <div class="ol-wfst--input-field-container">
5205
- <label class="ol-wfst--input-field-label" for="${key}">${key}</label>
5206
- <input placeholder="NULL" class="ol-wfst--input-field-input" type="${type}" name="${key}" value="${properties[key] || ''}">
2676
+ content += `
2677
+ <div class="ol-wfst--input-field-container">
2678
+ <label class="ol-wfst--input-field-label" for="${key}">${key}</label>
2679
+ <input placeholder="NULL" class="ol-wfst--input-field-input" type="${type}" name="${key}" value="${properties[key] || ''}">
5207
2680
  </div>`;
5208
2681
  }
5209
2682
  }
@@ -5224,18 +2697,7 @@
5224
2697
  * @extends {ol/Object~BaseObject}
5225
2698
  * @param options
5226
2699
  */
5227
- class Geoserver extends BaseObject$2 {
5228
- _options;
5229
- _countRequests;
5230
- _insertFeatures;
5231
- _updateFeatures;
5232
- _deleteFeatures;
5233
- // Formats
5234
- _formatWFS;
5235
- _formatGeoJSON;
5236
- _formatKml;
5237
- _xs;
5238
- state_;
2700
+ class Geoserver extends BaseObject {
5239
2701
  constructor(options) {
5240
2702
  super();
5241
2703
  const defaults = {
@@ -5268,9 +2730,9 @@
5268
2730
  this._updateFeatures = [];
5269
2731
  this._deleteFeatures = [];
5270
2732
  // Formats
5271
- this._formatWFS = new format.WFS();
5272
- this._formatGeoJSON = new format.GeoJSON();
5273
- this._formatKml = new format.KML({
2733
+ this._formatWFS = new WFS();
2734
+ this._formatGeoJSON = new GeoJSON();
2735
+ this._formatKml = new KML({
5274
2736
  extractStyles: false,
5275
2737
  showPointNames: false
5276
2738
  });
@@ -5468,7 +2930,7 @@
5468
2930
  * @private
5469
2931
  */
5470
2932
  async transact(transactionType, features, layerName) {
5471
- features = Array.isArray(features) ? features : [features];
2933
+ features = (Array.isArray(features) ? features : [features]);
5472
2934
  const clonedFeatures = [];
5473
2935
  const geoLayer = getStoredLayer(layerName);
5474
2936
  for (const feature of features) {
@@ -5476,10 +2938,10 @@
5476
2938
  const cloneGeom = clone.getGeometry();
5477
2939
  // Ugly fix to support GeometryCollection on GML
5478
2940
  // See https://github.com/openlayers/openlayers/issues/4220
5479
- if (cloneGeom instanceof geom.GeometryCollection) {
2941
+ if (cloneGeom instanceof GeometryCollection) {
5480
2942
  this._transformGeoemtryCollectionToGeometries(clone, cloneGeom);
5481
2943
  }
5482
- else if (cloneGeom instanceof geom.Circle) {
2944
+ else if (cloneGeom instanceof Circle) {
5483
2945
  // Geoserver has no Support to Circles
5484
2946
  this._transformCircleToPolygon(clone, cloneGeom);
5485
2947
  }
@@ -5532,10 +2994,10 @@
5532
2994
  srs === 'EPSG:4326'
5533
2995
  ? 'urn:x-ogc:def:crs:EPSG:4326'
5534
2996
  : srs;
5535
- const describeFeatureType = geoLayer.getDescribeFeatureType()._parsed;
5536
- if (!geoLayer) {
5537
- throw new Error(I18N.errors.layerNotFound);
2997
+ if (!geoLayer || !geoLayer.getDescribeFeatureType()) {
2998
+ throw new Error(`${I18N.errors.layerNotFound}: "${layerName}"`);
5538
2999
  }
3000
+ const describeFeatureType = geoLayer.getDescribeFeatureType()._parsed;
5539
3001
  const options = {
5540
3002
  featureNS: describeFeatureType.namespace,
5541
3003
  featureType: layerName,
@@ -5575,10 +3037,7 @@
5575
3037
  transactionType !== TransactionType.Insert) {
5576
3038
  payload = payload.replace(`</Transaction>`, `<LockId>${this._options.advanced.lockFeatureParams.lockId}</LockId></Transaction>`);
5577
3039
  }
5578
- const headers = {
5579
- 'Content-Type': 'text/xml',
5580
- ...this.getHeaders()
5581
- };
3040
+ const headers = Object.assign({ 'Content-Type': 'text/xml' }, this.getHeaders());
5582
3041
  const response = await fetch(this.getUrl(), {
5583
3042
  method: 'POST',
5584
3043
  body: payload,
@@ -5588,20 +3047,22 @@
5588
3047
  if (!response.ok) {
5589
3048
  throw new Error(I18N.errors.transaction + ' ' + response.status);
5590
3049
  }
5591
- const parseResponse = this._formatWFS.readTransactionResponse(await response.text());
3050
+ const responseStr = await response.text();
3051
+ const parseResponse = this._formatWFS.readTransactionResponse(responseStr);
3052
+ const wlayer = getStoredLayer(layerName);
5592
3053
  if (!Object.keys(parseResponse).length) {
5593
- const responseStr = await response.text();
5594
3054
  const findError = String(responseStr).match(/<ows:ExceptionText>([\s\S]*?)<\/ows:ExceptionText>/);
5595
3055
  if (findError) {
3056
+ if (wlayer instanceof WmsLayer) {
3057
+ this._removeFeatures(features);
3058
+ }
3059
+ // maybe remove tmp wms features here
5596
3060
  throw new Error(findError[1]);
5597
3061
  }
5598
3062
  }
5599
3063
  if (transactionType !== TransactionType.Delete) {
5600
- for (const feature of features) {
5601
- getEditLayer().getSource().removeFeature(feature);
5602
- }
3064
+ this._removeFeatures(features);
5603
3065
  }
5604
- const wlayer = getStoredLayer(layerName);
5605
3066
  wlayer.refresh();
5606
3067
  showLoading(false);
5607
3068
  this._insertFeatures = [];
@@ -5619,6 +3080,14 @@
5619
3080
  }, 0);
5620
3081
  });
5621
3082
  }
3083
+ /**
3084
+ * @privatwe
3085
+ */
3086
+ _removeFeatures(features) {
3087
+ for (const feature of features) {
3088
+ getEditLayer().getSource().removeFeature(feature);
3089
+ }
3090
+ }
5622
3091
  /**
5623
3092
  *
5624
3093
  * @param feature
@@ -5626,7 +3095,7 @@
5626
3095
  * @private
5627
3096
  */
5628
3097
  _transformCircleToPolygon(feature, geom) {
5629
- const geomConverted = Polygon.fromCircle(geom);
3098
+ const geomConverted = Polygon_js.fromCircle(geom);
5630
3099
  feature.setGeometry(geomConverted);
5631
3100
  }
5632
3101
  /**
@@ -5635,10 +3104,10 @@
5635
3104
  * @private
5636
3105
  * @param geom
5637
3106
  */
5638
- _transformGeoemtryCollectionToGeometries(feature, geom$1) {
5639
- let geomConverted = geom$1.getGeometries()[0];
5640
- if (geomConverted instanceof geom.Circle) {
5641
- geomConverted = Polygon.fromCircle(geomConverted);
3107
+ _transformGeoemtryCollectionToGeometries(feature, geom) {
3108
+ let geomConverted = geom.getGeometries()[0];
3109
+ if (geomConverted instanceof Circle) {
3110
+ geomConverted = Polygon_js.fromCircle(geomConverted);
5642
3111
  }
5643
3112
  feature.setGeometry(geomConverted);
5644
3113
  }
@@ -5653,7 +3122,7 @@
5653
3122
  const featureProperties = feature.getProperties();
5654
3123
  delete featureProperties.boundedBy;
5655
3124
  delete featureProperties._layerName_;
5656
- const clone = new Feature$1(featureProperties);
3125
+ const clone = new Feature(featureProperties);
5657
3126
  clone.setId(feature.getId());
5658
3127
  return clone;
5659
3128
  }
@@ -5692,6 +3161,7 @@
5692
3161
  // First, check if is a JSON (with errors)
5693
3162
  const dataParsed = JSON.parse(data);
5694
3163
  if ('exceptions' in dataParsed) {
3164
+ const error = new Error(parseError(dataParsed));
5695
3165
  const exceptions = dataParsed.exceptions;
5696
3166
  if (exceptions[0].code === 'CannotLockAllFeatures') {
5697
3167
  // Maybe the Feature is already blocked, ant thats trigger error, so, we try one locking more time again
@@ -5699,11 +3169,11 @@
5699
3169
  this.lockFeature(featureId, layerName, 1);
5700
3170
  }
5701
3171
  else {
5702
- showError(I18N.errors.lockFeature, exceptions);
3172
+ throw error;
5703
3173
  }
5704
3174
  }
5705
3175
  else {
5706
- showError(exceptions[0].text, exceptions);
3176
+ throw error;
5707
3177
  }
5708
3178
  }
5709
3179
  }
@@ -5749,21 +3219,21 @@
5749
3219
 
5750
3220
  var img = "data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='541' height='512' viewBox='0 0 541 512'%3e %3cpath fill='black' d='M103.306 228.483l129.493-125.249c-17.662-4.272-31.226-18.148-34.98-35.663l-0.055-0.307-129.852 125.248c17.812 4.15 31.53 18.061 35.339 35.662l0.056 0.308z'%3e%3c/path%3e %3cpath fill='black' d='M459.052 393.010c-13.486-8.329-22.346-23.018-22.373-39.779v-0.004c-0.053-0.817-0.082-1.772-0.082-2.733s0.030-1.916 0.089-2.863l-0.007 0.13-149.852 71.94c9.598 8.565 15.611 20.969 15.611 34.779 0 0.014 0 0.029 0 0.043v-0.002c-0.048 5.164-0.94 10.104-2.544 14.711l0.098-0.322z'%3e%3c/path%3e %3cpath fill='black' d='M290.207 57.553c-0.009 15.55-7.606 29.324-19.289 37.819l-0.135 0.093 118.054 46.69c-0.216-1.608-0.346-3.48-0.36-5.379v-0.017c0.033-16.948 9.077-31.778 22.596-39.953l0.209-0.118-122.298-48.056c0.659 2.633 1.098 5.693 1.221 8.834l0.002 0.087z'%3e%3c/path%3e %3cpath fill='black' d='M241.36 410.132l-138.629-160.067c-4.734 17.421-18.861 30.61-36.472 33.911l-0.29 0.045 143.881 166.255c1.668-18.735 14.197-34.162 31.183-40.044l0.327-0.099z'%3e%3c/path%3e %3cpath fill='black' d='M243.446 115.105c-31.785 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.785 0 57.552 25.767 57.552 57.553v0c0 31.786-25.767 57.553-57.553 57.553v0zM243.446 21.582c-19.866 0-35.97 16.105-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c0-19.866-16.104-35.97-35.97-35.97v0z'%3e%3c/path%3e %3cpath fill='black' d='M483.224 410.78c-31.786 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.786 0 57.552 25.767 57.552 57.553v0c0 31.786-25.767 57.553-57.553 57.553v0zM483.224 317.257c-19.866 0-35.97 16.104-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c0-19.866-16.105-35.97-35.97-35.97v0z'%3e%3c/path%3e %3cpath fill='black' d='M57.553 295.531c-31.785 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.785 0 57.553 25.767 57.553 57.553v0c0 31.786-25.767 57.553-57.553 57.553v0zM57.553 202.008c-19.866 0-35.97 16.105-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c-0.041-19.835-16.13-35.898-35.97-35.898 0 0 0 0 0 0v0z'%3e%3c/path%3e %3cpath fill='black' d='M256.036 512.072c-31.786 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.786 0 57.553 25.767 57.553 57.553v0c0 31.786-25.767 57.553-57.553 57.553v0zM256.036 418.55c-19.866 0-35.97 16.104-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c0-19.866-16.105-35.97-35.97-35.97v0z'%3e%3c/path%3e %3cpath fill='black' d='M435.24 194.239c-31.786 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.786 0 57.553 25.767 57.553 57.553v0c0 31.785-25.767 57.553-57.553 57.553v0zM435.24 100.716c-19.866 0-35.97 16.105-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c0-19.866-16.105-35.97-35.97-35.97v0z'%3e%3c/path%3e%3c/svg%3e";
5751
3221
 
5752
- class EditOverlay extends Overlay$1 {
3222
+ class EditOverlay extends Overlay {
5753
3223
  constructor(feature, coordinate = null) {
5754
3224
  super({
5755
3225
  id: feature.getId(),
5756
- position: coordinate || extent.getCenter(feature.getGeometry().getExtent()),
3226
+ position: coordinate || extent_js.getCenter(feature.getGeometry().getExtent()),
5757
3227
  positioning: 'center-center',
5758
3228
  offset: [0, -40],
5759
3229
  stopEvent: true,
5760
3230
  element: (createElement("div", null,
5761
- createElement("div", { className: "ol-wfst--edit-button-cnt", onclick: () => {
3231
+ createElement("div", { className: "ol-wfst--edit-button-cnt", onClick: () => {
5762
3232
  this.dispatchEvent('editFields');
5763
3233
  } },
5764
3234
  createElement("button", { className: "ol-wfst--edit-button", type: "button", title: I18N.labels.editFields },
5765
3235
  createElement("img", { src: img$1, alt: I18N.labels.editFields }))),
5766
- createElement("div", { className: "ol-wfst--edit-button-cnt", onclick: () => {
3236
+ createElement("div", { className: "ol-wfst--edit-button-cnt", onClick: () => {
5767
3237
  this.dispatchEvent('editGeom');
5768
3238
  } },
5769
3239
  createElement("button", { class: "ol-wfst--edit-button", type: "button", title: I18N.labels.editGeom },
@@ -5790,39 +3260,7 @@
5790
3260
  * @extends {ol/control/Control~Control}
5791
3261
  * @param options Wfst options, see [Wfst Options](#options) for more details.
5792
3262
  */
5793
- class Wfst extends control.Control {
5794
- _options;
5795
- _i18n;
5796
- // Ol
5797
- _map;
5798
- _view;
5799
- _viewport;
5800
- _initialized = false;
5801
- _layersControl;
5802
- _overlay;
5803
- // Interactions
5804
- _interactionWfsSelect;
5805
- _interactionSelectModify;
5806
- _collectionModify;
5807
- _interactionModify;
5808
- _interactionSnap;
5809
- _interactionDraw;
5810
- // Obserbable keys
5811
- _keyClickWms;
5812
- _keyRemove;
5813
- _keySelect;
5814
- // Controls
5815
- _controlApplyDiscardChanges;
5816
- _controlWidgetToolsDiv;
5817
- _selectDraw;
5818
- // State
5819
- _currentZoom;
5820
- _lastZoom;
5821
- // Editing
5822
- _editFeature;
5823
- _editFeatureOriginal;
5824
- _uploads;
5825
- _editFields;
3263
+ class Wfst extends Control {
5826
3264
  constructor(options) {
5827
3265
  super({
5828
3266
  target: null,
@@ -5832,6 +3270,7 @@
5832
3270
  this._init();
5833
3271
  }
5834
3272
  });
3273
+ this._initialized = false;
5835
3274
  setLang(options.language, options.i18n);
5836
3275
  const defaultOptions = getDefaultOptions();
5837
3276
  this._options = deepObjectAssign(defaultOptions, options);
@@ -5983,12 +3422,12 @@
5983
3422
  * @private
5984
3423
  */
5985
3424
  const prepareWfsInteraction = () => {
5986
- this._collectionModify = new Collection$1();
3425
+ this._collectionModify = new Collection();
5987
3426
  // Interaction to select wfs layer elements
5988
- this._interactionWfsSelect = new interaction.Select({
3427
+ this._interactionWfsSelect = new Select({
5989
3428
  hitTolerance: 10,
5990
3429
  style: (feature) => styleFunction(feature),
5991
- toggleCondition: condition.never,
3430
+ toggleCondition: condition_js.never,
5992
3431
  filter: (feature, layer) => {
5993
3432
  return (getMode() !== Modes.Edit &&
5994
3433
  layer &&
@@ -6026,10 +3465,10 @@
6026
3465
  */
6027
3466
  const prepareWmsInteraction = () => {
6028
3467
  // Interaction to allow select features in the edit layer
6029
- this._interactionSelectModify = new interaction.Select({
3468
+ this._interactionSelectModify = new Select({
6030
3469
  style: (feature) => styleFunction(feature),
6031
3470
  layers: [getEditLayer()],
6032
- toggleCondition: condition.never,
3471
+ toggleCondition: condition_js.never,
6033
3472
  removeCondition: () => (getMode() === Modes.Edit ? true : false) // Prevent deselect on clicking outside the feature
6034
3473
  });
6035
3474
  this._map.addInteraction(this._interactionSelectModify);
@@ -6063,16 +3502,16 @@
6063
3502
  if (this._options.layers.find((layer) => layer instanceof WmsLayer)) {
6064
3503
  prepareWmsInteraction();
6065
3504
  }
6066
- this._interactionModify = new interaction.Modify({
3505
+ this._interactionModify = new Modify({
6067
3506
  style: () => {
6068
3507
  if (getMode() === Modes.Edit) {
6069
- return new style.Style({
6070
- image: new style.Circle({
3508
+ return new Style({
3509
+ image: new CircleStyle({
6071
3510
  radius: 6,
6072
- fill: new style.Fill({
3511
+ fill: new Fill({
6073
3512
  color: '#ff0000'
6074
3513
  }),
6075
- stroke: new style.Stroke({
3514
+ stroke: new Stroke({
6076
3515
  width: 2,
6077
3516
  color: 'rgba(5, 5, 5, 0.9)'
6078
3517
  })
@@ -6085,11 +3524,11 @@
6085
3524
  },
6086
3525
  features: this._collectionModify,
6087
3526
  condition: (evt) => {
6088
- return condition.primaryAction(evt) && getMode() === Modes.Edit;
3527
+ return condition_js.primaryAction(evt) && getMode() === Modes.Edit;
6089
3528
  }
6090
3529
  });
6091
3530
  this._map.addInteraction(this._interactionModify);
6092
- this._interactionSnap = new interaction.Snap({
3531
+ this._interactionSnap = new Snap({
6093
3532
  source: getEditLayer().getSource()
6094
3533
  });
6095
3534
  this._map.addInteraction(this._interactionSnap);
@@ -6272,7 +3711,7 @@
6272
3711
  return;
6273
3712
  }
6274
3713
  if (this._keySelect) {
6275
- Observable$2.unByKey(this._keySelect);
3714
+ Observable.unByKey(this._keySelect);
6276
3715
  }
6277
3716
  const layerName = feature.get('_layerName_');
6278
3717
  const ll = this.getLayerByName(layerName);
@@ -6340,9 +3779,7 @@
6340
3779
  }
6341
3780
  };
6342
3781
  if (confirm) {
6343
- const confirmModal = Modal.confirm(I18N.labels.confirmDelete, {
6344
- ...this._options.modal
6345
- });
3782
+ const confirmModal = Modal.confirm(I18N.labels.confirmDelete, Object.assign({}, this._options.modal));
6346
3783
  confirmModal.show().once('dismiss', function (modal, ev, button) {
6347
3784
  if (button && button.value) {
6348
3785
  deleteEl();
@@ -6411,7 +3848,7 @@
6411
3848
  this._map.removeInteraction(this._interactionDraw);
6412
3849
  }
6413
3850
  const geomDrawType = this._selectDraw.value;
6414
- this._interactionDraw = new interaction.Draw({
3851
+ this._interactionDraw = new Draw({
6415
3852
  source: getEditLayer().getSource(),
6416
3853
  type: geomDrawType,
6417
3854
  style: (feature) => styleFunction(feature),
@@ -6484,9 +3921,7 @@
6484
3921
  this._map.removeOverlay(overlay);
6485
3922
  }
6486
3923
  }
6487
- class WfstEvent extends BaseEvent$1 {
6488
- data;
6489
- layer;
3924
+ class WfstEvent extends BaseEvent {
6490
3925
  constructor(options) {
6491
3926
  super(options.type);
6492
3927
  this.layer = options.layer;
@@ -6494,16 +3929,15 @@
6494
3929
  }
6495
3930
  }
6496
3931
 
6497
- var utils = {
6498
- WfsLayer: WfsLayer,
6499
- WmsLayer: WmsLayer,
6500
- Geoserver: Geoserver
6501
- };
3932
+ const utils = {
3933
+ WfsLayer,
3934
+ WmsLayer,
3935
+ Geoserver
3936
+ };
3937
+
6502
3938
  Object.assign(Wfst, utils);
6503
3939
 
6504
- exports.default = Wfst;
6505
-
6506
- Object.defineProperty(exports, '__esModule', { value: true });
3940
+ return Wfst;
6507
3941
 
6508
3942
  }));
6509
3943
  //# sourceMappingURL=ol-wfst.js.map