fix: 无 DisplayName 的几何体节点显示为「几何对象」而非空字符

This commit is contained in:
tian 2026-06-01 10:39:57 +08:00
parent a5f9e4da24
commit f8319438e9

View File

@ -345,7 +345,7 @@ namespace NavisworksTransport.UI.WPF.Views
{
if (modelItem == null) return null;
string displayName = modelItem.DisplayName ?? "?";
string displayName = !string.IsNullOrEmpty(modelItem.DisplayName) ? modelItem.DisplayName : "几何对象";
// 父节点 key 可能是完整格式 "IndexPath||DisplayPath",也可能是 ".../name#N"
// 只取纯 DisplayPath 部分(去掉 || 前缀和结尾的 #N 后缀)
string parentPath = parentDisplayPath;
@ -416,7 +416,7 @@ namespace NavisworksTransport.UI.WPF.Views
var nameCount = new Dictionary<string, int>();
foreach (var childItem in item.Children)
{
string name = childItem.DisplayName ?? "?";
string name = !string.IsNullOrEmpty(childItem.DisplayName) ? childItem.DisplayName : "几何对象";
nameCount.TryGetValue(name, out int count);
int siblingIdx = count;
nameCount[name] = count + 1;