Re: [mkgmap-dev] Why are all the un-named peaks called '6140565'?

2010-03-15 Thread Mark Burton

Hi Clinton,

 On Sun, Mar 14, 2010 at 11:29 PM, Mark Burton ma...@ordern.com wrote:
 
  Hey, that's a really great bug, it causes anonymous peaks to be
  named in honour of a bus stop!
 
 This may be caused by the def (default value) and height filters.
 I believe the statement is attempting the following:
 
 1. ${name|def:} use either the 'name' value, or as default '' (empty string).
 
 2. ${ele|height:m=ft|def:} Convert the elevation in meters to feet.
 If no 'ele' value is present, use an empty string.
 
 I have a feeling that the empty string part may be misinterpreted
 right now. It could be that the last value found is instead used.
 
 The relevant files are below, if you want to debug:
 
 DefaultFilter.java - called for the 'def' filter.
 
 HeightFilter.java - called for the 'height' filter (a subclass of
 ConvertFilter.java)
 
 ValueBuilder.java - instantiates the filter classes. This would be a
 good place to start.

Thanks for the info - I started to nose around in that area but haven't
got far - I shall take another look this evening.

One thing that struck me was (somewhere in that code) I saw where
it was testing to see if a passed in String value was null but it
didn't test if it was zero-length. So, like you above, I wonder if the
empty default value is causing problems.

Cheers,

Mark
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


[mkgmap-dev] Build mkgmap::trunk build #1602-811 failed (compilation failed)

2010-03-15 Thread teamcity
Build mkgmap::trunk build #1602-811 failed (compilation failed)
Agent: Iocaste
Build results: 
http://teamcity.mkgmap.org.uk/viewLog.html?buildId=2570buildTypeId=bt2

Compilation errors
==
/opt/TeamCity/buildAgent/work/49970accadf5db94/mkgmap/test/uk/me/parabola/mkgmap/osmstyle/StyledConverterTest.java:175:
 anonymous uk.me.parabola.mkgmap.osmstyle.StyledConverterTest$1 is not 
abstract and does not override abstract method addThroughRoute(long,long,long) 
in uk.me.parabola.mkgmap.general.MapCollector
MapCollector coll = new MapCollector() {
   ^
1 error
Compile failed; see the compiler error output for details.




Configure email notifications: 
http://teamcity.mkgmap.org.uk/profile.html?init=1tab=userNotifications
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


[mkgmap-dev] Commit: r1603: Add missing definition of addThroughRoute() to MapCollector sub-class.

2010-03-15 Thread svn commit

Version 1603 was commited by markb on 2010-03-15 14:20:59 + (Mon, 15 Mar 
2010) 

Add missing definition of addThroughRoute() to MapCollector sub-class.
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


[mkgmap-dev] [PATCH] Add a substring filter to the style language.

2010-03-15 Thread Jeffrey C. Ollie
This can be used to extract substrings from values.  If the name tag on an 
object was
equal to abcdef:

'${name|substring:2}' = 'cdef'
'${name|substring:2:4}' = 'cd'

As an example, it can be used to clean up the ref element on route relations:

type=route  route=road  network=US:I  ref ~ 'I\d+' { apply { set 
route_network='US:I'; set route_ref='${ref|substring:1}'; } }
type=route  route=road  network=US:I  ref ~ 'I \d+' { apply { set 
route_network='US:I'; set route_ref='${ref|substring:2}'; } }
type=route  route=road  network=US:I  ref ~ 'I-\d+' { apply { set 
route_network='US:I'; set route_ref='${ref|substring:2}'; } }
type=route  route=road  network=US:I  ref ~ '\d+' { apply { set 
route_network='US:I'; set route_ref='${ref}'; } }
---
 .../mkgmap/osmstyle/actions/SubstringFilter.java   |   66 
 .../mkgmap/osmstyle/actions/ValueBuilder.java  |2 +
 2 files changed, 68 insertions(+), 0 deletions(-)
 create mode 100644 
src/uk/me/parabola/mkgmap/osmstyle/actions/SubstringFilter.java

diff --git a/src/uk/me/parabola/mkgmap/osmstyle/actions/SubstringFilter.java 
b/src/uk/me/parabola/mkgmap/osmstyle/actions/SubstringFilter.java
new file mode 100644
index 000..823d402
--- /dev/null
+++ b/src/uk/me/parabola/mkgmap/osmstyle/actions/SubstringFilter.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2010 Jeffrey C. Ollie
+ * 
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ * 
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ * 
+ * 
+ * Author: Jeffrey C. Ollie
+ * Create date: 08-March-2010
+ */
+package uk.me.parabola.mkgmap.osmstyle.actions;
+
+import uk.me.parabola.mkgmap.reader.osm.Element;
+
+/**
+ * Extract a substring from a value
+ *
+ * @author Jeffrey C. Ollie
+ */
+public class SubstringFilter extends ValueFilter {
+private int args;
+private int start;
+private int end;
+
+public SubstringFilter(String arg) {
+   start = 0;
+   end = 0;
+   args = 0;
+
+   String[] temp = arg.split(:);
+
+   try {
+   if (temp.length == 1) {
+   start = Integer.parseInt(temp[0]);
+   args = 1;
+   } else if (temp.length == 2) {
+   start = Integer.parseInt(temp[0]);
+   end = Integer.parseInt(temp[1]);
+   args = 2;
+   } else {
+   start = 0;
+   end = 0;
+   args = 0;
+   }
+   } catch (NumberFormatException e) {
+   }
+}
+
+protected String doFilter(String value, Element el) {
+   if (value == null) return null;
+
+   if (args == 1) {
+   return value.substring(start);
+   }
+   if (args == 2) {
+   return value.substring(start, end);
+   }
+   return value;
+}
+}
diff --git a/src/uk/me/parabola/mkgmap/osmstyle/actions/ValueBuilder.java 
b/src/uk/me/parabola/mkgmap/osmstyle/actions/ValueBuilder.java
index 27b861d..1100b15 100644
--- a/src/uk/me/parabola/mkgmap/osmstyle/actions/ValueBuilder.java
+++ b/src/uk/me/parabola/mkgmap/osmstyle/actions/ValueBuilder.java
@@ -171,6 +171,8 @@ public class ValueBuilder {
item.addFilter(new HeightFilter(arg));
} else if (cmd.equals(not-equal)) {
item.addFilter(new NotEqualFilter(arg));
+   } else if (cmd.equals(substring)) {
+   item.addFilter(new SubstringFilter(arg));
}
}
 
-- 
1.7.0.1

___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] Why are all the un-named peaks called '6140565'?

2010-03-15 Thread Mark Burton

Steve,

 It turns out that the problem is Labels that are empty but not null. All 
 such labels, however generated, show as whatever label was defined right 
 after the first empty one.
 
 The attached patch should fix it.

That looks better, thanks.

Mark
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


[mkgmap-dev] Address search and State-question on Garmin Oregons

2010-03-15 Thread Daniela Duerbeck
Hi!

Today I bought a Garmin Oregon because of the great features.
Now I encountered the (I think) well known state-prompt-issue in the 
address search. But I find many questions concerning this issue but few 
answers. Is there already a wiki page?

TIA,
Dani
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


[mkgmap-dev] NSIS module patch

2010-03-15 Thread Nakor
Hello,

This is a patch for the NSIS module. I have seen that on some occasions 
the uninstaller does not get remove at uninstall and that moving it to 
be the last file removed improves the behavior.


Index: src/uk/me/parabola/mkgmap/combiners/NsisBuilder.java
===
--- src/uk/me/parabola/mkgmap/combiners/NsisBuilder.java(revision 1603)
+++ src/uk/me/parabola/mkgmap/combiners/NsisBuilder.java(working copy)
@@ -160,7 +160,6 @@
// Un-install files
pw.format(Locale.ROOT, Section \Uninstall\\n);
pw.format(Locale.ROOT,   Delete 
\$INSTDIR\\${MAPNAME}.img\\n);
-   pw.format(Locale.ROOT,   Delete 
\$INSTDIR\\Uninstall.exe\\n);
if (hasIndex) {
pw.format(Locale.ROOT,   Delete 
\$INSTDIR\\${MAPNAME}_mdr.img\\n);
pw.format(Locale.ROOT,   Delete 
\$INSTDIR\\${MAPNAME}.mdx\\n);
@@ -171,6 +170,7 @@
for (String file : mapList) {
pw.format(Locale.ROOT,   Delete 
\$INSTDIR\\%s.img\\n, file);
}
+   pw.format(Locale.ROOT,   Delete 
\$INSTDIR\\Uninstall.exe\\n);
pw.println();
pw.format(Locale.ROOT,   RmDir \$INSTDIR\\n);


Thanks,

   N.
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev