Handle urls and templates in ol.source.UrlTile

This makes url templates available for ol.source.VectorTile.
This commit is contained in:
Andreas Hocevar
2015-10-01 19:19:37 +02:00
parent af69933c64
commit 4784b7f2e2
8 changed files with 131 additions and 178 deletions
+3 -18
View File
@@ -87,12 +87,6 @@ ol.source.WMTS = function(options) {
urls = ol.TileUrlFunction.expandUrl(options.url);
}
/**
* @private
* @type {!Array.<string>}
*/
this.urls_ = urls || [];
// FIXME: should we guess this requestEncoding from options.url(s)
// structure? that would mean KVP only if a template is not provided.
@@ -175,9 +169,9 @@ ol.source.WMTS = function(options) {
});
}
var tileUrlFunction = this.urls_.length > 0 ?
var tileUrlFunction = (urls && urls.length > 0) ?
ol.TileUrlFunction.createFromTileUrlFunctions(
this.urls_.map(createFromWMTSTemplate)) :
urls.map(createFromWMTSTemplate)) :
ol.TileUrlFunction.nullTileUrlFunction;
goog.base(this, {
@@ -191,6 +185,7 @@ ol.source.WMTS = function(options) {
tileLoadFunction: options.tileLoadFunction,
tilePixelRatio: options.tilePixelRatio,
tileUrlFunction: tileUrlFunction,
urls: urls,
wrapX: options.wrapX !== undefined ? options.wrapX : false
});
@@ -268,16 +263,6 @@ ol.source.WMTS.prototype.getStyle = function() {
};
/**
* Return the URLs used for this WMTS source.
* @return {!Array.<string>} URLs.
* @api
*/
ol.source.WMTS.prototype.getUrls = function() {
return this.urls_;
};
/**
* Return the version of the WMTS source.
* @return {string} Version.