Changeset 355 in josm for trunk/src


Ignore:
Timestamp:
2007-10-09T12:52:06+02:00 (17 years ago)
Author:
gebner
Message:

Split circular ways properly.

File:
1 edited

Legend:

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

    r343 r355  
    194194                                currentWayChunk.add(currentNode);
    195195                                wayChunks.add(currentWayChunk);
    196                                 }
    197                         }
     196                        }
     197                }
     198
     199                // Handle circular ways specially.
     200                // If you split at a circular way at two nodes, you just want to split
     201                // it at these points, not also at the former endpoint.
     202                // So if the last node is the same first node, join the last and the
     203                // first way chunk.
     204                List<Node> lastWayChunk = wayChunks.get(wayChunks.size() - 1);
     205                if (wayChunks.size() >= 2 && wayChunks.get(0).get(0) == lastWayChunk.get(lastWayChunk.size() - 1)) {
     206                        lastWayChunk.remove(lastWayChunk.size() - 1);
     207                        lastWayChunk.addAll(wayChunks.get(0));
     208                        wayChunks.remove(wayChunks.size() - 1);
     209                        wayChunks.set(0, lastWayChunk);
     210                }
    198211
    199212                if (wayChunks.size() < 2) {
Note: See TracChangeset for help on using the changeset viewer.