[OpenLayers-Dev] Deactivate BaseLayer (tilecache), but requests are still executed

bwoodall bwoodall at bwoodall.org
Fri Mar 13 12:13:51 EDT 2009


Howdy Tiago

On Fri, 2009-03-13 at 05:36 -0700, T. Vieira wrote:
> Hi,
> 
> Using OL2.7 - IE6.
> 
> I'm using tilecache for baselayer, and when i deactivate the checkBox from
> that layer, visibility turns off.
> But, when i do a PAN or ZOOM the request to tilecache server is still
> executed.
> 
> I don't know if my code have a bug in some place, or if is a bug from
> Openlayers.

I don't think of this as a bug in either, since the baselayer is the
foundation of your map from which you can add other items (overlays,
freatures, ...) to highlight additional information or focus the viewer
to a particular area on the baselayer and I think the baselayer was
never meant to be turned off.

> 
> I made a change to get it work correctly:

Isn't OpenSource Cool!  

> 
> **** OpenLayers/Tile/image.js ****
> 
> draw: function() {
>  +    	var drawTile = false;
>     	
>         if (this.layer != this.layer.map.baseLayer && this.layer.reproject)
> {
>             this.bounds = this.getBoundsFromBaseLayer(this.position);
>         }
>         
>  +      if (this.layer.visibility != 0)
>  -      var drawTile = OpenLayers.Tile.prototype.draw.apply(this,
> arguments);
>  +       	drawTile = OpenLayers.Tile.prototype.draw.apply(this, arguments);
> 
> When the layer visibility is 0, the drawTile variable mantains false, so the
> request isn't executed.
> 
> Can you test it some way?
> 
> Thanks,
> Tiago Vieira




More information about the Dev mailing list