Theme rule set rendering

Started by Martin Holý, August 18, 2020, 14:52:05

0 Members and 1 Guest are viewing this topic.

Martin Holý

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?
  •  

john_percy

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

Voluntary and Velocity themes - https://voluntary.nichesite.org
  •  

Jackpope10z

What is a problem in case I know?
  •  

karlchick

#3
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.
User id: 62b600722
Author of the OS Map Theme:
DiscussDownload
  •  
    The following users thanked this post: poutnikl