@opengeoweb/webmap 4.16.0 → 4.18.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 +933 -287
- package/index.umd.js +928 -284
- package/lib/components/WMCanvasBuffer.d.ts +1 -1
- package/lib/components/WMFlyToBBox.d.ts +2 -1
- package/lib/components/WMJSDimension.d.ts +2 -1
- package/lib/components/WMJSMap.d.ts +17 -17
- package/lib/components/WMJSService.d.ts +5 -4
- package/lib/components/WMLayer.d.ts +3 -3
- package/lib/components/WMListener.d.ts +11 -2
- package/lib/components/WMTime.d.ts +1 -1
- package/lib/components/types.d.ts +28 -6
- package/package.json +1 -1
package/index.umd.js
CHANGED
|
@@ -158,7 +158,9 @@
|
|
|
158
158
|
*/
|
|
159
159
|
|
|
160
160
|
var isDefined = function isDefined(variable) {
|
|
161
|
-
if (variable === null)
|
|
161
|
+
if (variable === null) {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
162
164
|
|
|
163
165
|
if (typeof variable === 'undefined') {
|
|
164
166
|
return false;
|
|
@@ -173,7 +175,9 @@
|
|
|
173
175
|
*/
|
|
174
176
|
|
|
175
177
|
var toArray = function toArray(array) {
|
|
176
|
-
if (array === null || typeof array === 'undefined')
|
|
178
|
+
if (array === null || typeof array === 'undefined') {
|
|
179
|
+
return [];
|
|
180
|
+
}
|
|
177
181
|
|
|
178
182
|
if (array instanceof Array) {
|
|
179
183
|
return array;
|
|
@@ -191,7 +195,10 @@
|
|
|
191
195
|
*/
|
|
192
196
|
|
|
193
197
|
var WMJScheckURL = function WMJScheckURL(url) {
|
|
194
|
-
if (!isDefined(url))
|
|
198
|
+
if (!isDefined(url)) {
|
|
199
|
+
return '?';
|
|
200
|
+
}
|
|
201
|
+
|
|
195
202
|
var trimmedUrl = url.trim();
|
|
196
203
|
|
|
197
204
|
if (trimmedUrl.indexOf('?') === -1) {
|
|
@@ -218,14 +225,26 @@
|
|
|
218
225
|
return event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
|
|
219
226
|
};
|
|
220
227
|
var URLDecode = function URLDecode(encodedURL) {
|
|
221
|
-
if (!isDefined(encodedURL))
|
|
228
|
+
if (!isDefined(encodedURL)) {
|
|
229
|
+
return '';
|
|
230
|
+
}
|
|
231
|
+
|
|
222
232
|
return encodedURL.replace('+', ' ').replace('%2B', '+').replace('%20', ' ').replace('%5E', '^').replace('%26', '&').replace('%3F', '?').replace('%3E', '>').replace('%3C', '<').replace('%5C', '\\').replace('%2F', '/').replace('%25', '%').replace('%3A', ':').replace('%27', "'").replace('%24', '$');
|
|
223
233
|
}; // Encodes plain text to URL encoding
|
|
224
234
|
|
|
225
235
|
var URLEncode = function URLEncode(plaintext) {
|
|
226
|
-
if (!plaintext)
|
|
227
|
-
|
|
228
|
-
|
|
236
|
+
if (!plaintext) {
|
|
237
|
+
return plaintext;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
if (plaintext === undefined) {
|
|
241
|
+
return plaintext;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (plaintext === '') {
|
|
245
|
+
return plaintext;
|
|
246
|
+
}
|
|
247
|
+
|
|
229
248
|
var SAFECHARS = '0123456789' + // Numeric
|
|
230
249
|
'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + // Alphabetic
|
|
231
250
|
'abcdefghijklmnopqrstuvwxyz' + "%-_.!~*'()"; // RFC2396 Mark characters
|
|
@@ -264,8 +283,15 @@
|
|
|
264
283
|
var getCorrectWMSDimName = function getCorrectWMSDimName(origDimName) {
|
|
265
284
|
/* Adds DIM_ for dimensions other than height or time */
|
|
266
285
|
var upperCaseDimName = origDimName.toUpperCase();
|
|
267
|
-
|
|
268
|
-
if (upperCaseDimName === '
|
|
286
|
+
|
|
287
|
+
if (upperCaseDimName === 'TIME') {
|
|
288
|
+
return upperCaseDimName;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
if (upperCaseDimName === 'ELEVATION') {
|
|
292
|
+
return upperCaseDimName;
|
|
293
|
+
}
|
|
294
|
+
|
|
269
295
|
return "DIM_" + upperCaseDimName;
|
|
270
296
|
};
|
|
271
297
|
/* Returns all dimensions with its current values as URL */
|
|
@@ -380,7 +406,10 @@
|
|
|
380
406
|
|
|
381
407
|
var addStylesForLayer = function addStylesForLayer(layerObjectFromWMS) {
|
|
382
408
|
/* Get the Style object */
|
|
383
|
-
if (!layerObjectFromWMS.Style)
|
|
409
|
+
if (!layerObjectFromWMS.Style) {
|
|
410
|
+
return [];
|
|
411
|
+
}
|
|
412
|
+
|
|
384
413
|
var layerStyles = toArray(layerObjectFromWMS.Style);
|
|
385
414
|
/* Loop through the list of styles from the document, create a default object and try to fill in the object with the props from the WMS GetCapabilities document */
|
|
386
415
|
|
|
@@ -420,7 +449,10 @@
|
|
|
420
449
|
});
|
|
421
450
|
};
|
|
422
451
|
var addDimensionsForLayer = function addDimensionsForLayer(layerObjectFromWMS) {
|
|
423
|
-
if (!layerObjectFromWMS.Dimension)
|
|
452
|
+
if (!layerObjectFromWMS.Dimension) {
|
|
453
|
+
return [];
|
|
454
|
+
}
|
|
455
|
+
|
|
424
456
|
var layerDimensions = toArray(layerObjectFromWMS.Dimension);
|
|
425
457
|
var layerDimensionsExtents = toArray(layerObjectFromWMS.Extent);
|
|
426
458
|
var dimensionList = layerDimensions.map(function (layerDimension) {
|
|
@@ -481,10 +513,19 @@
|
|
|
481
513
|
var spreadArray = __spreadArray([], __read(array));
|
|
482
514
|
|
|
483
515
|
return spreadArray.sort(function (a, b) {
|
|
484
|
-
|
|
516
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
517
|
+
var x = a[key]; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
518
|
+
|
|
485
519
|
var y = b[key];
|
|
486
|
-
|
|
487
|
-
if (x
|
|
520
|
+
|
|
521
|
+
if (x < y) {
|
|
522
|
+
return -1;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
if (x > y) {
|
|
526
|
+
return 1;
|
|
527
|
+
}
|
|
528
|
+
|
|
488
529
|
return 0;
|
|
489
530
|
});
|
|
490
531
|
}
|
|
@@ -728,7 +769,10 @@
|
|
|
728
769
|
|
|
729
770
|
|
|
730
771
|
WMImage.prototype.isLoaded = function () {
|
|
731
|
-
if (this._isLoading)
|
|
772
|
+
if (this._isLoading) {
|
|
773
|
+
return false;
|
|
774
|
+
}
|
|
775
|
+
|
|
732
776
|
return this._isLoaded;
|
|
733
777
|
};
|
|
734
778
|
/**
|
|
@@ -822,7 +866,8 @@
|
|
|
822
866
|
this._srcLoaded = undefined;
|
|
823
867
|
|
|
824
868
|
this._load();
|
|
825
|
-
};
|
|
869
|
+
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
870
|
+
|
|
826
871
|
|
|
827
872
|
WMImage.prototype._getImageWithHeaders = function (url, headers) {
|
|
828
873
|
var _this = this;
|
|
@@ -860,7 +905,10 @@
|
|
|
860
905
|
});
|
|
861
906
|
})["catch"](function () {
|
|
862
907
|
debug(exports.DebugType.Error, "Unable to fetch image " + url + " with headers [" + JSON.stringify(headers) + "]");
|
|
863
|
-
|
|
908
|
+
|
|
909
|
+
if (url.startsWith('http://')) {
|
|
910
|
+
debug(exports.DebugType.Error, 'Note that URL starts with http:// instead of https://');
|
|
911
|
+
}
|
|
864
912
|
|
|
865
913
|
_this._loadEvent(true);
|
|
866
914
|
});
|
|
@@ -1241,7 +1289,11 @@
|
|
|
1241
1289
|
/* A string like "-180,-90,180,90" is given */
|
|
1242
1290
|
try {
|
|
1243
1291
|
var a = left.split(',');
|
|
1244
|
-
|
|
1292
|
+
|
|
1293
|
+
if (a.length !== 4) {
|
|
1294
|
+
return;
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1245
1297
|
this.left = parseFloat(a[0]);
|
|
1246
1298
|
this.bottom = parseFloat(a[1]);
|
|
1247
1299
|
this.right = parseFloat(a[2]);
|
|
@@ -1254,10 +1306,21 @@
|
|
|
1254
1306
|
/* Apply defaults to invalid values */
|
|
1255
1307
|
|
|
1256
1308
|
|
|
1257
|
-
if (this.left == null)
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1309
|
+
if (this.left == null) {
|
|
1310
|
+
this.left = -180;
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
if (this.right == null) {
|
|
1314
|
+
this.right = 180;
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
if (this.bottom == null) {
|
|
1318
|
+
this.bottom = -90;
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
if (this.top == null) {
|
|
1322
|
+
this.top = 90;
|
|
1323
|
+
}
|
|
1261
1324
|
};
|
|
1262
1325
|
/*
|
|
1263
1326
|
* Compares two boundingboxes and returns true if they are equal
|
|
@@ -1414,10 +1477,12 @@
|
|
|
1414
1477
|
};
|
|
1415
1478
|
|
|
1416
1479
|
WMListener.prototype.suspendEvent = function (name) {
|
|
1480
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1417
1481
|
this._suspendedEvents[name] = true;
|
|
1418
1482
|
};
|
|
1419
1483
|
|
|
1420
1484
|
WMListener.prototype.resumeEvent = function (name) {
|
|
1485
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1421
1486
|
this._suspendedEvents[name] = false;
|
|
1422
1487
|
};
|
|
1423
1488
|
|
|
@@ -1431,7 +1496,8 @@
|
|
|
1431
1496
|
|
|
1432
1497
|
|
|
1433
1498
|
WMListener.prototype.triggerEvent = function (name, param) {
|
|
1434
|
-
if (this._allEventsSuspended === true ||
|
|
1499
|
+
if (this._allEventsSuspended === true || // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1500
|
+
this._suspendedEvents[name] === true) {
|
|
1435
1501
|
return [];
|
|
1436
1502
|
}
|
|
1437
1503
|
|
|
@@ -1625,7 +1691,10 @@
|
|
|
1625
1691
|
var cachedImage = imageStore.getImageForSrc(altImage.imageSource);
|
|
1626
1692
|
return cachedImage && cachedImage.isLoaded() && !cachedImage.isLoading() && !cachedImage.hasError();
|
|
1627
1693
|
});
|
|
1628
|
-
|
|
1694
|
+
|
|
1695
|
+
if (index !== -1) {
|
|
1696
|
+
return sortedImagesForUrl[index];
|
|
1697
|
+
}
|
|
1629
1698
|
}
|
|
1630
1699
|
|
|
1631
1700
|
return null;
|
|
@@ -1837,7 +1906,10 @@
|
|
|
1837
1906
|
};
|
|
1838
1907
|
|
|
1839
1908
|
WMCanvasBuffer.prototype.finishedLoading = function () {
|
|
1840
|
-
if (this.ready)
|
|
1909
|
+
if (this.ready) {
|
|
1910
|
+
return;
|
|
1911
|
+
}
|
|
1912
|
+
|
|
1841
1913
|
this.ready = true;
|
|
1842
1914
|
|
|
1843
1915
|
for (var j = 0; j < this.layers.length; j += 1) {
|
|
@@ -1860,7 +1932,11 @@
|
|
|
1860
1932
|
WMCanvasBuffer.prototype.resize = function (w, h) {
|
|
1861
1933
|
var width = parseInt(w, 10);
|
|
1862
1934
|
var height = parseInt(h, 10);
|
|
1863
|
-
|
|
1935
|
+
|
|
1936
|
+
if (this._width === width && this._height === height) {
|
|
1937
|
+
return;
|
|
1938
|
+
}
|
|
1939
|
+
|
|
1864
1940
|
this._width = width;
|
|
1865
1941
|
this._height = height;
|
|
1866
1942
|
this.canvas.width = width;
|
|
@@ -2000,7 +2076,10 @@
|
|
|
2000
2076
|
_map.isAnimating = false;
|
|
2001
2077
|
|
|
2002
2078
|
_map.setAnimationDelay = function (delay) {
|
|
2003
|
-
if (delay < 1)
|
|
2079
|
+
if (delay < 1) {
|
|
2080
|
+
delay = 1;
|
|
2081
|
+
}
|
|
2082
|
+
|
|
2004
2083
|
_map.animationDelay = delay;
|
|
2005
2084
|
};
|
|
2006
2085
|
|
|
@@ -2059,8 +2138,14 @@
|
|
|
2059
2138
|
};
|
|
2060
2139
|
|
|
2061
2140
|
WMJSAnimate.prototype._animate = function () {
|
|
2062
|
-
if (this._map.isAnimating === false)
|
|
2063
|
-
|
|
2141
|
+
if (this._map.isAnimating === false) {
|
|
2142
|
+
return;
|
|
2143
|
+
}
|
|
2144
|
+
|
|
2145
|
+
if (this._map.animateBusy === true) {
|
|
2146
|
+
return;
|
|
2147
|
+
}
|
|
2148
|
+
|
|
2064
2149
|
var animationStep = this._map.animationList[this._map.currentAnimationStep];
|
|
2065
2150
|
|
|
2066
2151
|
if (!animationStep) {
|
|
@@ -2179,7 +2264,9 @@
|
|
|
2179
2264
|
index -= this._map.animationList.length;
|
|
2180
2265
|
}
|
|
2181
2266
|
|
|
2182
|
-
if (index < 0)
|
|
2267
|
+
if (index < 0) {
|
|
2268
|
+
index = 0;
|
|
2269
|
+
}
|
|
2183
2270
|
|
|
2184
2271
|
if (index >= 0) {
|
|
2185
2272
|
var animationStep = this._map.animationList[index];
|
|
@@ -2211,7 +2298,10 @@
|
|
|
2211
2298
|
};
|
|
2212
2299
|
|
|
2213
2300
|
WMJSAnimate.prototype.stopAnimating = function () {
|
|
2214
|
-
if (this._map.isAnimating === false)
|
|
2301
|
+
if (this._map.isAnimating === false) {
|
|
2302
|
+
return;
|
|
2303
|
+
}
|
|
2304
|
+
|
|
2215
2305
|
this._map._animationList = undefined;
|
|
2216
2306
|
this._divAnimationInfo.style.display = 'none';
|
|
2217
2307
|
this._map.isAnimating = false;
|
|
@@ -2259,9 +2349,18 @@
|
|
|
2259
2349
|
/* Temporal mappings from bgmaps.cgi service names to names defined here */
|
|
2260
2350
|
|
|
2261
2351
|
|
|
2262
|
-
if (layerName === 'streetmap')
|
|
2263
|
-
|
|
2264
|
-
|
|
2352
|
+
if (layerName === 'streetmap') {
|
|
2353
|
+
layerName = 'OSM';
|
|
2354
|
+
}
|
|
2355
|
+
|
|
2356
|
+
if (layerName === 'pdok') {
|
|
2357
|
+
layerName = 'OSM';
|
|
2358
|
+
}
|
|
2359
|
+
|
|
2360
|
+
if (layerName === 'naturalearth2') {
|
|
2361
|
+
layerName = 'NaturalEarth2';
|
|
2362
|
+
}
|
|
2363
|
+
|
|
2265
2364
|
var tileLayer = tileOptions[layerName];
|
|
2266
2365
|
|
|
2267
2366
|
if (!tileLayer) {
|
|
@@ -2295,10 +2394,23 @@
|
|
|
2295
2394
|
var initialResolution = 2 * pi * 6378137 / tileSize;
|
|
2296
2395
|
var originShiftX = -2 * pi * 6378137 / 2.0;
|
|
2297
2396
|
var originShiftY = 2 * pi * 6378137 / 2.0;
|
|
2298
|
-
|
|
2299
|
-
if (tileSettings.
|
|
2300
|
-
|
|
2301
|
-
|
|
2397
|
+
|
|
2398
|
+
if (tileSettings.tileSize) {
|
|
2399
|
+
tileSize = tileSettings.tileSize;
|
|
2400
|
+
}
|
|
2401
|
+
|
|
2402
|
+
if (tileSettings.resolution) {
|
|
2403
|
+
initialResolution = tileSettings.resolution;
|
|
2404
|
+
}
|
|
2405
|
+
|
|
2406
|
+
if (tileSettings.origX) {
|
|
2407
|
+
originShiftX = tileSettings.origX;
|
|
2408
|
+
}
|
|
2409
|
+
|
|
2410
|
+
if (tileSettings.origY) {
|
|
2411
|
+
originShiftY = tileSettings.origY;
|
|
2412
|
+
}
|
|
2413
|
+
|
|
2302
2414
|
var screenWidth = width;
|
|
2303
2415
|
var bboxw = currentBBOX.right - currentBBOX.left;
|
|
2304
2416
|
var originShiftX2 = initialResolution * tileSize + originShiftX;
|
|
@@ -2309,7 +2421,10 @@
|
|
|
2309
2421
|
var level = Math.trunc(levelF + 0.5);
|
|
2310
2422
|
|
|
2311
2423
|
var getAttribution = function getAttribution(textileLayer) {
|
|
2312
|
-
if (!textileLayer || !srs || !tileLayer[srs] || !tileLayer[srs].copyRight)
|
|
2424
|
+
if (!textileLayer || !srs || !tileLayer[srs] || !tileLayer[srs].copyRight) {
|
|
2425
|
+
return null;
|
|
2426
|
+
}
|
|
2427
|
+
|
|
2313
2428
|
return tileLayer[srs].copyRight;
|
|
2314
2429
|
};
|
|
2315
2430
|
|
|
@@ -2320,8 +2435,14 @@
|
|
|
2320
2435
|
var tileServerFormat = tileSettings.tileServerFormat || 'png';
|
|
2321
2436
|
var tmsEnabled = tileSettings.tms || false; // 'osm' or 'argisonline'
|
|
2322
2437
|
|
|
2323
|
-
if (level < tileSettings.minLevel)
|
|
2324
|
-
|
|
2438
|
+
if (level < tileSettings.minLevel) {
|
|
2439
|
+
level = tileSettings.minLevel;
|
|
2440
|
+
}
|
|
2441
|
+
|
|
2442
|
+
if (level > tileSettings.maxLevel) {
|
|
2443
|
+
level = tileSettings.maxLevel;
|
|
2444
|
+
}
|
|
2445
|
+
|
|
2325
2446
|
var numTilesAtLevel = Math.pow(2, level);
|
|
2326
2447
|
var numTilesAtLevelX = tileSetWidth / (initialResolution / numTilesAtLevel * tileSize);
|
|
2327
2448
|
var numTilesAtLevelY = tileSetHeight / (initialResolution / numTilesAtLevel * tileSize);
|
|
@@ -2373,7 +2494,7 @@
|
|
|
2373
2494
|
x: bounds.right,
|
|
2374
2495
|
y: bounds.top
|
|
2375
2496
|
}, newBBOX, width, height);
|
|
2376
|
-
var imageURL;
|
|
2497
|
+
var imageURL = '';
|
|
2377
2498
|
|
|
2378
2499
|
if (tileServerType === 'osm') {
|
|
2379
2500
|
if (tmsEnabled) {
|
|
@@ -2436,14 +2557,37 @@
|
|
|
2436
2557
|
numTilesAtLevelX *= 2;
|
|
2437
2558
|
}
|
|
2438
2559
|
|
|
2439
|
-
if (tilenbottom < 1)
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
if (
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2560
|
+
if (tilenbottom < 1) {
|
|
2561
|
+
tilenbottom = 1;
|
|
2562
|
+
}
|
|
2563
|
+
|
|
2564
|
+
if (tilenbottom > numTilesAtLevelY) {
|
|
2565
|
+
tilenbottom = numTilesAtLevelY;
|
|
2566
|
+
}
|
|
2567
|
+
|
|
2568
|
+
if (tilenleft < 1) {
|
|
2569
|
+
tilenleft = 1;
|
|
2570
|
+
}
|
|
2571
|
+
|
|
2572
|
+
if (tilenleft > numTilesAtLevelX) {
|
|
2573
|
+
tilenleft = numTilesAtLevelX;
|
|
2574
|
+
}
|
|
2575
|
+
|
|
2576
|
+
if (tilentop < 1) {
|
|
2577
|
+
tilentop = 1;
|
|
2578
|
+
}
|
|
2579
|
+
|
|
2580
|
+
if (tilentop > numTilesAtLevelY) {
|
|
2581
|
+
tilentop = numTilesAtLevelY;
|
|
2582
|
+
}
|
|
2583
|
+
|
|
2584
|
+
if (tilenright < 1) {
|
|
2585
|
+
tilenright = 1;
|
|
2586
|
+
}
|
|
2587
|
+
|
|
2588
|
+
if (tilenright > numTilesAtLevelX) {
|
|
2589
|
+
tilenright = numTilesAtLevelX;
|
|
2590
|
+
}
|
|
2447
2591
|
|
|
2448
2592
|
if (tilentop - tilenbottom > 20) {
|
|
2449
2593
|
debug(exports.DebugType.Error, "Too many tiles in vertical " + (tilentop - tilenbottom));
|
|
@@ -2464,8 +2608,14 @@
|
|
|
2464
2608
|
|
|
2465
2609
|
drawBGTiles(level);
|
|
2466
2610
|
imagesToRender.sort(function (imageA, imageB) {
|
|
2467
|
-
if (imageA.level < imageB.level)
|
|
2468
|
-
|
|
2611
|
+
if (imageA.level < imageB.level) {
|
|
2612
|
+
return -1;
|
|
2613
|
+
}
|
|
2614
|
+
|
|
2615
|
+
if (imageA.level > imageB.level) {
|
|
2616
|
+
return 1;
|
|
2617
|
+
}
|
|
2618
|
+
|
|
2469
2619
|
return 0;
|
|
2470
2620
|
});
|
|
2471
2621
|
|
|
@@ -2519,7 +2669,11 @@
|
|
|
2519
2669
|
|
|
2520
2670
|
if (layer) {
|
|
2521
2671
|
var legendURL = layer.legendGraphic;
|
|
2522
|
-
|
|
2672
|
+
|
|
2673
|
+
if (!legendURL) {
|
|
2674
|
+
return undefined;
|
|
2675
|
+
} // For THREDDS WMS we need to add layers=
|
|
2676
|
+
|
|
2523
2677
|
|
|
2524
2678
|
if (!legendURL.includes('&layers=')) {
|
|
2525
2679
|
legendURL += "&layers=" + URLEncode(layer.name) + "&";
|
|
@@ -2632,7 +2786,11 @@
|
|
|
2632
2786
|
this.minute = parseInt(minute, 10);
|
|
2633
2787
|
this.second = parseInt(second, 10);
|
|
2634
2788
|
this.isRegularInterval = false;
|
|
2635
|
-
|
|
2789
|
+
|
|
2790
|
+
if (this.month === 0 && this.year === 0) {
|
|
2791
|
+
this.isRegularInterval = true;
|
|
2792
|
+
}
|
|
2793
|
+
|
|
2636
2794
|
this.getTime = this.getTime.bind(this);
|
|
2637
2795
|
this.toISO8601 = this.toISO8601.bind(this);
|
|
2638
2796
|
}
|
|
@@ -2642,8 +2800,14 @@
|
|
|
2642
2800
|
/* Months and years are unequally distributed in time
|
|
2643
2801
|
So get time is not possible */
|
|
2644
2802
|
|
|
2645
|
-
if (this.month !== 0)
|
|
2646
|
-
|
|
2803
|
+
if (this.month !== 0) {
|
|
2804
|
+
throw new Error('month !== 0');
|
|
2805
|
+
}
|
|
2806
|
+
|
|
2807
|
+
if (this.year !== 0) {
|
|
2808
|
+
throw new Error('year !== 0');
|
|
2809
|
+
}
|
|
2810
|
+
|
|
2647
2811
|
timeres += this.day * 60 * 60 * 24;
|
|
2648
2812
|
timeres += this.hour * 60 * 60;
|
|
2649
2813
|
timeres += this.minute * 60;
|
|
@@ -2654,17 +2818,35 @@
|
|
|
2654
2818
|
|
|
2655
2819
|
DateInterval.prototype.toISO8601 = function () {
|
|
2656
2820
|
var isoTime = 'P';
|
|
2657
|
-
|
|
2658
|
-
if (this.
|
|
2659
|
-
|
|
2821
|
+
|
|
2822
|
+
if (this.year !== 0) {
|
|
2823
|
+
isoTime += this.year + "Y";
|
|
2824
|
+
}
|
|
2825
|
+
|
|
2826
|
+
if (this.month !== 0) {
|
|
2827
|
+
isoTime += this.month + "M";
|
|
2828
|
+
}
|
|
2829
|
+
|
|
2830
|
+
if (this.day !== 0) {
|
|
2831
|
+
isoTime += this.day + "D";
|
|
2832
|
+
}
|
|
2660
2833
|
|
|
2661
2834
|
if (this.hour !== 0 && this.minute !== 0 && this.second !== 0) {
|
|
2662
2835
|
isoTime += 'T';
|
|
2663
2836
|
}
|
|
2664
2837
|
|
|
2665
|
-
if (this.hour !== 0)
|
|
2666
|
-
|
|
2667
|
-
|
|
2838
|
+
if (this.hour !== 0) {
|
|
2839
|
+
isoTime += this.hour + "H";
|
|
2840
|
+
}
|
|
2841
|
+
|
|
2842
|
+
if (this.minute !== 0) {
|
|
2843
|
+
isoTime += this.minute + "M";
|
|
2844
|
+
}
|
|
2845
|
+
|
|
2846
|
+
if (this.second !== 0) {
|
|
2847
|
+
isoTime += this.second + "S";
|
|
2848
|
+
}
|
|
2849
|
+
|
|
2668
2850
|
return isoTime;
|
|
2669
2851
|
};
|
|
2670
2852
|
|
|
@@ -2714,16 +2896,29 @@
|
|
|
2714
2896
|
*/
|
|
2715
2897
|
var makeISO8601StringFromFlexibleWMSDateString = function makeISO8601StringFromFlexibleWMSDateString(isoString) {
|
|
2716
2898
|
// Datestring starting with a - token are not supported.
|
|
2717
|
-
if (!isoString || isoString.startsWith('-'))
|
|
2718
|
-
|
|
2899
|
+
if (!isoString || isoString.startsWith('-')) {
|
|
2900
|
+
return isoString;
|
|
2901
|
+
}
|
|
2719
2902
|
|
|
2720
|
-
|
|
2903
|
+
var trimmed = isoString.trim();
|
|
2721
2904
|
|
|
2722
|
-
if (
|
|
2905
|
+
if (trimmed.length === 4) {
|
|
2906
|
+
return trimmed + "-01-01T00:00:00Z"; // YYYY
|
|
2907
|
+
}
|
|
2723
2908
|
|
|
2724
|
-
if (
|
|
2909
|
+
if (trimmed.length === 7) {
|
|
2910
|
+
return trimmed + "-01T00:00:00Z"; // YYYY-MM
|
|
2911
|
+
}
|
|
2725
2912
|
|
|
2726
|
-
|
|
2913
|
+
if (trimmed.length === 10) {
|
|
2914
|
+
return trimmed + "T00:00:00Z"; // YYYY-MM-DD
|
|
2915
|
+
}
|
|
2916
|
+
|
|
2917
|
+
if (trimmed.length === 14) {
|
|
2918
|
+
return trimmed.slice(0, -1) + ":00:00Z"; // YYYY-MM-DDTHHZ
|
|
2919
|
+
}
|
|
2920
|
+
|
|
2921
|
+
return trimmed;
|
|
2727
2922
|
};
|
|
2728
2923
|
|
|
2729
2924
|
var isotime = makeISO8601StringFromFlexibleWMSDateString(unvalidatedIsotime);
|
|
@@ -2744,60 +2939,136 @@
|
|
|
2744
2939
|
var date = new Date(Date.UTC(year, month - 1, day, hours, minutes, seconds));
|
|
2745
2940
|
|
|
2746
2941
|
date.add = function (dateInterval) {
|
|
2747
|
-
if (!dateInterval)
|
|
2942
|
+
if (!dateInterval) {
|
|
2943
|
+
return;
|
|
2944
|
+
}
|
|
2748
2945
|
|
|
2749
2946
|
if (dateInterval.isRegularInterval === false) {
|
|
2750
|
-
if (dateInterval.year !== 0)
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
if (dateInterval.
|
|
2755
|
-
|
|
2947
|
+
if (dateInterval.year !== 0) {
|
|
2948
|
+
date.setUTCFullYear(date.getUTCFullYear() + dateInterval.year);
|
|
2949
|
+
}
|
|
2950
|
+
|
|
2951
|
+
if (dateInterval.month !== 0) {
|
|
2952
|
+
date.setUTCMonth(date.getUTCMonth() + dateInterval.month);
|
|
2953
|
+
}
|
|
2954
|
+
|
|
2955
|
+
if (dateInterval.day !== 0) {
|
|
2956
|
+
date.setUTCDate(date.getUTCDate() + dateInterval.day);
|
|
2957
|
+
}
|
|
2958
|
+
|
|
2959
|
+
if (dateInterval.hour !== 0) {
|
|
2960
|
+
date.setUTCHours(date.getUTCHours() + dateInterval.hour);
|
|
2961
|
+
}
|
|
2962
|
+
|
|
2963
|
+
if (dateInterval.minute !== 0) {
|
|
2964
|
+
date.setUTCMinutes(date.getUTCMinutes() + dateInterval.minute);
|
|
2965
|
+
}
|
|
2966
|
+
|
|
2967
|
+
if (dateInterval.second !== 0) {
|
|
2968
|
+
date.setUTCSeconds(date.getUTCSeconds() + dateInterval.second);
|
|
2969
|
+
}
|
|
2756
2970
|
} else {
|
|
2757
2971
|
date.setTime(date.getTime() + dateInterval.getTime());
|
|
2758
2972
|
}
|
|
2759
2973
|
};
|
|
2760
2974
|
|
|
2761
2975
|
date.substract = function (dateInterval) {
|
|
2762
|
-
if (!dateInterval)
|
|
2976
|
+
if (!dateInterval) {
|
|
2977
|
+
return;
|
|
2978
|
+
}
|
|
2763
2979
|
|
|
2764
2980
|
if (dateInterval.isRegularInterval === false) {
|
|
2765
|
-
if (dateInterval.year !== 0)
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
if (dateInterval.
|
|
2770
|
-
|
|
2981
|
+
if (dateInterval.year !== 0) {
|
|
2982
|
+
date.setUTCFullYear(date.getUTCFullYear() - dateInterval.year);
|
|
2983
|
+
}
|
|
2984
|
+
|
|
2985
|
+
if (dateInterval.month !== 0) {
|
|
2986
|
+
date.setUTCMonth(date.getUTCMonth() - dateInterval.month);
|
|
2987
|
+
}
|
|
2988
|
+
|
|
2989
|
+
if (dateInterval.day !== 0) {
|
|
2990
|
+
date.setUTCDate(date.getUTCDate() - dateInterval.day);
|
|
2991
|
+
}
|
|
2992
|
+
|
|
2993
|
+
if (dateInterval.hour !== 0) {
|
|
2994
|
+
date.setUTCHours(date.getUTCHours() - dateInterval.hour);
|
|
2995
|
+
}
|
|
2996
|
+
|
|
2997
|
+
if (dateInterval.minute !== 0) {
|
|
2998
|
+
date.setUTCMinutes(date.getUTCMinutes() - dateInterval.minute);
|
|
2999
|
+
}
|
|
3000
|
+
|
|
3001
|
+
if (dateInterval.second !== 0) {
|
|
3002
|
+
date.setUTCSeconds(date.getUTCSeconds() - dateInterval.second);
|
|
3003
|
+
}
|
|
2771
3004
|
} else {
|
|
2772
3005
|
date.setTime(date.getTime() - dateInterval.getTime());
|
|
2773
3006
|
}
|
|
2774
3007
|
};
|
|
2775
3008
|
|
|
2776
3009
|
date.addMultipleTimes = function (dateInterval, numberOfSteps) {
|
|
2777
|
-
if (!dateInterval)
|
|
3010
|
+
if (!dateInterval) {
|
|
3011
|
+
return;
|
|
3012
|
+
}
|
|
2778
3013
|
|
|
2779
3014
|
if (dateInterval.isRegularInterval === false) {
|
|
2780
|
-
if (dateInterval.year !== 0)
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
if (dateInterval.
|
|
2785
|
-
|
|
3015
|
+
if (dateInterval.year !== 0) {
|
|
3016
|
+
date.setUTCFullYear(date.getUTCFullYear() + dateInterval.year * numberOfSteps);
|
|
3017
|
+
}
|
|
3018
|
+
|
|
3019
|
+
if (dateInterval.month !== 0) {
|
|
3020
|
+
date.setUTCMonth(date.getUTCMonth() + dateInterval.month * numberOfSteps);
|
|
3021
|
+
}
|
|
3022
|
+
|
|
3023
|
+
if (dateInterval.day !== 0) {
|
|
3024
|
+
date.setUTCDate(date.getUTCDate() + dateInterval.day * numberOfSteps);
|
|
3025
|
+
}
|
|
3026
|
+
|
|
3027
|
+
if (dateInterval.hour !== 0) {
|
|
3028
|
+
date.setUTCHours(date.getUTCHours() + dateInterval.hour * numberOfSteps);
|
|
3029
|
+
}
|
|
3030
|
+
|
|
3031
|
+
if (dateInterval.minute !== 0) {
|
|
3032
|
+
date.setUTCMinutes(date.getUTCMinutes() + dateInterval.minute * numberOfSteps);
|
|
3033
|
+
}
|
|
3034
|
+
|
|
3035
|
+
if (dateInterval.second !== 0) {
|
|
3036
|
+
date.setUTCSeconds(date.getUTCSeconds() + dateInterval.second * numberOfSteps);
|
|
3037
|
+
}
|
|
2786
3038
|
} else {
|
|
2787
3039
|
date.setTime(date.getTime() + dateInterval.getTime() * numberOfSteps);
|
|
2788
3040
|
}
|
|
2789
3041
|
};
|
|
2790
3042
|
|
|
2791
3043
|
date.substractMultipleTimes = function (dateInterval, numberOfSteps) {
|
|
2792
|
-
if (!dateInterval)
|
|
3044
|
+
if (!dateInterval) {
|
|
3045
|
+
return;
|
|
3046
|
+
}
|
|
2793
3047
|
|
|
2794
3048
|
if (dateInterval.isRegularInterval === false) {
|
|
2795
|
-
if (dateInterval.year !== 0)
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
if (dateInterval.
|
|
2800
|
-
|
|
3049
|
+
if (dateInterval.year !== 0) {
|
|
3050
|
+
date.setUTCFullYear(date.getUTCFullYear() - dateInterval.year * numberOfSteps);
|
|
3051
|
+
}
|
|
3052
|
+
|
|
3053
|
+
if (dateInterval.month !== 0) {
|
|
3054
|
+
date.setUTCMonth(date.getUTCMonth() - dateInterval.month * numberOfSteps);
|
|
3055
|
+
}
|
|
3056
|
+
|
|
3057
|
+
if (dateInterval.day !== 0) {
|
|
3058
|
+
date.setUTCDate(date.getUTCDate() - dateInterval.day * numberOfSteps);
|
|
3059
|
+
}
|
|
3060
|
+
|
|
3061
|
+
if (dateInterval.hour !== 0) {
|
|
3062
|
+
date.setUTCHours(date.getUTCHours() - dateInterval.hour * numberOfSteps);
|
|
3063
|
+
}
|
|
3064
|
+
|
|
3065
|
+
if (dateInterval.minute !== 0) {
|
|
3066
|
+
date.setUTCMinutes(date.getUTCMinutes() - dateInterval.minute * numberOfSteps);
|
|
3067
|
+
}
|
|
3068
|
+
|
|
3069
|
+
if (dateInterval.second !== 0) {
|
|
3070
|
+
date.setUTCSeconds(date.getUTCSeconds() - dateInterval.second * numberOfSteps);
|
|
3071
|
+
}
|
|
2801
3072
|
} else {
|
|
2802
3073
|
date.setTime(date.getTime() - dateInterval.getTime() * numberOfSteps);
|
|
2803
3074
|
}
|
|
@@ -2835,8 +3106,17 @@
|
|
|
2835
3106
|
|
|
2836
3107
|
/** ****************************************************** */
|
|
2837
3108
|
|
|
2838
|
-
var parseISO8601IntervalToDateInterval = function parseISO8601IntervalToDateInterval(
|
|
2839
|
-
if (!
|
|
3109
|
+
var parseISO8601IntervalToDateInterval = function parseISO8601IntervalToDateInterval(_isotime) {
|
|
3110
|
+
if (!_isotime) {
|
|
3111
|
+
return undefined;
|
|
3112
|
+
}
|
|
3113
|
+
|
|
3114
|
+
var isotime = _isotime.trim();
|
|
3115
|
+
|
|
3116
|
+
if (isotime.charAt(0) !== 'P') {
|
|
3117
|
+
return undefined;
|
|
3118
|
+
}
|
|
3119
|
+
|
|
2840
3120
|
var splittedOnT = isotime.split('T');
|
|
2841
3121
|
var years = '0';
|
|
2842
3122
|
var months = '0';
|
|
@@ -2861,7 +3141,11 @@
|
|
|
2861
3141
|
|
|
2862
3142
|
if (dayIndex !== -1) {
|
|
2863
3143
|
var start = yearIndex;
|
|
2864
|
-
|
|
3144
|
+
|
|
3145
|
+
if (monthIndex !== -1) {
|
|
3146
|
+
start = monthIndex;
|
|
3147
|
+
}
|
|
3148
|
+
|
|
2865
3149
|
days = YYYYMMDDPart.substring(start + 1, dayIndex);
|
|
2866
3150
|
}
|
|
2867
3151
|
} // parse the right part
|
|
@@ -2886,7 +3170,11 @@
|
|
|
2886
3170
|
|
|
2887
3171
|
if (secondIndex !== -1) {
|
|
2888
3172
|
var start = hourIndex;
|
|
2889
|
-
|
|
3173
|
+
|
|
3174
|
+
if (minuteIndex !== -1) {
|
|
3175
|
+
start = minuteIndex;
|
|
3176
|
+
}
|
|
3177
|
+
|
|
2890
3178
|
seconds = HHMMSSPart.substring(start + 1, secondIndex);
|
|
2891
3179
|
}
|
|
2892
3180
|
}
|
|
@@ -2904,7 +3192,10 @@
|
|
|
2904
3192
|
/** ******************************************************* */
|
|
2905
3193
|
|
|
2906
3194
|
function getNumberOfTimeSteps(starttime, stoptime, interval) {
|
|
2907
|
-
if (!starttime || !stoptime || !interval)
|
|
3195
|
+
if (!starttime || !stoptime || !interval) {
|
|
3196
|
+
return undefined;
|
|
3197
|
+
}
|
|
3198
|
+
|
|
2908
3199
|
var steps = 0;
|
|
2909
3200
|
|
|
2910
3201
|
if (interval.month !== 0 || interval.year !== 0) {
|
|
@@ -2935,7 +3226,9 @@
|
|
|
2935
3226
|
this.initialized = false;
|
|
2936
3227
|
var times = isoTimeRangeDuration.split('/'); // Some safety checks
|
|
2937
3228
|
|
|
2938
|
-
if (times[2] === undefined)
|
|
3229
|
+
if (times[2] === undefined) {
|
|
3230
|
+
times[2] = 'PT1M';
|
|
3231
|
+
}
|
|
2939
3232
|
|
|
2940
3233
|
if (times[1] === undefined) {
|
|
2941
3234
|
// eslint-disable-next-line prefer-destructuring
|
|
@@ -3042,7 +3335,10 @@
|
|
|
3042
3335
|
return this.timeSteps - 1;
|
|
3043
3336
|
}
|
|
3044
3337
|
|
|
3045
|
-
if (currentDateTime > this.stopTime.getTime())
|
|
3338
|
+
if (currentDateTime > this.stopTime.getTime()) {
|
|
3339
|
+
return this.timeSteps - 1;
|
|
3340
|
+
}
|
|
3341
|
+
|
|
3046
3342
|
var timeStep = 0;
|
|
3047
3343
|
|
|
3048
3344
|
if (this.timeInterval.isRegularInterval === false) {
|
|
@@ -3052,7 +3348,10 @@
|
|
|
3052
3348
|
var temptimeTime = temptime.getTime();
|
|
3053
3349
|
temptime.add(this.timeInterval);
|
|
3054
3350
|
var temptimeTimeIsOneStepFurther = temptime.getTime();
|
|
3055
|
-
|
|
3351
|
+
|
|
3352
|
+
if (currentDateTime >= temptimeTime && currentDateTime < temptimeTimeIsOneStepFurther) {
|
|
3353
|
+
return j;
|
|
3354
|
+
}
|
|
3056
3355
|
}
|
|
3057
3356
|
|
|
3058
3357
|
throw new Error("Date " + currentDate.toISO8601() + " not found!");
|
|
@@ -3244,7 +3543,9 @@
|
|
|
3244
3543
|
|
|
3245
3544
|
if (this._type === 'timestartstopres') {
|
|
3246
3545
|
/* Compose a new dataString interval and re-initialize the time dimension */
|
|
3247
|
-
var dateStringItems = this.values.split('/')
|
|
3546
|
+
var dateStringItems = this.values.split('/').map(function (value) {
|
|
3547
|
+
return value.trim();
|
|
3548
|
+
});
|
|
3248
3549
|
var dateStringInterval = dateStringItems[2];
|
|
3249
3550
|
var newValue = newStartValueTimeAsMoment.toISOString() + "/" + newEndValueTimeAsMoment.toISOString() + "/" + dateStringInterval;
|
|
3250
3551
|
this.defaultValue = newEndValueTimeAsMoment.toISOString();
|
|
@@ -3262,7 +3563,10 @@
|
|
|
3262
3563
|
var newValues = '';
|
|
3263
3564
|
|
|
3264
3565
|
for (var j = 0; j < newArray.length; j += 1) {
|
|
3265
|
-
if (j > 0)
|
|
3566
|
+
if (j > 0) {
|
|
3567
|
+
newValues += ',';
|
|
3568
|
+
}
|
|
3569
|
+
|
|
3266
3570
|
newValues += newArray[j].toISO8601();
|
|
3267
3571
|
}
|
|
3268
3572
|
|
|
@@ -3289,14 +3593,20 @@
|
|
|
3289
3593
|
forceReferenceTimeValue = false;
|
|
3290
3594
|
}
|
|
3291
3595
|
|
|
3292
|
-
if (this._initialized === true)
|
|
3596
|
+
if (this._initialized === true) {
|
|
3597
|
+
return;
|
|
3598
|
+
}
|
|
3599
|
+
|
|
3293
3600
|
var ogcdimvalues = this.values;
|
|
3294
3601
|
|
|
3295
3602
|
if (forceothervalues) {
|
|
3296
3603
|
ogcdimvalues = forceothervalues;
|
|
3297
3604
|
}
|
|
3298
3605
|
|
|
3299
|
-
if (!isDefined(ogcdimvalues))
|
|
3606
|
+
if (!isDefined(ogcdimvalues)) {
|
|
3607
|
+
return;
|
|
3608
|
+
}
|
|
3609
|
+
|
|
3300
3610
|
this._allValues = [];
|
|
3301
3611
|
this._initialized = true;
|
|
3302
3612
|
|
|
@@ -3317,10 +3627,14 @@
|
|
|
3317
3627
|
var values = ogcdimvalues.split(',');
|
|
3318
3628
|
|
|
3319
3629
|
for (var j = 0; j < values.length; j += 1) {
|
|
3320
|
-
var
|
|
3630
|
+
var valuesRangedNoTrim = values[j].split('/');
|
|
3321
3631
|
|
|
3322
|
-
if (
|
|
3632
|
+
if (valuesRangedNoTrim.length === 3) {
|
|
3633
|
+
var valuesRanged = valuesRangedNoTrim.map(function (value) {
|
|
3634
|
+
return value.trim();
|
|
3635
|
+
});
|
|
3323
3636
|
/* Can be either time like '2021-03-17T06:00:00Z/2021-03-21T00:00:00Z/PT6H' or something else, like '0/24/2' */
|
|
3637
|
+
|
|
3324
3638
|
if (valuesRanged[2].charAt(0) === 'P') {
|
|
3325
3639
|
var partTimeRanges = new ParseISOTimeRangeDuration(values[j]);
|
|
3326
3640
|
|
|
@@ -3338,8 +3652,14 @@
|
|
|
3338
3652
|
var stop_1 = parseFloat(valuesRanged[1]);
|
|
3339
3653
|
var res = parseFloat(valuesRanged[2]);
|
|
3340
3654
|
stop_1 += res;
|
|
3341
|
-
|
|
3342
|
-
if (
|
|
3655
|
+
|
|
3656
|
+
if (start > stop_1) {
|
|
3657
|
+
stop_1 = start;
|
|
3658
|
+
}
|
|
3659
|
+
|
|
3660
|
+
if (res <= 0) {
|
|
3661
|
+
res = 1;
|
|
3662
|
+
}
|
|
3343
3663
|
|
|
3344
3664
|
for (var j2 = start; j2 < stop_1; j2 += res) {
|
|
3345
3665
|
this._allValues.push(String(j2));
|
|
@@ -3358,26 +3678,39 @@
|
|
|
3358
3678
|
}
|
|
3359
3679
|
}
|
|
3360
3680
|
}
|
|
3681
|
+
/* If no default value is given, take the last / most recent one */
|
|
3682
|
+
|
|
3683
|
+
|
|
3684
|
+
if (!isDefined(this.defaultValue) || this.defaultValue === '') {
|
|
3685
|
+
this.defaultValue = this.getLastValue();
|
|
3686
|
+
}
|
|
3687
|
+
/* Check if the string 'current' is given, and find the closest value inside the dimension */
|
|
3688
|
+
|
|
3361
3689
|
|
|
3362
|
-
if (
|
|
3363
|
-
this.defaultValue = this.
|
|
3690
|
+
if (this.defaultValue === 'current') {
|
|
3691
|
+
this.defaultValue = this.getClosestValue(moment__default["default"]().utc().format('YYYY-MM-DDTHH:mm:ss[Z]'), true);
|
|
3364
3692
|
}
|
|
3365
3693
|
/* If no currentvalue is set, set the default */
|
|
3366
3694
|
|
|
3367
3695
|
|
|
3368
|
-
if (!
|
|
3369
|
-
this.currentValue = this.
|
|
3696
|
+
if (!this.currentValue || this.currentValue.length === 0) {
|
|
3697
|
+
this.currentValue = this.defaultValue;
|
|
3370
3698
|
}
|
|
3371
3699
|
/* Check for out of range values and adjust accordingly to a valid range */
|
|
3372
3700
|
|
|
3373
3701
|
|
|
3374
3702
|
var index = this.getIndexForValue(this.currentValue);
|
|
3375
|
-
if (index === -2) this.currentValue = this.getLastValue(); // Date is past the latest (-2), so set it to the last value
|
|
3376
3703
|
|
|
3377
|
-
if (index === -
|
|
3704
|
+
if (index === -2) {
|
|
3705
|
+
this.currentValue = this.getLastValue(); // Date is past the latest (-2), so set it to the last value
|
|
3706
|
+
}
|
|
3378
3707
|
|
|
3708
|
+
if (index === -1) {
|
|
3709
|
+
this.currentValue = this.getFirstValue(); // Date is past the first (-1), so set it to the first value
|
|
3710
|
+
}
|
|
3379
3711
|
/* In case of reference time, the time dimension range is changed, check if the current time still fits in that range */
|
|
3380
3712
|
|
|
3713
|
+
|
|
3381
3714
|
if (forceReferenceTimeValue) {
|
|
3382
3715
|
if (this.getIndexForValue(this.currentValue, true) < 0) {
|
|
3383
3716
|
this.currentValue = this.getClosestValue(this.currentValue);
|
|
@@ -3528,7 +3861,11 @@
|
|
|
3528
3861
|
|
|
3529
3862
|
if (newValue === 'middle') {
|
|
3530
3863
|
var middleIndex = Math.ceil(this.size() / 2) - 1;
|
|
3531
|
-
|
|
3864
|
+
|
|
3865
|
+
if (middleIndex < 0) {
|
|
3866
|
+
middleIndex = 0;
|
|
3867
|
+
}
|
|
3868
|
+
|
|
3532
3869
|
return this.getValueForIndex(middleIndex);
|
|
3533
3870
|
}
|
|
3534
3871
|
|
|
@@ -3548,7 +3885,11 @@
|
|
|
3548
3885
|
value = this.getValueForIndex(index);
|
|
3549
3886
|
} catch (e) {
|
|
3550
3887
|
if (typeof e.message === 'number') {
|
|
3551
|
-
if (e.message === 0)
|
|
3888
|
+
if (e.message === 0) {
|
|
3889
|
+
value = WMDateTooEarlyString;
|
|
3890
|
+
} else {
|
|
3891
|
+
value = WMDateTooLateString;
|
|
3892
|
+
}
|
|
3552
3893
|
}
|
|
3553
3894
|
}
|
|
3554
3895
|
|
|
@@ -3589,8 +3930,14 @@
|
|
|
3589
3930
|
return this._timeRangeDurationDate.getDateAtTimeStep(index);
|
|
3590
3931
|
}
|
|
3591
3932
|
|
|
3592
|
-
if (this._type === 'timevalues')
|
|
3593
|
-
|
|
3933
|
+
if (this._type === 'timevalues') {
|
|
3934
|
+
return this._allValues[index];
|
|
3935
|
+
}
|
|
3936
|
+
|
|
3937
|
+
if (this._type === 'anyvalue') {
|
|
3938
|
+
return this._allValues[index];
|
|
3939
|
+
}
|
|
3940
|
+
|
|
3594
3941
|
return null;
|
|
3595
3942
|
};
|
|
3596
3943
|
/**
|
|
@@ -3601,7 +3948,11 @@
|
|
|
3601
3948
|
|
|
3602
3949
|
WMJSDimension.prototype.getDimInterval = function () {
|
|
3603
3950
|
this.initialize();
|
|
3604
|
-
|
|
3951
|
+
|
|
3952
|
+
if (!this.dimTimeInterval) {
|
|
3953
|
+
return undefined;
|
|
3954
|
+
}
|
|
3955
|
+
|
|
3605
3956
|
var _a = this.dimTimeInterval,
|
|
3606
3957
|
year = _a.year,
|
|
3607
3958
|
month = _a.month,
|
|
@@ -3674,7 +4025,10 @@
|
|
|
3674
4025
|
|
|
3675
4026
|
return this._timeRangeDurationDate.getTimeStepFromDate(value, outSideOfRangeFlag);
|
|
3676
4027
|
} catch (e) {
|
|
3677
|
-
if (parseInt(e.message, 10) === 0)
|
|
4028
|
+
if (parseInt(e.message, 10) === 0) {
|
|
4029
|
+
return -1;
|
|
4030
|
+
}
|
|
4031
|
+
|
|
3678
4032
|
return -2;
|
|
3679
4033
|
}
|
|
3680
4034
|
}
|
|
@@ -3682,7 +4036,7 @@
|
|
|
3682
4036
|
if (this._type === 'timevalues') {
|
|
3683
4037
|
try {
|
|
3684
4038
|
var dateToFind = parseISO8601DateToDate(value).getTime();
|
|
3685
|
-
var minDistance =
|
|
4039
|
+
var minDistance = null;
|
|
3686
4040
|
var foundIndex = 0;
|
|
3687
4041
|
var minTime = null;
|
|
3688
4042
|
var maxTime = null;
|
|
@@ -3690,11 +4044,23 @@
|
|
|
3690
4044
|
for (var j = 0; j < this._allValues.length; j += 1) {
|
|
3691
4045
|
var time = this._allDates[j].getTime();
|
|
3692
4046
|
|
|
3693
|
-
if (time < minTime || minTime === null)
|
|
3694
|
-
|
|
4047
|
+
if (time < minTime || minTime === null) {
|
|
4048
|
+
minTime = time;
|
|
4049
|
+
}
|
|
4050
|
+
|
|
4051
|
+
if (time > maxTime || maxTime === null) {
|
|
4052
|
+
maxTime = time;
|
|
4053
|
+
}
|
|
4054
|
+
|
|
3695
4055
|
var distance = time - dateToFind;
|
|
3696
|
-
|
|
3697
|
-
if (
|
|
4056
|
+
|
|
4057
|
+
if (distance < 0) {
|
|
4058
|
+
distance = -distance;
|
|
4059
|
+
}
|
|
4060
|
+
|
|
4061
|
+
if (j === 0) {
|
|
4062
|
+
minDistance = distance;
|
|
4063
|
+
}
|
|
3698
4064
|
|
|
3699
4065
|
if (distance < minDistance) {
|
|
3700
4066
|
minDistance = distance;
|
|
@@ -3703,8 +4069,13 @@
|
|
|
3703
4069
|
}
|
|
3704
4070
|
|
|
3705
4071
|
if (outSideOfRangeFlag) {
|
|
3706
|
-
if (minTime > dateToFind)
|
|
3707
|
-
|
|
4072
|
+
if (minTime > dateToFind) {
|
|
4073
|
+
return -1;
|
|
4074
|
+
}
|
|
4075
|
+
|
|
4076
|
+
if (maxTime < dateToFind) {
|
|
4077
|
+
return -2;
|
|
4078
|
+
}
|
|
3708
4079
|
}
|
|
3709
4080
|
|
|
3710
4081
|
return foundIndex;
|
|
@@ -3716,7 +4087,9 @@
|
|
|
3716
4087
|
|
|
3717
4088
|
if (this._type === 'anyvalue') {
|
|
3718
4089
|
for (var j = 0; j < this._allValues.length; j += 1) {
|
|
3719
|
-
if (this._allValues[j] === value)
|
|
4090
|
+
if (this._allValues[j] === value) {
|
|
4091
|
+
return j;
|
|
4092
|
+
}
|
|
3720
4093
|
}
|
|
3721
4094
|
}
|
|
3722
4095
|
|
|
@@ -3729,7 +4102,10 @@
|
|
|
3729
4102
|
|
|
3730
4103
|
WMJSDimension.prototype.size = function () {
|
|
3731
4104
|
this.initialize();
|
|
3732
|
-
|
|
4105
|
+
|
|
4106
|
+
if (this._type === 'timestartstopres') {
|
|
4107
|
+
return this._timeRangeDurationDate.getTimeSteps();
|
|
4108
|
+
}
|
|
3733
4109
|
|
|
3734
4110
|
if (this._type === 'timevalues' || this._type === 'anyvalue') {
|
|
3735
4111
|
return this._allValues.length;
|
|
@@ -3841,7 +4217,9 @@
|
|
|
3841
4217
|
};
|
|
3842
4218
|
|
|
3843
4219
|
this.repositionMapPin = function (_bbox) {
|
|
3844
|
-
if (!_bbox)
|
|
4220
|
+
if (!_bbox) {
|
|
4221
|
+
return;
|
|
4222
|
+
}
|
|
3845
4223
|
|
|
3846
4224
|
var newpos = _this._map.getPixelCoordFromGeoCoord({
|
|
3847
4225
|
x: _this.geoPosX,
|
|
@@ -3854,8 +4232,14 @@
|
|
|
3854
4232
|
this.setMapPin = function (_x, _y, _bbox) {
|
|
3855
4233
|
var x = _x;
|
|
3856
4234
|
var y = _y;
|
|
3857
|
-
|
|
3858
|
-
if (
|
|
4235
|
+
|
|
4236
|
+
if (!x || !y) {
|
|
4237
|
+
return;
|
|
4238
|
+
}
|
|
4239
|
+
|
|
4240
|
+
if (_this.disableMapPin && !_bbox) {
|
|
4241
|
+
return; // we still want to update the pin position when the bbox changes.
|
|
4242
|
+
}
|
|
3859
4243
|
|
|
3860
4244
|
_this.x = parseInt(x, 10);
|
|
3861
4245
|
_this.y = parseInt(y, 10);
|
|
@@ -3960,14 +4344,17 @@
|
|
|
3960
4344
|
}
|
|
3961
4345
|
}
|
|
3962
4346
|
|
|
3963
|
-
return request;
|
|
3964
|
-
}; // Build a valid WMS request for a certain layer
|
|
3965
|
-
|
|
3966
|
-
var buildWMSGetMapRequest = function buildWMSGetMapRequest(map, layer) {
|
|
3967
|
-
if (!isDefined(layer.name))
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
4347
|
+
return request;
|
|
4348
|
+
}; // Build a valid WMS request for a certain layer
|
|
4349
|
+
|
|
4350
|
+
var buildWMSGetMapRequest = function buildWMSGetMapRequest(map, layer) {
|
|
4351
|
+
if (!isDefined(layer.name)) {
|
|
4352
|
+
return {
|
|
4353
|
+
url: undefined,
|
|
4354
|
+
headers: null
|
|
4355
|
+
};
|
|
4356
|
+
}
|
|
4357
|
+
|
|
3971
4358
|
var srs = map.getProjection().srs;
|
|
3972
4359
|
var mapBbox = map.getDrawBBOX();
|
|
3973
4360
|
|
|
@@ -3979,10 +4366,13 @@
|
|
|
3979
4366
|
layer.format = 'image/png';
|
|
3980
4367
|
}
|
|
3981
4368
|
|
|
3982
|
-
if (layer.name.length < 1)
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
4369
|
+
if (layer.name.length < 1) {
|
|
4370
|
+
return {
|
|
4371
|
+
url: undefined,
|
|
4372
|
+
headers: null
|
|
4373
|
+
};
|
|
4374
|
+
} // GetFeatureInfo timeseries in the mapview
|
|
4375
|
+
|
|
3986
4376
|
|
|
3987
4377
|
if (srs === 'GFI:TIME_ELEVATION') {
|
|
3988
4378
|
var x = 707;
|
|
@@ -4092,8 +4482,10 @@
|
|
|
4092
4482
|
* */
|
|
4093
4483
|
var SCALE_DELAY = 10;
|
|
4094
4484
|
var ZOOMED_CALLBACK_DELAY = 500;
|
|
4485
|
+
var THROTTLE_OPTIONS = {
|
|
4486
|
+
noTrailing: true
|
|
4487
|
+
};
|
|
4095
4488
|
var THROTTLE_WAIT_TIME = 300;
|
|
4096
|
-
var THROTTLE_NO_TRAILING = true;
|
|
4097
4489
|
|
|
4098
4490
|
var WMFlyToBBox =
|
|
4099
4491
|
/** @class */
|
|
@@ -4103,7 +4495,6 @@
|
|
|
4103
4495
|
|
|
4104
4496
|
this.flyZoomToBBOXTimerStart = 1;
|
|
4105
4497
|
this.flyZoomToBBOXTimerSteps = 5;
|
|
4106
|
-
this.flyZoomToBBOXDebounced = throttleDebounce.debounce;
|
|
4107
4498
|
this.flyZoomToBBOXScaler = 0;
|
|
4108
4499
|
this.flyZoomToBBOXCurrent = new WMBBOX();
|
|
4109
4500
|
this.flyZoomToBBOXFly = new WMBBOX();
|
|
@@ -4196,9 +4587,9 @@
|
|
|
4196
4587
|
}
|
|
4197
4588
|
};
|
|
4198
4589
|
|
|
4199
|
-
this.startZoomThrottled = throttleDebounce.throttle(THROTTLE_WAIT_TIME,
|
|
4200
|
-
|
|
4201
|
-
});
|
|
4590
|
+
this.startZoomThrottled = throttleDebounce.throttle(THROTTLE_WAIT_TIME, function (currentbox, newbox) {
|
|
4591
|
+
_this.flyZoomToBBOXStartZoom(currentbox, newbox);
|
|
4592
|
+
}, THROTTLE_OPTIONS);
|
|
4202
4593
|
|
|
4203
4594
|
this.flyZoomToBBOXStartZoomThrottled = function (currentbox, newbox) {
|
|
4204
4595
|
_this.startZoomThrottled(currentbox, newbox);
|
|
@@ -4223,7 +4614,6 @@
|
|
|
4223
4614
|
var bgMapImageStore = new WMImageStore(bgImageStoreLength, {
|
|
4224
4615
|
id: 'bgMapImageStore'
|
|
4225
4616
|
});
|
|
4226
|
-
|
|
4227
4617
|
var detectLeftButton = function detectLeftButton(evt) {
|
|
4228
4618
|
if (evt.buttons) {
|
|
4229
4619
|
return evt.buttons === 1;
|
|
@@ -4385,7 +4775,6 @@
|
|
|
4385
4775
|
/* pan,zoom,zoomout,info */
|
|
4386
4776
|
|
|
4387
4777
|
this.numGetFeatureInfoRequests = 0;
|
|
4388
|
-
this.getFeatureInfoResult = [];
|
|
4389
4778
|
this.oldMapMode = undefined;
|
|
4390
4779
|
this.InValidMouseAction = 0;
|
|
4391
4780
|
this.resizingBBOXCursor = '';
|
|
@@ -4401,7 +4790,11 @@
|
|
|
4401
4790
|
this.proj4.srs = 'empty';
|
|
4402
4791
|
this.proj4.projection = undefined;
|
|
4403
4792
|
this.longlat = 'EPSG:4326';
|
|
4404
|
-
|
|
4793
|
+
|
|
4794
|
+
if (proj4__default["default"]) {
|
|
4795
|
+
proj4__default["default"].defs(WMProj4Defs);
|
|
4796
|
+
}
|
|
4797
|
+
|
|
4405
4798
|
this.previousMouseButtonState = 'up';
|
|
4406
4799
|
/* Binds */
|
|
4407
4800
|
|
|
@@ -4440,7 +4833,6 @@
|
|
|
4440
4833
|
this.setSize = this.setSize.bind(this);
|
|
4441
4834
|
this._setSize = this._setSize.bind(this);
|
|
4442
4835
|
this.abort = this.abort.bind(this);
|
|
4443
|
-
this.isBusy = this.isBusy.bind(this);
|
|
4444
4836
|
this._makeInfoHTML = this._makeInfoHTML.bind(this);
|
|
4445
4837
|
this.showScaleBar = this.showScaleBar.bind(this);
|
|
4446
4838
|
this.hideScaleBar = this.hideScaleBar.bind(this);
|
|
@@ -4728,30 +5120,52 @@
|
|
|
4728
5120
|
do {
|
|
4729
5121
|
numMapUnits *= 10.0;
|
|
4730
5122
|
divFactor = a / numMapUnits;
|
|
4731
|
-
|
|
5123
|
+
|
|
5124
|
+
if (divFactor === 0) {
|
|
5125
|
+
return undefined;
|
|
5126
|
+
}
|
|
5127
|
+
|
|
4732
5128
|
realWidth = desiredWidth / divFactor;
|
|
4733
5129
|
} while (realWidth < desiredWidth);
|
|
4734
5130
|
|
|
4735
5131
|
do {
|
|
4736
5132
|
numMapUnits /= 2.0;
|
|
4737
5133
|
divFactor = a / numMapUnits;
|
|
4738
|
-
|
|
5134
|
+
|
|
5135
|
+
if (divFactor === 0) {
|
|
5136
|
+
return undefined;
|
|
5137
|
+
}
|
|
5138
|
+
|
|
4739
5139
|
realWidth = desiredWidth / divFactor;
|
|
4740
5140
|
} while (realWidth > desiredWidth);
|
|
4741
5141
|
|
|
4742
5142
|
do {
|
|
4743
5143
|
numMapUnits *= 1.2;
|
|
4744
5144
|
divFactor = a / numMapUnits;
|
|
4745
|
-
|
|
5145
|
+
|
|
5146
|
+
if (divFactor === 0) {
|
|
5147
|
+
return undefined;
|
|
5148
|
+
}
|
|
5149
|
+
|
|
4746
5150
|
realWidth = desiredWidth / divFactor;
|
|
4747
5151
|
} while (realWidth < desiredWidth);
|
|
4748
5152
|
|
|
4749
5153
|
var roundedMapUnits = numMapUnits;
|
|
4750
5154
|
var d = Math.pow(10, Math.round(Math.log10(numMapUnits) + 0.5) - 1);
|
|
4751
5155
|
roundedMapUnits = Math.round(roundedMapUnits / d);
|
|
4752
|
-
|
|
4753
|
-
if (roundedMapUnits
|
|
4754
|
-
|
|
5156
|
+
|
|
5157
|
+
if (roundedMapUnits < 2.5) {
|
|
5158
|
+
roundedMapUnits = 2.5;
|
|
5159
|
+
}
|
|
5160
|
+
|
|
5161
|
+
if (roundedMapUnits > 2.5 && roundedMapUnits < 7.5) {
|
|
5162
|
+
roundedMapUnits = 5;
|
|
5163
|
+
}
|
|
5164
|
+
|
|
5165
|
+
if (roundedMapUnits > 7.5) {
|
|
5166
|
+
roundedMapUnits = 10;
|
|
5167
|
+
}
|
|
5168
|
+
|
|
4755
5169
|
roundedMapUnits *= d;
|
|
4756
5170
|
divFactor = desiredWidth / pixelsPerUnit / roundedMapUnits;
|
|
4757
5171
|
realWidth = desiredWidth / divFactor;
|
|
@@ -4796,15 +5210,42 @@
|
|
|
4796
5210
|
ctx.moveTo(offsetX + scaleBarProps.width * 2 + 1, scaleBarHeight - 2 + offsetY);
|
|
4797
5211
|
ctx.lineTo(offsetX + scaleBarProps.width * 2 + 1, scaleBarHeight - 2 - 7 + offsetY);
|
|
4798
5212
|
var units = '';
|
|
4799
|
-
|
|
4800
|
-
if (this.srs === 'EPSG:
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
if (this.srs === 'EPSG:
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
5213
|
+
|
|
5214
|
+
if (this.srs === 'EPSG:3411') {
|
|
5215
|
+
units = 'meter';
|
|
5216
|
+
}
|
|
5217
|
+
|
|
5218
|
+
if (this.srs === 'EPSG:3412') {
|
|
5219
|
+
units = 'meter';
|
|
5220
|
+
}
|
|
5221
|
+
|
|
5222
|
+
if (this.srs === 'EPSG:3575') {
|
|
5223
|
+
units = 'meter';
|
|
5224
|
+
}
|
|
5225
|
+
|
|
5226
|
+
if (this.srs === 'EPSG:4326') {
|
|
5227
|
+
units = 'degrees';
|
|
5228
|
+
}
|
|
5229
|
+
|
|
5230
|
+
if (this.srs === 'EPSG:28992') {
|
|
5231
|
+
units = 'meter';
|
|
5232
|
+
}
|
|
5233
|
+
|
|
5234
|
+
if (this.srs === 'EPSG:32661') {
|
|
5235
|
+
units = 'meter';
|
|
5236
|
+
}
|
|
5237
|
+
|
|
5238
|
+
if (this.srs === 'EPSG:3857') {
|
|
5239
|
+
units = 'meter';
|
|
5240
|
+
}
|
|
5241
|
+
|
|
5242
|
+
if (this.srs === 'EPSG:900913') {
|
|
5243
|
+
units = 'meter';
|
|
5244
|
+
}
|
|
5245
|
+
|
|
5246
|
+
if (this.srs === 'EPSG:102100') {
|
|
5247
|
+
units = 'meter';
|
|
5248
|
+
}
|
|
4808
5249
|
|
|
4809
5250
|
if (units === 'meter') {
|
|
4810
5251
|
if (scaleBarProps.mapunits > 1000) {
|
|
@@ -4830,7 +5271,11 @@
|
|
|
4830
5271
|
|
|
4831
5272
|
if (isDefined(this.mouseGeoCoordXY)) {
|
|
4832
5273
|
var roundingFactor = 1.0 / Math.pow(10, parseInt(Math.log((this.bbox.right - this.bbox.left) / this.width) / Math.log(10), 10) - 2);
|
|
4833
|
-
|
|
5274
|
+
|
|
5275
|
+
if (roundingFactor < 1) {
|
|
5276
|
+
roundingFactor = 1;
|
|
5277
|
+
}
|
|
5278
|
+
|
|
4834
5279
|
ctx.fillStyle = '#000000';
|
|
4835
5280
|
var xText = Math.round(this.mouseGeoCoordXY.x * roundingFactor) / roundingFactor;
|
|
4836
5281
|
var yText = Math.round(this.mouseGeoCoordXY.y * roundingFactor) / roundingFactor;
|
|
@@ -5025,32 +5470,18 @@
|
|
|
5025
5470
|
};
|
|
5026
5471
|
|
|
5027
5472
|
WMJSMap.prototype.rebuildMapDimensions = function () {
|
|
5028
|
-
for (var j = 0; j < this.mapdimensions.length; j += 1) {
|
|
5029
|
-
this.mapdimensions[j].used = false;
|
|
5030
|
-
}
|
|
5031
|
-
|
|
5032
5473
|
for (var i = 0; i < this.layers.length; i += 1) {
|
|
5033
5474
|
for (var j = 0; j < this.layers[i].dimensions.length; j += 1) {
|
|
5034
5475
|
var dim = this.layers[i].dimensions[j];
|
|
5035
5476
|
var mapdim = this.getDimension(dim.name);
|
|
5036
5477
|
|
|
5037
|
-
if (isDefined(mapdim)) {
|
|
5038
|
-
mapdim.used = true;
|
|
5039
|
-
} else {
|
|
5478
|
+
if (!isDefined(mapdim)) {
|
|
5040
5479
|
var newdim = dim.clone();
|
|
5041
|
-
newdim.used = true;
|
|
5042
5480
|
this.mapdimensions.push(newdim);
|
|
5043
5481
|
}
|
|
5044
5482
|
}
|
|
5045
5483
|
}
|
|
5046
5484
|
|
|
5047
|
-
for (var j = 0; j < this.mapdimensions.length; j += 1) {
|
|
5048
|
-
if (this.mapdimensions[j].used === false) {
|
|
5049
|
-
this.mapdimensions.splice(j, 1);
|
|
5050
|
-
j -= 1;
|
|
5051
|
-
}
|
|
5052
|
-
}
|
|
5053
|
-
|
|
5054
5485
|
this.callBack.triggerEvent('onmapdimupdate');
|
|
5055
5486
|
};
|
|
5056
5487
|
|
|
@@ -5132,7 +5563,9 @@
|
|
|
5132
5563
|
WMJSMap.prototype.toggleLayer = function (layer) {
|
|
5133
5564
|
if (layer.enabled === true) {
|
|
5134
5565
|
layer.enabled = false;
|
|
5135
|
-
} else
|
|
5566
|
+
} else {
|
|
5567
|
+
layer.enabled = true;
|
|
5568
|
+
}
|
|
5136
5569
|
|
|
5137
5570
|
this.calculateNumBaseLayers();
|
|
5138
5571
|
this.rebuildMapDimensions();
|
|
@@ -5145,7 +5578,9 @@
|
|
|
5145
5578
|
};
|
|
5146
5579
|
|
|
5147
5580
|
WMJSMap.prototype._getLayerIndex = function (layer) {
|
|
5148
|
-
if (!layer)
|
|
5581
|
+
if (!layer) {
|
|
5582
|
+
return undefined;
|
|
5583
|
+
}
|
|
5149
5584
|
|
|
5150
5585
|
for (var j = 0; j < this.layers.length; j += 1) {
|
|
5151
5586
|
if (this.layers[j] === layer) {
|
|
@@ -5167,7 +5602,10 @@
|
|
|
5167
5602
|
};
|
|
5168
5603
|
|
|
5169
5604
|
WMJSMap.prototype.deleteLayer = function (layerToDelete) {
|
|
5170
|
-
if (this.layers.length <= 0)
|
|
5605
|
+
if (this.layers.length <= 0) {
|
|
5606
|
+
return;
|
|
5607
|
+
}
|
|
5608
|
+
|
|
5171
5609
|
layerToDelete.setAutoUpdate(false);
|
|
5172
5610
|
|
|
5173
5611
|
var layerIndex = this._getLayerIndex(layerToDelete);
|
|
@@ -5318,14 +5756,18 @@
|
|
|
5318
5756
|
|
|
5319
5757
|
|
|
5320
5758
|
WMJSMap.prototype.setProjection = function (_srs, _bbox) {
|
|
5321
|
-
if (!_srs)
|
|
5759
|
+
if (!_srs) {
|
|
5760
|
+
_srs = 'EPSG:4326';
|
|
5761
|
+
}
|
|
5322
5762
|
|
|
5323
5763
|
if (_typeof(_srs) === 'object') {
|
|
5324
5764
|
_bbox = _srs.bbox;
|
|
5325
5765
|
_srs = _srs.srs;
|
|
5326
5766
|
}
|
|
5327
5767
|
|
|
5328
|
-
if (!_srs)
|
|
5768
|
+
if (!_srs) {
|
|
5769
|
+
_srs = 'EPSG:4326';
|
|
5770
|
+
}
|
|
5329
5771
|
|
|
5330
5772
|
if (this.srs !== _srs) {
|
|
5331
5773
|
this.defaultBBOX.setBBOX(_bbox);
|
|
@@ -5418,7 +5860,9 @@
|
|
|
5418
5860
|
};
|
|
5419
5861
|
|
|
5420
5862
|
WMJSMap.prototype._setSize = function (w, h) {
|
|
5421
|
-
if (!w || !h)
|
|
5863
|
+
if (!w || !h) {
|
|
5864
|
+
return;
|
|
5865
|
+
}
|
|
5422
5866
|
|
|
5423
5867
|
if (w < 4 || h < 4) {
|
|
5424
5868
|
return;
|
|
@@ -5428,8 +5872,14 @@
|
|
|
5428
5872
|
var projinfo = this.getProjection();
|
|
5429
5873
|
this.width = w;
|
|
5430
5874
|
this.height = h;
|
|
5431
|
-
|
|
5432
|
-
if (this.
|
|
5875
|
+
|
|
5876
|
+
if (this.width < 4 || isNaN(this.width)) {
|
|
5877
|
+
this.width = 4;
|
|
5878
|
+
}
|
|
5879
|
+
|
|
5880
|
+
if (this.height < 4 || isNaN(this.height)) {
|
|
5881
|
+
this.height = 4;
|
|
5882
|
+
}
|
|
5433
5883
|
|
|
5434
5884
|
if (!projinfo.srs || !projinfo.bbox) {
|
|
5435
5885
|
debug(exports.DebugType.Error, 'WebMapJS: this.setSize: Setting default projection (EPSG:4326 with (-180,-90,180,90)');
|
|
@@ -5441,12 +5891,19 @@
|
|
|
5441
5891
|
this.setProjection(projinfo.srs, projinfo.bbox);
|
|
5442
5892
|
}
|
|
5443
5893
|
|
|
5444
|
-
if (!this.baseDiv || !this.baseDiv.style)
|
|
5894
|
+
if (!this.baseDiv || !this.baseDiv.style) {
|
|
5895
|
+
return;
|
|
5896
|
+
}
|
|
5897
|
+
|
|
5445
5898
|
Object.assign(this.baseDiv.style, {
|
|
5446
5899
|
width: this.width,
|
|
5447
5900
|
height: this.height
|
|
5448
5901
|
});
|
|
5449
|
-
|
|
5902
|
+
|
|
5903
|
+
if (!this.mainElement || !this.mainElement.style) {
|
|
5904
|
+
return;
|
|
5905
|
+
}
|
|
5906
|
+
|
|
5450
5907
|
this.mainElement.style.width = this.width + "px";
|
|
5451
5908
|
this.mainElement.style.height = this.height + "px";
|
|
5452
5909
|
this.setBBOX(this.resizeBBOX);
|
|
@@ -5466,15 +5923,6 @@
|
|
|
5466
5923
|
this.callBack.triggerEvent('onloadingcomplete');
|
|
5467
5924
|
};
|
|
5468
5925
|
|
|
5469
|
-
WMJSMap.prototype.isBusy = function () {
|
|
5470
|
-
if (this.suspendDrawing === true || this.mapBusy || this.layersBusy === 1) {
|
|
5471
|
-
return true;
|
|
5472
|
-
}
|
|
5473
|
-
|
|
5474
|
-
if (this.divBuffer[0].ready === false || this.divBuffer[1].ready === false) return true;
|
|
5475
|
-
return false;
|
|
5476
|
-
};
|
|
5477
|
-
|
|
5478
5926
|
WMJSMap.prototype._makeInfoHTML = function () {
|
|
5479
5927
|
try {
|
|
5480
5928
|
// Create the layerinformation table
|
|
@@ -5524,7 +5972,9 @@
|
|
|
5524
5972
|
}
|
|
5525
5973
|
}
|
|
5526
5974
|
|
|
5527
|
-
if (foundDim === false)
|
|
5975
|
+
if (foundDim === false) {
|
|
5976
|
+
infoHTML += '<td>-</td>';
|
|
5977
|
+
}
|
|
5528
5978
|
}
|
|
5529
5979
|
|
|
5530
5980
|
infoHTML += '</tr>';
|
|
@@ -5563,7 +6013,10 @@
|
|
|
5563
6013
|
};
|
|
5564
6014
|
|
|
5565
6015
|
WMJSMap.prototype.display = function () {
|
|
5566
|
-
if (!this.divBuffer)
|
|
6016
|
+
if (!this.divBuffer) {
|
|
6017
|
+
return;
|
|
6018
|
+
}
|
|
6019
|
+
|
|
5567
6020
|
this.divBuffer.display();
|
|
5568
6021
|
this.drawnBBOX.setBBOX(this.bbox);
|
|
5569
6022
|
};
|
|
@@ -5573,10 +6026,6 @@
|
|
|
5573
6026
|
};
|
|
5574
6027
|
|
|
5575
6028
|
WMJSMap.prototype.draw = function (animationList) {
|
|
5576
|
-
if (animationList === void 0) {
|
|
5577
|
-
animationList = {};
|
|
5578
|
-
}
|
|
5579
|
-
|
|
5580
6029
|
if (this.isDestroyed) {
|
|
5581
6030
|
return;
|
|
5582
6031
|
}
|
|
@@ -5597,7 +6046,6 @@
|
|
|
5597
6046
|
/**
|
|
5598
6047
|
* API Function called to draw the layers, fires getmap request and shows the layers on the screen
|
|
5599
6048
|
*/
|
|
5600
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5601
6049
|
|
|
5602
6050
|
|
|
5603
6051
|
WMJSMap.prototype._draw = function (animationList) {
|
|
@@ -5614,8 +6062,7 @@
|
|
|
5614
6062
|
this.needsRedraw = false;
|
|
5615
6063
|
this.draw(this._animationList);
|
|
5616
6064
|
}
|
|
5617
|
-
};
|
|
5618
|
-
|
|
6065
|
+
};
|
|
5619
6066
|
|
|
5620
6067
|
WMJSMap.prototype._drawAndLoad = function (animationList) {
|
|
5621
6068
|
if (this.width < 4 || this.height < 4) {
|
|
@@ -5772,9 +6219,16 @@
|
|
|
5772
6219
|
triggerEvent = true;
|
|
5773
6220
|
}
|
|
5774
6221
|
|
|
5775
|
-
if (!this.divBuffer)
|
|
6222
|
+
if (!this.divBuffer) {
|
|
6223
|
+
return;
|
|
6224
|
+
}
|
|
6225
|
+
|
|
5776
6226
|
var mapbbox = this.bbox;
|
|
5777
|
-
|
|
6227
|
+
|
|
6228
|
+
if (isDefined(_mapbbox)) {
|
|
6229
|
+
mapbbox = _mapbbox;
|
|
6230
|
+
}
|
|
6231
|
+
|
|
5778
6232
|
this.updateBBOX.setBBOX(mapbbox);
|
|
5779
6233
|
this.divBuffer.setBBOX(this.updateBBOX, this.drawnBBOX);
|
|
5780
6234
|
this.drawnBBOX.setBBOX(mapbbox);
|
|
@@ -5805,7 +6259,9 @@
|
|
|
5805
6259
|
}
|
|
5806
6260
|
|
|
5807
6261
|
this.callBack.triggerEvent('onlayeradd');
|
|
5808
|
-
} else
|
|
6262
|
+
} else {
|
|
6263
|
+
this.baseLayers = undefined;
|
|
6264
|
+
}
|
|
5809
6265
|
};
|
|
5810
6266
|
|
|
5811
6267
|
WMJSMap.prototype.setBaseLayers = function (layer) {
|
|
@@ -5822,7 +6278,9 @@
|
|
|
5822
6278
|
}
|
|
5823
6279
|
|
|
5824
6280
|
this.callBack.triggerEvent('onlayerchange');
|
|
5825
|
-
} else
|
|
6281
|
+
} else {
|
|
6282
|
+
this.baseLayers = undefined;
|
|
6283
|
+
}
|
|
5826
6284
|
};
|
|
5827
6285
|
|
|
5828
6286
|
WMJSMap.prototype.getBaseLayers = function () {
|
|
@@ -5839,7 +6297,10 @@
|
|
|
5839
6297
|
|
|
5840
6298
|
WMJSMap.prototype.mouseWheelEvent = function (event) {
|
|
5841
6299
|
preventdefaultEvent(event);
|
|
5842
|
-
|
|
6300
|
+
|
|
6301
|
+
if (this.mouseWheelBusy === 1) {
|
|
6302
|
+
return;
|
|
6303
|
+
}
|
|
5843
6304
|
|
|
5844
6305
|
var _a = this.getMouseCoordinatesForDocument(event),
|
|
5845
6306
|
x = _a.x,
|
|
@@ -5897,7 +6358,10 @@
|
|
|
5897
6358
|
};
|
|
5898
6359
|
|
|
5899
6360
|
WMJSMap.prototype.destroy = function () {
|
|
5900
|
-
if (!this.initialized)
|
|
6361
|
+
if (!this.initialized) {
|
|
6362
|
+
return;
|
|
6363
|
+
}
|
|
6364
|
+
|
|
5901
6365
|
this.stopAnimating();
|
|
5902
6366
|
|
|
5903
6367
|
for (var i = this.layers.length - 1; i >= 0; i -= 1) {
|
|
@@ -5985,7 +6449,10 @@
|
|
|
5985
6449
|
/* For invalid layers we cannot build an url */
|
|
5986
6450
|
|
|
5987
6451
|
|
|
5988
|
-
if (!layer.name)
|
|
6452
|
+
if (!layer.name) {
|
|
6453
|
+
return '';
|
|
6454
|
+
}
|
|
6455
|
+
|
|
5989
6456
|
var request = WMJScheckURL(layer.service);
|
|
5990
6457
|
request += "&SERVICE=WMS&REQUEST=GetFeatureInfo&VERSION=" + layer.version;
|
|
5991
6458
|
request += "&LAYERS=" + URLEncode(layer.name);
|
|
@@ -6147,7 +6614,10 @@
|
|
|
6147
6614
|
this.oldMapMode = undefined;
|
|
6148
6615
|
}
|
|
6149
6616
|
} else {
|
|
6150
|
-
if (this.oldMapMode === undefined)
|
|
6617
|
+
if (this.oldMapMode === undefined) {
|
|
6618
|
+
this.oldMapMode = this.mapMode;
|
|
6619
|
+
}
|
|
6620
|
+
|
|
6151
6621
|
this.mapMode = 'zoom';
|
|
6152
6622
|
}
|
|
6153
6623
|
|
|
@@ -6272,7 +6742,10 @@
|
|
|
6272
6742
|
var foundBBOXRib = false;
|
|
6273
6743
|
|
|
6274
6744
|
if (this.mouseDownPressed === 0) {
|
|
6275
|
-
if (this.resizingBBOXEnabled === '')
|
|
6745
|
+
if (this.resizingBBOXEnabled === '') {
|
|
6746
|
+
this.resizingBBOXCursor = getComputedStyle(this.baseDiv).cursor;
|
|
6747
|
+
} // Find left rib
|
|
6748
|
+
|
|
6276
6749
|
|
|
6277
6750
|
if (Math.abs(this.mouseX - tlpx.x) < 6 && this.mouseY > tlpx.y && this.mouseY < brpx.y) {
|
|
6278
6751
|
foundBBOXRib = true;
|
|
@@ -6332,10 +6805,21 @@
|
|
|
6332
6805
|
|
|
6333
6806
|
if (foundBBOXRib === true || this.resizingBBOXEnabled !== '' && this.mouseDownPressed === 1) {
|
|
6334
6807
|
if (this.mouseDownPressed === 1) {
|
|
6335
|
-
if (this.resizingBBOXEnabled === 'left')
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
|
|
6808
|
+
if (this.resizingBBOXEnabled === 'left') {
|
|
6809
|
+
tlpx.x = this.mouseX;
|
|
6810
|
+
}
|
|
6811
|
+
|
|
6812
|
+
if (this.resizingBBOXEnabled === 'top') {
|
|
6813
|
+
tlpx.y = this.mouseY;
|
|
6814
|
+
}
|
|
6815
|
+
|
|
6816
|
+
if (this.resizingBBOXEnabled === 'right') {
|
|
6817
|
+
brpx.x = this.mouseX;
|
|
6818
|
+
}
|
|
6819
|
+
|
|
6820
|
+
if (this.resizingBBOXEnabled === 'bottom') {
|
|
6821
|
+
brpx.y = this.mouseY;
|
|
6822
|
+
}
|
|
6339
6823
|
|
|
6340
6824
|
if (this.resizingBBOXEnabled === 'topleft') {
|
|
6341
6825
|
tlpx.x = this.mouseX;
|
|
@@ -6388,8 +6872,17 @@
|
|
|
6388
6872
|
|
|
6389
6873
|
this.mouseUpX = this.mouseX;
|
|
6390
6874
|
this.mouseUpY = this.mouseY;
|
|
6391
|
-
|
|
6392
|
-
if (this.
|
|
6875
|
+
|
|
6876
|
+
if (this.mapPanning === 0) {
|
|
6877
|
+
return;
|
|
6878
|
+
}
|
|
6879
|
+
|
|
6880
|
+
if (this.mouseDownPressed === 1) {
|
|
6881
|
+
if (this.mapMode === 'zoomout') {
|
|
6882
|
+
this.zoomOut();
|
|
6883
|
+
}
|
|
6884
|
+
}
|
|
6885
|
+
|
|
6393
6886
|
this.mouseDownPressed = 0;
|
|
6394
6887
|
|
|
6395
6888
|
if (this.mouseDragging === 1) {
|
|
@@ -6477,8 +6970,13 @@
|
|
|
6477
6970
|
|
|
6478
6971
|
|
|
6479
6972
|
WMJSMap.prototype._mouseDragStart = function (x, y) {
|
|
6480
|
-
if (this.mapMode === 'pan')
|
|
6481
|
-
|
|
6973
|
+
if (this.mapMode === 'pan') {
|
|
6974
|
+
this._mapPanStart(x, y);
|
|
6975
|
+
}
|
|
6976
|
+
|
|
6977
|
+
if (this.mapMode === 'zoom') {
|
|
6978
|
+
this._mapZoomStart();
|
|
6979
|
+
}
|
|
6482
6980
|
};
|
|
6483
6981
|
|
|
6484
6982
|
WMJSMap.prototype.mouseDrag = function (x, y) {
|
|
@@ -6488,15 +6986,30 @@
|
|
|
6488
6986
|
this.mouseDragging = 1;
|
|
6489
6987
|
}
|
|
6490
6988
|
|
|
6491
|
-
if (this.mapMode === 'pan')
|
|
6492
|
-
|
|
6989
|
+
if (this.mapMode === 'pan') {
|
|
6990
|
+
this._mapPan(x, y);
|
|
6991
|
+
}
|
|
6992
|
+
|
|
6993
|
+
if (this.mapMode === 'zoom') {
|
|
6994
|
+
this._mapZoom();
|
|
6995
|
+
}
|
|
6493
6996
|
};
|
|
6494
6997
|
|
|
6495
6998
|
WMJSMap.prototype.mouseDragEnd = function (x, y) {
|
|
6496
|
-
if (this.mouseDragging === 0)
|
|
6999
|
+
if (this.mouseDragging === 0) {
|
|
7000
|
+
return;
|
|
7001
|
+
}
|
|
7002
|
+
|
|
6497
7003
|
this.mouseDragging = 0;
|
|
6498
|
-
|
|
6499
|
-
if (this.mapMode === '
|
|
7004
|
+
|
|
7005
|
+
if (this.mapMode === 'pan') {
|
|
7006
|
+
this._mapPanEnd(x, y);
|
|
7007
|
+
}
|
|
7008
|
+
|
|
7009
|
+
if (this.mapMode === 'zoom') {
|
|
7010
|
+
this._mapZoomEnd();
|
|
7011
|
+
}
|
|
7012
|
+
|
|
6500
7013
|
this.callBack.triggerEvent('mapdragend', {
|
|
6501
7014
|
map: this,
|
|
6502
7015
|
x: this.mouseUpX,
|
|
@@ -6527,7 +7040,9 @@
|
|
|
6527
7040
|
};
|
|
6528
7041
|
|
|
6529
7042
|
WMJSMap.prototype._mapPan = function (x, y) {
|
|
6530
|
-
if (this.mapPanning === 0)
|
|
7043
|
+
if (this.mapPanning === 0) {
|
|
7044
|
+
return;
|
|
7045
|
+
}
|
|
6531
7046
|
|
|
6532
7047
|
if (this.mouseX < 0 || this.mouseY < 0 || this.mouseX > this.mainElement.clientWidth || this.mouseY > this.mainElement.clientHeight) {
|
|
6533
7048
|
this._mapPanEnd(x, y);
|
|
@@ -6555,7 +7070,11 @@
|
|
|
6555
7070
|
|
|
6556
7071
|
WMJSMap.prototype._mapPanEnd = function (x, y) {
|
|
6557
7072
|
this.baseDiv.style.cursor = 'default';
|
|
6558
|
-
|
|
7073
|
+
|
|
7074
|
+
if (this.mapPanning === 0) {
|
|
7075
|
+
return;
|
|
7076
|
+
}
|
|
7077
|
+
|
|
6559
7078
|
this.mapPanning = 0;
|
|
6560
7079
|
var mapPanGeoCoords = this.getGeoCoordFromPixelCoord({
|
|
6561
7080
|
x: x,
|
|
@@ -6609,7 +7128,10 @@
|
|
|
6609
7128
|
};
|
|
6610
7129
|
|
|
6611
7130
|
WMJSMap.prototype._mapZoom = function () {
|
|
6612
|
-
if (this.mapZooming === 0)
|
|
7131
|
+
if (this.mapZooming === 0) {
|
|
7132
|
+
return;
|
|
7133
|
+
}
|
|
7134
|
+
|
|
6613
7135
|
var x = this.mouseX - this.mouseDownX;
|
|
6614
7136
|
var y = this.mouseY - this.mouseDownY;
|
|
6615
7137
|
|
|
@@ -6626,12 +7148,16 @@
|
|
|
6626
7148
|
if (w < 0) {
|
|
6627
7149
|
w = -w;
|
|
6628
7150
|
this.divZoomBox.style.left = this.mouseX + "px";
|
|
6629
|
-
} else
|
|
7151
|
+
} else {
|
|
7152
|
+
this.divZoomBox.style.left = this.mouseDownX + "px";
|
|
7153
|
+
}
|
|
6630
7154
|
|
|
6631
7155
|
if (h < 0) {
|
|
6632
7156
|
h = -h;
|
|
6633
7157
|
this.divZoomBox.style.top = this.mouseY + "px";
|
|
6634
|
-
} else
|
|
7158
|
+
} else {
|
|
7159
|
+
this.divZoomBox.style.top = this.mouseDownY + "px";
|
|
7160
|
+
}
|
|
6635
7161
|
|
|
6636
7162
|
this.divZoomBox.style.width = w + "px";
|
|
6637
7163
|
this.divZoomBox.style.height = h + "px";
|
|
@@ -6641,10 +7167,18 @@
|
|
|
6641
7167
|
var x = this.mouseUpX - this.mouseDownX;
|
|
6642
7168
|
var y = this.mouseUpY - this.mouseDownY;
|
|
6643
7169
|
this.baseDiv.style.cursor = 'default';
|
|
6644
|
-
|
|
7170
|
+
|
|
7171
|
+
if (this.mapZooming === 0) {
|
|
7172
|
+
return;
|
|
7173
|
+
}
|
|
7174
|
+
|
|
6645
7175
|
this.mapZooming = 0;
|
|
6646
7176
|
this.divZoomBox.style.display = 'none';
|
|
6647
|
-
|
|
7177
|
+
|
|
7178
|
+
if (x < 0 && y < 0) {
|
|
7179
|
+
return;
|
|
7180
|
+
}
|
|
7181
|
+
|
|
6648
7182
|
var zoomBBOXPixels = new WMBBOX();
|
|
6649
7183
|
|
|
6650
7184
|
if (x < 0) {
|
|
@@ -6718,7 +7252,10 @@
|
|
|
6718
7252
|
ratio = 1;
|
|
6719
7253
|
}
|
|
6720
7254
|
|
|
6721
|
-
if (ratio < 0)
|
|
7255
|
+
if (ratio < 0) {
|
|
7256
|
+
ratio = -ratio;
|
|
7257
|
+
}
|
|
7258
|
+
|
|
6722
7259
|
var screenRatio = this.width / this.height; // Is W > H?
|
|
6723
7260
|
|
|
6724
7261
|
if (ratio > screenRatio) {
|
|
@@ -6765,8 +7302,14 @@
|
|
|
6765
7302
|
|
|
6766
7303
|
WMJSMap.prototype.getGeoCoordFromPixelCoord = function (coordinates, _bbox) {
|
|
6767
7304
|
var mybbox = this.bbox;
|
|
6768
|
-
|
|
6769
|
-
if (
|
|
7305
|
+
|
|
7306
|
+
if (_bbox) {
|
|
7307
|
+
mybbox = _bbox;
|
|
7308
|
+
}
|
|
7309
|
+
|
|
7310
|
+
if (!isDefined(coordinates)) {
|
|
7311
|
+
return undefined;
|
|
7312
|
+
}
|
|
6770
7313
|
|
|
6771
7314
|
try {
|
|
6772
7315
|
var lon = coordinates.x / this.width * (mybbox.right - mybbox.left) + mybbox.left;
|
|
@@ -6888,9 +7431,19 @@
|
|
|
6888
7431
|
var w = this.width;
|
|
6889
7432
|
var h = this.height;
|
|
6890
7433
|
var b = this.updateBBOX;
|
|
6891
|
-
|
|
6892
|
-
if (isDefined(
|
|
6893
|
-
|
|
7434
|
+
|
|
7435
|
+
if (isDefined(_width)) {
|
|
7436
|
+
w = _width;
|
|
7437
|
+
}
|
|
7438
|
+
|
|
7439
|
+
if (isDefined(_height)) {
|
|
7440
|
+
h = _height;
|
|
7441
|
+
}
|
|
7442
|
+
|
|
7443
|
+
if (isDefined(_bbox)) {
|
|
7444
|
+
b = _bbox;
|
|
7445
|
+
}
|
|
7446
|
+
|
|
6894
7447
|
var x = w * (coordinates.x - b.left) / (b.right - b.left);
|
|
6895
7448
|
var y = h * (coordinates.y - b.top) / (b.bottom - b.top);
|
|
6896
7449
|
return {
|
|
@@ -6909,7 +7462,10 @@
|
|
|
6909
7462
|
};
|
|
6910
7463
|
|
|
6911
7464
|
WMJSMap.prototype.removeListener = function (name, f) {
|
|
6912
|
-
if (this.isDestroyed)
|
|
7465
|
+
if (this.isDestroyed) {
|
|
7466
|
+
return;
|
|
7467
|
+
}
|
|
7468
|
+
|
|
6913
7469
|
this.callBack.removeEvents(name, f);
|
|
6914
7470
|
};
|
|
6915
7471
|
|
|
@@ -7063,7 +7619,10 @@
|
|
|
7063
7619
|
this.WMProjectionUndo[0].bbox.setBBOX(this.bbox);
|
|
7064
7620
|
this.WMProjectionUndo[0].srs = this.srs;
|
|
7065
7621
|
this.NrOfUndos += 1;
|
|
7066
|
-
|
|
7622
|
+
|
|
7623
|
+
if (this.NrOfUndos > this.MaxUndos) {
|
|
7624
|
+
this.NrOfUndos = this.MaxUndos;
|
|
7625
|
+
}
|
|
7067
7626
|
}
|
|
7068
7627
|
|
|
7069
7628
|
this.DoRedo = 0;
|
|
@@ -7088,7 +7647,9 @@
|
|
|
7088
7647
|
|
|
7089
7648
|
if (isDefined(ratio) === false) {
|
|
7090
7649
|
ratio = 1;
|
|
7091
|
-
} else if (ratio === 0)
|
|
7650
|
+
} else if (ratio === 0) {
|
|
7651
|
+
return;
|
|
7652
|
+
}
|
|
7092
7653
|
|
|
7093
7654
|
a *= ratio;
|
|
7094
7655
|
this.zoomTo(new WMBBOX(this.resizeBBOX.left - a, this.resizeBBOX.bottom - a, this.resizeBBOX.right + a, this.resizeBBOX.top + a));
|
|
@@ -7107,9 +7668,16 @@
|
|
|
7107
7668
|
this.divBoundingBox.displayed = true;
|
|
7108
7669
|
}
|
|
7109
7670
|
|
|
7110
|
-
if (this.divBoundingBox.displayed !== true)
|
|
7671
|
+
if (this.divBoundingBox.displayed !== true) {
|
|
7672
|
+
return;
|
|
7673
|
+
}
|
|
7674
|
+
|
|
7111
7675
|
var b = this.bbox;
|
|
7112
|
-
|
|
7676
|
+
|
|
7677
|
+
if (isDefined(_mapbbox)) {
|
|
7678
|
+
b = _mapbbox;
|
|
7679
|
+
}
|
|
7680
|
+
|
|
7113
7681
|
var coord1 = this.getPixelCoordFromGeoCoord({
|
|
7114
7682
|
x: this.divBoundingBox.bbox.left,
|
|
7115
7683
|
y: this.divBoundingBox.bbox.top
|
|
@@ -7748,7 +8316,10 @@
|
|
|
7748
8316
|
|
|
7749
8317
|
|
|
7750
8318
|
var headers = [];
|
|
7751
|
-
|
|
8319
|
+
|
|
8320
|
+
if (options && options.headers) {
|
|
8321
|
+
headers = options.headers;
|
|
8322
|
+
}
|
|
7752
8323
|
|
|
7753
8324
|
if (!isDefined(service)) {
|
|
7754
8325
|
fail(I18n.no_service_defined.text);
|
|
@@ -7850,7 +8421,10 @@
|
|
|
7850
8421
|
WMJSService.prototype.checkVersion111 = function (jsonData) {
|
|
7851
8422
|
try {
|
|
7852
8423
|
var rootLayer = jsonData.WMT_MS_Capabilities.Capability.Layer;
|
|
7853
|
-
|
|
8424
|
+
|
|
8425
|
+
if (!rootLayer) {
|
|
8426
|
+
throw new Error('No 111 layer');
|
|
8427
|
+
}
|
|
7854
8428
|
} catch (e) {
|
|
7855
8429
|
var message = this.checkException(jsonData);
|
|
7856
8430
|
|
|
@@ -7871,7 +8445,10 @@
|
|
|
7871
8445
|
WMJSService.prototype.checkVersion130 = function (jsonData) {
|
|
7872
8446
|
try {
|
|
7873
8447
|
var rootLayer = jsonData.WMS_Capabilities.Capability.Layer;
|
|
7874
|
-
|
|
8448
|
+
|
|
8449
|
+
if (!rootLayer) {
|
|
8450
|
+
throw new Error('No 130 layer');
|
|
8451
|
+
}
|
|
7875
8452
|
} catch (e) {
|
|
7876
8453
|
var message = this.checkException(jsonData);
|
|
7877
8454
|
|
|
@@ -7910,14 +8487,30 @@
|
|
|
7910
8487
|
var version = null;
|
|
7911
8488
|
|
|
7912
8489
|
try {
|
|
7913
|
-
if (WMSVersion.version100 === jsonData.WMT_MS_Capabilities.attr.version)
|
|
7914
|
-
|
|
7915
|
-
|
|
8490
|
+
if (WMSVersion.version100 === jsonData.WMT_MS_Capabilities.attr.version) {
|
|
8491
|
+
version = WMSVersion.version100;
|
|
8492
|
+
}
|
|
8493
|
+
|
|
8494
|
+
if (WMSVersion.version111 === jsonData.WMT_MS_Capabilities.attr.version) {
|
|
8495
|
+
version = WMSVersion.version111;
|
|
8496
|
+
}
|
|
8497
|
+
|
|
8498
|
+
if (WMSVersion.version130 === jsonData.WMT_MS_Capabilities.attr.version) {
|
|
8499
|
+
version = WMSVersion.version130;
|
|
8500
|
+
}
|
|
7916
8501
|
} catch (e) {
|
|
7917
8502
|
try {
|
|
7918
|
-
if (WMSVersion.version100 === jsonData.WMS_Capabilities.attr.version)
|
|
7919
|
-
|
|
7920
|
-
|
|
8503
|
+
if (WMSVersion.version100 === jsonData.WMS_Capabilities.attr.version) {
|
|
8504
|
+
version = WMSVersion.version100;
|
|
8505
|
+
}
|
|
8506
|
+
|
|
8507
|
+
if (WMSVersion.version111 === jsonData.WMS_Capabilities.attr.version) {
|
|
8508
|
+
version = WMSVersion.version111;
|
|
8509
|
+
}
|
|
8510
|
+
|
|
8511
|
+
if (WMSVersion.version130 === jsonData.WMS_Capabilities.attr.version) {
|
|
8512
|
+
version = WMSVersion.version130;
|
|
8513
|
+
}
|
|
7921
8514
|
} catch (_a) {
|
|
7922
8515
|
var message = this.checkException(jsonData);
|
|
7923
8516
|
|
|
@@ -8025,7 +8618,8 @@
|
|
|
8025
8618
|
if (WMSCapabilities.Service.OnlineResource.value) {
|
|
8026
8619
|
_this.onlineresource = WMSCapabilities.Service.OnlineResource.value;
|
|
8027
8620
|
} else {
|
|
8028
|
-
_this.onlineresource =
|
|
8621
|
+
_this.onlineresource = // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8622
|
+
WMSCapabilities.Service.OnlineResource.attr['xlink:href'];
|
|
8029
8623
|
}
|
|
8030
8624
|
} catch (e) {
|
|
8031
8625
|
_this.onlineresource = I18n.not_available_message.text;
|
|
@@ -8061,7 +8655,9 @@
|
|
|
8061
8655
|
|
|
8062
8656
|
if (se) {
|
|
8063
8657
|
try {
|
|
8064
|
-
if (se.attr.code)
|
|
8658
|
+
if (se.attr.code) {
|
|
8659
|
+
code = se.attr.code;
|
|
8660
|
+
}
|
|
8065
8661
|
} catch (e) {// do nothing
|
|
8066
8662
|
}
|
|
8067
8663
|
|
|
@@ -8087,8 +8683,6 @@
|
|
|
8087
8683
|
WMJSService.prototype.getNodes = function (succes, failure, forceReload, options) {
|
|
8088
8684
|
var _this = this;
|
|
8089
8685
|
|
|
8090
|
-
this.nodeCache = undefined;
|
|
8091
|
-
|
|
8092
8686
|
if (!failure) {
|
|
8093
8687
|
// eslint-disable-next-line no-param-reassign
|
|
8094
8688
|
failure = function failure(msg) {
|
|
@@ -8403,9 +8997,18 @@
|
|
|
8403
8997
|
this.getmapURL = options.service;
|
|
8404
8998
|
this.getfeatureinfoURL = options.service;
|
|
8405
8999
|
this.getlegendgraphicURL = options.service;
|
|
8406
|
-
|
|
9000
|
+
|
|
9001
|
+
if (options.active === true) {
|
|
9002
|
+
this.active = true;
|
|
9003
|
+
} else {
|
|
9004
|
+
this.active = false;
|
|
9005
|
+
}
|
|
9006
|
+
|
|
8407
9007
|
this.name = options.name;
|
|
8408
|
-
|
|
9008
|
+
|
|
9009
|
+
if (options.getgraphinfoURL) {
|
|
9010
|
+
this.getgraphinfoURL = options.getgraphinfoURL;
|
|
9011
|
+
}
|
|
8409
9012
|
|
|
8410
9013
|
if (options.style) {
|
|
8411
9014
|
this.currentStyle = options.style;
|
|
@@ -8423,16 +9026,29 @@
|
|
|
8423
9026
|
this.id = options.id;
|
|
8424
9027
|
}
|
|
8425
9028
|
|
|
8426
|
-
if (options.format)
|
|
9029
|
+
if (options.format) {
|
|
9030
|
+
this.format = options.format;
|
|
9031
|
+
} else {
|
|
9032
|
+
this.format = 'image/png';
|
|
9033
|
+
}
|
|
8427
9034
|
|
|
8428
9035
|
if (isDefined(options.opacity)) {
|
|
8429
9036
|
this.opacity = options.opacity;
|
|
8430
9037
|
}
|
|
8431
9038
|
|
|
8432
|
-
if (options.title)
|
|
9039
|
+
if (options.title) {
|
|
9040
|
+
this.title = options.title;
|
|
9041
|
+
}
|
|
9042
|
+
|
|
8433
9043
|
this["abstract"] = I18n.not_available_message.text;
|
|
8434
|
-
|
|
8435
|
-
if (options.
|
|
9044
|
+
|
|
9045
|
+
if (options.enabled === false) {
|
|
9046
|
+
this.enabled = false;
|
|
9047
|
+
}
|
|
9048
|
+
|
|
9049
|
+
if (options.keepOnTop === true) {
|
|
9050
|
+
this.keepOnTop = true;
|
|
9051
|
+
}
|
|
8436
9052
|
|
|
8437
9053
|
if (options.transparent === false) {
|
|
8438
9054
|
this.transparent = false;
|
|
@@ -8614,11 +9230,18 @@
|
|
|
8614
9230
|
updateMapDimensions = true;
|
|
8615
9231
|
}
|
|
8616
9232
|
|
|
8617
|
-
if (!isDefined(value))
|
|
9233
|
+
if (!isDefined(value)) {
|
|
9234
|
+
return;
|
|
9235
|
+
}
|
|
9236
|
+
|
|
8618
9237
|
var dimIndex = this.dimensions.findIndex(function (dim) {
|
|
8619
9238
|
return dim.name === name;
|
|
8620
9239
|
});
|
|
8621
|
-
|
|
9240
|
+
|
|
9241
|
+
if (dimIndex < 0) {
|
|
9242
|
+
return;
|
|
9243
|
+
}
|
|
9244
|
+
|
|
8622
9245
|
var dim = this.dimensions[dimIndex];
|
|
8623
9246
|
dim.setValue(value);
|
|
8624
9247
|
this.handleReferenceTime(name, value, updateMapDimensions);
|
|
@@ -8674,8 +9297,13 @@
|
|
|
8674
9297
|
var serverFormats = capabilityObject.Request.GetMap.Format;
|
|
8675
9298
|
|
|
8676
9299
|
for (var f = 0; f < serverFormats.length; f += 1) {
|
|
8677
|
-
if (serverFormats[f].value.indexOf('24') > 0)
|
|
8678
|
-
|
|
9300
|
+
if (serverFormats[f].value.indexOf('24') > 0) {
|
|
9301
|
+
this.optimalFormat = serverFormats[f].value;
|
|
9302
|
+
}
|
|
9303
|
+
|
|
9304
|
+
if (serverFormats[f].value.indexOf('32') > 0) {
|
|
9305
|
+
this.optimalFormat = serverFormats[f].value;
|
|
9306
|
+
}
|
|
8679
9307
|
}
|
|
8680
9308
|
} catch (e) {
|
|
8681
9309
|
debug(exports.DebugType.Error, 'This WMS service has no getmap formats listed: using image/png');
|
|
@@ -8983,10 +9611,22 @@
|
|
|
8983
9611
|
|
|
8984
9612
|
for (var j = 0; j < this.styles.length; j += 1) {
|
|
8985
9613
|
if (this.styles[j].name === styleName) {
|
|
8986
|
-
if (nextPrev === -1)
|
|
8987
|
-
|
|
8988
|
-
|
|
8989
|
-
|
|
9614
|
+
if (nextPrev === -1) {
|
|
9615
|
+
j -= 1;
|
|
9616
|
+
}
|
|
9617
|
+
|
|
9618
|
+
if (nextPrev === 1) {
|
|
9619
|
+
j += 1;
|
|
9620
|
+
}
|
|
9621
|
+
|
|
9622
|
+
if (j < 0) {
|
|
9623
|
+
j = this.styles.length - 1;
|
|
9624
|
+
}
|
|
9625
|
+
|
|
9626
|
+
if (j > this.styles.length - 1) {
|
|
9627
|
+
j = 0;
|
|
9628
|
+
}
|
|
9629
|
+
|
|
8990
9630
|
return this.styles[j];
|
|
8991
9631
|
}
|
|
8992
9632
|
}
|
|
@@ -9006,7 +9646,11 @@
|
|
|
9006
9646
|
var dimIndex = this.dimensions.findIndex(function (dim) {
|
|
9007
9647
|
return dim.name === name;
|
|
9008
9648
|
});
|
|
9009
|
-
|
|
9649
|
+
|
|
9650
|
+
if (dimIndex < 0) {
|
|
9651
|
+
return undefined;
|
|
9652
|
+
}
|
|
9653
|
+
|
|
9010
9654
|
return this.dimensions[dimIndex];
|
|
9011
9655
|
};
|
|
9012
9656
|
/**
|