105067 优化选中部件高亮显示

This commit is contained in:
SINVO\yangshunli 2025-02-13 12:00:20 +08:00
parent 823f8998de
commit 4a977023f8
1 changed files with 28 additions and 13 deletions

View File

@ -1,18 +1,10 @@
using CommunityToolkit.Mvvm.Messaging; using EPLAN.Harness.API;
using EPLAN.Harness.API;
using EPLAN.Harness.AppCore.StudioCommon.TreeView;
using EPLAN.Harness.Common; using EPLAN.Harness.Common;
using EPLAN.Harness.Core.Controls; using EPLAN.Harness.Core.Controls;
using EPLAN.Harness.Core.Extensions;
using EPLAN.Harness.Core.LibEntities;
using EPLAN.Harness.Primitives.Treeviews;
using EPLAN.Harness.ProjectCore; using EPLAN.Harness.ProjectCore;
using EPLAN.Harness.ProjectCore.Occurrences; using EPLAN.Harness.ProjectCore.Occurrences;
using EPLAN.Harness.ProjectCore.Occurrences.Designer; using EPLAN.Harness.ProjectCore.Occurrences.Designer;
using HandyControl.Tools.Extension;
using Sinvo.EplanHpD.Plugin.WPFUI.Common;
using Sinvo.EplanHpD.Plugin.WPFUI.Models; using Sinvo.EplanHpD.Plugin.WPFUI.Models;
using Sinvo.EplanHpD.Plugin.WPFUI.Utils;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
@ -20,16 +12,15 @@ using System.Collections.ObjectModel;
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Threading; using System.Windows.Threading;
namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
{ {
public class ScannerViewModel : INotifyPropertyChanged, INotifyDataErrorInfo public class ScannerViewModel : INotifyPropertyChanged, INotifyDataErrorInfo
{ {
private FlexDesigner _currentFlexDesigner; private FlexDesigner _currentFlexDesigner;
private bool _othersWireShow = true; private bool _othersWireShow = true;
private bool _continueScan = true; private bool _continueScan = true;
@ -362,6 +353,24 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
} }
} }
//public void sethightlight()
//{
// ClearHighlights();
// var selectedObjects = HarnessApp.Selection.GetSelectedObjects();
// foreach (var obj in selectedObjects)
// {
// obj.SetHighlight(true); // 高亮选中部件
// }
//}
//private void ClearHighlights()
//{
// var allObjects = HarnessApp.GetAllObjects();
// foreach (var obj in allObjects)
// {
// obj.SetHighlight(false); // 清除高亮
// }
//}
private void ToSourceByName(string wireName) private void ToSourceByName(string wireName)
{ {
var occWire = _currentFlexDesigner.GetOccurrenceByName(wireName, typeof(OccWire)); var occWire = _currentFlexDesigner.GetOccurrenceByName(wireName, typeof(OccWire));
@ -397,6 +406,8 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
{ {
// 从设计器中获取线实例 // 从设计器中获取线实例
var occWire = _currentFlexDesigner.GetOccurrenceByID(occId); var occWire = _currentFlexDesigner.GetOccurrenceByID(occId);
var scanedWire = ScanCableModels.FirstOrDefault();
if (occWire != null) if (occWire != null)
{ {
// 设置线显示 // 设置线显示
@ -404,6 +415,10 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
// 清空已选择项并加入当前线 // 清空已选择项并加入当前线
_currentFlexDesigner.SelectSet.Clear(); _currentFlexDesigner.SelectSet.Clear();
_currentFlexDesigner.SelectSet.Add(occWire); _currentFlexDesigner.SelectSet.Add(occWire);
if (occId.Equals(scanedWire.S_PartID)|| occId.Equals(scanedWire.S_pinID) )
_currentFlexDesigner.SelectSet.Add(scanedWire.S_partObj.Children.Where(it => it.Type == OCC_TYPE.wPART));
else
_currentFlexDesigner.SelectSet.Add(scanedWire.E_partObj.Children.Where(it => it.Type == OCC_TYPE.wPART));
// 缩放设计器且触发选中事件 // 缩放设计器且触发选中事件
_currentFlexDesigner.FitToSelectSet(); _currentFlexDesigner.FitToSelectSet();