OpenLayers OpenLayers

Changeset 7915

Show
Ignore:
Timestamp:
09/01/08 07:06:45 (3 months ago)
Author:
edgemaster
Message:

Fix bug where the maxExtent of baselayers was being transformed
Move adjustResolutions() to Vector layers

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/edgemaster/openlayers/examples/multiple-projections.html

    r7913 r7915  
    6060            ); 
    6161             
    62             map.addLayers([osmgoo, osmll]); 
     62            map.addLayers([osmll, osmgoo]); 
    6363            gml = new OpenLayers.Layer.GML("OSM", "osm/sutton_coldfield.osm", {format: OpenLayers.Format.OSM}); 
    6464            map.zoomToExtent(new OpenLayers.Bounds(-1.819072,52.549034,-1.814341,52.551582).transform(epsg4326, map.getProjectionObject())); 
  • sandbox/edgemaster/openlayers/lib/OpenLayers/Layer.js

    r7912 r7915  
    872872        this.numZoomLevels = confProps.numZoomLevels; 
    873873    }, 
    874      
    875     /** 
    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 non-raster layers that 
    880     * 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; i < props.length; i++) { 
    894             if((this.options[props[i]] === undefined) && (this[props[i]])) { 
    895                 this[props[i]] = this.map.baseLayer[props[i]]; 
    896             } 
    897         } 
    898     }, 
    899874 
    900875    /** 
  • sandbox/edgemaster/openlayers/lib/OpenLayers/Layer/Vector.js

    r7912 r7915  
    621621        return feature; 
    622622    }, 
     623 
     624    /** 
     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    }, 
    623653     
    624654    /** 
     
    640670            var feature = this.features[i]; 
    641671            feature.geometry.transform(source, dest); 
    642         } 
    643         if(this.maxExtent != null) { 
    644             this.maxExtent.transform(source, dest); 
    645672        } 
    646673        this.projection = dest; 
  • sandbox/edgemaster/openlayers/lib/OpenLayers/Map.js

    r7912 r7915  
    10461046                        // trust the projection property all the time as it is 
    10471047                        // used as a shortcut for externalProjection 
    1048                         for (var l = 0; l < this.layers.length; l++) { 
     1048                        for (var l=0, len=this.layers.length; l < len; l++) { 
    10491049                            if(this.layers[l].transform && (typeof this.layers[l].transform == 'function')) { 
    10501050                                this.layers[l].transform(oldProjection, newProjection);