add a new property to layer.js called 'visibility' which we now need to store instead of reading directly from the visiblity of the div itself, since the div might be hidden, but only because it is out of range. we thus add a new method on layer called inRange() which returns whether or not the layer's max/min resolution settings allow it to be displayed at the current map's resolution. to make sure that min/max resolution, scale, etc are set for *all* layers, we remove the if statement limiting the running of initResolution() to only baselayers, and we add code at the end of that function that, once the resolutions array has been calculated, then goes back and sets min/max scale and resolution. now what we have to do is every time moveTo() is called on a layer, if the zoom has changed, then we must check if the layer is inRange() and update the display accordingly. on that same note, the layerswitcher must now be attentive to these changes, so we set it to redraw every time the zoom changes. in the layerswitcher code, we now add special code to disable a layer if it is out of range. must add the superclass call to moveTo() for all of the layers to ensure this code is executed for all. update test.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1577 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -620,7 +620,7 @@ OpenLayers.Map.prototype = {
|
||||
var bounds = this.getExtent();
|
||||
for (var i = 0; i < this.layers.length; i++) {
|
||||
var layer = this.layers[i];
|
||||
if (layer.getVisibility()) {
|
||||
if (zoomChanged || (layer.display && layer.inRange())) {
|
||||
layer.moveTo(bounds, zoomChanged, dragging);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user