Hi,

okay, first part.

In my testing it turned out, that the SizeFilter and the
DouglasPeuckerFilter either dropped my small rectangles or
converted them to a triangle.

Removing the filters fixed this for me.


If you think, that the generated rectangles should be large
enough, so that they're not "cleaned":
- If this is so, then there really is no reason for
  calling the filters anyway, they should be NOPs in that
  case. So we can optimize them away.
- I hope to show in later patches (don't hold your breath!
  I will go slowly step by step. There is no need to hurry
  anyway) that smaller rects might make some sense.

So this simple patch disables both filters for the overview
map.

If nobody objects or I get some "Go", I'll commit it soon.


    Elrond
Index: uk/me/parabola/mkgmap/combiners/TdbBuilder.java
===================================================================
--- uk/me/parabola/mkgmap/combiners/TdbBuilder.java	(revision 1065)
+++ uk/me/parabola/mkgmap/combiners/TdbBuilder.java	(working copy)
@@ -227,6 +227,8 @@
 	 */
 	private void writeOverviewMap() {
 		MapBuilder mb = new MapBuilder();
+		mb.setEnableLineCleanFilters(false);
+
 		FileSystemParam params = new FileSystemParam();
 		params.setBlockSize(512);
 		params.setMapDescription(overviewDescription);
Index: uk/me/parabola/mkgmap/build/MapBuilder.java
===================================================================
--- uk/me/parabola/mkgmap/build/MapBuilder.java	(revision 1065)
+++ uk/me/parabola/mkgmap/build/MapBuilder.java	(working copy)
@@ -108,6 +108,7 @@
 	private int		poiDisplayFlags;
 	private boolean sortRoads = true;
 	private static final double FILTER_DISTANCE = 2.6;
+	private boolean enableLineCleanFilters = true;
 
 	public MapBuilder() {
 		regionName = null;
@@ -819,7 +820,7 @@
 		config.setResolution(res);
 
 		LayerFilterChain filters = new LayerFilterChain(config);
-		if(res < 24) {
+		if (enableLineCleanFilters && (res < 24)) {
 			filters.addFilter(new SizeFilter());
 			filters.addFilter(new DouglasPeuckerFilter(FILTER_DISTANCE));
 		}
@@ -855,7 +856,7 @@
 		FilterConfig config = new FilterConfig();
 		config.setResolution(res);
 		LayerFilterChain filters = new LayerFilterChain(config);
-		if(res < 24) {
+		if (enableLineCleanFilters && (res < 24)) {
 			filters.addFilter(new SizeFilter());
 			//DouglasPeucker behaves at the moment not really optimal at low zooms, but acceptable.
 			//Is there an similar algorithm for polygons?
@@ -907,6 +908,10 @@
 		this.doRoads = doRoads;
 	}
 
+	public void setEnableLineCleanFilters(boolean enable) {
+		this.enableLineCleanFilters = enable;
+	}
+
 	private static class SourceSubdiv {
 		private final MapDataSource source;
 		private final Subdivision subdiv;
_______________________________________________
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to