Merge pull request #587 from ahocevar/587

Layer.WMS: BBOX precision errors in URLs. r=@bartvde
This commit is contained in:
ahocevar
2012-10-12 08:53:23 -07:00
8 changed files with 167 additions and 183 deletions
+24
View File
@@ -533,6 +533,30 @@
map.destroy();
}
function test_tileBounds(t) {
// do not defer moveGriddedTiles
var isNative = OpenLayers.Animation.isNative;
OpenLayers.Animation.isNative = true;
t.plan(3);
var map = new OpenLayers.Map("map", {projection: "EPSG:3857"});
var layer = new OpenLayers.Layer.WMS("wms", "../../img/blank.gif");
map.addLayer(layer);
map.setCenter([0, 0], 1);
map.pan(2, -100);
map.zoomIn();
t.eq(layer.grid[1][0].bounds, new OpenLayers.Bounds(-10018754.17, 0, 0, 10018754.17), "no floating point errors after zooming");
map.setCenter([0, 0], 14);
var bounds = layer.grid[0][0].bounds.clone();
map.pan(260, 520);
map.pan(-260, -520);
t.eq(layer.grid[0][0].bounds, bounds, "no floating point errors after dragging back and forth");
t.eq(bounds.right, 0, "0 is 0, and not some super small number");
map.destroy();
OpenLayers.Animation.isNative = isNative;
}
</script>
+3 -3
View File
@@ -154,9 +154,9 @@
var m = new OpenLayers.Map('map', {adjustZoom: function(z) {return z;}});
m.addLayer(layer);
m.zoomToMaxExtent();
t.eq(layer.grid[5][7].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=0&l=-256&s=221471921.25", "grid[5][7] kamap is okay");
t.eq(layer.grid[5][6].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=0&l=0&s=221471921.25", "grid[5][6] kamap is okay");
t.eq(layer.grid[5][5].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=0&l=-256&s=221471921.25", "grid[5][5] is okay");
t.eq(layer.grid[4][7].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=0&l=-256&s=221471921.25", "grid[5][7] kamap is okay");
t.eq(layer.grid[4][6].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=0&l=0&s=221471921.25", "grid[5][6] kamap is okay");
t.eq(layer.grid[4][5].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=0&l=-256&s=221471921.25", "grid[5][5] is okay");
t.ok(layer.grid[7][6].url == null, "no latitudinal wrapping - tile not loaded if outside maxExtent");
m.destroy();
}