Hi Larry

(sorry for coming back to you so late, I have been offline / busy last week)

On Wed, Mar 5, 2014 at 4:39 AM, Larry Shaffer <[email protected]> wrote:
> Hi Martin, et al.,
>
> Maybe I'm missing something elemental here, but I can't seem to find a
> simple way to apply my built-up QgsMapSettings to QgsMapCanvas or
> QgsMapRenderer, initiate a render from Python, then save into image on disk.
>
> This is what I would like to do (for simple screen-res renders):
>
> cnv = iface.mapCanvas()
> ms = cnv.mapSettings()  <-- or create fresh: ms = QgsMapSettings()
> (manipulate map settings)
> cnv.applyMapSettings(ms)  <-- shouldn't this be possible?
> cnv.refresh()  <-- since cnv.map().render() is stubbed now
> cnv.saveAsImage(my_imgpath)

the QgsMapSettings object inside QgsMapCanvas is meant to be read-only
(it is a const reference in c++, however there is no such thing in
Python). The configuration of the map in canvas should be set by
calling the setter methods directly on QgsMapCanvas instance, which
will make sure that appropriate signals are emitted (so that other
components can react to it). Some of the QgsMapSettings properties are
meant to be automatically handled by QgsMapCanvas (e.g. output image
size or DPI), but it makes sense to have a method like
"applyMapSettings(ms)" that would apply all the allowed settings from
an external QgsMapSettings.

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

Reply via email to