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
+14 -7
View File
@@ -82,9 +82,9 @@
function test_Layer_addOptions (t) {
t.plan( 19 );
t.plan( 20 );
var map = new OpenLayers.Map("map");
var map = new OpenLayers.Map("map", {allOverlays: true});
var options = { chicken: 151, foo: "bar" };
var layer = new OpenLayers.Layer('Test Layer', options);
map.addLayer(layer);
@@ -156,6 +156,17 @@
layer.addOptions({projection: "EPSG:900913"});
t.ok(layer.projection instanceof OpenLayers.Projection,
"addOptions creates a Projection object when given a projection string");
log = null;
// adding a 2nd layer to see if it gets reinitialized properly
var layer2 = new OpenLayers.Layer(null, {
moveTo: function(bounds) {
log = bounds;
}
});
map.addLayer(layer2);
layer.addOptions({maxResolution: 0.00034332275390625}, true);
t.eq(log.toBBOX(), map.getExtent().toBBOX(), "when reinitialize is set to true, changing base layer's resolution property reinitializes all layers.");
map.removeLayer(layer);
log = 0;
@@ -556,7 +567,7 @@
function test_Layer_getZoomForResolution(t) {
t.plan(13);
t.plan(12);
var layer = new OpenLayers.Layer('Test Layer');
layer.map = {};
@@ -584,10 +595,6 @@
"(fractionalZoom) doesn't return zoom below zero");
t.eq(layer.getZoomForResolution(1).toPrecision(6), (layer.resolutions.length - 1).toPrecision(6),
"(fractionalZoom) doesn't return zoom above highest index");
layer.restrictedMinZoom = 1;
t.eq(layer.getZoomForResolution(200), 1, "zoom all the way out, but we have a restrictedMinZoom of 1");
}
function test_Layer_redraw(t) {