Ticket #9819: 9819_combined_v1.patch

File 9819_combined_v1.patch, 4.4 KB (added by reichg, 4 years ago)

This has the mapcss addition necessary to cover original post issue AND some new validations for crossing ways. Also moved areLayerOrLevelDifferent() function to visit function so future validations for crossing ways will be less restricted by the ignoreWaySegmentCombination() function.

  • resources/data/validator/combinations.mapcss

     
    7575  assertMatch: "node source:addr:postcode=postman";
    7676}
    7777
     78way!:closed[highway][layer][layer!=0][!bridge][!tunnel][!covered][highway!~/steps|elevator/],
     79way!:closed[railway][layer][layer!=0][!bridge][!tunnel][!covered],
     80way!:closed[waterway][layer][layer!=0][!bridge][!tunnel][!covered] {
     81  throwWarning: tr("inspect to confirm a {1} tag is necessary on this {0}. If so, add either {2}, {3}, {4} or any other tags complimentary to {5}", "{2.key}", "{3.key}", "{4.key}=*", "{5.key}=*", "{6.key}=*", "{3.key}=*");
     82  group: tr("suspicious tag combination");
     83  assertMatch: "way highway=tertiary layer=2";
     84  assertMatch: "way waterway=stream layer=-1";
     85  assertMatch: "way railway=rail layer=2";
     86  assertNoMatch: "way highway=tertiary layer=2 bridge=yes";
     87  assertNoMatch: "way waterway=stream layer=-1 tunnel=yes";
     88  assertNoMatch: "way railway=rail layer=2 bridge=yes";
     89}
     90
    7891/* {0.key} without {1.key} (info level) */
    7992way[lanes:forward][!lanes:backward][oneway!=yes][oneway!=-1],
    8093way[lanes:backward][!lanes:forward][oneway!=yes][oneway!=-1],
     
    573586  throwWarning: tr("{0} on a relation without {1}", "{0.key}", "{1.tag}");
    574587}
    575588
    576 /* #9182 */
    577 way[waterway][layer][layer=~/^(-1|-2|-3|-4|-5)$/][!tunnel][culvert!=yes][covered!=yes][pipeline!=yes][location!=underground][eval(waylength()) > 400] {
    578   throwWarning: tr("Long waterway with {0} but without a tag which defines it as tunnel or underground. Remove {1} or add a tunnel tag if applicable. Also check crossing bridges and their {1} tags.", "{1.tag}", "{1.key}");
    579   group: tr("suspicious tag combination");
    580 }
    581 way[waterway][layer][layer=~/^(-1|-2|-3|-4|-5)$/][!tunnel][culvert!=yes][covered!=yes][pipeline!=yes][location!=underground][eval(waylength()) <= 400] {
    582   throwOther: tr("Short waterway with {0} but without a tag which defines it as tunnel or underground. Remove {1} or add a tunnel tag if applicable. Also check crossing bridges and their {1} tags.", "{1.tag}", "{1.key}");
    583   group: tr("suspicious tag combination");
    584 }
    585 
    586589/* #13144, #15536 */
    587590*[unisex=yes][female=yes][male!=yes][shop=hairdresser],
    588591*[unisex=yes][male=yes][female!=yes][shop=hairdresser] {
  • src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java

     
    114114        boolean ignoreWaySegmentCombination(Way w1, Way w2) {
    115115            if (w1 == w2)
    116116                return true;
    117             if (areLayerOrLevelDifferent(w1, w2))
    118                 return true;
    119117            if (isBuilding(w1) && isBuilding(w2))
    120118                return true; // handled by mapcss tests
    121119            if (((isResidentialArea(w1) || w1.hasKey(BARRIER, HIGHWAY, RAILWAY, WATERWAY) || isWaterArea(w1))
     
    378376                        highlight.add(es1);
    379377                        highlight.add(es2);
    380378
    381                         final MessageHelper message = createMessage(es1.getWay(), es2.getWay());
    382                         errors.add(TestError.builder(this, Severity.WARNING, message.code)
    383                                 .message(message.message)
    384                                 .primitives(prims)
    385                                 .highlightWaySegments(highlight)
    386                                 .build());
    387                         seenWays.put(prims, highlight);
     379                        if (!areLayerOrLevelDifferent(es1.getWay(), es2.getWay()))
     380                        {
     381                            final MessageHelper message = createMessage(es1.getWay(), es2.getWay());
     382                            errors.add(TestError.builder(this, Severity.WARNING, message.code)
     383                                    .message(message.message)
     384                                    .primitives(prims)
     385                                    .highlightWaySegments(highlight)
     386                                    .build());
     387                            seenWays.put(prims, highlight);
     388
     389                        }
    388390                    } else {
    389391                        highlight.add(es1);
    390392                        highlight.add(es2);