Locus Map - forum

Content & Tools => Themes - Vector maps => Topic started by: Martin Holý on August 18, 2020, 14:52:05

Title: Theme rule set rendering
Post by: Martin Holý on August 18, 2020, 14:52:05
Hello I have trouble with this rule set.


<rule e="way" k="landuse" v="allotments|meadow|grass|orchard|vineyard">
  <area fill="#DDE8BB" />

  <rule e="way" k="landuse" v="allotments|orchard|vineyard">
    <area stroke="#C2D881" stroke-width="0.5" />
  </rule>
 
  <rule e="way" k="*" v="*" zoom-min="14">
    <rule e="way" k="landuse" v="orchard">
      <area symbol-scaling="size" src="file:/patterns/Landuse-Orchard.png" />
    </rule>
    <rule e="way" k="landuse" v="vineyard">
      <area symbol-scaling="size" src="file:/patterns/Landuse-Vineyard.png" />
    </rule>
  </rule>
</rule>


All values "allotments|meadow|grass|orchard|vineyard" end up rendered as <area fill="#DDE8BB" stroke="#C2D881" stroke-width="0.5" symbol-scaling="size" src="file:/patterns/Landuse-Orchard.png" src="file:/patterns/Landuse-Orchard.png" />

It works if I split the rules but can it be done with nested rules somehow like this?
Title: Re: Theme rule set rendering
Post by: john_percy on August 18, 2020, 15:46:16
Nested rules like that do not work as expected, as you have found! You can't test for A|B and then nest an almost identical test for A. It appears that the previous test is cached in some way.

Sent from my moto g(6) plus using Tapatalk

Title: Re: Theme rule set rendering
Post by: Jackpope10z on January 22, 2021, 09:58:16
What is a problem in case I know?
Title: Re: Theme rule set rendering
Post by: karlchick on January 22, 2021, 11:31:01
As you said, it needs to be split out to separate rules, something like this:

<rule e="way" k="landuse" v="allotments|meadow|grass|orchard|vineyard">
  <area fill="#DDE8BB" />
</rule>
<rule e="way" k="landuse" v="allotments|orchard|vineyard">
  <area stroke="#C2D881" stroke-width="0.5" />
</rule>
<rule e="way" k="landuse" v="orchard" zoom-min="14">
  <area symbol-scaling="size" src="file:/patterns/Landuse-Orchard.png" />
</rule>
<rule e="way" k="landuse" v="vineyard" zoom-min="14">
  <area symbol-scaling="size" src="file:/patterns/Landuse-Vineyard.png" />
</rule>


The original rules would have worked in the v3 'engine' but in 'v4' the implementation is different and has this weird behaviour.