本文整理匯總了Python中safe_qgis.map.Map.getLegend方法的典型用法代碼示例。如果您正苦於以下問題:Python Map.getLegend方法的具體用法?Python Map.getLegend怎麽用?Python Map.getLegend使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類safe_qgis.map.Map
的用法示例。
在下文中一共展示了Map.getLegend方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_getLegend
# 需要導入模塊: from safe_qgis.map import Map [as 別名]
# 或者: from safe_qgis.map.Map import getLegend [as 別名]
def test_getLegend(self):
"""Getting a legend for a generic layer works."""
myLayer, myType = loadLayer('test_shakeimpact.shp')
del myType
myMap = Map(IFACE)
myMap.setImpactLayer(myLayer)
assert myMap.layer is not None
myLegend = myMap.getLegend()
myPath = os.path.join(temp_dir(), 'getLegend.png')
myLegend.save(myPath, 'PNG')
# As we have discovered, different versions of Qt and
# OS platforms cause different output, so hashes are a list
# of 'known good' renders.
myExpectedHashes = ['', # win
'd0c3071c4babe7db4f9762b311d61184', # ub12.04xiner
'b94cfd8a10d709ff28466ada425f24c8', # ub11.04-64
'00dc58aa50867de9b617ccfab0d13f21', # ub12.04
'e65853e217a4c9b0c2f303dd2aadb373', # ub12.04 xvfb
'e4273364b33a943e1108f519dbe8e06c', # ub12.04-64
'91177a81bee4400be4e85789e3be1e91', # binary read
'57da6f81b4a55507e1bed0b73423244b', # wVistaSP2-32
'']
assertHashesForFile(myExpectedHashes, myPath)