Step10 Kriging 输出路径强制 14_visualization + Step11 掩膜自动填入

This commit is contained in:
DXC
2026-06-16 14:12:10 +08:00
parent 0238aa66ab
commit 5084f7d049
3 changed files with 176 additions and 7 deletions

View File

@ -566,6 +566,39 @@ class Step11MapPanel(QWidget):
if not existing_out or not existing_out.strip():
self.output_dir.set_path(output_dir)
# 4.5. 自动探测 Step1 水体掩膜(修复张冠李戴:原仅找 roi.shp找不到时未尝试 1_water_mask
# 优先调用 main_window.pipeline.get_step_output_dir('step1')(数据真实来源)
# 兜底走 resolve_subdir('water_mask') → <work_dir>/1_water_mask
# Step1 典型产物water_mask_from_ndwi.dat、water_mask_from_shp.dat、xxx.shp
if self.work_dir:
water_mask_dir = None
pipeline = None
try:
_win = self.window()
if _win is not None:
pipeline = getattr(_win, 'pipeline', None)
except Exception:
pipeline = None
if pipeline is not None and hasattr(pipeline, 'get_step_output_dir'):
try:
water_mask_dir = pipeline.get_step_output_dir('step1')
except Exception as e:
print(f"⚠️ [step11_map_panel] pipeline.get_step_output_dir('step1') 失败: {e}")
water_mask_dir = None
if not water_mask_dir:
water_mask_dir = resolve_subdir(self.work_dir, 'water_mask')
existing_boundary = (self.boundary_file.get_path() or "").strip()
if not existing_boundary and water_mask_dir and os.path.isdir(water_mask_dir):
# 优先 .shpgeopandas 读矢量最稳),其次 .dat
mask_candidates = (
sorted(Path(water_mask_dir).glob("*.shp"))
+ sorted(Path(water_mask_dir).glob("*.dat"))
)
if mask_candidates:
self.boundary_file.set_path(str(mask_candidates[0]))
print(f"✅ [step11_map_panel] 自动从 Step1 掩膜目录填入: {mask_candidates[0]}")
# 5. 自动探测原始矢量边界文件(.shp作为专题图底图
# 优先回溯 input-test/roi.shpgeopandas.read_file 仅支持矢量格式
if self.work_dir: