diff --git a/externs/olx.js b/externs/olx.js
index bf89432715..4f864f5467 100644
--- a/externs/olx.js
+++ b/externs/olx.js
@@ -6126,8 +6126,7 @@ olx.tilegrid;
/**
- * @typedef {{transformTileCoord: (undefined|function(ol.TileCoord, ol.TileCoord=):ol.TileCoord),
- * extent: (ol.Extent|undefined),
+ * @typedef {{extent: (ol.Extent|undefined),
* minZoom: (number|undefined),
* origin: (ol.Coordinate|undefined),
* origins: (Array.
|undefined),
@@ -6368,21 +6367,6 @@ olx.tilegrid.XYZOptions.prototype.minZoom;
olx.tilegrid.XYZOptions.prototype.tileSize;
-/**
- * @typedef {{resolutions: !Array.}}
- * @api
- */
-olx.tilegrid.ZoomifyOptions;
-
-
-/**
- * Resolutions.
- * @type {!Array.}
- * @api
- */
-olx.tilegrid.ZoomifyOptions.prototype.resolutions;
-
-
/**
* Namespace.
* @type {Object}
diff --git a/src/ol/renderer/dom/domtilelayerrenderer.js b/src/ol/renderer/dom/domtilelayerrenderer.js
index 4fa5f7c3b9..89b7861f70 100644
--- a/src/ol/renderer/dom/domtilelayerrenderer.js
+++ b/src/ol/renderer/dom/domtilelayerrenderer.js
@@ -192,7 +192,7 @@ ol.renderer.dom.TileLayer.prototype.prepareFrame =
tileLayerZ = this.tileLayerZs_[tileLayerZKey];
} else {
tileCoordOrigin =
- tileGrid.getTileCoordForCoordAndZInternal(center, tileLayerZKey);
+ tileGrid.getTileCoordForCoordAndZ(center, tileLayerZKey);
tileLayerZ = new ol.renderer.dom.TileLayerZ_(tileGrid, tileCoordOrigin);
newTileLayerZKeys[tileLayerZKey] = true;
this.tileLayerZs_[tileLayerZKey] = tileLayerZ;
diff --git a/src/ol/source/bingmapssource.js b/src/ol/source/bingmapssource.js
index 22af55731e..4e2da51682 100644
--- a/src/ol/source/bingmapssource.js
+++ b/src/ol/source/bingmapssource.js
@@ -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));
}
});
}));
diff --git a/src/ol/source/tilesource.js b/src/ol/source/tilesource.js
index de36b51b01..9e6527428e 100644
--- a/src/ol/source/tilesource.js
+++ b/src/ol/source/tilesource.js
@@ -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;
};
diff --git a/src/ol/source/tileutfgridsource.js b/src/ol/source/tileutfgridsource.js
index b9a2069556..b5a7b7f8bb 100644
--- a/src/ol/source/tileutfgridsource.js
+++ b/src/ol/source/tileutfgridsource.js
@@ -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()));
diff --git a/src/ol/source/tilevectorsource.js b/src/ol/source/tilevectorsource.js
index 870eb6cfae..5e33b8d8b7 100644
--- a/src/ol/source/tilevectorsource.js
+++ b/src/ol/source/tilevectorsource.js
@@ -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;
};
diff --git a/src/ol/source/tilewmssource.js b/src/ol/source/tilewmssource.js
index 1bddb17a53..b2fa897e0a 100644
--- a/src/ol/source/tilewmssource.js
+++ b/src/ol/source/tilewmssource.js
@@ -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]) {
diff --git a/src/ol/source/wmtssource.js b/src/ol/source/wmtssource.js
index 63d84d2525..e5743492bf 100644
--- a/src/ol/source/wmtssource.js
+++ b/src/ol/source/wmtssource.js
@@ -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;
diff --git a/src/ol/source/zoomifysource.js b/src/ol/source/zoomifysource.js
index b422cb9eda..4a40b00731 100644
--- a/src/ol/source/zoomifysource.js
+++ b/src/ol/source/zoomifysource.js
@@ -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] +
diff --git a/src/ol/tilecoord.js b/src/ol/tilecoord.js
index 3855ac1aec..d38bb9a9c7 100644
--- a/src/ol/tilecoord.js
+++ b/src/ol/tilecoord.js
@@ -155,7 +155,7 @@ ol.tilecoord.wrapX = function(tileCoord, tileGrid, projection) {
var worldWidth = ol.extent.getWidth(projectionExtent);
var worldsAway = Math.ceil((projectionExtent[0] - center[0]) / worldWidth);
center[0] += worldWidth * worldsAway;
- return tileGrid.getTileCoordForCoordAndZInternal(center, z);
+ return tileGrid.getTileCoordForCoordAndZ(center, z);
} else {
return tileCoord;
}
diff --git a/src/ol/tilegrid/tilegrid.js b/src/ol/tilegrid/tilegrid.js
index af2f483092..1f6feef07c 100644
--- a/src/ol/tilegrid/tilegrid.js
+++ b/src/ol/tilegrid/tilegrid.js
@@ -2,7 +2,6 @@ goog.provide('ol.tilegrid.TileGrid');
goog.require('goog.array');
goog.require('goog.asserts');
-goog.require('goog.functions');
goog.require('goog.math');
goog.require('goog.object');
goog.require('ol');
@@ -113,17 +112,6 @@ ol.tilegrid.TileGrid = function(options) {
this.extent_ = goog.isDef(extent) ? extent : null;
- /**
- * TileCoord transform function for use with this tile grid. Transforms the
- * internal tile coordinates with bottom-left origin to the tile coordinates
- * used by the source's {@link ol.TileUrlFunction}.
- * @param {ol.TileCoord} tileCoord Tile coordinate.
- * @param {ol.TileCoord=} opt_tileCoord Destination tile coordinate.
- * @return {ol.TileCoord} Tile coordinate.
- */
- this.transformTileCoord = goog.isDef(options.transformTileCoord) ?
- options.transformTileCoord : goog.functions.identity;
-
/**
* @private
* @type {Array.}
@@ -134,13 +122,11 @@ ol.tilegrid.TileGrid = function(options) {
goog.asserts.assert(options.sizes.length == this.resolutions_.length,
'number of sizes and resolutions must be equal');
this.fullTileRanges_ = goog.array.map(options.sizes, function(size, z) {
- goog.asserts.assert(size[0] > 0, 'width must be > 0');
+ goog.asserts.assert(size[0] !== 0, 'width must not be 0');
goog.asserts.assert(size[1] !== 0, 'height must not be 0');
- var tileRange = new ol.TileRange(0, size[0] - 1, 0, size[1] - 1);
- if (tileRange.maxY < tileRange.minY) {
- tileRange.minY = size[1];
- tileRange.maxY = -1;
- }
+ var tileRange = new ol.TileRange(
+ Math.min(0, size[0]), Math.max(size[0] - 1, -1),
+ Math.min(0, size[1]), Math.max(size[1] - 1, -1));
if (this.minZoom <= z && z <= this.maxZoom && goog.isDef(extent)) {
goog.asserts.assert(tileRange.containsTileRange(
this.getTileRangeForExtentAndZ(extent, z)),
@@ -380,29 +366,7 @@ ol.tilegrid.TileGrid.prototype.getTileCoordExtent =
* @return {ol.TileCoord} Tile coordinate.
* @api
*/
-ol.tilegrid.TileGrid.prototype.getTileCoordForCoordAndResolution = function(
- coordinate, resolution, opt_tileCoord) {
- var tileCoord = this.getTileCoordForCoordAndResolutionInternal(
- coordinate, resolution, opt_tileCoord);
- this.transformTileCoord(tileCoord, tileCoord);
- return tileCoord;
-};
-
-
-/**
- * Get the tile coordinate for the given map coordinate and resolution. This
- * method considers that coordinates that intersect tile boundaries should be
- * assigned the higher tile coordinate.
- *
- * The returned tile coordinate is the internal, untransformed one with
- * bottom-left origin.
- *
- * @param {ol.Coordinate} coordinate Coordinate.
- * @param {number} resolution Resolution.
- * @param {ol.TileCoord=} opt_tileCoord Destination ol.TileCoord object.
- * @return {ol.TileCoord} Internal, untransformed tile coordinate.
- */
-ol.tilegrid.TileGrid.prototype.getTileCoordForCoordAndResolutionInternal =
+ol.tilegrid.TileGrid.prototype.getTileCoordForCoordAndResolution =
function(coordinate, resolution, opt_tileCoord) {
return this.getTileCoordForXYAndResolution_(
coordinate[0], coordinate[1], resolution, false, opt_tileCoord);
@@ -453,24 +417,7 @@ ol.tilegrid.TileGrid.prototype.getTileCoordForXYAndResolution_ = function(
* @return {ol.TileCoord} Tile coordinate.
* @api
*/
-ol.tilegrid.TileGrid.prototype.getTileCoordForCoordAndZ = function(
- coordinate, z, opt_tileCoord) {
- var tileCoord = this.getTileCoordForCoordAndZInternal(
- coordinate, z, opt_tileCoord);
- this.transformTileCoord(tileCoord, tileCoord);
- return tileCoord;
-};
-
-
-/**
- * Get a tile coordinate given a map coordinate and zoom level. The returned
- * tile coordinate is the internal one, untransformed with bottom-left origin.
- * @param {ol.Coordinate} coordinate Coordinate.
- * @param {number} z Zoom level.
- * @param {ol.TileCoord=} opt_tileCoord Destination ol.TileCoord object.
- * @return {ol.TileCoord} Internal, untransformed tile coordinate.
- */
-ol.tilegrid.TileGrid.prototype.getTileCoordForCoordAndZInternal =
+ol.tilegrid.TileGrid.prototype.getTileCoordForCoordAndZ =
function(coordinate, z, opt_tileCoord) {
var resolution = this.getResolution(z);
return this.getTileCoordForXYAndResolution_(
@@ -616,8 +563,6 @@ ol.tilegrid.createXYZ = function(opt_options) {
options.extent, options.maxZoom, options.tileSize);
delete options.maxZoom;
- options.transformTileCoord = ol.tilegrid.originTopLeftTileCoordTransform;
-
return new ol.tilegrid.TileGrid(options);
};
@@ -686,23 +631,3 @@ ol.tilegrid.extentFromProjection = function(projection) {
}
return extent;
};
-
-
-/**
- * @param {ol.TileCoord} tileCoord Tile coordinate.
- * @param {ol.TileCoord=} opt_tileCoord Destination tile coordinate.
- * @return {ol.TileCoord} Tile coordinate.
- * @this {ol.tilegrid.TileGrid}
- */
-ol.tilegrid.originTopLeftTileCoordTransform =
- function(tileCoord, opt_tileCoord) {
- if (goog.isNull(tileCoord)) {
- return null;
- }
- var z = tileCoord[0];
- var fullTileRange = this.getFullTileRange(z);
- var height = (goog.isNull(fullTileRange) || fullTileRange.minY < 0) ?
- 0 : fullTileRange.getHeight();
- return ol.tilecoord.createOrUpdate(
- z, tileCoord[1], height - tileCoord[2] - 1, opt_tileCoord);
-};
diff --git a/src/ol/tilegrid/wmtstilegrid.js b/src/ol/tilegrid/wmtstilegrid.js
index 5bd37371f1..74838aa2e9 100644
--- a/src/ol/tilegrid/wmtstilegrid.js
+++ b/src/ol/tilegrid/wmtstilegrid.js
@@ -38,8 +38,7 @@ ol.tilegrid.WMTS = function(options) {
resolutions: options.resolutions,
tileSize: options.tileSize,
tileSizes: options.tileSizes,
- sizes: options.sizes,
- transformTileCoord: ol.tilegrid.originTopLeftTileCoordTransform
+ sizes: options.sizes
});
};
diff --git a/src/ol/tilegrid/zoomifytilegrid.js b/src/ol/tilegrid/zoomifytilegrid.js
deleted file mode 100644
index 7023be6d3e..0000000000
--- a/src/ol/tilegrid/zoomifytilegrid.js
+++ /dev/null
@@ -1,72 +0,0 @@
-goog.provide('ol.tilegrid.Zoomify');
-
-goog.require('goog.math');
-goog.require('ol.TileCoord');
-goog.require('ol.tilecoord');
-goog.require('ol.tilegrid.TileGrid');
-
-
-
-/**
- * @classdesc
- * Set the grid pattern for sources accessing Zoomify tiled-image servers.
- *
- * @constructor
- * @extends {ol.tilegrid.TileGrid}
- * @param {olx.tilegrid.ZoomifyOptions=} opt_options Options.
- * @api
- */
-ol.tilegrid.Zoomify = function(opt_options) {
- var options = goog.isDef(opt_options) ? opt_options : options;
-
- /** @type {Array.} */
- var tileRangeByZ = goog.isDef(options.extent) ? [] : null;
-
- /**
- * @param {ol.TileCoord} tileCoord Tile coordinate.
- * @param {ol.TileCoord=} opt_tileCoord Destination tile coordinate.
- * @return {ol.TileCoord} Tile coordinate.
- */
- function transformTileCoord(tileCoord, opt_tileCoord) {
- var z = tileCoord[0];
- if (z < minZ || maxZ < z) {
- return null;
- }
- var n = Math.pow(2, z);
- var x = tileCoord[1];
- if (x < 0 || n <= x) {
- return null;
- }
- var y = tileCoord[2];
- if (y < -n || -1 < y) {
- return null;
- }
- if (!goog.isNull(tileRangeByZ)) {
- if (!tileRangeByZ[z].containsXY(x, -y - 1)) {
- return null;
- }
- }
- return ol.tilecoord.createOrUpdate(z, x, -y - 1, opt_tileCoord);
- }
-
- goog.base(this, {
- origin: [0, 0],
- resolutions: options.resolutions,
- transformTileCoord: transformTileCoord
- });
-
- if (goog.isDef(options.extent)) {
- var minZ = this.minZoom;
- var maxZ = this.maxZoom;
- tileRangeByZ = [];
- var z;
- for (z = 0; z <= maxZ; ++z) {
- if (z < minZ) {
- tileRangeByZ[z] = null;
- } else {
- tileRangeByZ[z] = this.getTileRangeForExtentAndZ(options.extent, z);
- }
- }
- }
-};
-goog.inherits(ol.tilegrid.Zoomify, ol.tilegrid.TileGrid);
diff --git a/src/ol/tileurlfunction.js b/src/ol/tileurlfunction.js
index b42dffca5a..cf70c2bf78 100644
--- a/src/ol/tileurlfunction.js
+++ b/src/ol/tileurlfunction.js
@@ -54,9 +54,12 @@ ol.TileUrlFunction.createFromTemplate = function(template) {
} else {
return template.replace(zRegEx, tileCoord[0].toString())
.replace(xRegEx, tileCoord[1].toString())
- .replace(yRegEx, tileCoord[2].toString())
+ .replace(yRegEx, function() {
+ var y = -tileCoord[2] - 1;
+ return y.toString();
+ })
.replace(dashYRegEx, function() {
- var y = (1 << tileCoord[0]) - tileCoord[2] - 1;
+ var y = (1 << tileCoord[0]) + tileCoord[2];
return y.toString();
});
}
diff --git a/test/spec/ol/source/tilevectorsource.test.js b/test/spec/ol/source/tilevectorsource.test.js
index 87a34db4de..9e6b297438 100644
--- a/test/spec/ol/source/tilevectorsource.test.js
+++ b/test/spec/ol/source/tilevectorsource.test.js
@@ -20,10 +20,10 @@ describe('ol.source.TileVector', function() {
var projection = ol.proj.get('EPSG:3857');
source.loadFeatures(
[-8238854, 4969777, -8237854, 4970777], 4.8, projection);
- expect(tileCoords[0]).to.eql([15, 9647, 12320]);
- expect(tileCoords[1]).to.eql([15, 9647, 12319]);
- expect(tileCoords[2]).to.eql([15, 9648, 12320]);
- expect(tileCoords[3]).to.eql([15, 9648, 12319]);
+ expect(tileCoords[0]).to.eql([15, 9647, -12321]);
+ expect(tileCoords[1]).to.eql([15, 9647, -12320]);
+ expect(tileCoords[2]).to.eql([15, 9648, -12321]);
+ expect(tileCoords[3]).to.eql([15, 9648, -12320]);
});
});
@@ -41,16 +41,16 @@ describe('ol.source.TileVector', function() {
var projection = ol.proj.get('EPSG:3857');
var tileCoord = tileSource.getTileCoordForTileUrlFunction(
- [6, -31, 41], projection);
- expect(tileCoord).to.eql([6, 33, 22]);
+ [6, -31, -23], projection);
+ expect(tileCoord).to.eql([6, 33, -23]);
tileCoord = tileSource.getTileCoordForTileUrlFunction(
- [6, 33, 41], projection);
- expect(tileCoord).to.eql([6, 33, 22]);
+ [6, 33, -23], projection);
+ expect(tileCoord).to.eql([6, 33, -23]);
tileCoord = tileSource.getTileCoordForTileUrlFunction(
- [6, 97, 41], projection);
- expect(tileCoord).to.eql([6, 33, 22]);
+ [6, 97, -23], projection);
+ expect(tileCoord).to.eql([6, 33, -23]);
});
it('returns the expected tile coordinate - {wrapX: false}', function() {
@@ -64,15 +64,15 @@ describe('ol.source.TileVector', function() {
var projection = ol.proj.get('EPSG:3857');
var tileCoord = tileSource.getTileCoordForTileUrlFunction(
- [6, -31, 41], projection);
+ [6, -31, -23], projection);
expect(tileCoord).to.eql(null);
tileCoord = tileSource.getTileCoordForTileUrlFunction(
- [6, 33, 41], projection);
- expect(tileCoord).to.eql([6, 33, 22]);
+ [6, 33, -23], projection);
+ expect(tileCoord).to.eql([6, 33, -23]);
tileCoord = tileSource.getTileCoordForTileUrlFunction(
- [6, 97, 41], projection);
+ [6, 97, -23], projection);
expect(tileCoord).to.eql(null);
});
});
diff --git a/test/spec/ol/source/xyzsource.test.js b/test/spec/ol/source/xyzsource.test.js
index e9f8c0fe82..79d5715b30 100644
--- a/test/spec/ol/source/xyzsource.test.js
+++ b/test/spec/ol/source/xyzsource.test.js
@@ -67,17 +67,17 @@ describe('ol.source.XYZ', function() {
var projection = xyzTileSource.getProjection();
var tileUrl = xyzTileSource.tileUrlFunction(
xyzTileSource.getTileCoordForTileUrlFunction(
- [6, -31, 41], projection));
+ [6, -31, -23], projection));
expect(tileUrl).to.eql('6/33/22');
tileUrl = xyzTileSource.tileUrlFunction(
xyzTileSource.getTileCoordForTileUrlFunction(
- [6, 33, 41], projection));
+ [6, 33, -23], projection));
expect(tileUrl).to.eql('6/33/22');
tileUrl = xyzTileSource.tileUrlFunction(
xyzTileSource.getTileCoordForTileUrlFunction(
- [6, 97, 41], projection));
+ [6, 97, -23], projection));
expect(tileUrl).to.eql('6/33/22');
});
@@ -89,17 +89,17 @@ describe('ol.source.XYZ', function() {
var projection = xyzTileSource.getProjection();
var tileUrl = xyzTileSource.tileUrlFunction(
xyzTileSource.getTileCoordForTileUrlFunction(
- [6, 33, 150], projection));
+ [6, 33, 0], projection));
expect(tileUrl).to.be(undefined);
tileUrl = xyzTileSource.tileUrlFunction(
xyzTileSource.getTileCoordForTileUrlFunction(
- [6, 33, 41], projection));
+ [6, 33, -23], projection));
expect(tileUrl).to.eql('6/33/22');
tileUrl = xyzTileSource.tileUrlFunction(
xyzTileSource.getTileCoordForTileUrlFunction(
- [6, 33, -23], projection));
+ [6, 33, -65], projection));
expect(tileUrl).to.be(undefined);
});
diff --git a/test/spec/ol/tilegrid/tilegrid.test.js b/test/spec/ol/tilegrid/tilegrid.test.js
index 6b2fe81990..9b2a4bc409 100644
--- a/test/spec/ol/tilegrid/tilegrid.test.js
+++ b/test/spec/ol/tilegrid/tilegrid.test.js
@@ -370,78 +370,6 @@ describe('ol.tilegrid.TileGrid', function() {
});
- describe('createOriginTopLeftTileCoordTransform', function() {
-
- it('transforms y to -y-1 for top-left origins', function() {
- var tileGrid = new ol.tilegrid.TileGrid({
- origin: [10, 40],
- sizes: [[2, -2], [4, -4]],
- resolutions: [1, 0.5],
- tileSize: 10
- });
- var transformFn = goog.bind(
- ol.tilegrid.originTopLeftTileCoordTransform, tileGrid);
- expect(transformFn([0, 0, -2])).to.eql([0, 0, 1]);
- expect(transformFn([0, 0, -1])).to.eql([0, 0, 0]);
- expect(transformFn([1, 0, -4])).to.eql([1, 0, 3]);
- expect(transformFn([1, 0, -1])).to.eql([1, 0, 0]);
- });
-
- it('transforms y to -y-1 when origin corner is not specified', function() {
- var tileGrid1 = new ol.tilegrid.TileGrid({
- origin: [10, 20],
- resolutions: [1, 0.5],
- tileSize: 10
- });
- var tileGrid = new ol.tilegrid.TileGrid({
- origin: [10, 40],
- resolutions: [1, 0.5],
- tileSize: 10
- });
- var transformFn1 = goog.bind(
- ol.tilegrid.originTopLeftTileCoordTransform, tileGrid);
- var transformFn2 = goog.bind(
- ol.tilegrid.originTopLeftTileCoordTransform, tileGrid1);
- expect(transformFn1([0, 0, -2])).to.eql([0, 0, 1]);
- expect(transformFn2([0, 0, -2])).to.eql([0, 0, 1]);
- expect(transformFn1([0, 0, -1])).to.eql([0, 0, 0]);
- expect(transformFn2([0, 0, -1])).to.eql([0, 0, 0]);
- expect(transformFn1([1, 0, -4])).to.eql([1, 0, 3]);
- expect(transformFn2([1, 0, -4])).to.eql([1, 0, 3]);
- expect(transformFn1([1, 0, -1])).to.eql([1, 0, 0]);
- expect(transformFn2([1, 0, -1])).to.eql([1, 0, 0]);
- });
-
- it('transforms y to height-y-1 for bottom-left origins', function() {
- var tileGrid1 = new ol.tilegrid.TileGrid({
- extent: [10, 20, 30, 40],
- resolutions: [1, 0.5],
- tileSize: 10
- });
- var tileGrid2 = new ol.tilegrid.TileGrid({
- origin: [10, 20],
- sizes: [[2, 2], [4, 4]],
- resolutions: [1, 0.5],
- tileSize: 10
- });
- var transformFn1 = goog.bind(
- ol.tilegrid.originTopLeftTileCoordTransform, tileGrid1);
- var transformFn2 = goog.bind(
- ol.tilegrid.originTopLeftTileCoordTransform, tileGrid2);
- expect(tileGrid1.getFullTileRange(0).getHeight()).to.equal(2);
- expect(transformFn1([0, 0, 0])).to.eql([0, 0, 1]);
- expect(transformFn2([0, 0, 0])).to.eql([0, 0, 1]);
- expect(transformFn1([0, 0, 1])).to.eql([0, 0, 0]);
- expect(transformFn2([0, 0, 1])).to.eql([0, 0, 0]);
- expect(tileGrid1.getFullTileRange(1).getHeight()).to.equal(4);
- expect(transformFn1([1, 0, 0])).to.eql([1, 0, 3]);
- expect(transformFn2([1, 0, 0])).to.eql([1, 0, 3]);
- expect(transformFn1([1, 0, 3])).to.eql([1, 0, 0]);
- expect(transformFn2([1, 0, 3])).to.eql([1, 0, 0]);
- });
-
- });
-
describe('createXYZ()', function() {
it('uses defaults', function() {
diff --git a/test/spec/ol/tilegrid/zoomifytilegrid.test.js b/test/spec/ol/tilegrid/zoomifytilegrid.test.js
deleted file mode 100644
index 4e3dace1c4..0000000000
--- a/test/spec/ol/tilegrid/zoomifytilegrid.test.js
+++ /dev/null
@@ -1,21 +0,0 @@
-goog.provide('ol.test.tilegrid.Zoomify');
-
-describe('ol.tilegrid.Zoomify', function() {
-
- describe('constructor', function() {
-
- it('can be constructed with minimal arguments', function() {
- var instance = new ol.tilegrid.Zoomify({
- resolutions: [],
- extent: [],
- origin: [],
- tileSize: []
- });
- expect(instance).to.be.an(ol.tilegrid.Zoomify);
- });
-
- });
-
-});
-
-goog.require('ol.tilegrid.Zoomify');
diff --git a/test/spec/ol/tileurlfunction.test.js b/test/spec/ol/tileurlfunction.test.js
index ef0d71e37d..37b3516fee 100644
--- a/test/spec/ol/tileurlfunction.test.js
+++ b/test/spec/ol/tileurlfunction.test.js
@@ -30,16 +30,16 @@ describe('ol.TileUrlFunction', function() {
describe('createFromTemplate', function() {
it('creates expected URL', function() {
var tileUrl = ol.TileUrlFunction.createFromTemplate('{z}/{x}/{y}');
- expect(tileUrl([3, 2, 1])).to.eql('3/2/1');
+ expect(tileUrl([3, 2, -2])).to.eql('3/2/1');
expect(tileUrl(null)).to.be(undefined);
});
it('accepts {-y} placeholder', function() {
var tileUrl = ol.TileUrlFunction.createFromTemplate('{z}/{x}/{-y}');
- expect(tileUrl([3, 2, 2])).to.eql('3/2/5');
+ expect(tileUrl([3, 2, -3])).to.eql('3/2/5');
});
it('replaces multiple placeholder occurrences', function() {
var tileUrl = ol.TileUrlFunction.createFromTemplate('{z}/{z}{x}{y}');
- expect(tileUrl([3, 2, 1])).to.eql('3/321');
+ expect(tileUrl([3, 2, -2])).to.eql('3/321');
});
});
@@ -51,7 +51,7 @@ describe('ol.TileUrlFunction', function() {
'http://tile-3/{z}/{x}/{y}'
];
var tileUrlFunction = ol.TileUrlFunction.createFromTemplates(templates);
- var tileCoord = [3, 2, 1];
+ var tileCoord = [3, 2, -2];
sinon.stub(ol.tilecoord, 'hash', function() { return 3; });
expect(tileUrlFunction(tileCoord)).to.eql('http://tile-1/3/2/1');