logo separator

[mkgmap-dev] Commit r4185: tags5.patch: Improve the RuleIndex.

From svn commit svn at mkgmap.org.uk on Sun May 6 06:51:18 BST 2018

Version mkgmap-r4185 was committed by gerd on Sun, 06 May 2018

tags5.patch: Improve the RuleIndex. 

Attached patch reduces again the number of evaluated rules, but should still evaluates all necessary rules.
The old index still returned too many rules. Let's look at the example that I added as unit test. Set of rules:
0: a=* {set b=1}
1: b=1 {set c=1}
2: d=2 {set c=2}
3: c=* {set a=2}
4: c=1 {set d=2}
5: c=2 {set d=1}
6: d=1 [0x10401 resolution 24]
7: d=2 [0x10402 resolution 24]
Assume we have no index and an element with only one tag a=1. We check each rule:
Rules 0 matches and sets b=1
Now 1 matches and sets c=1
Rule 2 doesn't match.
Rule 3 matches and sets a=2
Rule 4 matches and sets d=2
Rule 5  doesn't match.
Rule 6  doesn't match.
Rule 7  matches.
The index is used to reduce the number of evaluated rules. In the best case it should return rules 0,1,3,4, and 7 for the given element.
But the current code returns all rules because it thinks that rule 4 can set d=2 and therefore rule 2 might be triggered (which is wrong).
The patch changes the index to recognizes the order of the rules which change tags and therefore returns only the needed rules.


http://www.mkgmap.org.uk/websvn/revision.php?repname=mkgmap&rev=4185


More information about the mkgmap-dev mailing list