Improve type checking in ol.source.WMTS
This commit is contained in:
+26
-21
@@ -73,27 +73,32 @@ ol.source.WMTS = function(options) {
|
|||||||
* @return {ol.TileUrlFunctionType} Tile URL function.
|
* @return {ol.TileUrlFunctionType} Tile URL function.
|
||||||
*/
|
*/
|
||||||
function createFromWMTSTemplate(template) {
|
function createFromWMTSTemplate(template) {
|
||||||
return function(tileCoord) {
|
return (
|
||||||
if (goog.isNull(tileCoord)) {
|
/**
|
||||||
return undefined;
|
* @param {ol.TileCoord} tileCoord Tile coordinate.
|
||||||
} else {
|
* @return {string|undefined} Tile URL.
|
||||||
var localContext = {
|
*/
|
||||||
'TileMatrix': tileGrid.getMatrixId(tileCoord.z),
|
function(tileCoord) {
|
||||||
'TileCol': tileCoord.x,
|
if (goog.isNull(tileCoord)) {
|
||||||
'TileRow': tileCoord.y
|
return undefined;
|
||||||
};
|
} else {
|
||||||
if (requestEncoding != ol.source.WMTSRequestEncoding.KVP) {
|
var localContext = {
|
||||||
goog.object.extend(localContext, context);
|
'TileMatrix': tileGrid.getMatrixId(tileCoord.z),
|
||||||
}
|
'TileCol': tileCoord.x,
|
||||||
var url = template;
|
'TileRow': tileCoord.y
|
||||||
for (var key in localContext) {
|
};
|
||||||
// FIXME: should we filter properties with hasOwnProperty?
|
if (requestEncoding != ol.source.WMTSRequestEncoding.KVP) {
|
||||||
url = url.replace('{' + key + '}', localContext[key])
|
goog.object.extend(localContext, context);
|
||||||
.replace('%7B' + key + '%7D', localContext[key]);
|
}
|
||||||
}
|
var url = template;
|
||||||
return url;
|
for (var key in localContext) {
|
||||||
}
|
// FIXME: should we filter properties with hasOwnProperty?
|
||||||
};
|
url = url.replace('{' + key + '}', localContext[key])
|
||||||
|
.replace('%7B' + key + '%7D', localContext[key]);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var tileUrlFunction = ol.TileUrlFunction.nullTileUrlFunction;
|
var tileUrlFunction = ol.TileUrlFunction.nullTileUrlFunction;
|
||||||
|
|||||||
Reference in New Issue
Block a user