Don't change the visibility of layers with no code

When parsing a layer state ignore any layers with no code
attached rather than turning them off - this ensures that
the marker layer remains enabled and any markers can be
displayed.
This commit is contained in:
Tom Hughes 2010-07-21 09:07:38 +01:00
parent 53b0ace4c0
commit ad116b2431

View file

@ -260,15 +260,16 @@ function setMapLayers(layerConfig) {
} }
} else { } else {
for (var i = 0; i < map.layers.length; i++) { for (var i = 0; i < map.layers.length; i++) {
if (map.layers[i].layerCode && if (map.layers[i].layerCode) {
layerConfig.indexOf(map.layers[i].layerCode) >= 0) { if (layerConfig.indexOf(map.layers[i].layerCode) >= 0) {
if (map.layers[i].isBaseLayer) { if (map.layers[i].isBaseLayer) {
map.setBaseLayer(map.layers[i]); map.setBaseLayer(map.layers[i]);
} else {
map.layers[i].setVisibility(true);
}
} else { } else {
map.layers[i].setVisibility(true); map.layers[i].setVisibility(false);
} }
} else {
map.layers[i].setVisibility(false);
} }
} }
} }