logo separator

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

From Gerd Petermann GPetermann_muenchen at hotmail.com on Fri Mar 17 14:51:14 GMT 2017

Hi Andrzej,

okay, you are right, that sounds better than my approach. I'll try to code it that way.

Gerd
________________________________________
Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im Auftrag von Andrzej Popowski <popej at poczta.onet.pl>
Gesendet: Freitag, 17. März 2017 14:02:55
An: mkgmap-dev at lists.mkgmap.org.uk
Betreff: Re: [mkgmap-dev] if-then-else in style and style options

Hi Gerd,

you seem to evaluate scenarios, that I didn't think of. You probably
want to unwind a rule with double types into 2 rules with single type.
My idea was different, based on my guess, how mkgmap works. I have
looked at code now, and I can explain more precisely.

First there is class ActionRule, which contains a trio:
  private Op expression;
  private final List<Action> actions;
  private final GType type;

Here I would suggest to add 4-th element:
  private final GType type2;

And then support it in all methods, like add creator with 2 types:

public ActionRule(Op expression, List<Action> actions, GType type, GType
type2)


Or support for 2 types in resolveType:

if (type != null && finalizeRule != null) {
        ....
        if (type2 != null) {
                ...
        }
}

And similarly in RuleFileReader:

GType type = null;
GType type2 = null;
if (scanner.checkToken("[")) {
        type = typeReader.readType(...);
        if (scanner.checkToken("[") {
                type2 = typeReader.readType(...);
        }
}
else ...
saveRule(scanner, expr, actionList, type, type2);


I hope my theoretical implementation answers your questions. When 2 type
elements are present, there is no need to evaluate "continue" or
"continue with_actions" in first element, it is hardcoded as "continue
with_actions". And "continue" in last element will result in further
processing of OSM object.

There is no limitation for content of action part, rule with 2 types
behaves exactly like a rule with single type.

I'm sure that my understanding of your code is incomplete but I hope the
general idea is feasible. I think type element could be even a list,
like actions.

--
Best regards,
Andrzej
_______________________________________________
mkgmap-dev mailing list
mkgmap-dev at lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


More information about the mkgmap-dev mailing list