[OpenLayers-Commits] r11481 - in trunk/openlayers: lib/OpenLayers/Layer tests/Layer

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Fri Feb 25 06:50:33 EST 2011


Author: crschmidt
Date: 2011-02-25 03:50:30 -0800 (Fri, 25 Feb 2011)
New Revision: 11481

Modified:
   trunk/openlayers/lib/OpenLayers/Layer/Grid.js
   trunk/openlayers/tests/Layer/ArcGIS93Rest.html
   trunk/openlayers/tests/Layer/Grid.html
   trunk/openlayers/tests/Layer/KaMap.html
   trunk/openlayers/tests/Layer/MapGuide.html
   trunk/openlayers/tests/Layer/MapServer.html
   trunk/openlayers/tests/Layer/TMS.html
   trunk/openlayers/tests/Layer/WMS.html
   trunk/openlayers/tests/Layer/WrapDateLine.html
   trunk/openlayers/tests/Layer/XYZ.html
Log:
Default the buffer to 0 instead of 2. On small maps (or fullscreen
maps on small devices) this is a huge win: instead of downloading
*42 tiles* on a 500x500 div, we now download just 12, a 3.5x savings
in downloads by default. The buffer of 2 was originally chosen when
most maps were based on slow-loading WMS laeyrs and having an area
to pan into was more important. That default no longer makes sense.

(Closes #3111) r=tschaub


Modified: trunk/openlayers/lib/OpenLayers/Layer/Grid.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Layer/Grid.js	2011-02-25 11:47:41 UTC (rev 11480)
+++ trunk/openlayers/lib/OpenLayers/Layer/Grid.js	2011-02-25 11:50:30 UTC (rev 11481)
@@ -78,8 +78,11 @@
      * {Integer} Used only when in gridded mode, this specifies the number of 
      *           extra rows and colums of tiles on each side which will
      *           surround the minimum grid tiles to cover the map.
+     *           For very slow loading layers, a larger value may increase
+     *           performance somewhat when dragging, but will increase bandwidth
+     *           use significantly. 
      */
-    buffer: 2,
+    buffer: 0,
 
     /**
      * APIProperty: numLoadingTiles

Modified: trunk/openlayers/tests/Layer/ArcGIS93Rest.html
===================================================================
--- trunk/openlayers/tests/Layer/ArcGIS93Rest.html	2011-02-25 11:47:41 UTC (rev 11480)
+++ trunk/openlayers/tests/Layer/ArcGIS93Rest.html	2011-02-25 11:50:30 UTC (rev 11481)
@@ -94,7 +94,7 @@
         var params = {layers: "show:0,2"};
         t.plan( 2 );
         var map = new OpenLayers.Map('map');
-        layer = new OpenLayers.Layer.ArcGIS93Rest(name, url, params);
+        layer = new OpenLayers.Layer.ArcGIS93Rest(name, url, params, {buffer: 2});
         map.addLayer(layer);
         map.setCenter(new OpenLayers.LonLat(0,0),5);
         t.eq( layer.grid.length, 7, "Grid rows is correct." );

Modified: trunk/openlayers/tests/Layer/Grid.html
===================================================================
--- trunk/openlayers/tests/Layer/Grid.html	2011-02-25 11:47:41 UTC (rev 11480)
+++ trunk/openlayers/tests/Layer/Grid.html	2011-02-25 11:50:30 UTC (rev 11481)
@@ -27,7 +27,7 @@
                        
         layer = new OpenLayers.Layer.Grid(name, url, params, null);
         t.ok( layer instanceof OpenLayers.Layer.Grid, "returns OpenLayers.Layer.Grid object" );
-        t.eq( layer.buffer, 2, "buffer default is 2");
+        t.eq( layer.buffer, 0, "buffer default is 0");
         t.eq( layer.ratio, 1.5, "ratio default is 1.5");
         t.eq( layer.numLoadingTiles, 0, "numLoadingTiles starts at 0");
         t.ok( layer.events.listeners["tileloaded"] != null, "'tileloaded' event added to layer's event types");
@@ -47,7 +47,7 @@
     function test_Layer_Grid_inittiles (t) {
         t.plan( 2 );
         var map = new OpenLayers.Map('map');
-        layer = new OpenLayers.Layer.WMS(name, url, params);
+        layer = new OpenLayers.Layer.WMS(name, url, params, {buffer:2});
         map.addLayer(layer);
         map.setCenter(new OpenLayers.LonLat(0,0),5);
         t.eq( layer.grid.length, 7, "Grid rows is correct." );

Modified: trunk/openlayers/tests/Layer/KaMap.html
===================================================================
--- trunk/openlayers/tests/Layer/KaMap.html	2011-02-25 11:47:41 UTC (rev 11480)
+++ trunk/openlayers/tests/Layer/KaMap.html	2011-02-25 11:50:30 UTC (rev 11481)
@@ -65,8 +65,8 @@
         layer = new OpenLayers.Layer.KaMap(name, url, params, units);
         map.addLayer(layer);
         map.setCenter(new OpenLayers.LonLat(0,0),5);
-        t.eq( layer.grid.length, 8, "KaMap rows is correct." );
-        t.eq( layer.grid[0].length, 6, "KaMap cols is correct." );
+        t.eq( layer.grid.length, 4, "KaMap rows is correct." );
+        t.eq( layer.grid[0].length, 3, "KaMap cols is correct." );
         map.destroy();
         
     }

Modified: trunk/openlayers/tests/Layer/MapGuide.html
===================================================================
--- trunk/openlayers/tests/Layer/MapGuide.html	2011-02-25 11:47:41 UTC (rev 11480)
+++ trunk/openlayers/tests/Layer/MapGuide.html	2011-02-25 11:50:30 UTC (rev 11481)
@@ -69,7 +69,7 @@
         layer = new OpenLayers.Layer.MapGuide(name, url, paramsTiled);
         map.addLayer(layer);
         map.setCenter(new OpenLayers.LonLat(0,400000),5);
-        t.eq( layer.grid.length, 6, "Grid rows is correct." );
+        t.eq( layer.grid.length, 3, "Grid rows is correct." );
         // t.eq( layer.grid[0].length, 6, "Grid cols is correct." );
         map.destroy();
     }

Modified: trunk/openlayers/tests/Layer/MapServer.html
===================================================================
--- trunk/openlayers/tests/Layer/MapServer.html	2011-02-25 11:47:41 UTC (rev 11480)
+++ trunk/openlayers/tests/Layer/MapServer.html	2011-02-25 11:50:30 UTC (rev 11481)
@@ -74,11 +74,11 @@
     function test_Layer_MapServer_inittiles (t) {
         t.plan( 2 );
         var map = new OpenLayers.Map('map');
-        layer = new OpenLayers.Layer.MapServer(name, url, params);
+        layer = new OpenLayers.Layer.MapServer(name, url, params, {buffer: 0});
         map.addLayer(layer);
         map.setCenter(new OpenLayers.LonLat(0,0),5);
-        t.eq( layer.grid.length, 7, "Grid rows is correct." );
-        t.eq( layer.grid[0].length, 6, "Grid cols is correct." );
+        t.eq( layer.grid.length, 4, "Grid rows is correct." );
+        t.eq( layer.grid[0].length, 3, "Grid cols is correct." );
         map.destroy();
         
     }
@@ -234,7 +234,7 @@
             var map = new OpenLayers.Map('map');
             var layer = new OpenLayers.Layer.Google("Google");
             map.addLayer(layer);
-            layer = new OpenLayers.Layer.MapServer(name, url, params, {isBaseLayer: false, reproject: true});
+            layer = new OpenLayers.Layer.MapServer(name, url, params, {isBaseLayer: false, reproject: true, buffer: 2});
             layer.isBaseLayer=false;
             map.addLayer(layer);
             map.setCenter(new OpenLayers.LonLat(0,0), 5);
@@ -251,7 +251,7 @@
         }
         
         var map = new OpenLayers.Map('map');
-        layer = new OpenLayers.Layer.MapServer(name, url, params);
+        layer = new OpenLayers.Layer.MapServer(name, url, params, {buffer:2});
         map.addLayer(layer);
         map.setCenter(new OpenLayers.LonLat(0,0), 5);
         var tile = layer.grid[0][0];

Modified: trunk/openlayers/tests/Layer/TMS.html
===================================================================
--- trunk/openlayers/tests/Layer/TMS.html	2011-02-25 11:47:41 UTC (rev 11480)
+++ trunk/openlayers/tests/Layer/TMS.html	2011-02-25 11:50:30 UTC (rev 11481)
@@ -134,7 +134,7 @@
         t.plan(1);
             m = new OpenLayers.Map("map", {'maxExtent':new OpenLayers.Bounds(-122.6579,37.4901,-122.0738,37.8795)});
             layer = new OpenLayers.Layer.TMS( "TMS", 
-                    "http://labs.metacarta.com/wms-c/Basic.py/", {layername: 'basic', type:'png', resolutions:[0.000634956337608418]} );
+                    "http://labs.metacarta.com/wms-c/Basic.py/", {layername: 'basic', type:'png', resolutions:[0.000634956337608418], buffer: 2} );
             m.addLayer(layer);
             m.zoomToMaxExtent();
             t.eq(layer.getURL(layer.grid[3][3].bounds), "http://labs.metacarta.com/wms-c/Basic.py/1.0.0/basic/0/1/1.png", "TMS tiles around rounded properly.");

Modified: trunk/openlayers/tests/Layer/WMS.html
===================================================================
--- trunk/openlayers/tests/Layer/WMS.html	2011-02-25 11:47:41 UTC (rev 11480)
+++ trunk/openlayers/tests/Layer/WMS.html	2011-02-25 11:50:30 UTC (rev 11481)
@@ -146,7 +146,7 @@
     function test_Layer_WMS_inittiles (t) {
         t.plan( 2 );
         var map = new OpenLayers.Map('map');
-        layer = new OpenLayers.Layer.WMS(name, url, params);
+        layer = new OpenLayers.Layer.WMS(name, url, params, {buffer:2});
         map.addLayer(layer);
         map.setCenter(new OpenLayers.LonLat(0,0),5);
         t.eq( layer.grid.length, 7, "Grid rows is correct." );
@@ -312,7 +312,7 @@
             var layer = new OpenLayers.Layer.Google("Google");
             map.addLayer(layer);
             var wmslayer = new OpenLayers.Layer.WMS(name, url, params,
-                                                    {isBaseLayer: false, reproject:true});
+                                                    {isBaseLayer: false, reproject:true, buffer: 2});
             wmslayer.isBaseLayer=false;
             map.addLayer(wmslayer);
             map.setCenter(new OpenLayers.LonLat(0,0), 5);
@@ -329,7 +329,7 @@
         }
 
         var map = new OpenLayers.Map('map');
-        layer = new OpenLayers.Layer.WMS(name, url, params);
+        layer = new OpenLayers.Layer.WMS(name, url, params, {buffer: 2});
         map.addLayer(layer);
         map.setCenter(new OpenLayers.LonLat(0,0), 5);
         var tile = layer.grid[0][0];

Modified: trunk/openlayers/tests/Layer/WrapDateLine.html
===================================================================
--- trunk/openlayers/tests/Layer/WrapDateLine.html	2011-02-25 11:47:41 UTC (rev 11480)
+++ trunk/openlayers/tests/Layer/WrapDateLine.html	2011-02-25 11:50:30 UTC (rev 11481)
@@ -130,7 +130,7 @@
         t.plan( 3 );
 
         var url = "http://octo.metacarta.com/cgi-bin/mapserv";
-        layer = new OpenLayers.Layer.WMS(name, url, params, {'wrapDateLine':true,encodeBBOX:true});
+        layer = new OpenLayers.Layer.WMS(name, url, params, {'wrapDateLine':true,encodeBBOX:true, buffer: 2});
         var m = new OpenLayers.Map('map');
         m.addLayer(layer);
         m.zoomToMaxExtent();
@@ -146,7 +146,7 @@
         var layer = new OpenLayers.Layer.KaMap( "Blue Marble NG",
              "http://www.openlayers.org/world/index.php",
              {g: "satellite", map: "world"},
-             {wrapDateLine: true} ); 
+             {wrapDateLine: true, buffer: 2} ); 
         var m = new OpenLayers.Map('map');
         m.addLayer(layer);
         m.zoomToMaxExtent();
@@ -158,13 +158,13 @@
     function test_Layer_WrapDateLine_WMS_Overlay (t) {
         t.plan( 3 );
         var url = "http://octo.metacarta.com/cgi-bin/mapserv";
-        baselayer = new OpenLayers.Layer.WMS(name, url, params, {'wrapDateLine':true});
+        baselayer = new OpenLayers.Layer.WMS(name, url, params, {'wrapDateLine':true, buffer: 2});
         var layer = new OpenLayers.Layer.WMS( "DM Solutions Demo",
             "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap",
             {layers: "bathymetry,land_fn,park,drain_fn,drainage," +
                      "prov_bound,fedlimit,rail,road,popplace",
              transparent: "true", format: "image/png"},
-            {wrapDateLine: true, reproject: false,encodeBBOX:true});
+            {wrapDateLine: true, reproject: false,encodeBBOX:true, buffer:2});
         var m = new OpenLayers.Map('map');
         m.addLayers([baselayer,layer]);
         m.zoomToMaxExtent();

Modified: trunk/openlayers/tests/Layer/XYZ.html
===================================================================
--- trunk/openlayers/tests/Layer/XYZ.html	2011-02-25 11:47:41 UTC (rev 11480)
+++ trunk/openlayers/tests/Layer/XYZ.html	2011-02-25 11:50:30 UTC (rev 11481)
@@ -126,7 +126,7 @@
         t.plan(1);
             m = new OpenLayers.Map("map", {'maxExtent':new OpenLayers.Bounds(-122.6579,37.4901,-122.0738,37.8795)});
             layer = new OpenLayers.Layer.XYZ( "XYZ", 
-                    url, {layername: 'basic', type:'png', resolutions:[0.000634956337608418]} );
+                    url, {layername: 'basic', type:'png', resolutions:[0.000634956337608418], buffer: 2} );
             m.addLayer(layer);
             m.zoomToMaxExtent()
             t.eq(layer.getURL(layer.grid[3][3].bounds), "http://labs.metacarta.com/wms-c/Basic.py/1.0.0/basic/0/1/0.png", "XYZ tiles around rounded properly.");



More information about the Commits mailing list