[Qgis-developer] QgsMapRenderer rotation doesn't print rotated map

G. Allegri giohappy at gmail.com
Thu Mar 2 09:03:47 PST 2017


I'm using QgsMapRenderer to print a set of layers with a rotation.
This is an excerpt from my code:

(...)

i = QImage(QSize(600,600), QImage.Format_ARGB32_Premultiplied)
r = QgsMapRenderer()
rect = QgsRectangle(iface.mapCanvas().extent())
r.setExtent(rect)
r.setRotation(iface.mapCanvas().rotation())
r.setOutputSize(i.size(), i.logicalDpiX())
r.render(p)

(...)

I'm obtaining the rotation from the one set by the user to the map canvas
(which is rotated indeed) but the output image has no rotation applied.
How should rotation be defined for a renderer?

Giovanni
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20170302/01e1f22f/attachment.html>


More information about the Qgis-developer mailing list