Changeset 7599
- Timestamp:
- 07/30/08 02:02:36 (4 months ago)
- Files:
-
- trunk/openlayers/lib/OpenLayers/Tile/Image.js (modified) (2 diffs)
- trunk/openlayers/lib/OpenLayers/Util.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/lib/OpenLayers/Tile/Image.js
r6638 r7599 87 87 this.imgDiv.map = null; 88 88 } 89 this.imgDiv.urls = null; 89 90 } 90 91 this.imgDiv = null; … … 161 162 162 163 this.imgDiv.viewRequestID = this.layer.map.viewRequestID; 164 165 // needed for changing to a different serve for onload error 166 if (this.layer.url instanceof Array) { 167 this.imgDiv.urls = this.layer.url.slice(); 168 } 163 169 164 170 this.url = this.layer.getURL(this.bounds); trunk/openlayers/lib/OpenLayers/Util.js
r7329 r7599 364 364 OpenLayers.Util.onImageLoadError = function() { 365 365 this._attempts = (this._attempts) ? (this._attempts + 1) : 1; 366 if(this._attempts <= OpenLayers.IMAGE_RELOAD_ATTEMPTS) { 367 this.src = this.src; 366 if (this._attempts <= OpenLayers.IMAGE_RELOAD_ATTEMPTS) { 367 var urls = this.urls; 368 if (urls && urls instanceof Array && urls.length > 1){ 369 var src = this.src.toString(); 370 var current_url, k; 371 for (k = 0; current_url = urls[k]; k++){ 372 if(src.indexOf(current_url) != -1){ 373 break; 374 } 375 } 376 var guess = Math.floor(urls.length * Math.random()) 377 var new_url = urls[guess]; 378 k = 0; 379 while(new_url == current_url && k++ < 4){ 380 guess = Math.floor(urls.length * Math.random()) 381 new_url = urls[guess]; 382 } 383 this.src = src.replace(current_url, new_url); 384 } else { 385 this.src = this.src; 386 } 368 387 } else { 369 388 this.style.backgroundColor = OpenLayers.Util.onImageLoadErrorColor;
