Change ol.TileCoord to an Array

This commit is contained in:
Éric Lemoine
2014-08-15 23:33:22 +02:00
parent 0d20b337a0
commit ba035abb1f
29 changed files with 318 additions and 323 deletions

View File

@@ -4,6 +4,7 @@ goog.provide('ol.TileUrlFunctionType');
goog.require('goog.array');
goog.require('goog.math');
goog.require('ol.TileCoord');
goog.require('ol.tilecoord');
/**
@@ -46,11 +47,11 @@ ol.TileUrlFunction.createFromTemplate = function(template) {
if (goog.isNull(tileCoord)) {
return undefined;
} else {
return template.replace(zRegEx, tileCoord.z.toString())
.replace(xRegEx, tileCoord.x.toString())
.replace(yRegEx, tileCoord.y.toString())
return template.replace(zRegEx, tileCoord[0].toString())
.replace(xRegEx, tileCoord[1].toString())
.replace(yRegEx, tileCoord[2].toString())
.replace(dashYRegEx, function() {
var y = (1 << tileCoord.z) - tileCoord.y - 1;
var y = (1 << tileCoord[0]) - tileCoord[2] - 1;
return y.toString();
});
}
@@ -87,8 +88,8 @@ ol.TileUrlFunction.createFromTileUrlFunctions = function(tileUrlFunctions) {
if (goog.isNull(tileCoord)) {
return undefined;
} else {
var index =
goog.math.modulo(tileCoord.hash(), tileUrlFunctions.length);
var h = ol.tilecoord.hash(tileCoord);
var index = goog.math.modulo(h, tileUrlFunctions.length);
return tileUrlFunctions[index](tileCoord, pixelRatio, projection);
}
});
@@ -114,7 +115,7 @@ ol.TileUrlFunction.nullTileUrlFunction =
*/
ol.TileUrlFunction.withTileCoordTransform =
function(transformFn, tileUrlFunction) {
var tmpTileCoord = new ol.TileCoord(0, 0, 0);
var tmpTileCoord = [0, 0, 0];
return (
/**
* @param {ol.TileCoord} tileCoord Tile Coordinate.