Files
iD/modules/actions/unrestrict_turn.js
2016-06-14 09:09:44 -04:00

26 lines
903 B
JavaScript

import { DeleteRelation } from './delete_relation';
// Remove the effects of `turn.restriction` on `turn`, which must have the
// following structure:
//
// {
// from: { node: <node ID>, way: <way ID> },
// via: { node: <node ID> },
// to: { node: <node ID>, way: <way ID> },
// restriction: <relation ID>
// }
//
// In the simple case, `restriction` is a reference to a `no_*` restriction
// on the turn itself. In this case, it is simply deleted.
//
// The more complex case is where `restriction` references an `only_*`
// restriction on a different turn in the same intersection. In that case,
// that restriction is also deleted, but at the same time restrictions on
// the turns other than the first two are created.
//
export function UnrestrictTurn(turn) {
return function(graph) {
return DeleteRelation(turn.restriction)(graph);
};
}