logo separator

[mkgmap-dev] Commit: r888: Add zero to the bit array when the road does not end in a node

From Robert Vollmert rvollmert-lists at gmx.net on Sun Feb 15 08:00:32 GMT 2009

On Feb 15, 2009, at 00:44, svn commit wrote:

> Version 888 was commited by steve on 2009-02-14 23:44:24 +0000 (Sat,  
> 14 Feb 2009)
>
> Add zero to the bit array when the road does not end in a node
> as well as when it does not start with a node.

I based the startsWithNode special-casing on the evidence I saw in  
cGPSmapper-created maps: http://www.mkgmap.org.uk/pipermail/mkgmap-dev/2008q4/000220.html

There's never an increased nbits for a road not ending in a node. I'd  
prefer to leave this change out unless it's shown to help.

Of course, if cGPSmapper counts missing nodes at road ends a bug,  
perhaps we shouldn't try to imitate what it does if they're present  
too faithfully.

> Also fix the loop that writes the array out.

To fix the bug, I'd prefer this change (assuming I didn't mess it up):

--- RoadDef.java	(revision 887)
+++ RoadDef.java	(working copy)
@@ -351,8 +351,8 @@
  			bits[0] = false;
  		for (int i = 0; i < bits.length; i += 8) {
  			int b = 0;
-			for (int j = 0; j < bits.length - i; j++)
-				if (bits[j])
+			for (int j = 0; j < 8 && j < bits.length - i; j++)
+				if (bits[i+j])
  					b |= 1 << j;
  			writer.put((byte) b);


Cheers
Robert




More information about the mkgmap-dev mailing list