On Tue, Dec 04, 2007 at 09:33:41PM +0000, Jon Blower wrote: > OK, attached is an HTML file that shows the problem. As you can see > from the code I'm doing the following: > > 1) Creating two overlay layers, only one of which is to be displayed > in the layer switcher > 2) Adding both overlays to the map > 3) Toggling the displayInLayerSwitcher property of each overlay layer > 4) Redrawing the layer switcher control > > Initially nothing changes as a result of (3) and (4), i.e. the layers > that are displayed in the switcher don't change. However, if you > click the overlay's checkbox in the layer switcher it seems to sort > itself out and work correctly. > > So, it seems that the layer switcher only redraws when it is clicked.
You need to change the state of the LayerSwitcher -- by turning a layer on or off using setVisibility -- before it will redraw. You can force this by doing layerswitcher_control.layerStates = []; to clear out the layerStates, which will cause it to redraw. Regards, -- Christopher Schmidt MetaCarta _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
