For the record. Calling
layer.setVisible(layerVisible);
in the loop
and
layerHandler.setLayers(layerHandler.getLayers());
after the loop makes it work
/carsten
On 02/29/2012 03:03 PM, "Carsten Ø. Madsen" wrote:
> Hello
>
> I have a problem with controlling the visibility of layers.
>
> If I use layerHandler.turnLayerOn the layers renders correctly on the
> map but the bulbs in the OM LayersPanel does not render correctly. If
> I use layer.setVisible the bulbs renders correct but the layers that
> should be visible do not render anything?
>
> String tmp = config.getVisibleLayers();
> String[] visibleLayers = tmp != null ? tmp.split(" ")
> : new String[] {};
>
> for (Layer layer : layerHandler.getLayers()) {
> boolean layerVisible = false;
> for (String visibleLayerName : visibleLayers) {
> String prettyName = Environment.get(visibleLayerName
> + ".prettyName");
> if (layer.getName().equals(prettyName)) {
> layerVisible = true;
> break;
> }
> }
> layer.setVisible(layerVisible); // bulbs ok but
> nothing in layer
> // layerHandler.turnLayerOn(layerVisible, layer);
> bulbs wrong, layers ok
> }
>
> BR
> Carsten
>
> --
> [To unsubscribe to this list send an email to "majdart_at_bbn.com"
> with the following text in the BODY of the message "unsubscribe
> openmap-users"]
>
--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Thu Mar 01 2012 - 07:30:01 EST