I've a problem where I need to be able to toggle a vector layer on and off.
I'd originally thought about adding and removing a vector layer, but the panel edit controls need to have the layer existing when they are constructed, and there's no method for removing controls from a panel, so I thought I'd try just hiding the vector layer, using First issue was that I didn't want the vector layer to display in the layer switcher when it was hidden, I needed to set layer.displayInLayerSwitcher = false. But if I later made the layer visible and set layer.displayInLayerSwitcher = true, the layer would still not display in the layer switcher. Tracing through the code resulted in my adding calling a changelayer event after setting layer.displayInLayerSwitcher = true, after which the layer switcher displayed the layer. But drawing didn't work. If I clicked on the polygon control, I could draw a polygon, but when I double-clicked on the last point to close it out, the scratch polygon would disappear, and the vector layer would be blank. The problem seems to be that Vector.drawn is false - it's only set to true when moveTo() has been called, and because its visibility was false, moveTo() has never been called on it. Which leads me to conclude that there's more to toggling a layer on and off than just changing its visibility flag. How should I be approaching this? _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
