diff --git a/modules/core/graph.js b/modules/core/graph.js index 31c06c410..20995570e 100644 --- a/modules/core/graph.js +++ b/modules/core/graph.js @@ -102,6 +102,12 @@ coreGraph.prototype = { return result; }, + parentMultipolygons: function(entity) { + return this.parentRelations(entity).filter(function(relation) { + return relation.isMultipolygon(); + }); + }, + childNodes: function(entity) { if (this._childNodes[entity.id]) return this._childNodes[entity.id]; diff --git a/modules/svg/helpers.js b/modules/svg/helpers.js index 48095f322..56730f1e8 100644 --- a/modules/svg/helpers.js +++ b/modules/svg/helpers.js @@ -202,9 +202,10 @@ export function svgPointTransform(projection) { export function svgRelationMemberTags(graph) { return function(entity) { var tags = entity.tags; + var shouldCopyMultipolygonTags = !entity.hasInterestingTags(); graph.parentRelations(entity).forEach(function(relation) { var type = relation.tags.type; - if (type === 'multipolygon' || type === 'boundary') { + if ((type === 'multipolygon' && shouldCopyMultipolygonTags) || type === 'boundary') { tags = _extend({}, relation.tags, tags); } }); diff --git a/modules/svg/lines.js b/modules/svg/lines.js index 7834f276b..500b02fb7 100644 --- a/modules/svg/lines.js +++ b/modules/svg/lines.js @@ -122,8 +122,15 @@ export function svgLines(projection, context) { lines.enter() .append('path') .attr('class', function(d) { + + var prefix = 'way line'; + if (!d.hasInterestingTags() && graph.parentMultipolygons(d).length > 0) { + // fudge the classes to style multipolygon member lines as area edges + prefix = 'relation area'; + } + var oldMPClass = oldMultiPolygonOuters[d.id] ? 'old-multipolygon ' : ''; - return 'way line ' + klass + ' ' + selectedClass + oldMPClass + d.id; + return prefix + ' ' + klass + ' ' + selectedClass + oldMPClass + d.id; }) .call(svgTagClasses()) .merge(lines) diff --git a/modules/ui/modes.js b/modules/ui/modes.js index 2e112514a..dde2b604b 100644 --- a/modules/ui/modes.js +++ b/modules/ui/modes.js @@ -90,7 +90,7 @@ export function uiModes(context) { var recents = context.presets().getRecents().filter(function(recent) { return recent.geometry !== 'relation'; }); - items = _uniqWith(items.concat(), function(item1, item2) { + items = _uniqWith(items.concat(recents), function(item1, item2) { return item1.matches(item2.preset, item2.geometry); }); var maxShown = 10;