Commit 2665dff3 authored by Tomas Pettersson's avatar Tomas Pettersson 🏸

cache

parent 0fcd44f2
L.TimeDimension.Layer.WMS.Picasso = L.TimeDimension.Layer.WMS.extend({
initialize: function(layer, options) {
L.TimeDimension.Layer.WMS.prototype.initialize.call(this, layer, options);
this._refTime = 0;
},
_getCapabilitiesUrl: function() {
var url = this._baseLayer.getURL();
if (this._baseLayer.wmsParams.layers) url += this._baseLayer.wmsParams.layers;
......@@ -46,6 +49,9 @@ L.TimeDimension.Layer.WMS.Picasso = L.TimeDimension.Layer.WMS.extend({
if (this._setDefaultTime && this._timeDimension) {
this._timeDimension.setCurrentTime(this._defaultTime);
}
if (times.length > 0) {
this.fire('metadataload');
}
}).bind(this));
},
......@@ -53,6 +59,14 @@ L.TimeDimension.Layer.WMS.Picasso = L.TimeDimension.Layer.WMS.extend({
this._availableTimes = times;
this._updateTimeDimensionAvailableTimes();
},
// Player specific function: get available times to be used in player
getPlayerTimes: function() {
return this._availableTimes;
},
// Player specific function: should this layer available times be forced over other layers available times in player
forcePlayerTimes: function() {
return false;
},
_getRefTimeFromCapabilities: function(xml) {
var layers = $(xml).find('Layer[queryable="0"]');
......@@ -105,8 +119,22 @@ L.TimeDimension.Layer.WMS.Picasso = L.TimeDimension.Layer.WMS.extend({
}
return times;
},
getEvents : function(){
var clearCache = L.bind(this.clear, this);
return {
moveend: clearCache,
zoomend: clearCache
}
},
clear : function() {
for (var prop in this._layers) {
delete this._layers[prop];
}
},
_getLayerForTime: function(time) {
if (time == 0 || time == this._defaultTime || time == null) {
if (time == 0 || time == this._defaultTime || time == null || this._refTime == 0) {
return this._baseLayer;
}
if (this._layers.hasOwnProperty(time)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment