Support tile sources without configured projection
This change adds a lot of flexibility to working with tile layers: Sources where the server projection or tile grid do not matter can now be constructed without specifying a projection or tile grid. The tileUrlFunction/imageUrlFunction now also creates updated URLs when the params of the layer change, so things like mergeNewParams in ol2 will be possible. A nice side effect of this whole change is that there is no more duplicated code between tiled and single image WMS layers. While I was at it, I also fixed a WMS 1.1.1 axis order issue and incorrect STYLES params (STYLES=& instead of STYLES&).
This commit is contained in:
@@ -65,14 +65,14 @@ ol.source.TileSource.prototype.expireCache = goog.abstractMethod;
|
||||
*
|
||||
* @param {Object.<number, Object.<string, ol.Tile>>} loadedTilesByZ A lookup of
|
||||
* loaded tiles by zoom level.
|
||||
* @param {function(ol.Tile): boolean} isLoaded A function to determine if a
|
||||
* tile is fully loaded.
|
||||
* @param {function(ol.TileCoord): ol.Tile} getTileIfLoaded A function that
|
||||
* returns the tile only if it is fully loaded.
|
||||
* @param {number} z Zoom level.
|
||||
* @param {ol.TileRange} tileRange Tile range.
|
||||
* @return {boolean} The tile range is fully covered with loaded tiles.
|
||||
*/
|
||||
ol.source.TileSource.prototype.findLoadedTiles = function(loadedTilesByZ,
|
||||
isLoaded, z, tileRange) {
|
||||
getTileIfLoaded, z, tileRange) {
|
||||
// FIXME this could be more efficient about filling partial holes
|
||||
var fullyCovered = true;
|
||||
var tile, tileCoord, tileCoordKey, x, y;
|
||||
@@ -83,8 +83,8 @@ ol.source.TileSource.prototype.findLoadedTiles = function(loadedTilesByZ,
|
||||
if (loadedTilesByZ[z] && loadedTilesByZ[z][tileCoordKey]) {
|
||||
continue;
|
||||
}
|
||||
tile = this.getTile(tileCoord);
|
||||
if (isLoaded(tile)) {
|
||||
tile = getTileIfLoaded(tileCoord);
|
||||
if (!goog.isNull(tile)) {
|
||||
if (!loadedTilesByZ[z]) {
|
||||
loadedTilesByZ[z] = {};
|
||||
}
|
||||
@@ -108,6 +108,8 @@ ol.source.TileSource.prototype.getResolutions = function() {
|
||||
|
||||
/**
|
||||
* @param {ol.TileCoord} tileCoord Tile coordinate.
|
||||
* @param {ol.tilegrid.TileGrid=} opt_tileGrid Tile grid.
|
||||
* @param {ol.Projection=} opt_projection Projection.
|
||||
* @return {ol.Tile} Tile.
|
||||
*/
|
||||
ol.source.TileSource.prototype.getTile = goog.abstractMethod;
|
||||
@@ -124,9 +126,10 @@ ol.source.TileSource.prototype.getTileGrid = function() {
|
||||
/**
|
||||
* @param {number} z Z.
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @param {ol.tilegrid.TileGrid} tileGrid Tile grid.
|
||||
*/
|
||||
ol.source.TileSource.prototype.useLowResolutionTiles = function(z, extent) {
|
||||
var tileGrid = this.getTileGrid();
|
||||
ol.source.TileSource.prototype.useLowResolutionTiles =
|
||||
function(z, extent, tileGrid) {
|
||||
var tileRange, x, y, zKey;
|
||||
// FIXME this should loop up to tileGrid's minZ when implemented
|
||||
for (; z >= 0; --z) {
|
||||
|
||||
Reference in New Issue
Block a user