本文整理汇总了Python中PyQt5.QtGui.QBrush.setTransform方法的典型用法代码示例。如果您正苦于以下问题:Python QBrush.setTransform方法的具体用法?Python QBrush.setTransform怎么用?Python QBrush.setTransform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtGui.QBrush
的用法示例。
在下文中一共展示了QBrush.setTransform方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: textureRect
# 需要导入模块: from PyQt5.QtGui import QBrush [as 别名]
# 或者: from PyQt5.QtGui.QBrush import setTransform [as 别名]
def textureRect(self, rect_tile):
tile_info = rect_tile.data(0)
if tile_info is None:
return False
pm = QPixmap(self.__tiler.tile_to_path(tile_info))
if pm.width() != 256:
#print("Probably didn't get tile:", next_tile_info.x, next_tile_info.y, "\n")
#TODO: Attempt to texture with a lower res tile
#Bear in mind that you will have to take Mercator projection into
#account on the lower res tile.
#First Attempt: didn't work
#if tile_info.zoom <= self.__tiler.get_min_zoom():
# return False
#
#find colocated lower res tile
#(lat,lon) = tile_info.coord()
#tile_info2 = self.__tiler.coord_to_tile(lat,lon, tile_info.zoom-1)
#rect_tile.setData(0, tile_info2)
#print("prev tile: ", tile_info.tile, tile_info.coord())
#return self.textureRect(rect_tile, depth + 1)
#until such time as we can pull lower res tiles and figure out
#which area to render on a rectangle, skip:
return False
topLeft = rect_tile.boundingRect().topLeft()
bottomRight = rect_tile.boundingRect().bottomRight()
width = bottomRight.x() - topLeft.x()
height = bottomRight.y() - topLeft.y()
brush_trans = QTransform()
brush_trans.translate(topLeft.x(), topLeft.y())
brush_trans.scale(width/256.0, height/256.0)
qb = QBrush(pm)
qb.setTransform(brush_trans)
rect_tile.setBrush(qb)
return True