Ignore:
Timestamp:
2014-01-06T12:27:11+01:00 (6 years ago)
Author:
simon04
Message:

fix #9544 - Skip nodes outside of download area for BarriersEntrances and WayConnectedToArea validation tests

Location:
trunk/src/org/openstreetmap/josm/command
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/command/Command.java

    r6538 r6639  
    191191     * @param outsideDialogMessage the message text to be displayed when data is outside of the download area
    192192     * @param incompleteDialogMessage the message text to be displayed when data is incomplete
    193      * @param area the area used to determine whether data is outlying
    194193     * @param primitives the primitives to operate on
    195194     * @param ignore {@code null} or a primitive to be ignored
     
    198197    public static boolean checkAndConfirmOutlyingOperation(String operation,
    199198            String dialogTitle, String outsideDialogMessage, String incompleteDialogMessage,
    200             Area area, Collection<? extends OsmPrimitive> primitives,
     199            Collection<? extends OsmPrimitive> primitives,
    201200            Collection<? extends OsmPrimitive> ignore) {
    202201        boolean outside = false;
     
    205204            if (osm.isIncomplete()) {
    206205                incomplete = true;
    207             } else if (area != null && isOutlying(osm, area)
     206            } else if (osm.isOutsideDownloadArea()
    208207                    && (ignore == null || !ignore.contains(osm))) {
    209208                outside = true;
     
    241240    }
    242241
    243     private static boolean isOutlying(OsmPrimitive osm, Area area) {
    244         if (osm instanceof Node && !osm.isNewOrUndeleted()) {
    245             return !((Node) osm).getCoor().isIn(area);
    246         } else if (osm instanceof Way) {
    247             for (Node n : ((Way) osm).getNodes()) {
    248                 if (isOutlying(n, area)) {
    249                     return true;
    250                 }
    251             }
    252             return false;
    253         }
    254         return false;
    255     }
    256242}
  • trunk/src/org/openstreetmap/josm/command/DeleteCommand.java

    r6524 r6639  
    77
    88import java.awt.GridBagLayout;
    9 import java.awt.geom.Area;
    109import java.util.ArrayList;
    1110import java.util.Collection;
     
    253252        if (parents.isEmpty())
    254253            return null;
    255         if (!silent && !checkAndConfirmOutlyingDelete(layer, parents, null))
     254        if (!silent && !checkAndConfirmOutlyingDelete(parents, null))
    256255            return null;
    257256        return new DeleteCommand(layer,parents);
     
    355354        }
    356355
    357         if (!silent && !checkAndConfirmOutlyingDelete(layer,
     356        if (!silent && !checkAndConfirmOutlyingDelete(
    358357                primitivesToDelete, Utils.filteredCollection(primitivesToDelete, Way.class)))
    359358            return null;
     
    450449    }
    451450
    452     public static boolean checkAndConfirmOutlyingDelete(OsmDataLayer layer, Collection<? extends OsmPrimitive> primitives, Collection<? extends OsmPrimitive> ignore) {
    453         return checkAndConfirmOutlyingDelete(layer.data.getDataSourceArea(), primitives, ignore);
    454     }
    455 
    456     public static boolean checkAndConfirmOutlyingDelete(Area area, Collection<? extends OsmPrimitive> primitives, Collection<? extends OsmPrimitive> ignore) {
     451    public static boolean checkAndConfirmOutlyingDelete(Collection<? extends OsmPrimitive> primitives, Collection<? extends OsmPrimitive> ignore) {
    457452        return Command.checkAndConfirmOutlyingOperation("delete",
    458453                tr("Delete confirmation"),
     
    466461                        + "This will cause problems because you don''t see the real object."
    467462                        + "<br>" + "Do you really want to delete?"),
    468                 area, primitives, ignore);
     463                primitives, ignore);
    469464    }
    470465
Note: See TracChangeset for help on using the changeset viewer.