X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/c8fb5ad24c5751bd2d43b86e4359381d200af066..258e66299ac45c4dbb951dee0a92194301b31737:/app/assets/javascripts/map.js.erb diff --git a/app/assets/javascripts/map.js.erb b/app/assets/javascripts/map.js.erb index 6d26763f8..98299070d 100644 --- a/app/assets/javascripts/map.js.erb +++ b/app/assets/javascripts/map.js.erb @@ -1,5 +1,3 @@ -var objectLoader; - function getUserIcon(url) { return L.icon({ iconUrl: url || <%= asset_path('marker-red.png').to_json %>, @@ -10,41 +8,3 @@ function getUserIcon(url) { shadowSize: [41, 41] }); } - -function addObjectToMap(object, map, options) { - if (objectLoader) objectLoader.abort(); - if (map.objectLayer) map.removeLayer(map.objectLayer); - - objectLoader = $.ajax({ - url: OSM.apiUrl(object), - dataType: "xml", - success: function (xml) { - map.objectLayer = new L.OSM.DataLayer(null, { - styles: { - node: options.style, - way: options.style, - area: options.style - } - }); - - map.objectLayer.interestingNode = function (node, ways, relations) { - if (object.type === "node") { - return true; - } else if (object.type === "relation") { - for (var i = 0; i < relations.length; i++) - if (relations[i].members.indexOf(node) != -1) - return true; - } else { - return false; - } - }; - - map.objectLayer.addData(xml); - - if (options.zoom) map.fitBounds(map.objectLayer.getBounds()); - if (options.callback) options.callback(map.objectLayer.getBounds()); - - map.objectLayer.addTo(map); - } - }); -}