Add ol.TileCoord.createOrUpdate
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user