[OpenLayers-Users] unneeded tiles for switched off layers
GregM
grzemy at gmail.com
Fri Oct 5 17:19:37 EDT 2007
I have corrected it in Map.js setCenter function, with some additional lines
of checks and conditions inside 'for' loop.
It works for me, but I do not know if it is good for any case.
Code below:
>
> for (var i = 0; i < this.layers.length; i++) {
> var layer = this.layers[i];
> if (!layer.isBaseLayer) {
>
> var moveLayer;
> var inRange = layer.calculateInRange();
> if (layer.inRange != inRange) {
> // Layer property has changed. We are going
> // to call moveLayer so that the layer can be
> turned
> // off or on.
> layer.inRange = inRange;
> //do NOT download tiles if not in scale limit
> moveLayer = (layer.visibility && layer.inRange);
> //
> was ... = true;
> //switch off layer after going beyond scale limit
> if (layer.visibility && !layer.inRange)
> layer.setVisibility(false);
> this.events.triggerEvent("changelayer");
> } else {
> // If nothing has changed, then we only move the
> layer
> // if it is visible and inrange.
> moveLayer = (layer.visibility && layer.inRange);
> //switch off layer after going beyond scale limit
> if (layer.visibility && !layer.inRange)
> layer.setVisibility(false);
> }
> if (moveLayer) {
> layer.moveTo(bounds, zoomChanged, dragging);
> }
> }
> }
Greg
Does anyone have a workaround for this?
Thanks,
Linda Rawson
--
View this message in context: http://www.nabble.com/unneeded-tiles-for-switched-off-layers-tf4521653.html#a13067541
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list