v1 + v1 - OK, here's the matched pair - patches for both the splitter and mkgmap.
With these in place, the mapsource mouse works as expected across all tile boundaries right up to the outer boundaries. No weird overlap of tile and overview map. Spot on. Please could some others give this a test and confirm that the rounding is now correct. ----------------- Thinking some more about what I was seeing in mapsource when mousing around the Baltic map, I came to the conclusion that the edges of the overview map bounding boxes where in the wrong place so I took a look at mkgmap where it rounds those coords and came up with the attached fix. No great theory here, I just dicked around until it worked as I expected. For the Baltic map, the mouse now works right up to each boundary in both lat and lon directions whereas before it would only work right on one side of each boundary. Please try the patch, especially for maps that are W of Greenwich and S of the equator and see if the overview boxes are right. Cheers, Mark
diff --git a/src/uk/me/parabola/mkgmap/combiners/TdbBuilder.java b/src/uk/me/parabola/mkgmap/combiners/TdbBuilder.java index 0f74d96..3eb5ae6 100644 --- a/src/uk/me/parabola/mkgmap/combiners/TdbBuilder.java +++ b/src/uk/me/parabola/mkgmap/combiners/TdbBuilder.java @@ -149,9 +149,9 @@ public class TdbBuilder implements Combiner { //System.out.printf("mask %x\n", overviewMask); //System.out.println("overviewSource.getShift() = " + overviewSource.getShift()); - int maxLon = roundUp(bounds.getMaxLong(), overviewMask); + int maxLon = roundDown(bounds.getMaxLong(), overviewMask); int maxLat = roundUp(bounds.getMaxLat(), overviewMask); - int minLat = roundDown(bounds.getMinLat(), overviewMask); + int minLat = roundUp(bounds.getMinLat(), overviewMask); int minLon = roundDown(bounds.getMinLong(), overviewMask); //System.out.printf("maxLat 0x%x, modified=0x%x\n", bounds.getMaxLat(), maxLat);
diff --git a/src/uk/me/parabola/splitter/RoundingUtils.java b/src/uk/me/parabola/splitter/RoundingUtils.java index eef18b3..f89922f 100644 --- a/src/uk/me/parabola/splitter/RoundingUtils.java +++ b/src/uk/me/parabola/splitter/RoundingUtils.java @@ -71,7 +71,7 @@ public class RoundingUtils { int minLat = Math.max(b.getMinLat(), Utils.toMapUnit(-85.0d)); int maxLat = Math.min(b.getMaxLat(), Utils.toMapUnit(85.0d)); - int roundedMinLat = roundDown(minLat, shift); + int roundedMinLat = roundUp(minLat, shift); int roundedMaxLat = roundUp(maxLat, shift); if ((roundedMinLat & alignment) != (roundedMaxLat & alignment)) { // The new height isn't a multiple of twice the alignment. Fix it by pushing @@ -87,7 +87,7 @@ public class RoundingUtils { assert (roundedMaxLat - roundedMinLat) % doubleAlignment == 0 : "The area's height is not a multiple of " + doubleAlignment; int roundedMinLon = roundDown(b.getMinLong(), shift); - int roundedMaxLon = roundUp(b.getMaxLong(), shift); + int roundedMaxLon = roundDown(b.getMaxLong(), shift); if ((roundedMinLon & alignment) != (roundedMaxLon & alignment)) { // The new width isn't a multiple of twice the alignment. Fix it by pushing // the tile edge that moved the least out by another 'alignment' units.
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev