logo separator

[mkgmap-dev] [PATCH] pink line in dead end street.

From Johann Gail johann.gail at gmx.de on Sat Feb 14 23:12:48 GMT 2009

After some digging in the code I found a place, where is a special 
treatment for roads starting with or without a node.
I give it just a try and duplicated this code for the end of the road.

With these changes the wrong pink line in roads with dead end has 
disappeared in my cases.

If this patch is working, then the superfluous nodes at end of streets 
can be removed again.

Here the patch:

Index: src/uk/me/parabola/imgfmt/app/net/RoadDef.java
===================================================================
--- src/uk/me/parabola/imgfmt/app/net/RoadDef.java    (Revision 881)
+++ src/uk/me/parabola/imgfmt/app/net/RoadDef.java    (Arbeitskopie)
@@ -281,6 +281,7 @@
 
     // the first point in the road is a node (the above routing node)
     private boolean startsWithNode = true;
+    private boolean endsWithNode = true;
     // number of nodes in the road
     private int nnodes;
 
@@ -310,6 +311,10 @@
         startsWithNode = s;
     }
 
+    public void setEndsWithNode(boolean s) {
+        endsWithNode = s;
+    }
+
     public void setNumNodes(int n) {
         nnodes = n;
     }
@@ -343,17 +348,21 @@
         int nbits = nnodes;
         if (!startsWithNode)
             nbits++;
+        if (!endsWithNode)
+            nbits++;
         writer.putChar((char) nbits);
         boolean[] bits = new boolean[nbits];
         for (int i = 0; i < bits.length; i++)
             bits[i] = true;
         if (!startsWithNode)
             bits[0] = false;
+        if (!endsWithNode)
+            bits[bits.length] = false;
         for (int i = 0; i < bits.length; i += 8) {
             int b = 0;
-            for (int j = 0; j < bits.length - i; j++)
+            for (int j = i*8; j < bits.length; j++)
                 if (bits[j])
-                    b |= 1 << j;
+                    b |= 1 << j-i*8;
             writer.put((byte) b);
         }
     }


Index: src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java
===================================================================
--- src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java    (Revision 
881)
+++ src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java   
 (Arbeitskopie)
@@ -433,6 +433,7 @@
             }
 
             road.setStartsWithNode(nodeIndices.get(0) == 0);
+            road.setEndsWithNode(nodeIndices.get(numNodes-1) == 
points.size() - 1);
             road.setInternalNodes(hasInternalNodes);
         }

Index: src/uk/me/parabola/mkgmap/general/MapRoad.java
===================================================================
--- src/uk/me/parabola/mkgmap/general/MapRoad.java    (Revision 881)
+++ src/uk/me/parabola/mkgmap/general/MapRoad.java    (Arbeitskopie)
@@ -90,6 +90,10 @@
         this.roadDef.setStartsWithNode(s);
     }
 
+    public void setEndsWithNode(boolean s) {
+        this.roadDef.setStartsWithNode(s);
+    }
+
     public void setInternalNodes(boolean s) {
         this.roadDef.setInternalNodes(s);
     }




More information about the mkgmap-dev mailing list