[OpenLayers-Users] Mutually exclusive layers
Derek Watling
derek at cmainfo.co.za
Tue Feb 3 04:50:43 EST 2009
I have come up with the following solution which is working great:
<script type="text/javascript">
var map, streetNumbers, erfNumbers;
...
function init() {
...
map = new OpenLayers.Map(...);
...
streetNumbers = new OpenLayers.Layer.WMS("Street Numbers", ...);
...
streetNumbers.events.register('visibilitychanged', this, layerChanged);
map.addLayer(streetNumbers);
erfNumbers = new OpenLayers.Layer.WMS("Erf Numbers", ...);
...
erfNumbers.events.register('visibilitychanged', this, layerChanged);
map.addLayer(erfNumbers);
...
}
function layerChanged(layer) {
if (layer.object.visibility) {
switch (layer.object.name) {
case "Street Numbers":
erfNumbers.setVisibility(false);
break;
case "Erf Numbers":
streetNumbers.setVisibility(false);
break;
}
}
}
...
</script>
--
View this message in context: http://n2.nabble.com/Mutually-exclusive-layers-tp2257921p2262472.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list