管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2022-11-07 d8ce4e1d7fe96410a5fab96f46649280024ab2d9
QGIS/render_bak.py
@@ -51,9 +51,32 @@
layoutView.setContentsMargins(0, 0, 0, 0)
layoutView.setCurrentLayout(layout)
# project.layoutManager().addLayout(layout)
# map = QgsLayoutItemMap(layout)
# map.zoomToExtent(iface.mapCanvas().extent())
# # map.zoomToExtent(layers[0].extent())
# # map.attemptResize(QgsLayoutSize(2480, 1748, QgsUnitTypes.LayoutPixels))
# layout.addItem(map)
# collection = layout.pageCollection()
# collection.deletePage(0)
# page = QgsLayoutItemPage(layout)
# page.setPageSize('A5', True)
# collection.addPage(page)
# collection.redraw()
# collection = layout.pageCollection()
# page = collection.page(0)
# # QgsUnitTypes.LayoutCentimeters
# # size = QgsLayoutSize(2480, 1748, QgsUnitTypes.LayoutPixels)
# page.setPageSize('A5', True)
# imgSetting = QgsLayoutExporter.ImageExportSettings()
# imgSetting.imageSize.width = 4096
# imgSetting.imageSize.heigth = 3507
# layout.updateBounds()
# layout.refresh()
# page.redraw()
# collection.redraw()
exporter = QgsLayoutExporter(layout)
img_path = os.path.join("e:/", "render.png")