Merge pull request #4868 from sebasbaumh/refreshSource

Allow to refresh a source and reload its data.
This commit is contained in:
Tim Schaub
2016-02-25 07:15:46 -07:00
4 changed files with 65 additions and 0 deletions

View File

@@ -150,6 +150,15 @@ ol.source.Source.prototype.getWrapX = function() {
};
/**
* Refreshes the source and finally dispatches a 'change' event.
* @api
*/
ol.source.Source.prototype.refresh = function() {
this.changed();
};
/**
* Set the attributions of the source.
* @param {Array.<ol.Attribution>} attributions Attributions.

View File

@@ -290,6 +290,15 @@ ol.source.Tile.prototype.getTileCoordForTileUrlFunction = function(tileCoord, op
};
/**
* @inheritDoc
*/
ol.source.Tile.prototype.refresh = function() {
this.tileCache.clear();
this.changed();
};
/**
* Marks a tile coord as being used, without triggering a load.
* @param {number} z Tile coordinate z.