218 lines
13 KiB
XML
218 lines
13 KiB
XML
<UserControl x:Class="XP.Camera.Calibration.Controls.CalibrationControl"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:cal="clr-namespace:XP.Camera.Calibration"
|
|
xmlns:controls="clr-namespace:XP.Camera.Calibration.Controls"
|
|
xmlns:roi="clr-namespace:XP.ImageProcessing.RoiControl.Controls;assembly=XP.ImageProcessing.RoiControl"
|
|
mc:Ignorable="d"
|
|
d:DesignHeight="850"
|
|
d:DesignWidth="1400">
|
|
<UserControl.Resources>
|
|
<cal:CalibrationLocalizedStrings x:Key="LocalizedStrings" />
|
|
<SolidColorBrush x:Key="PrimaryColor" Color="#F5F5F5" />
|
|
<SolidColorBrush x:Key="AccentColor" Color="#0078D4" />
|
|
<SolidColorBrush x:Key="BackgroundColor" Color="#FAFAFA" />
|
|
<SolidColorBrush x:Key="SidebarColor" Color="#FFFFFF" />
|
|
<SolidColorBrush x:Key="BorderColor" Color="#E1E1E1" />
|
|
<SolidColorBrush x:Key="TextColor" Color="#333333" />
|
|
<SolidColorBrush x:Key="TextSecondaryColor" Color="#666666" />
|
|
|
|
<Style x:Key="ToolbarButtonStyle" TargetType="Button">
|
|
<Setter Property="Width" Value="80" />
|
|
<Setter Property="Height" Value="66" />
|
|
<Setter Property="Margin" Value="0,0,6,0" />
|
|
<Setter Property="Background" Value="White" />
|
|
<Setter Property="Foreground" Value="{StaticResource TextColor}" />
|
|
<Setter Property="BorderBrush" Value="{StaticResource BorderColor}" />
|
|
<Setter Property="BorderThickness" Value="1" />
|
|
<Setter Property="Cursor" Value="Hand" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="Button">
|
|
<Border Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
CornerRadius="6">
|
|
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
|
<ContentPresenter Content="{TemplateBinding Tag}"
|
|
HorizontalAlignment="Center"
|
|
Margin="0,2,0,3" />
|
|
<TextBlock Text="{TemplateBinding Content}"
|
|
FontSize="10.5"
|
|
HorizontalAlignment="Center"
|
|
Foreground="{TemplateBinding Foreground}"
|
|
TextWrapping="Wrap"
|
|
TextAlignment="Center" />
|
|
</StackPanel>
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter Property="Background" Value="#EAF2FB" />
|
|
<Setter Property="BorderBrush" Value="#B0D4F1" />
|
|
</Trigger>
|
|
<Trigger Property="IsPressed" Value="True">
|
|
<Setter Property="Background" Value="#CCE8FF" />
|
|
</Trigger>
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
<Setter Property="Opacity" Value="0.5" />
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
</UserControl.Resources>
|
|
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="*" />
|
|
<RowDefinition Height="Auto" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<Border Grid.Row="0" Background="#FAFAFA" BorderBrush="{StaticResource BorderColor}"
|
|
BorderThickness="0,0,0,1" Padding="12,8">
|
|
<StackPanel Orientation="Horizontal">
|
|
<Button Content="{Binding Source={StaticResource LocalizedStrings}, Path=CalibrationLoadImage}"
|
|
Command="{Binding LoadImageCommand}" FontFamily="Segoe UI"
|
|
Style="{StaticResource ToolbarButtonStyle}">
|
|
<Button.Tag>
|
|
<Image Source="/XP.Camera;component/Calibration/Resources/添加图像.png" Width="24" Height="24" />
|
|
</Button.Tag>
|
|
</Button>
|
|
<Button Content="{Binding Source={StaticResource LocalizedStrings}, Path=CalibrationLoadCsv}"
|
|
Command="{Binding LoadCsvCommand}" FontFamily="Segoe UI"
|
|
Style="{StaticResource ToolbarButtonStyle}">
|
|
<Button.Tag>
|
|
<Image Source="/XP.Camera;component/Calibration/Resources/外部导入.png" Width="24" Height="24" />
|
|
</Button.Tag>
|
|
</Button>
|
|
<Button Content="采集当前点"
|
|
Command="{Binding CapturePointCommand}" FontFamily="Segoe UI"
|
|
Style="{StaticResource ToolbarButtonStyle}">
|
|
<Button.Tag>
|
|
<Image Source="/XP.Camera;component/Calibration/Resources/执行.png" Width="24" Height="24" />
|
|
</Button.Tag>
|
|
</Button>
|
|
<Button Content="删除选中"
|
|
Command="{Binding DeleteSelectedPointCommand}" FontFamily="Segoe UI"
|
|
Style="{StaticResource ToolbarButtonStyle}">
|
|
<Button.Tag>
|
|
<TextBlock Text="✕" FontSize="20" Foreground="Red" HorizontalAlignment="Center" />
|
|
</Button.Tag>
|
|
</Button>
|
|
<Button Content="{Binding Source={StaticResource LocalizedStrings}, Path=CalibrationExecute}"
|
|
Command="{Binding CalibrateCommand}" FontFamily="Segoe UI"
|
|
Style="{StaticResource ToolbarButtonStyle}">
|
|
<Button.Tag>
|
|
<Image Source="/XP.Camera;component/Calibration/Resources/执行.png" Width="24" Height="24" />
|
|
</Button.Tag>
|
|
</Button>
|
|
<Button Content="{Binding Source={StaticResource LocalizedStrings}, Path=CalibrationSave}"
|
|
Command="{Binding SaveCalibrationCommand}" FontFamily="Segoe UI"
|
|
Style="{StaticResource ToolbarButtonStyle}">
|
|
<Button.Tag>
|
|
<Image Source="/XP.Camera;component/Calibration/Resources/保存结果.png" Width="24" Height="24" />
|
|
</Button.Tag>
|
|
</Button>
|
|
<Button Content="{Binding Source={StaticResource LocalizedStrings}, Path=CalibrationLoad}"
|
|
Command="{Binding LoadCalibrationCommand}" FontFamily="Segoe UI"
|
|
Style="{StaticResource ToolbarButtonStyle}">
|
|
<Button.Tag>
|
|
<Image Source="/XP.Camera;component/Calibration/Resources/加载数据.png" Width="24" Height="24" />
|
|
</Button.Tag>
|
|
</Button>
|
|
<CheckBox Content="{Binding Source={StaticResource LocalizedStrings}, Path=CalibrationShowWorld}"
|
|
VerticalAlignment="Center" FontFamily="Segoe UI"
|
|
IsChecked="{Binding ShowWorldCoordinates}"
|
|
Margin="10,0,0,0" FontSize="13" Foreground="{StaticResource TextColor}" />
|
|
<ToggleButton IsChecked="{Binding IsLiveView}" VerticalAlignment="Center" Margin="10,0,0,0"
|
|
Width="80" Height="66" Cursor="Hand" FontFamily="Segoe UI">
|
|
<ToggleButton.Template>
|
|
<ControlTemplate TargetType="ToggleButton">
|
|
<Border x:Name="Bd" Background="White" BorderBrush="#E1E1E1"
|
|
BorderThickness="1" CornerRadius="6">
|
|
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
|
<TextBlock x:Name="Icon" Text="▶" FontSize="20" HorizontalAlignment="Center" Margin="0,2,0,3" />
|
|
<TextBlock x:Name="Label" Text="实时" FontSize="10.5" HorizontalAlignment="Center" />
|
|
</StackPanel>
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsChecked" Value="True">
|
|
<Setter TargetName="Icon" Property="Text" Value="⏸" />
|
|
<Setter TargetName="Label" Property="Text" Value="冻结" />
|
|
<Setter TargetName="Bd" Property="Background" Value="#E8F5E9" />
|
|
<Setter TargetName="Bd" Property="BorderBrush" Value="#81C784" />
|
|
</Trigger>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter TargetName="Bd" Property="Background" Value="#EAF2FB" />
|
|
<Setter TargetName="Bd" Property="BorderBrush" Value="#B0D4F1" />
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</ToggleButton.Template>
|
|
</ToggleButton>
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
<Grid Grid.Row="1">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="400" />
|
|
<ColumnDefinition Width="*" />
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<Border Grid.Column="0" BorderBrush="{StaticResource BorderColor}" BorderThickness="0,0,1,0"
|
|
Background="{StaticResource SidebarColor}">
|
|
<Grid Margin="12">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="*" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<TextBlock Grid.Row="0" Text="{Binding Source={StaticResource LocalizedStrings}, Path=CalibrationPointList}"
|
|
FontSize="15" FontWeight="SemiBold" FontFamily="Segoe UI"
|
|
Margin="0,0,0,12" Foreground="{StaticResource TextColor}" />
|
|
|
|
<DataGrid Grid.Row="1" AutoGenerateColumns="False" CanUserAddRows="True"
|
|
ItemsSource="{Binding CalibrationPoints}"
|
|
SelectedItem="{Binding SelectedPoint}"
|
|
HeadersVisibility="Column" GridLinesVisibility="All"
|
|
FontFamily="Segoe UI"
|
|
BorderBrush="{StaticResource BorderColor}" BorderThickness="1">
|
|
<DataGrid.Columns>
|
|
<DataGridTextColumn Header="{Binding Source={StaticResource LocalizedStrings}, Path=CalibrationPixelX}"
|
|
Binding="{Binding PixelX}" FontFamily="Segoe UI" Width="*" />
|
|
<DataGridTextColumn Header="{Binding Source={StaticResource LocalizedStrings}, Path=CalibrationPixelY}"
|
|
Binding="{Binding PixelY}" FontFamily="Segoe UI" Width="*" />
|
|
<DataGridTextColumn Header="{Binding Source={StaticResource LocalizedStrings}, Path=CalibrationWorldX}"
|
|
Binding="{Binding WorldX}" FontFamily="Segoe UI" Width="*" />
|
|
<DataGridTextColumn Header="{Binding Source={StaticResource LocalizedStrings}, Path=CalibrationWorldY}"
|
|
Binding="{Binding WorldY}" FontFamily="Segoe UI" Width="*" />
|
|
</DataGrid.Columns>
|
|
</DataGrid>
|
|
</Grid>
|
|
</Border>
|
|
|
|
<Grid Grid.Column="1" Background="{StaticResource BackgroundColor}">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="*" />
|
|
<RowDefinition Height="Auto" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<roi:PolygonRoiCanvas Grid.Row="0" x:Name="roiCanvas" Margin="12,12,12,8"
|
|
ImageSource="{Binding ImageSource}" />
|
|
|
|
<Border Grid.Row="1" Background="White" BorderBrush="{StaticResource BorderColor}" BorderThickness="1"
|
|
Margin="12,0,12,12" Padding="12" MinHeight="80">
|
|
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
|
|
<TextBlock TextWrapping="Wrap" FontSize="12"
|
|
Text="{Binding StatusText}" FontFamily="Segoe UI"
|
|
Foreground="{StaticResource TextColor}" />
|
|
</ScrollViewer>
|
|
</Border>
|
|
</Grid>
|
|
</Grid>
|
|
</Grid>
|
|
</UserControl> |