Changeset 2228
- Timestamp:
- 02/16/07 11:45:26 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/lib/OpenLayers/Control/OverviewMap.js
r2225 r2228 429 429 // as the base layer for the main map. This should be made more robust. 430 430 if(this.map.units != 'degrees') { 431 if(this. map.getProjection() != this.ovmap.getProjection()) {431 if(this.ovmap.getProjection() && (this.map.getProjection() != this.ovmap.getProjection())) { 432 432 alert('The overview map only works when it is in the same projection as the main map'); 433 433 } 434 434 } 435 435 var pxBounds = this.getRectBoundsFromMapBounds(this.map.getExtent()); 436 this.setRectPxBounds(pxBounds); 436 if (pxBounds) { 437 this.setRectPxBounds(pxBounds); 438 } 437 439 }, 438 440 … … 490 492 var leftBottomPx = this.getOverviewPxFromLonLat(leftBottomLonLat); 491 493 var rightTopPx = this.getOverviewPxFromLonLat(rightTopLonLat); 492 return new OpenLayers.Bounds(leftBottomPx.x, leftBottomPx.y, 493 rightTopPx.x, rightTopPx.y); 494 var bounds = null; 495 if (leftBottomPx && rightTopPx) { 496 bounds = new OpenLayers.Bounds(leftBottomPx.x, leftBottomPx.y, 497 rightTopPx.x, rightTopPx.y); 498 } 499 return bounds; 494 500 }, 495 501 … … 541 547 var res = this.ovmap.getResolution(); 542 548 var extent = this.ovmap.getExtent(); 543 return new OpenLayers.Pixel( 544 Math.round(1/res * (lonlat.lon - extent.left)), 545 Math.round(1/res * (extent.top - lonlat.lat)) 546 ); 549 var px = null; 550 if (extent) { 551 px = new OpenLayers.Pixel( 552 Math.round(1/res * (lonlat.lon - extent.left)), 553 Math.round(1/res * (extent.top - lonlat.lat))); 554 } 555 return px; 547 556 }, 548 557
