OpenLayers OpenLayers

Changeset 1200

Show
Ignore:
Timestamp:
08/12/06 12:23:01 (2 years ago)
Author:
euzuro
Message:

rename setScale() to zoomToScale() and move it down a few lines in the code

Files:

Legend:

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

    r1177 r1200  
    836836  /********************************************************/ 
    837837   
     838    /** Zoom to a specific zoom level 
     839     *  
     840     * @param {int} zoom 
     841     */ 
     842    zoomTo: function(zoom) { 
     843        this.setCenter(null, zoom); 
     844    }, 
     845     
     846    /** 
     847     * @param {int} zoom 
     848     */ 
     849    zoomIn: function() { 
     850        this.zoomTo(this.getZoom() + 1); 
     851    }, 
     852     
     853    /** 
     854     * @param {int} zoom 
     855     */ 
     856    zoomOut: function() { 
     857        this.zoomTo(this.getZoom() - 1); 
     858    }, 
     859 
     860    /** Zoom to the passed in bounds, recenter 
     861     *  
     862     * @param {OpenLayers.Bounds} bounds 
     863     */ 
     864    zoomToExtent: function(bounds) { 
     865        this.setCenter(bounds.getCenterLonLat(),  
     866                       this.getZoomForExtent(bounds)); 
     867    }, 
     868 
     869    /** Wrapper to maintain defined API functionality.  
     870     *    zoomToMaxExtent() should be used from now on. 
     871     *  
     872     * @deprecated 
     873     */ 
     874    zoomToFullExtent: function() { 
     875        this.zoomToMaxExtent(); 
     876    }, 
     877 
     878    /** Zoom to the full extent and recenter. 
     879     */ 
     880    zoomToMaxExtent: function() { 
     881        this.zoomToExtent(this.getMaxExtent()); 
     882    }, 
     883 
    838884    /** zoom to a specified scale  
    839885     *  
    840886     * @param {float} scale 
    841887     */ 
    842     setScale: function(scale) { 
    843         var res = OpenLayers.Util.getResolutionFromScale(scale, this.baseLayer.units); 
     888    zoomToScale: function(scale) { 
     889        var res = OpenLayers.Util.getResolutionFromScale(scale,  
     890                                                         this.baseLayer.units); 
    844891        var size = this.getSize(); 
    845892        var w_deg = size.w * res; 
     
    848895 
    849896        var extent = new OpenLayers.Bounds(center.lon - w_deg / 2, 
    850                                        center.lat - h_deg / 2, 
    851                                        center.lon + w_deg / 2, 
    852                                        center.lat + h_deg / 2); 
     897                                           center.lat - h_deg / 2, 
     898                                           center.lon + w_deg / 2, 
     899                                           center.lat + h_deg / 2); 
    853900        this.zoomToExtent(extent); 
    854          
    855     }, 
    856      
    857     /** Zoom to a specific zoom level 
    858      *  
    859      * @param {int} zoom 
    860      */ 
    861     zoomTo: function(zoom) { 
    862         this.setCenter(null, zoom); 
    863     }, 
    864      
    865     /** 
    866      * @param {int} zoom 
    867      */ 
    868     zoomIn: function() { 
    869         this.zoomTo(this.getZoom() + 1); 
    870     }, 
    871      
    872     /** 
    873      * @param {int} zoom 
    874      */ 
    875     zoomOut: function() { 
    876         this.zoomTo(this.getZoom() - 1); 
    877     }, 
    878  
    879     /** Zoom to the passed in bounds, recenter 
    880      *  
    881      * @param {OpenLayers.Bounds} bounds 
    882      */ 
    883     zoomToExtent: function(bounds) { 
    884         this.setCenter(bounds.getCenterLonLat(),  
    885                        this.getZoomForExtent(bounds)); 
    886     }, 
    887  
    888     /** Wrapper to maintain defined API functionality.  
    889      *    zoomToMaxExtent() should be used from now on. 
    890      *  
    891      * @deprecated 
    892      */ 
    893     zoomToFullExtent: function() { 
    894         this.zoomToMaxExtent(); 
    895     }, 
    896  
    897     /** Zoom to the full extent and recenter. 
    898      */ 
    899     zoomToMaxExtent: function() { 
    900         this.zoomToExtent(this.getMaxExtent()); 
    901     }, 
    902  
     901    }, 
     902     
    903903  /********************************************************/ 
    904904  /*                                                      */