OpenLayers OpenLayers

Changeset 7917

Show
Ignore:
Timestamp:
09/01/08 09:12:22 (3 months ago)
Author:
edgemaster
Message:

Move adjustResolutions back to Layer, required by both Markers and Vectors

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/edgemaster/openlayers/lib/OpenLayers/Layer.js

    r7915 r7917  
    874874 
    875875    /** 
     876     * Method: adjustResolutions 
     877     * Attempts to adjust resolution options to that of a new base layer if 
     878     * originally copied from a base layer or the map object. 
     879     * This method is intended to be only used with marker and vector layers 
     880     * that need to adapt when the base layer changes. 
     881     */ 
     882    adjustResolutions: function(layer) { 
     883        var props = new Array( 
     884        'projection', 'units', 
     885        'scales', 'resolutions', 
     886        'maxScale', 'minScale',  
     887        'maxResolution', 'minResolution', 
     888        'minExtent', 'maxExtent', 
     889        'numZoomLevels', 'maxZoomLevel' 
     890        ); 
     891         
     892        // This is probably ugly - we clobber derived properties 
     893        for(var i=0, len=props.length; i < len; i++) { 
     894            if((this.options[props[i]] === undefined) && (this[props[i]])) { 
     895                var blProp = this.map.baseLayer[props[i]]; 
     896                if(blProp.clone && (typeof blProp.clone == 'function')) { 
     897                    this[props[i]] = blProp.clone(); 
     898                } else { 
     899                    this[props[i]] = blProp; 
     900                } 
     901            } 
     902        } 
     903    }, 
     904 
     905    /** 
    876906     * APIMethod: getResolution 
    877907     *  
  • sandbox/edgemaster/openlayers/lib/OpenLayers/Layer/Vector.js

    r7915 r7917  
    623623 
    624624    /** 
    625      * Method: adjustResolutions 
    626      * Attempts to adjust resolution options to that of a new base layer if 
    627      * originally copied from a base layer or the map object. 
    628      * This method is intended to be only used with non-raster layers that 
    629      * need to adapt when the base layer changes. 
    630      */ 
    631     adjustResolutions: function(layer) { 
    632         var props = new Array( 
    633             'projection', 'units', 
    634             'scales', 'resolutions', 
    635             'maxScale', 'minScale',  
    636             'maxResolution', 'minResolution', 
    637             'minExtent', 'maxExtent', 
    638             'numZoomLevels', 'maxZoomLevel' 
    639         ); 
    640          
    641         // This is probably ugly - we clobber derived properties 
    642         for(var i=0, len=props.length; i < len; i++) { 
    643             if((this.options[props[i]] === undefined) && (this[props[i]])) { 
    644                 var blProp = this.map.baseLayer[props[i]]; 
    645                 if(blProp.clone && (typeof blProp.clone == 'function')) { 
    646                     this[props[i]] = blProp.clone(); 
    647                 } else { 
    648                     this[props[i]] = blProp; 
    649                 } 
    650             } 
    651         } 
    652     }, 
    653      
    654     /** 
    655625     * APIMethod: transform 
    656626     * Transform the Vector layer from source to dest projection.