[OpenLayers-Dev] OpenLayers. Control. LayerSwitcher
Andreas Hocevar
ahocevar at opengeo.org
Thu Nov 26 02:34:24 EST 2009
Dom Lehr wrote:
> Hey Guys!
>
> I'm new to this list, but a big fan of OpenLayers! Needless to say,
> I'm to a point where I need some help: Here is my problem:
>
> I got four layers on my map; Enabling and disabling them thru the
> Control.LayerSwitcher works perfect. Tho, my layers depend on each
> other, which means I have to select certain layers, if one is
> selected. Example: If layer4 is selected, I also wanne have layer3, 2
> and 1 selected. If layer3 is selected, I wanne have 2 and 1 selected.
> Is there any way to achieve this?
>
layer4.events.on({
visibilitychanged: function() {
var vis = layer4.getVisibility();
layer3.setVisibility(vis);
}
});
layer3.events.on({
visibilitychanged: function() {
var vis = layer3.getVisibility();
layer2.setVisibility(vis);
layer1.setVisibility(vis);
}
});
Regards,
Andreas.
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
More information about the Dev
mailing list