logo separator

[mkgmap-dev] if-then-else in style and style options

From Gerd Petermann GPetermann_muenchen at hotmail.com on Wed Mar 8 10:27:30 GMT 2017

Hi Dave,

I prefer end to endif, but it would be easy to change that. I don't get the idea with else.
The implemented logic is that fori
f (a=b) then ...if-rules... else ...elserules... end
the term (a=b) is added to the if-rules and !(a=b) is added to the else-rules.

It seems you think of something like a switch-case-default statement ?

Gerd



________________________________________
Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im Auftrag von Dave Swarthout <daveswarthout at gmail.com>
Gesendet: Mittwoch, 8. März 2017 09:54:29
An: Development list for mkgmap
Betreff: Re: [mkgmap-dev] if-then-else in style and style options

This is probably coming too late but I was going to suggest earlier that the "end" directive be changed to "endif" to be more consistent with other programming languages. I've been away from programming for a long time - many languages (Java, C++, PHP) seem to use braces to end a control loop nowadays. No big deal either way.

Also, in your example, would an "Else" directive before the "[0x1c resolution 22]" the do the job? The program would still have to 'remember" that it was evaluating the "if " statement above, however.

Dave

On Wed, Mar 8, 2017 at 3:34 PM, Gerd Petermann <GPetermann_muenchen at hotmail.com<mailto:GPetermann_muenchen at hotmail.com>> wrote:
It would not work because 1=1 is interpreted as
$1='1'
and that will probably not be true.
Same effect with '1' = '1' .

Maybe we can add a style function "true()" which always retrurns true for this?

Gerd
________________________________________
Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk<mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk>> im Auftrag von Ticker Berkin <rwb-mkgmap at jagit.co.uk<mailto:rwb-mkgmap at jagit.co.uk>>
Gesendet: Mittwoch, 8. März 2017 09:25:34
An: mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk>
Betreff: Re: [mkgmap-dev] if-then-else in style and style options

Hi

I think you should document that you need a dummy condition, ie

if (...) then
  1=1 {action}
  ...
  1=1 [0x1c ...]
end

(I assume this should work OK)

Ticker

On Wed, 2017-03-08 at 08:07 +0000, Gerd Petermann wrote:
> Hi all,
>
> while writing the documentation I noticed this possible problem case:
> The lines file in the default style contains these rules:
> boundary=administrative { name '${mkgmap:boundary_name}' }
> boundary=administrative & admin_level<3 [0x1e resolution 12]
> boundary=administrative & admin_level<5 [0x1d resolution 19]
> boundary=administrative & admin_level<7 [0x1c resolution 21]
> boundary=administrative & admin_level<9 [0x1c resolution 22]
> boundary=administrative [0x1c resolution 22]
>
> So, one may want to extract the clause boundary=administrative  like
> this:
> if (boundary=administrative) then
>         { name '${mkgmap:boundary_name}' }
>         admin_level<3 [0x1e resolution 12]
>         admin_level<5 [0x1d resolution 19]
>         admin_level<7 [0x1c resolution 21]
>         admin_level<9 [0x1c resolution 22]
>         [0x1c resolution 22]
> end
>
> The problem: It doesn't work because the lines
>         { name '${mkgmap:boundary_name}' }
> and
>         [0x1c resolution 22]
> are not a valid rules and the rule parser "forgets" that the
> boundary=administrative expression will be added.
>
> What do you think? Should mkgmap support this syntax?
>
> Gerd
> ________________________________________
> Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk<mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk>> im Auftrag
> von Gerd Petermann <GPetermann_muenchen at hotmail.com<mailto:GPetermann_muenchen at hotmail.com>>
> Gesendet: Dienstag, 7. März 2017 20:10:52
> An: Development list for mkgmap
> Betreff: Re: [mkgmap-dev] if-then-else in style and style options
>
> Hi Andrzej,
>
> thanks, so I'll try to document the new syntax next.
>
> Gerd
> ________________________________________
> Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk<mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk>> im Auftrag
> von Andrzej Popowski <popej at poczta.onet.pl<mailto:popej at poczta.onet.pl>>
> Gesendet: Dienstag, 7. März 2017 17:40:16
> An: mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk>
> Betreff: Re: [mkgmap-dev] if-then-else in style and style options
>
> Hi Gerd,
>
> I have run some tests with current code and spotted no problems. I
> have
> tested both, if-then-else statement and style-option.
>
> --
> Best regards,
> Andrzej
> _______________________________________________
> mkgmap-dev mailing list
> mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk>
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
> _______________________________________________
> mkgmap-dev mailing list
> mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk>
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
> _______________________________________________
> mkgmap-dev mailing list
> mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk>
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
_______________________________________________
mkgmap-dev mailing list
mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk>
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
_______________________________________________
mkgmap-dev mailing list
mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk>
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev



--
Dave Swarthout
Homer, Alaska
Chiang Mai, Thailand
Travel Blog at http://dswarthout.blogspot.com


More information about the mkgmap-dev mailing list