More robust array type check. p=mwootendev, r=me (closes #2959)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@12095 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2011-06-16 19:16:25 +00:00
parent 54cccc0783
commit 995d612caa
43 changed files with 97 additions and 59 deletions

View File

@@ -430,7 +430,7 @@ OpenLayers.Layer.ArcGISCache = OpenLayers.Class(OpenLayers.Layer.XYZ, {
var url = this.url;
var s = '' + x + y + z;
if (url instanceof Array) {
if (OpenLayers.Util.isArray(url)) {
url = this.selectUrl(s, url);
}

View File

@@ -209,7 +209,7 @@ OpenLayers.Layer.HTTPRequest = OpenLayers.Class(OpenLayers.Layer, {
// in which case we will deterministically select one of them in
// order to evenly distribute requests to different urls.
//
if (url instanceof Array) {
if (OpenLayers.Util.isArray(url)) {
url = this.selectUrl(paramsString, url);
}

View File

@@ -117,7 +117,7 @@ OpenLayers.Layer.KaMapCache = OpenLayers.Class(OpenLayers.Layer.KaMap, {
// order to evenly distribute requests to different urls.
//
var url = this.url;
if (url instanceof Array) {
if (OpenLayers.Util.isArray(url)) {
url = this.selectUrl(paramsString, url);
}

View File

@@ -136,7 +136,7 @@ OpenLayers.Layer.MapServer = OpenLayers.Class(OpenLayers.Layer.Grid, {
// if url is not a string, it should be an array of strings,
// in which case we will deterministically select one of them in
// order to evenly distribute requests to different urls.
if (url instanceof Array) {
if (OpenLayers.Util.isArray(url)) {
url = this.selectUrl(paramsString, url);
}

View File

@@ -129,7 +129,7 @@ OpenLayers.Layer.TMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
this.map.getZoom() + this.zoomOffset;
var path = this.serviceVersion + "/" + this.layername + "/" + z + "/" + x + "/" + y + "." + this.type;
var url = this.url;
if (url instanceof Array) {
if (OpenLayers.Util.isArray(url)) {
url = this.selectUrl(path, url);
}
return url + path;

View File

@@ -138,7 +138,7 @@ OpenLayers.Layer.TileCache = OpenLayers.Class(OpenLayers.Layer.Grid, {
];
var path = components.join('/');
var url = this.url;
if (url instanceof Array) {
if (OpenLayers.Util.isArray(url)) {
url = this.selectUrl(path, url);
}
url = (url.charAt(url.length - 1) == '/') ? url : url + '/';

View File

@@ -554,7 +554,7 @@ OpenLayers.Layer.Vector = OpenLayers.Class(OpenLayers.Layer, {
* options - {Object}
*/
addFeatures: function(features, options) {
if (!(features instanceof Array)) {
if (!(OpenLayers.Util.isArray(features))) {
features = [features];
}
@@ -643,7 +643,7 @@ OpenLayers.Layer.Vector = OpenLayers.Class(OpenLayers.Layer, {
if (features === this.features) {
return this.removeAllFeatures(options);
}
if (!(features instanceof Array)) {
if (!(OpenLayers.Util.isArray(features))) {
features = [features];
}
if (features === this.selectedFeatures) {

View File

@@ -408,7 +408,7 @@ OpenLayers.Layer.WMTS = OpenLayers.Class(OpenLayers.Layer.Grid, {
path = path + this.matrixSet + "/" + this.matrix.identifier +
"/" + info.row + "/" + info.col + "." + this.formatSuffix;
if (this.url instanceof Array) {
if (OpenLayers.Util.isArray(this.url)) {
url = this.selectUrl(path, this.url);
} else {
url = this.url;

View File

@@ -120,7 +120,7 @@ OpenLayers.Layer.XYZ = OpenLayers.Class(OpenLayers.Layer.Grid, {
getURL: function (bounds) {
var xyz = this.getXYZ(bounds);
var url = this.url;
if (url instanceof Array) {
if (OpenLayers.Util.isArray(url)) {
var s = '' + xyz.x + xyz.y + xyz.z;
url = this.selectUrl(s, url);
}

View File

@@ -211,7 +211,7 @@ OpenLayers.Layer.Zoomify = OpenLayers.Class(OpenLayers.Layer.Grid, {
var path = "TileGroup" + Math.floor( (tileIndex) / 256 ) +
"/" + z + "-" + x + "-" + y + ".jpg";
var url = this.url;
if (url instanceof Array) {
if (OpenLayers.Util.isArray(url)) {
url = this.selectUrl(path, url);
}
return url + path;