[Qgis-developer] Incremental rendering update

Hugentobler Marco marco.hugentobler at karto.baug.ethz.ch
Wed Oct 17 06:49:09 EDT 2007

Hi Martin

>- I remember that after Qt4 port Tom disabled processEvents() calls
>during the rendering due because they were producing UI problems and
>even crashes... now it seems that it works again (Qt4.2.3 here) - or
>did you have to do something special to avoid those troubles?

No, it just worked (qt4.3). Maybe the problem was only on Mac?

>- I've noticed you've disabled usage of QPixmap in QgsMapCanvasMap ...
>was there any particular reason for that or just because of being a
>proof of concept?

Yes, it was just the quick and dirty way. I think it is possible to keep the QPixmap and to convert to image when doing a screen refresh.

>- if I understand it correctly, QgsMapCanvas::refresh() has changed
>its semantics from being trigger of rendering to just being updater of
>the drawn map. Some of the refresh() calls have been changed to
>drawIncrementally() and some not, which produces some bugs when
>working with the map canvas. (wouldn't it be better to preserve
>original meaning of refresh() function?)

That's a good point. It would probably be better to make a switch into refresh() function that calls QgsMapCanvasMap::update() if canvas is not dirty and QgsMapCanvasMap::render() if dirty.

>- the usual purpose of layer's repaintRequested signal is different -
>it's emitted when the layer thinks it should be re-rendered, while you
>use it to signal that there is some progress in drawing...

The repaintRequested signal is still emitted when the layer thinks it should be re-rendered. Maybe you mean the signal 'drawingProgress'? It is emitted in the same place (also before my changes). I think the reason for this is more of practical nature in that it is the place where qApp->processEvents() is done and so a progress bar would have the change to update.

>- an important thing what's missing so far is lack of mechanism which
>would stop rendering - e.g. when you hit escape key or when you move
>the map it should stop   and start rendering again

Yes, that is still to do. The way this has been done in the qt3 times was to set QgsMapLayer::mDrawingIsCancelled to true for all the layers. We could do the same to stop rendering. Althought it is not very nice to have QgsMapLayer::mDrawingIsCancelled member, as it does not represent a real maplayer property.

> - raster layers could also do some updates during rendering...

Good point. What do you think should be the policy for a raster layers to update? In fixed Intervals, e.g. once in the middle of the image or in fixed time intervals?

>But after all I'm happy to see that we can allow some level of
>concurrency while rendering even without the need to use threading...
>Nice work!

I'm going to make a branch for this so that we may also test on different platforms. I have an old G4 mac in my office, so I'll be able to test on Linux, Mac and W32.


More information about the Qgis-developer mailing list