Ignore:
Timestamp:
2011-09-24T22:09:19+02:00 (10 years ago)
Author:
simon04
Message:

fix #5407 - simplify way: dialog asking to delete nodes outside boundary is missing "never ask again" checkbox

File:
1 edited

Legend:

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

    r4458 r4461  
    183183     * Request confirmation if he is.
    184184     *
    185      * @param layer the layer in whose context data is deleted
     185     * @param operation the operation name which is used for setting some preferences
     186     * @param dialogTitle the title of the dialog being displayed
     187     * @param outsideDialogMessage the message text to be displayed when data is outside of the download area
     188     * @param incompleteDialogMessage the message text to be displayed when data is incomplete
     189     * @param area the area used to determine whether data is outlying
    186190     * @param primitives the primitives to operate on
    187      * @return true, if deleting outlying primitives is OK; false, otherwise
     191     * @param ignore {@code null} or a primitive to be ignored
     192     * @return true, if operating on outlying primitives is OK; false, otherwise
    188193     */
    189194    public static boolean checkAndConfirmOutlyingOperation(String operation,
     
    196201                if (osm.isIncomplete()) {
    197202                    incomplete = true;
    198                 } else if (osm instanceof Node && !osm.isNewOrUndeleted()
    199                         && !area.contains(((Node) osm).getCoor())
     203                } else if (isOutlying(osm, area)
    200204                        && (ignore == null || !ignore.equals(osm))) {
    201205                    outside = true;
     
    240244    }
    241245
     246    private static boolean isOutlying(OsmPrimitive osm, Area area) {
     247        if (osm instanceof Node) {
     248            return !osm.isNewOrUndeleted() && !area.contains(((Node) osm).getCoor());
     249        } else if (osm instanceof Way) {
     250            for (Node n : ((Way) osm).getNodes()) {
     251                if (isOutlying(n, area)) {
     252                    return true;
     253                }
     254            }
     255            return false;
     256        }
     257        return false;
     258    }
    242259}
Note: See TracChangeset for help on using the changeset viewer.