From 0e788717c52c2d458bda7a31005bef284b036b58 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Fri, 17 Mar 2017 14:40:55 -0400 Subject: [PATCH] Do not warn if path is connected to entrance (closes #3906) --- data/core.yaml | 2 +- dist/locales/en.json | 2 +- modules/validations/disconnected_highway.js | 16 ++++++++++------ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/data/core.yaml b/data/core.yaml index c27eff637..bba2ed267 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -468,7 +468,7 @@ en: used_with: "used with {type}" validations: disconnected_highway: Disconnected highway - disconnected_highway_tooltip: "Roads should be connected to other roads." + disconnected_highway_tooltip: "Roads should be connected to other roads or building entrances." untagged_point: Untagged point untagged_line: Untagged line untagged_area: Untagged area diff --git a/dist/locales/en.json b/dist/locales/en.json index 55ac472ab..0802e9e10 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -578,7 +578,7 @@ }, "validations": { "disconnected_highway": "Disconnected highway", - "disconnected_highway_tooltip": "Roads should be connected to other roads.", + "disconnected_highway_tooltip": "Roads should be connected to other roads or building entrances.", "untagged_point": "Untagged point", "untagged_line": "Untagged line", "untagged_area": "Untagged area", diff --git a/modules/validations/disconnected_highway.js b/modules/validations/disconnected_highway.js index c556e4e49..97da88593 100644 --- a/modules/validations/disconnected_highway.js +++ b/modules/validations/disconnected_highway.js @@ -10,11 +10,15 @@ export function validationDisconnectedHighway() { return graph.childNodes(entity) .every(function(vertex) { - return graph.parentWays(vertex) - .filter(function(parent) { - return parent.tags.highway && parent !== entity; - }) - .length === 0; + var parents = graph.parentWays(vertex); + if (parents.length === 1) { // standalone vertex + return true; + } else { // shared vertex + return !vertex.tags.entrance && + parents.filter(function(parent) { + return parent.tags.highway && parent !== entity; + }).length === 0; + } }); } @@ -26,7 +30,7 @@ export function validationDisconnectedHighway() { if (isDisconnectedHighway(entity, graph)) { warnings.push({ - id: 'missing_tag', + id: 'disconnected_highway', message: t('validations.disconnected_highway'), tooltip: t('validations.disconnected_highway_tooltip'), entity: entity