Ticket #19871: 19871.2.patch

File 19871.2.patch, 2.8 KB (added by GerdP, 5 years ago)

remove also now obsolete code to handle one-node-ways

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

     
    256256                        .build());
    257257                return;
    258258            }
    259             final Way viaPseudoWay = new Way();
    260             viaPseudoWay.addNode(viaNode);
    261             checkIfConnected(r, fromWay, viaPseudoWay,
    262                     tr("The \"from\" way does not start or end at a \"via\" node."), FROM_VIA_NODE);
    263             checkIfConnected(r, viaPseudoWay, toWay,
    264                     tr("The \"to\" way does not start or end at a \"via\" node."), TO_VIA_NODE);
     259            if (!fromWay.isFirstLastNode(viaNode)) {
     260                errors.add(TestError.builder(this, Severity.WARNING, FROM_VIA_NODE)
     261                        .message(tr("The \"from\" way does not start or end at a \"via\" node."))
     262                        .primitives(r, fromWay, viaNode)
     263                        .highlight(fromWay, viaNode)
     264                        .build());
     265            }
     266            if (!toWay.isFirstLastNode(viaNode)) {
     267                errors.add(TestError.builder(this, Severity.WARNING, TO_VIA_NODE)
     268                        .message(tr("The \"to\" way does not start or end at a \"via\" node."))
     269                        .primitives(r, toWay, viaNode)
     270                        .highlight(toWay, viaNode)
     271                        .build());
     272            }
    265273        } else {
    266274            if (isFullOneway(toWay) && ((Way) via.get(via.size() - 1)).isFirstLastNode(toWay.lastNode(true))) {
    267275                errors.add(TestError.builder(this, Severity.WARNING, SUPERFLUOUS)
     
    315323            c = current.isFirstLastNode(previous.firstNode()) || current.isFirstLastNode(previous.lastNode());
    316324        }
    317325        if (!c) {
    318             List<OsmPrimitive> hilite = new ArrayList<>();
    319             if (previous.getNodesCount() == 1 && previous.isNew())
    320                 hilite.add(previous.firstNode());
    321             else
    322                 hilite.add(previous);
    323             if (current.getNodesCount() == 1 && current.isNew())
    324                 hilite.add(current.firstNode());
    325             else
    326                 hilite.add(current);
    327             List<OsmPrimitive> primitives = new ArrayList<>();
    328             primitives.add(r);
    329             primitives.addAll(hilite);
    330326            errors.add(TestError.builder(this, Severity.ERROR, code)
    331327                    .message(msg)
    332                     .primitives(primitives)
    333                     .highlight(hilite)
     328                    .primitives(r, previous, current)
     329                    .highlight(previous, current)
    334330                    .build());
    335331        }
    336332    }