camptocamp/cgxp — pull request #87 by asaunier (2012-05-01 16:00:11+00:00)
Title: OL layer is not made visible at them loading if no MS layer is checked

I am investigating issue #78.

I have found out that in *cgxp.tree.LayerTree.loadGroup()* [1], if the loaded OpenLayers.Layer has no checked "mapserver" layers (*layer.params.LAYERS = []*), calling *layer.setVisibility()* at the end of this function will set *layer.params.LAYERS* to all "mapserver" layers => all subnodes are then checked.

It seems that this behaviour is triggered by a *visibilitychanged* event in *setVisibility* [2].

I have not been able to find out what happens when this event is triggered. But anyway it is not necessary to make an OL layer visible if no children is checked. And it seems to fix #78.

[1] https://github.com/camptocamp/cgxp/blob/master/core/src/script/CGXP/widgets/tree/LayerTree.js#L714
[2] https://github.com/openlayers/openlayers/blob/master/lib/OpenLayers/Layer.js#L743