<div dir="ltr">I don't like it but I don't know what to tell you to replace it with. All such "tricks" make writing code less than straightforward and penalize the casual user greatly. I am grateful to you and Ticker, et. al., for making an effort to add this functionality but IMO if you resort to such techniques it will be defeating the very purpose of creating the If-Then construct, that purpose being to simplify the writing of these somewhat strange style rules. <div><br></div><div>Respectfully,</div><div><br></div><div>Dave</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 16, 2017 at 3:34 PM, Gerd Petermann <span dir="ltr"><<a href="mailto:GPetermann_muenchen@hotmail.com" target="_blank">GPetermann_muenchen@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Andrzej,<br>
<br>
well, my problem is the possible misinterpretation caused by ambiguity caused by the if-then interpretation,<br>
but I think I have found a possible solution.<br>
<br>
Let's look at some rules for boundaries in the default style:<br>
v1)<br>
boundary=administrative { name '${mkgmap:boundary_name}' }<br>
boundary=administrative & admin_level<3 [0x1e resolution 12]<br>
boundary=administrative & admin_level<5 [0x1d resolution 19]<br>
boundary=administrative & admin_level<7 [0x1c resolution 21]<br>
boundary=administrative & admin_level<9 [0x1c resolution 22]<br>
boundary=administrative [0x1c resolution 22]<br>
<br>
We said we want to be able to use if-then like this:<br>
v2)<br>
if (boundary=administrative ) then<br>
{ name '${mkgmap:boundary_name}' }<br>
admin_level<3 [0x1e resolution 12]<br>
admin_level<5 [0x1d resolution 19]<br>
admin_level<7 [0x1c resolution 21]<br>
admin_level<9 [0x1c resolution 22]<br>
[0x1c resolution 22]<br>
end<br>
<br>
With r3838 this did not work, because the each rule needs an expression.<br>
Ticker suggested to add a dummy expression like 1=1 so we would write<br>
v3)<br>
if (boundary=administrative ) then<br>
1=1 { name '${mkgmap:boundary_name}' }<br>
admin_level<3 [0x1e resolution 12]<br>
admin_level<5 [0x1d resolution 19]<br>
admin_level<7 [0x1c resolution 21]<br>
admin_level<9 [0x1c resolution 22]<br>
1=1 [0x1c resolution 22]<br>
end<br>
<br>
but this is also not working as 1=1 is interpreted as $1='1' instead of "true"<br>
<br>
Now I noticed that the scanner allows to use () as an empty expression.<br>
So instead of v1 one already can write<br>
v4)<br>
if (boundary=administrative ) then<br>
() { name '${mkgmap:boundary_name}' }<br>
admin_level<3 [0x1e resolution 12]<br>
admin_level<5 [0x1d resolution 19]<br>
admin_level<7 [0x1c resolution 21]<br>
admin_level<9 [0x1c resolution 22]<br>
() [0x1c resolution 22]<br>
end<br>
<br>
If we document this we no longer have a problem with the "one expression two objects" syntax like this:<br>
a=b [0xc ... resolution 24][0x10801 resolution 24]<br>
because we still say that a rule must start with an expression and mkgmap can automaticalyl<br>
add "continue" or "continue with_actions" for all but the last type defintion.<br>
<br>
If you don't like the () 'trick' I can again try to make a style function like true() work.<br>
<br>
Gerd<br>
______________________________<wbr>__________<br>
Von: mkgmap-dev <<a href="mailto:mkgmap-dev-bounces@lists.mkgmap.org.uk">mkgmap-dev-bounces@lists.<wbr>mkgmap.org.uk</a>> im Auftrag von Andrzej Popowski <<a href="mailto:popej@poczta.onet.pl">popej@poczta.onet.pl</a>><br>
Gesendet: Freitag, 10. März 2017 20:14:49<br>
An: <a href="mailto:mkgmap-dev@lists.mkgmap.org.uk">mkgmap-dev@lists.mkgmap.org.uk</a><br>
Betreff: Re: [mkgmap-dev] if-then-else in style and style options<br>
<div class="HOEnZb"><div class="h5"><br>
Hi Gerd,<br>
<br>
my idea was more simple, than your implementation. I just would like to<br>
create multiple map objects with single rule. I didn't put "continue"<br>
there, because I assumed, that all element type definition should be<br>
processed.<br>
<br>
Still "continue" could be applied, it would mean, that OSM object is<br>
processed further, possibly resulting in 3-rd map object or more. I<br>
think "continue" or "continue with_actions" could be added to last type<br>
definition.<br>
<br>
Any other more complicated rules, like adding actions after first type<br>
definition, could be written just like now, with multiple statements.<br>
While I appreciate more flexibility I'm afraid, it could clutter the style.<br>
<br>
--<br>
Best regards,<br>
Andrzej<br>
______________________________<wbr>_________________<br>
mkgmap-dev mailing list<br>
<a href="mailto:mkgmap-dev@lists.mkgmap.org.uk">mkgmap-dev@lists.mkgmap.org.uk</a><br>
<a href="http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev" rel="noreferrer" target="_blank">http://www.mkgmap.org.uk/<wbr>mailman/listinfo/mkgmap-dev</a><br>
______________________________<wbr>_________________<br>
mkgmap-dev mailing list<br>
<a href="mailto:mkgmap-dev@lists.mkgmap.org.uk">mkgmap-dev@lists.mkgmap.org.uk</a><br>
<a href="http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev" rel="noreferrer" target="_blank">http://www.mkgmap.org.uk/<wbr>mailman/listinfo/mkgmap-dev</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Dave Swarthout<br>Homer, Alaska<br>Chiang Mai, Thailand<br>Travel Blog at <a href="http://dswarthout.blogspot.com" target="_blank">http://dswarthout.blogspot.com</a></div></div>
</div>