mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 05:30:35 +02:00
Treat anything with a from/via/to like a restriction
(closes #6221) Applies to actions like splitting, connecting, extracting a via node, etc
This commit is contained in:
@@ -80,7 +80,7 @@ export function actionConnect(nodeIDs) {
|
||||
role = relation.memberById(node.id).role || '';
|
||||
|
||||
// if this node is a via node in a restriction, remember for later
|
||||
if (relation.isValidRestriction()) {
|
||||
if (relation.hasFromViaTo()) {
|
||||
restrictionIDs.push(relation.id);
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ export function actionConnect(nodeIDs) {
|
||||
|
||||
for (k = 0; k < relations.length; k++) {
|
||||
relation = relations[k];
|
||||
if (relation.isValidRestriction()) {
|
||||
if (relation.hasFromViaTo()) {
|
||||
restrictionIDs.push(relation.id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ export function actionExtract(entityID, projection) {
|
||||
var parentRels = graph.parentRelations(entity);
|
||||
for (var i = 0; i < parentRels.length; i++) {
|
||||
var relation = parentRels[i];
|
||||
if (!relation.isValidRestriction()) continue;
|
||||
if (!relation.hasFromViaTo()) continue;
|
||||
|
||||
for (var j = 0; j < relation.members.length; j++) {
|
||||
var m = relation.members[j];
|
||||
|
||||
@@ -118,7 +118,7 @@ export function actionSplit(nodeId, newWayIds) {
|
||||
// 1. Splitting a FROM/TO way - only `wayA` OR `wayB` remains in relation
|
||||
// (whichever one is connected to the VIA node/ways)
|
||||
// 2. Splitting a VIA way - `wayB` remains in relation as a VIA way
|
||||
if (relation.isRestriction()) {
|
||||
if (relation.hasFromViaTo()) {
|
||||
var f = relation.memberByRole('from');
|
||||
var v = relation.membersByRole('via');
|
||||
var t = relation.memberByRole('to');
|
||||
|
||||
@@ -1160,7 +1160,7 @@ describe('iD.actionSplit', function () {
|
||||
});
|
||||
|
||||
|
||||
['restriction', 'restriction:bus'].forEach(function (type) {
|
||||
['restriction', 'restriction:bus', 'manoeuvre'].forEach(function (type) {
|
||||
describe('type = ' + type, function () {
|
||||
|
||||
it('updates a restriction\'s \'from\' role - via node', function () {
|
||||
|
||||
Reference in New Issue
Block a user