Changeset 773 in josm for trunk/src


Ignore:
Timestamp:
2008-08-12T14:02:10+02:00 (16 years ago)
Author:
stoecker
Message:

correct way splitting for circular ways

File:
1 edited

Legend:

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

    r772 r773  
    9797                                        if (w.deleted || w.incomplete) continue;
    9898                                        int last = w.nodes.size()-1;
     99                                        Boolean circular = w.nodes.get(0).equals(w.nodes.get(last));
    99100                                        int i = 0;
    100101                                        for (Node wn : w.nodes) {
    101                                                 if ((i > 0) && (i < last) && n.equals(wn)) {
     102                                                if ((circular || (i > 0 && i < last)) && n.equals(wn)) {
    102103                                                        Integer old = wayOccurenceCounter.get(w);
    103104                                                        wayOccurenceCounter.put(w, (old == null) ? 1 : old+1);
     
    130131                        }
    131132
    132                         // If a way and nodes are selected, verify that the nodes are part of the way.
     133                // If a way and nodes are selected, verify that the nodes are part of the way.
    133134                } else if (selectedWay != null && selectedNodes != null) {
    134135
     
    216217
    217218                if (wayChunks.size() < 2) {
    218                         JOptionPane.showMessageDialog(Main.parent, tr("The way cannot be split at the selected nodes. (Hint: Select nodes in the middle of the way.)"));
     219                        if(wayChunks.get(0).get(0) == wayChunks.get(0).get(wayChunks.get(0).size()-1))
     220                                JOptionPane.showMessageDialog(Main.parent, tr("You must select two or more nodes to split a circular way."));
     221                        else
     222                                JOptionPane.showMessageDialog(Main.parent, tr("The way cannot be split at the selected nodes. (Hint: Select nodes in the middle of the way.)"));
    219223                        return;
    220224                }
    221                 Main.debug("wayChunks.size(): " + wayChunks.size());
    222                 Main.debug("way id: " + selectedWay.id);
     225                //Main.debug("wayChunks.size(): " + wayChunks.size());
     226                //Main.debug("way id: " + selectedWay.id);
    223227
    224228                // build a list of commands, and also a new selection list
     
    245249                        wayToAdd.nodes.addAll(chunkIt.next());
    246250                        commandList.add(new AddCommand(wayToAdd));
    247                         Main.debug("wayToAdd: " + wayToAdd);
     251                        //Main.debug("wayToAdd: " + wayToAdd);
    248252                        newSelection.add(wayToAdd);
    249253
Note: See TracChangeset for help on using the changeset viewer.