Hi
Could everyone who is interested in this please try the attached patch.
It seems to work on the example I was looking at, but of course problems
may just have moved elsewhere so please check thing are OK
more widely. It would be good to know if it makes a difference to
inter tile routing as well.
..Steve
Index: src/uk/me/parabola/imgfmt/app/trergn/Subdivision.java
===================================================================
--- src/uk/me/parabola/imgfmt/app/trergn/Subdivision.java (revision 988)
+++ src/uk/me/parabola/imgfmt/app/trergn/Subdivision.java Wed Jul 29 10:53:31 BST 2009
@@ -96,15 +96,16 @@
this.zoomLevel = z;
int shift = getShift();
+ int mask = getMask();
this.latitude = (area.getMinLat() + area.getMaxLat())/2;
this.longitude = (area.getMinLong() + area.getMaxLong())/2;
- int w = (area.getWidth() + (1<<shift)) / 2 >> shift;
+ int w = (area.getWidth()/2 + mask) >> shift;
if (w > 0x7fff)
w = 0x7fff;
- int h = (area.getHeight() + (1 << shift)) / 2 >> shift;
+ int h = (area.getHeight()/2 + mask) >> shift;
if (h > 0xffff)
h = 0xffff;
@@ -167,6 +168,16 @@
}
/**
+ * Get the shift mask. The bits that will be lost due to the resolution
+ * shift level.
+ *
+ * @return A bit mask with the lower <i>shift</i> bits set.
+ */
+ public int getMask() {
+ return (1 << getShift()) - 1;
+ }
+
+ /**
* Get the resolution of this division. Resolution goes from 1 to 24
* and the higher the number the more detail there is.
*
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev