[Qt-interest] Modification for faster coordinate clipping in QOutlineMapper
Marco Hugentobler
marco at hugis.net
Sat Sep 5 08:04:55 CEST 2009
Hi
For applications that display geographic data (lakes), it is quite common to
display large polygons (100000 vertices).
One problem we have is that when zooming in very close, drawing polygons can
take very long time (several minutes). Doing a bit of debugging, I found that
most of the time is spent in the clipping code at
src/gui/painting/qoutlinemapper.cpp, function QOutlineMapper::clipElements
where the coordinates are clipped to +- 32767
In our GIS application, we already have code to do coordinate clipping based
on Sutherland and Hodgman's polygon-clipping algorithm and I noticed that it
runs much faster (but seems to me it is only suitable for straight line
segments). So I extended QOutlinemapper to use this algorithm for large pathes
without curves and it seems to work quite well for me.
If there is an interest in my modifications, the changed source files are
available at:
www.hugis.net/qt/qoutlinemapper_p.h
www.hugis.net/qt/qoutlinemapper.cpp
I hope that this performance improvement (or any other improvement that
enhances clipping speed) can be included in future versions of Qt.
Regards,
Marco
--
Dr. Marco Hugentobler
HUGIS - GIS Programmierung und Beratung
Honrainweg 5
CH-8038 Zürich
marco at hugis.net
More information about the Qt-interest-old
mailing list