ol-wfst 4.0.6 → 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.
- package/README.md +790 -782
- package/dist/Geoserver.d.ts +15 -15
- package/dist/Geoserver.d.ts.map +1 -1
- package/dist/WfsLayer.d.ts +10 -10
- package/dist/WfsLayer.d.ts.map +1 -1
- package/dist/WmsLayer.d.ts +11 -11
- package/dist/WmsLayer.d.ts.map +1 -1
- package/dist/modules/EditControlChanges.d.ts +9 -9
- package/dist/modules/EditControlChanges.d.ts.map +1 -1
- package/dist/modules/EditFieldsModal.d.ts +3 -2
- package/dist/modules/EditFieldsModal.d.ts.map +1 -1
- package/dist/modules/EditOverlay.d.ts +4 -3
- package/dist/modules/EditOverlay.d.ts.map +1 -1
- package/dist/modules/LayersControl.d.ts +2 -3
- package/dist/modules/LayersControl.d.ts.map +1 -1
- package/dist/modules/Uploads.d.ts +6 -3
- package/dist/modules/Uploads.d.ts.map +1 -1
- package/dist/modules/base/BaseLayer.d.ts +4 -4
- package/dist/modules/base/BaseLayer.d.ts.map +1 -1
- package/dist/modules/base/WfsSource.d.ts +1 -1
- package/dist/modules/base/WfsSource.d.ts.map +1 -1
- package/dist/modules/base/WmsSource.d.ts +1 -1
- package/dist/modules/base/WmsSource.d.ts.map +1 -1
- package/dist/modules/editLayer.d.ts +2 -2
- package/dist/modules/editLayer.d.ts.map +1 -1
- package/dist/modules/state.d.ts +2 -2
- package/dist/modules/state.d.ts.map +1 -1
- package/dist/modules/styleFunction.d.ts +3 -3
- package/dist/modules/styleFunction.d.ts.map +1 -1
- package/dist/ol-wfst.d.ts +20 -20
- package/dist/ol-wfst.d.ts.map +1 -1
- package/dist/ol-wfst.js +321 -2105
- package/dist/ol-wfst.js.map +1 -1
- package/dist/ol-wfst.min.js +1 -1
- package/dist/ol-wfst.min.js.map +1 -1
- package/lib/Geoserver.d.ts +15 -15
- package/lib/Geoserver.d.ts.map +1 -1
- package/lib/WfsLayer.d.ts +10 -10
- package/lib/WfsLayer.d.ts.map +1 -1
- package/lib/WmsLayer.d.ts +11 -11
- package/lib/WmsLayer.d.ts.map +1 -1
- package/lib/modules/EditControlChanges.d.ts +9 -9
- package/lib/modules/EditControlChanges.d.ts.map +1 -1
- package/lib/modules/EditFieldsModal.d.ts +3 -2
- package/lib/modules/EditFieldsModal.d.ts.map +1 -1
- package/lib/modules/EditOverlay.d.ts +4 -3
- package/lib/modules/EditOverlay.d.ts.map +1 -1
- package/lib/modules/LayersControl.d.ts +2 -3
- package/lib/modules/LayersControl.d.ts.map +1 -1
- package/lib/modules/Uploads.d.ts +6 -3
- package/lib/modules/Uploads.d.ts.map +1 -1
- package/lib/modules/base/BaseLayer.d.ts +4 -4
- package/lib/modules/base/BaseLayer.d.ts.map +1 -1
- package/lib/modules/base/WfsSource.d.ts +1 -1
- package/lib/modules/base/WfsSource.d.ts.map +1 -1
- package/lib/modules/base/WmsSource.d.ts +1 -1
- package/lib/modules/base/WmsSource.d.ts.map +1 -1
- package/lib/modules/editLayer.d.ts +2 -2
- package/lib/modules/editLayer.d.ts.map +1 -1
- package/lib/modules/state.d.ts +2 -2
- package/lib/modules/state.d.ts.map +1 -1
- package/lib/modules/styleFunction.d.ts +3 -3
- package/lib/modules/styleFunction.d.ts.map +1 -1
- package/lib/ol-wfst.d.ts +20 -20
- package/lib/ol-wfst.d.ts.map +1 -1
- package/lib/ol-wfst.js +81 -196
- package/lib/ol-wfst.js.map +1 -1
- package/package.json +5 -5
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/lib/tsconfig.tsbuildinfo +0 -1
package/lib/ol-wfst.js
CHANGED
|
@@ -1,40 +1,38 @@
|
|
|
1
|
-
import CircleStyle from 'ol/style/Circle';
|
|
2
|
-
import Fill$1 from 'ol/style/Fill';
|
|
3
|
-
import Stroke$1 from 'ol/style/Stroke';
|
|
4
|
-
import Style$1 from 'ol/style/Style';
|
|
5
|
-
import Control
|
|
6
|
-
import Draw from 'ol/interaction/Draw';
|
|
7
|
-
import Modify from 'ol/interaction/Modify';
|
|
8
|
-
import Select from 'ol/interaction/Select';
|
|
9
|
-
import Snap from 'ol/interaction/Snap';
|
|
10
|
-
import Collection from 'ol/Collection';
|
|
11
|
-
import BaseEvent from 'ol/events/Event';
|
|
12
|
-
import { primaryAction, never } from 'ol/events/condition';
|
|
13
|
-
import { unByKey } from 'ol/Observable';
|
|
1
|
+
import CircleStyle from 'ol/style/Circle.js';
|
|
2
|
+
import Fill$1 from 'ol/style/Fill.js';
|
|
3
|
+
import Stroke$1 from 'ol/style/Stroke.js';
|
|
4
|
+
import Style$1 from 'ol/style/Style.js';
|
|
5
|
+
import Control from 'ol/control/Control.js';
|
|
6
|
+
import Draw from 'ol/interaction/Draw.js';
|
|
7
|
+
import Modify from 'ol/interaction/Modify.js';
|
|
8
|
+
import Select from 'ol/interaction/Select.js';
|
|
9
|
+
import Snap from 'ol/interaction/Snap.js';
|
|
10
|
+
import Collection from 'ol/Collection.js';
|
|
11
|
+
import BaseEvent from 'ol/events/Event.js';
|
|
12
|
+
import { primaryAction, never } from 'ol/events/condition.js';
|
|
13
|
+
import Observable, { unByKey } from 'ol/Observable.js';
|
|
14
14
|
import Modal from 'modal-vanilla';
|
|
15
|
-
import VectorLayer from 'ol/layer/Vector';
|
|
15
|
+
import VectorLayer from 'ol/layer/Vector.js';
|
|
16
16
|
import { Mixin } from 'ts-mixer';
|
|
17
|
-
import Layer from 'ol/layer/Base';
|
|
18
|
-
import GeoJSON from 'ol/format/GeoJSON';
|
|
19
|
-
import VectorSource, { VectorSourceEvent } from 'ol/source/Vector';
|
|
20
|
-
import { transformExtent } from 'ol/proj';
|
|
21
|
-
import { bbox } from 'ol/loadingstrategy';
|
|
22
|
-
import TileLayer from 'ol/layer/Tile';
|
|
23
|
-
import TileWMS from 'ol/source/TileWMS';
|
|
24
|
-
import TileState from 'ol/TileState';
|
|
25
|
-
import {
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import {
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import { fromCircle } from 'ol/geom/Polygon';
|
|
37
|
-
import { getCenter } from 'ol/extent';
|
|
17
|
+
import Layer from 'ol/layer/Base.js';
|
|
18
|
+
import GeoJSON from 'ol/format/GeoJSON.js';
|
|
19
|
+
import VectorSource, { VectorSourceEvent } from 'ol/source/Vector.js';
|
|
20
|
+
import { transformExtent } from 'ol/proj.js';
|
|
21
|
+
import { bbox } from 'ol/loadingstrategy.js';
|
|
22
|
+
import TileLayer from 'ol/layer/Tile.js';
|
|
23
|
+
import TileWMS from 'ol/source/TileWMS.js';
|
|
24
|
+
import TileState from 'ol/TileState.js';
|
|
25
|
+
import { MultiPolygon, MultiLineString, MultiPoint, GeometryCollection, Polygon } from 'ol/geom.js';
|
|
26
|
+
import KML from 'ol/format/KML.js';
|
|
27
|
+
import WFS from 'ol/format/WFS.js';
|
|
28
|
+
import { Style, Stroke, Fill, Circle } from 'ol/style.js';
|
|
29
|
+
import BaseObject from 'ol/Object.js';
|
|
30
|
+
import Circle$1 from 'ol/geom/Circle.js';
|
|
31
|
+
import GeometryCollection$1 from 'ol/geom/GeometryCollection.js';
|
|
32
|
+
import Feature from 'ol/Feature.js';
|
|
33
|
+
import { fromCircle } from 'ol/geom/Polygon.js';
|
|
34
|
+
import { getCenter } from 'ol/extent.js';
|
|
35
|
+
import Overlay from 'ol/Overlay.js';
|
|
38
36
|
|
|
39
37
|
// External
|
|
40
38
|
let options = {};
|
|
@@ -210,7 +208,7 @@ const setLang = (lang = 'en', customI18n = null) => {
|
|
|
210
208
|
}
|
|
211
209
|
// Check if customs translations are provided
|
|
212
210
|
if (customI18n) {
|
|
213
|
-
I18N = {
|
|
211
|
+
I18N = Object.assign(Object.assign({}, I18N), customI18n);
|
|
214
212
|
}
|
|
215
213
|
};
|
|
216
214
|
|
|
@@ -430,17 +428,8 @@ var BaseLayerProperty;
|
|
|
430
428
|
* @param options
|
|
431
429
|
*/
|
|
432
430
|
class WfsSource extends VectorSource {
|
|
433
|
-
urlParams = new URLSearchParams({
|
|
434
|
-
SERVICE: 'wfs',
|
|
435
|
-
REQUEST: 'GetFeature',
|
|
436
|
-
OUTPUTFORMAT: 'application/json',
|
|
437
|
-
EXCEPTIONS: 'application/json'
|
|
438
|
-
});
|
|
439
431
|
constructor(options) {
|
|
440
|
-
super({
|
|
441
|
-
...options,
|
|
442
|
-
format: new GeoJSON(),
|
|
443
|
-
loader: async (extent, resolution, projection, success, failure) => {
|
|
432
|
+
super(Object.assign(Object.assign({}, options), { format: new GeoJSON(), loader: async (extent, resolution, projection, success, failure) => {
|
|
444
433
|
try {
|
|
445
434
|
// If bbox, add extent to the request
|
|
446
435
|
if (options.strategy == bbox) {
|
|
@@ -478,7 +467,12 @@ class WfsSource extends VectorSource {
|
|
|
478
467
|
showError(I18N.errors.geoserver, err, options.name);
|
|
479
468
|
failure();
|
|
480
469
|
}
|
|
481
|
-
}
|
|
470
|
+
} }));
|
|
471
|
+
this.urlParams = new URLSearchParams({
|
|
472
|
+
SERVICE: 'wfs',
|
|
473
|
+
REQUEST: 'GetFeature',
|
|
474
|
+
OUTPUTFORMAT: 'application/json',
|
|
475
|
+
EXCEPTIONS: 'application/json'
|
|
482
476
|
});
|
|
483
477
|
this.urlParams.set('version', options.geoServerAdvanced.getFeatureVersion);
|
|
484
478
|
this.urlParams.set('typename', options.name);
|
|
@@ -495,27 +489,15 @@ class WfsSource extends VectorSource {
|
|
|
495
489
|
* @param options
|
|
496
490
|
*/
|
|
497
491
|
class WfsLayer extends Mixin(BaseLayer, (VectorLayer)) {
|
|
498
|
-
_loadingCount = 0;
|
|
499
|
-
_loadedCount = 0;
|
|
500
|
-
beforeTransactFeature;
|
|
501
492
|
constructor(options) {
|
|
502
|
-
super({
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
minZoom: options.minZoom,
|
|
506
|
-
...options
|
|
507
|
-
});
|
|
493
|
+
super(Object.assign({ name: options.name, label: options.label || options.name, minZoom: options.minZoom }, options));
|
|
494
|
+
this._loadingCount = 0;
|
|
495
|
+
this._loadedCount = 0;
|
|
508
496
|
if (options.beforeTransactFeature) {
|
|
509
497
|
this.beforeTransactFeature = options.beforeTransactFeature;
|
|
510
498
|
}
|
|
511
499
|
const geoserver = options.geoserver;
|
|
512
|
-
const source = new WfsSource({
|
|
513
|
-
name: options.name,
|
|
514
|
-
geoserverUrl: geoserver.getUrl(),
|
|
515
|
-
geoServerAdvanced: geoserver.getAdvanced(),
|
|
516
|
-
...(options.strategy && { strategy: options.strategy }),
|
|
517
|
-
geoserverVendor: options.geoserverVendor
|
|
518
|
-
});
|
|
500
|
+
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 }));
|
|
519
501
|
this._loadingCount = 0;
|
|
520
502
|
this._loadedCount = 0;
|
|
521
503
|
source.on('featuresloadstart', () => {
|
|
@@ -584,17 +566,7 @@ class WfsLayer extends Mixin(BaseLayer, (VectorLayer)) {
|
|
|
584
566
|
*/
|
|
585
567
|
class WmsSource extends TileWMS {
|
|
586
568
|
constructor(options) {
|
|
587
|
-
super({
|
|
588
|
-
url: options.geoserverUrl,
|
|
589
|
-
serverType: 'geoserver',
|
|
590
|
-
params: {
|
|
591
|
-
SERVICE: 'wms',
|
|
592
|
-
TILED: true,
|
|
593
|
-
LAYERS: options.name,
|
|
594
|
-
EXCEPTIONS: 'application/json',
|
|
595
|
-
...(options.geoserverVendor && options.geoserverVendor)
|
|
596
|
-
},
|
|
597
|
-
tileLoadFunction: async (tile, src) => {
|
|
569
|
+
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) => {
|
|
598
570
|
const blobToJson = (blob) => {
|
|
599
571
|
return new Promise((resolve) => {
|
|
600
572
|
const reader = new FileReader();
|
|
@@ -624,9 +596,7 @@ class WmsSource extends TileWMS {
|
|
|
624
596
|
showError(I18N.errors.geoserver, err, options.name);
|
|
625
597
|
tile.setState(TileState.ERROR);
|
|
626
598
|
}
|
|
627
|
-
},
|
|
628
|
-
...options
|
|
629
|
-
});
|
|
599
|
+
} }, options));
|
|
630
600
|
}
|
|
631
601
|
}
|
|
632
602
|
|
|
@@ -639,18 +609,10 @@ class WmsSource extends TileWMS {
|
|
|
639
609
|
* @param options
|
|
640
610
|
*/
|
|
641
611
|
class WmsLayer extends Mixin(BaseLayer, (TileLayer)) {
|
|
642
|
-
_loadingCount = 0;
|
|
643
|
-
_loadedCount = 0;
|
|
644
|
-
beforeTransactFeature;
|
|
645
|
-
// Formats
|
|
646
|
-
_formatGeoJSON;
|
|
647
612
|
constructor(options) {
|
|
648
|
-
super({
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
minZoom: options.minZoom,
|
|
652
|
-
...options
|
|
653
|
-
});
|
|
613
|
+
super(Object.assign({ name: options.name, label: options.label || options.name, minZoom: options.minZoom }, options));
|
|
614
|
+
this._loadingCount = 0;
|
|
615
|
+
this._loadedCount = 0;
|
|
654
616
|
if (options.beforeTransactFeature) {
|
|
655
617
|
this.beforeTransactFeature = options.beforeTransactFeature;
|
|
656
618
|
}
|
|
@@ -760,6 +722,14 @@ class WmsLayer extends Mixin(BaseLayer, (TileLayer)) {
|
|
|
760
722
|
}
|
|
761
723
|
}
|
|
762
724
|
|
|
725
|
+
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";
|
|
726
|
+
|
|
727
|
+
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";
|
|
728
|
+
|
|
729
|
+
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";
|
|
730
|
+
|
|
731
|
+
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";
|
|
732
|
+
|
|
763
733
|
function createElement(tagName, attrs = {}, ...children) {
|
|
764
734
|
if (typeof tagName === 'function')
|
|
765
735
|
return tagName(attrs, children);
|
|
@@ -797,14 +767,6 @@ function createElement(tagName, attrs = {}, ...children) {
|
|
|
797
767
|
return elem;
|
|
798
768
|
}
|
|
799
769
|
|
|
800
|
-
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";
|
|
801
|
-
|
|
802
|
-
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";
|
|
803
|
-
|
|
804
|
-
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";
|
|
805
|
-
|
|
806
|
-
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";
|
|
807
|
-
|
|
808
770
|
/**
|
|
809
771
|
* Removes in the DOM the class of the tools
|
|
810
772
|
* @private
|
|
@@ -828,8 +790,6 @@ const activateDrawButton = () => {
|
|
|
828
790
|
}
|
|
829
791
|
};
|
|
830
792
|
class LayersControl extends Observable {
|
|
831
|
-
_uploads;
|
|
832
|
-
_uploadFormats;
|
|
833
793
|
constructor(uploads, uploadFormats) {
|
|
834
794
|
super();
|
|
835
795
|
this._uploads = uploads;
|
|
@@ -843,17 +803,17 @@ class LayersControl extends Observable {
|
|
|
843
803
|
addLayerEl(layer) {
|
|
844
804
|
const container = document.querySelector('.wfst--tools-control--select-layers');
|
|
845
805
|
const layerName = layer.get(BaseLayerProperty.NAME);
|
|
846
|
-
const checked = layer === getActiveLayerToInsertEls() ? { checked:
|
|
847
|
-
const input = (createElement("input", { value: layerName, id: `wfst--${layerName}`, type: "radio", className: "ol-wfst--tools-control-input", name: "wfst--select-layer",
|
|
806
|
+
const checked = layer === getActiveLayerToInsertEls() ? { checked: true } : {};
|
|
807
|
+
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) })));
|
|
848
808
|
const layerDom = (createElement("div", { className: `wfst--layer-control
|
|
849
809
|
${layer.getVisible() ? 'ol-wfst--visible-on' : ''}
|
|
850
810
|
${layer === getActiveLayerToInsertEls()
|
|
851
811
|
? 'ol-wfst--selected-on'
|
|
852
812
|
: ''}`, "data-layer": layerName },
|
|
853
813
|
createElement("div", { className: "ol-wfst--tools-control-visible" },
|
|
854
|
-
createElement("span", { className: "ol-wfst--tools-control-visible-btn ol-wfst--visible-btn-on", title: I18N.labels.toggleVisibility,
|
|
814
|
+
createElement("span", { className: "ol-wfst--tools-control-visible-btn ol-wfst--visible-btn-on", title: I18N.labels.toggleVisibility, onClick: (evt) => this._visibilityClickHandler(evt) },
|
|
855
815
|
createElement("img", { src: img$3 })),
|
|
856
|
-
createElement("span", { className: "ol-wfst--tools-control-visible-btn ol-wfst--visible-btn-off", title: I18N.labels.toggleVisibility,
|
|
816
|
+
createElement("span", { className: "ol-wfst--tools-control-visible-btn ol-wfst--visible-btn-off", title: I18N.labels.toggleVisibility, onClick: (evt) => this._visibilityClickHandler(evt) },
|
|
857
817
|
createElement("img", { src: img$2 }))),
|
|
858
818
|
createElement("label", { htmlFor: `wfst--${layerName}` },
|
|
859
819
|
input,
|
|
@@ -952,17 +912,16 @@ class LayersControl extends Observable {
|
|
|
952
912
|
return (createElement(null, null,
|
|
953
913
|
createElement("div", { className: "wfst--tools-control--head" },
|
|
954
914
|
this._uploads && (createElement("div", null,
|
|
955
|
-
createElement("input", { id: "ol-wfst--upload", type: "file", accept: this._uploadFormats,
|
|
915
|
+
createElement("input", { id: "ol-wfst--upload", type: "file", accept: this._uploadFormats, onChange: (evt) => this._uploads.process(evt) }),
|
|
956
916
|
createElement("label", { className: "ol-wfst--tools-control-btn ol-wfst--tools-control-btn-upload", htmlFor: "ol-wfst--upload", title: I18N.labels.uploadToLayer },
|
|
957
917
|
createElement("img", { src: img$5 })))),
|
|
958
918
|
createElement("div", { className: "ol-wfst--tools-control-draw-cnt" },
|
|
959
|
-
createElement("button", { className: "ol-wfst--tools-control-btn ol-wfst--tools-control-btn-draw", type: "button", title: I18N.labels.addElement,
|
|
919
|
+
createElement("button", { className: "ol-wfst--tools-control-btn ol-wfst--tools-control-btn-draw", type: "button", title: I18N.labels.addElement, onClick: () => {
|
|
960
920
|
this.dispatchEvent('drawMode');
|
|
961
921
|
} },
|
|
962
922
|
createElement("img", { src: img$4 })),
|
|
963
|
-
createElement("select", { title: I18N.labels.selectDrawType, className: "wfst--tools-control--select-draw",
|
|
964
|
-
const selectedValue = evt.target
|
|
965
|
-
.value;
|
|
923
|
+
createElement("select", { title: I18N.labels.selectDrawType, className: "wfst--tools-control--select-draw", onChange: (evt) => {
|
|
924
|
+
const selectedValue = evt.target.value;
|
|
966
925
|
this._changeStateSelect(getActiveLayerToInsertEls(), selectedValue);
|
|
967
926
|
this.dispatchEvent('changeGeom');
|
|
968
927
|
} }, [
|
|
@@ -991,20 +950,13 @@ const getEditLayer = () => {
|
|
|
991
950
|
|
|
992
951
|
// Ol
|
|
993
952
|
class Uploads extends Observable {
|
|
994
|
-
_options;
|
|
995
|
-
// Formats
|
|
996
|
-
_formatWFS;
|
|
997
|
-
_formatGeoJSON;
|
|
998
|
-
_formatKml;
|
|
999
|
-
_xs;
|
|
1000
|
-
_processUpload;
|
|
1001
953
|
constructor(options) {
|
|
1002
954
|
super();
|
|
1003
955
|
this._options = options;
|
|
1004
956
|
this._processUpload = options.processUpload;
|
|
1005
957
|
// Formats
|
|
1006
958
|
this._formatWFS = new WFS();
|
|
1007
|
-
this._formatGeoJSON = new GeoJSON
|
|
959
|
+
this._formatGeoJSON = new GeoJSON();
|
|
1008
960
|
this._formatKml = new KML({
|
|
1009
961
|
extractStyles: false,
|
|
1010
962
|
showPointNames: false
|
|
@@ -1177,17 +1129,9 @@ class Uploads extends Observable {
|
|
|
1177
1129
|
${I18N.labels.upload}
|
|
1178
1130
|
</button>
|
|
1179
1131
|
`;
|
|
1180
|
-
const modal = new Modal({
|
|
1181
|
-
...this._options.modal,
|
|
1182
|
-
header: true,
|
|
1183
|
-
headerClose: false,
|
|
1184
|
-
title: I18N.labels.uploadFeatures +
|
|
1132
|
+
const modal = new Modal(Object.assign(Object.assign({}, this._options.modal), { header: true, headerClose: false, title: I18N.labels.uploadFeatures +
|
|
1185
1133
|
' ' +
|
|
1186
|
-
getActiveLayerToInsertEls().get(BaseLayerProperty.NAME),
|
|
1187
|
-
content: content,
|
|
1188
|
-
backdrop: 'static',
|
|
1189
|
-
footer: footer
|
|
1190
|
-
}).show();
|
|
1134
|
+
getActiveLayerToInsertEls().get(BaseLayerProperty.NAME), content: content, backdrop: 'static', footer: footer })).show();
|
|
1191
1135
|
modal.on('dismiss', (modal, event) => {
|
|
1192
1136
|
// On saving changes
|
|
1193
1137
|
if (event.target.dataset.action === 'save') {
|
|
@@ -1257,13 +1201,13 @@ class EditControlChangesEl extends Control {
|
|
|
1257
1201
|
" -",
|
|
1258
1202
|
' ',
|
|
1259
1203
|
createElement("i", null, String(feature.getId()))),
|
|
1260
|
-
createElement("button", { type: "button", className: "btn btn-sm btn-secondary",
|
|
1204
|
+
createElement("button", { type: "button", className: "btn btn-sm btn-secondary", onClick: () => {
|
|
1261
1205
|
this.dispatchEvent(new VectorSourceEvent('cancel', feature));
|
|
1262
1206
|
} }, I18N.labels.cancel),
|
|
1263
|
-
createElement("button", { type: "button", className: "btn btn-sm btn-primary",
|
|
1207
|
+
createElement("button", { type: "button", className: "btn btn-sm btn-primary", onClick: () => {
|
|
1264
1208
|
this.dispatchEvent(new VectorSourceEvent('apply', feature));
|
|
1265
1209
|
} }, I18N.labels.apply),
|
|
1266
|
-
createElement("button", { type: "button", className: "btn btn-sm btn-danger-outline",
|
|
1210
|
+
createElement("button", { type: "button", className: "btn btn-sm btn-danger-outline", onClick: () => {
|
|
1267
1211
|
this.dispatchEvent(new VectorSourceEvent('delete', feature));
|
|
1268
1212
|
} }, I18N.labels.delete))))
|
|
1269
1213
|
});
|
|
@@ -1418,9 +1362,6 @@ function styleFunction(feature) {
|
|
|
1418
1362
|
* @private
|
|
1419
1363
|
*/
|
|
1420
1364
|
class EditFieldsModal extends Observable {
|
|
1421
|
-
_options;
|
|
1422
|
-
_modal;
|
|
1423
|
-
_feature;
|
|
1424
1365
|
constructor(options) {
|
|
1425
1366
|
super();
|
|
1426
1367
|
this._options = options;
|
|
@@ -1435,14 +1376,7 @@ class EditFieldsModal extends Observable {
|
|
|
1435
1376
|
${I18N.labels.save}
|
|
1436
1377
|
</button>
|
|
1437
1378
|
`;
|
|
1438
|
-
this._modal = new Modal({
|
|
1439
|
-
...this._options,
|
|
1440
|
-
header: true,
|
|
1441
|
-
headerClose: true,
|
|
1442
|
-
title: '',
|
|
1443
|
-
content: '<div></div>',
|
|
1444
|
-
footer: footer
|
|
1445
|
-
});
|
|
1379
|
+
this._modal = new Modal(Object.assign(Object.assign({}, this._options), { header: true, headerClose: true, title: '', content: '<div></div>', footer: footer }));
|
|
1446
1380
|
this._modal.on('dismiss', (modal, event) => {
|
|
1447
1381
|
// On saving changes
|
|
1448
1382
|
if (event.target.dataset.action === 'save') {
|
|
@@ -1516,17 +1450,6 @@ const DEFAULT_GEOSERVER_SRS = 'EPSG:3857';
|
|
|
1516
1450
|
* @param options
|
|
1517
1451
|
*/
|
|
1518
1452
|
class Geoserver extends BaseObject {
|
|
1519
|
-
_options;
|
|
1520
|
-
_countRequests;
|
|
1521
|
-
_insertFeatures;
|
|
1522
|
-
_updateFeatures;
|
|
1523
|
-
_deleteFeatures;
|
|
1524
|
-
// Formats
|
|
1525
|
-
_formatWFS;
|
|
1526
|
-
_formatGeoJSON;
|
|
1527
|
-
_formatKml;
|
|
1528
|
-
_xs;
|
|
1529
|
-
state_;
|
|
1530
1453
|
constructor(options) {
|
|
1531
1454
|
super();
|
|
1532
1455
|
const defaults = {
|
|
@@ -1559,9 +1482,9 @@ class Geoserver extends BaseObject {
|
|
|
1559
1482
|
this._updateFeatures = [];
|
|
1560
1483
|
this._deleteFeatures = [];
|
|
1561
1484
|
// Formats
|
|
1562
|
-
this._formatWFS = new WFS
|
|
1485
|
+
this._formatWFS = new WFS();
|
|
1563
1486
|
this._formatGeoJSON = new GeoJSON();
|
|
1564
|
-
this._formatKml = new KML
|
|
1487
|
+
this._formatKml = new KML({
|
|
1565
1488
|
extractStyles: false,
|
|
1566
1489
|
showPointNames: false
|
|
1567
1490
|
});
|
|
@@ -1866,10 +1789,7 @@ class Geoserver extends BaseObject {
|
|
|
1866
1789
|
transactionType !== TransactionType.Insert) {
|
|
1867
1790
|
payload = payload.replace(`</Transaction>`, `<LockId>${this._options.advanced.lockFeatureParams.lockId}</LockId></Transaction>`);
|
|
1868
1791
|
}
|
|
1869
|
-
const headers = {
|
|
1870
|
-
'Content-Type': 'text/xml',
|
|
1871
|
-
...this.getHeaders()
|
|
1872
|
-
};
|
|
1792
|
+
const headers = Object.assign({ 'Content-Type': 'text/xml' }, this.getHeaders());
|
|
1873
1793
|
const response = await fetch(this.getUrl(), {
|
|
1874
1794
|
method: 'POST',
|
|
1875
1795
|
body: payload,
|
|
@@ -2060,12 +1980,12 @@ class EditOverlay extends Overlay {
|
|
|
2060
1980
|
offset: [0, -40],
|
|
2061
1981
|
stopEvent: true,
|
|
2062
1982
|
element: (createElement("div", null,
|
|
2063
|
-
createElement("div", { className: "ol-wfst--edit-button-cnt",
|
|
1983
|
+
createElement("div", { className: "ol-wfst--edit-button-cnt", onClick: () => {
|
|
2064
1984
|
this.dispatchEvent('editFields');
|
|
2065
1985
|
} },
|
|
2066
1986
|
createElement("button", { className: "ol-wfst--edit-button", type: "button", title: I18N.labels.editFields },
|
|
2067
1987
|
createElement("img", { src: img$1, alt: I18N.labels.editFields }))),
|
|
2068
|
-
createElement("div", { className: "ol-wfst--edit-button-cnt",
|
|
1988
|
+
createElement("div", { className: "ol-wfst--edit-button-cnt", onClick: () => {
|
|
2069
1989
|
this.dispatchEvent('editGeom');
|
|
2070
1990
|
} },
|
|
2071
1991
|
createElement("button", { class: "ol-wfst--edit-button", type: "button", title: I18N.labels.editGeom },
|
|
@@ -2092,39 +2012,7 @@ const controlElement = document.createElement('div');
|
|
|
2092
2012
|
* @extends {ol/control/Control~Control}
|
|
2093
2013
|
* @param options Wfst options, see [Wfst Options](#options) for more details.
|
|
2094
2014
|
*/
|
|
2095
|
-
class Wfst extends Control
|
|
2096
|
-
_options;
|
|
2097
|
-
_i18n;
|
|
2098
|
-
// Ol
|
|
2099
|
-
_map;
|
|
2100
|
-
_view;
|
|
2101
|
-
_viewport;
|
|
2102
|
-
_initialized = false;
|
|
2103
|
-
_layersControl;
|
|
2104
|
-
_overlay;
|
|
2105
|
-
// Interactions
|
|
2106
|
-
_interactionWfsSelect;
|
|
2107
|
-
_interactionSelectModify;
|
|
2108
|
-
_collectionModify;
|
|
2109
|
-
_interactionModify;
|
|
2110
|
-
_interactionSnap;
|
|
2111
|
-
_interactionDraw;
|
|
2112
|
-
// Obserbable keys
|
|
2113
|
-
_keyClickWms;
|
|
2114
|
-
_keyRemove;
|
|
2115
|
-
_keySelect;
|
|
2116
|
-
// Controls
|
|
2117
|
-
_controlApplyDiscardChanges;
|
|
2118
|
-
_controlWidgetToolsDiv;
|
|
2119
|
-
_selectDraw;
|
|
2120
|
-
// State
|
|
2121
|
-
_currentZoom;
|
|
2122
|
-
_lastZoom;
|
|
2123
|
-
// Editing
|
|
2124
|
-
_editFeature;
|
|
2125
|
-
_editFeatureOriginal;
|
|
2126
|
-
_uploads;
|
|
2127
|
-
_editFields;
|
|
2015
|
+
class Wfst extends Control {
|
|
2128
2016
|
constructor(options) {
|
|
2129
2017
|
super({
|
|
2130
2018
|
target: null,
|
|
@@ -2134,6 +2022,7 @@ class Wfst extends Control$1 {
|
|
|
2134
2022
|
this._init();
|
|
2135
2023
|
}
|
|
2136
2024
|
});
|
|
2025
|
+
this._initialized = false;
|
|
2137
2026
|
setLang(options.language, options.i18n);
|
|
2138
2027
|
const defaultOptions = getDefaultOptions();
|
|
2139
2028
|
this._options = deepObjectAssign(defaultOptions, options);
|
|
@@ -2642,9 +2531,7 @@ class Wfst extends Control$1 {
|
|
|
2642
2531
|
}
|
|
2643
2532
|
};
|
|
2644
2533
|
if (confirm) {
|
|
2645
|
-
const confirmModal = Modal.confirm(I18N.labels.confirmDelete, {
|
|
2646
|
-
...this._options.modal
|
|
2647
|
-
});
|
|
2534
|
+
const confirmModal = Modal.confirm(I18N.labels.confirmDelete, Object.assign({}, this._options.modal));
|
|
2648
2535
|
confirmModal.show().once('dismiss', function (modal, ev, button) {
|
|
2649
2536
|
if (button && button.value) {
|
|
2650
2537
|
deleteEl();
|
|
@@ -2787,8 +2674,6 @@ class Wfst extends Control$1 {
|
|
|
2787
2674
|
}
|
|
2788
2675
|
}
|
|
2789
2676
|
class WfstEvent extends BaseEvent {
|
|
2790
|
-
data;
|
|
2791
|
-
layer;
|
|
2792
2677
|
constructor(options) {
|
|
2793
2678
|
super(options.type);
|
|
2794
2679
|
this.layer = options.layer;
|