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

T. Vieira tvieira at xlm.pt
Sun Mar 15 18:21:28 EDT 2009


Hi,

In my case the baselayer could be switch on/off.
I switch the baselayer to have a better performance with many layers over
the map.
So, my question remains.
Is that a reasonable change in the Openlayers code?

Thanks,
T Vieira


bwoodall wrote:
> 
> 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
> 
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
> 
> 

-- 
View this message in context: http://n2.nabble.com/Deactivate-BaseLayer-%28tilecache%29%2C-but-requests-are-still-executed-tp2473163p2483205.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.




More information about the Dev mailing list