[OpenLayers-Commits] r12422 - in sandbox/camptocamp/clientzoom: lib/OpenLayers/Layer lib/OpenLayers/Tile tests/Layer

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Thu Sep 29 10:31:24 EDT 2011


Author: erilem
Date: 2011-09-29 07:31:23 -0700 (Thu, 29 Sep 2011)
New Revision: 12422

Modified:
   sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/Grid.js
   sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/TMS.js
   sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/TileCache.js
   sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/WMTS.js
   sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/XYZ.js
   sandbox/camptocamp/clientzoom/lib/OpenLayers/Tile/BackBufferable.js
   sandbox/camptocamp/clientzoom/tests/Layer/Grid.html
Log:
function getServerSupportedResolution renamed to getServerResolution

Modified: sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/Grid.js
===================================================================
--- sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/Grid.js	2011-09-29 14:24:24 UTC (rev 12421)
+++ sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/Grid.js	2011-09-29 14:31:23 UTC (rev 12422)
@@ -261,14 +261,14 @@
                               !tilesBounds.containsBounds(bounds, true);
 
                 var resolution = this.map.getResolution();
-                var supportedResolution =
-                    this.getServerSupportedResolution(resolution);
+                var serverResolution =
+                    this.getServerResolution(resolution);
 
-                if(resolution !== supportedResolution) {
-                    bounds = this.map.calculateBounds(null, supportedResolution);
+                if(resolution !== serverResolution) {
+                    bounds = this.map.calculateBounds(null, serverResolution);
                     if(forceReTile) {
                         // stretch the layer div
-                        var scale = supportedResolution / resolution;
+                        var scale = serverResolution / resolution;
                         this.transformDiv(scale);
                     }
                 } else {
@@ -290,7 +290,7 @@
     },
 
     /**
-     * Method: getServerSupportedResolution
+     * Method: getServerResolution
      * Return the server-supported resolution that is the closest to
      *     the resolution passed as a parameter. If no resolution is
      *     passed the map resolution is used.
@@ -301,7 +301,7 @@
      * Returns:
      * {Number} The closest server supported resolution.
      */
-    getServerSupportedResolution: function(resolution) {
+    getServerResolution: function(resolution) {
         resolution = resolution || this.map.getResolution();
         if(this.serverResolutions &&
            OpenLayers.Util.indexOf(this.serverResolutions, resolution) === -1) {
@@ -329,7 +329,7 @@
      * {Number} The closest server supported zoom.
      */
     getServerSupportedZoom: function() {
-        return this.map.getZoomForResolution(this.getServerSupportedResolution());
+        return this.map.getZoomForResolution(this.getServerResolution());
     },
 
     /**
@@ -583,7 +583,7 @@
                       Math.max(1, 2 * this.buffer);
         
         var origin = this.getTileOrigin();
-        var resolution = this.getServerSupportedResolution();
+        var resolution = this.getServerResolution();
         
         var tileLayout = this.calculateGridLayout(bounds, origin, resolution);
 
@@ -858,7 +858,7 @@
         var grid = this.grid;
         var modelRow = grid[modelRowIndex];
 
-        var resolution = this.getServerSupportedResolution();
+        var resolution = this.getServerResolution();
         var deltaY = (prepend) ? -this.tileSize.h : this.tileSize.h;
         var deltaLat = resolution * -deltaY;
 
@@ -891,7 +891,7 @@
      */
     shiftColumn: function(prepend) {
         var deltaX = (prepend) ? -this.tileSize.w : this.tileSize.w;
-        var resolution = this.getServerSupportedResolution();
+        var resolution = this.getServerResolution();
         var deltaLon = resolution * deltaX;
 
         for (var i=0, len=this.grid.length; i<len; i++) {

Modified: sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/TMS.js
===================================================================
--- sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/TMS.js	2011-09-29 14:24:24 UTC (rev 12421)
+++ sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/TMS.js	2011-09-29 14:31:23 UTC (rev 12422)
@@ -171,7 +171,7 @@
      */
     getURL: function (bounds) {
         bounds = this.adjustBounds(bounds);
-        var res = this.getServerSupportedResolution();
+        var res = this.getServerResolution();
         var x = Math.round((bounds.left - this.tileOrigin.lon) / (res * this.tileSize.w));
         var y = Math.round((bounds.bottom - this.tileOrigin.lat) / (res * this.tileSize.h));
         var z = this.serverResolutions != null ?

Modified: sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/TileCache.js
===================================================================
--- sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/TileCache.js	2011-09-29 14:24:24 UTC (rev 12421)
+++ sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/TileCache.js	2011-09-29 14:31:23 UTC (rev 12422)
@@ -109,7 +109,7 @@
      *     passed-in bounds and appropriate tile size specified as parameters.
      */
     getURL: function(bounds) {
-        var res = this.getServerSupportedResolution();
+        var res = this.getServerResolution();
         var bbox = this.maxExtent;
         var size = this.tileSize;
         var tileX = Math.round((bounds.left - bbox.left) / (res * size.w));

Modified: sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/WMTS.js
===================================================================
--- sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/WMTS.js	2011-09-29 14:24:24 UTC (rev 12421)
+++ sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/WMTS.js	2011-09-29 14:31:23 UTC (rev 12422)
@@ -332,7 +332,7 @@
     getIdentifier: function() {
         return this.serverResolutions != null ?
             OpenLayers.Util.indexOf(this.serverResolutions,
-                                    this.getServerSupportedResolution()) :
+                                    this.getServerResolution()) :
             this.getServerSupportedZoom() + this.zoomOffset;
     },
     
@@ -351,7 +351,7 @@
                 var denom = 
                     OpenLayers.METERS_PER_INCH * 
                     OpenLayers.INCHES_PER_UNIT[this.units] * 
-                    this.getServerSupportedResolution() / 0.28E-3;
+                    this.getServerResolution() / 0.28E-3;
                 var diff = Number.POSITIVE_INFINITY;
                 var delta;
                 for (var i=0, ii=this.matrixIds.length; i<ii; ++i) {
@@ -383,7 +383,7 @@
      *     (respectively) of the given location within the target tile.
      */
     getTileInfo: function(loc) {
-        var res = this.getServerSupportedResolution();
+        var res = this.getServerResolution();
         
         var fx = (loc.lon - this.tileOrigin.lon) / (res * this.tileSize.w);
         var fy = (this.tileOrigin.lat - loc.lat) / (res * this.tileSize.h);

Modified: sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/XYZ.js
===================================================================
--- sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/XYZ.js	2011-09-29 14:24:24 UTC (rev 12421)
+++ sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/XYZ.js	2011-09-29 14:31:23 UTC (rev 12422)
@@ -148,7 +148,7 @@
      * {Object} - an object with x, y and z properties.
      */
     getXYZ: function(bounds) {
-        var res = this.getServerSupportedResolution();
+        var res = this.getServerResolution();
         var x = Math.round((bounds.left - this.maxExtent.left) /
             (res * this.tileSize.w));
         var y = Math.round((this.maxExtent.top - bounds.top) /

Modified: sandbox/camptocamp/clientzoom/lib/OpenLayers/Tile/BackBufferable.js
===================================================================
--- sandbox/camptocamp/clientzoom/lib/OpenLayers/Tile/BackBufferable.js	2011-09-29 14:24:24 UTC (rev 12421)
+++ sandbox/camptocamp/clientzoom/lib/OpenLayers/Tile/BackBufferable.js	2011-09-29 14:31:23 UTC (rev 12422)
@@ -102,8 +102,8 @@
         var layer = this.layer,
             map = layer.map,
             mapResolution = map.getResolution();
-        return layer.getServerSupportedResolution ?
-                   layer.getServerSupportedResolution(mapResolution) :
+        return layer.getServerResolution ?
+                   layer.getServerResolution(mapResolution) :
                    mapResolution;
     },
     

Modified: sandbox/camptocamp/clientzoom/tests/Layer/Grid.html
===================================================================
--- sandbox/camptocamp/clientzoom/tests/Layer/Grid.html	2011-09-29 14:24:24 UTC (rev 12421)
+++ sandbox/camptocamp/clientzoom/tests/Layer/Grid.html	2011-09-29 14:31:23 UTC (rev 12422)
@@ -624,32 +624,32 @@
         t.eq( layer.tileSize, null, "layer.tileSize is null after destroy" );
     }
     
-    function test_getServerSupportedResolution(t) {
+    function test_getServerResolution(t) {
 
         t.plan(4);
 
         var layer = new OpenLayers.Layer.Grid('', '', {}, {});
         var res;
 
-        res = layer.getServerSupportedResolution(1);
-        t.eq(res, 1, '[1] getServerSupportedResolution return value is correct');
+        res = layer.getServerResolution(1);
+        t.eq(res, 1, '[1] getServerResolution return value is correct');
 
         layer.serverResolutions = [2, 1];
-        res = layer.getServerSupportedResolution(1);
-        t.eq(res, 1, '[2] getServerSupportedResolution return value is correct');
+        res = layer.getServerResolution(1);
+        t.eq(res, 1, '[2] getServerResolution return value is correct');
 
         layer.serverResolutions = [2];
-        res = layer.getServerSupportedResolution(1);
-        t.eq(res, 2, '[3] getServerSupportedResolution return value is correct');
+        res = layer.getServerResolution(1);
+        t.eq(res, 2, '[3] getServerResolution return value is correct');
 
         var exc;
         layer.serverResolutions = [0.5];
         try {
-            res = layer.getServerSupportedResolution(1);
+            res = layer.getServerResolution(1);
         } catch(e) {
             exc = e;
         }
-        t.ok(exc != undefined, '[4] getServerSupportedResolution generates exception');
+        t.ok(exc != undefined, '[4] getServerResolution generates exception');
     }
 
     function test_getServerSupportedZoom(t) {



More information about the Commits mailing list