Ticket #1291: urls.patch
| File urls.patch, 2.0 kB (added by brentp, 10 months ago) |
|---|
-
lib/OpenLayers/Tile/Image.js
old new 82 82 this.frame.removeChild(this.imgDiv); 83 83 this.imgDiv.map = null; 84 84 } 85 this.imgDiv.layer = null; 85 86 } 86 87 this.imgDiv = null; 87 88 if ((this.frame != null) && (this.frame.parentNode == this.layer.div)) { … … 119 120 } 120 121 121 122 this.imgDiv.viewRequestID = this.layer.map.viewRequestID; 123 124 // needed for changing to a different serve for onload error 125 this.imgDiv.layer = this.layer; 126 122 127 123 128 this.url = this.layer.getURL(this.bounds); 124 129 // position the frame -
lib/OpenLayers/Util.js
old new 349 349 OpenLayers.Util.onImageLoadError = function() { 350 350 this._attempts = (this._attempts) ? (this._attempts + 1) : 1; 351 351 if(this._attempts <= OpenLayers.IMAGE_RELOAD_ATTEMPTS) { 352 this.src = this.src; 352 var urls = this.layer.url; 353 if(urls instanceof Array && urls.length > 1){ 354 var src = this.src.toString(); 355 var current_url, k; 356 for (k = 0; current_url = urls[k]; k++){ 357 if(src.indexOf(current_url) != -1){ 358 break; 359 } 360 } 361 var guess = Math.floor(urls.length * Math.random()) 362 var new_url = urls[guess]; 363 k = 0; 364 while(new_url == current_url && k++ < 4){ 365 guess = Math.floor(urls.length * Math.random()) 366 new_url = urls[guess]; 367 } 368 this.src = src.replace(current_url, new_url); 369 } else { 370 this.src = this.src; 371 } 353 372 } else { 354 373 this.style.backgroundColor = OpenLayers.Util.onImageLoadErrorColor; 355 374 }
