Hi Alexander

Seems to be a problem with the python bindings. In C++, the render method is: void QgsMapRenderer::render( QPainter* painter, double* forceWidthScale = 0 );

Somehow sip does not like that and forceWidthScale has a funny value (also, I cannot call the method with two arguments from python). If I change the function in qgsmaprenderer.sip to QgsMapRenderer::render( QPainter* painter ), forceWidthScale is 0 and it works.

Regards,
Marco

On 14.12.2012 15:51, Alexander Bruy wrote:
Hi all,

playing with map rendering I found strange issue: if layer style used
"Millimeters" as unit type, this layers are displayed in QGIS but
don't rendered when performing rendering to image from plugin/console.

Here is minimal script to reproduce this. Add to canvas several
line, point and polygon layers, ensure that style units are
"Millimeters", zoom to some region. Then run script:

from PyQt4.QtCore import *
from PyQt4.QtGui import *
canvas = qgis.utils.iface.mapCanvas()
extent = canvas.extent()
for l in canvas.layers():
   layers.append(l.id())
img = QImage(QSize(800, 600), QImage.Format_ARGB32_Premultiplied)
color = QColor(255, 255, 255)
img.fill(color.rgb())
p = QPainter()
p.begin(img)
render = QgsMapRenderer()
render.setLayerSet(layers)
render.setExtent(extent)
render.setOutputSize(img.size(), img.logicalDpiX())
render.render(p)
p.end()
img.save("/tmp/render_issue.png","png")

Output file will contain only polygonal layer(s), line and points are
not rendered. But when style units changed to "Map units" all works
fine. Same issue exists with labels.

Any ideas what is wrong? Maybe I miss something obvious?

Thanks


--
Dr. Marco Hugentobler
Sourcepole -  Linux & Open Source Solutions
Weberstrasse 5, CH-8004 Zürich, Switzerland
[email protected] http://www.sourcepole.ch
Technical Advisor QGIS Project Steering Committee

_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to