Single tileUrlFunction in createFromTileUrlFunctions

In that case, simply return the single tileUrlFunction.
This commit is contained in:
Bruno Binet
2013-03-11 11:29:40 +01:00
parent b4cbe0609a
commit c67e67ee12
2 changed files with 3 additions and 2 deletions

View File

@@ -113,8 +113,6 @@ ol.source.WMTS = function(wmtsOptions) {
};
}
// TODO: update createFromTileUrlFunctions so that if
// tileUrlFunctions.length == 1, it returns the only tileUrlFunction
var tileUrlFunction = ol.TileUrlFunction.createFromTileUrlFunctions(
goog.array.map(urls, function(url) {
if (goog.isDef(kvpParams)) {

View File

@@ -60,6 +60,9 @@ ol.TileUrlFunction.createFromTemplates = function(templates) {
* @return {ol.TileUrlFunctionType} Tile URL function.
*/
ol.TileUrlFunction.createFromTileUrlFunctions = function(tileUrlFunctions) {
if (tileUrlFunctions.length === 1) {
return tileUrlFunctions[0];
}
return function(tileCoord, tileGrid, projection) {
if (goog.isNull(tileCoord)) {
return undefined;