X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/53b0ace4c0577385af71394f03e2f4e2fb810f77..0ea9f92be50a8763331a81d3c32a5f5a157265c6:/public/javascripts/map.js diff --git a/public/javascripts/map.js b/public/javascripts/map.js index 6fcfdf120..090d4abc2 100644 --- a/public/javascripts/map.js +++ b/public/javascripts/map.js @@ -23,7 +23,8 @@ function createMap(divName, options) { new OpenLayers.Control.LayerSwitcher(), new OpenLayers.Control.Navigation(), new OpenLayers.Control.PanZoom(), - new OpenLayers.Control.PanZoomBar() + new OpenLayers.Control.PanZoomBar(), + new OpenLayers.Control.ScaleLine({geodesic: true}) ], units: "m", maxResolution: 156543.0339, @@ -244,31 +245,18 @@ function setMapLayers(layerConfig) { map.setBaseLayer(layers[i]); } } - - while (layerConfig.charAt(l) == "B" || layerConfig.charAt(l) == "0") { - l++; - } - - for (var layers = map.getLayersBy("isBaseLayer", false), i = 0; i < layers.length; i++) { - var c = layerConfig.charAt(l++); - - if (c == "T") { - layers[i].setVisibility(true); - } else if(c == "F") { - layers[i].setVisibility(false); - } - } } else { for (var i = 0; i < map.layers.length; i++) { - if (map.layers[i].layerCode && - layerConfig.indexOf(map.layers[i].layerCode) >= 0) { - if (map.layers[i].isBaseLayer) { - map.setBaseLayer(map.layers[i]); + if (map.layers[i].layerCode) { + if (layerConfig.indexOf(map.layers[i].layerCode) >= 0) { + if (map.layers[i].isBaseLayer) { + map.setBaseLayer(map.layers[i]); + } else { + map.layers[i].setVisibility(true); + } } else { - map.layers[i].setVisibility(true); + map.layers[i].setVisibility(false); } - } else { - map.layers[i].setVisibility(false); } } }