diff --git a/swipemap.py b/swipemap.py index c76e2ec..49040f9 100644 --- a/swipemap.py +++ b/swipemap.py @@ -17,14 +17,9 @@ * (at your option) any later version. * * * ***************************************************************************/ -""" - -__author__ = 'Luiz Motta' -__date__ = '2015-10-14' -__copyright__ = '(C) 2018, Luiz Motta' -__revision__ = '$Format:%H$' - + The following changes are NOT MY WORK, they are a suggestion from @LreeLenn in ISSUE #19 +""" from qgis.PyQt.QtCore import QRect, QLine, Qt from qgis.PyQt.QtGui import QColor, QImage @@ -55,8 +50,8 @@ def setIsVertical(self, isVertical): self.isVertical = isVertical def setLength(self, x, y): - y = int(self.boundingRect().height() - y) - self.length = int(x) if self.isVertical else int(y) + y = self.boundingRect().height() - y + self.length = x if self.isVertical else y self.update() def paint(self, painter, *args): # NEED *args for WINDOWS! @@ -67,7 +62,6 @@ def paint(self, painter, *args): # NEED *args for WINDOWS! h = int(self.boundingRect().height() - 2) w = int(self.length) line = QLine( w-1,0,w-1,h-1 ) - else: h = int(self.boundingRect().height() - self.length) w = int(self.boundingRect().width() - 2) @@ -94,9 +88,11 @@ def finished(): settings = QgsMapSettings( self.canvas.mapSettings() ) settings.setLayers( self.layers ) settings.setBackgroundColor( QColor( Qt.transparent ) ) + + settings.setDevicePixelRatio( 1 ) self.setRect( self.canvas.extent() ) job = QgsMapRendererParallelJob( settings ) job.start() job.finished.connect( finished) - job.waitForFinished() + job.waitForFinished() \ No newline at end of file