UNPKG

adaguc-webmapjs

Version:

Interactive maps library, capable of parsing a OGC WMS getcapabilities and display geographical layers

1 lines 175 kB
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("moment")):"function"==typeof define&&define.amd?define(["moment"],t):"object"==typeof exports?exports["adaguc-webmapjs"]=t(require("moment")):e["adaguc-webmapjs"]=t(e.moment)}(window,(function(__WEBPACK_EXTERNAL_MODULE__2__){return function(e){var t={};function i(s){if(t[s])return t[s].exports;var n=t[s]={i:s,l:!1,exports:{}};return e[s].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=e,i.c=t,i.d=function(e,t,s){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(s,n,function(t){return e[t]}.bind(null,n));return s},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=5)}([function(module,__webpack_exports__,__webpack_require__){"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var i=0;i<t.length;i++){var s=t[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function _createClass(e,t,i){return t&&_defineProperties(e.prototype,t),i&&_defineProperties(e,i),e}__webpack_require__.d(__webpack_exports__,"n",(function(){return isDefined})),__webpack_require__.d(__webpack_exports__,"o",(function(){return isNull})),__webpack_require__.d(__webpack_exports__,"r",(function(){return toArray})),__webpack_require__.d(__webpack_exports__,"e",(function(){return WMJScheckURL})),__webpack_require__.d(__webpack_exports__,"d",(function(){return WMJSKVP})),__webpack_require__.d(__webpack_exports__,"p",(function(){return preventdefaultEvent})),__webpack_require__.d(__webpack_exports__,"g",(function(){return attachEvent})),__webpack_require__.d(__webpack_exports__,"j",(function(){return deleteEvent})),__webpack_require__.d(__webpack_exports__,"k",(function(){return getMouseXCoordinate})),__webpack_require__.d(__webpack_exports__,"l",(function(){return getMouseYCoordinate})),__webpack_require__.d(__webpack_exports__,"a",(function(){return MakeHTTPRequest})),__webpack_require__.d(__webpack_exports__,"b",(function(){return URLDecode})),__webpack_require__.d(__webpack_exports__,"c",(function(){return URLEncode})),__webpack_require__.d(__webpack_exports__,"m",(function(){return getUrlVars})),__webpack_require__.d(__webpack_exports__,"i",(function(){return composeUrlObjectFromURL})),__webpack_require__.d(__webpack_exports__,"h",(function(){return checkIfHashTagChanged})),__webpack_require__.d(__webpack_exports__,"f",(function(){return addMouseWheelEvent})),__webpack_require__.d(__webpack_exports__,"q",(function(){return removeMouseWheelEvent}));var isDefined=function(e){return void 0!==e},isNull=function(e){return null===e},toArray=function(e){if(!e)return[];if(e.length)return e;var t=[];return t[0]=e,t},WMJScheckURL=function(e){return isDefined(e)?(-1===(e=e.trim()).indexOf("?")&&(e+="?"),e):"?"},WMJSSet=function(){};WMJSSet.prototype.add=function(e){this[e]=!0},WMJSSet.prototype.remove=function(e){delete this[e]};var WMJSKVP=function(){function e(t){return _classCallCheck(this,e),this.kvplist=[],this.kvplist=this._parse(t),this.kvplist}return _createClass(e,[{key:"_parse",value:function(e){var t=[],i=e.split("&");if(i)for(var s in i){var n=i[s].split("=");if(2===n.length){var a=n[0],o=n[1];t[a]instanceof Array||(t[a]=[]),t[a].push(o)}}return t}},{key:"getKeys",value:function(){var e=new WMJSSet;for(var t in this.kvplist)e.add(t);return e}},{key:"getValues",value:function(e){return this.kvplist[e]}},{key:"getKeyValues",value:function(){return this.kvplist}}]),e}(),preventdefaultEvent=function(e){var t=e||window.event;t.preventDefault?t.preventDefault():t.returnValue=!1},attachEvent=function(e,t,i){if(e){if("mousewheel"==t){var s=function(e,t){var i=0;e||(e=window.event,window.event.cancelBubble=!0,window.event.returnValue=!1),e.wheelDelta?i=e.wheelDelta/120:e.detail&&(i=-e.detail/3),i&&t(i),e.preventDefault&&e.preventDefault(),e.returnValue=!1};return e.addEventListener&&e.addEventListener("DOMMouseScroll",(function(e){s(e,i)}),!1),void(e.onmousewheel=document.onmousewheel=function(e){s(e,i)})}if(browser.isNS)e.addEventListener(t,i,!0);else{if(e.attachEvent("on"+t,i),null==window.event)return;window.event.cancelBubble=!0,window.event.returnValue=!1}}},deleteEvent=function(e,t,i){var s=!0;browser.isOP&&(s=!1),e.removeEventListener?e.removeEventListener(t,i,s):e.detachEvent&&(e.detachEvent(t,i),e.detachEvent("on"+t,i))},getMouseXCoordinate=function(e){return browser.isNS?e.clientX+window.scrollX:window.event.clientX+document.documentElement.scrollLeft+document.body.scrollLeft},getMouseYCoordinate=function(e){return browser.isNS?e.clientY+window.scrollY:window.event.clientY+document.documentElement.scrollTop+document.body.scrollTop},findElementPos=function(e){for(var t=e,i=curtop=0;e;)i+=e.offsetLeft,curtop+=e.offsetTop,e=e.offsetParent;return[i,curtop,parseInt(t.style.width+i),parseInt(t.style.height+curtop)]};function Browser(){this.isIE=!1,this.isNS=!1,this.isOP=!1,this.isKonqueror=!1,this.name=navigator.appName,this.version=null,navigator.userAgent,-1!=navigator.userAgent.indexOf("Opera")?this.isOP=!0:"Netscape"==navigator.appName||"Konqueror"==navigator.appName?(this.isNS=!0,this.isKonqueror=!0):-1!=navigator.appName.indexOf("Microsoft")&&(this.isIE=!0)}var browser=new Browser;function IsNumeric(e){var t,s=!0;for(i=0;i<e.length&&1==s;i++)t=e.charAt(i),-1=="0123456789.".indexOf(t)&&(s=!1);return s}function dump(e,t,i){var s="";i||(i=""),t||(t=0);if("object"===_typeof(e))for(var n in e){var a=e[n],o=i;IsNumeric(n)?(n="["+n+"]",o=i.substr(0,i.length-1)+n):o=i+n,"object"===_typeof(a)?s+=dump(a,t+1,o+"."):s+=o+'="'+a+'"<br>\n'}else s="===>"+e+"<===("+_typeof(e)+")";return s}var Url={encode:function(e){return escape(this._utf8_encode(e))},decode:function(e){return alert("Deprecated function !!! WMJSTools line 325 with ["+e+"]"),this._utf8_decode(unescape(e))},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");for(var t="",i=0;i<e.length;i++){var s=e.charCodeAt(i);s<128?t+=String.fromCharCode(s):s>127&&s<2048?(t+=String.fromCharCode(s>>6|192),t+=String.fromCharCode(63&s|128)):(t+=String.fromCharCode(s>>12|224),t+=String.fromCharCode(s>>6&63|128),t+=String.fromCharCode(63&s|128))}return t},_utf8_decode:function(e){for(var t="",i=0,s=c1=c2=0;i<e.length;)(s=e.charCodeAt(i))<128?(t+=String.fromCharCode(s),i++):s>191&&s<224?(c2=e.charCodeAt(i+1),t+=String.fromCharCode((31&s)<<6|63&c2),i+=2):(c2=e.charCodeAt(i+1),c3=e.charCodeAt(i+2),t+=String.fromCharCode((15&s)<<12|(63&c2)<<6|63&c3),i+=3);return t}};function createXHR(){try{return new XMLHttpRequest}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){}try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}return!1}function MakeJSONRequest(fname,callbackfunction,errorfunction,pointer,useredirect){function requestError(e){errorfunction?errorfunction(e,pointer):callbackfunction(void 0,pointer)}function redirRequest(){0==useredirect?MakeJSONRequest(fname=requestProxy+"REQUEST="+URLEncode(fname),callbackfunction,errorfunction,pointer,!0):requestError("status("+xhr.status+") to "+fname)}-1==fname.indexOf("?")?fname+="?":fname+="&",fname+="rand="+Math.random(),useredirect||(useredirect=!1);try{var xhr=createXHR();xhr.open("GET",fname,!0),xhr.onreadystatechange=function(){if(4==xhr.readyState)if(200==xhr.status){try{var data=eval("("+xhr.responseText+")")}catch(e){return void requestError("Invalid JSON: '"+xhr.responseText+"'")}null==data?requestError("request returned no data:"+fname):callbackfunction(data,pointer)}else redirRequest()},xhr.send(null)}catch(e){redirRequest()}}var MakeHTTPRequest=function e(t,i,s,n,a,o){function r(e){s?s(e,n):i(void 0,n)}function h(){!1===a?(t=o+"REQUEST="+URLEncode(t),e(t,i,s,n,!0,o)):r("status("+l.status+") to "+t)}-1===t.indexOf("?")?t+="?":t+="&",t+="rand="+Math.random(),a||(a=!1);try{var l=createXHR();l.open("GET",t,!0),l.onreadystatechange=function(){if(4===l.readyState)if(200===l.status){try{var e=l.responseText}catch(e){return void r("Exception occured:"+e)}void 0===e||""===e?r("request returned no data"):i(e,n)}else h()},l.send(null)}catch(e){h()}},URLDecode=function(e){return isDefined(e)?e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("+"," ")).replaceAll("%2B","+")).replaceAll("%20"," ")).replaceAll("%5E","^")).replaceAll("%26","&")).replaceAll("%3F","?")).replaceAll("%3E",">")).replaceAll("%3C","<")).replaceAll("%5C","\\")).replaceAll("%2F","/")).replaceAll("%25","%")).replaceAll("%3A",":")).replaceAll("%27","'")).replaceAll("%24","$"):""},URLEncode=function(e){if(!e)return e;if(void 0===e)return e;if(""===e)return e;if("string"!=typeof e)return e;var t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz%-_.!~*'()",i="0123456789ABCDEF";e=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/%/g,"%25")).replace(/\+/g,"%2B")).replace(/ /g,"%20")).replace(/\^/g,"%5E")).replace(/&/g,"%26")).replace(/\?/g,"%3F")).replace(/>/g,"%3E")).replace(/</g,"%3C")).replace(/\\/g,"%5C");for(var s="",n=0;n<e.length;n++){var a=e.charAt(n);if(" "===a)s+="%20";else if(-1!==t.indexOf(a))s+=a;else{var o=a.charCodeAt(0);o>255?(alert("Unicode Character '"+a+"' cannot be encoded using standard URL encoding.\n(URL encoding only supports 8-bit characters.)\nA space (+) will be substituted."),s+="+"):(s+="%",s+=i.charAt(o>>4&15),s+=i.charAt(15&o))}}return s};function checkValidInputTokens(e){var t=/^([a-zA-Z'_:~%?\$,\.\0-9 \-=/&])+$/;if(t.test(e)){var i=URLDecode(e);if(t.test(i))return!0}return!1}String.prototype.replaceAll=function(e,t){for(var i=this,s=i.indexOf(e);-1!=s;)s=(i=i.replace(e,t)).indexOf(e);return i},String.prototype.trim=function(){var e=this;return e=(e=e.replace(/^\s+/,"")).replace(/\s+$/,"")};var getUrlVars=function(){for(var e,t=[],i=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),s=0;s<i.length;s++)(e=i[s].split("="))[1]=URLDecode(e[1]),0==checkValidInputTokens(e[0])||0==checkValidInputTokens(e[1])||(t[e[0]]=e[1]+"");return t};function getUrlVarsFromHashTag(){var e,t=[],i=window.location.hash.indexOf("#");"?"==window.location.hash[i+1]&&i++;for(var s=window.location.hash.slice(i+1).split("&"),n=0;n<s.length;n++)(e=s[n].split("="))[1]=URLDecode(e[1]),0==checkValidInputTokens(e[0])||0==checkValidInputTokens(e[1])||(t[e[0]]=e[1]+"");return t}var composeUrlObjectFromURL=function(e){var t=[];if(!isDefined(e))return t;var i="",s=[],n=e.split("?");n.length>1?(i=n[0],s=n[1].split("&")):s=n[0].split("&");for(var a=0;a<s.length;a++){var o=s[a].split("=");isDefined(o[1])?(o[1]=URLDecode(o[1]),0==checkValidInputTokens(o[0])||0==checkValidInputTokens(o[1])||isDefined(o[1])&&o[1].length>0&&(t[o[0].toLowerCase()]=o[1]+"")):(o=s[a].split("%3D"),isDefined(o[1])&&(o[1]=URLDecode(o[1]),0==checkValidInputTokens(o[0])||0==checkValidInputTokens(o[1])||isDefined(o[1])&&o[1].length>0&&(t[o[0].toLowerCase()]=o[1]+"")))}return s[0].indexOf("="),{location:i,kvp:t}},currentLocationHash="",hashTagCheckerInUse=!1,hashTagTimerIsRunning=!1,_checkIfHashTagChanged=function e(t){var i=window.location.hash;if(currentLocationHash!=i&&i.length>0&&(currentLocationHash=i,-1!=window.location.href.indexOf("#"))){var s=window.location.href.split("#")[1];s=s.replaceAll("%27","'");var n=getUrlVarsFromHashTag();isDefined(n.clearhash)&&"1"==n.clearhash&&(window.location.hash="",currentLocationHash=""),t(s,n)}!0!==hashTagTimerIsRunning&&(hashTagTimerIsRunning=!0,setTimeout((function(){hashTagTimerIsRunning=!1,e(t)}),500))},checkIfHashTagChanged=function(e){isDefined(e)&&(1!=hashTagCheckerInUse?(hashTagCheckerInUse=!0,_checkIfHashTagChanged(e)):alert("checkIfHashTagChanged is in use"))},decodeBase64=function(e){var t,i,s,n={},a=0,o=0,r="",h=String.fromCharCode,l=e.length;for(t=0;t<64;t++)n["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t)]=t;for(i=0;i<l;i++)for(a=(a<<6)+n[e.charAt(i)],o+=6;o>=8;)((s=a>>>(o-=8)&255)||i<l-2)&&(r+=h(s));return r},addMouseWheelEvent=function(e,t){if(e){if(!window.addWheelListener){var i,s,n=function(e,t,n,o){e[i](a+t,"wheel"==s?n:function(e){!e&&(e=window.event);var t={originalEvent:e,target:e.target||e.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==e.type?0:1,deltaX:0,deltaY:0,deltaZ:0,preventDefault:function(){e.preventDefault?e.preventDefault():e.returnValue=!1}};return"mousewheel"==s?(t.deltaY=-1/40*e.wheelDelta,e.wheelDeltaX&&(t.deltaX=-1/40*e.wheelDeltaX)):t.deltaY=e.deltaY||e.detail,n(t)},o||!1)},a="";window.addEventListener?i="addEventListener":(i="attachEvent",a="on"),s="onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll",window.addWheelListener=function(e,t,i){n(e,s,t,i),"DOMMouseScroll"==s&&n(e,"MozMousePixelScroll",t,i)}}window.addWheelListener(e,t)}},removeMouseWheelEvent=function(e,t){console.warn("TODO: Implement removeMouseWheelEvent in WMJSTools.js")}},function(e,t,i){"use strict";(function(e){i.d(t,"a",(function(){return o})),i.d(t,"c",(function(){return a}));var s=i(2),n=i.n(s);i.d(t,"b",(function(){return n.a}));var a=window.proj4||e.proj4,o=window.jQuery||window.$||e.$||e.jQuery}).call(this,i(3))},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE__2__},function(e,t){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(e){"object"==typeof window&&(i=window)}e.exports=i},function(e){e.exports=JSON.parse('{"name":"adaguc-webmapjs","version":"3.3.26","description":"Interactive maps library, capable of parsing a OGC WMS getcapabilities and display geographical layers","main":"./dist/adaguc-webmapjs.js","scripts":{"clean":"rm -rf dist lib node_modules","build":"webpack --display-modules","babel":"babel src --out-dir lib"},"repository":{"type":"git","url":"git+ssh://git@github.com/maartenplieger/adaguc-webmapjs.git"},"keywords":["OGC","WMS","Geographical","Maps","Layers","Visualization","Canvas"],"author":"Maarten Plieger","license":"MIT","bugs":{"url":"https://github.com/maartenplieger/adaguc-webmapjs/issues"},"homepage":"https://github.com/maartenplieger/adaguc-webmapjs#readme","peerDependencies":{"jquery-ui-dist":"^1.12.1","proj4":"^2.5.0"},"dependencies":{"jquery":"^3.5.1","jshint":"^2.11.1","moment":"^2.26.0"},"devDependencies":{"@babel/cli":"^7.10.1","@babel/core":"^7.10.2","@babel/preset-env":"^7.10.2","@babel/preset-stage-2":"^7.8.3","babel-cli":"^6.26.0","babel-core":"^6.26.3","babel-eslint":"^10.1.0","babel-loader":"^8.1.0","babel-preset-env":"^1.7.0","babel-preset-react":"^6.24.1","babel-register":"^6.26.0","eslint":"^5.16.0","eslint-config-standard":"^12.0.0","eslint-config-standard-react":"^7.0.2","eslint-plugin-babel":"^5.3.0","eslint-plugin-import":"^2.21.2","eslint-plugin-json":"^1.4.0","eslint-plugin-node":"^9.2.0","eslint-plugin-promise":"^4.1.1","eslint-plugin-react":"^7.20.0","eslint-plugin-standard":"^4.0.1","source-map":"^0.7.3","webpack":"^4.43.0","webpack-cli":"^3.3.12"}}')},function(e,t,i){"use strict";i.r(t),i.d(t,"WMJSMap",(function(){return $})),i.d(t,"DateInterval",(function(){return se})),i.d(t,"parseISO8601IntervalToDateInterval",(function(){return ae})),i.d(t,"ParseISOTimeRangeDuration",(function(){return oe})),i.d(t,"isDefined",(function(){return n.n})),i.d(t,"WMJSLayer",(function(){return xe})),i.d(t,"getUrlVars",(function(){return n.m})),i.d(t,"checkIfHashTagChanged",(function(){return n.h})),i.d(t,"WMJSTimer",(function(){return O})),i.d(t,"WMJSGetServiceFromStore",(function(){return ye})),i.d(t,"WMJScheckURL",(function(){return n.e})),i.d(t,"URLEncode",(function(){return n.c})),i.d(t,"URLDecode",(function(){return n.b})),i.d(t,"WMJSDateOutSideRange",(function(){return c})),i.d(t,"WMJSDateTooEarlyString",(function(){return m})),i.d(t,"WMJSDateTooLateString",(function(){return f})),i.d(t,"WMJSEmptyLayerName",(function(){return u})),i.d(t,"WMJSEmptyLayerTitle",(function(){return d})),i.d(t,"parseISO8601DateToDate",(function(){return ne})),i.d(t,"I18n",(function(){return A})),i.d(t,"addMouseWheelEvent",(function(){return n.f})),i.d(t,"removeMouseWheelEvent",(function(){return n.q})),i.d(t,"WMJSKVP",(function(){return n.d})),i.d(t,"composeUrlObjectFromURL",(function(){return n.i})),i.d(t,"WMJSBBOX",(function(){return B})),i.d(t,"toArray",(function(){return n.r}));var s=i(1),n=i(0);function a(e,t){for(var i=0;i<t.length;i++){var s=t[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}var o=0,r=function(){function e(t,i,a,o){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.randomize=!0,this._srcLoaded=void 0,this._isLoaded=void 0,this._isLoading=void 0,this._hasError=void 0,this._opacity=void 0,Object(n.n)(o)&&Object(n.n)(o.randomizer)&&!1===o.randomizer&&(this.randomize=!1),this.init=this.init.bind(this),this.isLoaded=this.isLoaded.bind(this),this.isLoading=this.isLoading.bind(this),this.checkIfThisSourceIsSet=this.checkIfThisSourceIsSet.bind(this),this.setSource=this.setSource.bind(this),this.clear=this.clear.bind(this),this.getSrc=this.getSrc.bind(this),this.hasError=this.hasError.bind(this),this.stopLoading=this.stopLoading.bind(this),this._load=this._load.bind(this),this.load=this.load.bind(this),this.loadEvent=this.loadEvent.bind(this),this.setOpacity=this.setOpacity.bind(this),this.getOpacity=this.getOpacity.bind(this),this.setPosition=this.setPosition.bind(this),this.setSize=this.setSize.bind(this),this.setZIndex=this.setZIndex.bind(this),this.getElement=this.getElement.bind(this),this._getImageWithHeaders=this._getImageWithHeaders.bind(this),this.init(),this.srcToLoad=t,this._type=a,this.loadEventCallback=i,s.a?(this.el=Object(s.a)(document.createElement("img")),this.el.on("load",(function(){r.loadEvent(r,!1)})),this.el.on("error",(function(e){r.loadEvent(r,!0)})),this.el.onselectstart=function(){return!1},this.el.ondrag=function(){return!1},this.headers=[]):console.warn("WMJSImage: jquery is not defined, assuming unit test is running")}var t,i,r;return t=e,(i=[{key:"init",value:function(){this._srcLoaded="undefined image",this._isLoaded=!1,this._isLoading=!1,this._hasError=!1,this._opacity=1,this._stopLoading=!1}},{key:"isLoaded",value:function(){return!this._isLoading&&this._isLoaded}},{key:"isLoading",value:function(){return this._isLoading}},{key:"checkIfThisSourceIsSet",value:function(e){return this._srcLoaded===e||this.srcToLoad===e}},{key:"setSource",value:function(e,t){this._isLoading?console.error("-------------------------\x3e Source set while still loading!!! "):(this.srcToLoad=e,t&&t.headers&&t.headers.length>0&&(this.headers=t.headers),this._srcLoaded!==this.srcToLoad?this._isLoaded=!1:this._isLoaded=!0)}},{key:"clear",value:function(){this.init(),this._stopLoading=!0}},{key:"stopLoading",value:function(){this._stopLoading=!0}},{key:"getSrc",value:function(){return this.srcToLoad}},{key:"hasError",value:function(){return this._hasError}},{key:"load",value:function(){this._stopLoading=!1,this._load()}},{key:"_getImageWithHeaders",value:function(e,t){var i=this,s=new Headers;if(t&&t.length>0)for(var n=0;n<t.length;n++)s.append(t[n].name,t[n].value);var a={method:"GET",headers:s,mode:"cors",cache:"default"},o=new Request(e);fetch(o,a).then((function(e){e.arrayBuffer().then((function(e){var t=function(e){var t="";return[].slice.call(new Uint8Array(e)).forEach((function(e){t+=String.fromCharCode(e)})),window.btoa(t)}(e);i.getElement()[0].src="data:image/png;base64,"+t}))})).catch((function(s){console.error("Unable to fetch image "+e+" with headers ["+JSON.stringify(t)+"]"),e.startsWith("http://")&&console.error("Note that URL starts with http:// instead of https://"),i.loadEvent(i,!0)}))}},{key:"_load",value:function(){var e=this;if(this._hasError=!1,!0!==this._isLoaded){if(this._isLoading=!0,!this.srcToLoad)return console.error("Source not set"),void this.loadEvent(this,!0);if(this.srcToLoad.startsWith("/")&&!this.srcToLoad.startsWith("//")){var t=window.location.href.split("/").filter((function(e){return e.length>0})),i=t[0]+"//"+t[1]+"/";this.srcToLoad=i+this.srcToLoad}if(!1===this.srcToLoad.startsWith("http")&&!1===this.srcToLoad.startsWith("//"))return console.error("Source does not start with http"),void this.loadEvent(this,!0);this.srcToLoad!==this._srcLoaded?!0!==this.timerIsRunning&&(o>=4?!1===this._stopLoading?(this.timerIsRunning=!0,setTimeout((function(){e.timerIsRunning=!1,e._load()}),10)):this.init():(o++,this.headers&&this.headers.length>0?this._getImageWithHeaders(this.srcToLoad,this.headers):this.randomize?this.getElement()[0].src=this.srcToLoad+"&"+Math.random():this.getElement()[0].src=this.srcToLoad)):this.loadEvent(this,!1)}else this.loadEvent(this,!1)}},{key:"loadEvent",value:function(e,t){o--,this._hasError=t,this._isLoading=!1,this._isLoaded=!0,this._srcLoaded=this.srcToLoad,Object(n.n)(this.loadEventCallback)&&this.loadEventCallback(this)}},{key:"setOpacity",value:function(e){this._opacity=parseFloat(e),this.el.css("opacity",this._opacity)}},{key:"getOpacity",value:function(e){return this._opacity}},{key:"setPosition",value:function(e,t){this.el.css({top:parseInt(t)+"px",left:parseInt(e)+"px",position:"absolute"})}},{key:"setSize",value:function(e,t){e=parseInt(e),t=parseInt(t),0!==e&&0!==t&&(isNaN(e)||isNaN(t)||(this.el.width(parseInt(e)+"px"),this.el.height(parseInt(t)+"px")))}},{key:"setZIndex",value:function(e){this.el.zIndex=e}},{key:"getElement",value:function(){return this.el}}])&&a(t.prototype,i),r&&a(t,r),e}();function h(e,t){for(var i=0;i<t.length;i++){var s=t[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}var l=function(){function e(t,i,s){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.imagesbysrc={},this.imageLife=0,this._imageLifeCounter=0,this._type=i,this._loadEventCallbackList=[],this._maxNumberOfImages=t,this._options=s,this.imageLoadEventCallback=this.imageLoadEventCallback.bind(this),this.getImageForSrc=this.getImageForSrc.bind(this),this.clear=this.clear.bind(this),this.stopLoading=this.stopLoading.bind(this),this.addLoadEventCallback=this.addLoadEventCallback.bind(this),this.getNumImagesLoading=this.getNumImagesLoading.bind(this),this.getImage=this.getImage.bind(this),this.emptyImage=new r}var t,i,s;return t=e,(i=[{key:"imageLoadEventCallback",value:function(e,t){for(var i=0;i<this._loadEventCallbackList.length;i++)this._loadEventCallbackList[i].callback(e)}},{key:"_getKeys",value:function(e){if(Object.keys)return Object.keys(e);var t,i=[];for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&i.push(t);return i}},{key:"getImageForSrc",value:function(e){if(this.imagesbysrc[e])return this.imagesbysrc[e]}},{key:"clear",value:function(){for(var e in this.imagesbysrc)this.imagesbysrc.hasOwnProperty(e)&&this.imagesbysrc[e].clear()}},{key:"stopLoading",value:function(){for(var e in this.imagesbysrc)this.imagesbysrc.hasOwnProperty(e)&&this.imagesbysrc[e].stopLoading()}},{key:"addLoadEventCallback",value:function(e,t){t?e?this._loadEventCallbackList.push({id:t,callback:e}):console.error("addLoadEventCallback: callback not provided"):console.error("addLoadEventCallback: id not provided")}},{key:"removeEventCallback",value:function(e){for(var t=0;t<this._loadEventCallbackList.length;t++)this._loadEventCallbackList[t].id===e&&this._loadEventCallbackList.splice(t,1)}},{key:"getNumImagesLoading",value:function(){var e=0;for(var t in this.imagesbysrc)this.imagesbysrc.hasOwnProperty(t)&&this.imagesbysrc[t].isLoading()&&e++;return e}},{key:"getImage",value:function(e,t){var i=this;if(e){var s=this.getImageForSrc(e);if(void 0!==s)return s.imageLife=this._imageLifeCounter++,s;if(this._getKeys(this.imagesbysrc).length<this._maxNumberOfImages)return(s=new r(e,this.imageLoadEventCallback,this._type,this._options)).setSource(e,t),s.KVP=new n.d(e),this.imagesbysrc[e]=s,s.imageLife=this._imageLifeCounter++,s;var a=-1,o=this._imageLifeCounter;return Object.keys(this.imagesbysrc).forEach((function(e){var t=i.imagesbysrc[e];!1===t.isLoading()&&o>=t.imageLife&&(o=t.imageLife,a=e)})),-1===a?(console.error("not enough cache for "+this._type),this.emptyImage):(s=this.imagesbysrc[a],delete this.imagesbysrc[a],s.clear(),s.setSource(e,t),s.KVP=new n.d(e),this.imagesbysrc[e]=s,s.imageLife=this._imageLifeCounter++,s)}console.log("getImage, no src set")}}])&&h(t.prototype,i),s&&h(t,s),e}(),u="empty_layer",d="empty layer",c="outside range",m="date too early",f="date too late",p=function(e){console.log("error:"+e)},g="1.0.0",v="1.1.1",y="1.3.0",b=[["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"]];function _(e){return(_="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function x(e,t){for(var i=0;i<t.length;i++){var s=t[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}var B=function(){function e(t,i,s,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.left=-180,this.bottom=-90,this.right=180,this.top=90,this.clone=this.clone.bind(this),this.copy=this.copy.bind(this),this.setBBOX=this.setBBOX.bind(this),this.equals=this.equals.bind(this),this.toString=this.toString.bind(this),this.setBBOX(t,i,s,n)}var t,i,s;return t=e,(i=[{key:"clone",value:function(t){void 0===t&&(t=this);var i=new e;return i.left=t.left,i.bottom=t.bottom,i.right=t.right,i.top=t.top,i}},{key:"copy",value:function(e){this.setBBOX(e)}},{key:"setBBOX",value:function(e,t,i,s){if(null==e)return this.left=-180,this.bottom=-90,this.right=180,void(this.top=90);if(!t)if("object"===_(e)){var n=e;void 0===n.length||null===n.length?(e=n.left,t=n.bottom,i=n.right,s=n.top):(e=parseFloat(n[0]),t=parseFloat(n[1]),i=parseFloat(n[2]),s=parseFloat(n[3]))}else try{var a=e.split(",");4!==a.length&&p("Invalid map bounding box: '"+e+"'"),e=parseFloat(a[0]),t=parseFloat(a[1]),i=parseFloat(a[2]),s=parseFloat(a[3])}catch(e){}void 0!==e&&void 0!==t&&void 0!==i&&void 0!==s&&null!==e&&null!==t&&null!==i&&null!==s||(void 0===e&&(e=-180),void 0===i&&(i=180),void 0===t&&(t=-90),void 0===s&&(s=90)),this.left=e,this.bottom=t,this.right=i,this.top=s}},{key:"equals",value:function(e,t,i,s){if(!e)return!1;if(void 0!==t&&this.left===e&&this.right===i&&this.top===s&&this.bottom===t)return!0;if("object"===_(e)){if(this.left===e.left&&this.right===e.right&&this.top===e.top&&this.bottom===e.bottom)return!0}else{var n=e.split(",");4!==n.length&&console.log("Invalid map bounding box: "+e);var a=parseFloat(n[0]);t=parseFloat(n[1]),i=parseFloat(n[2]),s=parseFloat(n[3]);var o=0;if(this.left===a&&o++,this.right===i&&o++,this.top===s&&o++,this.bottom===t&&o++,o>=2)return!0}return!1}},{key:"toString",value:function(){return this.left+","+this.bottom+","+this.right+","+this.top}}])&&x(t.prototype,i),s&&x(t,s),e}();var w=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.bbox=new B,this.srs="EPSG:4326"};function L(e,t){for(var i=0;i<t.length;i++){var s=t[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function S(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var k=function e(){S(this,e),this.name=void 0,this.functionpointer=void 0,this.finished=0,this.keepOnCall=!1},T=function(){function e(){S(this,e),this._callBacks=[],this._suspendedEvents=[],this.addToCallback=this.addToCallback.bind(this),this.removeEvents=this.removeEvents.bind(this),this.suspendEvent=this.suspendEvent.bind(this),this.resumeEvent=this.resumeEvent.bind(this),this.suspendEvents=this.suspendEvents.bind(this),this.resumeEvents=this.resumeEvents.bind(this),this.triggerEvent=this.triggerEvent.bind(this),this.destroy=this.destroy.bind(this),this._allEventsSuspended=!1}var t,i,s;return t=e,(i=[{key:"addToCallback",value:function(e,t,i){var s=-1;i||(i=!1);for(var n=0;n<this._callBacks.length;n++){if(1===this._callBacks[n].finished){s=n;break}if(this._callBacks[n].name===e&&this._callBacks[n].functionpointer===t)return this._callBacks[n].keepOnCall=i,!1}return-1===s&&(s=this._callBacks.length,this._callBacks.push(new k)),this._callBacks[s].name=e,this._callBacks[s].functionpointer=t,this._callBacks[s].finished=0,this._callBacks[s].keepOnCall=i,!0}},{key:"removeEvents",value:function(e,t){for(var i=0;i<this._callBacks.length;i++)0===this._callBacks[i].finished&&this._callBacks[i].name===e&&(t?this._callBacks[i].functionpointer===t&&(this._callBacks[i].finished=1):this._callBacks[i].finished=1)}},{key:"destroy",value:function(){this._callBacks.length=0}},{key:"suspendEvent",value:function(e){this._suspendedEvents[e]=!0}},{key:"resumeEvent",value:function(e){this._suspendedEvents[e]=!1}},{key:"suspendEvents",value:function(){this._allEventsSuspended=!0}},{key:"resumeEvents",value:function(){this._allEventsSuspended=!1}},{key:"triggerEvent",value:function(e,t){if(!0!==this._allEventsSuspended&&!0!==this._suspendedEvents[e]){for(var i=[],s=0;s<this._callBacks.length;s++)if(0===this._callBacks[s].finished&&this._callBacks[s].name===e){!1===this._callBacks[s].keepOnCall&&(this._callBacks[s].finished=1);try{i.push(this._callBacks[s].functionpointer(t,this))}catch(i){console.log("Error for event ["+e+"]: ",t,i)}}return i}}}])&&L(t.prototype,i),s&&L(t,s),e}();function O(){this.init=function(i,s){(e=parseInt(i/10+.5))<1&&(e=1),t=e=1,a=s,o(),n=i/1,e>0&&r()},this.reset=function(){e=t,e=1},this.stop=function(){o()};var e,t,i=null,s=!1,n=10,a="";function o(){s&&clearTimeout(i),s=!1}function r(){0==e?(o(),""!=a&&a()):(e-=1,s=!0,i=setTimeout(r,n))}}function M(e,t){for(var i=0;i<t.length;i++){var s=t[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}var C=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._isRunning=!1,this._milliseconds=10,this._stop=!1,this.init=this.init.bind(this),this.stop=this.stop.bind(this)}var t,i,s;return t=e,(i=[{key:"init",value:function(e,t){var i=this;this._stop=!1,this._milliseconds=e,this._milliseconds<10&&(this._milliseconds=50),!1===this._isRunning&&(self.setTimeout((function(){i._isRunning=!1,!1===i._stop&&t()}),this._milliseconds),this._isRunning=!0)}},{key:"stop",value:function(){this._stop=!0}}])&&M(t.prototype,i),s&&M(t,s),e}();function I(e,t){for(var i=0;i<t.length;i++){var s=t[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}var E=function(){function e(t,i,n,a,o,h){var l=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),s.a?(this.canvas=Object(s.a)("<canvas/>",{class:"WMJSCanvasBuffer"}).width(a).height(o),this._ctx=this.canvas[0].getContext("2d"),this._ctx.canvas.width=a,this._ctx.canvas.height=o,this._imageStore=n,this.ready=!0,this.hidden=!0,this.layerstodisplay=[],this.layers=[],this._defaultImage=new r("webmapjs/img/stoploading.png",(function(){console.log("no image loaded"),l._statDivBufferImageLoaded()}),this._type),this._currentbbox=void 0,this._currentnewbbox=void 0,this._width=a,this._height=o,this._type=i,this._webmapJSCallback=t,this._internalCallbacks=h,"imagebuffer"===this._type&&this.canvas.addClass("wmjsimagebuffer"),"legendbuffer"===this._type&&this.canvas.addClass("wmjslegendbuffer"),this.canvas.addClass("WMJSCanvasBuffer-noselect"),this.getCanvasContext=this.getCanvasContext.bind(this),this.imageLoadComplete=this.imageLoadComplete.bind(this),this._statDivBufferImageLoaded=this._statDivBufferImageLoaded.bind(this),this.hide=this.hide.bind(this),this.display=this.display.bind(this),this.finishedLoading=this.finishedLoading.bind(this),this.resize=this.resize.bind(this),this.load=this.load.bind(this),this.setSrc=this.setSrc.bind(this),this._getPixelCoordFromGeoCoord=this._getPixelCoordFromGeoCoord.bind(this),this.setBBOX=this.setBBOX.bind(this),this.getBuffer=this.getBuffer.bind(this)):console.warn("WMJSCanvasBuffer: jquery is not defined, assuming unit test is running")}var t,i,a;return t=e,(i=[{key:"getCanvasContext",value:function(){return this._ctx}},{key:"imageLoadComplete",value:function(e){this._statDivBufferImageLoaded(),this._webmapJSCallback.triggerEvent("onimageload"),"imagebuffer"===this._type&&this._webmapJSCallback.triggerEvent("onimagebufferimageload",e)}},{key:"_statDivBufferImageLoaded",value:function(){for(var e=0;e<this.layers.length;e++)if(!1===this.layers[e].image.isLoaded())return;this.finishedLoading()}},{key:"hide",value:function(){this.hidden=!0,this.canvas.hide(),this.layers.length=0,this.layerstodisplay.length=0}},{key:"display",value:function(e,t){var i=[];if(!e||t){var s,n;if(this.hidden=!1,this._ctx.globalAlpha=1,"legendbuffer"===this._type&&this._ctx.clearRect(0,0,this._width,this._height),"imagebuffer"===this._type&&(this._ctx.beginPath(),this._ctx.rect(0,0,this._width,this._height),this._ctx.fillStyle="white",this._ctx.fill(),this._webmapJSCallback.triggerEvent("beforecanvasstartdraw",this._ctx),this._internalCallbacks&&this._internalCallbacks.beforecanvasstartdraw&&this._internalCallbacks.beforecanvasstartdraw(this._ctx)),e){var a=t,o=e;s=this._getPixelCoordFromGeoCoord({x:a.left,y:a.top},o),n=this._getPixelCoordFromGeoCoord({x:a.right,y:a.bottom},o)}for(var r=0,h=0;h<this.layerstodisplay.length;h++)if(this.layerstodisplay[h].image.setSize(this._width,this._height),!1===this.layerstodisplay[h].image.hasError()){var l=this.layerstodisplay[h].opacity;this._ctx.globalAlpha=l;var u=this.layerstodisplay[h].image.getElement()[0];if("legendbuffer"===this._type){var d=parseInt(u.width)+4,c=parseInt(u.height)+4;r+=d+4;var m=this._width-r+2,f=this._height-c-2;this._ctx.beginPath(),this._ctx.fillStyle="#FFFFFF",this._ctx.lineWidth=.3,this._ctx.globalAlpha=.5,this._ctx.strokeStyle="#000000",this._ctx.rect(parseInt(m)+.5,parseInt(f)+.5,d,c),this._ctx.fill(),this._ctx.stroke(),this._ctx.globalAlpha=1;try{this._ctx.drawImage(u,m,f)}catch(e){console.log("146",e)}}else if(e){var p=parseInt(s.x+.5),g=parseInt(s.y+.5),v=parseInt(n.x-s.x+.5),y=parseInt(n.y-s.y+.5);if(v===parseInt(this._ctx.canvas.width)&&y===parseInt(this._ctx.canvas.height))try{this._ctx.drawImage(u,p,g)}catch(e){console.log("159",e)}else try{this._ctx.drawImage(u,p,g,v,y)}catch(e){console.log("165",e)}}else try{this._ctx.drawImage(u,0,0,this._width,this._height)}catch(e){console.log("172",e)}}else i.push(this.layerstodisplay[h]);this._ctx.globalAlpha=1,"imagebuffer"===this._type&&i.length>0&&(this._webmapJSCallback.triggerEvent("canvasonerror",i),this._internalCallbacks&&this._internalCallbacks.canvasonerror&&this._internalCallbacks.canvasonerror(i)),"imagebuffer"===this._type&&(this._webmapJSCallback.triggerEvent("beforecanvasdisplay",this._ctx),this._internalCallbacks&&this._internalCallbacks.beforecanvasdisplay&&this._internalCallbacks.beforecanvasdisplay(this._ctx)),this.canvas.show(),"imagebuffer"===this._type&&(this._webmapJSCallback.triggerEvent("aftercanvasdisplay",this._ctx),this._internalCallbacks&&this._internalCallbacks.aftercanvasdisplay&&this._internalCallbacks.aftercanvasdisplay(this._ctx))}else console.error("skipping WMJSCanvasBuffer:display because newbbox is undefined")}},{key:"finishedLoading",value:function(){if(!this.ready){this.ready=!0,this.layerstodisplay.length=0;for(var e=0;e<this.layers.length;e++)this.layerstodisplay.push(this.layers[e]),this.layers[e].image.hasError()&&p("image error: "+this.layerstodisplay[e].image.getSrc());try{Object(n.n)(this.onLoadReadyFunction)&&this.onLoadReadyFunction(this)}catch(e){p("Exception in Divbuffer::finishedLoading: "+e)}}}},{key:"resize",value:function(e,t){e=parseInt(e),t=parseInt(t),this._width===e&&this._height===t||(this._width=e,this._height=t,this.canvas.width(e),this.canvas.height(t),this._ctx.canvas.height=t,this._ctx.canvas.width=e)}},{key:"load",value:function(e){if(!1!==this.ready){this.ready=!1,this.layerstodisplay.length=0,this.onLoadReadyFunction=e||{},this.nrLoading=0;for(var t=0;t<this.layers.length;t++)this.layers[t].loadThisOne=!1,!1===this.layers[t].image.isLoaded()&&(this.layers[t].loadThisOne=!0,this.nrLoading++);if(0===this.nrLoading)this._statDivBufferImageLoaded();else{this._type,this._type;for(var i=0;i<this.layers.length;i++)!0===this.layers[i].loadThisOne&&(this.layers[i].image.getSrc(),this.layers[i].image.getSrc());for(var s=0;s<this.layers.length;s++)!0===this.layers[s].loadThisOne&&this.layers[s].image.load()}}}},{key:"setSrc",value:function(e,t,i,s,a,o){if(Object(n.n)(t)){for(;e>=this.layers.length;)this.layers.push({image:this._defaultImage,opacity:o,linkedInfo:a,loadThisOne:!1});var r=a&&a.layer&&a.layer.headers?a.layer.headers:[],h=this._imageStore.getImage(t,{headers:r});this.layers[e].image=h}else console.log("undefined")}},{key:"_getPixelCoordFromGeoCoord",value:function(e,t){return{x:this._width*(e.x-t.left)/(t.right-t.left),y:this._height*(e.y-t.top)/(t.bottom-t.top)}}},{key:"setBBOX",value:function(e,t){this._currentbbox===t+""&&this._currentnewbbox===e+""||(this._currentbbox=t+"",this._currentnewbbox=e+"",!1===this.hidden&&this.display(e,t))}},{key:"getBuffer",value:function(){return this.canvas}}])&&I(t.prototype,i),a&&I(t,a),e}();function D(e,t){for(var i=0;i<t.length;i++){var s=t[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}var R=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t.animationDelay=100,this._callBack=t.getListener(),this._imageStore=t.getImageStore(),this._divAnimationInfo=document.createElement("div"),t.currentAnimationStep=0,t.animationList=void 0,t.isAnimating=!1,t.setAnimationDelay=function(e){e<1&&(e=1),t.animationDelay=e},this._divAnimationInfo.style.zIndex=1e4,this._divAnimationInfo.style.background="none",this._divAnimationInfo.style.position="absolute",this._divAnimationInfo.style.border="none",this._divAnimationInfo.style.margin="0px",this._divAnimationInfo.style.padding="0px",this._divAnimationInfo.style.lineHeight="14px",this._divAnimationInfo.style.fontFamily='"Courier New", "Lucida Console", Monospace',this._divAnimationInfo.style.fontSize="10px",t.getBaseElement().append(this._divAnimationInfo),s.a?(Object(s.a)(this._divAnimationInfo).mouseout((function(){t.mouseHoverAnimationBox=!1})),t.isAnimatingLoopRunning=!1,this._map=t,this._removeAllChilds=this._removeAllChilds.bind(this),this._drawAnimationBar=this._drawAnimationBar.bind(this),this._animate=this._animate.bind(this),this._animateLoop=this._animateLoop.bind(this),this.checkAnimation=this.checkAnimation.bind(this),this.stopAnimating=this.stopAnimating.bind(this),t.stopAnimating=this.stopAnimating,t.checkAnimation=this.checkAnimation):console.warn("WMJSAnimate: jquery is not defined, assuming unit test is running")}var t,i,n;return t=e,(i=[{key:"_removeAllChilds",value:function(e){try{if(e.hasChildNodes())for(;e.childNodes.length>=1;)e.removeChild(e.firstChild)}catch(e){}}},{key:"_drawAnimationBar",value:function(e){}},{key:"_animate",value:function(){if(!1!==this._map.isAnimating&&!0!==this._map.animateBusy){var e=this._map.animationList[this._map.currentAnimationStep];e?(this._map.setDimension(e.name,e.value,!1),this._callBack.triggerEvent("ondimchange"),this._callBack.triggerEvent("onnextanimationstep",this._map),this._map._pdraw(),this._map.animateBusy=!1):p("No animation step for "+this._map.currentAnimationStep)}}},{key:"_animateLoop",value:function(){if(!1!==this._map.isAnimating){var e=this._map.animationDelay;if(0===this._map.currentAnimationStep&&(e*=3),this._map.currentAnimationStep===this._map.animationList.length-1&&(e*=5),this._map.animationTimer.init(e,this._animateLoop),this.checkAnimation(),!1===this._map.mouseHoverAnimationBox){this._animate();var t=this._map.currentAnimationStep+1;t>=this._map.animationList.length&&(t=0);var i=!1,s=0,n=this._map.animationList[t];this._map.setDimension(n.name,n.value,!1),this._map.animationList[t].requests=this._map.getWMSRequests(),n=this._map.animationList[this._map.currentAnimationStep],this._map.setDimension(n.name,n.value,!1);for(var a=0;a<this._map.animationList[t].requests.length;a++){var o=this._map.animationList[t].requests[a].url,r=this._map.getImageStore().getImageForSrc(o);r&&r.isLoaded()&&s++}s===this._map.animationList[t].requests.length&&(i=!0),i&&(this._map.currentAnimationStep=t)}}else this._map.isAnimatingLoopRunning=!1}},{key:"checkAnimation",value:function(){if(!1!==this._map.isAnimating){if(this._map.animationTimer||(this._map.animationTimer=new O),!1===this._map.mouseHoverAnimationBox){var e=this._imageStore.getNumImagesLoading();if(e<4){var t=this._map.animationList.length;if(this._map.animationList.length>0)for(var i=0;i<t;i++){for(var s=i+this._map.currentAnimationStep;s<0;)s+=this._map.animationList.length;for(;s>=this._map.animationList.length;)s-=this._map.animationList.length;if(s<0&&(s=0),s>=0){var n=this._map.animationList[s];if(this._map.setDimension(n.name,n.value,!1),this._map.animationList[s].requests=this._map.getWMSRequests(),n=this._map.animationList[this._map.currentAnimationStep],this._map.setDimension(n.name,n.value,!1),this._map.animationList[s].imagesInPrefetch=this._map.prefetch(this._map.animationList[s].requests),(e+=this._map.animationList[s].imagesInPrefetch.length)>3)break}}}}!1===this._map.isAnimatingLoopRunning&&(this._map.isAnimatingLoopRunning=!0,this._animateLoop())}else this._map.isAnimatingLoopRunning=!1}},{key:"stopAnimating",value:function(){!1!==this._map.isAnimating&&(this._map._animationList=void 0,this._divAnimationInfo.style.display="none",this._map.isAnimating=!1,this._map.animateBusy=!1,this._map.rebuildMapDimensions(),this._callBack.triggerEvent("onstopanimation",this._map))}}])&&D(t.prototype,i),n&&D(t,n),e}();function j(e,t){for(var i=0;i<t.length;i++){var s=t[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}var P=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,i,s;return t=e,(i=[{key:"render",value:function(e,t,i,s,n,a,o,r,h){var l={},u=[];if(o.stopLoading(),h){"streetmap"===h&&(h="OSM"),"pdok"===h&&(h="OSM"),"naturalearth2"===h&&(h="NaturalEarth2");var d=r[h];if(d){var c=d[i];if(!c)for(var m in r)if(r.hasOwnProperty(m))for(var f in r[m])r[m].hasOwnProperty(f)&&f===i&&(c=r[m][f]);var p=Math.PI,g=256,v=2*p*6378137/g,y=-2*p*6378137/2,b=2*p*6378137/2;c.tileSize&&(g=c.tileSize),c.resolution&&(v=c.resolution),c.origX&&(y=c.origX),c.origY&&(b=c.origY);var _=s,x=e.right-e.left,B=v*g+y,w=b-v*g,L=B-y,S=b-w,k=Math.log(Math.abs(B-y)/(x/_*g))/Math.log(2);!function(r){var h=c.home,d=c.tileServerType,m=c.tileServerFormat||"png",f=c.tms||!1;r<c.minLevel&&(r=c.minLevel),r>c.maxLevel&&(r=c.maxLevel);var p=Math.pow(2,r),_=L/(v/p*g),x=S/(v/p*g),B=parseInt(Math.round((e.left-y)/L*_/1+.5)),k=parseInt(Math.round((e.right-y)/L*_/1+.5)),T=parseInt(Math.round(x-(e.bottom-w)/S*x+.5)),O=parseInt(Math.round(x-(e.top-w)/S*x+.5)),M=function(e,t,i){var s=v/Math.pow(2,e);return{x:t*s+y,y:b-i*s}},C=function(e,t,i){var s=M(e,t*g,i*g),n=M(e,(t+1)*g,(i+1)*g);return{left:s.x,bottom:s.y,right:n.x,top:n.y}},I=function(e,t,i,s){var n=i*(e.x-t.left)/(t.right-t.left),a=s*(e.y-t.top)/(t.bottom-t.top);return{x:parseFloat(n),y:parseFloat(a)}},E=function e(i,a,r,c){var p,g=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],v=C(a,r,c),y=I({x:v.left,y:v.bottom},t,s,n),b=I({x:v.right,y:v.top},t,s,n);if("osm"===d?p=f?h+a+"/"+r+"/"+(x-1-c)+"."+m:h+a+"/"+r+"/"+c+"."+m:"arcgisonline"===d||"wmst"===d?p=h+a+"/"+c+"/"+r:"skyvector"===d&&(p=h+2*(11-Math.round(a))+"/"+r+"/"+c+"."+m),!l[p]){l[p]=!0;var _=o.getImage(p);if(!1===g)if(_.isLoaded()&&!_.hasError())try{i.drawImage(_.getElement()[0],parseInt(y.x),parseInt(y.y),parseInt(b.x-y.x)+1,parseInt(b.y-y.y)+1)}catch(e){}else a>1&&e(i,a-1,parseInt(r/2),parseInt(c/2),!1);else g&&!1===_.isLoaded()&&!1===_.hasError()&&!1===_.isLoading()&&_.load(),_.isLoaded()&&!_.hasError()?u.push({image:_,i:_.getElement()[0],x:parseInt(y.x),y:parseInt(y.y),w:parseInt(b.x-y.x)+1,h:parseInt(b.y-y.y)+1,level:a}):a>1&&e(i,a-1,parseInt(r/2),parseInt(c/2),!1)}};if("EPSG:4326"!==i&&"EPSG:4258"!==i||(_*=2),O<1&&(O=1),O>x&&(O=x),B<1&&(B=1),B>_&&(B=_),T<1&&(T=1),T>x&&(T=x),k<1&&(k=1),k>_&&(k=_),T-O>20)console.error("Too many tiles in vertical",T-O);else if(k-B>20)console.error("Too many tiles in horizontal",T-O);else for(var D=O-1;D<T;D++)for(var R=B-1;R<k;R++)E(a,r,R,D)}(parseInt(k+.5)),u.sort((function(e,t){return e.level<t.level?-1:e.level>t.level?1:0}));for(var T=0;T<u.length;T++){var O=u[T];if(O.image.isLoaded()&&!O.image.hasError())try{a.drawImage(O.i,O.x,O.y,O.w,O.h)}catch(e){}}return{attributionText:d&&i&&d[i]&&d[i].copyRight?d[i].copyRight:null}}console.error("Tiled layer with name "+h+" not found")}else console.error("layerName not defined")}}])&&j(t.prototype,i),s&&j(t,s),e}(),X=function(e,t,i){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"#FFF",n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"#000",a={x:parseInt(t),y:parseInt(i)};e.fillStyle=s,e.globalAlpha=1,e.beginPath();var o=9,r=2.5*o;e.arc(a.x,a.y-r,o,Math.PI,2*Math.PI),e.bezierCurveTo(a.x+o,a.y-r,a.x+o/1.6,a.y-o,a.x,a.y),e.bezierCurveTo(a.x,a.y,a.x-o/1.6,a.y-o,a.x-o,a.y-r),e.stroke(),e.fill(),e.fillStyle="#FFF",e.beginPath(),e.arc(a.x,a.y-r,o/2,2*Math.PI,0),e.fill(),e.fillStyle=n,e.beginPath(),e.arc(a.x,a.y,2,2*Math.PI,0),e.fill()},A={delete:{text:"Delete"},delete_selected_flag_tooltip:{tooltip:"Delete selected flag"},add_flag_tooltip:{tooltip:"Add a flag with current latitude, longitude and name"},are_you_sure:{text:"Are you sure about deleting this flag?"},delete_title_confirm:{text:"Delete flag"},default_selected_flag:{text:"None"},selected_flag:{text:"Nearest flag:"},add_point_interest_abstract:{text:"Add or update your point of interest here with a latitude, a longitude and a name of choice."},insert_name:{text:"Name:"},add_point_interest:{text:"Add point of interest"},add:{text:"Add"},place_search_term:{text:"Search for location&hellip;"},debug_searching_location:{text:"Searching for location in SQLite DB:"},debug_searching_sqlite_location:{text:"Searching for location with GeoNames API:"},geonames_api_call_failed:{text:"GeoNames API request failed"},geonames_sqlite_call_failed:{text:"GeoNames SQLite request failed."},no_results_search:{text:"No results for search"},unable_to_do_getcapabilities:{text:"Unable to do getcapabilities for"},unable_to_connect_server:{text:"Unable to connect to the service."},unable_to_search:{text:"Unable to perform a search"},no_urls_in_config:{text:"No GeoNames URLs defined in config file"},only_alpha_num_allowed:{text:"Search may only contain alpha numeric characters"},no_search_definition:{text:"Search term is empty"},result:{text:"Result"},service_has_error:{text:"--- service has an error ---"},no_time_dimension_in_layer:{text:"No time dimension found in this layer"},no_service_defined:{text:"No service defined"},service_url_empty:{text:"Service URL is empty"},wms_service_exception_code:{text:"WMS Service exception with code "},unnamed_service:{text:"Unnamed service"},add_layers:{text:"Add layers&hellip;",tooltip:"Add new datasets, layers and services"},add_custom_service:{text:"Add a custom version 1.1.1 Web Map Service (WMS)"},properties_for:{text:"Properties for"},color_range:{text:"Color range"},reset:{text:"Reset"},apply:{text:"Apply"},min_value:{text:"Min value"},max_value:{text:"Max value"},wms_version:{text:"WMS version"},wms_comp_mode:{text:"WMS 1.3.0 BBOX compatibility mode"},projections:{text:"Projections"},projection:{text:"Projec