From 5a1a992abd1beac4ff37c7884fdbd9c7688ec47a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=BC=9F?= Date: Mon, 27 Apr 2026 13:47:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B0=94=E6=B3=A1=E6=B5=8B=E9=87=8F=EF=BC=9ARO?= =?UTF-8?q?I=E4=B8=8A=E6=96=B9=E6=98=BE=E7=A4=BA=E7=A9=BA=E9=9A=99?= =?UTF-8?q?=E7=8E=87=E5=92=8CPASS/FAIL=E5=88=A4=E5=AE=9A=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controls/PolygonRoiCanvas.xaml.cs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/XP.ImageProcessing.RoiControl/Controls/PolygonRoiCanvas.xaml.cs b/XP.ImageProcessing.RoiControl/Controls/PolygonRoiCanvas.xaml.cs index 9bcd2c7..1130f59 100644 --- a/XP.ImageProcessing.RoiControl/Controls/PolygonRoiCanvas.xaml.cs +++ b/XP.ImageProcessing.RoiControl/Controls/PolygonRoiCanvas.xaml.cs @@ -375,6 +375,7 @@ namespace XP.ImageProcessing.RoiControl.Controls private BubbleSubTool _bubbleTool = BubbleSubTool.Roi; private Rectangle _bubbleRoiRect; private Ellipse _bubbleRoiHandle; // 右下角调整手柄 + private TextBlock _bubbleResultLabel; // ROI 上方结果标签 private Rect? _bubbleRoi; private Point? _bubbleRoiStart; private bool _bubbleRoiDragging; @@ -1137,6 +1138,16 @@ namespace XP.ImageProcessing.RoiControl.Controls }; _measureOverlay.Children.Add(_bubbleRoiHandle); } + if (_bubbleResultLabel == null) + { + _bubbleResultLabel = new TextBlock + { + FontSize = 13, FontWeight = FontWeights.Bold, + IsHitTestVisible = false, + Visibility = Visibility.Collapsed + }; + _measureOverlay.Children.Add(_bubbleResultLabel); + } } private void SyncBubbleRoiVisuals() @@ -1256,6 +1267,17 @@ namespace XP.ImageProcessing.RoiControl.Controls } double voidRate = roiArea > 0 ? voidArea * 100.0 / roiArea : 0; + // 更新 ROI 上方标签 + if (_bubbleResultLabel != null) + { + string cls = voidRate <= 25.0 ? "PASS" : "FAIL"; + _bubbleResultLabel.Text = $"Void: {voidRate:F1}% | {cls}"; + _bubbleResultLabel.Foreground = cls == "PASS" ? Brushes.Lime : Brushes.Red; + Canvas.SetLeft(_bubbleResultLabel, roi.X); + Canvas.SetTop(_bubbleResultLabel, roi.Y - 20); + _bubbleResultLabel.Visibility = Visibility.Visible; + } + RaiseMeasureCompleted(roi.TopLeft, roi.BottomRight, voidRate, 1, "BubbleVoid"); } @@ -1388,6 +1410,7 @@ namespace XP.ImageProcessing.RoiControl.Controls { if (_bubbleRoiRect != null) { _measureOverlay.Children.Remove(_bubbleRoiRect); _bubbleRoiRect = null; } if (_bubbleRoiHandle != null) { _measureOverlay.Children.Remove(_bubbleRoiHandle); _bubbleRoiHandle = null; } + if (_bubbleResultLabel != null) { _measureOverlay.Children.Remove(_bubbleResultLabel); _bubbleResultLabel = null; } if (_bubbleMaskImage != null) { _measureOverlay.Children.Remove(_bubbleMaskImage); _bubbleMaskImage = null; } } _bubbleRoi = null;