Add ol.TileCoord#getZXY

This commit is contained in:
Tom Payne
2013-09-18 14:21:09 +01:00
parent 9397720c8e
commit 8ea6a50f03

View File

@@ -1,6 +1,7 @@
goog.provide('ol.TileCoord');
goog.require('goog.array');
goog.require('goog.asserts');
/**
@@ -113,6 +114,23 @@ ol.TileCoord.getKeyZXY = function(z, x, y) {
};
/**
* @param {Array.<number>=} opt_result Optional array to reuse.
* @return {Array.<number>} Array of z, x, y.
*/
ol.TileCoord.prototype.getZXY = function(opt_result) {
if (goog.isDef(opt_result)) {
goog.asserts.assert(opt_result.length == 3);
opt_result[0] = this.z;
opt_result[1] = this.x;
opt_result[2] = this.y;
return opt_result;
} else {
return [this.z, this.x, this.y];
}
};
/**
* @return {number} Hash.
*/