本文整理汇总了Python中safe_qgis.report.map.Map.set_organisation_logo方法的典型用法代码示例。如果您正苦于以下问题:Python Map.set_organisation_logo方法的具体用法?Python Map.set_organisation_logo怎么用?Python Map.set_organisation_logo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类safe_qgis.report.map.Map
的用法示例。
在下文中一共展示了Map.set_organisation_logo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_custom_logo
# 需要导入模块: from safe_qgis.report.map import Map [as 别名]
# 或者: from safe_qgis.report.map.Map import set_organisation_logo [as 别名]
def test_custom_logo(self):
"""Test that setting user-defined logo works."""
LOGGER.info('Testing custom_logo')
layer, _ = load_layer('test_shakeimpact.shp')
canvas_layer = QgsMapCanvasLayer(layer)
CANVAS.setLayerSet([canvas_layer])
rect = QgsRectangle(106.7894, -6.2308, 106.8004, -6.2264)
CANVAS.setExtent(rect)
CANVAS.refresh()
report = Map(IFACE)
report.set_impact_layer(layer)
report.set_organisation_logo(":/plugins/inasafe/logo-flower.png")
out_path = unique_filename(
prefix='mapCustomLogoTest', suffix='.pdf', dir=temp_dir('test'))
report.make_pdf(out_path)
LOGGER.debug(out_path)
message = 'Rendered output does not exist: %s' % out_path
self.assertTrue(os.path.exists(out_path), message)
# pdf rendering is non deterministic so we can't do a hash check
# test_renderComposition renders just the image instead of pdf
# so we hash check there and here we just do a basic minimum file
# size check.
out_size = os.stat(out_path).st_size
# Note: You should replace, not append the numbers for a given
# platform. Also note that this test will break every time the
# version number of InaSAFE changes so we should ultimately come up
# with a lower maintenance test strategy.
expected_sizes = [
402083, # Ubuntu 13.04_64
400563, # Ubuntu 13.10_64
450385, # Ubuntu 14.04_64 AG
413193, # Ubuntu 14.04_64 TS pycharm
416313, # Ubuntu 14.04_64 TS make - TODO why is this?
419483, # Ubuntu 14.04_64 MB pycharm
413193, # Ubuntu 14.04_64 MB make - TODO why is this?
419036, # Ubuntu 14.04_64 IS pycharm
412764, # Ubuntu 14.04_64 IS make - TODO why is this?
367934, # Slackware64 14.0
82263, # Linux Mint 14_64
85418, # Windows 7 32bit
88779, # Windows 7 64bit
436118, # Jenkins ub 12.04
432703, # Travis
]
message = '%s\nExpected rendered map pdf to be in %s, got %s' % (
out_path, expected_sizes, out_size)
self.assertIn(out_size, expected_sizes, message)