Correctly size Layer.Grid and Layer.KaMap in rows/cols for all values of Grid.buffer.

Closes bug #928. Thanks a mil to bartvde for identifying the solution.


git-svn-id: http://svn.openlayers.org/trunk/openlayers@4317 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Schuyler Erle
2007-09-15 14:48:22 +00:00
parent 121a5553f4
commit c941651e72
4 changed files with 103 additions and 22 deletions
+36
View File
@@ -547,6 +547,41 @@
t.eq(bounds.toBBOX(), "0,-90,180,90", "get tile bounds returns correct bounds after pan");
}
function test_Layer_Grid_moveTo_buffer_calculation (t) {
t.plan(6);
var map = new OpenLayers.Map( 'map3' ); // odd map size
var layer0 = new OpenLayers.Layer.WMS( "0 buffer: OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0",
{layers: 'basic'}, {'buffer':0} );
map.addLayer(layer0);
var layer1 = new OpenLayers.Layer.WMS( "1 buffer: OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0",
{layers: 'basic'}, {'buffer':1} );
map.addLayer(layer1);
var layer2 = new OpenLayers.Layer.WMS( "2 buffer: OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0",
{layers: 'basic'}, {'buffer':2} );
map.addLayer(layer2);
map.setCenter(new OpenLayers.LonLat(0, 0), 4);
t.eq( layer0.grid.length, 3, "Grid rows with buffer:0" );
map.setBaseLayer(layer1);
t.eq( layer1.grid.length, 4, "Grid rows with buffer:1" );
map.setBaseLayer(layer2);
t.eq( layer2.grid.length, 6, "Grid rows with buffer:2" );
// zooming in on Greenland exercises the bug from pre-r4313
map.setCenter(new OpenLayers.LonLat(0, 90), 4);
t.eq( layer0.grid.length, 3, "Grid rows with buffer:0" );
map.setBaseLayer(layer1);
t.eq( layer1.grid.length, 4, "Grid rows with buffer:1" );
map.setBaseLayer(layer2);
t.eq( layer2.grid.length, 6, "Grid rows with buffer:2" );
}
function test_99_Layer_Grid_destroy (t) {
t.plan( 5 );
@@ -582,5 +617,6 @@
<body>
<div id="map" style="width:499px;height:549px;display:none"></div>
<div id="map2" style="width:500px;height:550px;display:none"></div>
<div id="map3" style="width:594px;height:464px;display:none"></div>
</body>
</html>