本文整理匯總了Python中safe_qgis.map.Map.drawPixmap方法的典型用法代碼示例。如果您正苦於以下問題:Python Map.drawPixmap方法的具體用法?Python Map.drawPixmap怎麽用?Python Map.drawPixmap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類safe_qgis.map.Map
的用法示例。
在下文中一共展示了Map.drawPixmap方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_windowsDrawingArtifacts
# 需要導入模塊: from safe_qgis.map import Map [as 別名]
# 或者: from safe_qgis.map.Map import drawPixmap [as 別名]
def test_windowsDrawingArtifacts(self):
"""Test that windows rendering does not make artifacts"""
# sometimes spurious lines are drawn on the layout
myMap = Map(IFACE)
myMap.setupComposition()
myPdfPath = os.path.join(temp_dir(), 'outArtifactsTest.pdf')
myMap.setupPrinter(myPdfPath)
myPixmap = QtGui.QPixmap(10, 10)
myPixmap.fill(QtGui.QColor(250, 250, 250))
myFilename = os.path.join(temp_dir(), 'greyBox')
myPixmap.save(myFilename, 'PNG')
for i in range(10, 190, 10):
myPicture = QgsComposerPicture(myMap.composition)
myPicture.setPictureFile(myFilename)
myPicture.setFrame(False)
myPicture.setItemPosition(i, # x
i, # y
10, # width
10) # height
myMap.composition.addItem(myPicture)
# Same drawing drawn directly as a pixmap
myPixmapItem = myMap.composition.addPixmap(myPixmap)
myPixmapItem.setOffset(i, i + 20)
# Same drawing using our drawPixmap Helper
myWidthMM = 1
myMap.drawPixmap(myPixmap, myWidthMM, i, i + 40)
myMap.renderPrintout()
myUnwantedHash = 'd05e9223d50baf8bb147475aa96d6ba3'
myHash = hashForFile(myPdfPath)
# when this test no longer matches our broken render hash
# we know the issue is fixed
myMessage = 'Windows map render still draws with artifacts.'
assert myHash != myUnwantedHash, myMessage