[Marble-devel] Optimization tips

Torsten Rahn tackat at t-online.de
Thu Jan 3 13:14:36 UTC 2013


Well it depends a lot on what you paint and how. 

A) GeoPainter is relatively low-level painting (like QPainter). 

For some use cases it makes sense to use it:
We use it for example in the coordinate grid where in theory there are
millions of coordinate grid lines. Instead of "instantiating" them fully we
only determine which possible lines would have to be drawn for the current 

This basically equals:


... and that is probably what you have done already.

B) Another approach would be to treat the polygons/lines as objects. You can 
either instantiate the objects via C++ code:


... or you can load ready-made "KML" files (xml code) into your widget:


So the object-oriented approach is quite similar to the concept of Qt's 
QGraphicsView. And this one allows for some internal "high-level" performance 
optimization: Internally we have started to create "TilePyramids" that would 
only have objects painted (and evaluated) if they cover a certain region 
("tile") that is currently inside the viewport. So this is something that 
should improve performance (and will do so even more with future Marble 

So the second approach might be better if you want  best performance without 
having to worry much about optimizations. But with the first approach you 
might have better control over what you're doing and you could do the whole 
bsp-tree / tilePyramid thing yourself in some way that is optimal for your use 

Do your thousands of polygons only cover a certain small area or are they 
covered over the whole globe? What is the amount of nodes of a typical 
polygon? Do you have to change the pen and brush frequently?

Best Regards,


In other cases it's better if you treat 

On Donnerstag, 3. Januar 2013 09:15:05 jean-charles.quillet at alyotech.fr wrote:
> >-----Message d'origine-----
> >De : De la part de Torsten Rahn
> >Envoyé : mercredi 2 janvier 2013 16:01
> >
> >On Mittwoch, 2. Januar 2013 15:50:10 jean-charles.quillet at alyotech.fr 
> >> Hello,
> >> 
> >> I'm drawing a lot of vectorial datas on a marble map (~100000 lines
> >> and polygons, sometimes more). The rendering is beginning to be very
> >> slow. What are my options to accelerate the rendering ?
> >> Thanks,
> >
> >What are you using to draw the stuff? GeoPainter?  Or do you import KML?
> I dont import KML. But I'm using the GeoPainter using layers as described
> in :
> http://techbase.kde.org/Projects/Marble/LayerInterface
> _______________________________________________
> Marble-devel mailing list
> Marble-devel at kde.org
> https://mail.kde.org/mailman/listinfo/marble-devel

More information about the Marble-devel mailing list