Add ol.TileCoord.createOrUpdate

This commit is contained in:
Tom Payne
2013-04-09 15:20:47 +02:00
parent aa12232ec3
commit 7b58685462

View File

@@ -83,6 +83,25 @@ ol.TileCoord.createFromString = function(str) {
};
/**
* @param {number} z Z.
* @param {number} x X.
* @param {number} y Y.
* @param {ol.TileCoord|undefined} tileCoord Tile coordinate.
* @return {ol.TileCoord} Tile coordinate.
*/
ol.TileCoord.createOrUpdate = function(z, x, y, tileCoord) {
if (goog.isDef(tileCoord)) {
tileCoord.z = z;
tileCoord.x = x;
tileCoord.y = y;
return tileCoord;
} else {
return new ol.TileCoord(z, x, y);
}
};
/**
* @param {number} z Z.
* @param {number} x X.