Changeset 351 in josm for trunk


Ignore:
Timestamp:
2007-10-07T22:43:56+02:00 (17 years ago)
Author:
gebner
Message:

Make add node and connect more often reuse ways.

File:
1 edited

Legend:

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

    r343 r351  
    150150                                        return;
    151151                        }
    152                         // If ALT is held, instead of creating a new node, re-use an existing
     152                        // If SHIFT is held, instead of creating a new node, re-use an existing
    153153                        // node (making this action identical to AddSegmentAction with the
    154154                        // small difference that the node used will then be selected to allow
     
    191191                                        cmds.add(new AddCommand(way));
    192192                                } else {
    193                                         if (insertInto != null && way == insertInto.way) {
    194                                                 way = newInsertInto;
     193                                        if (insertInto != null) {
     194                                                if (way == insertInto.way) {
     195                                                        way = newInsertInto;
     196                                                }
    195197                                        } else {
    196198                                                Way wnew = new Way(way);
     
    222224                Way way = null;
    223225                for (Way w : Main.ds.ways) {
     226                        if (w.nodes.size() < 1) continue;
    224227                        int i = w.nodes.indexOf(n);
    225                         if (i == -1) continue;
    226                         if (i == 0 || i == w.nodes.size() - 1) {
    227                                         if (way != null)
    228                                                 return null;
    229                                         way = w;
    230                                 }
     228                        if (w.nodes.get(0) == n || w.nodes.get(w.nodes.size() - 1) == n) {
     229                                if (way != null)
     230                                        return null;
     231                                way = w;
    231232                        }
     233                }
    232234                return way;
    233235        }
Note: See TracChangeset for help on using the changeset viewer.