Ignore:
Timestamp:
2010-05-11T08:41:44+02:00 (14 years ago)
Author:
stoecker
Message:

fix #4995 - improve area joinging reliability

File:
1 edited

Legend:

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

    r3170 r3230  
    103103    }
    104104
    105     public void combineWays(Collection<Way> ways) {
     105    public Way combineWays(Collection<Way> ways) {
    106106
    107107        // prepare and clean the list of ways to combine
    108108        //
    109109        if (ways == null || ways.isEmpty())
    110             return;
     110            return null;
    111111        ways.remove(null); // just in case -  remove all null ways from the collection
    112112        ways = new HashSet<Way>(ways); // remove duplicates
     
    119119        if (path == null) {
    120120            warnCombiningImpossible();
    121             return;
     121            return null;
    122122        }
    123123        // check whether any ways have been reversed in the process
     
    142142        }
    143143        if ((reversedWays != null) && !reversedWays.isEmpty()) {
    144             if (!confirmChangeDirectionOfWays()) return;
     144            if (!confirmChangeDirectionOfWays()) return null;
    145145            // filter out ways that have no direction-dependent tags
    146146            unreversedWays = ReverseWayTagCorrector.irreversibleWays(unreversedWays);
     
    167167                    }
    168168                    catch(UserCancelException ex) {
    169                         return;
     169                        return null;
    170170                    }
    171171                }
     
    207207            dialog.setVisible(true);
    208208            if (dialog.isCancelled())
    209                 return;
     209                return null;
    210210        }
    211211
     
    218218        cmds.add(new DeleteCommand(deletedWays));
    219219        final SequenceCommand sequenceCommand = new SequenceCommand(tr("Combine {0} ways", ways.size()), cmds);
    220 
    221         // update gui
    222         final Way selectedWay = targetWay;
    223         Runnable guiTask = new Runnable() {
    224             public void run() {
    225                 Main.main.undoRedo.add(sequenceCommand);
    226                 getCurrentDataSet().setSelected(selectedWay);
    227             }
    228         };
    229         if (SwingUtilities.isEventDispatchThread()) {
    230             guiTask.run();
    231         } else {
    232             SwingUtilities.invokeLater(guiTask);
    233         }
     220        Main.main.undoRedo.add(sequenceCommand);
     221
     222        return targetWay;
    234223    }
    235224
     
    248237            return;
    249238        }
    250         combineWays(selectedWays);
     239        // combine and update gui
     240        final Way selectedWay = combineWays(selectedWays);
     241        if(selectedWay != null)
     242        {
     243            Runnable guiTask = new Runnable() {
     244                public void run() {
     245                    getCurrentDataSet().setSelected(selectedWay);
     246                }
     247            };
     248            if (SwingUtilities.isEventDispatchThread()) {
     249                guiTask.run();
     250            } else {
     251                SwingUtilities.invokeLater(guiTask);
     252            }
     253        }
    251254    }
    252255
Note: See TracChangeset for help on using the changeset viewer.