#0018 修复图像处理界面参数区显示不全的问题;将参数及算子名称改为中文
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using XplorePlane.Views;
|
||||
using XplorePlane.ViewModels;
|
||||
@@ -21,6 +23,13 @@ namespace XplorePlane
|
||||
{
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
// 强制使用中文 UI,确保 ImageProcessing 库显示中文
|
||||
var zhCN = new CultureInfo("zh-CN");
|
||||
Thread.CurrentThread.CurrentCulture = zhCN;
|
||||
Thread.CurrentThread.CurrentUICulture = zhCN;
|
||||
CultureInfo.DefaultThreadCurrentCulture = zhCN;
|
||||
CultureInfo.DefaultThreadCurrentUICulture = zhCN;
|
||||
|
||||
// 配置 Serilog 日志系统
|
||||
ConfigureLogging();
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -12,6 +12,7 @@ namespace XplorePlane.Services
|
||||
IReadOnlyList<string> GetAvailableProcessors();
|
||||
IReadOnlyList<ProcessorParameter> GetProcessorParameters(string processorName);
|
||||
ImageProcessorBase GetProcessor(string processorName);
|
||||
string GetProcessorDisplayName(string processorName);
|
||||
void RegisterProcessor(string name, ImageProcessorBase processor);
|
||||
|
||||
Task<BitmapSource> ProcessImageAsync(
|
||||
|
||||
@@ -78,6 +78,15 @@ namespace XplorePlane.Services
|
||||
throw new ArgumentException($"Processor not registered or is 16-bit only: {processorName}", nameof(processorName));
|
||||
}
|
||||
|
||||
public string GetProcessorDisplayName(string processorName)
|
||||
{
|
||||
if (_processorRegistry.TryGetValue(processorName, out var p))
|
||||
return string.IsNullOrWhiteSpace(p.Name) ? processorName : p.Name;
|
||||
if (_processorRegistry16.TryGetValue(processorName, out var p16))
|
||||
return string.IsNullOrWhiteSpace(p16.Name) ? processorName : p16.Name;
|
||||
return processorName;
|
||||
}
|
||||
|
||||
public async Task<BitmapSource> ProcessImageAsync(
|
||||
BitmapSource source,
|
||||
string processorName,
|
||||
|
||||
@@ -11,12 +11,20 @@ using XplorePlane.Services;
|
||||
|
||||
namespace XplorePlane.ViewModels
|
||||
{
|
||||
/// <summary>算子列表项:持有注册 key 和本地化显示名</summary>
|
||||
public class ProcessorItem
|
||||
{
|
||||
public string Key { get; }
|
||||
public string DisplayName { get; }
|
||||
public ProcessorItem(string key, string displayName) { Key = key; DisplayName = displayName; }
|
||||
public override string ToString() => DisplayName;
|
||||
}
|
||||
public class ImageProcessingViewModel : BindableBase
|
||||
{
|
||||
private readonly IImageProcessingService _imageProcessingService;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private string _selectedProcessor;
|
||||
private ProcessorItem _selectedProcessorItem;
|
||||
private BitmapSource _currentImage;
|
||||
private BitmapSource _originalImage;
|
||||
private double _processingProgress;
|
||||
@@ -28,14 +36,12 @@ namespace XplorePlane.ViewModels
|
||||
_imageProcessingService = imageProcessingService;
|
||||
_logger = logger;
|
||||
|
||||
AvailableProcessors = new ObservableCollection<string>();
|
||||
AvailableProcessors = new ObservableCollection<ProcessorItem>();
|
||||
CurrentParameters = new ObservableCollection<ProcessorParameterVM>();
|
||||
|
||||
// Populate available processors
|
||||
foreach (var name in _imageProcessingService.GetAvailableProcessors())
|
||||
AvailableProcessors.Add(name);
|
||||
foreach (var key in _imageProcessingService.GetAvailableProcessors())
|
||||
AvailableProcessors.Add(new ProcessorItem(key, _imageProcessingService.GetProcessorDisplayName(key)));
|
||||
|
||||
// Initialize commands (stubs - implemented in tasks 7.2, 7.4, 7.7)
|
||||
SelectProcessorCommand = new DelegateCommand<string>(OnSelectProcessor);
|
||||
ApplyProcessingCommand = new DelegateCommand(OnApplyProcessing);
|
||||
ResetImageCommand = new DelegateCommand(OnResetImage);
|
||||
@@ -43,14 +49,21 @@ namespace XplorePlane.ViewModels
|
||||
SaveResultCommand = new DelegateCommand(OnSaveResult, () => CurrentImage != null);
|
||||
}
|
||||
|
||||
public ObservableCollection<string> AvailableProcessors { get; }
|
||||
public ObservableCollection<ProcessorItem> AvailableProcessors { get; }
|
||||
public ObservableCollection<ProcessorParameterVM> CurrentParameters { get; }
|
||||
|
||||
public string SelectedProcessor
|
||||
public ProcessorItem SelectedProcessorItem
|
||||
{
|
||||
get => _selectedProcessor;
|
||||
set => SetProperty(ref _selectedProcessor, value);
|
||||
get => _selectedProcessorItem;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _selectedProcessorItem, value);
|
||||
if (value != null) OnSelectProcessor(value.Key);
|
||||
}
|
||||
}
|
||||
|
||||
// Keep SelectedProcessor as the key string for service calls
|
||||
public string SelectedProcessor => _selectedProcessorItem?.Key;
|
||||
|
||||
public BitmapSource CurrentImage
|
||||
{
|
||||
|
||||
@@ -84,9 +84,9 @@
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="160" MinWidth="140" MaxWidth="200" />
|
||||
<ColumnDefinition Width="5" />
|
||||
<ColumnDefinition Width="*" MinWidth="400" />
|
||||
<ColumnDefinition Width="*" MinWidth="300" />
|
||||
<ColumnDefinition Width="5" />
|
||||
<ColumnDefinition Width="300" MinWidth="260" MaxWidth="380" />
|
||||
<ColumnDefinition Width="320" MinWidth="280" MaxWidth="420" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- ── 左侧操作栏 ── -->
|
||||
@@ -148,7 +148,9 @@
|
||||
|
||||
<!-- ── 右侧:算子选择 + 参数配置 ── -->
|
||||
<Border Grid.Column="4" Style="{StaticResource PanelBorderStyle}" Margin="0,0,0,0">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" VerticalAlignment="Top">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
VerticalAlignment="Top">
|
||||
<StackPanel Margin="10,8,10,10">
|
||||
|
||||
<GroupBox Header="选择算子" Margin="0,0,0,8">
|
||||
@@ -159,7 +161,7 @@
|
||||
FontFamily="{StaticResource CsdFont}"
|
||||
FontSize="12"
|
||||
ItemsSource="{Binding AvailableProcessors}"
|
||||
SelectedItem="{Binding SelectedProcessor}"
|
||||
SelectedItem="{Binding SelectedProcessorItem}"
|
||||
SelectionChanged="OnProcessorComboChanged" />
|
||||
</GroupBox>
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.Windows.Controls;
|
||||
using Prism.Ioc;
|
||||
using XplorePlane.Services;
|
||||
using XplorePlane.ViewModels;
|
||||
|
||||
namespace XplorePlane.Views
|
||||
{
|
||||
public partial class ImageProcessingPanelView : UserControl
|
||||
@@ -27,12 +26,12 @@ namespace XplorePlane.Views
|
||||
|
||||
private void OnProcessorComboChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (sender is ComboBox cmb && cmb.SelectedItem is string processorName
|
||||
if (sender is ComboBox cmb && cmb.SelectedItem is ProcessorItem item
|
||||
&& _imageProcessingService != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var processor = _imageProcessingService.GetProcessor(processorName);
|
||||
var processor = _imageProcessingService.GetProcessor(item.Key);
|
||||
parameterControl.LoadProcessor(processor);
|
||||
}
|
||||
catch (ArgumentException)
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:views="clr-namespace:XplorePlane.Views"
|
||||
Title="图像处理"
|
||||
Width="1000" Height="700"
|
||||
MinWidth="800" MinHeight="500"
|
||||
Width="1200" Height="750"
|
||||
MinWidth="900" MinHeight="550"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
ShowInTaskbar="False">
|
||||
<views:ImageProcessingPanelView />
|
||||
|
||||
@@ -175,6 +175,12 @@
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
||||
<!-- 图像处理中文卫星程序集 -->
|
||||
<None Include="Libs\ImageProcessing\zh-CN\*.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Link>zh-CN\%(Filename)%(Extension)</Link>
|
||||
</None>
|
||||
|
||||
<!-- 配置文件 -->
|
||||
<None Update="App.config">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
|
||||
@@ -13,3 +13,5 @@
|
||||
2026.3.14
|
||||
----------------------
|
||||
1、主页面的布局与拆分 √
|
||||
2、硬件层射线源的集成 √
|
||||
3、图像层集成,包括复刻一个示例界面,优化界面布局及算子中文 √
|
||||
Reference in New Issue
Block a user