Ticket #7470: 7470.patch

File 7470.patch, 4.5 KB (added by simon04, 13 years ago)
  • src/org/openstreetmap/josm/command/Command.java

    diff --git a/src/org/openstreetmap/josm/command/Command.java b/src/org/openstreetmap/josm/command/Command.java
    index 514ec5f..404f59a 100644
    a b abstract public class Command extends PseudoCommand {  
    176176     */
    177177    public static boolean checkAndConfirmOutlyingOperation(String operation,
    178178            String dialogTitle, String outsideDialogMessage, String incompleteDialogMessage,
    179             Area area, Collection<? extends OsmPrimitive> primitives, OsmPrimitive ignore) {
     179            Area area, Collection<? extends OsmPrimitive> primitives,
     180            Collection<? extends OsmPrimitive> ignore) {
    180181        boolean outside = false;
    181182        boolean incomplete = false;
    182         if (area != null) {
    183             for (OsmPrimitive osm : primitives) {
    184                 if (osm.isIncomplete()) {
    185                     incomplete = true;
    186                 } else if (isOutlying(osm, area)
    187                         && (ignore == null || !ignore.equals(osm))) {
    188                     outside = true;
    189                 }
    190             }
    191         } else {
    192             for (OsmPrimitive osm : primitives) {
    193                 if (osm.isIncomplete()) {
    194                     incomplete = true;
    195                 }
     183        for (OsmPrimitive osm : primitives) {
     184            if (osm.isIncomplete()) {
     185                incomplete = true;
     186            } else if (area != null && isOutlying(osm, area)
     187                    && (ignore == null || !ignore.contains(osm))) {
     188                outside = true;
    196189            }
    197190        }
    198191        if (outside) {
  • src/org/openstreetmap/josm/command/DeleteCommand.java

    diff --git a/src/org/openstreetmap/josm/command/DeleteCommand.java b/src/org/openstreetmap/josm/command/DeleteCommand.java
    index e6751cc..a3aefc5 100644
    a b public class DeleteCommand extends Command {  
    357357            primitivesToDelete.addAll(nodesToDelete);
    358358        }
    359359
    360         if (!silent && !checkAndConfirmOutlyingDelete(layer, primitivesToDelete, null))
     360        if (!silent && !checkAndConfirmOutlyingDelete(layer,
     361                primitivesToDelete, Utils.filteredCollection(primitivesToDelete, Way.class)))
    361362            return null;
    362363
    363364        waysToBeChanged.addAll(OsmPrimitive.getFilteredSet(OsmPrimitive.getReferrer(primitivesToDelete), Way.class));
    public class DeleteCommand extends Command {  
    453454        }
    454455    }
    455456
    456     public static boolean checkAndConfirmOutlyingDelete(OsmDataLayer layer, Collection<? extends OsmPrimitive> primitives, OsmPrimitive ignore) {
     457    public static boolean checkAndConfirmOutlyingDelete(OsmDataLayer layer, Collection<? extends OsmPrimitive> primitives, Collection<? extends OsmPrimitive> ignore) {
    457458        return checkAndConfirmOutlyingDelete(layer.data.getDataSourceArea(), primitives, ignore);
    458459    }
    459460
    460     public static boolean checkAndConfirmOutlyingDelete(Area area, Collection<? extends OsmPrimitive> primitives, OsmPrimitive ignore) {
     461    public static boolean checkAndConfirmOutlyingDelete(Area area, Collection<? extends OsmPrimitive> primitives, Collection<? extends OsmPrimitive> ignore) {
    461462        return Command.checkAndConfirmOutlyingOperation("delete",
    462463                tr("Delete confirmation"),
    463464                tr("You are about to delete nodes outside of the area you have downloaded."
  • src/org/openstreetmap/josm/data/validation/tests/DuplicateNode.java

    diff --git a/src/org/openstreetmap/josm/data/validation/tests/DuplicateNode.java b/src/org/openstreetmap/josm/data/validation/tests/DuplicateNode.java
    index 584a584..41acc1b 100644
    a b import static org.openstreetmap.josm.tools.I18n.tr;  
    66
    77import java.util.ArrayList;
    88import java.util.Collection;
     9import java.util.Collections;
    910import java.util.HashMap;
    1011import java.util.Iterator;
    1112import java.util.LinkedHashSet;
    public class DuplicateNode extends Test {  
    383384            target = nodes.iterator().next();
    384385        }
    385386
    386         if (DeleteCommand.checkAndConfirmOutlyingDelete(Main.main.getCurrentDataSet().getDataSourceArea(), nodes, target))
     387        if (DeleteCommand.checkAndConfirmOutlyingDelete(Main.main.getCurrentDataSet().getDataSourceArea(), nodes, Collections.singleton(target)))
    387388            return MergeNodesAction.mergeNodes(Main.main.getEditLayer(), nodes, target);
    388389
    389390        return null;// undoRedo handling done in mergeNodes