Changeset 4795
- Timestamp:
- 10/03/07 16:42:35 (1 year ago)
- Files:
-
- branches/openlayers/2.5/lib/OpenLayers/Layer.js (modified) (2 diffs)
- branches/openlayers/2.5/lib/OpenLayers/Map.js (modified) (5 diffs)
- branches/openlayers/2.5/tests/Control/test_OverviewMap.html (modified) (2 diffs)
- branches/openlayers/2.5/tests/Layer/test_Grid.html (modified) (2 diffs)
- branches/openlayers/2.5/tests/Layer/test_KaMap.html (modified) (2 diffs)
- branches/openlayers/2.5/tests/Layer/test_TMS.html (modified) (1 diff)
- branches/openlayers/2.5/tests/Layer/test_TileCache.html (modified) (1 diff)
- branches/openlayers/2.5/tests/Layer/test_WrapDateLine.html (modified) (3 diffs)
- branches/openlayers/2.5/tests/test_Layer.html (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/openlayers/2.5/lib/OpenLayers/Layer.js
r4390 r4795 732 732 * Parameters: 733 733 * bounds - {<OpenLayers.Bounds>} 734 * closest - {Boolean} Find the zoom level that most closely fits the 735 * specified bounds. Note that this may result in a zoom that does 736 * not exactly contain the entire extent. 737 * Default is false. 734 738 * 735 739 * Returns: 736 740 * {Integer} The index of the zoomLevel (entry in the resolutions array) 737 * that still contains the passed-in extent. We do this by calculating 738 * the ideal resolution for the given exteng (based on the map size) 739 * and then find the closest resolution to this ideal resolution. 740 */ 741 getZoomForExtent: function(extent) { 741 * for the passed-in extent. We do this by calculating the ideal 742 * resolution for the given extent (based on the map size) and then 743 * calling getZoomForResolution(), passing along the 'closest' 744 * parameter. 745 */ 746 getZoomForExtent: function(extent, closest) { 742 747 var viewSize = this.map.getSize(); 743 748 var idealResolution = Math.max( extent.getWidth() / viewSize.w, 744 749 extent.getHeight() / viewSize.h ); 745 750 746 return this.getZoomForResolution(idealResolution );751 return this.getZoomForResolution(idealResolution, closest); 747 752 }, 748 753 … … 761 766 /** 762 767 * APIMethod: getZoomForResolution 763 * Get the index for the closest resolution in the layers resolutions array. 764 * 765 * Parameters: 766 * resolution - {Float} Map units per pixel. 768 * 769 * Parameters: 770 * resolution - {Float} 771 * closest - {Boolean} Find the zoom level that corresponds to the absolute 772 * closest resolution, which may result in a zoom whose corresponding 773 * resolution is actually smaller than we would have desired (if this 774 * is being called from a getZoomForExtent() call, then this means that 775 * the returned zoom index might not actually contain the entire 776 * extent specified... but it'll be close). 777 * Default is false. 767 778 * 768 779 * Returns: 769 780 * {Integer} The index of the zoomLevel (entry in the resolutions array) 770 * that is the closest to the passed-in resolution. 771 */ 772 getZoomForResolution: function(resolution) { 773 var zoom, diff; 781 * that corresponds to the best fit resolution given the passed in 782 * value and the 'closest' specification. 783 */ 784 getZoomForResolution: function(resolution, closest) { 785 var diff; 774 786 var minDiff = Number.POSITIVE_INFINITY; 775 for(var i=0; i < this.resolutions.length; i++) { 776 diff = Math.abs(this.resolutions[i] - resolution); 777 if(diff < minDiff) { 778 zoom = i; 787 for(var i=0; i < this.resolutions.length; i++) { 788 if (closest) { 789 diff = Math.abs(this.resolutions[i] - resolution); 790 if (diff > minDiff) { 791 break; 792 } 779 793 minDiff = diff; 780 } else if(diff > minDiff) { 781 break; 794 } else { 795 if (this.resolutions[i] < resolution) { 796 break; 797 } 782 798 } 783 799 } 784 return zoom;800 return Math.max(0, i-1); 785 801 }, 786 802 branches/openlayers/2.5/lib/OpenLayers/Map.js
r4390 r4795 708 708 // zoom to oldExtent *and* force zoom change 709 709 this.setCenter(oldExtent.getCenterLonLat(), 710 this.getZoomForExtent(oldExtent ),710 this.getZoomForExtent(oldExtent, true), 711 711 false, true); 712 712 } … … 1357 1357 * Parameters: 1358 1358 * bounds - {<OpenLayers.Bounds>} 1359 * closest - {Boolean} Find the zoom level that most closely fits the 1360 * specified bounds. Note that this may result in a zoom that does 1361 * not exactly contain the entire extent. 1362 * Default is false. 1359 1363 * 1360 1364 * Returns: … … 1362 1366 * If no baselayer is set, returns null. 1363 1367 */ 1364 getZoomForExtent: function (bounds ) {1368 getZoomForExtent: function (bounds, closest) { 1365 1369 var zoom = null; 1366 1370 if (this.baseLayer != null) { 1367 zoom = this.baseLayer.getZoomForExtent(bounds );1371 zoom = this.baseLayer.getZoomForExtent(bounds, closest); 1368 1372 } 1369 1373 return zoom; … … 1375 1379 * Parameter: 1376 1380 * resolution - {Float} 1381 * closest - {Boolean} Find the zoom level that corresponds to the absolute 1382 * closest resolution, which may result in a zoom whose corresponding 1383 * resolution is actually smaller than we would have desired (if this 1384 * is being called from a getZoomForExtent() call, then this means that 1385 * the returned zoom index might not actually contain the entire 1386 * extent specified... but it'll be close). 1387 * Default is false. 1377 1388 * 1378 1389 * Returns: … … 1380 1391 * If no baselayer is set, returns null. 1381 1392 */ 1382 getZoomForResolution: function(resolution ) {1393 getZoomForResolution: function(resolution, closest) { 1383 1394 var zoom = null; 1384 1395 if (this.baseLayer != null) { 1385 zoom = this.baseLayer.getZoomForResolution(resolution );1396 zoom = this.baseLayer.getZoomForResolution(resolution, closest); 1386 1397 } 1387 1398 return zoom; branches/openlayers/2.5/tests/Control/test_OverviewMap.html
r4390 r4795 44 44 t.eq(overviewCenter.lon, -71, "Overviewmap center lon correct"); 45 45 t.eq(overviewCenter.lat, 42, "Overviewmap center lat correct"); 46 t.eq(overviewZoom, 9, "Overviewmap zoomcorrect");46 t.eq(overviewZoom, 8, "Overviewmap zoomcorrect"); 47 47 48 48 control.mapDivClick({'xy':new OpenLayers.Pixel(5,5)}); 49 49 50 // There are box model issues that keep browsers from giving us51 // identical results here. Test the normalized difference against52 // a tolerance instead of testing equality.53 function normalizedDiff(a, b) {54 return Math.abs((a - b) / (a + b));55 }56 var tolerance = 1e-4;57 58 50 var cent = map.getCenter(); 59 t.ok(normalizedDiff(cent.lon, -71.00390625) < tolerance, 60 "Clicking on the Overview Map has the correct effect on map lon"); 61 t.ok(normalizedDiff(cent.lat, 42.00390625) < tolerance, 62 "Clicking on the Overview Map has the correct effect on map lat"); 51 t.eq(cent.lon, -71.3515625, "Clicking on the Overview Map has the correct effect on map lon"); 52 t.eq(cent.lat, 42.17578125, "Clicking on the Overview Map has the correct effect on map lat"); 63 53 64 54 control.rectMouseDown({'xy':new OpenLayers.Pixel(5,5), 'which':1}); … … 67 57 68 58 var cent = map.getCenter(); 69 t.ok(normalizedDiff(cent.lon, -70.83984375) < tolerance, 70 "Dragging on the Overview Map has the correct effect on map lon"); 71 t.ok(normalizedDiff(cent.lat, 41.84765625) < tolerance, 72 "Dragging on the Overview Map has the correct effect on map lat"); 59 t.eq(cent.lon, -71.2734375, "Dragging on the Overview Map has the correct effect on map lon"); 60 t.eq(cent.lat, 42.09765625, "Dragging on the Overview Map has the correct effect on map lat"); 73 61 74 62 map.setCenter(new OpenLayers.LonLat(0,0), 0); branches/openlayers/2.5/tests/Layer/test_Grid.html
r4390 r4795 151 151 zoom = layer.getZoomForExtent(bounds); 152 152 153 /** 154 * ideal resolution: 2 map units / 500px = 0.004 155 * layer.resolutions = [1.40625, 0.703125, 0.3515625, 0.17578125, 156 * 0.087890625, 0.0439453125, 0.02197265625, 157 * 0.010986328125, 0.0054931640625, 0.00274658203125, 158 * 0.001373291015625, 0.0006866455078125, 0.00034332275390625, 159 * 0.000171661376953125, 0.0000858306884765625, 0.00004291534423828125] 160 * 161 * So, we expect a zoom of 9 because it is the closest resolution. 162 */ 163 t.eq( zoom, 9, "getZoomForExtent() returns correct value"); 153 t.eq( zoom, 8, "getZoomForExtent() returns correct value"); 164 154 165 155 bounds = new OpenLayers.Bounds(10,10,100,100); 166 156 zoom = layer.getZoomForExtent(bounds); 167 157 168 /** 169 * ideal resolution: 90 map units / 500px = 0.18 170 * So, we expect a zoom of 3 because it is the closest. 171 */ 172 t.eq( zoom, 3, "getZoomForExtent() returns correct value"); 158 t.eq( zoom, 2, "getZoomForExtent() returns correct value"); 173 159 } 174 160 … … 556 542 map.zoomIn(); 557 543 var bounds = layer.getTileBounds(new OpenLayers.Pixel(200,200)); 558 t.eq(bounds.toBBOX(), "- 90,0,0,90", "get tile bounds returns correct bounds");544 t.eq(bounds.toBBOX(), "-180,-90,0,90", "get tile bounds returns correct bounds"); 559 545 map.pan(200,0); 560 546 var bounds = layer.getTileBounds(new OpenLayers.Pixel(200,200)); 561 t.eq(bounds.toBBOX(), "0, 0,90,90", "get tile bounds returns correct bounds after pan");547 t.eq(bounds.toBBOX(), "0,-90,180,90", "get tile bounds returns correct bounds after pan"); 562 548 } 563 549 branches/openlayers/2.5/tests/Layer/test_KaMap.html
r4390 r4795 129 129 zoom = layer.getZoomForExtent(bounds); 130 130 131 /** 132 * ideal resolution: 2 map units / 500px = 0.004 133 * layer.resolutions = [1.40625, 0.703125, 0.3515625, 0.17578125, 134 * 0.087890625, 0.0439453125, 0.02197265625, 135 * 0.010986328125, 0.0054931640625, 0.00274658203125, 136 * 0.001373291015625, 0.0006866455078125, 0.00034332275390625, 137 * 0.000171661376953125, 0.0000858306884765625, 0.00004291534423828125] 138 * 139 * So, we expect a zoom of 9 because it is the closest resolution. 140 */ 141 t.eq( zoom, 9, "getZoomForExtent() returns correct value"); 131 t.eq( zoom, 8, "getZoomForExtent() returns correct value"); 142 132 143 133 bounds = new OpenLayers.Bounds(10,10,100,100); 144 134 zoom = layer.getZoomForExtent(bounds); 145 135 146 /** 147 * ideal resolution: 90 map units / 500px = 0.18 148 * So, we expect a zoom of 3 because it is the closest. 149 */ 150 t.eq( zoom, 3, "getZoomForExtent() returns correct value"); 136 t.eq( zoom, 2, "getZoomForExtent() returns correct value"); 151 137 } 152 138 … … 251 237 map.zoomIn(); 252 238 var bounds = layer.getTileBounds(new OpenLayers.Pixel(200,200)); 253 t.eq(bounds.toBBOX(), "- 90,0,0,90", "get tile bounds returns correct bounds");239 t.eq(bounds.toBBOX(), "-180,0,0,180", "get tile bounds returns correct bounds"); 254 240 map.pan(200,0); 255 241 var bounds = layer.getTileBounds(new OpenLayers.Pixel(200,200)); 256 t.eq(bounds.toBBOX(), "0,0, 90,90", "get tile bounds returns correct bounds after pan");242 t.eq(bounds.toBBOX(), "0,0,180,180", "get tile bounds returns correct bounds after pan"); 257 243 } 258 244 branches/openlayers/2.5/tests/Layer/test_TMS.html
r4794 r4795 78 78 bounds = new OpenLayers.Bounds(10,10,12,12); 79 79 zoom = layer.getZoomForExtent(bounds); 80 /** 81 * ideal resolution: 2 map units / 500px = 0.004 82 * layer.resolutions = [1.40625, 0.703125, 0.3515625, 0.17578125, 83 * 0.087890625, 0.0439453125, 0.02197265625, 84 * 0.010986328125, 0.0054931640625, 0.00274658203125, 85 * 0.001373291015625, 0.0006866455078125, 0.00034332275390625, 86 * 0.000171661376953125, 0.0000858306884765625, 0.00004291534423828125] 87 * 88 * So, we expect a zoom of 9 because it is the closest resolution. 89 */ 90 91 t.eq( zoom, 9, "getZoomForExtent() returns correct value"); 80 81 t.eq( zoom, 8, "getZoomForExtent() returns correct value"); 92 82 93 83 bounds = new OpenLayers.Bounds(10,10,100,100); 94 84 zoom = layer.getZoomForExtent(bounds); 95 /** 96 * ideal resolution: 90 map units / 500px = 0.18 97 * So, we expect a zoom of 3 because it is the closest. 98 */ 99 t.eq( zoom, 3, "getZoomForExtent() returns correct value"); 85 86 t.eq( zoom, 2, "getZoomForExtent() returns correct value"); 100 87 } 101 88 branches/openlayers/2.5/tests/Layer/test_TileCache.html
r4390 r4795 79 79 bounds = new OpenLayers.Bounds(10,10,12,12); 80 80 zoom = layer.getZoomForExtent(bounds); 81 /** 82 * ideal resolution: 2 map units / 500px = 0.004 83 * layer.resolutions = [0.703125, 0.3515625, 0.17578125, 84 * 0.087890625, 0.0439453125, 0.02197265625, 85 * 0.010986328125, 0.0054931640625, 0.00274658203125, 86 * 0.001373291015625, 0.0006866455078125, 0.00034332275390625, 87 * 0.000171661376953125, 0.0000858306884765625, 0.00004291534423828125, 88 * 0.000021457672119140625] 89 * 90 * So, we expect a zoom of 8 because it is the closest resolution. 91 */ 92 t.eq( zoom, 8, "getZoomForExtent() returns correct value"); 81 82 t.eq( zoom, 7, "getZoomForExtent() returns correct value"); 93 83 94 84 bounds = new OpenLayers.Bounds(10,10,100,100); 95 85 zoom = layer.getZoomForExtent(bounds); 96 /**97 * ideal resolution: 90 map units / 500px = 0.1898 * So, we expect a zoom of 2 because it is the closest.99 */100 86 101 t.eq( zoom, 2, "getZoomForExtent() returns correct value");87 t.eq( zoom, 1, "getZoomForExtent() returns correct value"); 102 88 } 103 89 branches/openlayers/2.5/tests/Layer/test_WrapDateLine.html
r4390 r4795 132 132 m.addLayer(layer); 133 133 m.zoomToMaxExtent(); 134 t.eq(layer.grid[3][0].url, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=%2Fmapdata%2Fvmap_wms.map&LAYERS=basic&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=0%2C 0%2C90%2C90&WIDTH=256&HEIGHT=256", "cell [3][0] is wrapped around the world.");135 t.eq(layer.grid[0][0].url, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=%2Fmapdata%2Fvmap_wms.map&LAYERS=basic&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=0%2C 270%2C90%2C360&WIDTH=256&HEIGHT=256", "cell [0][0] is wrapped around the world lon, but not lat");136 t.eq(layer.grid[0][3].url, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=%2Fmapdata%2Fvmap_wms.map&LAYERS=basic&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=- 90%2C270%2C0%2C360&WIDTH=256&HEIGHT=256", "cell [3][0] is not wrapped at all.");134 t.eq(layer.grid[3][0].url, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=%2Fmapdata%2Fvmap_wms.map&LAYERS=basic&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=0%2C-90%2C180%2C90&WIDTH=256&HEIGHT=256", "cell [3][0] is wrapped around the world."); 135 t.eq(layer.grid[0][0].url, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=%2Fmapdata%2Fvmap_wms.map&LAYERS=basic&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=0%2C450%2C180%2C630&WIDTH=256&HEIGHT=256", "cell [0][0] is wrapped around the world lon, but not lat"); 136 t.eq(layer.grid[0][3].url, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=%2Fmapdata%2Fvmap_wms.map&LAYERS=basic&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=-180%2C450%2C0%2C630&WIDTH=256&HEIGHT=256", "cell [3][0] is not wrapped at all."); 137 137 138 138 } … … 147 147 m.addLayer(layer); 148 148 m.zoomToMaxExtent(); 149 t.eq(layer.grid[0][0].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=-1280&l=0&s= 110735960.625", "grid[0][0] kamap is okay");150 t.eq(layer.grid[0][3].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=-1280&l=-256&s= 110735960.625", "grid[0][3] kamap is okay");151 t.eq(layer.grid[3][0].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=-512&l=0&s= 110735960.625", "grid[3][0] is okay");149 t.eq(layer.grid[0][0].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=-1280&l=0&s=221471921.25", "grid[0][0] kamap is okay"); 150 t.eq(layer.grid[0][3].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=-1280&l=-256&s=221471921.25", "grid[0][3] kamap is okay"); 151 t.eq(layer.grid[3][0].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=-512&l=0&s=221471921.25", "grid[3][0] is okay"); 152 152 } 153 153 function test_Layer_WrapDateLine_WMS_Overlay (t) { … … 164 164 m.addLayers([baselayer,layer]); 165 165 m.zoomToMaxExtent(); 166 t.eq(layer.grid[0][0].url, "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?LAYERS=bathymetry%2Cland_fn%2Cpark%2Cdrain_fn%2Cdrainage%2Cprov_bound%2Cfedlimit%2Crail%2Croad%2Cpopplace&TRANSPARENT=true&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=0%2C 270%2C90%2C360&WIDTH=256&HEIGHT=256", "grid[0][0] wms overlay is okay");167 t.eq(layer.grid[0][3].url, "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?LAYERS=bathymetry%2Cland_fn%2Cpark%2Cdrain_fn%2Cdrainage%2Cprov_bound%2Cfedlimit%2Crail%2Croad%2Cpopplace&TRANSPARENT=true&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=- 90%2C270%2C0%2C360&WIDTH=256&HEIGHT=256", "grid[0][3] wms overlay is okay");168 t.eq(layer.grid[3][0].url, "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?LAYERS=bathymetry%2Cland_fn%2Cpark%2Cdrain_fn%2Cdrainage%2Cprov_bound%2Cfedlimit%2Crail%2Croad%2Cpopplace&TRANSPARENT=true&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=0%2C 0%2C90%2C90&WIDTH=256&HEIGHT=256", "grid[3][0] wms overlay okay");166 t.eq(layer.grid[0][0].url, "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?LAYERS=bathymetry%2Cland_fn%2Cpark%2Cdrain_fn%2Cdrainage%2Cprov_bound%2Cfedlimit%2Crail%2Croad%2Cpopplace&TRANSPARENT=true&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=0%2C450%2C180%2C630&WIDTH=256&HEIGHT=256", "grid[0][0] wms overlay is okay"); 167 t.eq(layer.grid[0][3].url, "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?LAYERS=bathymetry%2Cland_fn%2Cpark%2Cdrain_fn%2Cdrainage%2Cprov_bound%2Cfedlimit%2Crail%2Croad%2Cpopplace&TRANSPARENT=true&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=-180%2C450%2C0%2C630&WIDTH=256&HEIGHT=256", "grid[0][3] wms overlay is okay"); 168 t.eq(layer.grid[3][0].url, "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?LAYERS=bathymetry%2Cland_fn%2Cpark%2Cdrain_fn%2Cdrainage%2Cprov_bound%2Cfedlimit%2Crail%2Croad%2Cpopplace&TRANSPARENT=true&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=0%2C-90%2C180%2C90&WIDTH=256&HEIGHT=256", "grid[3][0] wms overlay okay"); 169 169 } 170 170 branches/openlayers/2.5/tests/test_Layer.html
r4390 r4795 156 156 function test_06_Layer_getZoomForResolution(t) { 157 157 158 t.plan( 6);158 t.plan(8); 159 159 160 160 var layer = new OpenLayers.Layer('Test Layer'); … … 164 164 165 165 t.eq(layer.getZoomForResolution(200), 0, "zoom all the way out"); 166 t.eq(layer.getZoomForResolution(65), 1, "index closest to 65");167 t.eq(layer.getZoomForResolution(63), 1, "index closest to 63");168 166 t.eq(layer.getZoomForResolution(25), 2, "zoom in middle"); 169 167 t.eq(layer.getZoomForResolution(3), 5, "zoom allmost all the way in"); 170 168 t.eq(layer.getZoomForResolution(1), 6, "zoom all the way in"); 169 170 t.eq(layer.getZoomForResolution(65), 0, "smallest containing res"); 171 t.eq(layer.getZoomForResolution(63), 1, "smallest containing res"); 172 173 t.eq(layer.getZoomForResolution(65, true), 1, "closest res"); 174 t.eq(layer.getZoomForResolution(63, true), 1, "closest res"); 171 175 172 176 }
