[Qgis-developer] Utilising QGraphicsScene in a first-class
fashion for QgsMapCanvas
marco.hugentobler at karto.baug.ethz.ch
Wed Apr 11 02:25:59 EDT 2007
This is very interesting. I have some questions:
What is your experience about performance and memory requirements of this
Am I right that the changes do not affect libqgis_core and libqgis_gui, only
the code on top of it?
Could you make a .tgz available so that developers can test?
Am Montag, 9. April 2007 05:23 schrieb Brendan Morley:
> Dear fellow developers,
> I've been experimenting (in my personal code base) with the use of
> QGraphicsScene / QGraphicsView / QGraphicsItem as I believe TrollTech
> intended them.
> My proof of concept seems to work (so far) and I now want to see if
> there is any interest to collaborating on this further within the QGIS
> dev team.
> Here's what I have so far:
> 1. Current State of Trunk
> a. QgsMapCanvas is now a QGraphicsView
> b. The QGraphicsView is attached to a QGraphicsScene.
> c. The QGraphicsScene is populated by a QGraphicsRectItem,
> d. The QGraphicsRectItem is the QgsMapCanvasMap.
> e. The QgsMapCanvasMap renders itself by fetching the drawable features
> and rendering onto its own QPixmap.
> f. The QgsMapCanvasMap paints itself by painting its QPixmap.
> g. The QGraphicsScene coordinates are 1:1 with the QGraphicsView
> h. The 1:1 mapping is maintained by a proprietary implementation.
> e. Panning is handled in a proprietary implementation.
> 2. Design
> a. All drawable features are represented by a corresponding
> b. Vector features become QGraphicsItems with an attached Path
> (using .addPath).
> c. Vector features also have attached ToolTips if possible.
> d. Raster layers would continue to be QGraphicsRectItems.
> e. Incremental drawing to be restored.
> f. Ability to halt a drawing operation to be restored.
> 3. Deprecations
> a. The QgsMapToPixel object is obsolete, since Map coordinates are
> equivalent to Scene coordinates and Pixel coordinates are equivalent to
> View coordinates.
> b. The QgsMapCanvasMap is obsolete, since vector features can be added
> directly to the QGraphicsScene rather than being abstracted through the
> 4. Probable Deprecations
> a. The Pan tool should be refactored to exploit the built-in dragging of
> the QGraphicsView.
> b. The feature selection method should be refactored to exploit the
> built-in selection functionality of the QGraphicsScene.
> 5. Benefits
> a. I have already got incremental rendering working - this was broken
> every since we ported to Qt4.
> b. Ability to exploit ToolTips.
> c. Ability to move features as a whole, rather than point by point.
> d. Ability to rotate the map with only a little extra code.
> e. Qt4.3 looks like having perspective transformations. We can start
> simulating those pseudo-3D road navigation devices!
> f. Let TrollTech worry about enhancing this code rather than us.
> Qgis-developer mailing list
> Qgis-developer at lists.qgis.org
More information about the Qgis-developer