[Qgis-developer] Summer of code project

Martin Dobias wonder.sk at gmail.com
Mon Apr 5 17:16:49 EDT 2010


Hi Jae

On Mon, Apr 5, 2010 at 9:20 PM, Jae Sammy <jcs at rincon.com> wrote:
> Martin,
>
> This project sounds like a great idea!
>
> I came across the following potential optimization while trying to optimize my map refreshing in a project where I had a large number of static rasters under a small number of vector layers that were changing frequently under a large number of vector layers that were changing infrequently.  Ideally this called for the ability to refresh each layer individually and the map to only redraw the pixels that were affected by the change.

How long does the rendering take now and what would be an acceptable
time for you? Anyway note that when map canvas is panned or zoomed,
_all_ map layers have to be rendered again even if there were some
optimizations.


> Currently, qgis doesn't take full advantage of Qt's native graphics view framework since all layers are rendered down to a single qgraphicsrectitem (qgsmapcanvasmap) and placed in a scene by itself.  A possible optimization is to play nicer w/ Qt and have all layers implement their own qgraphicsitem and add them to the qgraphicsscene (currently instantiated in qgsmapcanvas) in order based on their order in the layerset.  This way qt will only render what is needed and each item can inform the scene of the changes to its bounding rectangle so that only a subset of the scene is re-rendered.

This optimization is surely possible. Render caching introduced
recently actually does a very similar thing. Personally, I think that
rendering all layers into one graphics item is a better option than
having one item per layer: the blending of layers is done just once
per redraw, I believe that when using "item per layer" approach, the
rendered images of layers will have to be blended together on every
update - that means also when drawing rubber bands on top of the map
(e.g. for measuring), when panning etc. And that could be much slower.
But I may be wrong...

Regards
Martin


More information about the Qgis-developer mailing list