mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-17 22:24:49 +02:00
Disable merge operation when it would damage relations
The operation is disabled when attempting to join ways which don't belong to identical sets of relations. Restriction relations are excluded, because they are already handled with slightly different logic. Fixes #8674 Fixes #8645 Fixes #3825 Fixes #1512
This commit is contained in:
@@ -142,6 +142,47 @@ describe('iD.actionJoin', function () {
|
||||
expect(iD.actionJoin(['-', '=']).disabled(graph)).to.equal('restriction');
|
||||
});
|
||||
|
||||
it('returns \'conflicting_relations\' when a relation would be extended', function () {
|
||||
// a --> b ==> c
|
||||
// members: -
|
||||
// not member: =
|
||||
var graph = iD.coreGraph([
|
||||
iD.osmNode({id: 'a', loc: [0,0]}),
|
||||
iD.osmNode({id: 'b', loc: [2,0]}),
|
||||
iD.osmNode({id: 'c', loc: [4,0]}),
|
||||
iD.osmWay({id: '-', nodes: ['a', 'b']}),
|
||||
iD.osmWay({id: '=', nodes: ['b', 'c']}),
|
||||
iD.osmRelation({id: 'r', tags: {}, members: [
|
||||
{type: 'way', id: '-'},
|
||||
]})
|
||||
]);
|
||||
|
||||
expect(iD.actionJoin(['-', '=']).disabled(graph)).to.equal('conflicting_relations');
|
||||
});
|
||||
|
||||
it('returns \'conflicting_relations\' when a relation would be forked', function () {
|
||||
// a --> b ==> c
|
||||
// |
|
||||
// d
|
||||
// members: -, =
|
||||
// not member: |
|
||||
var graph = iD.coreGraph([
|
||||
iD.osmNode({id: 'a', loc: [0,0]}),
|
||||
iD.osmNode({id: 'b', loc: [2,0]}),
|
||||
iD.osmNode({id: 'c', loc: [4,0]}),
|
||||
iD.osmNode({id: 'd', loc: [2,2]}),
|
||||
iD.osmWay({id: '-', nodes: ['a', 'b']}),
|
||||
iD.osmWay({id: '=', nodes: ['b', 'c']}),
|
||||
iD.osmWay({id: '|', nodes: ['b', 'd']}),
|
||||
iD.osmRelation({id: 'r', tags: {}, members: [
|
||||
{type: 'way', id: '-'},
|
||||
{type: 'way', id: '='},
|
||||
]})
|
||||
]);
|
||||
|
||||
expect(iD.actionJoin(['-', '|']).disabled(graph)).to.equal('conflicting_relations');
|
||||
});
|
||||
|
||||
it('returns \'paths_intersect\' if resulting way intersects itself', function () {
|
||||
// d
|
||||
// |
|
||||
|
||||
Reference in New Issue
Block a user