Changeset 2231
- Timestamp:
- 02/16/07 15:24:56 (2 years ago)
- Files:
-
- trunk/openlayers/lib/OpenLayers/Map.js (modified) (3 diffs)
- trunk/openlayers/lib/OpenLayers/Tile/Image.js (modified) (3 diffs)
- trunk/openlayers/lib/OpenLayers/Util.js (modified) (1 diff)
- trunk/openlayers/tests/grid_inittiles.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/lib/OpenLayers/Map.js
r2167 r2231 77 77 /** @type int */ 78 78 zoom: 0, 79 80 /** Used to store a unique identifier that changes when the map view 81 * changes. viewRequestID should be used when adding data asynchronously 82 * to the map: viewRequestID is incremented when you initiate your 83 * request (right now during changing of baselayers and changing of zooms). 84 * It is stored here in the map and also in the data that will be coming 85 * back asynchronously. Before displaying this data on request completion, 86 * we check that the viewRequestID of the data is still the same as that 87 * of the map. Fix for #480 88 * 89 * @type String */ 90 viewRequestID: 0, 79 91 80 92 // Options … … 449 461 // set new baselayer and make it visible 450 462 this.baseLayer = newBaseLayer; 463 464 // Increment viewRequestID since the baseLayer is 465 // changing. This is used by tiles to check if they should 466 // draw themselves. 467 this.viewRequestID++; 451 468 this.baseLayer.setVisibility(true, noEvent); 452 469 … … 744 761 this.popups[i].updatePosition(); 745 762 } 763 764 // zoom level has changed, increment viewRequestID. 765 this.viewRequestID++; 746 766 } 747 767 trunk/openlayers/lib/OpenLayers/Tile/Image.js
r2163 r2231 35 35 if ((this.imgDiv != null) && (this.imgDiv.parentNode == this.layer.div)) { 36 36 this.layer.div.removeChild(this.imgDiv); 37 this.imgDiv.map = null; 37 38 } 38 39 this.imgDiv = null; … … 53 54 this.initImgDiv(); 54 55 } 56 57 this.imgDiv.viewRequestID = this.layer.map.viewRequestID; 55 58 56 59 this.url = this.layer.getURL(this.bounds); … … 133 136 this.layer.opacity); 134 137 } 138 139 // we need this reference to check back the viewRequestID 140 this.imgDiv.map = this.layer.map; 141 135 142 }, 136 143 trunk/openlayers/lib/OpenLayers/Util.js
r2229 r2231 218 218 219 219 OpenLayers.Util.onImageLoad = function() { 220 this.style.backgroundColor = null; 221 this.style.display = ""; 220 // The complex check here is to solve issues described in #480. 221 // Every time a map view changes, it increments the 'viewRequestID' 222 // property. As the requests for the images for the new map view are sent 223 // out, they are tagged with this unique viewRequestID. 224 // 225 // If an image has no viewRequestID property set, we display it regardless, 226 // but if it does have a viewRequestID property, we check that it matches 227 // the viewRequestID set on the map. 228 // 229 // If the viewRequestID on the map has changed, that means that the user 230 // has changed the map view since this specific request was sent out, and 231 // therefore this tile does not need to be displayed (so we do not execute 232 // this code that turns its display on). 233 // 234 if (!this.viewRequestID || 235 (this.viewRequestID == this.map.viewRequestID)) { 236 this.style.backgroundColor = null; 237 this.style.display = ""; 238 } 222 239 }; 223 240 trunk/openlayers/tests/grid_inittiles.html
r2206 r2231 12 12 <!-- 13 13 function init(){ 14 map = new OpenLayers.Map('map', {'maxResolution': 1.40625/2, tileSize: new OpenLayers.Size(256,256)});14 var map = new OpenLayers.Map('map', {'maxResolution': 1.40625/2, tileSize: new OpenLayers.Size(256,256)}); 15 15 ww = new OpenLayers.Layer.WMS( "Basic", 16 16 "http://labs.metacarta.com/wms-c/Basic.py?",
