Changeset 19034 in josm


Ignore:
Timestamp:
2024-04-06T10:03:50+02:00 (5 weeks ago)
Author:
GerdP
Message:

fix #9304: fix #9304: in validator, check for intersecting roads in different layers

  • exclude highway areas with layer != 0 from test
  • add one more test case with a bridge that is split (code coverage)
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/nodist/data/9304-examples.osm

    r19029 r19034  
    7272  <node id='-81913' action='modify' lat='52.85184234363' lon='8.33096821625' />
    7373  <node id='-81914' action='modify' lat='52.85308443243' lon='8.32968378727' />
     74  <node id='-81916' action='modify' lat='52.85151466516' lon='8.33385008876' />
     75  <node id='-81917' action='modify' lat='52.85192920272' lon='8.3345583381' />
     76  <node id='-81918' action='modify' lat='52.85139622512' lon='8.33508135299' />
     77  <node id='-81919' action='modify' lat='52.85229767723' lon='8.33551719874' />
     78  <node id='-81941' action='modify' lat='52.85132713167' lon='8.33529383324' />
     79  <node id='-81942' action='modify' lat='52.85174167102' lon='8.33600208258' />
     80  <node id='-81943' action='modify' lat='52.85120869112' lon='8.33652509747' />
     81  <node id='-81957' action='modify' lat='52.85216278631' lon='8.33610559595' />
     82  <node id='-81983' action='modify' lat='52.85567653366' lon='8.33139515768' />
     83  <node id='-81984' action='modify' lat='52.85540596408' lon='8.33237349066' />
     84  <node id='-81985' action='modify' lat='52.85546909714' lon='8.32826598577' />
     85  <node id='-81986' action='modify' lat='52.8556900621' lon='8.32931900066' />
     86  <node id='-81995' action='modify' lat='52.85568346895' lon='8.33033082658' />
    7487  <way id='-579' action='modify'>
    7588    <nd ref='-25357' />
     
    280293    <tag k='tunnel' v='yes' />
    281294  </way>
     295  <way id='-36866' action='modify'>
     296    <nd ref='-81916' />
     297    <nd ref='-81917' />
     298    <nd ref='-81918' />
     299    <nd ref='-81916' />
     300    <tag k='area' v='yes' />
     301    <tag k='highway' v='pedestrian' />
     302    <tag k='layer' v='-1' />
     303    <tag k='name' v='below' />
     304  </way>
     305  <way id='-36869' action='modify'>
     306    <nd ref='-81917' />
     307    <nd ref='-81919' />
     308    <tag k='highway' v='path' />
     309  </way>
     310  <way id='-36917' action='modify'>
     311    <nd ref='-81941' />
     312    <nd ref='-81942' />
     313    <nd ref='-81943' />
     314    <nd ref='-81941' />
     315    <tag k='area' v='yes' />
     316    <tag k='highway' v='pedestrian' />
     317    <tag k='name' v='normal' />
     318  </way>
     319  <way id='-36934' action='modify'>
     320    <nd ref='-81957' />
     321    <nd ref='-81942' />
     322    <tag k='highway' v='footway' />
     323    <tag k='layer' v='1' />
     324  </way>
     325  <way id='-37072' action='modify'>
     326    <nd ref='-81983' />
     327    <nd ref='-81984' />
     328    <tag k='highway' v='unclassified' />
     329  </way>
     330  <way id='-37073' action='modify'>
     331    <nd ref='-81985' />
     332    <nd ref='-81986' />
     333    <tag k='highway' v='unclassified' />
     334  </way>
     335  <way id='-37074' action='modify'>
     336    <nd ref='-81986' />
     337    <nd ref='-81995' />
     338    <tag k='bridge' v='yes' />
     339    <tag k='highway' v='unclassified' />
     340    <tag k='layer' v='1' />
     341  </way>
     342  <way id='-37086' action='modify'>
     343    <nd ref='-81995' />
     344    <nd ref='-81983' />
     345    <tag k='bridge' v='yes' />
     346    <tag k='highway' v='unclassified' />
     347    <tag k='layer' v='1' />
     348  </way>
    282349</osm>
  • trunk/src/org/openstreetmap/josm/data/validation/tests/Highways.java

    r19029 r19034  
    311311    private void testDifferentLayers(Node connection) {
    312312        List<Way> ways = connection.getParentWays();
    313         ways.removeIf(w -> !w.hasTag("highway") || w.hasTag("highway", "steps"));
     313        ways.removeIf(w -> !w.hasTag("highway") || w.hasTag("highway", "steps") || isSpecialArea(w));
    314314        if (ways.size() < 2 || ways.stream().noneMatch(w -> w.hasKey("layer")))
    315315            return;
     
    339339
    340340    /**
     341     * Check if way is an area on a layer above or below 0.
     342     * @param w the way
     343     * @return true if way is an area on a layer above or below 0
     344     */
     345    private static boolean isSpecialArea(Way w) {
     346        return w.hasAreaTags() && OsmUtils.getLayer(w) != null;
     347    }
     348
     349    /**
    341350     * Check if there are at least two neighbouring nodes on the given ways.
    342351     * If so, the connection node can be considered to be at a specific layer, else it marks the end of such a layer
Note: See TracChangeset for help on using the changeset viewer.