X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/7ff77d9d3d7960ae993bf5ef97a66dbb10f2496e..0f9e1fa05e6e916aabd934dee47617fafa28e549:/app/assets/javascripts/map.js.erb diff --git a/app/assets/javascripts/map.js.erb b/app/assets/javascripts/map.js.erb index c97dc76c3..c06c9c8ea 100644 --- a/app/assets/javascripts/map.js.erb +++ b/app/assets/javascripts/map.js.erb @@ -71,6 +71,12 @@ function createMap(divName, options) { }); map.addLayer(markers); + map.dataLayer = new OpenLayers.Layer(I18n.t('browse.start_rjs.data_layer_name'), { + visibility: false, + displayInLayerSwitcher: false + }); + map.addLayer(map.dataLayer); + $("#" + divName).on("resized", function () { map.updateSize(); }); @@ -100,13 +106,13 @@ function addMarkerToMap(position, icon, description) { return marker; } -function addObjectToMap(url, zoom, callback) { +function addObjectToMap(object, zoom, callback) { var layer = new OpenLayers.Layer.Vector("Objects", { strategies: [ new OpenLayers.Strategy.Fixed() ], protocol: new OpenLayers.Protocol.HTTP({ - url: url, + url: OSM.apiUrl(object), format: new OpenLayers.Format.OSM() }), style: { @@ -190,7 +196,6 @@ function openMapPopup(marker, description) { function closeMapPopup() { if (popup) { map.removePopup(popup); - delete popup; } } @@ -198,10 +203,6 @@ function removeMarkerFromMap(marker){ markers.removeMarker(marker); } -function removeBoxFromMap(box){ - vectors.removeFeature(box); -} - function proj(x) { return x.clone().transform(epsg4326, map.getProjectionObject()); } @@ -218,7 +219,7 @@ function setMapCenter(center, zoom) { } function getEventPosition(event) { - return map.getLonLatFromViewPortPx(event.xy).clone().transform(map.getProjectionObject(), epsg4326); + return unproj(map.getLonLatFromViewPortPx(event.xy)); } function getMapLayers() {