
On Wed, Aug 05, 2009 at 12:23:48AM +0200, Thilo Hannemann wrote:
5. As the name mangling might get really complex how about factoring the mkgmap code in a way that makes it easy to write your own name mangling code in Java? One could for example introduce another keyword for the type part that selects a 'namefinder' for that part. The namefinder would be a Java routine that will be compiled as part of mkgmap. Probably everybody discussing in this thread here compiles his own version of mkgmap anyway. Writing a name mangling function in Java might actually be easier than coming up with some super-powerful syntax for the style files. Useful namefinder routines could then be integrated into trunk for general usage.
Example for that:
mtb:scale=0 & mtb:scale:uphill=0 & route=mtb [0x?? namefinder=MTBROUTE road_class=? road_speed=? level ?]
+1 for that. One of the built-in name finders (I can contribute it) would embed name, operator, ref, (shelter|covered)=(yes|no), fee=(no|*) in the name. This would be useful for bus stops, parking, and various amenities. The resulting label could be something like this: name (ref) [operator] [+-][$!] The + or - would correspond to (covered|shelter)=(yes|no), and the ! or $ would correspond to fee=no or fee=*. Any of the components could be absent. E.g., a parking place with no name, operator or fee would be named "!" (and given the parking place symbol). Later on, we might want to pass a format string to the namefinder routine, for localization purposes, e.g., for using a different currency symbol. Marko