提升暴雨产图效率
This commit is contained in:
@@ -75,7 +75,7 @@ class TemplateCache:
|
||||
logger.info(f" 模板已缓存: {os.path.basename(template_path)} ({len(self._cache)} 个)")
|
||||
|
||||
def restore_template(self, template_path: str) -> tuple:
|
||||
"""从缓存恢复模板(跳过图层解析以加速)"""
|
||||
"""从缓存恢复模板"""
|
||||
cached = self._cache.get(template_path)
|
||||
if not cached:
|
||||
raise RuntimeError(f"模板未缓存: {template_path}")
|
||||
@@ -83,10 +83,8 @@ class TemplateCache:
|
||||
project = QgsProject.instance()
|
||||
t0 = time.time()
|
||||
|
||||
# FlagDontResolveLayers: 跳过数据库连接验证,缓存文件已含正确连接
|
||||
flags = QgsProject.ReadFlags()
|
||||
flags |= QgsProject.FlagDontResolveLayers
|
||||
project.read(cached["file"], flags)
|
||||
# 大部分图层已 GPKG 本地化,不需要 FlagDontResolveLayers
|
||||
project.read(cached["file"])
|
||||
|
||||
logger.debug(f" 恢复耗时: {time.time() - t0:.1f}s")
|
||||
return project, cached["texts"], cached["extent"]
|
||||
|
||||
Reference in New Issue
Block a user