[Qgis-developer] qgis pre-refresh rendering ?

Sandro Santilli strk at keybit.net
Sat Dec 13 09:45:45 PST 2014


On Sat, Dec 13, 2014 at 06:01:13PM +0100, Sandro Santilli wrote:
> On Sat, Dec 13, 2014 at 05:40:10PM +0100, Sandro Santilli wrote:
> > On Sat, Dec 13, 2014 at 10:40:44PM +0700, Martin Dobias wrote:
> 
> > > The rect() and setRect() is just our added convenience functionality in
> > > QgsMapCanvasItem. The idea was that you just use setRect() to specify the
> > > item's position+size in map coordinates - and the pos() and boundingRect()
> > > will be set according to that. In addition, calls to updatePosition() from
> > > map canvas make sure that pos() and boundingRect() are kept in sync with
> > > changes to the canvas.
> > 
> > The problem with that, as you can see, is that it is assumed that
> > a single rectangle can fully express a map configuration, but that's
> > only true when there's no rotation.
> 
> Actually, worst than this, it is assumed that a rectangle in map units
> can express a size in device units. And the (pre-rotation-commit) code
> to compute that (size in device units) was transforming the upper-left
> and lower-right corners of the rectangle to device coordinates and
> computing their distance.
> 
> For a 90 degrees rotated extent that gives a size of 0 in one direction...

In my pull request https://github.com/qgis/QGIS/pull/1734 I've
now reverted the special rotation handling in QgsMapCanvasMap::paint
moving the handling up to pass QgsMapCanvasItem::setRect
(via QgsMapCanvasMap::setContent) what it expects: an encoding
of size and position only.

In that version the pre-rendering positioning of both rotated and
non-rotated map is correct on both zoom and pan.

The pre-rendering positioning on rotation change is still glitching as
the new code (like the old one) in QgsMapCanvasItem::setRect can not
look at a stored map _center_.

Revision/tests welcome.

I've started the QEP, but not having a clear plan other than what I did
already it isn't gone much far. Help there is welcome:
https://github.com/qgis/QGIS-Enhancement-Proposals/pull/14
https://github.com/strk/QGIS-Enhancement-Proposals/blob/maprotation/QEP-9-Map_Rotation.rst


--strk;

 ()  ASCII ribbon campaign  --  Keep it simple !
 /\  http://strk.keybit.net/rants/ascii_mails.txt  


More information about the Qgis-developer mailing list