@opengeoweb/webmap 9.4.1 → 9.6.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/index.esm.js +77 -41
- package/package.json +10 -1
- package/src/lib/components/WMJSMap.d.ts +5 -0
- package/src/lib/components/WMLayer.d.ts +2 -0
package/index.esm.js
CHANGED
|
@@ -4410,6 +4410,7 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
4410
4410
|
this.rebuildMapDimensions = this.rebuildMapDimensions.bind(this);
|
|
4411
4411
|
this.getLayerByServiceAndName = this.getLayerByServiceAndName.bind(this);
|
|
4412
4412
|
this.getLayers = this.getLayers.bind(this);
|
|
4413
|
+
this.hasLayer = this.hasLayer.bind(this);
|
|
4413
4414
|
this.setLayer = this.setLayer.bind(this);
|
|
4414
4415
|
this.setActive = this.setActive.bind(this);
|
|
4415
4416
|
this.setActiveLayer = this.setActiveLayer.bind(this);
|
|
@@ -4422,6 +4423,7 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
4422
4423
|
this.removeAllLayers = this.removeAllLayers.bind(this);
|
|
4423
4424
|
this.deleteLayer = this.deleteLayer.bind(this);
|
|
4424
4425
|
this.moveLayerDown = this.moveLayerDown.bind(this);
|
|
4426
|
+
this.reorderLayers = this.reorderLayers.bind(this);
|
|
4425
4427
|
this.swapLayers = this.swapLayers.bind(this);
|
|
4426
4428
|
this.moveLayerUp = this.moveLayerUp.bind(this);
|
|
4427
4429
|
this.addLayer = this.addLayer.bind(this);
|
|
@@ -5040,6 +5042,11 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5040
5042
|
}
|
|
5041
5043
|
return returnlayers;
|
|
5042
5044
|
}
|
|
5045
|
+
}, {
|
|
5046
|
+
key: "hasLayer",
|
|
5047
|
+
value: function hasLayer(layer) {
|
|
5048
|
+
return this.layers.includes(layer) || this.baseLayers.includes(layer);
|
|
5049
|
+
}
|
|
5043
5050
|
}, {
|
|
5044
5051
|
key: "setLayer",
|
|
5045
5052
|
value: function setLayer(layer) {
|
|
@@ -5178,6 +5185,35 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5178
5185
|
}
|
|
5179
5186
|
}
|
|
5180
5187
|
}
|
|
5188
|
+
/**
|
|
5189
|
+
* Reorder layers according to an index array with indices on how the layers should be reordered.
|
|
5190
|
+
*/
|
|
5191
|
+
}, {
|
|
5192
|
+
key: "reorderLayers",
|
|
5193
|
+
value: function reorderLayers(order) {
|
|
5194
|
+
var _this5 = this;
|
|
5195
|
+
// The length should be the same
|
|
5196
|
+
if (order.length !== this.layers.length) {
|
|
5197
|
+
return false;
|
|
5198
|
+
}
|
|
5199
|
+
// There should be no duplicate indices
|
|
5200
|
+
if (order.length !== new Set(order).size) {
|
|
5201
|
+
return false;
|
|
5202
|
+
}
|
|
5203
|
+
var origList = this.layers.slice();
|
|
5204
|
+
var wasReordered = false;
|
|
5205
|
+
order.forEach(function (value, index) {
|
|
5206
|
+
if (value >= 0 || value < _this5.layers.length) {
|
|
5207
|
+
var indexA = _this5.layers.length - value - 1;
|
|
5208
|
+
var indexB = _this5.layers.length - index - 1;
|
|
5209
|
+
if (indexA !== indexB) {
|
|
5210
|
+
_this5.layers[indexA] = origList[indexB];
|
|
5211
|
+
wasReordered = true;
|
|
5212
|
+
}
|
|
5213
|
+
}
|
|
5214
|
+
});
|
|
5215
|
+
return wasReordered;
|
|
5216
|
+
}
|
|
5181
5217
|
}, {
|
|
5182
5218
|
key: "swapLayers",
|
|
5183
5219
|
value: function swapLayers(_layerA, _layerB) {
|
|
@@ -5220,9 +5256,9 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5220
5256
|
}, {
|
|
5221
5257
|
key: "configureMapDimensions",
|
|
5222
5258
|
value: function configureMapDimensions(layer) {
|
|
5223
|
-
var
|
|
5259
|
+
var _this6 = this;
|
|
5224
5260
|
layer.dimensions.forEach(function (dimension) {
|
|
5225
|
-
var mapDim =
|
|
5261
|
+
var mapDim = _this6.getDimension(dimension.name);
|
|
5226
5262
|
if ((mapDim === null || mapDim === void 0 ? void 0 : mapDim.currentValue) !== undefined && dimension.linked) {
|
|
5227
5263
|
dimension.setClosestValue(mapDim.currentValue);
|
|
5228
5264
|
}
|
|
@@ -5235,7 +5271,7 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5235
5271
|
}, {
|
|
5236
5272
|
key: "addLayer",
|
|
5237
5273
|
value: function addLayer(layer) {
|
|
5238
|
-
var
|
|
5274
|
+
var _this7 = this;
|
|
5239
5275
|
return new Promise(function (resolve, reject) {
|
|
5240
5276
|
if (!isDefined(layer)) {
|
|
5241
5277
|
debugLogger(DebugType.Warning);
|
|
@@ -5248,12 +5284,12 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5248
5284
|
return;
|
|
5249
5285
|
}
|
|
5250
5286
|
/* Set a reference in the layer to this map */
|
|
5251
|
-
layer.parentMap =
|
|
5252
|
-
|
|
5287
|
+
layer.parentMap = _this7;
|
|
5288
|
+
_this7.layers.push(layer);
|
|
5253
5289
|
var done = function done(layerCallback) {
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
resolve(
|
|
5290
|
+
_this7.configureMapDimensions(layerCallback);
|
|
5291
|
+
_this7.callBack.triggerEvent('onlayeradd');
|
|
5292
|
+
resolve(_this7);
|
|
5257
5293
|
};
|
|
5258
5294
|
layer.parseLayer(done, undefined, 'WMJSMap addLayer');
|
|
5259
5295
|
});
|
|
@@ -5551,7 +5587,7 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5551
5587
|
}, {
|
|
5552
5588
|
key: "_drawAndLoad",
|
|
5553
5589
|
value: function _drawAndLoad(inputAnimationList) {
|
|
5554
|
-
var
|
|
5590
|
+
var _this8 = this;
|
|
5555
5591
|
if (this.width < 4 || this.height < 4) {
|
|
5556
5592
|
this._drawReady();
|
|
5557
5593
|
return;
|
|
@@ -5571,16 +5607,16 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5571
5607
|
this.mouseHoverAnimationBox = false;
|
|
5572
5608
|
inputAnimationList.forEach(function (animationStepWithoutRequests, j) {
|
|
5573
5609
|
if (selectedTime && animationStepWithoutRequests.value === selectedTime) {
|
|
5574
|
-
|
|
5610
|
+
_this8.currentAnimationStep = j;
|
|
5575
5611
|
}
|
|
5576
5612
|
var animationStep = {
|
|
5577
5613
|
name: animationStepWithoutRequests.name,
|
|
5578
5614
|
value: animationStepWithoutRequests.value,
|
|
5579
5615
|
requests: []
|
|
5580
5616
|
};
|
|
5581
|
-
|
|
5582
|
-
animationStep.requests =
|
|
5583
|
-
|
|
5617
|
+
_this8.setDimension(animationStepWithoutRequests.name, animationStepWithoutRequests.value, false);
|
|
5618
|
+
animationStep.requests = _this8.getWMSRequests();
|
|
5619
|
+
_this8.animationList.push(animationStep);
|
|
5584
5620
|
});
|
|
5585
5621
|
this.setDimension(this.animationList[this.currentAnimationStep].name, this.animationList[this.currentAnimationStep].value, false);
|
|
5586
5622
|
this.wmAnimate.loopAnimation();
|
|
@@ -5606,11 +5642,11 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5606
5642
|
}, {
|
|
5607
5643
|
key: "getWMSRequests",
|
|
5608
5644
|
value: function getWMSRequests(dimensionOverride) {
|
|
5609
|
-
var
|
|
5645
|
+
var _this9 = this;
|
|
5610
5646
|
var requests = [];
|
|
5611
5647
|
this.layers.forEach(function (layer) {
|
|
5612
5648
|
if (layer.service && layer.enabled) {
|
|
5613
|
-
var request = buildWMSGetMapRequest(
|
|
5649
|
+
var request = buildWMSGetMapRequest(_this9, layer, dimensionOverride);
|
|
5614
5650
|
if (request === null || request === void 0 ? void 0 : request.url) {
|
|
5615
5651
|
requests.push(request);
|
|
5616
5652
|
}
|
|
@@ -5621,7 +5657,7 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5621
5657
|
}, {
|
|
5622
5658
|
key: "addLayersToCanvasAndDisplayThem",
|
|
5623
5659
|
value: function addLayersToCanvasAndDisplayThem() {
|
|
5624
|
-
var
|
|
5660
|
+
var _this10 = this;
|
|
5625
5661
|
debugLogger(DebugType.Log);
|
|
5626
5662
|
this.divBuffer.reset();
|
|
5627
5663
|
var currentLayerIndex = 0;
|
|
@@ -5629,12 +5665,12 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5629
5665
|
this.baseLayers && this.baseLayers.forEach(function (baseLayer) {
|
|
5630
5666
|
var _a;
|
|
5631
5667
|
if (baseLayer.enabled && baseLayer.keepOnTop === false && baseLayer.type && baseLayer.type !== 'twms') {
|
|
5632
|
-
|
|
5633
|
-
var requestURL = (_a = buildWMSGetMapRequest(
|
|
5668
|
+
_this10.numBaseLayers += 1;
|
|
5669
|
+
var requestURL = (_a = buildWMSGetMapRequest(_this10, baseLayer)) === null || _a === void 0 ? void 0 : _a.url;
|
|
5634
5670
|
if (requestURL) {
|
|
5635
|
-
|
|
5671
|
+
_this10.divBuffer.setSrc(currentLayerIndex, requestURL, {
|
|
5636
5672
|
layer: baseLayer
|
|
5637
|
-
}, baseLayer.opacity,
|
|
5673
|
+
}, baseLayer.opacity, _this10.getDrawBBOX());
|
|
5638
5674
|
currentLayerIndex += 1;
|
|
5639
5675
|
}
|
|
5640
5676
|
}
|
|
@@ -5646,11 +5682,11 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5646
5682
|
this.layers && this.layers.forEach(function (layer) {
|
|
5647
5683
|
var _a;
|
|
5648
5684
|
if (layer.service && layer.enabled && layer.isConfigured) {
|
|
5649
|
-
var requestURL = (_a = buildWMSGetMapRequest(
|
|
5685
|
+
var requestURL = (_a = buildWMSGetMapRequest(_this10, layer)) === null || _a === void 0 ? void 0 : _a.url;
|
|
5650
5686
|
if (requestURL) {
|
|
5651
|
-
|
|
5687
|
+
_this10.divBuffer.setSrc(currentLayerIndex, requestURL, {
|
|
5652
5688
|
layer: layer
|
|
5653
|
-
}, layer.opacity,
|
|
5689
|
+
}, layer.opacity, _this10.getDrawBBOX());
|
|
5654
5690
|
currentLayerIndex += 1;
|
|
5655
5691
|
}
|
|
5656
5692
|
}
|
|
@@ -5658,11 +5694,11 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5658
5694
|
this.baseLayers && this.baseLayers.forEach(function (baseLayer) {
|
|
5659
5695
|
var _a;
|
|
5660
5696
|
if (baseLayer.enabled && baseLayer.keepOnTop === true) {
|
|
5661
|
-
var requestURL = (_a = buildWMSGetMapRequest(
|
|
5697
|
+
var requestURL = (_a = buildWMSGetMapRequest(_this10, baseLayer)) === null || _a === void 0 ? void 0 : _a.url;
|
|
5662
5698
|
if (requestURL) {
|
|
5663
|
-
|
|
5699
|
+
_this10.divBuffer.setSrc(currentLayerIndex, requestURL, {
|
|
5664
5700
|
layer: baseLayer
|
|
5665
|
-
}, baseLayer.opacity,
|
|
5701
|
+
}, baseLayer.opacity, _this10.getDrawBBOX());
|
|
5666
5702
|
currentLayerIndex += 1;
|
|
5667
5703
|
}
|
|
5668
5704
|
}
|
|
@@ -5856,20 +5892,20 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5856
5892
|
}, {
|
|
5857
5893
|
key: "_buildLayerDims",
|
|
5858
5894
|
value: function _buildLayerDims() {
|
|
5859
|
-
var
|
|
5895
|
+
var _this11 = this;
|
|
5860
5896
|
if (this.buildLayerDimsBusy === true) {
|
|
5861
5897
|
return;
|
|
5862
5898
|
}
|
|
5863
5899
|
this.mapdimensions.forEach(function (mapDim) {
|
|
5864
|
-
|
|
5900
|
+
_this11.layers.forEach(function (layer) {
|
|
5865
5901
|
layer.dimensions.forEach(function (layerDim) {
|
|
5866
5902
|
if (layerDim.linked === true && layerDim.name === mapDim.name) {
|
|
5867
5903
|
if (mapDim.currentValue === 'current' || mapDim.currentValue === 'default' || mapDim.currentValue === '' || mapDim.currentValue === 'earliest' || mapDim.currentValue === 'middle' || mapDim.currentValue === 'latest') {
|
|
5868
5904
|
mapDim.currentValue = layerDim.getClosestValue(mapDim.currentValue);
|
|
5869
5905
|
}
|
|
5870
|
-
|
|
5906
|
+
_this11.buildLayerDimsBusy = true;
|
|
5871
5907
|
layerDim.setClosestValue(mapDim.currentValue);
|
|
5872
|
-
|
|
5908
|
+
_this11.buildLayerDimsBusy = false;
|
|
5873
5909
|
}
|
|
5874
5910
|
});
|
|
5875
5911
|
});
|
|
@@ -6598,7 +6634,7 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
6598
6634
|
}, {
|
|
6599
6635
|
key: "zoomTo",
|
|
6600
6636
|
value: function zoomTo(_newbbox) {
|
|
6601
|
-
var
|
|
6637
|
+
var _this12 = this;
|
|
6602
6638
|
debugLogger(DebugType.Log);
|
|
6603
6639
|
var setOrigBox = false;
|
|
6604
6640
|
var newbbox = new WMBBOX(_newbbox);
|
|
@@ -6639,14 +6675,14 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
6639
6675
|
this._updateBoundingBox(this.bbox);
|
|
6640
6676
|
this.drawnBBOX.setBBOX(this.bbox);
|
|
6641
6677
|
var resetMapPinAndDialogs = function resetMapPinAndDialogs() {
|
|
6642
|
-
for (var j = 0; j <
|
|
6643
|
-
var newpos =
|
|
6644
|
-
x:
|
|
6645
|
-
y:
|
|
6678
|
+
for (var j = 0; j < _this12.gfiDialogList.length; j += 1) {
|
|
6679
|
+
var newpos = _this12.getPixelCoordFromGeoCoord({
|
|
6680
|
+
x: _this12.gfiDialogList[j].geoPosX,
|
|
6681
|
+
y: _this12.gfiDialogList[j].geoPosY
|
|
6646
6682
|
});
|
|
6647
|
-
if (
|
|
6648
|
-
if (
|
|
6649
|
-
|
|
6683
|
+
if (_this12.gfiDialogList[j].hasBeenDragged === false) {
|
|
6684
|
+
if (_this12.gfiDialogList[j].moveToMouseCursor === true) {
|
|
6685
|
+
_this12.gfiDialogList[j].setXY(_this12.gfiDialogList[j].origX + newpos.x, _this12.gfiDialogList[j].origY + newpos.y);
|
|
6650
6686
|
}
|
|
6651
6687
|
}
|
|
6652
6688
|
}
|
|
@@ -8243,6 +8279,9 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8243
8279
|
if (options.headers) {
|
|
8244
8280
|
this.headers = options.headers;
|
|
8245
8281
|
}
|
|
8282
|
+
if (options.geojson) {
|
|
8283
|
+
this.geojson = options.geojson;
|
|
8284
|
+
}
|
|
8246
8285
|
}
|
|
8247
8286
|
}
|
|
8248
8287
|
_createClass(WMLayer, [{
|
|
@@ -8577,10 +8616,7 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8577
8616
|
var layerDoneCallback = function layerDoneCallback(__layer) {
|
|
8578
8617
|
if (isDefined(_layerDoneCallback)) {
|
|
8579
8618
|
try {
|
|
8580
|
-
/* Enable these two console timings to do performance measurments of parseLayer */
|
|
8581
|
-
// console.time(origin);
|
|
8582
8619
|
_layerDoneCallback(__layer);
|
|
8583
|
-
// console.timeEnd(origin);
|
|
8584
8620
|
} catch (e) {
|
|
8585
8621
|
debugLogger(DebugType.Error, e.message);
|
|
8586
8622
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/webmap",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.6.0",
|
|
4
4
|
"description": "GeoWeb webmap library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git@gitlab.com:opengeoweb/opengeoweb.git"
|
|
9
9
|
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@opengeoweb/shared": "*",
|
|
12
|
+
"throttle-debounce": "^5.0.0",
|
|
13
|
+
"moment": "^2.29.4",
|
|
14
|
+
"proj4": "^2.9.2",
|
|
15
|
+
"lodash": "^4.17.21",
|
|
16
|
+
"date-fns": "^3.3.0"
|
|
17
|
+
},
|
|
18
|
+
"peerDependencies": {},
|
|
10
19
|
"module": "./index.esm.js",
|
|
11
20
|
"type": "module",
|
|
12
21
|
"main": "./index.esm.js"
|
|
@@ -128,6 +128,7 @@ export default class WMJSMap {
|
|
|
128
128
|
rebuildMapDimensions(): void;
|
|
129
129
|
getLayerByServiceAndName(layerService: string, layerName: string): WMLayer;
|
|
130
130
|
getLayers(): WMLayer[];
|
|
131
|
+
hasLayer(layer: WMLayer): boolean;
|
|
131
132
|
setLayer(layer: WMLayer): Promise<unknown>;
|
|
132
133
|
setActive(active: boolean): void;
|
|
133
134
|
setActiveLayer(layer: WMLayer): void;
|
|
@@ -140,6 +141,10 @@ export default class WMJSMap {
|
|
|
140
141
|
removeAllLayers(): void;
|
|
141
142
|
deleteLayer(layerToDelete: WMLayer): void;
|
|
142
143
|
moveLayerDown(layerToMove: WMLayer): void;
|
|
144
|
+
/**
|
|
145
|
+
* Reorder layers according to an index array with indices on how the layers should be reordered.
|
|
146
|
+
*/
|
|
147
|
+
reorderLayers(order: number[]): boolean;
|
|
143
148
|
swapLayers(_layerA: WMLayer, _layerB: WMLayer): void;
|
|
144
149
|
moveLayerUp(layerToMove: WMLayer): void;
|
|
145
150
|
configureMapDimensions(layer: WMLayer): void;
|
|
@@ -43,6 +43,7 @@ export interface LayerOptions extends LayerFoundation {
|
|
|
43
43
|
ReactWMJSLayerId?: string;
|
|
44
44
|
onLayerError?: (layer: WMLayer, error: Error, webmapInstance: WMJSMap) => void;
|
|
45
45
|
onLayerReady?: (layer: WMLayer, webmap?: WMJSMap) => void;
|
|
46
|
+
geojson?: GeoJSON.FeatureCollection;
|
|
46
47
|
}
|
|
47
48
|
/**
|
|
48
49
|
* Helper function to figure out the dimensions from the WMS layer object (From WMS GetCapabilities). Parses both WMS 1.1.1 and WMS 1.3.0.
|
|
@@ -114,6 +115,7 @@ export default class WMLayer {
|
|
|
114
115
|
};
|
|
115
116
|
isConfigured: boolean;
|
|
116
117
|
geographicBoundingBox?: GeographicBoundingBox;
|
|
118
|
+
geojson?: GeoJSON.FeatureCollection;
|
|
117
119
|
init(): void;
|
|
118
120
|
constructor(options?: LayerOptions);
|
|
119
121
|
getLayerName(): string;
|