删除BGA手动测量工具
This commit is contained in:
@@ -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<MeasurementToolEvent>().Publish(MeasurementToolMode.ThroughHoleFillRate);
|
||||
}
|
||||
|
||||
private Window _bgaMeasurePanel;
|
||||
|
||||
private void ExecuteBgaVoidMeasure()
|
||||
{
|
||||
if (!CheckImageLoaded()) return;
|
||||
_logger.Info("BGA空隙测量功能已触发");
|
||||
_eventAggregator.GetEvent<MeasurementToolEvent>().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<MeasurementToolEvent>().Publish(MeasurementToolMode.None);
|
||||
};
|
||||
_bgaMeasurePanel.Show();
|
||||
}
|
||||
|
||||
private Window _bgaDetectionPanel;
|
||||
|
||||
private void ExecuteBgaDetection()
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
<Window
|
||||
x:Class="XplorePlane.Views.ImageProcessing.BgaMeasurePanel"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="BGA空隙测量"
|
||||
Width="280" Height="280"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
Topmost="True" ShowInTaskbar="False"
|
||||
Background="#F5F5F5" FontFamily="Microsoft YaHei UI">
|
||||
<Window.Resources>
|
||||
<Style x:Key="IconBtnStyle" TargetType="ButtonBase">
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ButtonBase">
|
||||
<Border x:Name="Bd" Background="#FFFFFF" BorderBrush="#E0E0E0"
|
||||
BorderThickness="1" CornerRadius="6" Padding="10,6">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Bd" Property="Background" Value="#EAF2FB" />
|
||||
<Setter TargetName="Bd" Property="BorderBrush" Value="#B0D4F1" />
|
||||
</Trigger>
|
||||
<DataTrigger Binding="{Binding IsChecked, RelativeSource={RelativeSource Self}}" Value="True">
|
||||
<Setter TargetName="Bd" Property="Background" Value="#005FB8" />
|
||||
<Setter TargetName="Bd" Property="BorderBrush" Value="#004C99" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
</DataTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="CardStyle" TargetType="Border">
|
||||
<Setter Property="Background" Value="White" />
|
||||
<Setter Property="BorderBrush" Value="#E8E8E8" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="CornerRadius" Value="8" />
|
||||
<Setter Property="Padding" Value="12,10" />
|
||||
<Setter Property="Margin" Value="0,0,0,8" />
|
||||
</Style>
|
||||
<Style x:Key="ParamLabel" TargetType="TextBlock">
|
||||
<Setter Property="FontSize" Value="11" />
|
||||
<Setter Property="Foreground" Value="#555" />
|
||||
<Setter Property="Margin" Value="0,0,0,3" />
|
||||
</Style>
|
||||
<Style TargetType="TextBox">
|
||||
<Setter Property="BorderBrush" Value="#D0D0D0" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="Padding" Value="4,3" />
|
||||
<Setter Property="FontSize" Value="11.5" />
|
||||
<Style.Resources>
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="CornerRadius" Value="4" />
|
||||
</Style>
|
||||
</Style.Resources>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
<StackPanel Margin="10">
|
||||
<!-- 工具栏 -->
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,10">
|
||||
<RadioButton x:Name="RbVoid" IsChecked="True" Style="{StaticResource IconBtnStyle}" ToolTip="画气泡" Margin="0,0,4,0">
|
||||
<Image Source="/Assets/Icons/bubble.png" Width="20" Height="20" />
|
||||
</RadioButton>
|
||||
<RadioButton x:Name="RbBall" Style="{StaticResource IconBtnStyle}" ToolTip="画焊球" Margin="0,0,10,0">
|
||||
<TextBlock Text="焊球" FontSize="11" VerticalAlignment="Center" />
|
||||
</RadioButton>
|
||||
<Button Style="{StaticResource IconBtnStyle}" ToolTip="完成" Click="Finish_Click">
|
||||
<Image Source="/Assets/Icons/ok.png" Width="20" Height="20" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
<!-- 提示 -->
|
||||
<TextBlock Text="左键点两次画圆(圆心+半径),右键删除" FontSize="10" Foreground="#999" Margin="0,0,0,8" />
|
||||
|
||||
<!-- 参数卡片 -->
|
||||
<Border Style="{StaticResource CardStyle}">
|
||||
<StackPanel>
|
||||
<TextBlock Text="VoidLimit(%)" Style="{StaticResource ParamLabel}" />
|
||||
<DockPanel>
|
||||
<TextBox x:Name="TbVoidLimit" DockPanel.Dock="Right" Width="50" Text="25.0"
|
||||
VerticalContentAlignment="Center" Margin="6,0,0,0" />
|
||||
<Slider x:Name="SliderVoidLimit" Minimum="0" Maximum="100" Value="25"
|
||||
VerticalAlignment="Center" />
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 结果卡片 -->
|
||||
<Border Style="{StaticResource CardStyle}">
|
||||
<TextBlock x:Name="TbResult" Text="空隙率: --" FontSize="13" FontWeight="SemiBold" Foreground="#333" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</Window>
|
||||
@@ -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<PolygonRoiCanvas>(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<T>(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<T>(child);
|
||||
if (result != null) return result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -236,15 +236,8 @@
|
||||
Text="通孔填锡率" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- 第三列: BGA空隙测量 + 气泡测量 -->
|
||||
<!-- 第三列: 气泡测量 -->
|
||||
<StackPanel>
|
||||
<telerik:RadRibbonButton
|
||||
telerik:ScreenTip.Description="BGA焊球空隙率检测"
|
||||
telerik:ScreenTip.Title="BGA空隙测量"
|
||||
Command="{Binding BgaVoidMeasureCommand}"
|
||||
Size="Medium"
|
||||
SmallImage="/Assets/Icons/bga.png"
|
||||
Text="BGA空隙" />
|
||||
<telerik:RadRibbonButton
|
||||
telerik:ScreenTip.Description="手动气泡测量(魔棒+画笔)"
|
||||
telerik:ScreenTip.Title="气泡测量"
|
||||
|
||||
Reference in New Issue
Block a user