ol-wfst 3.0.4 → 3.0.5
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/CHANGELOG.md +71 -67
- package/README.md +30 -5
- package/dist/css/ol-wfst.bootstrap5.css +364 -481
- package/dist/css/ol-wfst.bootstrap5.min.css +1 -1
- package/dist/css/ol-wfst.css +3 -0
- package/dist/ol-wfst.d.ts +25 -8
- package/dist/ol-wfst.d.ts.map +1 -1
- package/dist/ol-wfst.js +191 -166
- 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/dist/tsconfig.tsbuildinfo +1 -1
- package/lib/ol-wfst.d.ts +25 -8
- package/lib/ol-wfst.d.ts.map +1 -1
- package/lib/ol-wfst.js +47 -30
- package/lib/ol-wfst.js.map +1 -1
- package/lib/style/css/ol-gisify.css +3 -0
- package/lib/style/css/ol-wfst.bootstrap5.css +364 -481
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +70 -70
package/lib/ol-wfst.js
CHANGED
|
@@ -3,7 +3,7 @@ import { GeometryCollection, Circle as Circle$1, Polygon, MultiLineString, Multi
|
|
|
3
3
|
import { Style, Circle, Fill, Stroke } from 'ol/style';
|
|
4
4
|
import { Control } from 'ol/control';
|
|
5
5
|
import { Modify, Snap, Select, Draw } from 'ol/interaction';
|
|
6
|
-
import { Collection,
|
|
6
|
+
import { Collection, Overlay, Feature } from 'ol';
|
|
7
7
|
import { WFS, GeoJSON, KML } from 'ol/format';
|
|
8
8
|
import { Vector, Tile } from 'ol/layer';
|
|
9
9
|
import { Vector as Vector$1, TileWMS } from 'ol/source';
|
|
@@ -40,17 +40,17 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
var img = "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";
|
|
43
|
+
var img$5 = "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";
|
|
44
44
|
|
|
45
|
-
var img$
|
|
45
|
+
var img$4 = "data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='448' height='448' viewBox='0 0 448 448'%3e %3cpath d='M222 296l29-29-38-38-29 29v14h24v24h14zM332 116c-2.25-2.25-6-2-8.25 0.25l-87.5 87.5c-2.25 2.25-2.5 6-0.25 8.25s6 2 8.25-0.25l87.5-87.5c2.25-2.25 2.5-6 0.25-8.25zM352 264.5v47.5c0 39.75-32.25 72-72 72h-208c-39.75 0-72-32.25-72-72v-208c0-39.75 32.25-72 72-72h208c10 0 20 2 29.25 6.25 2.25 1 4 3.25 4.5 5.75 0.5 2.75-0.25 5.25-2.25 7.25l-12.25 12.25c-2.25 2.25-5.25 3-8 2-3.75-1-7.5-1.5-11.25-1.5h-208c-22 0-40 18-40 40v208c0 22 18 40 40 40h208c22 0 40-18 40-40v-31.5c0-2 0.75-4 2.25-5.5l16-16c2.5-2.5 5.75-3 8.75-1.75s5 4 5 7.25zM328 80l72 72-168 168h-72v-72zM439 113l-23 23-72-72 23-23c9.25-9.25 24.75-9.25 34 0l38 38c9.25 9.25 9.25 24.75 0 34z'%3e%3c/path%3e%3c/svg%3e";
|
|
46
46
|
|
|
47
|
-
var img$
|
|
47
|
+
var img$3 = "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";
|
|
48
48
|
|
|
49
|
-
var img$
|
|
49
|
+
var img$2 = "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";
|
|
50
50
|
|
|
51
|
-
var img$
|
|
51
|
+
var img$1 = "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";
|
|
52
52
|
|
|
53
|
-
var img
|
|
53
|
+
var img = "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";
|
|
54
54
|
|
|
55
55
|
var GeometryType;
|
|
56
56
|
(function (GeometryType) {
|
|
@@ -210,6 +210,7 @@ const controlElement = document.createElement('div');
|
|
|
210
210
|
* @fires modifyend
|
|
211
211
|
* @fires drawstart
|
|
212
212
|
* @fires drawend
|
|
213
|
+
* @fires load
|
|
213
214
|
* @extends {ol/control/Control~Control}
|
|
214
215
|
* @param opt_options Wfst options, see [Wfst Options](#options) for more details.
|
|
215
216
|
*/
|
|
@@ -219,6 +220,7 @@ class Wfst extends Control {
|
|
|
219
220
|
target: null,
|
|
220
221
|
element: controlElement
|
|
221
222
|
});
|
|
223
|
+
this._initialized = false;
|
|
222
224
|
// Check if the selected language exists
|
|
223
225
|
this._i18n =
|
|
224
226
|
opt_options.language && opt_options.language in i18n
|
|
@@ -263,7 +265,7 @@ class Wfst extends Control {
|
|
|
263
265
|
}
|
|
264
266
|
};
|
|
265
267
|
this._options = deepObjectAssign(defaultOptions, opt_options);
|
|
266
|
-
this._mapLayers =
|
|
268
|
+
this._mapLayers = {};
|
|
267
269
|
this._countRequests = 0;
|
|
268
270
|
this._isEditModeOn = false;
|
|
269
271
|
// GeoServer
|
|
@@ -289,6 +291,17 @@ class Wfst extends Control {
|
|
|
289
291
|
this._controlWidgetToolsDiv.className = 'ol-wfst--tools-control';
|
|
290
292
|
this._initAsyncOperations();
|
|
291
293
|
}
|
|
294
|
+
/**
|
|
295
|
+
* Gat all the layers in the ol-wfst instance
|
|
296
|
+
* If a name is provided, only returns that layer
|
|
297
|
+
* @public
|
|
298
|
+
*/
|
|
299
|
+
getLayers(layerName = '') {
|
|
300
|
+
if (layerName && layerName in this._mapLayers) {
|
|
301
|
+
return this._mapLayers[layerName];
|
|
302
|
+
}
|
|
303
|
+
return Object.values(this._mapLayers);
|
|
304
|
+
}
|
|
292
305
|
/**
|
|
293
306
|
* @private
|
|
294
307
|
*/
|
|
@@ -304,10 +317,6 @@ class Wfst extends Control {
|
|
|
304
317
|
/**
|
|
305
318
|
* Connect to the GeoServer and retrieve metadata about the service (GetCapabilities).
|
|
306
319
|
* Get each layer specs (DescribeFeatureType) and create the layers and map controls.
|
|
307
|
-
*
|
|
308
|
-
* @param layers
|
|
309
|
-
* @param showControl
|
|
310
|
-
* @param active
|
|
311
320
|
* @private
|
|
312
321
|
*/
|
|
313
322
|
_initAsyncOperations() {
|
|
@@ -315,7 +324,9 @@ class Wfst extends Control {
|
|
|
315
324
|
try {
|
|
316
325
|
// @ts-expect-error
|
|
317
326
|
this.on('allDescribeFeatureTypeLoaded', this._onLoad);
|
|
318
|
-
this.
|
|
327
|
+
if (this._isVisible) {
|
|
328
|
+
this._showLoading();
|
|
329
|
+
}
|
|
319
330
|
yield this._connectToGeoServerAndGetCapabilities();
|
|
320
331
|
if (this._options.layers) {
|
|
321
332
|
yield this._getGeoserverLayersData(this._options.layers, this._options.geoServerUrl);
|
|
@@ -410,8 +421,7 @@ class Wfst extends Control {
|
|
|
410
421
|
const getLayerData = (layerName) => __awaiter(this, void 0, void 0, function* () {
|
|
411
422
|
const params = new URLSearchParams({
|
|
412
423
|
service: 'wfs',
|
|
413
|
-
version: this._options.geoServerAdvanced
|
|
414
|
-
.describeFeatureTypeVersion,
|
|
424
|
+
version: this._options.geoServerAdvanced.describeFeatureTypeVersion,
|
|
415
425
|
request: 'DescribeFeatureType',
|
|
416
426
|
typeName: layerName,
|
|
417
427
|
outputFormat: 'application/json',
|
|
@@ -602,8 +612,7 @@ class Wfst extends Control {
|
|
|
602
612
|
featureProjection: this._view
|
|
603
613
|
.getProjection()
|
|
604
614
|
.getCode(),
|
|
605
|
-
dataProjection: this._options.geoServerAdvanced
|
|
606
|
-
.projection
|
|
615
|
+
dataProjection: this._options.geoServerAdvanced.projection
|
|
607
616
|
});
|
|
608
617
|
features.forEach((feature) => {
|
|
609
618
|
feature.set('_layerName_', layerName,
|
|
@@ -940,10 +949,10 @@ class Wfst extends Control {
|
|
|
940
949
|
" data-layer="${layerName}">
|
|
941
950
|
<div class="ol-wfst--tools-control-visible">
|
|
942
951
|
<span class="ol-wfst--tools-control-visible-btn ol-wfst--visible-btn-on" title="${this._i18n.labels.toggleVisibility}">
|
|
943
|
-
<img src="${img$
|
|
952
|
+
<img src="${img$1}"/>
|
|
944
953
|
</span>
|
|
945
954
|
<span class="ol-wfst--tools-control-visible-btn ol-wfst--visible-btn-off" title="${this._i18n.labels.toggleVisibility}">
|
|
946
|
-
<img src="${img
|
|
955
|
+
<img src="${img}"/>
|
|
947
956
|
</span>
|
|
948
957
|
</div>
|
|
949
958
|
<label for="wfst--${layerName}">
|
|
@@ -1007,7 +1016,7 @@ class Wfst extends Control {
|
|
|
1007
1016
|
uploadButton.className =
|
|
1008
1017
|
'ol-wfst--tools-control-btn ol-wfst--tools-control-btn-upload';
|
|
1009
1018
|
uploadButton.htmlFor = 'ol-wfst--upload';
|
|
1010
|
-
uploadButton.innerHTML = `<img src="${img$
|
|
1019
|
+
uploadButton.innerHTML = `<img src="${img$2}"/> `;
|
|
1011
1020
|
uploadButton.title = this._i18n.labels.uploadToLayer;
|
|
1012
1021
|
// Hidden Input form
|
|
1013
1022
|
const uploadInput = document.createElement('input');
|
|
@@ -1031,7 +1040,7 @@ class Wfst extends Control {
|
|
|
1031
1040
|
drawButton.className =
|
|
1032
1041
|
'ol-wfst--tools-control-btn ol-wfst--tools-control-btn-draw';
|
|
1033
1042
|
drawButton.type = 'button';
|
|
1034
|
-
drawButton.innerHTML = `<img src="${img}"/>`;
|
|
1043
|
+
drawButton.innerHTML = `<img src="${img$5}"/>`;
|
|
1035
1044
|
drawButton.title = this._i18n.labels.addElement;
|
|
1036
1045
|
drawButton.onclick = () => {
|
|
1037
1046
|
if (this._isDrawModeOn) {
|
|
@@ -1107,10 +1116,18 @@ class Wfst extends Control {
|
|
|
1107
1116
|
}
|
|
1108
1117
|
/**
|
|
1109
1118
|
* Hide loading
|
|
1119
|
+
* @fires load
|
|
1110
1120
|
* @private
|
|
1111
1121
|
*/
|
|
1112
1122
|
_hideLoading() {
|
|
1113
|
-
|
|
1123
|
+
// run only once
|
|
1124
|
+
if (!this._initialized) {
|
|
1125
|
+
this.dispatchEvent('load');
|
|
1126
|
+
this._initialized = true;
|
|
1127
|
+
}
|
|
1128
|
+
if (this._modalLoading) {
|
|
1129
|
+
this._modalLoading.classList.remove('ol-wfst--tools-control--loading-show');
|
|
1130
|
+
}
|
|
1114
1131
|
}
|
|
1115
1132
|
/**
|
|
1116
1133
|
* Lock a feature in the geoserver before edit
|
|
@@ -1374,12 +1391,12 @@ class Wfst extends Control {
|
|
|
1374
1391
|
this._editLayer.getSource().removeFeature(feature);
|
|
1375
1392
|
}
|
|
1376
1393
|
}
|
|
1377
|
-
const
|
|
1378
|
-
if (
|
|
1379
|
-
refreshWfsLayer(
|
|
1394
|
+
const wlayer = this._mapLayers[layerName];
|
|
1395
|
+
if (wlayer instanceof Vector) {
|
|
1396
|
+
refreshWfsLayer(wlayer);
|
|
1380
1397
|
}
|
|
1381
|
-
else if (
|
|
1382
|
-
refreshWmsLayer(
|
|
1398
|
+
else if (wlayer instanceof Tile) {
|
|
1399
|
+
refreshWmsLayer(wlayer);
|
|
1383
1400
|
}
|
|
1384
1401
|
this._hideLoading();
|
|
1385
1402
|
this._insertFeatures = [];
|
|
@@ -1747,7 +1764,7 @@ class Wfst extends Control {
|
|
|
1747
1764
|
*/
|
|
1748
1765
|
_addFeatureToEdit(feature, coordinate = null, layerName = null) {
|
|
1749
1766
|
const prepareOverlay = () => {
|
|
1750
|
-
const svgFields = `<img src="${img$
|
|
1767
|
+
const svgFields = `<img src="${img$4}"/>`;
|
|
1751
1768
|
const editFieldsEl = document.createElement('div');
|
|
1752
1769
|
editFieldsEl.className = 'ol-wfst--edit-button-cnt';
|
|
1753
1770
|
editFieldsEl.innerHTML = `<button class="ol-wfst--edit-button" type="button" title="${this._i18n.labels.editFields}">${svgFields}</button>`;
|
|
@@ -1756,7 +1773,7 @@ class Wfst extends Control {
|
|
|
1756
1773
|
};
|
|
1757
1774
|
const buttons = document.createElement('div');
|
|
1758
1775
|
buttons.append(editFieldsEl);
|
|
1759
|
-
const svgGeom = `<img src="${img$
|
|
1776
|
+
const svgGeom = `<img src="${img$3}"/>`;
|
|
1760
1777
|
const editGeomEl = document.createElement('div');
|
|
1761
1778
|
editGeomEl.className = 'ol-wfst--edit-button-cnt';
|
|
1762
1779
|
editGeomEl.innerHTML = `<button class="ol-wfst--edit-button" type="button" title="${this._i18n.labels.editGeom}">${svgGeom}</button>`;
|
|
@@ -2255,5 +2272,5 @@ const deepObjectAssign = (target, ...sources) => {
|
|
|
2255
2272
|
return target;
|
|
2256
2273
|
};
|
|
2257
2274
|
|
|
2258
|
-
export default
|
|
2275
|
+
export { Wfst as default };
|
|
2259
2276
|
//# sourceMappingURL=ol-wfst.js.map
|