[Qgis-developer] Multiple labeling layers ?

Hugo Mercier hugo.mercier at oslandia.com
Thu Feb 12 05:50:17 PST 2015


Hi Martin,

Thanks for your feedback.

Le 12/02/2015 13:00, Martin Dobias a écrit :
> Hi Hugo
> 
> On Mon, Feb 9, 2015 at 9:37 PM, Hugo Mercier <hugo.mercier at oslandia.com
> <mailto:hugo.mercier at oslandia.com>> wrote:
> 
>     Hi all,
> 
>     We have a request to refine the way layers can be cached and especially
>     regarding the handling of labels.
> 
>     The goal is to be able to optimize what is redrawn during the rendering
>     when features of only some of the vector layers are moving (a script
>     somewhere makes them move), and the other vector layers stay the same
>     (same data, same extent)
> 
> 
> Sounds good. Do I understand correctly you want to avoid having to
> register features on every map rendering?
> 
> What exactly would be cached - features / label candidates? for one view
> / for the whole map?

If I am correct, during labeling the most demanding task is the global
optimization to compute label positions. So these label positions could
be cached for one set of labels (in a labeling layer), provided the
underlying vector layers are also cached.

> 
> 
>     I would like to allow labels to be manipulated in a new kind of
>     "labeling" layers, which could be organised as any other layer in the
>     legend : on top / above other layers, with blending modes, etc.
> 
> 
> Recently there was a ticket filed for that:
> http://hub.qgis.org/issues/12131
> By reordering do you mean that the labeling could get "under" some other
> layers - i.e. wouldn't be drawn always on top?

Yes the idea would be to separate the vector layers that provide
features and layers that actually draw labels. So yes, labels that could
be drawn not always on top. Or labels from a set of layers drawn
independently from labels of some other set of labels (with possible
overlaps in this case).

> 
> Or do you mean that a "labeling" layer would actually _draw_ extra
> labeling instead of _providing_ features? This could be indeed an
> interesting piece of functionality.

Exactly. Each labelling layer would refer to a set of vector layers
which provide features. The PAL optimization would be run on each
labeling layer and labels rendered in their own layer.

I am also investigating another optimization idea: the good old global
labeling on top of every other layers, but with a way to "partially"
solve the placement problem. Could it be possible to inject precomputed
label positions in PAL ? So that a part of the label positions would be
already known from a previous frame and some other labels would have to
be recomputed ? The 'obstacle' feature of PAL is interesting, but
probably not "strong" enough to really avoid overlapping ...



More information about the Qgis-developer mailing list