[Qgis-developer] Utilising QGraphicsScene in a first-class
fashion for QgsMapCanvas
wonder.sk at gmail.com
Mon Apr 9 14:15:27 EDT 2007
On 4/9/07, Brendan Morley <morb at beagle.com.au> wrote:
> 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.
Important question is the performance when representing features as
QGraphicsItems. Personally I'm in favour to use this implementation
but definitely we should find out first if this won't eat too much
processor time (and memory).
> 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
I'm not sure whether QgsMapToPixel should be obsoleted - when you're
using only core libraries (no map canvas) there should be a simple way
how to convert between the coordinates when doing something with
I can imagine when QgsMapCanvasMap can be a good option - in case you
have many raster layers - each represented by one canvas item with a
pixmap, the memory overhead can be big. When layers are rendered to
one pixmap, you don't need a buffer for every layer.
> 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.
a - Yes, panning would be better if done with default QGraphicsView
> 5. Benefits
> a. I have already got incremental rendering working - this was broken
> every since we ported to Qt4.
What were the necessary changes?
> 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!
Perspective transformations look very good. I'm currently developing a
simple navigation and routing application (as a school project) based
on QGIS libs + python and this looks like a must have feature :-)
More information about the Qgis-developer