Bug report #11549
Change in map rendering causing problems with batch image saves
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Map Canvas | ||
Affected QGIS version: | 2.6.0 | Regression?: | No |
Operating System: | Windows | Easy fix?: | No |
Pull Request or Patch supplied: | No | Resolution: | invalid |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 19819 |
Description
I have code for a python plugin that follows this pattern:
- display vector layer A in map canvas
- use the canvas saveAsImage method to save map image
- hide vector layer A from map canvas
- display vector layer B in map canvas
- use the canvas saveAsImage method to save map image
- hide vector layer A from map canvas
I've been using this to bulk generate images for hundreds of map layers and it worked like a dream in 2.0 Dufour. But I updated to 2.6 Brighton and it no longer works. All the map images are created without the vector layers being visible.
It it seems as though the map redraws are being cached differently. If I remove the step to hide the vector layers, the images without the vector layers are produced just the same, but all the vector layers are rendered in the map canvas when the routine ends.
I tried using the canvas refresh method in the loop, but it made no difference.
I also compared the behaviour of the MMQGIS plugin's animation tools, which work in a similar way, and they have the same problem - i.e. they don't work with QGIS 2.6.
It seems like a bug to me, but if this behaviour is by design, are there any steps I can take to enable this kind of pattern again?
History
#1 Updated by Rich Burkmar about 10 years ago
Sorry - last line in pseudocode should read 'hide vector layer B from map canvas'.
#2 Updated by Giovanni Manghi about 10 years ago
- Resolution set to invalid
- Status changed from Open to Closed
a lot changed in rendering since qgis 2.0.1 so it is likely you will need to modify your code. Before saying it is a bug better ask in the developer mailing list, then eventually we can reopen this ticket. Cheers.
#3 Updated by Rich Burkmar about 10 years ago
Thanks - I will pursue it with the developer mailing list.