etiennesky / profiletool

14 stars 36 forks source link

Saving profile as PNG causes QGIS to crash #35

Closed mixedbredie closed 7 years ago

mixedbredie commented 7 years ago

I'm using QGIS 2.14.12 and QGIS 2.18.3 64-bit on Windows 7. Adding a GeoTIFF DEM and drawing a line with the plugin correctly renders a profile. Saving the profile as a PNG file causes a crash dump of QGIS after setting the output location and pressing the Save button.

Saving as PDF and SVG works as expected.

The Python warning console has the following in it:

2017-03-03T11:42:46 1   warning:C:\PROGRA~1\QGIS2~1.14\apps\Python27\lib\site-packages\matplotlib-1.3.1-py2.7-win-amd64.egg\matplotlib\collections.py:548: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison`
        if self._edgecolors == 'face':

        traceback:  File "C:/Users/mcdonaldr/.qgis2/python/plugins\profiletool\tools\ptmaptool.py", line 51, in canvasDoubleClickEvent
            self.emit( SIGNAL("doubleClicked"), {'x': event.pos().x(), 'y': event.pos().y()} )
          File "C:/Users/mcdonaldr/.qgis2/python/plugins\profiletool\profileplugin.py", line 203, in doubleClicked
            self.doprofile.calculateProfil(self.pointstoDraw,self.mdl, self.plotlibrary)
          File "C:/Users/mcdonaldr/.qgis2/python/plugins\profiletool\tools\doprofile.py", line 101, in calculateProfil
            PlottingTool().attachCurves(self.dockwidget, self.profiles, model1, library)
          File "C:/Users/mcdonaldr/.qgis2/python/plugins\profiletool\tools\plottingtool.py", line 177, in attachCurves
            self.changeColor(wdg, "Matplotlib", model1.item(i,1).data(Qt.BackgroundRole), tmp_name)
          File "C:/Users/mcdonaldr/.qgis2/python/plugins\profiletool\tools\plottingtool.py", line 271, in changeColor
            wdg.plotWdg.draw()
          File "C:\PROGRA~1\QGIS2~1.14\apps\Python27\lib\site-packages\matplotlib-1.3.1-py2.7-win-amd64.egg\matplotlib\backends\backend_qt4agg.py", line 154, in draw
            FigureCanvasAgg.draw(self)
          File "C:\PROGRA~1\QGIS2~1.14\apps\Python27\lib\site-packages\matplotlib-1.3.1-py2.7-win-amd64.egg\matplotlib\backends\backend_agg.py", line 451, in draw
            self.figure.draw(self.renderer)
          File "C:\PROGRA~1\QGIS2~1.14\apps\Python27\lib\site-packages\matplotlib-1.3.1-py2.7-win-amd64.egg\matplotlib\artist.py", line 55, in draw_wrapper
            draw(artist, renderer, *args, **kwargs)
          File "C:\PROGRA~1\QGIS2~1.14\apps\Python27\lib\site-packages\matplotlib-1.3.1-py2.7-win-amd64.egg\matplotlib\figure.py", line 1034, in draw
            func(*args)
          File "C:\PROGRA~1\QGIS2~1.14\apps\Python27\lib\site-packages\matplotlib-1.3.1-py2.7-win-amd64.egg\matplotlib\artist.py", line 55, in draw_wrapper
            draw(artist, renderer, *args, **kwargs)
          File "C:\PROGRA~1\QGIS2~1.14\apps\Python27\lib\site-packages\matplotlib-1.3.1-py2.7-win-amd64.egg\matplotlib\axes.py", line 2086, in draw
            a.draw(renderer)
          File "C:\PROGRA~1\QGIS2~1.14\apps\Python27\lib\site-packages\matplotlib-1.3.1-py2.7-win-amd64.egg\matplotlib\artist.py", line 55, in draw_wrapper
            draw(artist, renderer, *args, **kwargs)
          File "C:\PROGRA~1\QGIS2~1.14\apps\Python27\lib\site-packages\matplotlib-1.3.1-py2.7-win-amd64.egg\matplotlib\collections.py", line 276, in draw
            offsets, transOffset, self.get_facecolor(), self.get_edgecolor(),```
mixedbredie commented 7 years ago

I should add that this is using the matplotlib plot library. Switching to the Qwt5 library allows me to save as PNG.

patricev commented 7 years ago

Hi, Now PyQtGraph (4.0.1) is used as the plot library. It solves the issue. Regards