X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/64f5b3f5113e5e2dcf4f44921c200c2335066779..dc931c4ac47b340c9a2a8d855fa57a290e838260:/app/assets/javascripts/map.js.erb?ds=sidebyside 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); - } - }); -}