Changeset 2280
- Timestamp:
- 02/23/07 06:35:22 (2 years ago)
- Files:
-
- sandbox/emanuel/animatedZooming/lib/OpenLayers/Control/OverviewMap.js (modified) (4 diffs)
- sandbox/emanuel/animatedZooming/lib/OpenLayers/Layer.js (modified) (1 diff)
- sandbox/emanuel/animatedZooming/lib/OpenLayers/Layer/Grid.js (modified) (2 diffs)
- sandbox/emanuel/animatedZooming/lib/OpenLayers/Util.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/emanuel/animatedZooming/lib/OpenLayers/Control/OverviewMap.js
r2275 r2280 118 118 this.div.appendChild(this.element); 119 119 120 this.map.events.register('moveend', this, this.update); 120 // update overviewmap during map is panning 121 this.map.events.register('move', this, this.update); 121 122 122 // Set up events. The image div recenters the map on click.123 // Set up events. The image div recenters the map on doubleclick. 123 124 // The extent rectangle can be dragged to recenter the map. 124 125 // If the mousedown happened elsewhere, then mousemove and mouseup … … 142 143 OpenLayers.Event.stop(e); 143 144 }); 144 this.rectEvents.register('dblclick', this, this.rectDblClick );145 145 this.mapDivEvents = new OpenLayers.Events(this, this.mapDiv); 146 this.mapDivEvents.register(' click', this, this.mapDivClick);146 this.mapDivEvents.register('dblclick', this, this.mapDivDblClick ); 147 147 148 148 // Optionally add min/max buttons if the control will go in the … … 282 282 }, 283 283 284 284 285 /** 285 286 * @param {OpenLayers.Event} evt 286 287 */ 287 rectDblClick: function(evt) { 288 this.performedRectDrag = false; 289 OpenLayers.Event.stop(evt); 290 this.updateOverview(); 291 }, 292 293 /** 294 * @param {OpenLayers.Event} evt 295 */ 296 mapDivClick: function(evt) { 288 mapDivDblClick: function(evt) { 297 289 var pxBounds = this.getRectPxBounds(); 298 290 var pxCenter = pxBounds.getCenterPixel(); … … 360 352 } 361 353 362 if(!this.isSuitableOverview()) { 363 this.updateOverview(); 364 } 365 366 // update extent rectangle 367 this.updateRectToMap(); 368 }, 369 370 /** 371 * Determines if the overview map is suitable given the extent and 372 * resolution of the main map. 373 */ 374 isSuitableOverview: function() { 375 var mapExtent = this.map.getExtent(); 376 var maxExtent = this.map.maxExtent; 377 var testExtent = new OpenLayers.Bounds( 378 Math.max(mapExtent.left, maxExtent.left), 379 Math.max(mapExtent.bottom, maxExtent.bottom), 380 Math.min(mapExtent.right, maxExtent.right), 381 Math.min(mapExtent.top, maxExtent.top)); 382 var resRatio = this.ovmap.getResolution() / this.map.getResolution(); 383 return ((resRatio > this.minRatio) && 384 (resRatio <= this.maxRatio) && 385 (this.ovmap.getExtent().containsBounds(testExtent))); 386 }, 387 354 this.updateOverview(); 355 }, 356 388 357 /* 389 358 * Updates the overview map. If the map is scaling (by zooming) the parameters sandbox/emanuel/animatedZooming/lib/OpenLayers/Layer.js
r2275 r2280 704 704 705 705 /** 706 * Sets visibility after zoomend/loadend:706 * Sets visibility of map after zoomend/loadend: 707 707 * - freezed/cloned layerContainer invisible 708 708 * - zoomOutTile invisibile 709 * 709 710 * Calls automatically after fire loadend event. 710 711 */ 711 712 setLoadendVisibility: function() { 712 // set cloned layerDiv invisibile -> original div is visible 713 if (this.map.layerContainerDivClone){ 714 this.map.layerContainerDivClone.style.display= "none"; 715 } 716 717 // set zoomOutTile invisible 718 if (this.map.baseLayer.zoomOutTile){ 719 this.map.baseLayer.zoomOutTile.imgDiv.style.display = "none"; 713 // function for map only; not for overviewmap! 714 if (this.map.div.id == "map") { 715 // set cloned layerDiv invisibile -> original div is visible 716 if (this.map.layerContainerDivClone){ 717 this.map.layerContainerDivClone.style.display= "none"; 718 } 719 720 // set zoomOutTile invisible 721 if (this.map.baseLayer.zoomOutTile){ 722 this.map.baseLayer.zoomOutTile.imgDiv.style.display = "none"; 723 } 720 724 } 721 725 }, sandbox/emanuel/animatedZooming/lib/OpenLayers/Layer/Grid.js
r2275 r2280 173 173 */ 174 174 _initTiles:function() { 175 175 if (this.map.div.id.match("overviewMap")) 176 this.buffer = 1; 177 176 178 // work out mininum number of rows and columns; this is the number of 177 179 // tiles required to cover the viewport plus one for panning … … 360 362 var tile = this[0]; 361 363 var layer = this[1]; 362 363 // default assumption: every images in extent are loaded 364 var stillLoading = false; 365 366 // set internal alt message after image loaded 367 if (tile.imgDiv) 368 tile.imgDiv.alt = "loaded"; 369 370 // check if all visible tiles are loaded 371 for (var j=0; j < layer.tileQueue.length; j++) { 372 if (layer.tileQueue[j].imgDiv){ 373 if((layer.tileQueue[j].bounds.intersectsBounds( 374 layer.map.getExtent(),false)) 375 && (layer.tileQueue[j].imgDiv.alt != "loaded")){ 376 // at least one image tile is still loading 377 stillLoading = true; 364 if (layer.map.div.id == "map") { 365 // default assumption: every images in extent are loaded 366 var stillLoading = false; 367 368 // set internal alt message after image loaded 369 if (tile.imgDiv) 370 tile.imgDiv.alt = "loaded"; 371 372 // check if all visible tiles are loaded 373 for (var j=0; j < layer.tileQueue.length; j++) { 374 if (layer.tileQueue[j].imgDiv){ 375 if((layer.tileQueue[j].bounds.intersectsBounds( 376 layer.map.getExtent(),false)) 377 && (layer.tileQueue[j].imgDiv.alt != "loaded")){ 378 // at least one image tile is still loading 379 stillLoading = true; 380 } 378 381 } 379 382 } 380 } 381 382 // any visible images loaded? -> fire loadend event383 if ((!stillLoading) && (!layer.map.baseLayer.doneLoading)) {384 layer.map.baseLayer.doneLoading = true;385 layer.events.triggerEvent("loadend");383 384 // any visible images loaded? -> fire loadend event 385 if ((!stillLoading) && (!layer.map.baseLayer.doneLoading)) { 386 layer.map.baseLayer.doneLoading = true; 387 layer.events.triggerEvent("loadend"); 388 } 386 389 } 387 390 } sandbox/emanuel/animatedZooming/lib/OpenLayers/Util.js
r2275 r2280 230 230 // this code that turns its display on). 231 231 // 232 if (!this.viewRequestID || 233 (this.viewRequestID == this.map.viewRequestID)) { 232 var request; 233 if (!this.viewRequestID) 234 request = true; 235 236 if (this.map) { 237 if (this.viewRequestID == this.map.viewRequestID) 238 request = true; 239 } 240 241 if (request) { 234 242 this.style.backgroundColor = null; 235 243 this.style.display = "";
