[OpenLayers-Users] layer.maxResolution and LayerSwitcher

Tim Schaub tschaub at openplans.org
Mon Mar 3 18:20:45 EST 2008


Hey-

Jeff Dege wrote:
> Where would be the best place for me to hook some code so as to make the
> layer not show up in the LayerSwitcher, when it's not being drawn?

The best thing to do would be to modify the LayerSwitcher code so that 
it creates a block element for each layer entry and then set the class 
name (depending on layer.inRange) of the element instead of changing the 
style of the span that contains the layer name (around line 301).  This 
would let users decide whether they wanted a gray label or no entry at all.

If you do this, please create a ticket and submit a patch.

Tim

> 
> Is there an event I could catch, on scale changes, so I could check
> Layer.inRange, and set Layer. displayInLayerSwitcher?  Would zoomend
> work?  Or does it fire too late?
> 
> -----Original Message-----
> From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org]
> On Behalf Of Christopher Schmidt
> Sent: Monday, March 03, 2008 5:06 PM
> To: users at openlayers.org
> Subject: Re: [OpenLayers-Users] layer.maxResolution and LayerSwitcher
> 
> On Mon, Mar 03, 2008 at 05:02:53PM -0600, Jeff Dege wrote:
>> I have a layer I'm turning off at certain zoomlevels, by setting
>> maxResolution and/or minResolution.
>>
>> At zoomlelelels where it's not being drawn, it still shows up in the
>> layerSwitcher, with no title and a disabled checkbox.
>>
>> Is this intended behavior?
>  
> Yep.
> 
> Regards,




More information about the Users mailing list