Changeset 15681 in josm


Ignore:
Timestamp:
2020-01-11T16:48:54+01:00 (3 months ago)
Author:
GerdP
Message:

fix #18083 (again): Don't combine ways when the shared node is old and outside of the download area. If that happens, show a notification "Combine ways refused. (A shared node is outside of the download area)"
Please suggest a better message text.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java

    r15628 r15681  
    1111import java.util.Collection;
    1212import java.util.Collections;
     13import java.util.HashSet;
    1314import java.util.LinkedHashSet;
    1415import java.util.LinkedList;
    1516import java.util.List;
    1617import java.util.Objects;
     18import java.util.Set;
    1719import java.util.stream.Collectors;
    1820
     
    281283            return;
    282284        }
     285
     286        // see #18083: check if we will combine ways at nodes outside of the download area
     287        Set<Node> endNodesOutside = new HashSet<>();
     288        for (Way w : selectedWays) {
     289            final Node[] endnodes = { w.firstNode(), w.lastNode() };
     290            for (Node n : endnodes) {
     291                if (!n.isNew() && n.isOutsideDownloadArea() && !endNodesOutside.add(n)) {
     292                    new Notification(tr("Combine ways refused<br>" + "(A shared node is outside of the download area)"))
     293                            .setIcon(JOptionPane.INFORMATION_MESSAGE).show();
     294                    return;
     295
     296                }
     297            }
     298        }
     299
    283300        // combine and update gui
    284301        Pair<Way, Command> combineResult;
Note: See TracChangeset for help on using the changeset viewer.