[OpenLayers-Dev] Hiding Layers from the Layer Switcher
Peterson Eric-EEP002
Eric.Peterson at motorola.com
Wed Jul 18 15:14:52 EDT 2007
Ah! Perfect! Thank you!
-eP
-----Original Message-----
From: dev-bounces at openlayers.org [mailto:dev-bounces at openlayers.org] On
Behalf Of Christopher Schmidt
Sent: Wednesday, July 18, 2007 1:02 PM
To: dev at openlayers.org
Subject: Re: [OpenLayers-Dev] Hiding Layers from the Layer Switcher
On Wed, Jul 18, 2007 at 12:52:53PM -0400, Peterson Eric-EEP002 wrote:
> What I would REALLY like is some way to merge both markers and vectors
> together into a single layer, so that when I select/deselect that
> layer in the Layer Switcher, both markers and vectors appear/disappear
> concurrently. But I realize that due to the architecture of OL, it
> might not be possible to do that.
In trunk, it is possible to symbolize a 'point' as an icon, so you could
essentially achieve this goal. However, you've asked about 2.4, so I'll
continue with more information on that below.
> Alternately, I could achieve the result I want if the following
> additions were made to the layer code:
>
> 1. Have a property associated with a layer that causes it to appear in
> the Layer Switcher list. This could be set as an option while
> constructing a new Layer object, and the Layer Switcher could pay
> attention to this property when generating the layer form.
displayInLayerSwitcher option on the layer:
http://dev.openlayers.org/apidocs/files/OpenLayers/Layer-js.html#OpenLay
ers.Layer.displayInLayerSwitcher
> 2. When a layer is selected or deselected in the Layer Switcher,
> trigger a "showlayer" or "hidelayer" event.
The event you are talking about is the 'changelayer' event, on the Map
object. This event fires any time a layer is changed, and you can then
loop through the layers and call:
http://dev.openlayers.org/apidocs/files/OpenLayers/Layer-js.html#OpenLay
ers.Layer.getVisibility
Regards,
--
Christopher Schmidt
MetaCarta
_______________________________________________
Dev mailing list
Dev at openlayers.org
http://openlayers.org/mailman/listinfo/dev
More information about the Dev
mailing list