Ticket #18863: 18863-detect-broken.2.patch

File 18863-detect-broken.2.patch, 2.3 KB (added by GerdP, 5 years ago)

only perform additional check if first and last node of split-way are inside download area

  • src/org/openstreetmap/josm/command/SplitWayCommand.java

     
    472472            int ir = 0;
    473473            List<RelationMember> relationMembers = r.getMembers();
    474474            for (RelationMember rm : relationMembers) {
    475                 if (rm.isWay() && rm.getMember() == way) {
     475                if (rm.getMember() == way) {
    476476                    boolean insert = true;
    477477                    if (relationSpecialTypes.containsKey(type) && "restriction".equals(relationSpecialTypes.get(type))) {
    478478                        RelationInformation rValue = treatAsRestriction(r, rm, c, newWays, way, changedWay);
     
    541541                                    // won't help in any case.
    542542                                    direction = Direction.IRRELEVANT;
    543543                                }
     544                                if (direction == Direction.UNKNOWN && (!way.firstNode().isOutsideDownloadArea()
     545                                        || way.lastNode().isOutsideDownloadArea())) {
     546                                    // check if any other complete way in the relation is connected to the way
     547                                    // if so, the order of the relation is broken
     548                                    for (int i = 0; i < r.getMembersCount(); i++) {
     549                                        if (i >= ir - 1 && i <= ir + 1)
     550                                            continue;
     551                                        RelationMember rmTest = r.getMember(i);
     552                                        if (rmTest.isWay() && !rmTest.getMember().isIncomplete() &&
     553                                            (way.isFirstLastNode(rmTest.getWay().firstNode())
     554                                                    || way.isFirstLastNode(rm.getWay().lastNode()))) {
     555                                                direction = Direction.IRRELEVANT;
     556                                                break;
     557                                        }
     558                                    }
     559                                }
    544560                            }
    545561                        } else {
    546562                            int k = 1;