[Qgis-developer] Multicolumn legends in print composer

Radim Blazek radim.blazek at gmail.com
Sat Nov 17 09:10:39 PST 2012

On Wed, Nov 14, 2012 at 11:11 AM, Andreas Neumann <a.neumann at carto.net> wrote:
> Hi,
> Thanks to Radim we now have multi-column legends in print composer.

Thanks to Régis and Agence de l'eau Adour as it was already mentioned by others.

> This
> was one of my long-time feature requests - but it never got to the top
> of my requests so that we could pay for the work.
> Generally it works great, but I noticed two strange behaviors:
> * when having only one column (default) - the background rectangle is
> way too small, not covering the full bouding box of the legend

Width? Fixed.

> * when going beyong 4 columns, QGIS gets really slow, hangs or crashes.

Splitting of layers into columns is not that easy as it seems to be.
It is a special sort of bin packing problem (NP-hard). Maybe it has
its own name? I have used brute force because:
 - I thought that the number of layer will never be too big
 - implementaion of heuristic algorithm for such a marginal feature
seemed to be overkill
 - suboptimal solution could look quite bad

You proved immediately that I was wrong. How many layers do you have?
70 I have read somewhere? My original idea was to calculate number of
possibilities first and decide if heuristic should be used. Now it
seems a necessity.

Maybe I am wrong and there is a simple solution? Well, I did not know
at the beginning that I am going to solve combinatorial exercises.

Regarding the crash, I was quite careful, using value() where there
was minimum suspicion that it could run out of range. Many
combinations should not mean allocation of a lot of memory, just more
computational time. Only one combination is always evaluated at time.
Does it seem to be a memory allocation problem or out of list bounds?
Could you send me backtrace off list?

Please follow/comment http://hub.qgis.org/issues/1841


> Did other test the new multicolumn legends?
> Thanks Radim for your work!
> Andreas
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer

More information about the Qgis-developer mailing list