On 2012-01-13 16:10, Steve Ratcliffe wrote:
On 13/01/12 19:05, Richard Hansen wrote:
Hi all,

I have stumbled across a couple of mkgmap command-line argument parsing
bugs:

1.  (all?) command-line arguments after '-c template.args' are ignored

The order of options intentionally matters. Options only affect files
that follow them on the command line (or within a command file). So I
don't think that there is a bug there.

2.  '--generate-sea' produces the following error message (I have to use
'--generate-sea=multipolygon' even though multipolygon is supposedly the
default):

That is something that should be fixed.

Attached are two patches to address these two issues.

Thanks,
Richard
>From 3337a836c0f332b8c07e9df9144a95731935a8b7 Mon Sep 17 00:00:00 2001
From: Richard Hansen <[email protected]>
Date: Sat, 14 Jan 2012 17:45:42 -0500
Subject: [PATCH 1/2] Skip empty sea generation options

Silences the following warnings when --generate-sea is given:

Unknown sea generation option ''
Known sea generation options are:
  multipolygon        use a multipolygon (default)
  polygons | no-mp    use polygons rather than a multipolygon
  no-sea-sectors      disable use of "sea sectors"
  extend-sea-sectors  extend coastline to reach border
  land-tag=TAG=VAL    tag to use for land polygons (default natural=land)
  close-gaps=NUM      close gaps in coastline that are less than this distance (metres)
  floodblocker        enable the floodblocker (for multipolgon only)
  fbgap=NUM           points closer to the coastline are ignored for flood blocking (default 40)
  fbthres=NUM         min points contained in a polygon to be flood blocked (default 20)
  fbratio=NUM         min ratio (points/area size) for flood blocking (default 0.5)
---
 .../parabola/mkgmap/reader/osm/SeaGenerator.java   |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/uk/me/parabola/mkgmap/reader/osm/SeaGenerator.java b/src/uk/me/parabola/mkgmap/reader/osm/SeaGenerator.java
index 80ca6e0..ef6ef94 100644
--- a/src/uk/me/parabola/mkgmap/reader/osm/SeaGenerator.java
+++ b/src/uk/me/parabola/mkgmap/reader/osm/SeaGenerator.java
@@ -100,6 +100,8 @@ public class SeaGenerator extends OsmReadingHooksAdaptor {
 					fbThreshold = (int)Double.parseDouble(o.substring("fbthres=".length()));
 				else if("fbdebug".equals(o)) 
 					fbDebug = true;
+				else if(o.isEmpty())
+					continue;
 				else {
 					if(!"help".equals(o))
 						System.err.println("Unknown sea generation option '" + o + "'");
-- 
1.7.8.2

>From c87d000af2532c2179284f270bc89da0a4880032 Mon Sep 17 00:00:00 2001
From: Richard Hansen <[email protected]>
Date: Sat, 14 Jan 2012 17:49:22 -0500
Subject: [PATCH 2/2] Document option order significance in --help=options

---
 resources/help/en/options |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/resources/help/en/options b/resources/help/en/options
index 4370779..f7b46c2 100644
--- a/resources/help/en/options
+++ b/resources/help/en/options
@@ -1,3 +1,7 @@
+Note that option order is significant:  An option only applies to
+subsequent input files.  (So if you are using splitter, you probably
+want to put most of your options before '-c template.args'.)
+
 General options:
 
 --help=topic
-- 
1.7.8.2

_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to