diff --git a/XplorePlane/ViewModels/Main/MainViewModel.cs b/XplorePlane/ViewModels/Main/MainViewModel.cs index 9da4c12..2041f83 100644 --- a/XplorePlane/ViewModels/Main/MainViewModel.cs +++ b/XplorePlane/ViewModels/Main/MainViewModel.cs @@ -92,7 +92,6 @@ namespace XplorePlane.ViewModels public DelegateCommand PointLineDistanceMeasureCommand { get; } public DelegateCommand AngleMeasureCommand { get; } public DelegateCommand ThroughHoleFillRateMeasureCommand { get; } - public DelegateCommand BgaVoidMeasureCommand { get; } public DelegateCommand BgaDetectionCommand { get; } public DelegateCommand VoidDetectionCommand { get; } public DelegateCommand BubbleMeasureCommand { get; } @@ -236,7 +235,6 @@ namespace XplorePlane.ViewModels PointLineDistanceMeasureCommand = new DelegateCommand(ExecutePointLineDistanceMeasure); AngleMeasureCommand = new DelegateCommand(ExecuteAngleMeasure); ThroughHoleFillRateMeasureCommand = new DelegateCommand(ExecuteThroughHoleFillRateMeasure); - BgaVoidMeasureCommand = new DelegateCommand(ExecuteBgaVoidMeasure); BgaDetectionCommand = new DelegateCommand(ExecuteBgaDetection); VoidDetectionCommand = new DelegateCommand(ExecuteVoidDetection); BubbleMeasureCommand = new DelegateCommand(ExecuteBubbleMeasure); @@ -554,31 +552,6 @@ namespace XplorePlane.ViewModels _eventAggregator.GetEvent().Publish(MeasurementToolMode.ThroughHoleFillRate); } - private Window _bgaMeasurePanel; - - private void ExecuteBgaVoidMeasure() - { - if (!CheckImageLoaded()) return; - _logger.Info("BGA空隙测量功能已触发"); - _eventAggregator.GetEvent().Publish(MeasurementToolMode.BgaVoid); - - if (_bgaMeasurePanel != null && _bgaMeasurePanel.IsVisible) - { - _bgaMeasurePanel.Activate(); - return; - } - - _bgaMeasurePanel = new Views.ImageProcessing.BgaMeasurePanel - { - Owner = System.Windows.Application.Current.MainWindow - }; - _bgaMeasurePanel.Closed += (s, e) => - { - _eventAggregator.GetEvent().Publish(MeasurementToolMode.None); - }; - _bgaMeasurePanel.Show(); - } - private Window _bgaDetectionPanel; private void ExecuteBgaDetection() diff --git a/XplorePlane/Views/ImageProcessing/BgaMeasurePanel.xaml b/XplorePlane/Views/ImageProcessing/BgaMeasurePanel.xaml deleted file mode 100644 index 87aad82..0000000 --- a/XplorePlane/Views/ImageProcessing/BgaMeasurePanel.xaml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/XplorePlane/Views/ImageProcessing/BgaMeasurePanel.xaml.cs b/XplorePlane/Views/ImageProcessing/BgaMeasurePanel.xaml.cs deleted file mode 100644 index ee34e2f..0000000 --- a/XplorePlane/Views/ImageProcessing/BgaMeasurePanel.xaml.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System.Windows; -using XP.ImageProcessing.RoiControl.Controls; - -namespace XplorePlane.Views.ImageProcessing -{ - public partial class BgaMeasurePanel : Window - { - private PolygonRoiCanvas _canvas; - - public BgaMeasurePanel() - { - InitializeComponent(); - Loaded += OnLoaded; - } - - private void OnLoaded(object sender, RoutedEventArgs e) - { - try - { - var mainWin = Owner as MainWindow; - if (mainWin != null) - _canvas = FindChild(mainWin); - } - catch { } - - // 模式切换:通知 canvas 切换气泡/焊球 - RbVoid.Checked += (s, ev) => - { - if (_canvas != null) _canvas.SetBgaDrawBall(false); - }; - RbBall.Checked += (s, ev) => - { - if (_canvas != null) _canvas.SetBgaDrawBall(true); - }; - - // VoidLimit 同步 - SliderVoidLimit.ValueChanged += (s, ev) => - { - TbVoidLimit.Text = SliderVoidLimit.Value.ToString("F1"); - _canvas?.SetBgaVoidLimit(SliderVoidLimit.Value); - }; - - // 监听测量完成事件更新结果 - if (_canvas != null) - { - _canvas.MeasureCompleted += (s, ev) => - { - if (ev is MeasureCompletedEventArgs args && args.MeasureType == "BgaVoid") - { - TbResult.Text = $"空隙率: {args.Distance:F1}%"; - } - }; - } - } - - private void Finish_Click(object sender, RoutedEventArgs e) - { - Close(); - } - - private static T FindChild(DependencyObject parent) where T : DependencyObject - { - int count = System.Windows.Media.VisualTreeHelper.GetChildrenCount(parent); - for (int i = 0; i < count; i++) - { - var child = System.Windows.Media.VisualTreeHelper.GetChild(parent, i); - if (child is T t) return t; - var result = FindChild(child); - if (result != null) return result; - } - return null; - } - } -} diff --git a/XplorePlane/Views/Main/MainWindow.xaml b/XplorePlane/Views/Main/MainWindow.xaml index a1995f5..a460208 100644 --- a/XplorePlane/Views/Main/MainWindow.xaml +++ b/XplorePlane/Views/Main/MainWindow.xaml @@ -236,15 +236,8 @@ Text="通孔填锡率" /> - + -