From 74448434c96353e5398d41768bd1fbd47bde82e3 Mon Sep 17 00:00:00 2001 From: Martin Raifer Date: Tue, 14 May 2013 12:52:15 +0200 Subject: [PATCH] Improve display of objects on data browser maps Previously, tagged nodes of ways were shown on the browse/way and browse/relation pages. Now, nodes are not shown on browse/way pages and only nodes which are direct members of the relation are shown on browse/relation pages. --- app/assets/javascripts/map.js.erb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/map.js.erb b/app/assets/javascripts/map.js.erb index 8591e260a..ba331f313 100644 --- a/app/assets/javascripts/map.js.erb +++ b/app/assets/javascripts/map.js.erb @@ -142,7 +142,7 @@ function addObjectToMap(object, zoom, callback) { url: OSM.apiUrl(object), dataType: "xml", success: function (xml) { - objectLayer = new L.OSM.DataLayer(xml, { + objectLayer = new L.OSM.DataLayer(null, { style: { strokeColor: "blue", strokeWidth: 3, @@ -153,6 +153,20 @@ function addObjectToMap(object, zoom, callback) { } }); + 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; + } + }; + + objectLayer.addData(xml); + var bounds = objectLayer.getBounds(); if (zoom) { -- 2.39.5