No deltas for tile bounds/position calculation

Now we also do not use deltas for shiftRow and shiftColumn. Some
refactoring was done so we do not need different calculateGridLayout
methods for layers with top-left and bottom-left tile origin.

TODO: With this commit, ArcGisCache and KaMap layers are broken.
This commit is contained in:
ahocevar
2012-10-11 21:22:52 +02:00
parent d4f011d00c
commit c5bb52d93f
5 changed files with 104 additions and 159 deletions

View File

@@ -535,15 +535,27 @@
}
function test_tileBounds(t) {
t.plan(1);
// do not defer moveGriddedTiles
var isNative = OpenLayers.Animation.isNative;
OpenLayers.Animation.isNative = true;
t.plan(2);
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");
t.eq(layer.grid[1][0].bounds, new OpenLayers.Bounds(-10018754.17, 0, 0, 10018754.17), "no floating point errors after zooming");
map.zoomTo(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");
console.log(bounds.toString())
map.destroy();
OpenLayers.Animation.isNative = isNative;
}