Do not transform tile coordinates for tileUrlFunction

This commit is contained in:
Andreas Hocevar
2015-06-18 09:09:21 +02:00
parent 2249c82ac2
commit af319c259b
19 changed files with 58 additions and 308 deletions

View File

@@ -118,6 +118,7 @@ ol.source.BingMaps.prototype.handleImageryMetadataResponse =
goog.array.map(
resource.imageUrlSubdomains,
function(subdomain) {
var quadKeyTileCoord = [0, 0, 0];
var imageUrl = resource.imageUrl
.replace('{subdomain}', subdomain)
.replace('{culture}', culture);
@@ -135,8 +136,10 @@ ol.source.BingMaps.prototype.handleImageryMetadataResponse =
if (goog.isNull(tileCoord)) {
return undefined;
} else {
return imageUrl.replace(
'{quadkey}', ol.tilecoord.quadKey(tileCoord));
ol.tilecoord.createOrUpdate(tileCoord[0], tileCoord[1],
-tileCoord[2] - 1, quadKeyTileCoord);
return imageUrl.replace('{quadkey}', ol.tilecoord.quadKey(
quadKeyTileCoord));
}
});
}));

View File

@@ -217,8 +217,7 @@ ol.source.Tile.prototype.getTilePixelSize =
/**
* Handles x-axis wrapping and returns a tile coordinate transformed from the
* internal tile scheme to the tile grid's tile scheme. When the tile coordinate
* Returns a tile coordinate wrapped around the x-axis. When the tile coordinate
* is outside the resolution and extent range of the tile grid, `null` will be
* returned.
* @param {ol.TileCoord} tileCoord Tile coordinate.
@@ -235,8 +234,7 @@ ol.source.Tile.prototype.getTileCoordForTileUrlFunction =
if (this.getWrapX()) {
tileCoord = ol.tilecoord.wrapX(tileCoord, tileGrid, projection);
}
return ol.tilecoord.withinExtentAndZ(tileCoord, tileGrid) ?
tileGrid.transformTileCoord(tileCoord) : null;
return ol.tilecoord.withinExtentAndZ(tileCoord, tileGrid) ? tileCoord : null;
};

View File

@@ -82,7 +82,7 @@ ol.source.TileUTFGrid.prototype.getTemplate = function() {
ol.source.TileUTFGrid.prototype.forDataAtCoordinateAndResolution = function(
coordinate, resolution, callback, opt_this, opt_request) {
if (!goog.isNull(this.tileGrid)) {
var tileCoord = this.tileGrid.getTileCoordForCoordAndResolutionInternal(
var tileCoord = this.tileGrid.getTileCoordForCoordAndResolution(
coordinate, resolution);
var tile = /** @type {!ol.source.TileUTFGridTile_} */(this.getTile(
tileCoord[0], tileCoord[1], tileCoord[2], 1, this.getProjection()));

View File

@@ -116,7 +116,7 @@ ol.source.TileVector.prototype.forEachFeatureAtCoordinateAndResolution =
var tileGrid = this.tileGrid_;
var tiles = this.tiles_;
var tileCoord = tileGrid.getTileCoordForCoordAndResolutionInternal(coordinate,
var tileCoord = tileGrid.getTileCoordForCoordAndResolution(coordinate,
resolution);
var tileKey = this.getTileKeyZXY_(tileCoord[0], tileCoord[1], tileCoord[2]);
@@ -250,7 +250,7 @@ ol.source.TileVector.prototype.getTileCoordForTileUrlFunction =
tileCoord = ol.tilecoord.wrapX(tileCoord, tileGrid, projection);
}
return ol.tilecoord.withinExtentAndZ(tileCoord, tileGrid) ?
tileGrid.transformTileCoord(tileCoord) : null;
tileCoord : null;
};

View File

@@ -140,7 +140,7 @@ ol.source.TileWMS.prototype.getGetFeatureInfoUrl =
tileGrid = this.getTileGridForProjection(projectionObj);
}
var tileCoord = tileGrid.getTileCoordForCoordAndResolutionInternal(
var tileCoord = tileGrid.getTileCoordForCoordAndResolution(
coordinate, resolution);
if (tileGrid.getResolutions().length <= tileCoord[0]) {

View File

@@ -159,7 +159,7 @@ ol.source.WMTS = function(options) {
var localContext = {
'TileMatrix': tileGrid.getMatrixId(tileCoord[0]),
'TileCol': tileCoord[1],
'TileRow': tileCoord[2]
'TileRow': -tileCoord[2] - 1
};
goog.object.extend(localContext, dimensions);
var url = template;

View File

@@ -6,9 +6,10 @@ goog.require('ol.ImageTile');
goog.require('ol.TileCoord');
goog.require('ol.TileState');
goog.require('ol.dom');
goog.require('ol.extent');
goog.require('ol.proj');
goog.require('ol.source.TileImage');
goog.require('ol.tilegrid.Zoomify');
goog.require('ol.tilegrid.TileGrid');
/**
@@ -86,8 +87,10 @@ ol.source.Zoomify = function(opt_options) {
}
resolutions.reverse();
var tileGrid = new ol.tilegrid.Zoomify({
extent: [0, 0, size[0], size[1]],
var extent = [0, -size[1], size[0], 0];
var tileGrid = new ol.tilegrid.TileGrid({
extent: extent,
origin: ol.extent.getTopLeft(extent),
resolutions: resolutions
});
@@ -106,7 +109,7 @@ ol.source.Zoomify = function(opt_options) {
} else {
var tileCoordZ = tileCoord[0];
var tileCoordX = tileCoord[1];
var tileCoordY = tileCoord[2];
var tileCoordY = -tileCoord[2] - 1;
var tileIndex =
tileCoordX +
tileCoordY * tierSizeInTiles[tileCoordZ][0] +