[Qgis-developer] should legends be shown for invisible layers ?

Martin Dobias wonder.sk at gmail.com
Sat Dec 13 17:52:45 PST 2014

Hi Sandro

On Sun, Dec 14, 2014 at 6:40 AM, Sandro Santilli <strk at keybit.net> wrote:

> Does it make sense to show a layer's legend while the layer visibility is
> off,
> or should the legend nodes in the layertree really be removed ?

When map-based filtering is enabled, the legend nodes for invisible layers
are not shown. Technically they are not deleted, they are just filtered out
inside the layer tree model.

I'm wondering as I move steps toward optimization of WMS legend construction
> for cases in which it is not needed: http://hub.qgis.org/issues/11860
> You probably don't want to incur in the cost of new WMS GetLegendGraphics
> requests as you pan and zoom while the layer is invisible, but then would
> you still want the last fetched legend visible in that case ?

Indeed you don't want such extra cost. But as I noted in the ticket, if a
legend node is filtered out or in a collapsed part of a tree, the model
will not ask about its data(), so if fetching is implemented there, it will
be done lazily only when required.

> The same applies to vector layers too, except the cost is much much lower
> there. Does it make sense for map dependent legends to update while their
> corresponding layer is invisible ? And to show the legend at all ?

Map dependent legends for each layer are not re-created completely on every
change of map extent: only the filtering part is applied - and when they
are invisible all legend nodes are filtered out.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20141214/cc6dbefa/attachment.html>

More information about the Qgis-developer mailing list