skip unsupported/invalid restrictions instead of fallback to "no_*"

closes #9337 (at least kind of… for a proper solution see #6460)
This commit is contained in:
Martin Raifer
2022-10-27 18:34:48 +02:00
parent dd30a39d74
commit 097c6bd774
3 changed files with 9 additions and 2 deletions
+2
View File
@@ -47,6 +47,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
* Fix selection of best background source when starting on a zoomed-out view ([#9325])
* Fix leaking of localized strings in combo fields when taginfo service is unavailable ([#9342])
* Keep tags when changing presets if the new preset has a field for it ([#9341], [#9104])
* Skip unsupported/invalid restriction relations instead of assuming they are a "no_*" restriction ([#9337])
#### :rocket: Presets
* Support tagging schema v5 ([#9320]):
* Add new field type `colour` ([schema-builder#38], [#8782])
@@ -61,6 +62,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
[#9294]: https://github.com/openstreetmap/iD/issues/9294
[#9320]: https://github.com/openstreetmap/iD/pull/9320
[#9325]: https://github.com/openstreetmap/iD/issues/9325
[#9337]: https://github.com/openstreetmap/iD/issues/9337
[#9341]: https://github.com/openstreetmap/iD/issues/9341
[#9342]: https://github.com/openstreetmap/iD/issues/9342
[schema-builder#38]: https://github.com/ideditor/schema-builder/pull/38
+5
View File
@@ -386,8 +386,13 @@ export function osmIntersection(graph, startVertexId, maxDistance) {
var f = restriction.memberByRole('from');
var v = restriction.membersByRole('via');
var t = restriction.memberByRole('to');
var isNo = /^no_/.test(restriction.tags.restriction);
var isOnly = /^only_/.test(restriction.tags.restriction);
if (!(isNo || isOnly)) {
continue; // skip unsupported restriction values
}
// Does the current path match this turn restriction?
var matchesFrom = (f.id === fromWayId);
var matchesViaTo = false;
+2 -2
View File
@@ -305,7 +305,7 @@ describe('iD.osmIntersection', function() {
expect(turns[0].u).to.be.true;
});
it('restricts turns with a restriction relation', function() {
it('restricts turns with a no_* restriction relation', function() {
// u ==== * ---> w
var graph = iD.coreGraph([
iD.osmNode({ id: 'u', loc: [0, 0] }),
@@ -313,7 +313,7 @@ describe('iD.osmIntersection', function() {
iD.osmNode({ id: 'w', loc: [2, 0] }),
iD.osmWay({ id: '=', nodes: ['u', '*'], tags: { highway: 'residential' } }),
iD.osmWay({ id: '-', nodes: ['*', 'w'], tags: { highway: 'residential' } }),
iD.osmRelation({id: 'r', tags: { type: 'restriction' }, members: [
iD.osmRelation({id: 'r', tags: { type: 'restriction', restriction: 'no_straight_on' }, members: [
{ id: '=', role: 'from', type: 'way' },
{ id: '-', role: 'to', type: 'way' },
{ id: '*', role: 'via', type: 'node' }