OpenLayers OpenLayers

Changeset 2228

Show
Ignore:
Timestamp:
02/16/07 11:45:26 (2 years ago)
Author:
euzuro
Message:

patch for #486 -- more error prevention. thanks very much to bart for finding these :-)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Control/OverviewMap.js

    r2225 r2228  
    429429        // as the base layer for the main map.  This should be made more robust. 
    430430        if(this.map.units != 'degrees') { 
    431             if(this.map.getProjection() != this.ovmap.getProjection()) { 
     431            if(this.ovmap.getProjection() && (this.map.getProjection() != this.ovmap.getProjection())) { 
    432432                alert('The overview map only works when it is in the same projection as the main map'); 
    433433            } 
    434434        } 
    435435        var pxBounds = this.getRectBoundsFromMapBounds(this.map.getExtent()); 
    436         this.setRectPxBounds(pxBounds); 
     436        if (pxBounds) { 
     437          this.setRectPxBounds(pxBounds); 
     438        } 
    437439    }, 
    438440     
     
    490492        var leftBottomPx = this.getOverviewPxFromLonLat(leftBottomLonLat); 
    491493        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; 
    494500    }, 
    495501 
     
    541547        var res  = this.ovmap.getResolution(); 
    542548        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; 
    547556    }, 
    548557