diff --git a/data/core.yaml b/data/core.yaml index 40611f78b..e94fbb51d 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -1378,9 +1378,9 @@ en: building-building: reference: "Buildings should not intersect except on different layers." building-highway: - reference: "Highways crossing buildings should use bridges, tunnels, coverings, or entrances." + reference: "Highways crossing buildings should use bridges, tunnels, or different layers." building-railway: - reference: "Railways crossing buildings should use bridges or tunnels." + reference: "Railways crossing buildings should use bridges, tunnels, or different layers." building-waterway: reference: "Waterways crossing buildings should use tunnels or different layers." highway-highway: diff --git a/dist/locales/en.json b/dist/locales/en.json index 5cdd7a420..c27850da7 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -1694,10 +1694,10 @@ "reference": "Buildings should not intersect except on different layers." }, "building-highway": { - "reference": "Highways crossing buildings should use bridges, tunnels, coverings, or entrances." + "reference": "Highways crossing buildings should use bridges, tunnels, or different layers." }, "building-railway": { - "reference": "Railways crossing buildings should use bridges or tunnels." + "reference": "Railways crossing buildings should use bridges, tunnels, or different layers." }, "building-waterway": { "reference": "Waterways crossing buildings should use tunnels or different layers." diff --git a/modules/ui/fields/radio.js b/modules/ui/fields/radio.js index 3b8bc5a86..601be2470 100644 --- a/modules/ui/fields/radio.js +++ b/modules/ui/fields/radio.js @@ -75,10 +75,10 @@ export function uiFieldRadio(field, context) { function structureExtras(selection, tags) { - var selected = selectedKey(); + var selected = selectedKey() || tags.layer !== undefined; var type = context.presets().field(selected); var layer = context.presets().field('layer'); - var showLayer = (selected === 'bridge' || selected === 'tunnel'); + var showLayer = (selected === 'bridge' || selected === 'tunnel' || tags.layer !== undefined); var extrasWrap = selection.selectAll('.structure-extras-wrap') diff --git a/modules/validations/crossing_ways.js b/modules/validations/crossing_ways.js index d1e0d55dd..1024633a4 100644 --- a/modules/validations/crossing_ways.js +++ b/modules/validations/crossing_ways.js @@ -38,18 +38,12 @@ export function validationCrossingWays(context) { tags.highway === 'corridor'; } - function allowsStructures(featureType) { - return allowsBridge(featureType) || allowsTunnel(featureType); - } function allowsBridge(featureType) { return featureType === 'highway' || featureType === 'railway' || featureType === 'waterway'; } function allowsTunnel(featureType) { return featureType === 'highway' || featureType === 'railway' || featureType === 'waterway'; } - function canCover(featureType) { - return featureType === 'building'; - } function getFeatureTypeForCrossingCheck(way, graph) { @@ -110,20 +104,12 @@ export function validationCrossingWays(context) { } else if (allowsTunnel(featureType1) && hasTag(tags1, 'tunnel')) return true; else if (allowsTunnel(featureType2) && hasTag(tags2, 'tunnel')) return true; - if (canCover(featureType1) && canCover(featureType2)) { - if (hasTag(tags1, 'covered') && !hasTag(tags2, 'covered')) return true; - if (!hasTag(tags1, 'covered') && hasTag(tags2, 'covered')) return true; - // crossing covered features that can themselves cover must use different layers - if (hasTag(tags1, 'covered') && hasTag(tags2, 'covered') && layer1 !== layer2) return true; - } else if (canCover(featureType1) && hasTag(tags2, 'covered')) return true; - else if (canCover(featureType2) && hasTag(tags1, 'covered')) return true; - // don't flag crossing waterways and pier/highways if (featureType1 === 'waterway' && featureType2 === 'highway' && tags2.man_made === 'pier') return true; if (featureType2 === 'waterway' && featureType1 === 'highway' && tags1.man_made === 'pier') return true; - if (!allowsStructures(featureType1) && !allowsStructures(featureType2)) { - // if no structures are applicable, the layers must be different + if (featureType1 === 'building' || featureType2 === 'building') { + // for building crossings, different layers are enough if (layer1 !== layer2) return true; } return false; @@ -394,10 +380,13 @@ export function validationCrossingWays(context) { } else { useFixID = 'use_different_layers'; } - if (useFixID === 'use_different_layers') { + if (useFixID === 'use_different_layers' || + featureType1 === 'building' || + featureType2 === 'building') { fixes.push(makeChangeLayerFix('higher')); fixes.push(makeChangeLayerFix('lower')); - } else { + } + if (useFixID !== 'use_different_layers') { fixes.push(new validationIssueFix({ icon: useFixIcon, title: t('issues.fix.' + useFixID + '.title') diff --git a/test/spec/validations/crossing_ways.js b/test/spec/validations/crossing_ways.js index 7e3dadc9e..5d719edac 100644 --- a/test/spec/validations/crossing_ways.js +++ b/test/spec/validations/crossing_ways.js @@ -99,7 +99,7 @@ describe('iD.validations.crossing_ways', function () { }); it('legit crossing between highway and building', function() { - createWaysWithOneCrossingPoint({ highway: 'residential', covered: 'yes' }, { building: 'yes' }); + createWaysWithOneCrossingPoint({ highway: 'residential', layer: '-1' }, { building: 'yes' }); var issues = validate(); expect(issues).to.have.lengthOf(0); }); @@ -123,7 +123,7 @@ describe('iD.validations.crossing_ways', function () { }); it('legit crossing between railway and building', function() { - createWaysWithOneCrossingPoint({ railway: 'rail', covered: 'yes' }, { building: 'yes' }); + createWaysWithOneCrossingPoint({ railway: 'rail', layer: '-1' }, { building: 'yes' }); var issues = validate(); expect(issues).to.have.lengthOf(0); }); @@ -135,13 +135,13 @@ describe('iD.validations.crossing_ways', function () { }); it('legit crossing between waterway and building', function() { - createWaysWithOneCrossingPoint({ waterway: 'river', covered: 'yes' }, { building: 'yes' }); + createWaysWithOneCrossingPoint({ waterway: 'river', layer: '-1' }, { building: 'yes' }); var issues = validate(); expect(issues).to.have.lengthOf(0); }); it('legit crossing between building and building', function() { - createWaysWithOneCrossingPoint({ building: 'yes' }, { building: 'yes', covered: 'yes' }); + createWaysWithOneCrossingPoint({ building: 'yes' }, { building: 'yes', layer: '1' }); var issues = validate(); expect(issues).to.have.lengthOf(0); });