From 5fa6f4025d334fdc8314c783d8807ef94fe7f040 Mon Sep 17 00:00:00 2001 From: "DESKTOP-VO9ISA2\\zhengxuan.zhang" Date: Mon, 20 Apr 2026 09:37:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=BE=E5=83=8F=E7=AE=97?= =?UTF-8?q?=E5=AD=90=E5=B7=A5=E5=85=B7=E7=AE=B1=E7=9A=84=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E4=B8=8E=E6=B5=81=E7=A8=8B=E5=9B=BE=E7=95=8C=E9=9D=A2=E4=BF=9D?= =?UTF-8?q?=E6=8C=81=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pipeline/PipelineEditorViewModelTests.cs | 14 +++++++++- .../OperatorToolboxViewModel.cs | 24 +++-------------- .../PipelineEditorViewModel.cs | 8 +++--- .../ImageProcessing/PipelineEditorView.xaml | 4 +-- XplorePlane/XplorePlane.csproj | 6 ++--- XplorePlane/readme.txt | 26 +++++++++++++++---- 6 files changed, 48 insertions(+), 34 deletions(-) diff --git a/XplorePlane.Tests/Pipeline/PipelineEditorViewModelTests.cs b/XplorePlane.Tests/Pipeline/PipelineEditorViewModelTests.cs index 19eb3b6..cb13fd8 100644 --- a/XplorePlane.Tests/Pipeline/PipelineEditorViewModelTests.cs +++ b/XplorePlane.Tests/Pipeline/PipelineEditorViewModelTests.cs @@ -44,6 +44,18 @@ namespace XplorePlane.Tests.Pipeline Assert.Equal(0, vm.PipelineNodes[0].Order); } + [Fact] + public void AddOperator_KnownKey_SetsIconPath() + { + _mockImageSvc.Setup(s => s.GetAvailableProcessors()).Returns(new[] { "ShockFilter" }); + + var vm = CreateVm(); + vm.AddOperatorCommand.Execute("ShockFilter"); + + Assert.Single(vm.PipelineNodes); + Assert.Equal("⚡", vm.PipelineNodes[0].IconPath); + } + [Fact] public void AddOperator_InvalidKey_NodeNotAdded() { @@ -276,4 +288,4 @@ namespace XplorePlane.Tests.Pipeline Assert.True(vmMax.IsValueValid); } } -} \ No newline at end of file +} diff --git a/XplorePlane/ViewModels/ImageProcessing/OperatorToolboxViewModel.cs b/XplorePlane/ViewModels/ImageProcessing/OperatorToolboxViewModel.cs index b64ee03..a39b047 100644 --- a/XplorePlane/ViewModels/ImageProcessing/OperatorToolboxViewModel.cs +++ b/XplorePlane/ViewModels/ImageProcessing/OperatorToolboxViewModel.cs @@ -37,21 +37,7 @@ namespace XplorePlane.ViewModels private readonly IImageProcessingService _imageProcessingService; private string _searchText = string.Empty; - // 算子 Key -> (分类名, 分类图标, 算子图标) 映射 - private static readonly Dictionary CategoryMap = new() - { - ["GaussianBlur"] = ("滤波与平滑", "🔵", "🌀"), - ["GaussianBlur16"] = ("滤波与平滑", "🔵", "🌀"), - ["BandPassFilter"] = ("滤波与平滑", "🔵", "📶"), - ["ShockFilter"] = ("滤波与平滑", "🔵", "⚡"), - ["Contrast"] = ("增强与校正", "🟡", "🔆"), - ["Gamma"] = ("增强与校正", "🟡", "🌗"), - ["FlatFieldCorrection16"] = ("增强与校正", "🟡", "📐"), - ["Threshold"] = ("分割与阈值", "🟢", "📊"), - ["Division"] = ("分割与阈值", "🟢", "➗"), - ["Morphology"] = ("形态学与轮廓", "🔴", "🔲"), - ["Contour"] = ("形态学与轮廓", "🔴", "✏️"), - }; + // UI 元数据(分类 + 图标)由 OperatorUiMetadata 统一提供,保持工具箱与流水线图标一致 public OperatorToolboxViewModel(IImageProcessingService imageProcessingService) { @@ -82,10 +68,8 @@ namespace XplorePlane.ViewModels foreach (var key in _imageProcessingService.GetAvailableProcessors()) { var displayName = _imageProcessingService.GetProcessorDisplayName(key); - var (category, catIcon, opIcon) = CategoryMap.TryGetValue(key, out var info) - ? info - : ("其他", "⚙", "⚙"); - AvailableOperators.Add(new OperatorDescriptor(key, displayName ?? key, opIcon, category, catIcon)); + var (category, categoryIcon, operatorIcon) = OperatorUiMetadata.Get(key); + AvailableOperators.Add(new OperatorDescriptor(key, displayName ?? key, operatorIcon, category, categoryIcon)); } ApplyFilter(); } @@ -128,4 +112,4 @@ namespace XplorePlane.ViewModels _ => 99 }; } -} \ No newline at end of file +} diff --git a/XplorePlane/ViewModels/ImageProcessing/PipelineEditorViewModel.cs b/XplorePlane/ViewModels/ImageProcessing/PipelineEditorViewModel.cs index c84bba7..7d1162a 100644 --- a/XplorePlane/ViewModels/ImageProcessing/PipelineEditorViewModel.cs +++ b/XplorePlane/ViewModels/ImageProcessing/PipelineEditorViewModel.cs @@ -183,7 +183,8 @@ namespace XplorePlane.ViewModels } var displayName = _imageProcessingService.GetProcessorDisplayName(operatorKey) ?? operatorKey; - var node = new PipelineNodeViewModel(operatorKey, displayName) + var icon = OperatorUiMetadata.GetOperatorIcon(operatorKey); + var node = new PipelineNodeViewModel(operatorKey, displayName, icon) { Order = PipelineNodes.Count }; @@ -442,7 +443,8 @@ namespace XplorePlane.ViewModels { var displayName = _imageProcessingService.GetProcessorDisplayName(nodeModel.OperatorKey) ?? nodeModel.OperatorKey; - var node = new PipelineNodeViewModel(nodeModel.OperatorKey, displayName) + var icon = OperatorUiMetadata.GetOperatorIcon(nodeModel.OperatorKey); + var node = new PipelineNodeViewModel(nodeModel.OperatorKey, displayName, icon) { Order = nodeModel.Order, IsEnabled = nodeModel.IsEnabled @@ -515,4 +517,4 @@ namespace XplorePlane.ViewModels return dir; } } -} \ No newline at end of file +} diff --git a/XplorePlane/Views/ImageProcessing/PipelineEditorView.xaml b/XplorePlane/Views/ImageProcessing/PipelineEditorView.xaml index 4c80928..65378df 100644 --- a/XplorePlane/Views/ImageProcessing/PipelineEditorView.xaml +++ b/XplorePlane/Views/ImageProcessing/PipelineEditorView.xaml @@ -164,7 +164,7 @@ HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="13" - Text="⚙" /> + Text="{Binding IconPath}" /> @@ -314,4 +314,4 @@ - \ No newline at end of file + diff --git a/XplorePlane/XplorePlane.csproj b/XplorePlane/XplorePlane.csproj index 1b10f08..62361c6 100644 --- a/XplorePlane/XplorePlane.csproj +++ b/XplorePlane/XplorePlane.csproj @@ -164,7 +164,7 @@ - - + + - \ No newline at end of file + diff --git a/XplorePlane/readme.txt b/XplorePlane/readme.txt index 4655797..0763ea3 100644 --- a/XplorePlane/readme.txt +++ b/XplorePlane/readme.txt @@ -46,16 +46,14 @@ 1、各窗体间数据流的传递,全局数据结构的设计(包括一个基本的说明文档)√ 2、将telerik 升级到 2024.1.408.310;调整界面和主题;引入 硬件层依赖 √ 3、图像算子流程文件,保存文件后缀 .imw, image process workflow 缩写 √ -4、CNC保存文件后缀为.xp, 表示 XplorePlane CNC file 的缩写 +4、CNC保存文件后缀为.xp, 表示 XplorePlane CNC file 的缩写 √ 5、硬件层射线源控件的初步集成(采用库层面的自定义控件方式) √ PrismBootstrapper 的执行顺序是:RegisterTypes() → ConfigureModuleCatalog() → InitializeModules() → CreateShell() - - -2026.3.27 +2026.4.16 ---------------------- -CNC及矩阵功能的设计与实现,包含以下功能: +CNC及矩阵功能的设计与评审,包含以下功能: √ 1、CNC功能设计与实现,包含以下功能: a. CNC状态的定义和管理 b. CNC界面设计与实现 @@ -66,6 +64,24 @@ CNC及矩阵功能的设计与实现,包含以下功能: +2026.4.20 +---------------------- +1、图像算子工具箱的图标 √ +2、最新的图像算子集成 +3、修复流程图编辑器,并屏蔽 +4、主页面加载图像的功能 + + + + + + + + + + + +