removing the restrictedMinZoom property, and allow for restricting zoom levels with maxResolution and numZoomLevels. Thanks tschaub for the doc, test and examples improvements. r=tschaub (see #3338)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@12106 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2011-06-18 19:25:46 +00:00
parent 6248cdc94d
commit a9d3b8b72e
8 changed files with 98 additions and 105 deletions
+5 -33
View File
@@ -338,31 +338,24 @@
*/
function test_Map_isValidZoomLevel(t) {
t.plan(6);
t.plan(4);
var map = new OpenLayers.Map("map");
map.addLayer(new OpenLayers.Layer(null, {
isBaseLayer: true, numZoomLevels: 19
}))
var valid;
valid = OpenLayers.Map.prototype.isValidZoomLevel.apply(map, [-1]);
t.eq(valid, false, "-1 is not a valid zoomLevel");
valid = OpenLayers.Map.prototype.isValidZoomLevel.apply(map, [0]);
t.eq(valid, true, "0 is a valid zoomLevel when baseLayer has no restrictedMinZoom");
t.eq(valid, true, "0 is a valid zoomLevel");
valid = OpenLayers.Map.prototype.isValidZoomLevel.apply(map, [18]);
t.eq(valid, true, "18 is a valid zoomLevel");
valid = OpenLayers.Map.prototype.isValidZoomLevel.apply(map, [19]);
t.eq(valid, false, "19 is not a valid zoomLevel");
map.baseLayer.restrictedMinZoom = 1;
valid = OpenLayers.Map.prototype.isValidZoomLevel.apply(map, [0]);
t.eq(valid, false, "0 is not a valid zoomLevel when baseLayer has restrictedMinZoom of 1");
valid = OpenLayers.Map.prototype.isValidZoomLevel.apply(map, [1]);
t.eq(valid, true, "1 is a valid zoomLevel");
valid = OpenLayers.Map.prototype.isValidZoomLevel.apply(map, [19]);
t.eq(valid, false, "19 is not a valid zoomLevel when baseLayer has restrictedMinZoom of 1");
map.destroy();
}
@@ -1296,27 +1289,6 @@
var maxExtent = OpenLayers.Map.prototype.getMaxExtent.apply(map, [options]);
t.ok(maxExtent == map.baseLayer.maxExtent, "null options, valid baseLayer returns map.baseLayer.maxExtent");
}
function test_Map_getRestrictedMinZoom(t){
t.plan(3);
var map = {};
//no baseLayer
var minZoom = OpenLayers.Map.prototype.getRestrictedMinZoom.apply(map);
t.eq(minZoom, null, "no baseLayer returns null");
map.baseLayer = new OpenLayers.Layer(null, {isBaseLayer: true});
//baseLayer
minZoom = OpenLayers.Map.prototype.getRestrictedMinZoom.apply(map);
t.eq(minZoom, 0, "default baseLayer.restrictedMinZoom returns 0");
//custom minZoomLevel on baseLayer
map.baseLayer.restrictedMinZoom = 1;
minZoom = OpenLayers.Map.prototype.getRestrictedMinZoom.apply(map);
t.eq(minZoom, map.baseLayer.restrictedMinZoom, "custom baseLayer.restrictedMinZoom returns map.baseLayer.restrictedMinZoom");
}
function test_Map_zoomToMaxExtent(t){
t.plan(4)