Ignore:
Timestamp:
2023-09-18T19:27:57+02:00 (14 months ago)
Author:
taylor.smock
Message:

See #23170: Better behavior around undo/redo, only delete ways with one referrer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/ReconstructPolygonAction.java

    r36136 r36142  
    6464        boolean wont = false;
    6565        for (RelationMember m : r.getMembers()) {
    66             if (m.isWay() && m.getWay().getReferrers().size() == 1) {
     66            if (m.isWay()) {
    6767                ways.add(m.getWay());
    6868            } else {
     
    157157            tags.remove("type");
    158158
    159             // then delete ways that are not relevant (do not take part in other relations of have strange tags)
     159            // then delete ways that are not relevant (do not take part in other relations or have strange tags)
    160160            Way candidateWay = null;
    161161            for (Way w : p.ways) {
    162                 if (w.getReferrers().equals(relations)) {
     162                if (w.getReferrers().size() == 1) {
    163163                    // check tags that remain
    164164                    Set<String> keys = new HashSet<>(w.keySet());
     
    192192        // only delete the relation if it hasn't been re-used
    193193        if (!relationReused) {
    194             commands.add(relationDeleteCommand);
     194            // The relation needs to be deleted first, so that undo/redo continue to work properly
     195            commands.add(0, relationDeleteCommand);
    195196        }
    196197
Note: See TracChangeset for help on using the changeset viewer.