@opengeoweb/webmap 9.10.1 → 9.11.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 +374 -187
- package/package.json +1 -1
- package/src/lib/components/WMAnimate.d.ts +0 -1
- package/src/lib/components/WMCanvasBuffer.d.ts +7 -4
- package/src/lib/components/WMConstants.d.ts +2 -0
- package/src/lib/components/WMImageStore.d.ts +0 -1
- package/src/lib/components/WMJSMap.d.ts +4 -1
- package/src/lib/components/WMJSService.d.ts +2 -0
- package/src/lib/components/WMJSTools.d.ts +1 -1
- package/src/lib/components/WMLayer.d.ts +1 -1
- package/src/lib/components/WMListener.d.ts +47 -11
- package/src/lib/components/WMListener.spec.d.ts +1 -0
- package/src/lib/components/index.d.ts +4 -4
- package/src/lib/components/types.d.ts +1 -1
- package/src/lib/utils/index.d.ts +3 -0
- package/src/lib/utils/mapConstants.d.ts +7 -0
- package/src/lib/utils/utils.d.ts +10 -0
package/index.esm.js
CHANGED
|
@@ -463,52 +463,6 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
|
463
463
|
};
|
|
464
464
|
}
|
|
465
465
|
|
|
466
|
-
/* *
|
|
467
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
468
|
-
* you may not use this file except in compliance with the License.
|
|
469
|
-
* You may obtain a copy of the License at
|
|
470
|
-
*
|
|
471
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
472
|
-
*
|
|
473
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
474
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
475
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
476
|
-
* See the License for the specific language governing permissions and
|
|
477
|
-
* limitations under the License.
|
|
478
|
-
*
|
|
479
|
-
* Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
480
|
-
* Copyright 2020 - Finnish Meteorological Institute (FMI)
|
|
481
|
-
* */
|
|
482
|
-
var WMEmptyLayerName = 'empty_layer';
|
|
483
|
-
var WMEmptyLayerTitle = 'empty layer';
|
|
484
|
-
var WMDateOutSideRange = 'outside range';
|
|
485
|
-
var WMDateTooEarlyString = 'date too early';
|
|
486
|
-
var WMDateTooLateString = 'date too late';
|
|
487
|
-
var WMSVersion = {
|
|
488
|
-
version100: '1.0.0',
|
|
489
|
-
version111: '1.1.1',
|
|
490
|
-
version130: '1.3.0'
|
|
491
|
-
};
|
|
492
|
-
var WMProj4Defs = [['EPSG:4326', '+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees'], ['EPSG:4269', '+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees'], ['EPSG:3575', '+proj=laea +lat_0=90 +lon_0=10 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs'], ['EPSG:3785', '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs'], ['EPSG:3857', '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs'], ['EPSG:3411', '+proj=stere +lat_0=90 +lat_ts=70 +lon_0=-45 +k=1 +x_0=0 +y_0=0 +a=6378273 +b=6356889.449 +units=m +no_defs'], ['EPSG:3412', '+proj=stere +lat_0=-90 +lat_ts=-70 +lon_0=0 +k=1 +x_0=0 +y_0=0 +a=6378273 +b=6356889.449 +units=m +no_defs'], ['EPSG:28992', '+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +units=m +no_defs <>'], ['EPSG:32661', '+proj=stere +lat_0=90 +lat_ts=90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +ellps=WGS84 +datum=WGS84 +units=m +no_defs'], ['EPSG:102100', '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs'], ['EPSG:3067', '+proj=utm +zone=35 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs']];
|
|
493
|
-
var epsgDescriptionLookup = {
|
|
494
|
-
'EPSG:3411': 'NSIDC Sea Ice Polar Stereographic North',
|
|
495
|
-
'EPSG:3412': 'NSIDC Sea Ice Polar Stereographic South',
|
|
496
|
-
'EPSG:3575': 'Lambert azimuthal equal-area projection Europe',
|
|
497
|
-
'EPSG:3785': 'Mercator (deprecated)',
|
|
498
|
-
'EPSG:3857': 'Mercator',
|
|
499
|
-
'EPSG:4258': 'ETRS89',
|
|
500
|
-
'EPSG:4326': 'World Lat lon WGS84',
|
|
501
|
-
'CRS:84': 'World Lat lon WGS84',
|
|
502
|
-
'EPSG:25831': 'ETRS89 / UTM zone 31N',
|
|
503
|
-
'EPSG:25832': 'ETRS89 / UTM zone 32N',
|
|
504
|
-
'EPSG:28992': 'Dutch Amersfoort / RD New',
|
|
505
|
-
'EPSG:32661': 'Polar Stereographic WGS 84 / UPS North',
|
|
506
|
-
'EPSG:3067': 'ETRS89 / TM35FIN(E,N) -- Finland'
|
|
507
|
-
};
|
|
508
|
-
var mapImageStoreLength = 1000;
|
|
509
|
-
var bgImageStoreLength = 360;
|
|
510
|
-
var legendImageStoreLength = 500;
|
|
511
|
-
|
|
512
466
|
/******************************************************************************
|
|
513
467
|
Copyright (c) Microsoft Corporation.
|
|
514
468
|
|
|
@@ -557,6 +511,54 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
557
511
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
558
512
|
};
|
|
559
513
|
|
|
514
|
+
/* *
|
|
515
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
516
|
+
* you may not use this file except in compliance with the License.
|
|
517
|
+
* You may obtain a copy of the License at
|
|
518
|
+
*
|
|
519
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
520
|
+
*
|
|
521
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
522
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
523
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
524
|
+
* See the License for the specific language governing permissions and
|
|
525
|
+
* limitations under the License.
|
|
526
|
+
*
|
|
527
|
+
* Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
528
|
+
* Copyright 2020 - Finnish Meteorological Institute (FMI)
|
|
529
|
+
* */
|
|
530
|
+
var WMEmptyLayerName = 'empty_layer';
|
|
531
|
+
var WMEmptyLayerTitle = 'empty layer';
|
|
532
|
+
var WMDateOutSideRange = 'outside range';
|
|
533
|
+
var WMDateTooEarlyString = 'date too early';
|
|
534
|
+
var WMDateTooLateString = 'date too late';
|
|
535
|
+
var WMSVersion = {
|
|
536
|
+
version100: '1.0.0',
|
|
537
|
+
version111: '1.1.1',
|
|
538
|
+
version130: '1.3.0'
|
|
539
|
+
};
|
|
540
|
+
var WMProj4Defs = [['EPSG:4326', '+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees'], ['EPSG:4269', '+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees'], ['EPSG:3575', '+proj=laea +lat_0=90 +lon_0=10 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs'], ['EPSG:3785', '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs'], ['EPSG:3857', '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs'], ['EPSG:3411', '+proj=stere +lat_0=90 +lat_ts=70 +lon_0=-45 +k=1 +x_0=0 +y_0=0 +a=6378273 +b=6356889.449 +units=m +no_defs'], ['EPSG:3412', '+proj=stere +lat_0=-90 +lat_ts=-70 +lon_0=0 +k=1 +x_0=0 +y_0=0 +a=6378273 +b=6356889.449 +units=m +no_defs'], ['EPSG:28992', '+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +units=m +no_defs <>'], ['EPSG:32661', '+proj=stere +lat_0=90 +lat_ts=90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +ellps=WGS84 +datum=WGS84 +units=m +no_defs'], ['EPSG:102100', '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs'], ['EPSG:3067', '+proj=utm +zone=35 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs']];
|
|
541
|
+
var epsgDescriptionLookup = {
|
|
542
|
+
'EPSG:3411': 'NSIDC Sea Ice Polar Stereographic North',
|
|
543
|
+
'EPSG:3412': 'NSIDC Sea Ice Polar Stereographic South',
|
|
544
|
+
'EPSG:3575': 'Lambert azimuthal equal-area projection Europe',
|
|
545
|
+
'EPSG:3785': 'Mercator (deprecated)',
|
|
546
|
+
'EPSG:3857': 'Mercator',
|
|
547
|
+
'EPSG:4258': 'ETRS89',
|
|
548
|
+
'EPSG:4326': 'World Lat lon WGS84',
|
|
549
|
+
'CRS:84': 'World Lat lon WGS84',
|
|
550
|
+
'EPSG:25831': 'ETRS89 / UTM zone 31N',
|
|
551
|
+
'EPSG:25832': 'ETRS89 / UTM zone 32N',
|
|
552
|
+
'EPSG:28992': 'Dutch Amersfoort / RD New',
|
|
553
|
+
'EPSG:32661': 'Polar Stereographic WGS 84 / UPS North',
|
|
554
|
+
'EPSG:3067': 'ETRS89 / TM35FIN(E,N) -- Finland'
|
|
555
|
+
};
|
|
556
|
+
var mapImageStoreLength = 1000;
|
|
557
|
+
var bgImageStoreLength = 360;
|
|
558
|
+
var legendImageStoreLength = 500;
|
|
559
|
+
var EVENT_GETCAPABILITIES_START = 'onstartgetcapabilities';
|
|
560
|
+
var EVENT_GETCAPABILITIES_READY = 'onreadygetcapabilities';
|
|
561
|
+
|
|
560
562
|
/* debug helper */
|
|
561
563
|
var enableConsoleDebugging = false;
|
|
562
564
|
var DebugType;
|
|
@@ -779,7 +781,7 @@ var dateToISO8601 = function dateToISO8601(date) {
|
|
|
779
781
|
return iso;
|
|
780
782
|
};
|
|
781
783
|
/**
|
|
782
|
-
* Helper function to figure out the styles from the WMS layer object from the WMS
|
|
784
|
+
* Helper function to figure out the styles from the WMS layer object from the WMS GetCapabilities document
|
|
783
785
|
* @param layerObjectFromWMS The layer object from the WMS GetCapabilities JSON document
|
|
784
786
|
* @returns Style[] Array of style objects.
|
|
785
787
|
*/
|
|
@@ -1486,9 +1488,6 @@ var WMImageStore = /*#__PURE__*/function () {
|
|
|
1486
1488
|
}]);
|
|
1487
1489
|
return WMImageStore;
|
|
1488
1490
|
}();
|
|
1489
|
-
var getMapImageStore = new WMImageStore(mapImageStoreLength, {
|
|
1490
|
-
id: 'getMapImageStore'
|
|
1491
|
-
});
|
|
1492
1491
|
|
|
1493
1492
|
/* *
|
|
1494
1493
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -1623,142 +1622,204 @@ var WMProjection = /*#__PURE__*/_createClass(function WMProjection() {
|
|
|
1623
1622
|
this.srs = 'EPSG:4326';
|
|
1624
1623
|
});
|
|
1625
1624
|
|
|
1626
|
-
var CallBackFunction = /*#__PURE__*/_createClass(function CallBackFunction() {
|
|
1627
|
-
_classCallCheck(this, CallBackFunction);
|
|
1628
|
-
this.name = undefined;
|
|
1629
|
-
this.functionpointer = undefined;
|
|
1630
|
-
this.finished = 0;
|
|
1631
|
-
this.keepOnCall = false;
|
|
1632
|
-
});
|
|
1633
1625
|
var WMListener = /*#__PURE__*/function () {
|
|
1634
1626
|
function WMListener() {
|
|
1635
1627
|
_classCallCheck(this, WMListener);
|
|
1636
|
-
this.
|
|
1637
|
-
this.
|
|
1638
|
-
this.
|
|
1639
|
-
this.
|
|
1628
|
+
this.addEventListener = this.addEventListener.bind(this);
|
|
1629
|
+
this.removeEventListener = this.removeEventListener.bind(this);
|
|
1630
|
+
this.removeEventListeners = this.removeEventListeners.bind(this);
|
|
1631
|
+
this.triggerEvent = this.triggerEvent.bind(this);
|
|
1632
|
+
this.destroy = this.destroy.bind(this);
|
|
1640
1633
|
this.suspendEvent = this.suspendEvent.bind(this);
|
|
1641
1634
|
this.resumeEvent = this.resumeEvent.bind(this);
|
|
1642
1635
|
this.suspendEvents = this.suspendEvents.bind(this);
|
|
1643
1636
|
this.resumeEvents = this.resumeEvents.bind(this);
|
|
1644
|
-
|
|
1645
|
-
this.
|
|
1646
|
-
this.
|
|
1637
|
+
// Deprecated routines:
|
|
1638
|
+
this.removeEvents = this.removeEvents.bind(this);
|
|
1639
|
+
this._suspendAllEvents = false;
|
|
1640
|
+
this.registeredEvents = new Map();
|
|
1641
|
+
this._suspendedEvents = new Map();
|
|
1647
1642
|
}
|
|
1648
|
-
|
|
1643
|
+
/**
|
|
1644
|
+
* Remove events by name and function.
|
|
1645
|
+
* @param name Event name
|
|
1646
|
+
* @param f Function pointer to check
|
|
1647
|
+
*/
|
|
1649
1648
|
_createClass(WMListener, [{
|
|
1650
|
-
key: "
|
|
1651
|
-
value: function
|
|
1652
|
-
|
|
1653
|
-
var cbp = -1; /* callbackpointer */
|
|
1654
|
-
for (var j = 0; j < this._callBacks.length; j += 1) {
|
|
1655
|
-
// A callback list index pointer. if finished==1, then this index may be replaced by a new one.
|
|
1656
|
-
if (this._callBacks[j].finished === 1) {
|
|
1657
|
-
cbp = j;
|
|
1658
|
-
break;
|
|
1659
|
-
}
|
|
1660
|
-
// If the current callback already exist, we will simply keep it
|
|
1661
|
-
if (this._callBacks[j].name === name && this._callBacks[j].functionpointer === functionpointer) {
|
|
1662
|
-
this._callBacks[j].keepOnCall = keepOnCall;
|
|
1663
|
-
return false;
|
|
1664
|
-
}
|
|
1665
|
-
}
|
|
1666
|
-
if (cbp === -1) {
|
|
1667
|
-
cbp = this._callBacks.length;
|
|
1668
|
-
this._callBacks.push(new CallBackFunction());
|
|
1669
|
-
}
|
|
1670
|
-
this._callBacks[cbp].name = name;
|
|
1671
|
-
this._callBacks[cbp].functionpointer = functionpointer;
|
|
1672
|
-
this._callBacks[cbp].finished = 0;
|
|
1673
|
-
this._callBacks[cbp].keepOnCall = keepOnCall;
|
|
1674
|
-
return true;
|
|
1649
|
+
key: "removeEventListener",
|
|
1650
|
+
value: function removeEventListener(name, f) {
|
|
1651
|
+
return this.removeEvents(name, f);
|
|
1675
1652
|
}
|
|
1653
|
+
/**
|
|
1654
|
+
* Remove all events by name
|
|
1655
|
+
* @param name Event name
|
|
1656
|
+
*/
|
|
1676
1657
|
}, {
|
|
1677
|
-
key: "
|
|
1678
|
-
value: function
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1658
|
+
key: "removeEventListeners",
|
|
1659
|
+
value: function removeEventListeners(name) {
|
|
1660
|
+
return this.removeEvents(name);
|
|
1661
|
+
}
|
|
1662
|
+
/**
|
|
1663
|
+
* Add multiple functions which will be called after the event with the same name is triggered
|
|
1664
|
+
* @param name: The name of the event to register
|
|
1665
|
+
* @param function: The function to trigger
|
|
1666
|
+
* @param keepOnCall: When false, this event name and function combination is removed once triggered.
|
|
1667
|
+
* When true Otherwise keep the event and allow it to be triggered multiple times
|
|
1668
|
+
* @return: true if the event is registerd, false if it already was registered
|
|
1669
|
+
*/
|
|
1670
|
+
}, {
|
|
1671
|
+
key: "addEventListener",
|
|
1672
|
+
value: function addEventListener(name, functionpointer) {
|
|
1673
|
+
var keepOnCall = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
1674
|
+
var events = this.registeredEvents.get(name);
|
|
1675
|
+
// This event name has no function callbacks associated, just add it.
|
|
1676
|
+
if (!events || (events === null || events === void 0 ? void 0 : events.length) === 0) {
|
|
1677
|
+
this.registeredEvents.set(name, [{
|
|
1678
|
+
name: name,
|
|
1679
|
+
functionpointer: functionpointer,
|
|
1680
|
+
keepOnCall: keepOnCall,
|
|
1681
|
+
finished: 0
|
|
1682
|
+
}]);
|
|
1683
|
+
return true;
|
|
1684
|
+
}
|
|
1685
|
+
// Check if this function callback was already associated. If so, do nothing.
|
|
1686
|
+
if ((events === null || events === void 0 ? void 0 : events.findIndex(function (c) {
|
|
1687
|
+
return c.functionpointer === functionpointer;
|
|
1688
|
+
})) !== -1) {
|
|
1689
|
+
return false;
|
|
1698
1690
|
}
|
|
1691
|
+
events.push({
|
|
1692
|
+
name: name,
|
|
1693
|
+
functionpointer: functionpointer,
|
|
1694
|
+
keepOnCall: keepOnCall,
|
|
1695
|
+
finished: 0
|
|
1696
|
+
});
|
|
1697
|
+
return true;
|
|
1699
1698
|
}
|
|
1699
|
+
/**
|
|
1700
|
+
* Destroys this listener, deregistering all events
|
|
1701
|
+
*/
|
|
1700
1702
|
}, {
|
|
1701
1703
|
key: "destroy",
|
|
1702
1704
|
value: function destroy() {
|
|
1703
|
-
this.
|
|
1705
|
+
this.registeredEvents.clear();
|
|
1704
1706
|
}
|
|
1707
|
+
/**
|
|
1708
|
+
* Suspend a specific event by name, triggers will not be called
|
|
1709
|
+
* @param name
|
|
1710
|
+
*/
|
|
1705
1711
|
}, {
|
|
1706
1712
|
key: "suspendEvent",
|
|
1707
1713
|
value: function suspendEvent(name) {
|
|
1708
|
-
|
|
1709
|
-
this._suspendedEvents[name] = true;
|
|
1714
|
+
this._suspendedEvents.set(name, true);
|
|
1710
1715
|
}
|
|
1716
|
+
/**
|
|
1717
|
+
* Resume a specific event by name, resuming normal operation
|
|
1718
|
+
* @param name
|
|
1719
|
+
*/
|
|
1711
1720
|
}, {
|
|
1712
1721
|
key: "resumeEvent",
|
|
1713
1722
|
value: function resumeEvent(name) {
|
|
1714
|
-
|
|
1715
|
-
this._suspendedEvents[name] = false;
|
|
1723
|
+
this._suspendedEvents.set(name, false);
|
|
1716
1724
|
}
|
|
1725
|
+
/**
|
|
1726
|
+
* This listener will not listen to any triggers
|
|
1727
|
+
*/
|
|
1717
1728
|
}, {
|
|
1718
1729
|
key: "suspendEvents",
|
|
1719
1730
|
value: function suspendEvents() {
|
|
1720
|
-
this.
|
|
1731
|
+
this._suspendAllEvents = true;
|
|
1721
1732
|
}
|
|
1733
|
+
/**
|
|
1734
|
+
* Resume event listening
|
|
1735
|
+
*/
|
|
1722
1736
|
}, {
|
|
1723
1737
|
key: "resumeEvents",
|
|
1724
1738
|
value: function resumeEvents() {
|
|
1725
|
-
this.
|
|
1739
|
+
this._suspendAllEvents = false;
|
|
1726
1740
|
}
|
|
1727
|
-
|
|
1741
|
+
/**
|
|
1742
|
+
* Trigger an event with custom parameters
|
|
1743
|
+
* @param name The name of the event to trigger
|
|
1744
|
+
* @param param The parameters to provide to the associated function
|
|
1745
|
+
* @returns The results of the function.
|
|
1746
|
+
*/
|
|
1728
1747
|
}, {
|
|
1729
1748
|
key: "triggerEvent",
|
|
1730
1749
|
value: function triggerEvent(name, param) {
|
|
1731
|
-
if (this.
|
|
1732
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1733
|
-
this._suspendedEvents[name] === true) {
|
|
1750
|
+
if (this._suspendAllEvents === true || this._suspendedEvents.get(name) === true) {
|
|
1734
1751
|
return [];
|
|
1735
1752
|
}
|
|
1736
1753
|
var returnList = [];
|
|
1737
|
-
var
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1754
|
+
var events = this.registeredEvents.get(name);
|
|
1755
|
+
if (events && events.length > 0) {
|
|
1756
|
+
var _iterator = _createForOfIteratorHelper(events),
|
|
1757
|
+
_step;
|
|
1758
|
+
try {
|
|
1759
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1760
|
+
var myEvent = _step.value;
|
|
1761
|
+
if (myEvent.finished === 0) {
|
|
1762
|
+
// Mark the following as finished: it needs to be removed
|
|
1763
|
+
if (myEvent.keepOnCall === false) {
|
|
1764
|
+
myEvent.finished = 1;
|
|
1746
1765
|
}
|
|
1747
1766
|
try {
|
|
1748
|
-
returnList.push(
|
|
1767
|
+
returnList.push(myEvent.functionpointer(param));
|
|
1749
1768
|
} catch (e) {
|
|
1750
1769
|
debugLogger(DebugType.Error, "Error for event [".concat(name, "]: "), param, e);
|
|
1751
1770
|
}
|
|
1752
1771
|
}
|
|
1753
1772
|
}
|
|
1773
|
+
} catch (err) {
|
|
1774
|
+
_iterator.e(err);
|
|
1775
|
+
} finally {
|
|
1776
|
+
_iterator.f();
|
|
1754
1777
|
}
|
|
1755
|
-
} catch (err) {
|
|
1756
|
-
_iterator2.e(err);
|
|
1757
|
-
} finally {
|
|
1758
|
-
_iterator2.f();
|
|
1759
1778
|
}
|
|
1779
|
+
// Now remove all finished events
|
|
1780
|
+
this.removeFinishedEvents();
|
|
1760
1781
|
return returnList;
|
|
1761
1782
|
}
|
|
1783
|
+
}, {
|
|
1784
|
+
key: "removeFinishedEvents",
|
|
1785
|
+
value: function removeFinishedEvents() {
|
|
1786
|
+
var _this = this;
|
|
1787
|
+
this.registeredEvents.forEach(function (callbacks, name) {
|
|
1788
|
+
_this.registeredEvents.set(name, callbacks.filter(function (c) {
|
|
1789
|
+
return !c.finished;
|
|
1790
|
+
}));
|
|
1791
|
+
});
|
|
1792
|
+
}
|
|
1793
|
+
}, {
|
|
1794
|
+
key: "removeEvents",
|
|
1795
|
+
value: function removeEvents(name, f) {
|
|
1796
|
+
var numberOfRemovedEvents = 0;
|
|
1797
|
+
var events = this.registeredEvents.get(name);
|
|
1798
|
+
if (events && events.length > 0) {
|
|
1799
|
+
var _iterator2 = _createForOfIteratorHelper(events),
|
|
1800
|
+
_step2;
|
|
1801
|
+
try {
|
|
1802
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
1803
|
+
var myEvent = _step2.value;
|
|
1804
|
+
if (myEvent.finished === 0) {
|
|
1805
|
+
if (!f) {
|
|
1806
|
+
myEvent.finished = 1;
|
|
1807
|
+
numberOfRemovedEvents += 1;
|
|
1808
|
+
} else if (myEvent.functionpointer === f) {
|
|
1809
|
+
myEvent.finished = 1;
|
|
1810
|
+
numberOfRemovedEvents += 1;
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
} catch (err) {
|
|
1815
|
+
_iterator2.e(err);
|
|
1816
|
+
} finally {
|
|
1817
|
+
_iterator2.f();
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
this.removeFinishedEvents();
|
|
1821
|
+
return numberOfRemovedEvents;
|
|
1822
|
+
}
|
|
1762
1823
|
}]);
|
|
1763
1824
|
return WMListener;
|
|
1764
1825
|
}();
|
|
@@ -1866,7 +1927,7 @@ _bbox) {
|
|
|
1866
1927
|
return undefined;
|
|
1867
1928
|
};
|
|
1868
1929
|
var WMCanvasBuffer = /*#__PURE__*/function () {
|
|
1869
|
-
function WMCanvasBuffer(
|
|
1930
|
+
function WMCanvasBuffer(webMapJS, w, h, internalCallbacks) {
|
|
1870
1931
|
var _this = this;
|
|
1871
1932
|
_classCallCheck(this, WMCanvasBuffer);
|
|
1872
1933
|
this.canvas = document.createElement('canvas');
|
|
@@ -1875,17 +1936,14 @@ var WMCanvasBuffer = /*#__PURE__*/function () {
|
|
|
1875
1936
|
this._ctx = this.canvas.getContext('2d');
|
|
1876
1937
|
this._ctx.canvas.width = w;
|
|
1877
1938
|
this._ctx.canvas.height = h;
|
|
1878
|
-
this._imageStore =
|
|
1939
|
+
this._imageStore = webMapJS.getImageStore();
|
|
1879
1940
|
this.ready = true;
|
|
1880
1941
|
this.layers = [];
|
|
1881
|
-
this._defaultImage = new WMImage('webmapjs/img/stoploading.png', function () {
|
|
1882
|
-
_this._statDivBufferImageLoaded();
|
|
1883
|
-
});
|
|
1884
1942
|
this._currentbbox = undefined;
|
|
1885
1943
|
this._currentnewbbox = undefined;
|
|
1886
1944
|
this._width = w;
|
|
1887
1945
|
this._height = h;
|
|
1888
|
-
this.
|
|
1946
|
+
this._webMapJS = webMapJS;
|
|
1889
1947
|
this._internalCallbacks = internalCallbacks;
|
|
1890
1948
|
/* Bind */
|
|
1891
1949
|
this.getCanvasContext = this.getCanvasContext.bind(this);
|
|
@@ -1899,6 +1957,9 @@ var WMCanvasBuffer = /*#__PURE__*/function () {
|
|
|
1899
1957
|
this.setBBOX = this.setBBOX.bind(this);
|
|
1900
1958
|
this.getBuffer = this.getBuffer.bind(this);
|
|
1901
1959
|
this._drawImage = this._drawImage.bind(this);
|
|
1960
|
+
this.isImageStoreLoading = this.isImageStoreLoading.bind(this);
|
|
1961
|
+
this._display = this._display.bind(this);
|
|
1962
|
+
this.destroy = this.destroy.bind(this);
|
|
1902
1963
|
this._imageStore.addImageEventCallback(function (image, id, imageEventType) {
|
|
1903
1964
|
if (imageEventType === WMImageEventType.Loaded) {
|
|
1904
1965
|
_this.imageLoadComplete(image);
|
|
@@ -1909,6 +1970,7 @@ var WMCanvasBuffer = /*#__PURE__*/function () {
|
|
|
1909
1970
|
}, 'WMCanvasBuffer');
|
|
1910
1971
|
this._errorList = [];
|
|
1911
1972
|
this.animationFrameRequest = ANIMATIONFRAMEREQUEST_DONE;
|
|
1973
|
+
this._isBufferLoading = false;
|
|
1912
1974
|
}
|
|
1913
1975
|
_createClass(WMCanvasBuffer, [{
|
|
1914
1976
|
key: "getCanvasContext",
|
|
@@ -1922,10 +1984,14 @@ var WMCanvasBuffer = /*#__PURE__*/function () {
|
|
|
1922
1984
|
}, {
|
|
1923
1985
|
key: "imageLoadComplete",
|
|
1924
1986
|
value: function imageLoadComplete(image) {
|
|
1987
|
+
if (!this._webMapJS) {
|
|
1988
|
+
return;
|
|
1989
|
+
}
|
|
1925
1990
|
this._statDivBufferImageLoaded();
|
|
1926
|
-
this.
|
|
1927
|
-
this.
|
|
1991
|
+
this._webMapJS.getListener().triggerEvent('onimageload', undefined);
|
|
1992
|
+
this._webMapJS.getListener().triggerEvent('onimagebufferimageload', image);
|
|
1928
1993
|
this.display();
|
|
1994
|
+
this.checkIfLoading();
|
|
1929
1995
|
}
|
|
1930
1996
|
/**
|
|
1931
1997
|
* Checks if all images are loaded, if so it will call finishedLoading
|
|
@@ -1992,17 +2058,24 @@ var WMCanvasBuffer = /*#__PURE__*/function () {
|
|
|
1992
2058
|
key: "display",
|
|
1993
2059
|
value: function display() {
|
|
1994
2060
|
var _this2 = this;
|
|
2061
|
+
if (!this._webMapJS) {
|
|
2062
|
+
return;
|
|
2063
|
+
}
|
|
1995
2064
|
// Check if the response from window.requestAnimationFrame is set. If this is the case, debounce the next display.
|
|
1996
2065
|
if (this.animationFrameRequest !== ANIMATIONFRAMEREQUEST_DONE) {
|
|
1997
2066
|
clearTimeout(this.timerHandle);
|
|
1998
2067
|
this.timerHandle = setTimeout(function () {
|
|
1999
|
-
_this2.
|
|
2068
|
+
if (_this2._webMapJS) {
|
|
2069
|
+
_this2._display();
|
|
2070
|
+
}
|
|
2000
2071
|
}, 100);
|
|
2001
2072
|
return;
|
|
2002
2073
|
}
|
|
2003
2074
|
// Display the next frame based on window.requestAnimationFrame, e.g. when the screen is ready to display.
|
|
2004
2075
|
this.animationFrameRequest = window.requestAnimationFrame(function () {
|
|
2005
|
-
_this2.
|
|
2076
|
+
if (_this2._webMapJS) {
|
|
2077
|
+
_this2._display();
|
|
2078
|
+
}
|
|
2006
2079
|
});
|
|
2007
2080
|
}
|
|
2008
2081
|
}, {
|
|
@@ -2010,6 +2083,10 @@ var WMCanvasBuffer = /*#__PURE__*/function () {
|
|
|
2010
2083
|
value: function _display() {
|
|
2011
2084
|
var _this3 = this;
|
|
2012
2085
|
var _a, _b, _c, _d, _e, _f;
|
|
2086
|
+
if (!this.ready) {
|
|
2087
|
+
return;
|
|
2088
|
+
}
|
|
2089
|
+
this.ready = false;
|
|
2013
2090
|
// Frame is displayed, so reset animationFrameRequest back to default.
|
|
2014
2091
|
this.animationFrameRequest = ANIMATIONFRAMEREQUEST_DONE;
|
|
2015
2092
|
this._ctx.globalAlpha = 1;
|
|
@@ -2017,7 +2094,7 @@ var WMCanvasBuffer = /*#__PURE__*/function () {
|
|
|
2017
2094
|
this._ctx.beginPath();
|
|
2018
2095
|
this._ctx.fillRect(0, 0, this._width, this._height);
|
|
2019
2096
|
this._ctx.fill();
|
|
2020
|
-
this.
|
|
2097
|
+
this._webMapJS.getListener().triggerEvent('beforecanvasstartdraw', this._ctx);
|
|
2021
2098
|
if (this._internalCallbacks && this._internalCallbacks.beforecanvasstartdraw) {
|
|
2022
2099
|
this._internalCallbacks.beforecanvasstartdraw(this._ctx);
|
|
2023
2100
|
}
|
|
@@ -2028,37 +2105,39 @@ var WMCanvasBuffer = /*#__PURE__*/function () {
|
|
|
2028
2105
|
if (imageToDisplay === null || imageToDisplay === void 0 ? void 0 : imageToDisplay.isLoadedWithoutErrors()) {
|
|
2029
2106
|
// Draw this image, it is loaded and OK
|
|
2030
2107
|
_this3._drawImage(layer);
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2108
|
+
} else {
|
|
2109
|
+
/**
|
|
2110
|
+
* Check if this image has an error.
|
|
2111
|
+
* If the error has occured some time ago, and the amount of retries is low, just retry to load the image.
|
|
2112
|
+
*/
|
|
2113
|
+
if ((imageToDisplay === null || imageToDisplay === void 0 ? void 0 : imageToDisplay.hasError()) && imageToDisplay.isLoading() === false && imageToDisplay.getLastErrorMSecondsAgo() > 5000 && imageToDisplay.getNumFailedAttempts() < 10) {
|
|
2114
|
+
imageToDisplay.forceReload();
|
|
2115
|
+
}
|
|
2116
|
+
/* Find closest alternative and display instead image */
|
|
2117
|
+
var im = getAlternativeImage(layer.imageSource, _this3._imageStore, _this3._currentnewbbox);
|
|
2118
|
+
if (im) {
|
|
2119
|
+
_this3._drawImage(im);
|
|
2120
|
+
}
|
|
2044
2121
|
}
|
|
2045
2122
|
});
|
|
2046
2123
|
this._ctx.globalAlpha = 1;
|
|
2047
2124
|
/* Display errors */
|
|
2048
2125
|
if (this._errorList.length > 0) {
|
|
2049
|
-
this.
|
|
2126
|
+
this._webMapJS.getListener().triggerEvent('canvasonerror', this._errorList);
|
|
2050
2127
|
(_b = (_a = this._internalCallbacks) === null || _a === void 0 ? void 0 : _a.canvasonerror) === null || _b === void 0 ? void 0 : _b.call(_a, this._errorList);
|
|
2051
2128
|
}
|
|
2052
|
-
this.
|
|
2129
|
+
this._webMapJS.getListener().triggerEvent('beforecanvasdisplay', this._ctx);
|
|
2053
2130
|
(_d = (_c = this._internalCallbacks) === null || _c === void 0 ? void 0 : _c.beforecanvasdisplay) === null || _d === void 0 ? void 0 : _d.call(_c, this._ctx);
|
|
2054
2131
|
this.canvas.style.display = 'inline-block';
|
|
2055
|
-
this.
|
|
2132
|
+
this._webMapJS.getListener().triggerEvent('aftercanvasdisplay', this._ctx);
|
|
2056
2133
|
(_f = (_e = this._internalCallbacks) === null || _e === void 0 ? void 0 : _e.aftercanvasdisplay) === null || _f === void 0 ? void 0 : _f.call(_e, this._ctx);
|
|
2134
|
+
this.ready = true;
|
|
2057
2135
|
}
|
|
2058
2136
|
}, {
|
|
2059
2137
|
key: "finishedLoading",
|
|
2060
2138
|
value: function finishedLoading() {
|
|
2061
2139
|
if (this.ready) {
|
|
2140
|
+
// console.log('finishedLoading');
|
|
2062
2141
|
return;
|
|
2063
2142
|
}
|
|
2064
2143
|
this.ready = true;
|
|
@@ -2146,6 +2225,24 @@ var WMCanvasBuffer = /*#__PURE__*/function () {
|
|
|
2146
2225
|
if (!image.isLoaded() && !image.isLoading()) {
|
|
2147
2226
|
image.load();
|
|
2148
2227
|
}
|
|
2228
|
+
this.checkIfLoading();
|
|
2229
|
+
}
|
|
2230
|
+
}, {
|
|
2231
|
+
key: "checkIfLoading",
|
|
2232
|
+
value: function checkIfLoading() {
|
|
2233
|
+
var isLoading = this.isImageStoreLoading();
|
|
2234
|
+
if (!isLoading && this._isBufferLoading) {
|
|
2235
|
+
this._isBufferLoading = false;
|
|
2236
|
+
this._webMapJS.getListener().triggerEvent('onloadready');
|
|
2237
|
+
} else if (isLoading && !this._isBufferLoading) {
|
|
2238
|
+
this._isBufferLoading = true;
|
|
2239
|
+
this._webMapJS.getListener().triggerEvent('onloadstart');
|
|
2240
|
+
}
|
|
2241
|
+
}
|
|
2242
|
+
}, {
|
|
2243
|
+
key: "isImageStoreLoading",
|
|
2244
|
+
value: function isImageStoreLoading() {
|
|
2245
|
+
return this._imageStore.getNumImagesLoading() !== 0;
|
|
2149
2246
|
}
|
|
2150
2247
|
}, {
|
|
2151
2248
|
key: "_getPixelCoordFromGeoCoord",
|
|
@@ -2164,6 +2261,13 @@ var WMCanvasBuffer = /*#__PURE__*/function () {
|
|
|
2164
2261
|
this._currentnewbbox = newbbox;
|
|
2165
2262
|
this.display();
|
|
2166
2263
|
}
|
|
2264
|
+
}, {
|
|
2265
|
+
key: "destroy",
|
|
2266
|
+
value: function destroy() {
|
|
2267
|
+
clearTimeout(this.timerHandle);
|
|
2268
|
+
cancelAnimationFrame(this.animationFrameRequest);
|
|
2269
|
+
this._webMapJS = null;
|
|
2270
|
+
}
|
|
2167
2271
|
}, {
|
|
2168
2272
|
key: "getBuffer",
|
|
2169
2273
|
value: function getBuffer() {
|
|
@@ -2184,20 +2288,20 @@ function prefetchImagesForAnimation(wmMap) {
|
|
|
2184
2288
|
var indexOfNextAnimationStep = (wmMap.currentAnimationStep + offset) % countAnimationSteps;
|
|
2185
2289
|
return animationSteps[indexOfNextAnimationStep];
|
|
2186
2290
|
});
|
|
2187
|
-
prefetchLayerImagesInOrderWithUrls(animationStepsInOrder, maxImagesToPrefetch);
|
|
2291
|
+
prefetchLayerImagesInOrderWithUrls(wmMap, animationStepsInOrder, maxImagesToPrefetch);
|
|
2188
2292
|
}
|
|
2189
|
-
function prefetchLayerImagesInOrderWithUrls(animationStepsInOrder, maxImagesToPrefetch) {
|
|
2293
|
+
function prefetchLayerImagesInOrderWithUrls(wmMap, animationStepsInOrder, maxImagesToPrefetch) {
|
|
2190
2294
|
var _iterator = _createForOfIteratorHelper(animationStepsInOrder),
|
|
2191
2295
|
_step;
|
|
2192
2296
|
try {
|
|
2193
2297
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
2194
2298
|
var animationStep = _step.value;
|
|
2195
2299
|
// dont prefetch if already prefetching too many images
|
|
2196
|
-
var countImagesLoading = getMapImageStore.getNumImagesLoading();
|
|
2300
|
+
var countImagesLoading = wmMap.getMapImageStore.getNumImagesLoading();
|
|
2197
2301
|
if (countImagesLoading > maxImagesToPrefetch - 1) {
|
|
2198
2302
|
break;
|
|
2199
2303
|
}
|
|
2200
|
-
prefetchLayerImagesForTime(animationStep.requests || []);
|
|
2304
|
+
prefetchLayerImagesForTime(wmMap, animationStep.requests || []);
|
|
2201
2305
|
}
|
|
2202
2306
|
} catch (err) {
|
|
2203
2307
|
_iterator.e(err);
|
|
@@ -2212,12 +2316,12 @@ function prefetchLayerImagesInOrder(wmMap, timesToPrefetchInOrder, maxImagesToPr
|
|
|
2212
2316
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
2213
2317
|
var timeToPrefetch = _step2.value;
|
|
2214
2318
|
// dont prefetch if already prefetching too many images
|
|
2215
|
-
var countImagesLoading = getMapImageStore.getNumImagesLoading();
|
|
2319
|
+
var countImagesLoading = wmMap.getMapImageStore.getNumImagesLoading();
|
|
2216
2320
|
if (countImagesLoading > maxImagesToPrefetch - 1) {
|
|
2217
2321
|
break;
|
|
2218
2322
|
}
|
|
2219
2323
|
var layersImageUrls = getLayersImageUrlsForTime(wmMap, timeToPrefetch);
|
|
2220
|
-
prefetchLayerImagesForTime(layersImageUrls);
|
|
2324
|
+
prefetchLayerImagesForTime(wmMap, layersImageUrls);
|
|
2221
2325
|
}
|
|
2222
2326
|
} catch (err) {
|
|
2223
2327
|
_iterator2.e(err);
|
|
@@ -2232,9 +2336,9 @@ function getLayersImageUrlsForTime(wmMap, timeToPrefetch) {
|
|
|
2232
2336
|
}]);
|
|
2233
2337
|
return layersImageUrls;
|
|
2234
2338
|
}
|
|
2235
|
-
function prefetchLayerImagesForTime(requests) {
|
|
2339
|
+
function prefetchLayerImagesForTime(wmMap, requests) {
|
|
2236
2340
|
requests.forEach(function (request) {
|
|
2237
|
-
var image = getMapImageStore.getImage(request.url, {
|
|
2341
|
+
var image = wmMap.getMapImageStore.getImage(request.url, {
|
|
2238
2342
|
headers: request.headers
|
|
2239
2343
|
});
|
|
2240
2344
|
if (image.hasNotStartedLoading()) {
|
|
@@ -2331,7 +2435,6 @@ var WMJSAnimate = /*#__PURE__*/function () {
|
|
|
2331
2435
|
function WMJSAnimate(_map) {
|
|
2332
2436
|
_classCallCheck(this, WMJSAnimate);
|
|
2333
2437
|
_WMJSAnimate_instances.add(this);
|
|
2334
|
-
this._imageStore = getMapImageStore;
|
|
2335
2438
|
this.isNextTimeCloseToWallClockTime = false;
|
|
2336
2439
|
_map.animationDelay = 100;
|
|
2337
2440
|
this._callBack = _map.getListener();
|
|
@@ -2422,14 +2525,14 @@ var WMJSAnimate = /*#__PURE__*/function () {
|
|
|
2422
2525
|
var numberOfImagesReadyForNextAnimationStep = 0;
|
|
2423
2526
|
layersImageUrls.forEach(function (request) {
|
|
2424
2527
|
var url = request.url;
|
|
2425
|
-
var image = getMapImageStore.getImageForSrc(url);
|
|
2528
|
+
var image = _this._map.getMapImageStore.getImageForSrc(url);
|
|
2426
2529
|
/* Get a loaded image which has no error */
|
|
2427
2530
|
if (image === null || image === void 0 ? void 0 : image.isLoadedWithoutErrors()) {
|
|
2428
2531
|
numberOfImagesReadyForNextAnimationStep += 1;
|
|
2429
2532
|
return;
|
|
2430
2533
|
}
|
|
2431
2534
|
/* Check if a similar image is available instead, then we can continue with the smoother animation */
|
|
2432
|
-
var alternativeImage = getAlternativeImage(url, getMapImageStore, _this._map.getDrawBBOX());
|
|
2535
|
+
var alternativeImage = getAlternativeImage(url, _this._map.getMapImageStore, _this._map.getDrawBBOX());
|
|
2433
2536
|
if (alternativeImage) {
|
|
2434
2537
|
numberOfImagesReadyForNextAnimationStep += 1;
|
|
2435
2538
|
return;
|
|
@@ -4409,10 +4512,6 @@ var getErrorsToDisplay = function getErrorsToDisplay(canvasErrors, getLayerBySer
|
|
|
4409
4512
|
return list;
|
|
4410
4513
|
}, []);
|
|
4411
4514
|
};
|
|
4412
|
-
var clearImageCache = function clearImageCache() {
|
|
4413
|
-
getMapImageStore.clear();
|
|
4414
|
-
getLegendImageStore().clear();
|
|
4415
|
-
};
|
|
4416
4515
|
/**
|
|
4417
4516
|
/**
|
|
4418
4517
|
* WMJSMap class
|
|
@@ -4669,11 +4768,16 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
4669
4768
|
this._adagucBeforeCanvasDisplay = this._adagucBeforeCanvasDisplay.bind(this);
|
|
4670
4769
|
this.displayScaleBarInMap = this.displayScaleBarInMap.bind(this);
|
|
4671
4770
|
this.configureMapDimensions = this.configureMapDimensions.bind(this);
|
|
4771
|
+
this.getImageStore = this.getImageStore.bind(this);
|
|
4772
|
+
this.clearImageCache = this.clearImageCache.bind(this);
|
|
4672
4773
|
this.mapPin = new MapPin(this);
|
|
4673
4774
|
this.loadingDiv = document.createElement('div');
|
|
4674
4775
|
this.loadingDiv.className = 'WMJSDivBuffer-loading';
|
|
4675
4776
|
this.enableAutoPrefetching = true;
|
|
4676
4777
|
this.isProjectionSupported = isProjectionSupported.bind(this);
|
|
4778
|
+
this.getMapImageStore = new WMImageStore(mapImageStoreLength, {
|
|
4779
|
+
id: this.getId()
|
|
4780
|
+
});
|
|
4677
4781
|
this.init();
|
|
4678
4782
|
}
|
|
4679
4783
|
_createClass(WMJSMap, [{
|
|
@@ -5147,7 +5251,7 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5147
5251
|
this.bbox.top = 90;
|
|
5148
5252
|
this.srs = 'EPSG:4326';
|
|
5149
5253
|
// IMAGE buffer
|
|
5150
|
-
this.divBuffer = new WMCanvasBuffer(this
|
|
5254
|
+
this.divBuffer = new WMCanvasBuffer(this, this.getWidth(), this.getHeight(), {
|
|
5151
5255
|
beforecanvasstartdraw: this._adagucBeforeDraw,
|
|
5152
5256
|
beforecanvasdisplay: this._adagucBeforeCanvasDisplay,
|
|
5153
5257
|
canvasonerror: function canvasonerror(e) {
|
|
@@ -5160,8 +5264,8 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5160
5264
|
_this3.draw('legendImageStore loaded');
|
|
5161
5265
|
}
|
|
5162
5266
|
}, this.internalMapId);
|
|
5163
|
-
this.callBack.
|
|
5164
|
-
this.callBack.
|
|
5267
|
+
this.callBack.addEventListener('display', this.display, true);
|
|
5268
|
+
this.callBack.addEventListener('draw', function () {
|
|
5165
5269
|
debugLogger(DebugType.Log);
|
|
5166
5270
|
}, true);
|
|
5167
5271
|
bgMapImageStore.addImageEventCallback(function (image, id, imageEventType) {
|
|
@@ -6103,9 +6207,11 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
6103
6207
|
this.detachEvents();
|
|
6104
6208
|
this.callBack.destroy();
|
|
6105
6209
|
this.callBack = null;
|
|
6106
|
-
getMapImageStore.removeEventCallback(this.internalMapId);
|
|
6210
|
+
this.getMapImageStore.removeEventCallback(this.internalMapId);
|
|
6107
6211
|
bgMapImageStore.removeEventCallback(this.internalMapId);
|
|
6108
6212
|
getLegendImageStore().removeEventCallback(this.internalMapId);
|
|
6213
|
+
this.divBuffer.destroy();
|
|
6214
|
+
this.divBuffer = null;
|
|
6109
6215
|
this.internalMapId = '';
|
|
6110
6216
|
this.mainElement.removeChild(this.baseDiv);
|
|
6111
6217
|
this.baseDiv.innerHTML = '';
|
|
@@ -7136,7 +7242,7 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
7136
7242
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7137
7243
|
f) {
|
|
7138
7244
|
var keep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
7139
|
-
return this.callBack.
|
|
7245
|
+
return this.callBack.addEventListener(name, f, keep);
|
|
7140
7246
|
}
|
|
7141
7247
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7142
7248
|
}, {
|
|
@@ -7145,7 +7251,7 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
7145
7251
|
if (this.isDestroyed) {
|
|
7146
7252
|
return;
|
|
7147
7253
|
}
|
|
7148
|
-
this.callBack.
|
|
7254
|
+
this.callBack.removeEventListener(name, f);
|
|
7149
7255
|
}
|
|
7150
7256
|
}, {
|
|
7151
7257
|
key: "getListener",
|
|
@@ -7386,6 +7492,17 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
7386
7492
|
value: function getDrawBBOX() {
|
|
7387
7493
|
return this.bbox;
|
|
7388
7494
|
}
|
|
7495
|
+
}, {
|
|
7496
|
+
key: "getImageStore",
|
|
7497
|
+
value: function getImageStore() {
|
|
7498
|
+
return this.getMapImageStore;
|
|
7499
|
+
}
|
|
7500
|
+
}, {
|
|
7501
|
+
key: "clearImageCache",
|
|
7502
|
+
value: function clearImageCache() {
|
|
7503
|
+
this.getMapImageStore.clear();
|
|
7504
|
+
getLegendImageStore().clear();
|
|
7505
|
+
}
|
|
7389
7506
|
}]);
|
|
7390
7507
|
return WMJSMap;
|
|
7391
7508
|
}();
|
|
@@ -7954,6 +8071,7 @@ var WMXMLParser = function WMXMLParser(url, headers) {
|
|
|
7954
8071
|
});
|
|
7955
8072
|
};
|
|
7956
8073
|
|
|
8074
|
+
var wmServiceListener = new WMListener();
|
|
7957
8075
|
var loadGetCapabilitiesViaProxy = function loadGetCapabilitiesViaProxy(url, succes, fail, xml2jsonrequestURL) {
|
|
7958
8076
|
var getcapreq = "".concat(xml2jsonrequestURL, "request=");
|
|
7959
8077
|
getcapreq += URLEncode(url);
|
|
@@ -8208,6 +8326,7 @@ var WMJSService = /*#__PURE__*/function () {
|
|
|
8208
8326
|
this.functionCallbackList.push(_cf);
|
|
8209
8327
|
/* Fail functions */
|
|
8210
8328
|
var fail = function fail(jsonData) {
|
|
8329
|
+
wmServiceListener.triggerEvent(EVENT_GETCAPABILITIES_READY, _this.service);
|
|
8211
8330
|
_this.busy = false;
|
|
8212
8331
|
var current;
|
|
8213
8332
|
while (current = _this.functionCallbackList.pop()) {
|
|
@@ -8216,6 +8335,7 @@ var WMJSService = /*#__PURE__*/function () {
|
|
|
8216
8335
|
};
|
|
8217
8336
|
/* Success functions */
|
|
8218
8337
|
var succes = function succes(jsonData) {
|
|
8338
|
+
wmServiceListener.triggerEvent(EVENT_GETCAPABILITIES_READY, _this.service);
|
|
8219
8339
|
_this.busy = false;
|
|
8220
8340
|
_this.getcapabilitiesDoc = jsonData;
|
|
8221
8341
|
try {
|
|
@@ -8263,6 +8383,7 @@ var WMJSService = /*#__PURE__*/function () {
|
|
|
8263
8383
|
current.callback(jsonData);
|
|
8264
8384
|
}
|
|
8265
8385
|
};
|
|
8386
|
+
wmServiceListener.triggerEvent(EVENT_GETCAPABILITIES_START, this.service);
|
|
8266
8387
|
WMJSGetCapabilities(this.service, succes, fail, options);
|
|
8267
8388
|
} else {
|
|
8268
8389
|
succescallback(this.getcapabilitiesDoc);
|
|
@@ -9004,7 +9125,7 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
9004
9125
|
}
|
|
9005
9126
|
/**
|
|
9006
9127
|
* A Promise to parse the layer, it will fetch the WMS GetCapabilities document, configure the layer and resolve to a WMLayer object
|
|
9007
|
-
* @param forceReload Do not use the cache of the WMS
|
|
9128
|
+
* @param forceReload Do not use the cache of the WMS GetCapabilities document, but instead fetch new data from the server
|
|
9008
9129
|
* @returns WMLayer object
|
|
9009
9130
|
*/
|
|
9010
9131
|
}, {
|
|
@@ -9220,6 +9341,39 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
9220
9341
|
return WMLayer;
|
|
9221
9342
|
}();
|
|
9222
9343
|
|
|
9344
|
+
/* *
|
|
9345
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9346
|
+
* you may not use this file except in compliance with the License.
|
|
9347
|
+
* You may obtain a copy of the License at
|
|
9348
|
+
*
|
|
9349
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9350
|
+
*
|
|
9351
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
9352
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
9353
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9354
|
+
* See the License for the specific language governing permissions and
|
|
9355
|
+
* limitations under the License.
|
|
9356
|
+
*
|
|
9357
|
+
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
9358
|
+
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
9359
|
+
* */
|
|
9360
|
+
var defaultAnimationDelayAtStart = 250;
|
|
9361
|
+
var defaultDelay = 1000; // [ms]
|
|
9362
|
+
var defaultTimeStep = 60;
|
|
9363
|
+
var defaultSecondsPerPx = 80;
|
|
9364
|
+
var defaultTimeSpan = 24 * 3600;
|
|
9365
|
+
var speedFactors = [0.1, 0.2, 0.5, 1, 2, 4, 8, 16]; // Declares available animation speed multipliers for default delay
|
|
9366
|
+
|
|
9367
|
+
var mapConstants = /*#__PURE__*/Object.freeze({
|
|
9368
|
+
__proto__: null,
|
|
9369
|
+
defaultAnimationDelayAtStart: defaultAnimationDelayAtStart,
|
|
9370
|
+
defaultDelay: defaultDelay,
|
|
9371
|
+
defaultTimeStep: defaultTimeStep,
|
|
9372
|
+
defaultSecondsPerPx: defaultSecondsPerPx,
|
|
9373
|
+
defaultTimeSpan: defaultTimeSpan,
|
|
9374
|
+
speedFactors: speedFactors
|
|
9375
|
+
});
|
|
9376
|
+
|
|
9223
9377
|
/* *
|
|
9224
9378
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9225
9379
|
* you may not use this file except in compliance with the License.
|
|
@@ -9362,6 +9516,36 @@ var getWMJSTimeDimensionForLayerId = function getWMJSTimeDimensionForLayerId(lay
|
|
|
9362
9516
|
}
|
|
9363
9517
|
return wmLayer.getDimension('time');
|
|
9364
9518
|
};
|
|
9519
|
+
/**
|
|
9520
|
+
* Clears the image store for all maps
|
|
9521
|
+
*/
|
|
9522
|
+
var clearImageCacheForAllMaps = function clearImageCacheForAllMaps() {
|
|
9523
|
+
getWMJSMapIds().forEach(function (id) {
|
|
9524
|
+
var map = getWMJSMapById(id);
|
|
9525
|
+
if (map && !map.isDestroyed) {
|
|
9526
|
+
map.clearImageCache();
|
|
9527
|
+
}
|
|
9528
|
+
});
|
|
9529
|
+
};
|
|
9530
|
+
var roundWithTimeStep = function roundWithTimeStep(unixTime, timeStep, type) {
|
|
9531
|
+
var adjustedTimeStep = timeStep * 60;
|
|
9532
|
+
if (!type || type === 'round') {
|
|
9533
|
+
return Math.round(unixTime / adjustedTimeStep) * adjustedTimeStep;
|
|
9534
|
+
}
|
|
9535
|
+
if (type === 'floor') {
|
|
9536
|
+
return Math.floor(unixTime / adjustedTimeStep) * adjustedTimeStep;
|
|
9537
|
+
}
|
|
9538
|
+
if (type === 'ceil') {
|
|
9539
|
+
return Math.ceil(unixTime / adjustedTimeStep) * adjustedTimeStep;
|
|
9540
|
+
}
|
|
9541
|
+
return undefined;
|
|
9542
|
+
};
|
|
9543
|
+
/**
|
|
9544
|
+
* Returns speed delay for given speedFactor. For options, see defined above in "speedFactors"
|
|
9545
|
+
*/
|
|
9546
|
+
var getSpeedDelay = function getSpeedDelay(speedFactor) {
|
|
9547
|
+
return defaultDelay / speedFactor;
|
|
9548
|
+
};
|
|
9365
9549
|
|
|
9366
9550
|
var utils = /*#__PURE__*/Object.freeze({
|
|
9367
9551
|
__proto__: null,
|
|
@@ -9377,7 +9561,10 @@ var utils = /*#__PURE__*/Object.freeze({
|
|
|
9377
9561
|
getWMJSMapById: getWMJSMapById,
|
|
9378
9562
|
getWMJSMapIds: getWMJSMapIds,
|
|
9379
9563
|
getWMJSDimensionForLayerAndDimension: getWMJSDimensionForLayerAndDimension,
|
|
9380
|
-
getWMJSTimeDimensionForLayerId: getWMJSTimeDimensionForLayerId
|
|
9564
|
+
getWMJSTimeDimensionForLayerId: getWMJSTimeDimensionForLayerId,
|
|
9565
|
+
clearImageCacheForAllMaps: clearImageCacheForAllMaps,
|
|
9566
|
+
roundWithTimeStep: roundWithTimeStep,
|
|
9567
|
+
getSpeedDelay: getSpeedDelay
|
|
9381
9568
|
});
|
|
9382
9569
|
|
|
9383
9570
|
/* *
|
|
@@ -10536,4 +10723,4 @@ var getCapabilities = /*#__PURE__*/Object.freeze({
|
|
|
10536
10723
|
getLayersFlattenedFromService: getLayersFlattenedFromService
|
|
10537
10724
|
});
|
|
10538
10725
|
|
|
10539
|
-
export { DateInterval, DebugType, EPSGCode, I18n, LayerType, ParseISOTimeRangeDuration, URLDecode, URLEncode, WMBBOX, WMDateOutSideRange, WMDateTooEarlyString, WMDateTooLateString, WMEmptyLayerName, WMEmptyLayerTitle, WMGetServiceFromStore, WMImage, WMImageEventType, WMJSDimension, WMJSMap, WMJSService, WMJScheckURL, WMLayer, WMProj4Defs, WMSVersion, bgImageStoreLength, buildWMSGetMapRequest,
|
|
10726
|
+
export { DateInterval, DebugType, EPSGCode, EVENT_GETCAPABILITIES_READY, EVENT_GETCAPABILITIES_START, I18n, LayerType, ParseISOTimeRangeDuration, URLDecode, URLEncode, WMBBOX, WMDateOutSideRange, WMDateTooEarlyString, WMDateTooLateString, WMEmptyLayerName, WMEmptyLayerTitle, WMGetServiceFromStore, WMImage, WMImageEventType, WMJSDimension, WMJSMap, WMJSService, WMJScheckURL, WMLayer, WMProj4Defs, WMSVersion, bgImageStoreLength, buildWMSGetMapRequest, clearImageCacheForAllMaps, debugLogger, defaultReduxLayerRadarKNMI, epsgDescriptionLookup, generateLayerId, generateMapId, generateTimesliderId, getAlternativeImage, getBBOXandProjString, getCapabilities, getLegendGraphicURLForLayer, getSpeedDelay, getUriWithParam, getWMJSDimensionForLayerAndDimension, getWMJSMapById, getWMJSMapIds, getWMJSTimeDimensionForLayerId, getWMLayerById, handleMomentISOString, isDefined, isProjectionSupported, legendImageStore, legendImageStoreLength, mapConstants, mapImageStoreLength, mockGetCapabilities, multiDimensionLayer, parseISO8601DateToDate, parseISO8601IntervalToDateInterval, registerWMJSMap, registerWMLayer, roundWithTimeStep, speedFactors, tilesettings, toArray, unRegisterAllWMJSLayersAndMaps, unRegisterWMJSLayer, unRegisterWMJSMap, testSettings as webmapTestSettings, utils as webmapUtils, wmServiceListener };
|
package/package.json
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import WMImage from './WMImage';
|
|
3
3
|
import WMImageStore from './WMImageStore';
|
|
4
4
|
import WMBBOX from './WMBBOX';
|
|
5
|
-
import WMListener from './WMListener';
|
|
6
5
|
import { LinkedInfo, LinkedInfoContent, WMPosition } from './types';
|
|
6
|
+
import type WMJSMap from './WMJSMap';
|
|
7
7
|
interface InternalCallback {
|
|
8
8
|
beforecanvasstartdraw?: (context: CanvasRenderingContext2D) => void;
|
|
9
9
|
beforecanvasdisplay?: (context: CanvasRenderingContext2D) => void;
|
|
@@ -70,12 +70,11 @@ export default class WMCanvasBuffer {
|
|
|
70
70
|
_imageStore: WMImageStore;
|
|
71
71
|
ready: boolean;
|
|
72
72
|
layers: CanvasGeoLayer[];
|
|
73
|
-
_defaultImage: WMImage;
|
|
74
73
|
_currentbbox: WMBBOX;
|
|
75
74
|
_currentnewbbox: WMBBOX;
|
|
76
75
|
_width: number;
|
|
77
76
|
_height: number;
|
|
78
|
-
|
|
77
|
+
_webMapJS: WMJSMap;
|
|
79
78
|
nrLoading: number;
|
|
80
79
|
onLoadReadyFunction: (param: unknown) => void;
|
|
81
80
|
_internalCallbacks: InternalCallback;
|
|
@@ -84,7 +83,8 @@ export default class WMCanvasBuffer {
|
|
|
84
83
|
animationFrameRequest: number;
|
|
85
84
|
timerHandle: NodeJS.Timeout;
|
|
86
85
|
_errorList: LinkedInfo[];
|
|
87
|
-
|
|
86
|
+
_isBufferLoading: boolean;
|
|
87
|
+
constructor(webMapJS: WMJSMap, w: number, h: number, internalCallbacks: InternalCallback);
|
|
88
88
|
getCanvasContext(): CanvasRenderingContext2D;
|
|
89
89
|
/**
|
|
90
90
|
* Triggered by the WMImageStore when an image completes loading
|
|
@@ -113,8 +113,11 @@ export default class WMCanvasBuffer {
|
|
|
113
113
|
* @returns Void
|
|
114
114
|
*/
|
|
115
115
|
setSrc(layerIndex: number, imageSource: string, linkedInfo: LinkedInfoContent, opacity: number, bbox: WMBBOX): void;
|
|
116
|
+
checkIfLoading(): void;
|
|
117
|
+
isImageStoreLoading(): boolean;
|
|
116
118
|
_getPixelCoordFromGeoCoord(coordinates: WMPosition, b: WMBBOX): WMPosition;
|
|
117
119
|
setBBOX(newbbox: WMBBOX, loadedbbox: WMBBOX): void;
|
|
120
|
+
destroy(): void;
|
|
118
121
|
getBuffer(): HTMLCanvasElement;
|
|
119
122
|
}
|
|
120
123
|
export {};
|
|
@@ -27,3 +27,5 @@ export declare const epsgDescriptionLookup: {
|
|
|
27
27
|
export declare const mapImageStoreLength = 1000;
|
|
28
28
|
export declare const bgImageStoreLength = 360;
|
|
29
29
|
export declare const legendImageStoreLength = 500;
|
|
30
|
+
export declare const EVENT_GETCAPABILITIES_START = "onstartgetcapabilities";
|
|
31
|
+
export declare const EVENT_GETCAPABILITIES_READY = "onreadygetcapabilities";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import WMImageStore from './WMImageStore';
|
|
1
2
|
import WMBBOX from './WMBBOX';
|
|
2
3
|
import WMListener from './WMListener';
|
|
3
4
|
import { proj4 } from './WMJSExternalDependencies';
|
|
@@ -8,7 +9,6 @@ import { AnimationStep, Dimension, LinkedInfo } from './types';
|
|
|
8
9
|
export declare const detectLeftButton: (evt: MouseEvent) => boolean;
|
|
9
10
|
export declare const detectRightButton: (evt: MouseEvent) => boolean;
|
|
10
11
|
export declare const getErrorsToDisplay: (canvasErrors: LinkedInfo[], getLayerByServiceAndName: (layerservice: string, layername: string) => WMLayer) => string[];
|
|
11
|
-
export declare const clearImageCache: () => void;
|
|
12
12
|
/**
|
|
13
13
|
/**
|
|
14
14
|
* WMJSMap class
|
|
@@ -113,6 +113,7 @@ export default class WMJSMap {
|
|
|
113
113
|
private needsRedraw;
|
|
114
114
|
private buildLayerDimsBusy;
|
|
115
115
|
isProjectionSupported: (srs: string) => boolean;
|
|
116
|
+
getMapImageStore: WMImageStore;
|
|
116
117
|
constructor(_element: HTMLElement);
|
|
117
118
|
setWMTileRendererTileSettings(_WMTileRendererTileSettings: unknown): void;
|
|
118
119
|
/**
|
|
@@ -316,4 +317,6 @@ export default class WMJSMap {
|
|
|
316
317
|
showBoundingBox(_bbox?: WMBBOX, _mapbbox?: WMBBOX): void;
|
|
317
318
|
hideBoundingBox(): void;
|
|
318
319
|
getDrawBBOX(): WMBBOX;
|
|
320
|
+
getImageStore(): WMImageStore;
|
|
321
|
+
clearImageCache(): void;
|
|
319
322
|
}
|
|
@@ -60,7 +60,7 @@ export declare const getUriAddParam: (baseUrl: string, params: Record<string, an
|
|
|
60
60
|
*/
|
|
61
61
|
export declare const dateToISO8601: (date: Date) => string;
|
|
62
62
|
/**
|
|
63
|
-
* Helper function to figure out the styles from the WMS layer object from the WMS
|
|
63
|
+
* Helper function to figure out the styles from the WMS layer object from the WMS GetCapabilities document
|
|
64
64
|
* @param layerObjectFromWMS The layer object from the WMS GetCapabilities JSON document
|
|
65
65
|
* @returns Style[] Array of style objects.
|
|
66
66
|
*/
|
|
@@ -140,7 +140,7 @@ export default class WMLayer {
|
|
|
140
140
|
parseLayer(_layerDoneCallback: (layer: WMLayer) => void, forceReload: boolean, origin: string): void;
|
|
141
141
|
/**
|
|
142
142
|
* A Promise to parse the layer, it will fetch the WMS GetCapabilities document, configure the layer and resolve to a WMLayer object
|
|
143
|
-
* @param forceReload Do not use the cache of the WMS
|
|
143
|
+
* @param forceReload Do not use the cache of the WMS GetCapabilities document, but instead fetch new data from the server
|
|
144
144
|
* @returns WMLayer object
|
|
145
145
|
*/
|
|
146
146
|
parseLayerPromise(forceReload?: boolean): Promise<WMLayer>;
|
|
@@ -1,21 +1,57 @@
|
|
|
1
|
-
export interface CallBack {
|
|
2
|
-
name: string;
|
|
3
|
-
finished: number;
|
|
4
|
-
keepOnCall: boolean;
|
|
5
|
-
functionpointer: (param?: unknown, that?: unknown) => void;
|
|
6
|
-
}
|
|
7
|
-
export type SuspendedEvent = Record<string, boolean>;
|
|
8
1
|
export default class WMListener {
|
|
9
|
-
private
|
|
2
|
+
private registeredEvents;
|
|
10
3
|
private _suspendedEvents;
|
|
11
|
-
private
|
|
4
|
+
private _suspendAllEvents;
|
|
12
5
|
constructor();
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Remove events by name and function.
|
|
8
|
+
* @param name Event name
|
|
9
|
+
* @param f Function pointer to check
|
|
10
|
+
*/
|
|
11
|
+
removeEventListener(name: string, f: (param?: unknown) => unknown): number;
|
|
12
|
+
/**
|
|
13
|
+
* Remove all events by name
|
|
14
|
+
* @param name Event name
|
|
15
|
+
*/
|
|
16
|
+
removeEventListeners(name: string): number;
|
|
17
|
+
/**
|
|
18
|
+
* Add multiple functions which will be called after the event with the same name is triggered
|
|
19
|
+
* @param name: The name of the event to register
|
|
20
|
+
* @param function: The function to trigger
|
|
21
|
+
* @param keepOnCall: When false, this event name and function combination is removed once triggered.
|
|
22
|
+
* When true Otherwise keep the event and allow it to be triggered multiple times
|
|
23
|
+
* @return: true if the event is registerd, false if it already was registered
|
|
24
|
+
*/
|
|
25
|
+
addEventListener(name: string, functionpointer: (param: unknown) => void, keepOnCall?: boolean): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Destroys this listener, deregistering all events
|
|
28
|
+
*/
|
|
15
29
|
destroy(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Suspend a specific event by name, triggers will not be called
|
|
32
|
+
* @param name
|
|
33
|
+
*/
|
|
16
34
|
suspendEvent(name: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* Resume a specific event by name, resuming normal operation
|
|
37
|
+
* @param name
|
|
38
|
+
*/
|
|
17
39
|
resumeEvent(name: string): void;
|
|
40
|
+
/**
|
|
41
|
+
* This listener will not listen to any triggers
|
|
42
|
+
*/
|
|
18
43
|
suspendEvents(): void;
|
|
44
|
+
/**
|
|
45
|
+
* Resume event listening
|
|
46
|
+
*/
|
|
19
47
|
resumeEvents(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Trigger an event with custom parameters
|
|
50
|
+
* @param name The name of the event to trigger
|
|
51
|
+
* @param param The parameters to provide to the associated function
|
|
52
|
+
* @returns The results of the function.
|
|
53
|
+
*/
|
|
20
54
|
triggerEvent(name: string, param?: unknown): unknown[];
|
|
55
|
+
private removeFinishedEvents;
|
|
56
|
+
removeEvents(name: string, f?: (param?: unknown) => unknown): number;
|
|
21
57
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import WMJSMap
|
|
1
|
+
import WMJSMap from './WMJSMap';
|
|
2
2
|
import { isDefined, WMJScheckURL, URLDecode, URLEncode, toArray, debugLogger, DebugType, getUriWithParam } from './WMJSTools';
|
|
3
3
|
import WMGetServiceFromStore from './WMGetServiceFromStore';
|
|
4
4
|
import { parseISO8601DateToDate, DateInterval, parseISO8601IntervalToDateInterval, ParseISOTimeRangeDuration } from './WMTime';
|
|
5
5
|
import I18n from '../utils/I18n/lang.en';
|
|
6
6
|
import WMImage from './WMImage';
|
|
7
7
|
import { getLegendGraphicURLForLayer, legendImageStore } from './WMLegend';
|
|
8
|
-
import {
|
|
9
|
-
import { WMJSService } from './WMJSService';
|
|
8
|
+
import { WMImageEventType } from './WMImageStore';
|
|
9
|
+
import { WMJSService, wmServiceListener } from './WMJSService';
|
|
10
10
|
import { getAlternativeImage } from './WMCanvasBuffer';
|
|
11
11
|
export { default as WMJSDimension, handleMomentISOString, } from './WMJSDimension';
|
|
12
12
|
export { default as WMLayer, LayerType } from './WMLayer';
|
|
13
13
|
export type { LayerOptions, LayerFoundation } from './WMLayer';
|
|
14
14
|
export { default as WMBBOX } from './WMBBOX';
|
|
15
15
|
export type { Bbox } from './WMBBOX';
|
|
16
|
-
export { WMJSMap, DateInterval, parseISO8601IntervalToDateInterval, ParseISOTimeRangeDuration, isDefined, WMGetServiceFromStore, WMJScheckURL, URLEncode, URLDecode, parseISO8601DateToDate, I18n, toArray, getLegendGraphicURLForLayer, legendImageStore, WMImage, debugLogger, DebugType, WMImageEventType, WMJSService,
|
|
16
|
+
export { WMJSMap, DateInterval, parseISO8601IntervalToDateInterval, ParseISOTimeRangeDuration, isDefined, WMGetServiceFromStore, WMJScheckURL, URLEncode, URLDecode, parseISO8601DateToDate, I18n, toArray, getLegendGraphicURLForLayer, legendImageStore, WMImage, debugLogger, DebugType, WMImageEventType, WMJSService, getUriWithParam, getAlternativeImage, wmServiceListener, };
|
|
17
17
|
export * from './types';
|
|
18
18
|
export * from './WMTimeTypes';
|
|
19
19
|
export * from './WMConstants';
|
|
@@ -97,7 +97,7 @@ export interface WMSBoundingBox {
|
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
99
|
/**
|
|
100
|
-
* This interface is for reading from the WMS
|
|
100
|
+
* This interface is for reading from the WMS GetCapabilities document, which can have different structures for V1.1.1 and V1.3.0
|
|
101
101
|
*/
|
|
102
102
|
export interface WMSLayerFromGetCapabilities {
|
|
103
103
|
attr: {
|
package/src/lib/utils/index.d.ts
CHANGED
|
@@ -4,3 +4,6 @@ export * as webmapUtils from './utils';
|
|
|
4
4
|
export * from './utils';
|
|
5
5
|
export * from './testUtils';
|
|
6
6
|
export * from './getCapabilities';
|
|
7
|
+
export type { SpeedFactorType } from './mapConstants';
|
|
8
|
+
export * as mapConstants from './mapConstants';
|
|
9
|
+
export { speedFactors } from './mapConstants';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const defaultAnimationDelayAtStart = 250;
|
|
2
|
+
export declare const defaultDelay = 1000;
|
|
3
|
+
export declare const defaultTimeStep = 60;
|
|
4
|
+
export declare const defaultSecondsPerPx = 80;
|
|
5
|
+
export declare const defaultTimeSpan: number;
|
|
6
|
+
export type SpeedFactorType = 0.1 | 0.2 | 0.5 | 1 | 2 | 4 | 8 | 16;
|
|
7
|
+
export declare const speedFactors: SpeedFactorType[];
|
package/src/lib/utils/utils.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { WMJSDimension, WMJSMap, WMLayer } from '../components';
|
|
2
|
+
import { SpeedFactorType } from './mapConstants';
|
|
2
3
|
export declare const generateLayerId: () => string;
|
|
3
4
|
export declare const generateMapId: () => string;
|
|
4
5
|
export declare const generateTimesliderId: () => string;
|
|
@@ -44,3 +45,12 @@ export declare const getWMJSDimensionForLayerAndDimension: (layerId: string, dim
|
|
|
44
45
|
* @return: The WMJSDimension if found, otherwise null
|
|
45
46
|
*/
|
|
46
47
|
export declare const getWMJSTimeDimensionForLayerId: (layerId: string) => WMJSDimension;
|
|
48
|
+
/**
|
|
49
|
+
* Clears the image store for all maps
|
|
50
|
+
*/
|
|
51
|
+
export declare const clearImageCacheForAllMaps: () => void;
|
|
52
|
+
export declare const roundWithTimeStep: (unixTime: number, timeStep: number, type?: string) => number;
|
|
53
|
+
/**
|
|
54
|
+
* Returns speed delay for given speedFactor. For options, see defined above in "speedFactors"
|
|
55
|
+
*/
|
|
56
|
+
export declare const getSpeedDelay: (speedFactor: SpeedFactorType) => number;
|