From 8cbb71a0a981cc42caf4a88a94405c700b4fef34 Mon Sep 17 00:00:00 2001 From: Biel Frontera Date: Thu, 28 Jan 2016 12:01:03 +0100 Subject: [PATCH] Release v0.1.12 --- dist/leaflet.timedimension.control.css | 12 ++++------- dist/leaflet.timedimension.control.min.css | 2 +- dist/leaflet.timedimension.min.js | 4 ++-- dist/leaflet.timedimension.src.js | 23 +++++++++++++--------- dist/leaflet.timedimension.src.withlog.js | 23 +++++++++++++--------- package.json | 2 +- src/leaflet.timedimension.control.js | 3 ++- src/leaflet.timedimension.player.js | 2 +- 8 files changed, 39 insertions(+), 32 deletions(-) diff --git a/dist/leaflet.timedimension.control.css b/dist/leaflet.timedimension.control.css index adc4ec7..ecd0abe 100644 --- a/dist/leaflet.timedimension.control.css +++ b/dist/leaflet.timedimension.control.css @@ -1,5 +1,5 @@ /* - * Leaflet TimeDimension v0.1.11 - 2016-01-07 + * Leaflet TimeDimension v0.1.12 - 2016-01-28 * * Copyright 2016 Biel Frontera (ICTS SOCIB) * datacenter@socib.es @@ -51,7 +51,7 @@ border-right-width: 0px; } -a.leaflet-control-timecontrol{ +.leaflet-bar-timecontrol a.leaflet-control-timecontrol{ height: auto; width: auto; padding: 4px 15px; @@ -83,16 +83,12 @@ a.timecontrol-date.timecontrol-loading:before{ } -a.timecontrol-slider{ +.leaflet-bar-timecontrol a.timecontrol-slider{ height: auto; width: 300px; padding: 4px 15px; } -a.timecontrol-slider:hover{ - width: 300px; -} - a.timecontrol-slider .ui-slider{ margin-top: 8px; margin-bottom: 7px; @@ -109,7 +105,7 @@ a.timecontrol-slider .ui-slider-handle{ padding: 0 2px; } -a.timecontrol-speed, a.timecontrol-speed:hover{ +.leaflet-bar-timecontrol a.timecontrol-speed{ width: 160px; } diff --git a/dist/leaflet.timedimension.control.min.css b/dist/leaflet.timedimension.control.min.css index 0b20571..72684ee 100644 --- a/dist/leaflet.timedimension.control.min.css +++ b/dist/leaflet.timedimension.control.min.css @@ -1 +1 @@ -a.timecontrol-date.timecontrol-loading:before,a.timecontrol-play-loading:before{-webkit-animation:rotation 12s infinite linear;font-family:"Glyphicons Halflings"}a.timecontrol-backward:before,a.timecontrol-forward:before,a.timecontrol-pause:before,a.timecontrol-play-loading:before,a.timecontrol-play:before,a.timecontrol-speed span.speed:before,a.timecontrol-stop:before{font-family:"Glyphicons Halflings"}@font-face{font-family:'Glyphicons Halflings';src:url(//netdna.bootstrapcdn.com/bootstrap/3.0.0/fonts/glyphicons-halflings-regular.eot);src:url(//netdna.bootstrapcdn.com/bootstrap/3.0.0/fonts/glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'),url(//netdna.bootstrapcdn.com/bootstrap/3.0.0/fonts/glyphicons-halflings-regular.woff) format('woff'),url(//netdna.bootstrapcdn.com/bootstrap/3.0.0/fonts/glyphicons-halflings-regular.ttf) format('truetype'),url(//netdna.bootstrapcdn.com/bootstrap/3.0.0/fonts/glyphicons-halflings-regular.svg#glyphicons-halflingsregular) format('svg')}.leaflet-bar-timecontrol{margin-bottom:20px!important;background-color:#FFF}.leaflet-bar-horizontal a{float:left;border-right:1px solid #ccc;border-bottom-width:0;text-decoration:none}.leaflet-bar-horizontal a:hover{border-bottom-width:0}.leaflet-bar-horizontal a:first-child{border-top-left-radius:4px;border-bottom-left-radius:4px;border-top-right-radius:0}.leaflet-bar-horizontal a:last-child{border-top-right-radius:4px;border-bottom-right-radius:4px;border-bottom-left-radius:0;border-right-width:0}a.leaflet-control-timecontrol{height:auto;width:auto;padding:4px 15px;font-size:12px;line-height:26px}a.leaflet-control-timecontrol:hover{height:auto;width:auto}a.timecontrol-date{padding-left:30px}a.timecontrol-date.timecontrol-loading{padding-left:5px;background-color:#ffefa4}a.timecontrol-date.timecontrol-loading:before{content:"\e031";width:25px;display:inline-block;line-height:20px}a.timecontrol-slider{height:auto;width:300px;padding:4px 15px}a.timecontrol-slider:hover{width:300px}a.timecontrol-slider .ui-slider{margin-top:8px;margin-bottom:7px;height:9px}a.timecontrol-slider .ui-slider-handle{border-bottom:1px!important;width:5px;height:17px;border-width:1px;border-color:#a5a5a5;border-radius:4px;padding:0 2px}a.timecontrol-speed,a.timecontrol-speed:hover{width:160px}a.timecontrol-speed span.speed{display:inline-block;float:left;width:50px;height:26px;white-space:nowrap;text-align:left}a.timecontrol-speed .ui-slider{margin-left:55px}a.timecontrol-speed span.speed:before{content:"\e141";padding-right:5px}a.timecontrol-play:before{content:"\e072"}a.timecontrol-pause:before{content:"\e073"}@-webkit-keyframes rotation{from{-webkit-transform:rotate(0)}to{-webkit-transform:rotate(360deg)}}a.timecontrol-play-loading{background-color:#ffefa4;position:relative}a.timecontrol-play-loading span{display:inline-block;width:0;position:absolute;top:5px;left:10px;font-weight:700}a.timecontrol-play-loading:before{content:"\e031";opacity:.2}a.timecontrol-stop:before{content:"\e074"}a.timecontrol-forward:before{content:"\e075"}a.timecontrol-backward:before{content:"\e071"} \ No newline at end of file +a.timecontrol-date.timecontrol-loading:before,a.timecontrol-play-loading:before{-webkit-animation:rotation 12s infinite linear;font-family:"Glyphicons Halflings"}a.timecontrol-backward:before,a.timecontrol-forward:before,a.timecontrol-pause:before,a.timecontrol-play-loading:before,a.timecontrol-play:before,a.timecontrol-speed span.speed:before,a.timecontrol-stop:before{font-family:"Glyphicons Halflings"}@font-face{font-family:'Glyphicons Halflings';src:url(//netdna.bootstrapcdn.com/bootstrap/3.0.0/fonts/glyphicons-halflings-regular.eot);src:url(//netdna.bootstrapcdn.com/bootstrap/3.0.0/fonts/glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'),url(//netdna.bootstrapcdn.com/bootstrap/3.0.0/fonts/glyphicons-halflings-regular.woff) format('woff'),url(//netdna.bootstrapcdn.com/bootstrap/3.0.0/fonts/glyphicons-halflings-regular.ttf) format('truetype'),url(//netdna.bootstrapcdn.com/bootstrap/3.0.0/fonts/glyphicons-halflings-regular.svg#glyphicons-halflingsregular) format('svg')}.leaflet-bar-timecontrol{margin-bottom:20px!important;background-color:#FFF}.leaflet-bar-horizontal a{float:left;border-right:1px solid #ccc;border-bottom-width:0;text-decoration:none}.leaflet-bar-horizontal a:hover{border-bottom-width:0}.leaflet-bar-horizontal a:first-child{border-top-left-radius:4px;border-bottom-left-radius:4px;border-top-right-radius:0}.leaflet-bar-horizontal a:last-child{border-top-right-radius:4px;border-bottom-right-radius:4px;border-bottom-left-radius:0;border-right-width:0}.leaflet-bar-timecontrol a.leaflet-control-timecontrol{height:auto;width:auto;padding:4px 15px;font-size:12px;line-height:26px}a.leaflet-control-timecontrol:hover{height:auto;width:auto}a.timecontrol-date{padding-left:30px}a.timecontrol-date.timecontrol-loading{padding-left:5px;background-color:#ffefa4}a.timecontrol-date.timecontrol-loading:before{content:"\e031";width:25px;display:inline-block;line-height:20px}.leaflet-bar-timecontrol a.timecontrol-slider{height:auto;width:300px;padding:4px 15px}a.timecontrol-slider .ui-slider{margin-top:8px;margin-bottom:7px;height:9px}a.timecontrol-slider .ui-slider-handle{border-bottom:1px!important;width:5px;height:17px;border-width:1px;border-color:#a5a5a5;border-radius:4px;padding:0 2px}.leaflet-bar-timecontrol a.timecontrol-speed{width:160px}a.timecontrol-speed span.speed{display:inline-block;float:left;width:50px;height:26px;white-space:nowrap;text-align:left}a.timecontrol-speed .ui-slider{margin-left:55px}a.timecontrol-speed span.speed:before{content:"\e141";padding-right:5px}a.timecontrol-play:before{content:"\e072"}a.timecontrol-pause:before{content:"\e073"}@-webkit-keyframes rotation{from{-webkit-transform:rotate(0)}to{-webkit-transform:rotate(360deg)}}a.timecontrol-play-loading{background-color:#ffefa4;position:relative}a.timecontrol-play-loading span{display:inline-block;width:0;position:absolute;top:5px;left:10px;font-weight:700}a.timecontrol-play-loading:before{content:"\e031";opacity:.2}a.timecontrol-stop:before{content:"\e074"}a.timecontrol-forward:before{content:"\e075"}a.timecontrol-backward:before{content:"\e071"} \ No newline at end of file diff --git a/dist/leaflet.timedimension.min.js b/dist/leaflet.timedimension.min.js index bf2f485..2a3ff2d 100644 --- a/dist/leaflet.timedimension.min.js +++ b/dist/leaflet.timedimension.min.js @@ -1,5 +1,5 @@ /* - * Leaflet TimeDimension v0.1.11 - 2016-01-07 + * Leaflet TimeDimension v0.1.12 - 2016-01-28 * * Copyright 2016 Biel Frontera (ICTS SOCIB) * datacenter@socib.es @@ -14,4 +14,4 @@ * git://github.com/socib/Leaflet.TimeDimension.git * */ -!function(a){L.TimeDimension=(L.Layer||L.Class).extend({includes:L.Mixin.Events,initialize:function(a){L.setOptions(this,a),this._availableTimes=this._generateAvailableTimes(),this._currentTimeIndex=-1,this._loadingTimeIndex=-1,this._loadingTimeout=this.options.loadingTimeout||3e3,this._syncedLayers=[],this._availableTimes.length>0&&this.setCurrentTime(this.options.currentTime||this._getDefaultCurrentTime())},getAvailableTimes:function(){return this._availableTimes},getCurrentTimeIndex:function(){return-1==this._currentTimeIndex?this._availableTimes.length-1:this._currentTimeIndex},getCurrentTime:function(){var a=-1;return a=-1!=this._loadingTimeIndex?this._loadingTimeIndex:this.getCurrentTimeIndex(),a>=0?this._availableTimes[a]:0},isLoading:function(){return-1!=this._loadingTimeIndex},setCurrentTimeIndex:function(a){if(a>=this._availableTimes.length&&(a=this._availableTimes.length-1),!(0>a)){this._loadingTimeIndex=a;var b=this._availableTimes[a];this._checkSyncedLayersReady(this._availableTimes[this._loadingTimeIndex])?this._newTimeIndexLoaded():(this.fire("timeloading",{time:b}),setTimeout(function(a){a==this._loadingTimeIndex&&this._newTimeIndexLoaded()}.bind(this,a),this._loadingTimeout))}},_newTimeIndexLoaded:function(){if(-1!=this._loadingTimeIndex){var a=this._availableTimes[this._loadingTimeIndex];this._currentTimeIndex=this._loadingTimeIndex,this.fire("timeload",{time:a}),this._loadingTimeIndex=-1}},_checkSyncedLayersReady:function(a){for(var b=0,c=this._syncedLayers.length;c>b;b++)if(this._syncedLayers[b].isReady&&!this._syncedLayers[b].isReady(a))return!1;return!0},setCurrentTime:function(a){var b=this._seekNearestTimeIndex(a);this.setCurrentTimeIndex(b)},seekNearestTime:function(a){var b=this._seekNearestTimeIndex(a);return this._availableTimes[b]},nextTime:function(a,b){void 0===a&&(a=1),void 0===b&&(b=!1);var c=this._currentTimeIndex;if(this._loadingTimeIndex>-1&&(c=this._loadingTimeIndex),c+=a,c>=this._availableTimes.length){if(!b)return;c=0}this.setCurrentTimeIndex(c)},prepareNextTimes:function(a,b){void 0===a&&(a=1);var c=this._currentTimeIndex;this._loadingTimeIndex>-1&&(c=this._loadingTimeIndex);for(var d=0,e=this._syncedLayers.length;e>d;d++)this._syncedLayers[d].setMinimumForwardCache&&this._syncedLayers[d].setMinimumForwardCache(b);for(var f=b;f>0&&(c+=a,!(c>=this._availableTimes.length));)this.fire("timeloading",{time:this._availableTimes[c]}),f--},getNumberNextTimesReady:function(a,b){void 0===a&&(a=1);var c=this._currentTimeIndex;this._loadingTimeIndex>-1&&(c=this._loadingTimeIndex);for(var d=b,e=0;d>0;){if(c+=a,c>=this._availableTimes.length){d=0,e=b;break}var f=this._availableTimes[c];this._checkSyncedLayersReady(f)&&e++,d--}return e},previousTime:function(a){void 0===a&&(a=1);var b=this._currentTimeIndex;this._loadingTimeIndex>-1&&(b=this._loadingTimeIndex),b-=a,0>b&&(b=0),this.setCurrentTimeIndex(b)},registerSyncedLayer:function(a){this._syncedLayers.push(a),a.on("timeload",this._onSyncedLayerLoaded,this)},unregisterSyncedLayer:function(a){var b=this._syncedLayers.indexOf(a);-1!=b&&this._syncedLayers.splice(b,1),a.off("timeload",this._onSyncedLayerLoaded,this)},_onSyncedLayerLoaded:function(a){a.time==this._availableTimes[this._loadingTimeIndex]&&this._checkSyncedLayersReady(a.time)&&this._newTimeIndexLoaded()},_generateAvailableTimes:function(){if(this.options.times)return L.TimeDimension.Util.parseTimesExpression(this.options.times);if(this.options.timeInterval){var a=L.TimeDimension.Util.parseTimeInterval(this.options.timeInterval),b=this.options.period||"P1D",c=this.options.validTimeRange||void 0;return L.TimeDimension.Util.explodeTimeRange(a[0],a[1],b,c)}return[]},_getDefaultCurrentTime:function(){var a=this._seekNearestTimeIndex((new Date).getTime());return this._availableTimes[a]},_seekNearestTimeIndex:function(a){for(var b=0,c=this._availableTimes.length;c>b&&!(a0&&b--,b},setAvailableTimes:function(a,b){var c=this.getCurrentTime();if("extremes"==b){var d=this.options.period||"P1D";this._availableTimes=L.TimeDimension.Util.explodeTimeRange(new Date(a[0]),new Date(a[a.length-1]),d)}else{var e=L.TimeDimension.Util.parseTimesExpression(a);if(0==this._availableTimes.length)this._availableTimes=e;else if("intersect"==b)this._availableTimes=L.TimeDimension.Util.intersect_arrays(e,this._availableTimes);else if("union"==b)this._availableTimes=L.TimeDimension.Util.union_arrays(e,this._availableTimes);else{if("replace"!=b)throw"Merge available times mode not implemented: "+b;this._availableTimes=e}}this.setCurrentTime(c),this.fire("availabletimeschanged",{})}}),L.Map.addInitHook(function(){this.options.timeDimension&&(this.timeDimension=L.timeDimension(this.options.timeDimensionOptions||{}))}),L.timeDimension=function(a){return new L.TimeDimension(a)},L.TimeDimension.Util={getTimeDuration:function(a){if(void 0===nezasa)throw"iso8601-js-period library is required for Leatlet.TimeDimension: https://github.com/nezasa/iso8601-js-period";return nezasa.iso8601.Period.parse(a,!0)},addTimeDuration:function(a,b,c){void 0===c&&(c=!0),("string"==typeof b||b instanceof String)&&(b=this.getTimeDuration(b));var d=b.length,e=c?"getUTC":"get",f=c?"setUTC":"set";d>0&&0!=b[0]&&a[f+"FullYear"](a[e+"FullYear"]()+b[0]),d>1&&0!=b[1]&&a[f+"Month"](a[e+"Month"]()+b[1]),d>2&&0!=b[2]&&a[f+"Date"](a[e+"Date"]()+7*b[2]),d>3&&0!=b[3]&&a[f+"Date"](a[e+"Date"]()+b[3]),d>4&&0!=b[4]&&a[f+"Hours"](a[e+"Hours"]()+b[4]),d>5&&0!=b[5]&&a[f+"Minutes"](a[e+"Minutes"]()+b[5]),d>6&&0!=b[6]&&a[f+"Seconds"](a[e+"Seconds"]()+b[6])},subtractTimeDuration:function(a,b,c){("string"==typeof b||b instanceof String)&&(b=this.getTimeDuration(b));for(var d=[],e=0,f=b.length;f>e;e++)d.push(-b[e]);this.addTimeDuration(a,d,c)},parseAndExplodeTimeRange:function(a){var b=a.split("/"),c=new Date(Date.parse(b[0])),d=new Date(Date.parse(b[1])),e=b.length>2?b[2]:"P1D";return this.explodeTimeRange(c,d,e)},explodeTimeRange:function(a,b,c,d){var e=this.getTimeDuration(c),f=[],g=new Date(a.getTime()),h=null,i=null,j=null,k=null;if(void 0!==d){var l=d.split("/");h=l[0].split(":")[0],i=l[0].split(":")[1],j=l[1].split(":")[0],k=l[1].split(":")[1]}for(;b>g;)(void 0===d||g.getUTCHours()>=h&&g.getUTCHours()<=j)&&(g.getUTCHours()!=h||g.getUTCMinutes()>=i)&&(g.getUTCHours()!=j||g.getUTCMinutes()<=k)&&f.push(g.getTime()),this.addTimeDuration(g,e);return g>=b&&f.push(b.getTime()),f},parseTimeInterval:function(a){var b=a.split("/");if(2!=b.length)throw"Incorrect ISO9601 TimeInterval: "+a;var c=Date.parse(b[0]),d=null,e=null;return isNaN(c)?(e=this.getTimeDuration(b[0]),d=Date.parse(b[1]),c=new Date(d),this.subtractTimeDuration(c,e,!0),d=new Date(d)):(d=Date.parse(b[1]),isNaN(d)?(e=this.getTimeDuration(b[1]),d=new Date(c),this.addTimeDuration(d,e,!0)):d=new Date(d),c=new Date(c)),[c,d]},parseTimesExpression:function(a){var b=[];if(!a)return b;if("string"==typeof a||a instanceof String)for(var c,d,e=a.split(","),f=0,g=e.length;g>f;f++)c=e[f],3==c.split("/").length?b=b.concat(this.parseAndExplodeTimeRange(c)):(d=Date.parse(c),isNaN(d)||b.push(d));else b=a;return b.sort(function(a,b){return a-b})},intersect_arrays:function(a,b){for(var c=a.slice(0),d=b.slice(0),e=[];c.length>0&&d.length>0;)c[0]d[0]?d.shift():(e.push(c.shift()),d.shift());return e},union_arrays:function(a,b){for(var c=a.slice(0),d=b.slice(0),e=[];c.length>0&&d.length>0;)c[0]d[0]?e.push(d.shift()):(e.push(c.shift()),d.shift());return c.length>0?e=e.concat(c):d.length>0&&(e=e.concat(d)),e}},L.TimeDimension.Layer=(L.Layer||L.Class).extend({includes:L.Mixin.Events,options:{opacity:1,zIndex:1},initialize:function(a,b){L.setOptions(this,b||{}),this._map=null,this._baseLayer=a,this._currentLayer=null,this._timeDimension=this.options.timeDimension||null},addTo:function(a){return a.addLayer(this),this},onAdd:function(a){this._map=a,!this._timeDimension&&a.timeDimension&&(this._timeDimension=a.timeDimension),this._timeDimension.on("timeloading",this._onNewTimeLoading,this),this._timeDimension.on("timeload",this._update,this),this._timeDimension.registerSyncedLayer(this),this._update()},onRemove:function(a){this._timeDimension.unregisterSyncedLayer(this),this._timeDimension.off("timeloading",this._onNewTimeLoading,this),this._timeDimension.off("timeload",this._update,this),this.eachLayer(a.removeLayer,a),this._map=null},eachLayer:function(a,b){return a.call(b,this._baseLayer),this},setZIndex:function(a){return this.options.zIndex=a,this._baseLayer.setZIndex&&this._baseLayer.setZIndex(a),this._currentLayer&&this._currentLayer.setZIndex&&this._currentLayer.setZIndex(a),this},setOpacity:function(a){return this.options.opacity=a,this._baseLayer.setOpacity&&this._baseLayer.setOpacity(a),this._currentLayer&&this._currentLayer.setOpacity&&this._currentLayer.setOpacity(a),this},bringToBack:function(){return this._currentLayer?(this._currentLayer.bringToBack(),this):void 0},bringToFront:function(){return this._currentLayer?(this._currentLayer.bringToFront(),this):void 0},_onNewTimeLoading:function(a){this.fire("timeload",{time:a.time})},isReady:function(a){return!0},_update:function(){return!0},getBaseLayer:function(){return this._baseLayer}}),L.timeDimension.layer=function(a,b){return new L.TimeDimension.Layer(a,b)},L.TimeDimension.Layer.WMS=L.TimeDimension.Layer.extend({initialize:function(a,b){L.TimeDimension.Layer.prototype.initialize.call(this,a,b),this._timeCacheBackward=this.options.cacheBackward||this.options.cache||0,this._timeCacheForward=this.options.cacheForward||this.options.cache||0,this._wmsVersion=this.options.wmsVersion||this.options.version||a.options.version||"1.1.1",this._proxy=this.options.proxy||null,this._updateTimeDimension=this.options.updateTimeDimension||!1,this._setDefaultTime=this.options.setDefaultTime||!1,this._updateTimeDimensionMode=this.options.updateTimeDimensionMode||"intersect",this._layers={},this._defaultTime=0,this._availableTimes=[],this._capabilitiesRequested=!1,(this._updateTimeDimension||this.options.requestTimeFromCapabilities)&&this._requestTimeDimensionFromCapabilities(),this._baseLayer.on("load",function(){this._baseLayer.setLoaded(!0),this.fire("timeload",{time:this._defaultTime})}.bind(this))},getEvents:function(){var a=L.bind(this._unvalidateCache,this);return{moveend:a,zoomend:a}},eachLayer:function(a,b){for(var c in this._layers)this._layers.hasOwnProperty(c)&&a.call(b,this._layers[c]);return L.TimeDimension.Layer.prototype.eachLayer.call(this,a,b)},_onNewTimeLoading:function(a){var b=this._getLayerForTime(a.time);this._map.hasLayer(b)||this._map.addLayer(b)},isReady:function(a){var b=this._getLayerForTime(a);return b.isLoaded()},onAdd:function(a){L.TimeDimension.Layer.prototype.onAdd.call(this,a),0==this._availableTimes.length?this._requestTimeDimensionFromCapabilities():this._updateTimeDimensionAvailableTimes()},_update:function(){if(this._map){var a=this._timeDimension.getCurrentTime(),b=this._getLayerForTime(a);null==this._currentLayer&&(this._currentLayer=b),this._map.hasLayer(b)?this._showLayer(b,a):this._map.addLayer(b)}},setOpacity:function(a){L.TimeDimension.Layer.prototype.setOpacity.apply(this,arguments);for(var b in this._layers)this._layers.hasOwnProperty(b)&&this._layers[b].setOpacity&&this._layers[b].setOpacity(a)},setParams:function(a,b){L.extend(this._baseLayer.options,a);for(var c in this._layers)this._layers.hasOwnProperty(c)&&this._layers[c].setParams&&(this._layers[c].setLoaded(!1),this._layers[c].setParams(a,b));return this},_unvalidateCache:function(){var a=this._timeDimension.getCurrentTime();for(var b in this._layers)a!=b&&this._layers.hasOwnProperty(b)&&(this._layers[b].setLoaded(!1),this._layers[b].redraw())},_evictCachedTimes:function(a,b){var c=this._getLoadedTimes(),d=String(this._currentTime),e=c.indexOf(d),f=[];if(b>-1){var g=e-b;g>0&&(f=c.splice(0,g),this._removeLayers(f))}if(a>-1){e=c.indexOf(d);var g=c.length-e-a-1;g>0&&(f=c.splice(e+a+1,g),this._removeLayers(f))}},_showLayer:function(a,b){this._currentLayer&&this._currentLayer!==a&&this._currentLayer.hide(),a.show(),this._currentLayer&&this._currentLayer===a||(this._currentLayer=a,this._currentTime=b,this._evictCachedTimes(this._timeCacheForward,this._timeCacheBackward))},_getLayerForTime:function(a){if(0==a||a==this._defaultTime||null==a)return this._baseLayer;if(this._layers.hasOwnProperty(a))return this._layers[a];var b=this._getNearestTime(a);if(this._layers.hasOwnProperty(b))return this._layers[b];var c=this._baseLayer.options;c.time=new Date(b).toISOString();var d=null;return d=this._baseLayer instanceof L.TileLayer?L.tileLayer.wms(this._baseLayer.getURL(),c):L.nonTiledLayer.wms(this._baseLayer.getURL(),c),this._layers[a]=d,d.on("load",function(a,b){a.setLoaded(!0),this._layers[b]||(this._layers[b]=a),this._timeDimension&&b==this._timeDimension.getCurrentTime()&&!this._timeDimension.isLoading()&&this._showLayer(a,b),this.fire("timeload",{time:b})}.bind(this,d,a)),d.onAdd=function(a){Object.getPrototypeOf(this).onAdd.call(this,a),this.hide()}.bind(d),d},_getLoadedTimes:function(){var a=[];for(var b in this._layers)this._layers.hasOwnProperty(b)&&a.push(b);return a.sort(function(a,b){return a-b})},_removeLayers:function(a){for(var b=0,c=a.length;c>b;b++)this._map&&this._map.removeLayer(this._layers[a[b]]),delete this._layers[a[b]]},setMinimumForwardCache:function(a){a>this._timeCacheForward&&(this._timeCacheForward=a)},_requestTimeDimensionFromCapabilities:function(){if(!this._capabilitiesRequested){this._capabilitiesRequested=!0;var b=this._baseLayer.getURL(),c=b+"?service=WMS&version="+this._wmsVersion+"&request=GetCapabilities";this._proxy&&(c=this._proxy+"?url="+encodeURIComponent(c)),a.get(c,function(a){this._defaultTime=Date.parse(this._getDefaultTimeFromCapabilities(a)),this._setDefaultTime=this._setDefaultTime||this._timeDimension&&0==this._timeDimension.getAvailableTimes().length,this.setAvailableTimes(this._parseTimeDimensionFromCapabilities(a)),this._setDefaultTime&&this._timeDimension&&this._timeDimension.setCurrentTime(this._defaultTime)}.bind(this))}},_parseTimeDimensionFromCapabilities:function(b){var c=a(b).find('Layer[queryable="1"]'),d=this._baseLayer.wmsParams.layers,e=c.find("Name").filter(function(b){return a(this).text()===d}),f=null;if(e){var g=e.parent();f=this._getTimesFromLayerCapabilities(g),f||(f=this._getTimesFromLayerCapabilities(g.parent()))}return f},_getTimesFromLayerCapabilities:function(a){var b=null,c=a.find("Dimension[name='time']");if(c&&c.length&&c[0].textContent.length)b=c[0].textContent.trim();else{var d=a.find("Extent[name='time']");d&&d.length&&d[0].textContent.length&&(b=d[0].textContent.trim())}return b},_getDefaultTimeFromCapabilities:function(b){var c=a(b).find('Layer[queryable="1"]'),d=this._baseLayer.wmsParams.layers,e=c.find("Name").filter(function(b){return a(this).text()===d}),f=0;if(e){var g=e.parent();f=this._getDefaultTimeFromLayerCapabilities(g),0==f&&(f=this._getDefaultTimeFromLayerCapabilities(g.parent()))}return f},_getDefaultTimeFromLayerCapabilities:function(a){var b=0,c=a.find("Dimension[name='time']");if(c&&c.attr("default"))b=c.attr("default");else{var d=a.find("Extent[name='time']");d&&d.attr("default")&&(b=d.attr("default"))}return b},setAvailableTimes:function(a){this._availableTimes=L.TimeDimension.Util.parseTimesExpression(a),this._updateTimeDimensionAvailableTimes()},_updateTimeDimensionAvailableTimes:function(){(this._timeDimension&&this._updateTimeDimension||this._timeDimension&&0==this._timeDimension.getAvailableTimes().length)&&(this._timeDimension.setAvailableTimes(this._availableTimes,this._updateTimeDimensionMode),this._defaultTime>0&&this._timeDimension.setCurrentTime(this._defaultTime))},_getNearestTime:function(a){if(this._layers.hasOwnProperty(a))return a;if(0==this._availableTimes.length)return a;for(var b=0,c=this._availableTimes.length;c>b&&!(a0&&b--,a!=this._availableTimes[b],this._availableTimes[b]}}),L.NonTiledLayer||(L.NonTiledLayer=(L.Layer||L.Class).extend({})),L.NonTiledLayer.include({_visible:!0,_loaded:!1,_originalUpdate:L.NonTiledLayer.prototype._update,_originalOnRemove:L.NonTiledLayer.prototype.onRemove,_update:function(){(this._visible||!this._loaded)&&this._originalUpdate()},onRemove:function(a){this._loaded=!1,this._originalOnRemove(a)},setLoaded:function(a){this._loaded=a},isLoaded:function(){return this._loaded},hide:function(){this._visible=!1,this._div.style.display="none"},show:function(){this._visible=!0,this._div.style.display="block"},getURL:function(){return this._wmsUrl}}),L.TileLayer.include({_visible:!0,_loaded:!1,_originalUpdate:L.TileLayer.prototype._update,_update:function(){(this._visible||!this._loaded)&&this._originalUpdate()},setLoaded:function(a){this._loaded=a},isLoaded:function(){return this._loaded},hide:function(){this._visible=!1,this._container&&(this._container.style.display="none")},show:function(){this._visible=!0,this._container&&(this._container.style.display="block")},getURL:function(){return this._url}}),L.timeDimension.layer.wms=function(a,b){return new L.TimeDimension.Layer.WMS(a,b)},L.TimeDimension.Layer.GeoJson=L.TimeDimension.Layer.extend({initialize:function(a,b){L.TimeDimension.Layer.prototype.initialize.call(this,a,b),this._updateTimeDimension=this.options.updateTimeDimension||!1,this._updateTimeDimensionMode=this.options.updateTimeDimensionMode||"extremes",this._duration=this.options.duration||null,this._addlastPoint=this.options.addlastPoint||!1,this._waitForReady=this.options.waitForReady||!1,this._defaultTime=0,this._availableTimes=[],this._loaded=!1,0==this._baseLayer.getLayers().length?this._waitForReady?this._baseLayer.on("ready",this._onReadyBaseLayer,this):this._loaded=!0:(this._loaded=!0,this._setAvailableTimes())},onAdd:function(a){L.TimeDimension.Layer.prototype.onAdd.call(this,a),this._loaded&&this._setAvailableTimes()},eachLayer:function(a,b){return this._currentLayer&&a.call(b,this._currentLayer),L.TimeDimension.Layer.prototype.eachLayer.call(this,a,b)},isReady:function(a){return this._loaded},_update:function(){if(this._map&&this._loaded){var a=(this._timeDimension.getCurrentTime(),this._timeDimension.getCurrentTime()),b=0;if(this._duration){var c=new Date(a);L.TimeDimension.Util.subtractTimeDuration(c,this._duration,!0),b=c.getTime()}for(var d=L.geoJson(null,this._baseLayer.options),e=this._baseLayer.getLayers(),f=0,g=e.length;g>f;f++){var h=this._getFeatureBetweenDates(e[f].feature,b,a);if(h&&(d.addData(h),this._addlastPoint&&"LineString"==h.geometry.type&&h.geometry.coordinates.length>0)){var i=h.properties;i.last=!0,d.addData({type:"Feature",properties:i,geometry:{type:"Point",coordinates:h.geometry.coordinates[h.geometry.coordinates.length-1]}})}}this._currentLayer&&this._map.removeLayer(this._currentLayer),d.getLayers().length&&(d.addTo(this._map),this._currentLayer=d)}},_setAvailableTimes:function(){var a=[];this._availableTimes=[];for(var b=this._baseLayer.getLayers(),c=0,d=b.length;d>c;c++)b[c].feature&&(a=L.TimeDimension.Util.union_arrays(a,this._getFeatureTimes(b[c].feature)));for(var c=0,d=a.length;d>c;c++){var e=a[c];("string"==typeof e||e instanceof String)&&(e=Date.parse(e.trim())),this._availableTimes.push(e)}this._timeDimension&&(this._updateTimeDimension||0==this._timeDimension.getAvailableTimes().length)&&(this._timeDimension.setAvailableTimes(this._availableTimes,this._updateTimeDimensionMode),this._timeDimension.setCurrentTime(this._availableTimes[0]))},_getFeatureTimes:function(a){return a.properties?a.properties.hasOwnProperty("coordTimes")?a.properties.coordTimes:a.properties.hasOwnProperty("times")?a.properties.times:a.properties.hasOwnProperty("linestringTimestamps")?a.properties.linestringTimestamps:a.properties.hasOwnProperty("time")?[a.properties.time]:[]:[]},_getFeatureBetweenDates:function(a,b,c){var d=this._getFeatureTimes(a);if(0==d.length)return a;for(var e=[],f=0,g=d.length;g>f;f++){var h=d[f];("string"==typeof h||h instanceof String)&&(h=Date.parse(h.trim())),e.push(h)}if(e[0]>c||e[g-1]b)for(var f=0;g>f;f++)if(null===i&&e[f]>b&&(i=f),e[f]>c){j=f;break}null===i&&(i=0),null===j&&(j=g);var k=[];return k=a.geometry.coordinates[0].length?a.geometry.coordinates.slice(i,j):a.geometry.coordinates,{type:"Feature",properties:a.properties,geometry:{type:a.geometry.type,coordinates:k}}},_onReadyBaseLayer:function(){this._loaded=!0,this._setAvailableTimes(),this._update()}}),L.timeDimension.layer.geoJson=function(a,b){return new L.TimeDimension.Layer.GeoJson(a,b)},L.TimeDimension.Player=(L.Layer||L.Class).extend({initialize:function(a,b){L.setOptions(this,a),this._timeDimension=b,this._paused=!1,this._buffer=this.options.buffer||5,this._minBufferReady=this.options.minBufferReady||1,this._waitingForBuffer=!1,this._loop=this.options.loop||!1,this._steps=1,this._timeDimension.on("timeload",function(a){this["continue"](),this._waitingForBuffer=!1}.bind(this)),this.setTransitionTime(this.options.transitionTime||1e3)},_tick:function(){if(this._timeDimension.getCurrentTimeIndex()>=this._timeDimension.getAvailableTimes().length-1&&!this._loop)return this.pause(),this.stop(),void this._timeDimension.fire("timeanimationfinished");if(!this._paused){var a=0,b=this._bufferSize;if(this._minBufferReady>0)if(a=this._timeDimension.getNumberNextTimesReady(this._steps,b),this._waitingForBuffer){if(b>a)return void this._timeDimension.fire("timeanimationwaiting",{percent:a/b});this._timeDimension.fire("timeanimationrunning"),this._waitingForBuffer=!1}else if(a0&&this._timeDimension.prepareNextTimes(this._steps,b)}},start:function(a){this._intervalID||(this._steps=a||1,this._waitingForBuffer=!1,this._intervalID=window.setInterval(L.bind(this._tick,this),this._transitionTime),this._tick())},stop:function(){this._intervalID&&(clearInterval(this._intervalID),this._intervalID=null)},pause:function(){this._paused=!0},"continue":function(){this._paused=!1},getTransitionTime:function(){return this._transitionTime},isPlaying:function(){return this._intervalID?!0:!1},isWaiting:function(){return this._waitingForBuffer},setTransitionTime:function(a){this._transitionTime=a,"function"==typeof this._buffer?this._bufferSize=this._buffer.call(this,this._transitionTime,this._minBufferReady,this._loop):this._bufferSize=this._buffer,this._intervalID&&(this.stop(),this.start())}}),L.Control.TimeDimension=L.Control.extend({options:{position:"bottomleft",title:"Time Control",backwardButton:!0,forwardButton:!0,playButton:!0,displayDate:!0,timeSlider:!0,speedSlider:!0,timeSteps:1,autoPlay:!1,playerOptions:{transitionTime:1e3}},initialize:function(a){L.Control.prototype.initialize.call(this,a),this._dateUTC=!0,this._timeDimension=this.options.timeDimension||null},onAdd:function(a){!this._timeDimension&&a.timeDimension&&(this._timeDimension=a.timeDimension);var b,c="leaflet-control-timecontrol";return b=L.DomUtil.create("div","leaflet-bar leaflet-bar-horizontal leaflet-bar-timecontrol"),this.options.backwardButton&&(this._buttonBackward=this._createBackwardButton(c+" timecontrol-backward",b)),this.options.playButton&&(this._buttonPlayPause=this._createPlayPauseButton(c+" timecontrol-play",b)),this.options.forwardButton&&(this._buttonForward=this._createForwardButton(c+" timecontrol-forward",b)),this.options.displayDate&&(this._displayDate=this._createDisplayDate(c+" timecontrol-date",b)),this.options.timeSlider&&(this._slider=this._createSlider(c+" timecontrol-slider timecontrol-dateslider",b)),this.options.speedSlider&&(this._sliderSpeed=this._createSliderSpeed(c+" timecontrol-slider timecontrol-speed",b)),this._steps=this.options.timeSteps||1,this._timeDimension.on("timeload",function(a){this._update()}.bind(this)),this._timeDimension.on("timeloading",function(a){a.time==this._timeDimension.getCurrentTime()&&this._displayDate&&-1==this._displayDate.className.indexOf(" timecontrol-loading")&&(this._displayDate.className+=" timecontrol-loading")}.bind(this)),this._timeDimension.on("timeanimationwaiting",function(a){this._buttonPlayPause&&(this._buttonPlayPause.className="leaflet-control-timecontrol timecontrol-play-loading",this._buttonPlayPause.innerHTML=""+Math.floor(100*a.percent)+"%")}.bind(this)),this._timeDimension.on("timeload timeanimationrunning",function(a){this._buttonPlayPause&&(this._buttonPlayPause.innerHTML="",this._player&&this._player.isPlaying()?this._buttonPlayPause.className="leaflet-control-timecontrol timecontrol-pause":this._buttonPlayPause.className="leaflet-control-timecontrol timecontrol-play")}.bind(this)),this._timeDimension.on("timeanimationfinished",function(a){this._buttonPlayPause&&(this._buttonPlayPause.className="leaflet-control-timecontrol timecontrol-play")}.bind(this)),this._timeDimension.on("availabletimeschanged",function(a){this._slider&&this._slider.slider("option","max",this._timeDimension.getAvailableTimes().length-1)}.bind(this)),b.addEventListener("mouseover",function(){a.dragging.disable(),a.doubleClickZoom.disable()}),b.addEventListener("mouseout",function(){a.dragging.enable(),a.doubleClickZoom.enable()}),this._update(),this.options.autoPlay&&this._buttonPlayPause&&this._buttonPlayPauseClicked(),b},_initPlayer:function(){this._player=new L.TimeDimension.Player(this.options.playerOptions,this._timeDimension),this._sliderSpeed&&this._sliderSpeedValueChanged(this._sliderSpeed.slider("value"))},_update:function(){if(this._timeDimension){var a=this._timeDimension.getCurrentTime();if(a>0){var b=new Date(a);this._displayDate&&(this._displayDate.className=this._displayDate.className.replace(" timecontrol-loading",""),this._displayDate.innerHTML=this._getDisplayDateFormat(b)),this._slider&&!this._slidingTimeSlider&&this._slider.slider("value",this._timeDimension.getCurrentTimeIndex())}else this._displayDate&&(this._displayDate.innerHTML="Time not available"),this._slider&&this._slider.slider("value",0)}},_createBackwardButton:function(a,b){var c=L.DomUtil.create("a",a,b);return c.href="#",c.title="Backward",L.DomEvent.addListener(c,"click",L.DomEvent.stopPropagation).addListener(c,"click",L.DomEvent.preventDefault).addListener(c,"click",this._buttonBackwardClicked,this),c},_createForwardButton:function(a,b){var c=L.DomUtil.create("a",a,b);return c.href="#",c.title="Forward",L.DomEvent.addListener(c,"click",L.DomEvent.stopPropagation).addListener(c,"click",L.DomEvent.preventDefault).addListener(c,"click",this._buttonForwardClicked,this),c},_createPlayPauseButton:function(a,b){var c=L.DomUtil.create("a",a,b);return c.href="#",c.title="Play",L.DomEvent.addListener(c,"click",L.DomEvent.stopPropagation).addListener(c,"click",L.DomEvent.preventDefault).addListener(c,"click",this._buttonPlayPauseClicked,this),c},_createDisplayDate:function(a,b){var c=L.DomUtil.create("a",a,b);return c.href="#",c.title="UTC Time",L.DomEvent.addListener(c,"click",L.DomEvent.stopPropagation).addListener(c,"click",L.DomEvent.preventDefault).addListener(c,"click",this._toggleDateUTC,this),c},_createSlider:function(b,c){var d=L.DomUtil.create("a",b,c);d.href="#",L.DomEvent.addListener(d,"click",L.DomEvent.stopPropagation).addListener(d,"click",L.DomEvent.preventDefault),d.innerHTML='
';var e=a(d).find(".slider"),f=this._timeDimension.getAvailableTimes().length-1;return e.slider({min:0,max:f,range:"min",stop:function(a,b){this._sliderValueChanged(b.value),this._slidingTimeSlider=!1}.bind(this),slide:function(a,b){this._slidingTimeSlider=!0;var c=new Date(this._timeDimension.getAvailableTimes()[b.value]);this._displayDate.innerHTML=this._getDisplayDateFormat(c)}.bind(this)}),e},_createSliderSpeed:function(b,c){var d=L.DomUtil.create("a",b,c);d.href="#",L.DomEvent.addListener(d,"click",L.DomEvent.stopPropagation).addListener(d,"click",L.DomEvent.preventDefault);var e=1;e=this._player?1e3/this._playerOptions.getTransitionTime():Math.round(1e4/(this.options.playerOptions.transitionTime||1e3))/10,d.innerHTML=''+e+'fps
';var f=a(d).find(".slider");return f.slider({min:.1,max:10,value:e,step:.1,range:"min",stop:function(b,c,d){var e=a(b).find(".speed")[0];e.innerHTML=d.value+"fps",this._sliderSpeedValueChanged(d.value)}.bind(this,d),slide:function(b,c,d){var e=a(b).find(".speed")[0];e.innerHTML=d.value+"fps"}.bind(this,d)}),f},_buttonBackwardClicked:function(a){this._timeDimension.previousTime(this._steps)},_buttonForwardClicked:function(a){this._timeDimension.nextTime(this._steps)},_buttonPlayPauseClicked:function(a){this._player||this._initPlayer(),this._player.isPlaying()?this._player.isWaiting()?(this._buttonPlayPause.className="leaflet-control-timecontrol timecontrol-pause",this._buttonPlayPause.innerHTML="",this._player.stop(),this._player.start(this._steps)):(this._buttonPlayPause.className="leaflet-control-timecontrol timecontrol-play",this._player.stop(),this._buttonPlayPause.innerHTML=""):(this._buttonPlayPause.className="leaflet-control-timecontrol timecontrol-pause",this._player.start(this._steps))},_sliderValueChanged:function(a){this._timeDimension.setCurrentTimeIndex(a)},_sliderSpeedValueChanged:function(a){this._player&&this._player.setTransitionTime(1e3/a)},_toggleDateUTC:function(a){this._dateUTC?this._displayDate.title="Local Time":this._displayDate.title="UTC Time",this._dateUTC=!this._dateUTC,this._update()},_getDisplayDateFormat:function(a){return this._dateUTC?a.toISOString():a.toLocaleString()}}),L.Map.addInitHook(function(){this.options.timeDimensionControl&&(this.timeDimensionControl=L.control.timeDimension(this.options.timeDimensionControlOptions||{}),this.addControl(this.timeDimensionControl))}),L.control.timeDimension=function(a){return new L.Control.TimeDimension(a)}}(jQuery); \ No newline at end of file +!function(a){L.TimeDimension=(L.Layer||L.Class).extend({includes:L.Mixin.Events,initialize:function(a){L.setOptions(this,a),this._availableTimes=this._generateAvailableTimes(),this._currentTimeIndex=-1,this._loadingTimeIndex=-1,this._loadingTimeout=this.options.loadingTimeout||3e3,this._syncedLayers=[],this._availableTimes.length>0&&this.setCurrentTime(this.options.currentTime||this._getDefaultCurrentTime())},getAvailableTimes:function(){return this._availableTimes},getCurrentTimeIndex:function(){return-1==this._currentTimeIndex?this._availableTimes.length-1:this._currentTimeIndex},getCurrentTime:function(){var a=-1;return a=-1!=this._loadingTimeIndex?this._loadingTimeIndex:this.getCurrentTimeIndex(),a>=0?this._availableTimes[a]:0},isLoading:function(){return-1!=this._loadingTimeIndex},setCurrentTimeIndex:function(a){if(a>=this._availableTimes.length&&(a=this._availableTimes.length-1),!(0>a)){this._loadingTimeIndex=a;var b=this._availableTimes[a];this._checkSyncedLayersReady(this._availableTimes[this._loadingTimeIndex])?this._newTimeIndexLoaded():(this.fire("timeloading",{time:b}),setTimeout(function(a){a==this._loadingTimeIndex&&this._newTimeIndexLoaded()}.bind(this,a),this._loadingTimeout))}},_newTimeIndexLoaded:function(){if(-1!=this._loadingTimeIndex){var a=this._availableTimes[this._loadingTimeIndex];this._currentTimeIndex=this._loadingTimeIndex,this.fire("timeload",{time:a}),this._loadingTimeIndex=-1}},_checkSyncedLayersReady:function(a){for(var b=0,c=this._syncedLayers.length;c>b;b++)if(this._syncedLayers[b].isReady&&!this._syncedLayers[b].isReady(a))return!1;return!0},setCurrentTime:function(a){var b=this._seekNearestTimeIndex(a);this.setCurrentTimeIndex(b)},seekNearestTime:function(a){var b=this._seekNearestTimeIndex(a);return this._availableTimes[b]},nextTime:function(a,b){void 0===a&&(a=1),void 0===b&&(b=!1);var c=this._currentTimeIndex;if(this._loadingTimeIndex>-1&&(c=this._loadingTimeIndex),c+=a,c>=this._availableTimes.length){if(!b)return;c=0}this.setCurrentTimeIndex(c)},prepareNextTimes:function(a,b){void 0===a&&(a=1);var c=this._currentTimeIndex;this._loadingTimeIndex>-1&&(c=this._loadingTimeIndex);for(var d=0,e=this._syncedLayers.length;e>d;d++)this._syncedLayers[d].setMinimumForwardCache&&this._syncedLayers[d].setMinimumForwardCache(b);for(var f=b;f>0&&(c+=a,!(c>=this._availableTimes.length));)this.fire("timeloading",{time:this._availableTimes[c]}),f--},getNumberNextTimesReady:function(a,b){void 0===a&&(a=1);var c=this._currentTimeIndex;this._loadingTimeIndex>-1&&(c=this._loadingTimeIndex);for(var d=b,e=0;d>0;){if(c+=a,c>=this._availableTimes.length){d=0,e=b;break}var f=this._availableTimes[c];this._checkSyncedLayersReady(f)&&e++,d--}return e},previousTime:function(a){void 0===a&&(a=1);var b=this._currentTimeIndex;this._loadingTimeIndex>-1&&(b=this._loadingTimeIndex),b-=a,0>b&&(b=0),this.setCurrentTimeIndex(b)},registerSyncedLayer:function(a){this._syncedLayers.push(a),a.on("timeload",this._onSyncedLayerLoaded,this)},unregisterSyncedLayer:function(a){var b=this._syncedLayers.indexOf(a);-1!=b&&this._syncedLayers.splice(b,1),a.off("timeload",this._onSyncedLayerLoaded,this)},_onSyncedLayerLoaded:function(a){a.time==this._availableTimes[this._loadingTimeIndex]&&this._checkSyncedLayersReady(a.time)&&this._newTimeIndexLoaded()},_generateAvailableTimes:function(){if(this.options.times)return L.TimeDimension.Util.parseTimesExpression(this.options.times);if(this.options.timeInterval){var a=L.TimeDimension.Util.parseTimeInterval(this.options.timeInterval),b=this.options.period||"P1D",c=this.options.validTimeRange||void 0;return L.TimeDimension.Util.explodeTimeRange(a[0],a[1],b,c)}return[]},_getDefaultCurrentTime:function(){var a=this._seekNearestTimeIndex((new Date).getTime());return this._availableTimes[a]},_seekNearestTimeIndex:function(a){for(var b=0,c=this._availableTimes.length;c>b&&!(a0&&b--,b},setAvailableTimes:function(a,b){var c=this.getCurrentTime();if("extremes"==b){var d=this.options.period||"P1D";this._availableTimes=L.TimeDimension.Util.explodeTimeRange(new Date(a[0]),new Date(a[a.length-1]),d)}else{var e=L.TimeDimension.Util.parseTimesExpression(a);if(0==this._availableTimes.length)this._availableTimes=e;else if("intersect"==b)this._availableTimes=L.TimeDimension.Util.intersect_arrays(e,this._availableTimes);else if("union"==b)this._availableTimes=L.TimeDimension.Util.union_arrays(e,this._availableTimes);else{if("replace"!=b)throw"Merge available times mode not implemented: "+b;this._availableTimes=e}}this.setCurrentTime(c),this.fire("availabletimeschanged",{})}}),L.Map.addInitHook(function(){this.options.timeDimension&&(this.timeDimension=L.timeDimension(this.options.timeDimensionOptions||{}))}),L.timeDimension=function(a){return new L.TimeDimension(a)},L.TimeDimension.Util={getTimeDuration:function(a){if(void 0===nezasa)throw"iso8601-js-period library is required for Leatlet.TimeDimension: https://github.com/nezasa/iso8601-js-period";return nezasa.iso8601.Period.parse(a,!0)},addTimeDuration:function(a,b,c){void 0===c&&(c=!0),("string"==typeof b||b instanceof String)&&(b=this.getTimeDuration(b));var d=b.length,e=c?"getUTC":"get",f=c?"setUTC":"set";d>0&&0!=b[0]&&a[f+"FullYear"](a[e+"FullYear"]()+b[0]),d>1&&0!=b[1]&&a[f+"Month"](a[e+"Month"]()+b[1]),d>2&&0!=b[2]&&a[f+"Date"](a[e+"Date"]()+7*b[2]),d>3&&0!=b[3]&&a[f+"Date"](a[e+"Date"]()+b[3]),d>4&&0!=b[4]&&a[f+"Hours"](a[e+"Hours"]()+b[4]),d>5&&0!=b[5]&&a[f+"Minutes"](a[e+"Minutes"]()+b[5]),d>6&&0!=b[6]&&a[f+"Seconds"](a[e+"Seconds"]()+b[6])},subtractTimeDuration:function(a,b,c){("string"==typeof b||b instanceof String)&&(b=this.getTimeDuration(b));for(var d=[],e=0,f=b.length;f>e;e++)d.push(-b[e]);this.addTimeDuration(a,d,c)},parseAndExplodeTimeRange:function(a){var b=a.split("/"),c=new Date(Date.parse(b[0])),d=new Date(Date.parse(b[1])),e=b.length>2?b[2]:"P1D";return this.explodeTimeRange(c,d,e)},explodeTimeRange:function(a,b,c,d){var e=this.getTimeDuration(c),f=[],g=new Date(a.getTime()),h=null,i=null,j=null,k=null;if(void 0!==d){var l=d.split("/");h=l[0].split(":")[0],i=l[0].split(":")[1],j=l[1].split(":")[0],k=l[1].split(":")[1]}for(;b>g;)(void 0===d||g.getUTCHours()>=h&&g.getUTCHours()<=j)&&(g.getUTCHours()!=h||g.getUTCMinutes()>=i)&&(g.getUTCHours()!=j||g.getUTCMinutes()<=k)&&f.push(g.getTime()),this.addTimeDuration(g,e);return g>=b&&f.push(b.getTime()),f},parseTimeInterval:function(a){var b=a.split("/");if(2!=b.length)throw"Incorrect ISO9601 TimeInterval: "+a;var c=Date.parse(b[0]),d=null,e=null;return isNaN(c)?(e=this.getTimeDuration(b[0]),d=Date.parse(b[1]),c=new Date(d),this.subtractTimeDuration(c,e,!0),d=new Date(d)):(d=Date.parse(b[1]),isNaN(d)?(e=this.getTimeDuration(b[1]),d=new Date(c),this.addTimeDuration(d,e,!0)):d=new Date(d),c=new Date(c)),[c,d]},parseTimesExpression:function(a){var b=[];if(!a)return b;if("string"==typeof a||a instanceof String)for(var c,d,e=a.split(","),f=0,g=e.length;g>f;f++)c=e[f],3==c.split("/").length?b=b.concat(this.parseAndExplodeTimeRange(c)):(d=Date.parse(c),isNaN(d)||b.push(d));else b=a;return b.sort(function(a,b){return a-b})},intersect_arrays:function(a,b){for(var c=a.slice(0),d=b.slice(0),e=[];c.length>0&&d.length>0;)c[0]d[0]?d.shift():(e.push(c.shift()),d.shift());return e},union_arrays:function(a,b){for(var c=a.slice(0),d=b.slice(0),e=[];c.length>0&&d.length>0;)c[0]d[0]?e.push(d.shift()):(e.push(c.shift()),d.shift());return c.length>0?e=e.concat(c):d.length>0&&(e=e.concat(d)),e}},L.TimeDimension.Layer=(L.Layer||L.Class).extend({includes:L.Mixin.Events,options:{opacity:1,zIndex:1},initialize:function(a,b){L.setOptions(this,b||{}),this._map=null,this._baseLayer=a,this._currentLayer=null,this._timeDimension=this.options.timeDimension||null},addTo:function(a){return a.addLayer(this),this},onAdd:function(a){this._map=a,!this._timeDimension&&a.timeDimension&&(this._timeDimension=a.timeDimension),this._timeDimension.on("timeloading",this._onNewTimeLoading,this),this._timeDimension.on("timeload",this._update,this),this._timeDimension.registerSyncedLayer(this),this._update()},onRemove:function(a){this._timeDimension.unregisterSyncedLayer(this),this._timeDimension.off("timeloading",this._onNewTimeLoading,this),this._timeDimension.off("timeload",this._update,this),this.eachLayer(a.removeLayer,a),this._map=null},eachLayer:function(a,b){return a.call(b,this._baseLayer),this},setZIndex:function(a){return this.options.zIndex=a,this._baseLayer.setZIndex&&this._baseLayer.setZIndex(a),this._currentLayer&&this._currentLayer.setZIndex&&this._currentLayer.setZIndex(a),this},setOpacity:function(a){return this.options.opacity=a,this._baseLayer.setOpacity&&this._baseLayer.setOpacity(a),this._currentLayer&&this._currentLayer.setOpacity&&this._currentLayer.setOpacity(a),this},bringToBack:function(){return this._currentLayer?(this._currentLayer.bringToBack(),this):void 0},bringToFront:function(){return this._currentLayer?(this._currentLayer.bringToFront(),this):void 0},_onNewTimeLoading:function(a){this.fire("timeload",{time:a.time})},isReady:function(a){return!0},_update:function(){return!0},getBaseLayer:function(){return this._baseLayer},getBounds:function(){var a=new L.LatLngBounds;return this._currentLayer&&a.extend(this._currentLayer.getBounds?this._currentLayer.getBounds():this._currentLayer.getLatLng()),a}}),L.timeDimension.layer=function(a,b){return new L.TimeDimension.Layer(a,b)},L.TimeDimension.Layer.WMS=L.TimeDimension.Layer.extend({initialize:function(a,b){L.TimeDimension.Layer.prototype.initialize.call(this,a,b),this._timeCacheBackward=this.options.cacheBackward||this.options.cache||0,this._timeCacheForward=this.options.cacheForward||this.options.cache||0,this._wmsVersion=this.options.wmsVersion||this.options.version||a.options.version||"1.1.1",this._proxy=this.options.proxy||null,this._updateTimeDimension=this.options.updateTimeDimension||!1,this._setDefaultTime=this.options.setDefaultTime||!1,this._updateTimeDimensionMode=this.options.updateTimeDimensionMode||"intersect",this._layers={},this._defaultTime=0,this._availableTimes=[],this._capabilitiesRequested=!1,(this._updateTimeDimension||this.options.requestTimeFromCapabilities)&&this._requestTimeDimensionFromCapabilities(),this._baseLayer.on("load",function(){this._baseLayer.setLoaded(!0),this.fire("timeload",{time:this._defaultTime})}.bind(this))},getEvents:function(){var a=L.bind(this._unvalidateCache,this);return{moveend:a,zoomend:a}},eachLayer:function(a,b){for(var c in this._layers)this._layers.hasOwnProperty(c)&&a.call(b,this._layers[c]);return L.TimeDimension.Layer.prototype.eachLayer.call(this,a,b)},_onNewTimeLoading:function(a){var b=this._getLayerForTime(a.time);this._map.hasLayer(b)||this._map.addLayer(b)},isReady:function(a){var b=this._getLayerForTime(a);return b.isLoaded()},onAdd:function(a){L.TimeDimension.Layer.prototype.onAdd.call(this,a),0==this._availableTimes.length?this._requestTimeDimensionFromCapabilities():this._updateTimeDimensionAvailableTimes()},_update:function(){if(this._map){var a=this._timeDimension.getCurrentTime(),b=this._getLayerForTime(a);null==this._currentLayer&&(this._currentLayer=b),this._map.hasLayer(b)?this._showLayer(b,a):this._map.addLayer(b)}},setOpacity:function(a){L.TimeDimension.Layer.prototype.setOpacity.apply(this,arguments);for(var b in this._layers)this._layers.hasOwnProperty(b)&&this._layers[b].setOpacity&&this._layers[b].setOpacity(a)},setParams:function(a,b){L.extend(this._baseLayer.options,a);for(var c in this._layers)this._layers.hasOwnProperty(c)&&this._layers[c].setParams&&(this._layers[c].setLoaded(!1),this._layers[c].setParams(a,b));return this},_unvalidateCache:function(){var a=this._timeDimension.getCurrentTime();for(var b in this._layers)a!=b&&this._layers.hasOwnProperty(b)&&(this._layers[b].setLoaded(!1),this._layers[b].redraw())},_evictCachedTimes:function(a,b){var c=this._getLoadedTimes(),d=String(this._currentTime),e=c.indexOf(d),f=[];if(b>-1){var g=e-b;g>0&&(f=c.splice(0,g),this._removeLayers(f))}if(a>-1){e=c.indexOf(d);var g=c.length-e-a-1;g>0&&(f=c.splice(e+a+1,g),this._removeLayers(f))}},_showLayer:function(a,b){this._currentLayer&&this._currentLayer!==a&&this._currentLayer.hide(),a.show(),this._currentLayer&&this._currentLayer===a||(this._currentLayer=a,this._currentTime=b,this._evictCachedTimes(this._timeCacheForward,this._timeCacheBackward))},_getLayerForTime:function(a){if(0==a||a==this._defaultTime||null==a)return this._baseLayer;if(this._layers.hasOwnProperty(a))return this._layers[a];var b=this._getNearestTime(a);if(this._layers.hasOwnProperty(b))return this._layers[b];var c=this._baseLayer.options;c.time=new Date(b).toISOString();var d=new this._baseLayer.constructor(this._baseLayer.getURL(),c);return this._layers[a]=d,d.on("load",function(a,b){a.setLoaded(!0),this._layers[b]||(this._layers[b]=a),this._timeDimension&&b==this._timeDimension.getCurrentTime()&&!this._timeDimension.isLoading()&&this._showLayer(a,b),this.fire("timeload",{time:b})}.bind(this,d,a)),d.onAdd=function(a){Object.getPrototypeOf(this).onAdd.call(this,a),this.hide()}.bind(d),d},_getLoadedTimes:function(){var a=[];for(var b in this._layers)this._layers.hasOwnProperty(b)&&a.push(b);return a.sort(function(a,b){return a-b})},_removeLayers:function(a){for(var b=0,c=a.length;c>b;b++)this._map&&this._map.removeLayer(this._layers[a[b]]),delete this._layers[a[b]]},setMinimumForwardCache:function(a){a>this._timeCacheForward&&(this._timeCacheForward=a)},_requestTimeDimensionFromCapabilities:function(){if(!this._capabilitiesRequested){this._capabilitiesRequested=!0;var b=this._baseLayer.getURL(),c=b+"?service=WMS&version="+this._wmsVersion+"&request=GetCapabilities";this._proxy&&(c=this._proxy+"?url="+encodeURIComponent(c)),a.get(c,function(a){this._defaultTime=Date.parse(this._getDefaultTimeFromCapabilities(a)),this._setDefaultTime=this._setDefaultTime||this._timeDimension&&0==this._timeDimension.getAvailableTimes().length,this.setAvailableTimes(this._parseTimeDimensionFromCapabilities(a)),this._setDefaultTime&&this._timeDimension&&this._timeDimension.setCurrentTime(this._defaultTime)}.bind(this))}},_parseTimeDimensionFromCapabilities:function(b){var c=a(b).find('Layer[queryable="1"]'),d=this._baseLayer.wmsParams.layers,e=c.find("Name").filter(function(b){return a(this).text()===d}),f=null;if(e){var g=e.parent();f=this._getTimesFromLayerCapabilities(g),f||(f=this._getTimesFromLayerCapabilities(g.parent()))}return f},_getTimesFromLayerCapabilities:function(a){var b=null,c=a.find("Dimension[name='time']");if(c&&c.length&&c[0].textContent.length)b=c[0].textContent.trim();else{var d=a.find("Extent[name='time']");d&&d.length&&d[0].textContent.length&&(b=d[0].textContent.trim())}return b},_getDefaultTimeFromCapabilities:function(b){var c=a(b).find('Layer[queryable="1"]'),d=this._baseLayer.wmsParams.layers,e=c.find("Name").filter(function(b){return a(this).text()===d}),f=0;if(e){var g=e.parent();f=this._getDefaultTimeFromLayerCapabilities(g),0==f&&(f=this._getDefaultTimeFromLayerCapabilities(g.parent()))}return f},_getDefaultTimeFromLayerCapabilities:function(a){var b=0,c=a.find("Dimension[name='time']");if(c&&c.attr("default"))b=c.attr("default");else{var d=a.find("Extent[name='time']");d&&d.attr("default")&&(b=d.attr("default"))}return b},setAvailableTimes:function(a){this._availableTimes=L.TimeDimension.Util.parseTimesExpression(a),this._updateTimeDimensionAvailableTimes()},_updateTimeDimensionAvailableTimes:function(){(this._timeDimension&&this._updateTimeDimension||this._timeDimension&&0==this._timeDimension.getAvailableTimes().length)&&(this._timeDimension.setAvailableTimes(this._availableTimes,this._updateTimeDimensionMode),this._defaultTime>0&&this._timeDimension.setCurrentTime(this._defaultTime))},_getNearestTime:function(a){if(this._layers.hasOwnProperty(a))return a;if(0==this._availableTimes.length)return a;for(var b=0,c=this._availableTimes.length;c>b&&!(a0&&b--,a!=this._availableTimes[b],this._availableTimes[b]}}),L.NonTiledLayer||(L.NonTiledLayer=(L.Layer||L.Class).extend({})),L.NonTiledLayer.include({_visible:!0,_loaded:!1,_originalUpdate:L.NonTiledLayer.prototype._update,_originalOnRemove:L.NonTiledLayer.prototype.onRemove,_update:function(){(this._visible||!this._loaded)&&this._originalUpdate()},onRemove:function(a){this._loaded=!1,this._originalOnRemove(a)},setLoaded:function(a){this._loaded=a},isLoaded:function(){return this._loaded},hide:function(){this._visible=!1,this._div.style.display="none"},show:function(){this._visible=!0,this._div.style.display="block"},getURL:function(){return this._wmsUrl}}),L.TileLayer.include({_visible:!0,_loaded:!1,_originalUpdate:L.TileLayer.prototype._update,_update:function(){(this._visible||!this._loaded)&&this._originalUpdate()},setLoaded:function(a){this._loaded=a},isLoaded:function(){return this._loaded},hide:function(){this._visible=!1,this._container&&(this._container.style.display="none")},show:function(){this._visible=!0,this._container&&(this._container.style.display="block")},getURL:function(){return this._url}}),L.timeDimension.layer.wms=function(a,b){return new L.TimeDimension.Layer.WMS(a,b)},L.TimeDimension.Layer.GeoJson=L.TimeDimension.Layer.extend({initialize:function(a,b){L.TimeDimension.Layer.prototype.initialize.call(this,a,b),this._updateTimeDimension=this.options.updateTimeDimension||!1,this._updateTimeDimensionMode=this.options.updateTimeDimensionMode||"extremes",this._duration=this.options.duration||null,this._addlastPoint=this.options.addlastPoint||!1,this._waitForReady=this.options.waitForReady||!1,this._defaultTime=0,this._availableTimes=[],this._loaded=!1,0==this._baseLayer.getLayers().length?this._waitForReady?this._baseLayer.on("ready",this._onReadyBaseLayer,this):this._loaded=!0:(this._loaded=!0,this._setAvailableTimes())},onAdd:function(a){L.TimeDimension.Layer.prototype.onAdd.call(this,a),this._loaded&&this._setAvailableTimes()},eachLayer:function(a,b){return this._currentLayer&&a.call(b,this._currentLayer),L.TimeDimension.Layer.prototype.eachLayer.call(this,a,b)},isReady:function(a){return this._loaded},_update:function(){if(this._map&&this._loaded){var a=(this._timeDimension.getCurrentTime(),this._timeDimension.getCurrentTime()),b=0;if(this._duration){var c=new Date(a);L.TimeDimension.Util.subtractTimeDuration(c,this._duration,!0),b=c.getTime()}for(var d=L.geoJson(null,this._baseLayer.options),e=this._baseLayer.getLayers(),f=0,g=e.length;g>f;f++){var h=this._getFeatureBetweenDates(e[f].feature,b,a);if(h&&(d.addData(h),this._addlastPoint&&"LineString"==h.geometry.type&&h.geometry.coordinates.length>0)){var i=h.properties;i.last=!0,d.addData({type:"Feature",properties:i,geometry:{type:"Point",coordinates:h.geometry.coordinates[h.geometry.coordinates.length-1]}})}}this._currentLayer&&this._map.removeLayer(this._currentLayer),d.getLayers().length&&(d.addTo(this._map),this._currentLayer=d)}},_setAvailableTimes:function(){var a=[];this._availableTimes=[];for(var b=this._baseLayer.getLayers(),c=0,d=b.length;d>c;c++)b[c].feature&&(a=L.TimeDimension.Util.union_arrays(a,this._getFeatureTimes(b[c].feature)));for(var c=0,d=a.length;d>c;c++){var e=a[c];("string"==typeof e||e instanceof String)&&(e=Date.parse(e.trim())),this._availableTimes.push(e)}this._timeDimension&&(this._updateTimeDimension||0==this._timeDimension.getAvailableTimes().length)&&(this._timeDimension.setAvailableTimes(this._availableTimes,this._updateTimeDimensionMode),this._timeDimension.setCurrentTime(this._availableTimes[0]))},_getFeatureTimes:function(a){return a.properties?a.properties.hasOwnProperty("coordTimes")?a.properties.coordTimes:a.properties.hasOwnProperty("times")?a.properties.times:a.properties.hasOwnProperty("linestringTimestamps")?a.properties.linestringTimestamps:a.properties.hasOwnProperty("time")?[a.properties.time]:[]:[]},_getFeatureBetweenDates:function(a,b,c){var d=this._getFeatureTimes(a);if(0==d.length)return a;for(var e=[],f=0,g=d.length;g>f;f++){var h=d[f];("string"==typeof h||h instanceof String)&&(h=Date.parse(h.trim())),e.push(h)}if(e[0]>c||e[g-1]b)for(var f=0;g>f;f++)if(null===i&&e[f]>b&&(i=f),e[f]>c){j=f;break}null===i&&(i=0),null===j&&(j=g);var k=[];return k=a.geometry.coordinates[0].length?a.geometry.coordinates.slice(i,j):a.geometry.coordinates,{type:"Feature",properties:a.properties,geometry:{type:a.geometry.type,coordinates:k}}},_onReadyBaseLayer:function(){this._loaded=!0,this._setAvailableTimes(),this._update()}}),L.timeDimension.layer.geoJson=function(a,b){return new L.TimeDimension.Layer.GeoJson(a,b)},L.TimeDimension.Player=(L.Layer||L.Class).extend({initialize:function(a,b){L.setOptions(this,a),this._timeDimension=b,this._paused=!1,this._buffer=this.options.buffer||5,this._minBufferReady=this.options.minBufferReady||1,this._waitingForBuffer=!1,this._loop=this.options.loop||!1,this._steps=1,this._timeDimension.on("timeload",function(a){this["continue"](),this._waitingForBuffer=!1}.bind(this)),this.setTransitionTime(this.options.transitionTime||1e3)},_tick:function(){if(this._timeDimension.getCurrentTimeIndex()>=this._timeDimension.getAvailableTimes().length-1&&!this._loop)return this.pause(),this.stop(),void this._timeDimension.fire("timeanimationfinished");if(!this._paused){var a=0,b=this._bufferSize;if(this._minBufferReady>0)if(a=this._timeDimension.getNumberNextTimesReady(this._steps,b),this._waitingForBuffer){if(b>a)return void this._timeDimension.fire("timeanimationwaiting",{percent:a/b});this._timeDimension.fire("timeanimationrunning"),this._waitingForBuffer=!1}else if(a0&&this._timeDimension.prepareNextTimes(this._steps,b)}},start:function(a){this._intervalID||(this._steps=a||1,this._waitingForBuffer=!1,this._intervalID=window.setInterval(L.bind(this._tick,this),this._transitionTime),this._tick())},stop:function(){this._intervalID&&(clearInterval(this._intervalID),this._intervalID=null)},pause:function(){this._paused=!0},"continue":function(){this._paused=!1},getTransitionTime:function(){return this._transitionTime},isPlaying:function(){return this._intervalID?!0:!1},isWaiting:function(){return this._waitingForBuffer},setTransitionTime:function(a){this._transitionTime=a,"function"==typeof this._buffer?this._bufferSize=this._buffer.call(this,this._transitionTime,this._minBufferReady,this._loop):this._bufferSize=this._buffer,this._intervalID&&(this.stop(),this.start())}}),L.Control.TimeDimension=L.Control.extend({options:{position:"bottomleft",title:"Time Control",backwardButton:!0,forwardButton:!0,playButton:!0,displayDate:!0,timeSlider:!0,speedSlider:!0,timeSteps:1,autoPlay:!1,playerOptions:{transitionTime:1e3}},initialize:function(a){L.Control.prototype.initialize.call(this,a),this._dateUTC=!0,this._timeDimension=this.options.timeDimension||null},onAdd:function(a){this._map=a,!this._timeDimension&&a.timeDimension&&(this._timeDimension=a.timeDimension);var b,c="leaflet-control-timecontrol";return b=L.DomUtil.create("div","leaflet-bar leaflet-bar-horizontal leaflet-bar-timecontrol"),this.options.backwardButton&&(this._buttonBackward=this._createBackwardButton(c+" timecontrol-backward",b)),this.options.playButton&&(this._buttonPlayPause=this._createPlayPauseButton(c+" timecontrol-play",b)),this.options.forwardButton&&(this._buttonForward=this._createForwardButton(c+" timecontrol-forward",b)),this.options.displayDate&&(this._displayDate=this._createDisplayDate(c+" timecontrol-date",b)),this.options.timeSlider&&(this._slider=this._createSlider(c+" timecontrol-slider timecontrol-dateslider",b)),this.options.speedSlider&&(this._sliderSpeed=this._createSliderSpeed(c+" timecontrol-slider timecontrol-speed",b)),this._steps=this.options.timeSteps||1,this._timeDimension.on("timeload",function(a){this._update()}.bind(this)),this._timeDimension.on("timeloading",function(a){a.time==this._timeDimension.getCurrentTime()&&this._displayDate&&-1==this._displayDate.className.indexOf(" timecontrol-loading")&&(this._displayDate.className+=" timecontrol-loading")}.bind(this)),this._timeDimension.on("timeanimationwaiting",function(a){this._buttonPlayPause&&(this._buttonPlayPause.className="leaflet-control-timecontrol timecontrol-play-loading",this._buttonPlayPause.innerHTML=""+Math.floor(100*a.percent)+"%")}.bind(this)),this._timeDimension.on("timeload timeanimationrunning",function(a){this._buttonPlayPause&&(this._buttonPlayPause.innerHTML="",this._player&&this._player.isPlaying()?this._buttonPlayPause.className="leaflet-control-timecontrol timecontrol-pause":this._buttonPlayPause.className="leaflet-control-timecontrol timecontrol-play")}.bind(this)),this._timeDimension.on("timeanimationfinished",function(a){this._buttonPlayPause&&(this._buttonPlayPause.className="leaflet-control-timecontrol timecontrol-play")}.bind(this)),this._timeDimension.on("availabletimeschanged",function(a){this._slider&&this._slider.slider("option","max",this._timeDimension.getAvailableTimes().length-1)}.bind(this)),b.addEventListener("mouseover",function(){a.dragging.disable(),a.doubleClickZoom.disable()}),b.addEventListener("mouseout",function(){a.dragging.enable(),a.doubleClickZoom.enable()}),this._update(),this.options.autoPlay&&this._buttonPlayPause&&this._buttonPlayPauseClicked(),b},_initPlayer:function(){this._player=new L.TimeDimension.Player(this.options.playerOptions,this._timeDimension),this._sliderSpeed&&this._sliderSpeedValueChanged(this._sliderSpeed.slider("value"))},_update:function(){if(this._timeDimension){var a=this._timeDimension.getCurrentTime();if(a>0){var b=new Date(a);this._displayDate&&(this._displayDate.className=this._displayDate.className.replace(" timecontrol-loading",""),this._displayDate.innerHTML=this._getDisplayDateFormat(b)),this._slider&&!this._slidingTimeSlider&&this._slider.slider("value",this._timeDimension.getCurrentTimeIndex())}else this._displayDate&&(this._displayDate.innerHTML="Time not available"),this._slider&&this._slider.slider("value",0)}},_createBackwardButton:function(a,b){var c=L.DomUtil.create("a",a,b);return c.href="#",c.title="Backward",L.DomEvent.addListener(c,"click",L.DomEvent.stopPropagation).addListener(c,"click",L.DomEvent.preventDefault).addListener(c,"click",this._buttonBackwardClicked,this),c},_createForwardButton:function(a,b){var c=L.DomUtil.create("a",a,b);return c.href="#",c.title="Forward",L.DomEvent.addListener(c,"click",L.DomEvent.stopPropagation).addListener(c,"click",L.DomEvent.preventDefault).addListener(c,"click",this._buttonForwardClicked,this),c},_createPlayPauseButton:function(a,b){var c=L.DomUtil.create("a",a,b);return c.href="#",c.title="Play",L.DomEvent.addListener(c,"click",L.DomEvent.stopPropagation).addListener(c,"click",L.DomEvent.preventDefault).addListener(c,"click",this._buttonPlayPauseClicked,this),c},_createDisplayDate:function(a,b){var c=L.DomUtil.create("a",a,b);return c.href="#",c.title="UTC Time",L.DomEvent.addListener(c,"click",L.DomEvent.stopPropagation).addListener(c,"click",L.DomEvent.preventDefault).addListener(c,"click",this._toggleDateUTC,this),c},_createSlider:function(b,c){var d=L.DomUtil.create("a",b,c);d.href="#",L.DomEvent.addListener(d,"click",L.DomEvent.stopPropagation).addListener(d,"click",L.DomEvent.preventDefault),d.innerHTML='
';var e=a(d).find(".slider"),f=this._timeDimension.getAvailableTimes().length-1;return e.slider({min:0,max:f,range:"min",stop:function(a,b){this._sliderValueChanged(b.value),this._slidingTimeSlider=!1}.bind(this),slide:function(a,b){this._slidingTimeSlider=!0;var c=new Date(this._timeDimension.getAvailableTimes()[b.value]);this._displayDate.innerHTML=this._getDisplayDateFormat(c)}.bind(this)}),e},_createSliderSpeed:function(b,c){var d=L.DomUtil.create("a",b,c);d.href="#",L.DomEvent.addListener(d,"click",L.DomEvent.stopPropagation).addListener(d,"click",L.DomEvent.preventDefault);var e=1;e=this._player?1e3/this._playerOptions.getTransitionTime():Math.round(1e4/(this.options.playerOptions.transitionTime||1e3))/10,d.innerHTML=''+e+'fps
';var f=a(d).find(".slider");return f.slider({min:.1,max:10,value:e,step:.1,range:"min",stop:function(b,c,d){var e=a(b).find(".speed")[0];e.innerHTML=d.value+"fps",this._sliderSpeedValueChanged(d.value)}.bind(this,d),slide:function(b,c,d){var e=a(b).find(".speed")[0];e.innerHTML=d.value+"fps"}.bind(this,d)}),f},_buttonBackwardClicked:function(a){this._timeDimension.previousTime(this._steps)},_buttonForwardClicked:function(a){this._timeDimension.nextTime(this._steps)},_buttonPlayPauseClicked:function(a){this._player||this._initPlayer(),this._player.isPlaying()?this._player.isWaiting()?(this._buttonPlayPause.className="leaflet-control-timecontrol timecontrol-pause",this._buttonPlayPause.innerHTML="",this._player.stop(),this._player.start(this._steps)):(this._buttonPlayPause.className="leaflet-control-timecontrol timecontrol-play",this._player.stop(),this._buttonPlayPause.innerHTML=""):(this._buttonPlayPause.className="leaflet-control-timecontrol timecontrol-pause",this._player.start(this._steps))},_sliderValueChanged:function(a){this._timeDimension.setCurrentTimeIndex(a)},_sliderSpeedValueChanged:function(a){this._player&&this._player.setTransitionTime(1e3/a)},_toggleDateUTC:function(a){this._dateUTC?this._displayDate.title="Local Time":this._displayDate.title="UTC Time",this._dateUTC=!this._dateUTC,this._update()},_getDisplayDateFormat:function(a){return this._dateUTC?a.toISOString():a.toLocaleString()}}),L.Map.addInitHook(function(){this.options.timeDimensionControl&&(this.timeDimensionControl=L.control.timeDimension(this.options.timeDimensionControlOptions||{}),this.addControl(this.timeDimensionControl))}),L.control.timeDimension=function(a){return new L.Control.TimeDimension(a)}}(jQuery); \ No newline at end of file diff --git a/dist/leaflet.timedimension.src.js b/dist/leaflet.timedimension.src.js index 8c29669..af988da 100644 --- a/dist/leaflet.timedimension.src.js +++ b/dist/leaflet.timedimension.src.js @@ -1,5 +1,5 @@ /* - * Leaflet TimeDimension v0.1.11 - 2016-01-07 + * Leaflet TimeDimension v0.1.12 - 2016-01-28 * * Copyright 2016 Biel Frontera (ICTS SOCIB) * datacenter@socib.es @@ -613,6 +613,14 @@ L.TimeDimension.Layer = (L.Layer || L.Class).extend({ getBaseLayer: function() { return this._baseLayer; + }, + + getBounds: function() { + var bounds = new L.LatLngBounds(); + if (this._currentLayer) { + bounds.extend(this._currentLayer.getBounds ? this._currentLayer.getBounds() : this._currentLayer.getLatLng()); + } + return bounds; } }); @@ -793,12 +801,8 @@ L.TimeDimension.Layer.WMS = L.TimeDimension.Layer.extend({ var wmsParams = this._baseLayer.options; wmsParams.time = new Date(nearestTime).toISOString(); - var newLayer = null; - if (this._baseLayer instanceof L.TileLayer) { - newLayer = L.tileLayer.wms(this._baseLayer.getURL(), wmsParams); - } else { - newLayer = L.nonTiledLayer.wms(this._baseLayer.getURL(), wmsParams); - } + var newLayer = new this._baseLayer.constructor(this._baseLayer.getURL(), wmsParams); + this._layers[time] = newLayer; newLayer.on('load', (function(layer, time) { @@ -1302,7 +1306,7 @@ L.TimeDimension.Player = (L.Layer || L.Class).extend({ _tick: function() { if (this._timeDimension.getCurrentTimeIndex() >= this._timeDimension.getAvailableTimes().length - 1) { - //we reached the last step + // we reached the last step if (!this._loop){ this.pause(); this.stop(); @@ -1427,6 +1431,7 @@ L.Control.TimeDimension = L.Control.extend({ }, onAdd: function(map) { + this._map = map; if (!this._timeDimension && map.timeDimension){ this._timeDimension = map.timeDimension; } @@ -1512,7 +1517,7 @@ L.Control.TimeDimension = L.Control.extend({ _initPlayer : function(){ this._player = new L.TimeDimension.Player(this.options.playerOptions, this._timeDimension); - //Update TransitionTime with the one setted on the slider + // Update TransitionTime with the one setted on the slider if(this._sliderSpeed){ this._sliderSpeedValueChanged(this._sliderSpeed.slider( "value")); } diff --git a/dist/leaflet.timedimension.src.withlog.js b/dist/leaflet.timedimension.src.withlog.js index 40d602a..1b764a9 100644 --- a/dist/leaflet.timedimension.src.withlog.js +++ b/dist/leaflet.timedimension.src.withlog.js @@ -1,5 +1,5 @@ /* - * Leaflet TimeDimension v0.1.11 - 2016-01-07 + * Leaflet TimeDimension v0.1.12 - 2016-01-28 * * Copyright 2016 Biel Frontera (ICTS SOCIB) * datacenter@socib.es @@ -613,6 +613,14 @@ L.TimeDimension.Layer = (L.Layer || L.Class).extend({ getBaseLayer: function() { return this._baseLayer; + }, + + getBounds: function() { + var bounds = new L.LatLngBounds(); + if (this._currentLayer) { + bounds.extend(this._currentLayer.getBounds ? this._currentLayer.getBounds() : this._currentLayer.getLatLng()); + } + return bounds; } }); @@ -793,12 +801,8 @@ L.TimeDimension.Layer.WMS = L.TimeDimension.Layer.extend({ var wmsParams = this._baseLayer.options; wmsParams.time = new Date(nearestTime).toISOString(); - var newLayer = null; - if (this._baseLayer instanceof L.TileLayer) { - newLayer = L.tileLayer.wms(this._baseLayer.getURL(), wmsParams); - } else { - newLayer = L.nonTiledLayer.wms(this._baseLayer.getURL(), wmsParams); - } + var newLayer = new this._baseLayer.constructor(this._baseLayer.getURL(), wmsParams); + this._layers[time] = newLayer; newLayer.on('load', (function(layer, time) { @@ -1302,7 +1306,7 @@ L.TimeDimension.Player = (L.Layer || L.Class).extend({ _tick: function() { if (this._timeDimension.getCurrentTimeIndex() >= this._timeDimension.getAvailableTimes().length - 1) { - //we reached the last step + // we reached the last step if (!this._loop){ this.pause(); this.stop(); @@ -1427,6 +1431,7 @@ L.Control.TimeDimension = L.Control.extend({ }, onAdd: function(map) { + this._map = map; if (!this._timeDimension && map.timeDimension){ this._timeDimension = map.timeDimension; } @@ -1512,7 +1517,7 @@ L.Control.TimeDimension = L.Control.extend({ _initPlayer : function(){ this._player = new L.TimeDimension.Player(this.options.playerOptions, this._timeDimension); - //Update TransitionTime with the one setted on the slider + // Update TransitionTime with the one setted on the slider if(this._sliderSpeed){ this._sliderSpeedValueChanged(this._sliderSpeed.slider( "value")); } diff --git a/package.json b/package.json index e905b24..86f397c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "leaflet-timedimension", - "version": "0.1.11", + "version": "0.1.12", "description": "Add time dimension capabilities on a Leaflet map", "keywords": [ "gis", diff --git a/src/leaflet.timedimension.control.js b/src/leaflet.timedimension.control.js index 6329991..c620c86 100644 --- a/src/leaflet.timedimension.control.js +++ b/src/leaflet.timedimension.control.js @@ -26,6 +26,7 @@ L.Control.TimeDimension = L.Control.extend({ }, onAdd: function(map) { + this._map = map; if (!this._timeDimension && map.timeDimension){ this._timeDimension = map.timeDimension; } @@ -111,7 +112,7 @@ L.Control.TimeDimension = L.Control.extend({ _initPlayer : function(){ this._player = new L.TimeDimension.Player(this.options.playerOptions, this._timeDimension); - //Update TransitionTime with the one setted on the slider + // Update TransitionTime with the one setted on the slider if(this._sliderSpeed){ this._sliderSpeedValueChanged(this._sliderSpeed.slider( "value")); } diff --git a/src/leaflet.timedimension.player.js b/src/leaflet.timedimension.player.js index cddc37d..a3e1a17 100644 --- a/src/leaflet.timedimension.player.js +++ b/src/leaflet.timedimension.player.js @@ -23,7 +23,7 @@ L.TimeDimension.Player = (L.Layer || L.Class).extend({ _tick: function() { if (this._timeDimension.getCurrentTimeIndex() >= this._timeDimension.getAvailableTimes().length - 1) { - //we reached the last step + // we reached the last step if (!this._loop){ this.pause(); this.stop();