Ticket #12493: 12493-2.patch

File 12493-2.patch, 2.1 KB (added by GerdP, 3 years ago)

proposed solution

  • src/org/openstreetmap/josm/data/validation/tests/UnconnectedWays.java

     
    5757
    5858    static final double DETOUR_FACTOR = 4;
    5959
     60    private final Set<String> priorityHighwayTags = new HashSet<>(Highways.CLASSIFIED_HIGHWAYS);
     61
    6062    protected abstract boolean isCandidate(OsmPrimitive p);
    6163
    6264    protected boolean isWantedWay(Way w) {
     
    368370        for (Entry<Node, MyWaySegment> error : errorMap.entrySet()) {
    369371            Node node = error.getKey();
    370372            MyWaySegment ws = error.getValue();
     373            String usedMsg = message;
     374            // #12493 - Categorize 'Way end node near other highway' warnings.
     375            if (isHighwayTest && priorityHighwayTags.contains(ws.w.get(HIGHWAY))) {
     376                // Get parent way from nearby end node and extract highway tag.
     377                Way parentWay = getWantedParentWay(node);
     378                if (priorityHighwayTags.contains(parentWay.get(HIGHWAY))) {
     379                    // both ways are major, change message
     380                    usedMsg = tr("Way end node near other highway - Major");
     381                }
     382            }
    371383            errors.add(TestError.builder(this, severity, code)
    372                     .message(message)
     384                    .message(usedMsg)
    373385                    .primitives(node, ws.w)
    374386                    .highlight(node)
    375387                    .build());
     
    392404        if (!searchNodes.isEmpty()) {
    393405            maxLen = DETOUR_FACTOR * mindist;
    394406            if (isHighwayTest) {
    395                 addErrors(Severity.WARNING, getHighwayEndNodesNearOtherHighway(), tr("Way end node near other highway"));
     407                addErrors(Severity.WARNING, getHighwayEndNodesNearOtherHighway(), tr("Way end node near other highway - Minor"));
    396408            } else {
    397409                addErrors(Severity.WARNING, getWayEndNodesNearOtherWay(), tr("Way end node near other way"));
    398410            }