On Fri, Jul 17, 2009 at 11:30:12AM +0300, Marko Mäkelä wrote: > There will be a combinatorial explosion if there is no way to write > this kind of rules: > > name += ref > name += operator
I thought that it would be nice to translate shelter=yes and shelter=no as well, by appending a '+' or '-' to the name. This could be useful when you are bicycling or walking, and you are looking for the nearest shelter to have a break or to escape from a rain shower. To avoid messy rules, I tried to introduce two auxiliary variables, name_ref and name_ref_op: name=* & ref=* { set name_ref='${name} (${ref})' } name=* & ref!=* { set name_ref='${name}' } ref=* & name!=* { set name_ref='${ref}' } name_ref=* & operator=* { set name_ref_op='${name_ref} - ${operator}' } name_ref=* & operator!=* { set name_ref_op='${name_ref}' } operator=* & name_ref!=* { set name_ref_op='${operator}' } No matter if I use 'set' or 'add', the action { name '${name_ref_op}' } will be ignored. Any ideas? While working on this, I mistyped =!* instead of !=*, and the style parser threw an exception. The ugly patch (which does not use any auxiliary variables) is attached. Marko
Index: resources/styles/default/points =================================================================== --- resources/styles/default/points (revision 1106) +++ resources/styles/default/points (working copy) @@ -85,7 +85,10 @@ amenity=university [0x2c05 resolution 21] amenity=zoo [0x2c07 resolution 21] -highway=bus_stop [0x2f08 resolution 21] +(highway=bus_stop | railway=tram_stop | railway=halt | railway=station) & shelter=yes { name '${name} ${ref} - ${operator}+' | '${name} ${ref}+' | '${name} - ${operator}+' | '${ref} ${operator}+' | '${name}+' | '${ref}+' | '${operator}+' } +(highway=bus_stop | railway=tram_stop | railway=halt | railway=station) & shelter=no { name '${name} ${ref} - ${operator}-' | '${name} ${ref}-' | '${name} - ${operator}-' | '${ref} ${operator}-' | '${name}-' | '${ref}-' | '${operator}-' } +highway=bus_stop | railway=tram_stop | railway=halt | railway=station { name '${name} ${ref} - ${operator}' | '${name} ${ref}' | '${name} - ${operator}' | '${ref} ${operator}' | '${name}' | '${ref}' | '${operator}' } +highway=bus_stop [0x2f17 resolution 20] highway=motorway_junction { name '${ref} ${name}' | '${ref}' | '${name}' } highway=motorway_junction [0x2000 resolution 16] @@ -133,7 +136,7 @@ railway=halt [0x2f08 resolution 21] railway=station [0x2f08 resolution 20] -railway=tram_stop [0x2f08 resolution 21] +railway=tram_stop [0x2f17 resolution 21] shop=bakers [0x2e02 resolution 20] shop=bakery [0x2e02 resolution 20]
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev