disable merge operation if at least one relation is incomplete

Incomplete multipolygons were harmed in the merge operation (which
relies on completely loaded relations to determine inner/outer
status for example).

This disables the operation and adds an appropriate tooltip.
This commit is contained in:
tyr
2014-02-09 18:41:31 +01:00
parent 422f76be77
commit 90fd8b6e51
4 changed files with 10 additions and 1 deletions

View File

@@ -106,6 +106,7 @@ en:
not_eligible: These features can't be merged.
not_adjacent: These lines can't be merged because they aren't connected.
restriction: These lines can't be merged because at least one is a member of a "{relation}" relation.
incomplete_relation: These features can't be merged because at least one hasn't been fully downloaded.
move:
title: Move
description: Move this to a different location.

View File

@@ -134,7 +134,8 @@
"annotation": "Merged {n} lines.",
"not_eligible": "These features can't be merged.",
"not_adjacent": "These lines can't be merged because they aren't connected.",
"restriction": "These lines can't be merged because at least one is a member of a \"{relation}\" relation."
"restriction": "These lines can't be merged because at least one is a member of a \"{relation}\" relation.",
"incomplete_relation": "These features can't be merged because at least one hasn't been fully downloaded."
},
"move": {
"title": "Move",

View File

@@ -108,6 +108,10 @@ iD.actions.MergePolygon = function(ids, newRelationId) {
if (entities.other.length > 0 ||
entities.closedWay.length + entities.multipolygon.length < 2)
return 'not_eligible';
if (!entities.multipolygon.every(function(r) {
return r.isComplete(graph);
}))
return 'incomplete_relation';
};
return action;

View File

@@ -38,6 +38,9 @@ iD.operations.Merge = function(selectedIDs, context) {
if (j === 'restriction' && m && p)
return t('operations.merge.restriction', {relation: context.presets().item('type/restriction').name()});
if (p === 'incomplete_relation' && j && m)
return t('operations.merge.incomplete_relation');
if (j && m && p)
return t('operations.merge.' + j);