OpenLayers OpenLayers

Changeset 106

Show
Ignore:
Timestamp:
05/17/06 13:21:11 (3 years ago)
Author:
crschmidt
Message:

Can't return an extent before center is set.

Files:

Legend:

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

    r104 r106  
    183183    */ 
    184184    getExtent: function () { 
    185         var res = this.getResolution(); 
    186         var size = this.getSize(); 
    187         var w_deg = size.w * res; 
    188         var h_deg = size.h * res; 
    189         return new OpenLayers.Bounds( 
    190             this.center.lon - w_deg / 2,  
    191             this.center.lat - h_deg / 2, 
    192             this.center.lon + w_deg / 2, 
    193             this.center.lat + h_deg / 2); 
     185        if (this.center) { 
     186            var res = this.getResolution(); 
     187            var size = this.getSize(); 
     188            var w_deg = size.w * res; 
     189            var h_deg = size.h * res; 
     190            return new OpenLayers.Bounds( 
     191                this.center.lon - w_deg / 2,  
     192                this.center.lat - h_deg / 2, 
     193                this.center.lon + w_deg / 2, 
     194                this.center.lat + h_deg / 2); 
     195        } else { 
     196            return null; 
     197        } 
    194198    }, 
    195199