From 9d059709bdc7a9d49131b4cb313afb52f10a11f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=BC=9F?= Date: Tue, 28 Apr 2026 14:39:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B0=94=E6=B3=A1=E6=B5=8B=E9=87=8F:=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B8=85=E9=99=A4=E5=90=8E=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E5=86=8D=E6=AC=A1=E4=BD=BF=E7=94=A8=E3=80=81VoidLimit=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E3=80=81=E8=B0=83=E6=95=B4ROI=E5=90=8E=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controls/PolygonRoiCanvas.xaml.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/XP.ImageProcessing.RoiControl/Controls/PolygonRoiCanvas.xaml.cs b/XP.ImageProcessing.RoiControl/Controls/PolygonRoiCanvas.xaml.cs index 2222c99..917ae39 100644 --- a/XP.ImageProcessing.RoiControl/Controls/PolygonRoiCanvas.xaml.cs +++ b/XP.ImageProcessing.RoiControl/Controls/PolygonRoiCanvas.xaml.cs @@ -386,12 +386,14 @@ namespace XP.ImageProcessing.RoiControl.Controls private System.Windows.Media.Imaging.WriteableBitmap _bubbleMask; private int _bubbleThreshold = 128; private int _bubbleBrushSize = 5; + private double _bubbleVoidLimit = 25.0; private bool _bubbleBrushDragging; private readonly System.Collections.Generic.Stack _bubbleUndoStack = new(); public void SetBubbleTool(BubbleSubTool tool) => _bubbleTool = tool; public void SetBubbleThreshold(int val) => _bubbleThreshold = val; public void SetBubbleBrushSize(int val) => _bubbleBrushSize = val; + public void SetBubbleVoidLimit(double val) { _bubbleVoidLimit = val; UpdateBubbleResult(); } public Rect? BubbleRoi => _bubbleRoi; /// 设置 BGA 测量的气泡/焊球绘制模式 @@ -467,6 +469,14 @@ namespace XP.ImageProcessing.RoiControl.Controls _angleTempVDot = _angleTempADot = null; _angleTempLineA = null; _angleTempV = _angleTempA = null; _angleClickCount = 0; _mDraggingDot = null; _mDraggingOwner = null; + // 清理气泡测量状态 + _bubbleRoiRect = null; _bubbleRoiHandle = null; _bubbleResultLabel = null; + _bubbleMaskImage = null; _bubbleMask = null; + _bubbleRoi = null; _bubbleRoiStart = null; + _bubbleRoiDragging = false; _bubbleRoiMoving = false; + _bubbleRoiResizing = false; _bubbleBrushDragging = false; + _bubbleTool = BubbleSubTool.Roi; + _bubbleUndoStack.Clear(); } public void ClearMeasurements() => RemoveMeasureOverlay(); @@ -1287,8 +1297,8 @@ namespace XP.ImageProcessing.RoiControl.Controls // 更新 ROI 上方标签 if (_bubbleResultLabel != null) { - string cls = voidRate <= 25.0 ? "PASS" : "FAIL"; - _bubbleResultLabel.Text = $"Void: {voidRate:F1}% | {cls}"; + string cls = voidRate <= _bubbleVoidLimit ? "PASS" : "FAIL"; + _bubbleResultLabel.Text = $"Void: {voidRate:F1}% | Limit: {_bubbleVoidLimit:F1}% | {cls}"; _bubbleResultLabel.Foreground = cls == "PASS" ? Brushes.Lime : Brushes.Red; Canvas.SetLeft(_bubbleResultLabel, roi.X); Canvas.SetTop(_bubbleResultLabel, roi.Y - 20);