From 3803d28d74cf646cec6810e650448048c182491b Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Fri, 14 Dec 2012 14:20:17 -0500 Subject: [PATCH] Improve area-closed logic. Fixes #237 --- js/id/graph/entity.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/js/id/graph/entity.js b/js/id/graph/entity.js index 5c89e4890..3918f4172 100644 --- a/js/id/graph/entity.js +++ b/js/id/graph/entity.js @@ -115,8 +115,16 @@ iD.Way.isClosed = function(d) { return (!d.nodes.length) || d.nodes[d.nodes.length - 1].id === d.nodes[0].id; }; +// a way is an area if: +// +// - area=yes +// - closed and +// - doesn't have area=no +// - doesn't have highway tag iD.Way.isArea = function(d) { - return iD.Way.isClosed(d) || (d.tags.area && d.tags.area === 'yes'); + return (d.tags.area && d.tags.area === 'yes') || + (iD.Way.isClosed(d) && + (!d.tags.area || d.tags.area === 'no') && !d.tags.highway); }; iD.Relation = function(attrs) {