[mkgmap] Bug or missunderstanding?

I'm looking at the moment at RoadDef.java, lines 352 to 358. As I understand it by the comments, there should be a bitfield converted into a byte array and in some cases be shifted by one. I think the inner loop in 354 is wrong. At least I see no sense in the loop limits. Can anyone give me a comment or explain what is intended here? The next question appearing to me: What happens, if the road has no final node (a dead end road)? Is there also a zero bit needed? // this is related to the number of nodes, but there // is more to it... // For now, shift by one if the first node is not a // routing node. Supposedly, other holes are also // possible. // This might be unnecessary if we just make sure // that every road starts with a node. int nbits = nnodes; if (!startsWithNode) 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; 352: for (int i = 0; i < bits.length; i += 8) { 353: int b = 0; 354: for (int j = 0; j < bits.length - i; j++) if (bits[j]) b |= 1 << j; writer.put((byte) b); }

On Sat, Feb 14, 2009 at 11:07:59PM +0100, Johann Gail wrote:
The next question appearing to me: What happens, if the road has no final node (a dead end road)? Is there also a zero bit needed?
There is code in RoadDef#writeNod2 to add an extra bit set to zero if the road does not start with a node. It would probably be worth trying the similar thing in the case where a road does not end in a node. But I don't think we really understand what bit array is for so it is difficult to know. ..Steve

There is code in RoadDef#writeNod2 to add an extra bit set to zero if the road does not start with a node.
It would probably be worth trying the similar thing in the case where a road does not end in a node.
But I don't think we really understand what bit array is for so it is difficult to know.
Yes, but what is with the current loop code? In the inner loop gets always the same first 8 bits written in the byte. I don't know what the bits mean, but this is IMO clearly a bug.
participants (2)
-
Johann Gail
-
Steve Ratcliffe