Add ol.source.WMTS#getUrls
This commit is contained in:
@@ -83,6 +83,17 @@ ol.source.WMTS = function(options) {
|
||||
*/
|
||||
this.style_ = options.style;
|
||||
|
||||
var urls = options.urls;
|
||||
if (!goog.isDef(urls) && goog.isDef(options.url)) {
|
||||
urls = ol.TileUrlFunction.expandUrl(options.url);
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {!Array.<string>}
|
||||
*/
|
||||
this.urls_ = goog.isDefAndNotNull(urls) ? urls : [];
|
||||
|
||||
// FIXME: should we guess this requestEncoding from options.url(s)
|
||||
// structure? that would mean KVP only if a template is not provided.
|
||||
var requestEncoding = goog.isDef(options.requestEncoding) ?
|
||||
@@ -158,15 +169,10 @@ ol.source.WMTS = function(options) {
|
||||
});
|
||||
}
|
||||
|
||||
var tileUrlFunction = ol.TileUrlFunction.nullTileUrlFunction;
|
||||
var urls = options.urls;
|
||||
if (!goog.isDef(urls) && goog.isDef(options.url)) {
|
||||
urls = ol.TileUrlFunction.expandUrl(options.url);
|
||||
}
|
||||
if (goog.isDef(urls)) {
|
||||
tileUrlFunction = ol.TileUrlFunction.createFromTileUrlFunctions(
|
||||
goog.array.map(urls, createFromWMTSTemplate));
|
||||
}
|
||||
var tileUrlFunction = this.urls_.length > 0 ?
|
||||
ol.TileUrlFunction.createFromTileUrlFunctions(
|
||||
goog.array.map(this.urls_, createFromWMTSTemplate)) :
|
||||
ol.TileUrlFunction.nullTileUrlFunction;
|
||||
|
||||
var tmpExtent = ol.extent.createEmpty();
|
||||
tileUrlFunction = ol.TileUrlFunction.withTileCoordTransform(
|
||||
@@ -272,6 +278,16 @@ 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.
|
||||
|
||||
Reference in New Issue
Block a user