当前位置: 首页>>代码示例>>Python>>正文


Python Map.set_organisation_logo方法代码示例

本文整理汇总了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)
开发者ID:cccs-ip,项目名称:inasafe,代码行数:51,代码来源:test_map.py


注:本文中的safe_qgis.report.map.Map.set_organisation_logo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。