Be stricter with the type of ol.source.TileWMS#_urls
This commit is contained in:
@@ -56,9 +56,9 @@ ol.source.TileWMS = function(opt_options) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {Array.<string>|undefined}
|
* @type {!Array.<string>}
|
||||||
*/
|
*/
|
||||||
this.urls_ = urls;
|
this.urls_ = goog.isDefAndNotNull(urls) ? urls : [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -232,7 +232,7 @@ ol.source.TileWMS.prototype.getRequestUrl_ =
|
|||||||
pixelRatio, projection, params) {
|
pixelRatio, projection, params) {
|
||||||
|
|
||||||
var urls = this.urls_;
|
var urls = this.urls_;
|
||||||
if (!goog.isDef(urls) || goog.array.isEmpty(urls)) {
|
if (goog.array.isEmpty(urls)) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -283,7 +283,7 @@ ol.source.TileWMS.prototype.getRequestUrl_ =
|
|||||||
if (urls.length == 1) {
|
if (urls.length == 1) {
|
||||||
url = urls[0];
|
url = urls[0];
|
||||||
} else {
|
} else {
|
||||||
var index = goog.math.modulo(tileCoord.hash(), this.urls_.length);
|
var index = goog.math.modulo(tileCoord.hash(), urls.length);
|
||||||
url = urls[index];
|
url = urls[index];
|
||||||
}
|
}
|
||||||
return goog.uri.utils.appendParamsFromMap(url, params);
|
return goog.uri.utils.appendParamsFromMap(url, params);
|
||||||
@@ -309,7 +309,7 @@ ol.source.TileWMS.prototype.getTilePixelSize =
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the URLs used for this WMS source.
|
* Return the URLs used for this WMS source.
|
||||||
* @return {Array.<string>|undefined} URLs.
|
* @return {!Array.<string>} URLs.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.source.TileWMS.prototype.getUrls = function() {
|
ol.source.TileWMS.prototype.getUrls = function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user