logo separator

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

From Gerd Petermann GPetermann_muenchen at hotmail.com on Tue Mar 7 14:52:18 GMT 2017

Hi Dave,

the coding is done unless one finds errors. Only documentation is missing.
I hoped to get some feedback that it really improves readabilty (as it cannot improve performance for now).

Gerd

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

I'm sorry Gerd, I want to experiment with the new statements but I just don't have the time to play at the moment. Please commit the changes if you haven't already, and I'll get the new version and experiment when I can.

Dave

On Tue, Mar 7, 2017 at 9:09 PM, Gerd Petermann <GPetermann_muenchen at hotmail.com<mailto:GPetermann_muenchen at hotmail.com>> wrote:
Any feedback on this?

If nobody is interested in using if-then-else in style I'd be happy to use only the style-option_v3.patch
for trunk.

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: Mittwoch, 1. März 2017 15:54:02
An: mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk>
Betreff: [mkgmap-dev] if-then-else  in style and style options

Hi all,

I've applied the style-option_v3.patch to the branch, for details see  log message:
http://www.mkgmap.org.uk/websvn/revision.php?repname=mkgmap&rev=3827

I've also tried to fix the known problems with the interpretation of if then statements,
so I hope it works now:
http://www.mkgmap.org.uk/websvn/revision.php?repname=mkgmap&path=%2F&

Just to make this clear: The if statements are translated to "normal" rules, so you cannot do anything
with if-then which would not work without, you should also not (yet) exprect run time improvements.
The advantage is that you don't have to repeat phrases.

A complex sample that shows a possible usage.
# Roundabouts
if (junction=roundabout) then
        if (mkgmap:option:single-roundabout=true) then
                (highway=trunk | highway=trunk_link) [0x0c road_class=4 road_speed=2 resolution 18]
                (highway=primary | highway=primary_link) [0x0c road_class=3 road_speed=2 resolution 19]
                (highway=secondary | highway=secondary_link) [0x0c road_class=2 road_speed=2 resolution 20]
                (highway=tertiary | highway=tertiary_link) [0x0c road_class=1 road_speed=1 resolution 21]
        else
                (highway=trunk | highway=trunk_link) [0x0c road_class=4 road_speed=2 resolution 24 continue]
                (highway=trunk | highway=trunk_link) [0x10801 resolution 18]

                (highway=primary | highway=primary_link) [0x0c road_class=3 road_speed=2 resolution 24 continue]
                (highway=primary | highway=primary_link) [0x10802 resolution 19]

                (highway=secondary | highway=secondary_link) [0x0c road_class=2 road_speed=2 resolution 24 continue]
                (highway=secondary | highway=secondary_link) [0x10803 resolution 20]

                (highway=tertiary | highway=tertiary_link) [0x0c road_class=1 road_speed=1 resolution 24 continue]
                (highway=tertiary | highway=tertiary_link) [0x10804 resolution 21]
        end
        # minor roundabouts need no overlay
        (highway=unclassified | highway=minor ) [0x0c road_class=1 road_speed=1 resolution 21]
        highway=* [0x0c road_class=0 road_speed=1 resolution 22]
end

If the corresponding block in the default style lines file is replaced with these rules, you can
use option --style-option=single-roundabout to enable the rules which don't add 0x180x lines as overlays for roundabouts.

It might be possible to completely remove rules which would never be triggered but that is quite complex, so I leave that for later.

Gerd
_______________________________________________
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