New behavior for layer.getZoomForResolution. This method now returns the index of the resolution closest to the passed in resolution - making for fewer unwanted resolution changes, and a generally happier populace (see #990).
git-svn-id: http://svn.openlayers.org/trunk/openlayers@4381 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -150,12 +150,26 @@
|
||||
bounds = new OpenLayers.Bounds(10,10,12,12);
|
||||
zoom = layer.getZoomForExtent(bounds);
|
||||
|
||||
t.eq( zoom, 8, "getZoomForExtent() returns correct value");
|
||||
/**
|
||||
* ideal resolution: 2 map units / 500px = 0.004
|
||||
* layer.resolutions = [1.40625, 0.703125, 0.3515625, 0.17578125,
|
||||
* 0.087890625, 0.0439453125, 0.02197265625,
|
||||
* 0.010986328125, 0.0054931640625, 0.00274658203125,
|
||||
* 0.001373291015625, 0.0006866455078125, 0.00034332275390625,
|
||||
* 0.000171661376953125, 0.0000858306884765625, 0.00004291534423828125]
|
||||
*
|
||||
* So, we expect a zoom of 9 because it is the closest resolution.
|
||||
*/
|
||||
t.eq( zoom, 9, "getZoomForExtent() returns correct value");
|
||||
|
||||
bounds = new OpenLayers.Bounds(10,10,100,100);
|
||||
zoom = layer.getZoomForExtent(bounds);
|
||||
|
||||
t.eq( zoom, 2, "getZoomForExtent() returns correct value");
|
||||
/**
|
||||
* ideal resolution: 90 map units / 500px = 0.18
|
||||
* So, we expect a zoom of 3 because it is the closest.
|
||||
*/
|
||||
t.eq( zoom, 3, "getZoomForExtent() returns correct value");
|
||||
}
|
||||
|
||||
function test_07_Layer_Grid_moveTo(t) {
|
||||
@@ -541,10 +555,10 @@
|
||||
map.zoomToMaxExtent();
|
||||
map.zoomIn();
|
||||
var bounds = layer.getTileBounds(new OpenLayers.Pixel(200,200));
|
||||
t.eq(bounds.toBBOX(), "-180,-90,0,90", "get tile bounds returns correct bounds");
|
||||
t.eq(bounds.toBBOX(), "-90,0,0,90", "get tile bounds returns correct bounds");
|
||||
map.pan(200,0);
|
||||
var bounds = layer.getTileBounds(new OpenLayers.Pixel(200,200));
|
||||
t.eq(bounds.toBBOX(), "0,-90,180,90", "get tile bounds returns correct bounds after pan");
|
||||
t.eq(bounds.toBBOX(), "0,0,90,90", "get tile bounds returns correct bounds after pan");
|
||||
}
|
||||
|
||||
function test_Layer_Grid_moveTo_buffer_calculation (t) {
|
||||
|
||||
Reference in New Issue
Block a user