Hi!

I think I have a solution for this nuisance, but first of all a question, as I don't know the data structure by heart yet: is the list of nodes of a way guaranteed to be sorted by their occurence in the way? Meaning: is the first node in the list always the first of the way and likewise with the last?

If so, the attached patch solves Ticket #488.

Best Regards, Florian.

<cid:part1.07030505.04070308@yahoo.de>
Index: src/org/openstreetmap/josm/actions/SplitWayAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/SplitWayAction.java      (revision 771)
+++ src/org/openstreetmap/josm/actions/SplitWayAction.java      (working copy)
@@ -95,12 +95,14 @@
                        for (Node n : selectedNodes) {
                                for (Way w : Main.ds.ways) {
                                        if (w.deleted || w.incomplete) continue;
+                                       int i = 0;
                                        for (Node wn : w.nodes) {
-                                               if (n.equals(wn)) {
+                                               if (n.equals(wn) && (i>0) && 
(i<(w.nodes.size()-1))) {
                                                        Integer old = 
wayOccurenceCounter.get(w);
                                                        
wayOccurenceCounter.put(w, (old == null) ? 1 : old+1);
                                                        break;
                                                }
+                                               i++;
                                        }
                                }
                        }
Index: .classpath
===================================================================
--- .classpath  (revision 771)
+++ .classpath  (working copy)
@@ -1,11 +1,11 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-       <classpathentry kind="src" path="src"/>
-       <classpathentry excluding="build/|dist/|src/|test/" 
including="images/|presets/|styles/" kind="src" path=""/>
-       <classpathentry kind="con" 
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-       <classpathentry kind="lib" 
path="lib/metadata-extractor-2.3.1-nosun.jar"/>
-       <classpathentry kind="lib" path="lib/gettext-commons-0.9.jar"/>
-       <classpathentry kind="con" 
path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
-       <classpathentry kind="lib" path="lib/jfcunit.jar"/>
-       <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry excluding="build/|dist/|src/|test/" 
including="images/|presets/|styles/" kind="src" path=""/>
+       <classpathentry kind="con" 
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+       <classpathentry kind="lib" 
path="lib/metadata-extractor-2.3.1-nosun.jar"/>
+       <classpathentry kind="con" 
path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+       <classpathentry kind="lib" path="lib/jfcunit.jar"/>
+       <classpathentry kind="lib" path="lib/gettext-commons-0.9.2.jar"/>
+       <classpathentry kind="output" path="bin"/>
+</classpath>
_______________________________________________
josm-dev mailing list
josm-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/josm-dev

Reply via email to