Here's something from last year that I forgot to push out.
I noticed that a RGM (Real Garmin Map) only contained a single
background rectangle (0x4b) for each layer. i.e. the rectangle was not
split like normal polys are. The attached patch makes our maps the same
so you just get one 0x4b poly per level.
I have not found any noticeable difference in mapsource behaviour with
this patch but it's probably worth using if it has no issues simply
because "that's how they do it".
Mark
diff --git a/src/uk/me/parabola/mkgmap/build/MapArea.java b/src/uk/me/parabola/mkgmap/build/MapArea.java
index 355f2cf..7590470 100644
--- a/src/uk/me/parabola/mkgmap/build/MapArea.java
+++ b/src/uk/me/parabola/mkgmap/build/MapArea.java
@@ -476,7 +476,10 @@ public class MapArea implements MapDataSource {
*/
private void addShape(MapShape s) {
shapes.add(s);
- addToBounds(s.getBounds());
+ if(s.getType() != 0x4b) {
+ // don't let the porky background polygon bloat the bounds
+ addToBounds(s.getBounds());
+ }
addSize(s, s.hasExtendedType()? XT_SHAPE_KIND : SHAPE_KIND);
}
@@ -533,11 +536,11 @@ public class MapArea implements MapDataSource {
int ycell = (y - ybase) / dy;
if (xcell < 0) {
- log.info("xcell was", xcell, "x", x, "xbase", xbase);
+ log.info("Element of type 0x" + Integer.toHexString(e.getType()) + " xcell was", xcell, "x", x, "xbase", xbase);
xcell = 0;
}
if (ycell < 0) {
- log.info("ycell was", ycell, "y", y, "ybase", ybase);
+ log.info("Element of type 0x" + Integer.toHexString(e.getType()) + " ycell was", ycell, "y", y, "ybase", ybase);
ycell = 0;
}
diff --git a/src/uk/me/parabola/mkgmap/filters/PolygonSizeSplitterFilter.java b/src/uk/me/parabola/mkgmap/filters/PolygonSizeSplitterFilter.java
index 29efb86..cc21187 100644
--- a/src/uk/me/parabola/mkgmap/filters/PolygonSizeSplitterFilter.java
+++ b/src/uk/me/parabola/mkgmap/filters/PolygonSizeSplitterFilter.java
@@ -94,7 +94,7 @@ public class PolygonSizeSplitterFilter extends PolygonSplitterBase implements Ma
}
private boolean isSizeOk(MapShape shape, int maxSize) {
- if (shape.getType() == 0x4a)
+ if (shape.getType() == 0x4a || shape.getType() == 0x4b)
return true;
Area bounds = shape.getBounds();
return bounds.getMaxDimention() < maxSize
diff --git a/src/uk/me/parabola/mkgmap/general/MapShape.java b/src/uk/me/parabola/mkgmap/general/MapShape.java
index 8845db3..c6b3c4a 100644
--- a/src/uk/me/parabola/mkgmap/general/MapShape.java
+++ b/src/uk/me/parabola/mkgmap/general/MapShape.java
@@ -198,5 +198,16 @@ public class MapShape extends MapLine {// So top code can link objects from here
return false;
}
+ public Coord getLocation() {
+ if(getType() == 0x4b) {
+ // the map coverage polygon is not split to fit the
+ // subdivision it is located in but its first point has to
+ // be within that subdivision so make the polygon's
+ // location the same as the first point to ensure that it
+ // starts within the subdivision
+ return getPoints().get(0);
+ }
+ return super.getLocation();
+ }
}
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev