3liz / lizmap-web-client

Transfer a QGIS project on a server, Lizmap is providing the web interface to browse it
https://www.lizmap.com
Mozilla Public License 2.0
249 stars 141 forks source link

Layer toggeling behaviour at LWC start #4232

Open meyerlor opened 4 months ago

meyerlor commented 4 months ago

What is the bug? (in English)

If I understand it correctly, with LWC 3.7 the behaviour of the layer panel should be the same as in QGIS. This is really great and works fine - but "initiating" the layers which should be activated at the start of LWC does somehow not really follow an understandable logic (at least i can not comprehend it). Maybe it is intended to work this way, hopefully it is possible to clarify a little bit:

Steps to reproduce the issue

  1. When not working with QGIS map themes, setting a layer in the lizmap plugin as "toggled" will also toggle the group the layer is part of when opening LWC - although the group is not toggled in the lizmap plugin (so all layers of that group need to be "untoggled" in LM plugin, but then the user has to activate all layers manually in LWC)
  2. To circumvent this behaviour, I tried using QGIS map themes - toggle all layers in a group but do not toggle the group itself: grafik This results in: grafik which is again not the desired result.

So how can it be achieved that a user can "fast switch on" a group like shown here:

Group_SwitchOn

Versions, safeguards, check summary etc

QGIS Desktop 3.28 LWC 3.7.2

Check Lizmap plugin

Operating system

Ubuntu 22.04

Browsers

Firefox, Chrome, Safari, Microsoft Edge

Browsers version

Firefox 115

Relevant log output

No response

meyerlor commented 4 months ago

addendum: With "Group as Layer" active in the Lizmap Plugin, this Group can not be made visible from the start of LWC - no matter if going via themes or setting the group as "toggled" in Lizmap Plugin, the group will not be loaded when starting LWC - this kind of makes the "Group as Layer" function much less usefull for me (I have several labeling layers which should be grouped to speed up rendering - but the labels are neeeded from the start!)

nboisteault commented 4 months ago

From what I see in the .qgs file, when a layer is present in a theme definition it means it has to be checked. But it might be not visible (visible="0") because of at least one parent group unchecked.

    <visibility-preset has-checked-group-info="1" has-expanded-info="1" name="theme3">
      <layer expanded="1" id="sousquartiers_7c49d0fc_0ee0_4308_a66d_45c144e59872" style="défaut" visible="0"></layer>
      <expanded-legend-nodes id="sousquartiers_7c49d0fc_0ee0_4308_a66d_45c144e59872"></expanded-legend-nodes>
      <checked-group-nodes>
        <checked-group-node id="group1"></checked-group-node>
      </checked-group-nodes>
      <expanded-group-nodes>
        <expanded-group-node id="group1/sub-group1"></expanded-group-node>
        <expanded-group-node id="group1"></expanded-group-node>
      </expanded-group-nodes>
    </visibility-preset>
rldhont commented 1 day ago

@meyerlor In LWC 3.8 we have implement a way to check / uncheck all children of a group by double clicking it.

meyerlor commented 8 hours ago

awesome - i will wait for the next release to try those fixes regarding grouping of layers etc!