本文整理匯總了Python中safe_qgis.map.Map.addClassToLegend方法的典型用法代碼示例。如果您正苦於以下問題:Python Map.addClassToLegend方法的具體用法?Python Map.addClassToLegend怎麽用?Python Map.addClassToLegend使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類safe_qgis.map.Map
的用法示例。
在下文中一共展示了Map.addClassToLegend方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_addClassToLegend
# 需要導入模塊: from safe_qgis.map import Map [as 別名]
# 或者: from safe_qgis.map.Map import addClassToLegend [as 別名]
def test_addClassToLegend(self):
"""Test we can add a class to the map legend."""
myLayer, myType = loadLayer('test_shakeimpact.shp')
del myType
myMap = Map(IFACE)
myMap.setImpactLayer(myLayer)
myMap.legend = None
myColour = QtGui.QColor(12, 34, 126)
myMap.addClassToLegend(myColour,
theMin=None,
theMax=None,
theCategory=None,
theLabel='bar')
myMap.addClassToLegend(myColour,
theMin=None,
theMax=None,
theCategory=None,
theLabel='foo')
myPath = os.path.join(temp_dir(), 'addClassToLegend.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.
myExpectedHashes = ['', # win
'67c0f45792318298664dd02cc0ac94c3', # ub12.04xiner
'ea0702782c2ed5d950c427fbe1743858', # ub11.04-64
'53e0ba1144e071ad41756595d29bf444', # ub12.04
'0681c3587305074bc9272f456fb4dd09', # ub12.04 xvfb
'a37443d70604bdc8c279576b424a158c', # ub12.04-64
# ub11.04-64 laptop
'944cee3eb9d916816b60ef41e8069683', # binary read
'de3ceb6547ffc6c557d031c0b7ee9e75', # wVistaSP2-32
'',
]
assertHashesForFile(myExpectedHashes, myPath)