本文整理匯總了Python中safe_qgis.map.Map.getVectorLegend方法的典型用法代碼示例。如果您正苦於以下問題:Python Map.getVectorLegend方法的具體用法?Python Map.getVectorLegend怎麽用?Python Map.getVectorLegend使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類safe_qgis.map.Map
的用法示例。
在下文中一共展示了Map.getVectorLegend方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_getVectorLegend
# 需要導入模塊: from safe_qgis.map import Map [as 別名]
# 或者: from safe_qgis.map.Map import getVectorLegend [as 別名]
def test_getVectorLegend(self):
"""Getting a legend for a vector layer works."""
myLayer, myType = loadLayer('test_shakeimpact.shp')
del myType
myMap = Map(IFACE)
myMap.setImpactLayer(myLayer)
myMap.getVectorLegend()
myPath = os.path.join(temp_dir(), 'getVectorLegend.png')
myMap.legend.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.
# Results currently identical to getLegend as image is same
myExpectedHashes = ['', # win
'd0c3071c4babe7db4f9762b311d61184', # ub12.04 xinr
'b94cfd8a10d709ff28466ada425f24c8', # ub11.04-64
'00dc58aa50867de9b617ccfab0d13f21', # ub12.04
'e65853e217a4c9b0c2f303dd2aadb373', # ub12.04 xvfb
'e4273364b33a943e1108f519dbe8e06c', # ub12.04-64
# ub11.04-64 laptop
'91177a81bee4400be4e85789e3be1e91', # Binary Read
'57da6f81b4a55507e1bed0b73423244b', # wVistaSP2-32
'']
assertHashesForFile(myExpectedHashes, myPath)