mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-17 22:24:49 +02:00
add default implied access values for ways with "motorroad=yes"
see https://wiki.openstreetmap.org/wiki/OSM_tags_for_routing/Access_restrictions addresses https://github.com/openstreetmap/id-tagging-schema/issues/609
This commit is contained in:
@@ -61,8 +61,10 @@ _Breaking developer changes, which may affect downstream projects or sites that
|
||||
#### :rocket: Presets
|
||||
* Don't inherit fields which the current preset already has a dedicated field for
|
||||
* Take location into account when setting a presets default values from regional fields
|
||||
* Roads with `motorroad=yes` show implied access restrictions (`foot=no`, `bicycle=no`, `horse=no`) ([id-tagging-schema#609], [#9333])
|
||||
#### :hammer: Development
|
||||
|
||||
[#9333]: https://github.com/openstreetmap/iD/pull/9333
|
||||
[#10299]: https://github.com/openstreetmap/iD/issues/10299
|
||||
[#10392]: https://github.com/openstreetmap/iD/issues/10392
|
||||
[#10394]: https://github.com/openstreetmap/iD/pull/10394
|
||||
@@ -71,6 +73,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
|
||||
[#10843]: https://github.com/openstreetmap/iD/pull/10843
|
||||
[#10852]: https://github.com/openstreetmap/iD/issues/10852
|
||||
[#10885]: https://github.com/openstreetmap/iD/issues/10885
|
||||
[id-tagging-schema#609]: https://github.com/openstreetmap/id-tagging-schema/issues/609
|
||||
[@0xatulpatil]: https://github.com/0xatulpatil
|
||||
[@MohamedAli00949]: https://github.com/MohamedAli00949
|
||||
|
||||
|
||||
@@ -312,12 +312,19 @@ export function uiFieldAccess(field, context) {
|
||||
if (tags[accessField]) {
|
||||
return tags[accessField];
|
||||
}
|
||||
// implied access
|
||||
// motorroad: https://wiki.openstreetmap.org/wiki/OSM_tags_for_routing/Access_restrictions
|
||||
if (tags.motorroad === 'yes' && (accessField === 'foot' || accessField === 'bicycle' || accessField === 'horse')) {
|
||||
return 'no';
|
||||
}
|
||||
// inherited access
|
||||
if (tags.vehicle && (accessField === 'bicycle' || accessField === 'motor_vehicle')) {
|
||||
return tags.vehicle;
|
||||
}
|
||||
if (tags.access) {
|
||||
return tags.access;
|
||||
}
|
||||
// default access by road/barrier type
|
||||
for (const key in placeholdersByTag) {
|
||||
if (tags[key]) {
|
||||
if (placeholdersByTag[key][tags[key]] &&
|
||||
|
||||
@@ -121,6 +121,16 @@ describe('iD.uiFieldAccess', function() {
|
||||
expect(selection.selectAll('.preset-input-access-bicycle').attr('placeholder')).to.equal('destination');
|
||||
});
|
||||
|
||||
it('sets foot, bicycle and horse placeholder to "no" when there a "motorroad=yes" tag (#9333)', function() {
|
||||
var access = iD.uiFieldAccess(field, context);
|
||||
selection.call(access);
|
||||
|
||||
access.tags({highway: 'primary', motorroad: 'yes'});
|
||||
expect(selection.selectAll('.preset-input-access-foot').attr('placeholder')).to.equal('no');
|
||||
expect(selection.selectAll('.preset-input-access-bicycle').attr('placeholder')).to.equal('no');
|
||||
expect(selection.selectAll('.preset-input-access-horse').attr('placeholder')).to.equal('no');
|
||||
});
|
||||
|
||||
it('sets correct placeholder on a multi selection', function() {
|
||||
var access = iD.uiFieldAccess(field, context);
|
||||
selection.call(access);
|
||||
|
||||
Reference in New Issue
Block a user