logo separator

[mkgmap-dev] Append Name with general rules via style-file

From Steve Ratcliffe steve at parabola.me.uk on Fri Aug 7 14:40:47 BST 2009


Hi Felix,

I am trying to work out what doesn't work here.  In general
anything that relies on the order that actions are run in
will not work reliably (see my previous post).

I will put each question/comment in a separate post to keep
things clear and separate.

The following part of the file could be much reduced:

> mtb:scale=0 & mtb:scale:uphill=0 & route=mtb { name 'mtbrt00 ${name}' |
> 'mtbrt00' }
> mtb:scale=0 & mtb:scale:uphill=1 & route=mtb { name 'mtbrt01 ${name}' |
> 'mtbrt01' }
> mtb:scale=0 & mtb:scale:uphill=2 & route=mtb { name 'mtbrt02 ${name}' |
> 'mtbrt02' }
> mtb:scale=0 & mtb:scale:uphill=3 & route=mtb { name 'mtbrt03 ${name}' |
> 'mtbrt03' }
> mtb:scale=0 & mtb:scale:uphill=4 & route=mtb { name 'mtbrt04 ${name}' |
> 'mtbrt04' }
> mtb:scale=0 & mtb:scale:uphill=5 & route=mtb { name 'mtbrt05 ${name}' |
> 'mtbrt05' }
> mtb:scale=1 & mtb:scale:uphill=1 & route=mtb { name 'mtbrt11 ${name}' |
> 'mtbrt11' }
> mtb:scale=1 & mtb:scale:uphill=2 & route=mtb { name 'mtbrt12 ${name}' |
> 'mtbrt12' }
> mtb:scale=1 & mtb:scale:uphill=3 & route=mtb { name 'mtbrt13 ${name}' |
> 'mtbrt13' }
> mtb:scale=1 & mtb:scale:uphill=4 & route=mtb { name 'mtbrt14 ${name}' |
> 'mtbrt14' }
> mtb:scale=1 & mtb:scale:uphill=5 & route=mtb { name 'mtbrt15 ${name}' |
> 'mtbrt15' }
> mtb:scale=2 & mtb:scale:uphill=2 & route=mtb { name 'mtbrt22 ${name}' |
> 'mtbrt22' }
> mtb:scale=2 & mtb:scale:uphill=3 & route=mtb { name 'mtbrt23 ${name}' |
> 'mtbrt23' }
> mtb:scale=2 & mtb:scale:uphill=4 & route=mtb { name 'mtbrt24 ${name}' |
> 'mtbrt24' }
> mtb:scale=2 & mtb:scale:uphill=5 & route=mtb { name 'mtbrt25 ${name}' |
> 'mtbrt25' }
> mtb:scale=3 & mtb:scale:uphill=3 & route=mtb { name 'mtbrt33 ${name}' |
> 'mtbrt33' }
> mtb:scale=3 & mtb:scale:uphill=4 & route=mtb { name 'mtbrt34 ${name}' |
> 'mtbrt34' }
> mtb:scale=3 & mtb:scale:uphill=5 & route=mtb { name 'mtbrt35 ${name}' |
> 'mtbrt35' }
> mtb:scale=4 & mtb:scale:uphill=4 & route=mtb { name 'mtbrt44 ${name}' |
> 'mtbrt44' }
> mtb:scale=4 & mtb:scale:uphill=5 & route=mtb { name 'mtbrt45 ${name}' |
> 'mtbrt45' }
> mtb:scale=5 & mtb:scale:uphill=5 & route=mtb { name 'mtbrt55 ${name}' |
> 'mtbrt55' }
>
> mtb:scale:uphill=0 & route=mtb { name 'mtbrt.0 ${name}' | 'mtbrt.0' }
> mtb:scale:uphill=1 & route=mtb { name 'mtbrt.1 ${name}' | 'mtbrt.1' }
> mtb:scale:uphill=2 & route=mtb { name 'mtbrt.2 ${name}' | 'mtbrt.2' }
> mtb:scale:uphill=3 & route=mtb { name 'mtbrt.3 ${name}' | 'mtbrt.3' }
> mtb:scale:uphill=4 & route=mtb { name 'mtbrt.4 ${name}' | 'mtbrt.4' }
> mtb:scale:uphill=5 & route=mtb { name 'mtbrt.5 ${name}' | 'mtbrt.5' }
>
> mtb:scale=0 & route=mtb { name 'mtbrt0. ${name}' | 'mtbrt0.' }
> mtb:scale=1 & route=mtb { name 'mtbrt1. ${name}' | 'mtbrt1.' }
> mtb:scale=2 & route=mtb { name 'mtbrt2. ${name}' | 'mtbrt2.' }
> mtb:scale=3 & route=mtb { name 'mtbrt3. ${name}' | 'mtbrt3.' }
> mtb:scale=4 & route=mtb { name 'mtbrt4. ${name}' | 'mtbrt4.' }
> mtb:scale=5 & route=mtb { name 'mtbrt5. ${name}' | 'mtbrt5.' }
>
> mtb:scale=0 & mtb:scale:uphill=0 { name 'mtb00 ${name}' | 'mtb00' }
> mtb:scale=0 & mtb:scale:uphill=1 { name 'mtb01 ${name}' | 'mtb01' }
> mtb:scale=0 & mtb:scale:uphill=2 { name 'mtb02 ${name}' | 'mtb02' }
> mtb:scale=0 & mtb:scale:uphill=3 { name 'mtb03 ${name}' | 'mtb03' }
> mtb:scale=0 & mtb:scale:uphill=4 { name 'mtb04 ${name}' | 'mtb04' }
> mtb:scale=0 & mtb:scale:uphill=5 { name 'mtb05 ${name}' | 'mtb05' }
> mtb:scale=1 & mtb:scale:uphill=1 { name 'mtb11 ${name}' | 'mtb11' }
> mtb:scale=1 & mtb:scale:uphill=2 { name 'mtb12 ${name}' | 'mtb12' }
> mtb:scale=1 & mtb:scale:uphill=3 { name 'mtb13 ${name}' | 'mtb13' }
> mtb:scale=1 & mtb:scale:uphill=4 { name 'mtb14 ${name}' | 'mtb14' }
> mtb:scale=1 & mtb:scale:uphill=5 { name 'mtb15 ${name}' | 'mtb15' }
> mtb:scale=2 & mtb:scale:uphill=2 { name 'mtb22 ${name}' | 'mtb22' }
> mtb:scale=2 & mtb:scale:uphill=3 { name 'mtb23 ${name}' | 'mtb23' }
> mtb:scale=2 & mtb:scale:uphill=4 { name 'mtb24 ${name}' | 'mtb24' }
> mtb:scale=2 & mtb:scale:uphill=5 { name 'mtb25 ${name}' | 'mtb25' }
> mtb:scale=3 & mtb:scale:uphill=3 { name 'mtb33 ${name}' | 'mtb33' }
> mtb:scale=3 & mtb:scale:uphill=4 { name 'mtb34 ${name}' | 'mtb34' }
> mtb:scale=3 & mtb:scale:uphill=5 { name 'mtb35 ${name}' | 'mtb35' }
> mtb:scale=4 & mtb:scale:uphill=4 { name 'mtb44 ${name}' | 'mtb44' }
> mtb:scale=4 & mtb:scale:uphill=5 { name 'mtb45 ${name}' | 'mtb45' }
> mtb:scale=5 & mtb:scale:uphill=5 { name 'mtb55 ${name}' | 'mtb55' }
>
> mtb:scale:uphill=0 { name 'mtb.0 ${name}' | 'mtb.0' }
> mtb:scale:uphill=1 { name 'mtb.1 ${name}' | 'mtb.1' }
> mtb:scale:uphill=2 { name 'mtb.2 ${name}' | 'mtb.2' }
> mtb:scale:uphill=3 { name 'mtb.3 ${name}' | 'mtb.3' }
> mtb:scale:uphill=4 { name 'mtb.4 ${name}' | 'mtb.4' }
> mtb:scale:uphill=5 { name 'mtb.5 ${name}' | 'mtb.5' }
>
> mtb:scale=0 { name 'mtb0. ${name}' | 'mtb0.' }
> mtb:scale=1 { name 'mtb1. ${name}' | 'mtb1.' }
> mtb:scale=2 { name 'mtb2. ${name}' | 'mtb2.' }
> mtb:scale=3 { name 'mtb3. ${name}' | 'mtb3.' }
> mtb:scale=4 { name 'mtb4. ${name}' | 'mtb4.' }
> mtb:scale=5 { name 'mtb5. ${name}' | 'mtb5.' }

To the following which says 'if either mtb:scale or mtb:scale:uphill
are given then construct the name from the values.  If either one
is absent, replace it with a dot'.

Does that accurately reproduce what you want?  I realise that might
not currently work with other things in the file, but I am trying to
take this a step at a time.

(mtb:scale=*  | mtb:scale:uphill=*) & route=mtb
	{ name 'mtbrt${mtb:scale|def:.}${mtb:scale:uphill|def:.} ${name}'
          | 'mtbrt${mtb:scale|def:.}${mtb:scale:uphill|def:.}'
	}

(mtb:scale=* | mtb:scale:uphill=*) & route!=mtb
	{ name 'mtb${mtb:scale|def:.}${mtb:scale:uphill|def:.} ${name}'
  		 | 'mtb${mtb:scale|def:.}${mtb:scale:uphill|def:.}'

If there are invalid values for mtb:scale, then this will give different
results for that case, but if that is important then perhaps we
can deal with that separately.

Regards,

..Steve



More information about the mkgmap-dev mailing list