本文整理汇总了Python中safe.report.impact_report.ImpactReport.template方法的典型用法代码示例。如果您正苦于以下问题:Python ImpactReport.template方法的具体用法?Python ImpactReport.template怎么用?Python ImpactReport.template使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类safe.report.impact_report.ImpactReport
的用法示例。
在下文中一共展示了ImpactReport.template方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Xtest_print_impact_table
# 需要导入模块: from safe.report.impact_report import ImpactReport [as 别名]
# 或者: from safe.report.impact_report.ImpactReport import template [as 别名]
def Xtest_print_impact_table(self):
"""Test print impact table to pdf."""
impact_layer_path = test_data_path(
'impact', 'population_affected_entire_area.shp')
layer, _ = load_layer(impact_layer_path)
# noinspection PyUnresolvedReferences,PyArgumentList
QgsMapLayerRegistry.instance().addMapLayer(layer)
# noinspection PyCallingNonCallable
rect = QgsRectangle(106.8194, -6.2108, 106.8201, -6.1964)
CANVAS.setExtent(rect)
CANVAS.refresh()
template = resources_path(
'qgis-composer-templates', 'a4-portrait-blue.qpt')
report = ImpactReport(IFACE, template, layer)
report.template = template # just to cover set template
out_path = unique_filename(
prefix='test_print_impact_table',
suffix='.pdf',
dir=temp_dir('test'))
report.print_impact_table(out_path)
# Check the file exists
message = 'Rendered output does not exist: %s' % out_path
self.assertTrue(os.path.exists(out_path), message)
# Check the file is not corrupt
message = 'The output file %s is corrupt' % out_path
out_size = os.stat(out_path).st_size
self.assertTrue(out_size > 0, message)