From 9d39e6116171c23c1e733163f6d45e68861f7fa8 Mon Sep 17 00:00:00 2001 From: DXC Date: Sat, 9 May 2026 14:35:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=87=AA=E5=8A=A8=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=20.shp=E2=86=92.dat=20=E6=B0=B4=E5=9F=9F?= =?UTF-8?q?=E6=8E=A9=E8=86=9C=EF=BC=8C=E8=A7=A3=E5=86=B3=E6=8F=92=E5=80=BC?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/water_quality_inversion_pipeline_GUI.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/core/water_quality_inversion_pipeline_GUI.py b/src/core/water_quality_inversion_pipeline_GUI.py index 6f81a94..b63c1cb 100644 --- a/src/core/water_quality_inversion_pipeline_GUI.py +++ b/src/core/water_quality_inversion_pipeline_GUI.py @@ -1679,10 +1679,16 @@ class WaterQualityInversionPipeline: return self.deglint_img_path # 确定使用的水域掩膜 - # 优先级:1. 用户提供的water_mask参数 2. 步骤1生成的dat格式掩膜 3. None(处理全图) final_water_mask = water_mask + + # 【新增智能转换逻辑】:如果 GUI 传入的是 .shp,且第一步已经生成了 .dat 掩膜,强制替换为栅格 .dat + if final_water_mask is not None and str(final_water_mask).lower().endswith('.shp'): + if self.water_mask_path is not None and Path(self.water_mask_path).exists(): + print(f"检测到输入掩膜为 .shp 矢量文件,自动替换为步骤1生成的栅格掩膜: {self.water_mask_path}") + final_water_mask = self.water_mask_path + + # 优先级处理 if final_water_mask is None: - # 尝试使用步骤1生成的dat格式掩膜 if self.water_mask_path is not None: final_water_mask = self.water_mask_path print(f"使用步骤1生成的水域掩膜: {final_water_mask}")