更完善吊装路径路径点编辑关联逻辑
This commit is contained in:
parent
366d9309f2
commit
131dfba768
@ -1707,6 +1707,45 @@ namespace NavisworksTransport
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新吊装路径的关联点(通用方法)
|
||||
/// </summary>
|
||||
/// <param name="route">路径</param>
|
||||
/// <param name="modifiedPointIndex">修改的点的索引</param>
|
||||
private void UpdateAerialPathRelatedPoints(PathRoute route, int modifiedPointIndex)
|
||||
{
|
||||
if (route.PathType != PathType.Aerial ||
|
||||
route.AerialSubType != AerialSubType.ThreeStepHoisting ||
|
||||
route.Points.Count != 4)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var points = route.Points;
|
||||
|
||||
// 修改起点(索引0):更新提升点(索引1)的X,Y坐标
|
||||
if (modifiedPointIndex == 0)
|
||||
{
|
||||
var startPoint = points[0];
|
||||
var liftPoint = points[1];
|
||||
liftPoint.X = startPoint.X;
|
||||
liftPoint.Y = startPoint.Y;
|
||||
}
|
||||
// 修改终点(索引3):更新平移终点(索引2)的X,Y坐标
|
||||
else if (modifiedPointIndex == 3)
|
||||
{
|
||||
var endPoint = points[3];
|
||||
var moveEndPoint = points[2];
|
||||
moveEndPoint.X = endPoint.X;
|
||||
moveEndPoint.Y = endPoint.Y;
|
||||
}
|
||||
// 修改起吊高度(通过起点或终点的Z坐标变化):更新提升点和平移终点的Z坐标
|
||||
else if (modifiedPointIndex == 0 || modifiedPointIndex == 3)
|
||||
{
|
||||
// 这个逻辑在EditLiftHeightCommand中处理
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新路径点位置(保存修改)
|
||||
/// </summary>
|
||||
@ -1728,6 +1767,9 @@ namespace NavisworksTransport
|
||||
var pointToUpdate = CurrentRoute.Points[_editingPointIndex];
|
||||
pointToUpdate.Position = _editingPreviewPoint.Position;
|
||||
|
||||
// 吊装路径:自动更新关联点
|
||||
UpdateAerialPathRelatedPoints(CurrentRoute, _editingPointIndex);
|
||||
|
||||
// 添加历史记录
|
||||
var historyEntry = new PathHistoryEntry(
|
||||
CurrentRoute.Id,
|
||||
|
||||
@ -19,6 +19,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
private double _z;
|
||||
private string _name;
|
||||
private NavisworksTransport.PathPointType _type; // 使用完全限定名
|
||||
private int _index; // 路径点在列表中的索引
|
||||
|
||||
/// <summary>
|
||||
/// 路径点ID
|
||||
@ -112,14 +113,41 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
return "起点";
|
||||
case NavisworksTransport.PathPointType.EndPoint:
|
||||
return "终点";
|
||||
case NavisworksTransport.PathPointType.WayPoint:
|
||||
return "路径点";
|
||||
default:
|
||||
return Type.ToString();
|
||||
return "途经点";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 路径点在列表中的索引
|
||||
/// </summary>
|
||||
public int Index
|
||||
{
|
||||
get => _index;
|
||||
set => SetProperty(ref _index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否可以修改路径点(通过3D视图点击)
|
||||
/// </summary>
|
||||
public bool CanModifyPoint { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 是否可以编辑坐标
|
||||
/// </summary>
|
||||
public bool CanEditCoordinates { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 是否可以删除路径点
|
||||
/// </summary>
|
||||
public bool CanDelete { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示起吊高度按钮(仅吊装路径的起点)
|
||||
/// </summary>
|
||||
public bool ShowLiftHeightButton { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 坐标字符串表示
|
||||
/// </summary>
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
@ -14,6 +15,7 @@ using NavisworksTransport.Core;
|
||||
using NavisworksTransport.Core.Config;
|
||||
using NavisworksTransport.Commands;
|
||||
using NavisworksTransport.UI.WPF.Views;
|
||||
using NavisworksTransport.Utils;
|
||||
|
||||
namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
{
|
||||
@ -650,6 +652,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
public ICommand SelectStartPointCommand { get; private set; }
|
||||
public ICommand SelectEndPointCommand { get; private set; }
|
||||
public ICommand EditPointCoordinatesCommand { get; private set; }
|
||||
public ICommand EditLiftHeightCommand { get; private set; }
|
||||
public ICommand AutoPlanPathCommand { get; private set; }
|
||||
public ICommand ClearAutoPathCommand { get; private set; }
|
||||
public ICommand ImportPathCommand { get; private set; }
|
||||
@ -683,7 +686,8 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
public bool CanExecuteSaveAsPath => SelectedPathRoute != null && SelectedPathRoute.Points.Count > 0;
|
||||
|
||||
public bool CanExecuteModifyPoint => SelectedPathPoint != null &&
|
||||
_pathPlanningManager?.PathEditState != PathEditState.EditingPoint;
|
||||
_pathPlanningManager?.PathEditState != PathEditState.EditingPoint &&
|
||||
SelectedPathPoint.CanModifyPoint;
|
||||
public bool CanExecuteCancelModifyPoint => _pathPlanningManager?.PathEditState == PathEditState.EditingPoint;
|
||||
|
||||
#endregion
|
||||
@ -818,6 +822,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
SelectStartPointCommand = new RelayCommand(async () => await ExecuteSelectStartPointAsync());
|
||||
SelectEndPointCommand = new RelayCommand(async () => await ExecuteSelectEndPointAsync());
|
||||
EditPointCoordinatesCommand = new RelayCommand<PathPointViewModel>(ExecuteEditPointCoordinates);
|
||||
EditLiftHeightCommand = new RelayCommand<PathPointViewModel>(ExecuteEditLiftHeight);
|
||||
AutoPlanPathCommand = new RelayCommand(async () => await ExecuteAutoPlanPathAsync(), () => CanExecuteAutoPlanPath);
|
||||
ClearAutoPathCommand = new RelayCommand(async () => await ExecuteClearAutoPathAsync());
|
||||
ImportPathCommand = new RelayCommand(async () => await ExecuteImportPathAsync());
|
||||
@ -867,19 +872,11 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
IsActive = true
|
||||
};
|
||||
|
||||
// 转换路径点
|
||||
foreach (var corePoint in newRoute.Points)
|
||||
// 使用统一的辅助方法创建路径点
|
||||
var pathPoints = CreatePathPointViewModelsFromCoreRoute(newRoute);
|
||||
foreach (var point in pathPoints)
|
||||
{
|
||||
var wpfPoint = new PathPointViewModel
|
||||
{
|
||||
Id = corePoint.Id,
|
||||
Name = corePoint.Name,
|
||||
X = corePoint.X,
|
||||
Y = corePoint.Y,
|
||||
Z = corePoint.Z,
|
||||
Type = corePoint.Type
|
||||
};
|
||||
newPathViewModel.Points.Add(wpfPoint);
|
||||
newPathViewModel.Points.Add(point);
|
||||
}
|
||||
|
||||
// 添加到 UI 列表并选中
|
||||
@ -960,19 +957,11 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
PathType = PathType.Aerial
|
||||
};
|
||||
|
||||
// 转换路径点
|
||||
foreach (var corePoint in newRoute.Points)
|
||||
// 使用统一的辅助方法创建路径点
|
||||
var pathPoints = CreatePathPointViewModelsFromCoreRoute(newRoute);
|
||||
foreach (var point in pathPoints)
|
||||
{
|
||||
var wpfPoint = new PathPointViewModel
|
||||
{
|
||||
Id = corePoint.Id,
|
||||
Name = corePoint.Name,
|
||||
X = corePoint.X,
|
||||
Y = corePoint.Y,
|
||||
Z = corePoint.Z,
|
||||
Type = corePoint.Type
|
||||
};
|
||||
newPathViewModel.Points.Add(wpfPoint);
|
||||
newPathViewModel.Points.Add(point);
|
||||
}
|
||||
|
||||
// 添加到 UI 列表并选中
|
||||
@ -1043,7 +1032,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
// 设置路径类型为空中路径(吊装)
|
||||
newRoute.PathType = PathType.Aerial;
|
||||
newRoute.AerialSubType = AerialSubType.ThreeStepHoisting;
|
||||
|
||||
|
||||
// 创建对应的 WPF ViewModel
|
||||
var newPathViewModel = new PathRouteViewModel
|
||||
{
|
||||
@ -1053,20 +1042,12 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
IsActive = true,
|
||||
PathType = PathType.Aerial
|
||||
};
|
||||
|
||||
// 转换路径点
|
||||
foreach (var corePoint in newRoute.Points)
|
||||
|
||||
// 使用统一的辅助方法创建路径点
|
||||
var pathPoints = CreatePathPointViewModelsFromCoreRoute(newRoute);
|
||||
foreach (var point in pathPoints)
|
||||
{
|
||||
var wpfPoint = new PathPointViewModel
|
||||
{
|
||||
Id = corePoint.Id,
|
||||
Name = corePoint.Name,
|
||||
X = corePoint.X,
|
||||
Y = corePoint.Y,
|
||||
Z = corePoint.Z,
|
||||
Type = corePoint.Type
|
||||
};
|
||||
newPathViewModel.Points.Add(wpfPoint);
|
||||
newPathViewModel.Points.Add(point);
|
||||
}
|
||||
|
||||
// 添加到 UI 列表并选中
|
||||
@ -1209,6 +1190,11 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
point.Y = dialog.Y;
|
||||
point.Z = dialog.Z;
|
||||
|
||||
LogManager.Info($"[坐标编辑] 修改点: {point.Name}, 类型: {point.Type}, 索引: {point.Index}");
|
||||
|
||||
// 吊装路径:自动更新关联点(UI层)
|
||||
UpdateAerialPathRelatedPoints(SelectedPathRoute, point.Index);
|
||||
|
||||
// 同步更新到底层数据模型
|
||||
if (_pathPlanningManager != null)
|
||||
{
|
||||
@ -1222,9 +1208,15 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
corePoint.Y = point.Y;
|
||||
corePoint.Z = point.Z;
|
||||
|
||||
// 吊装路径:自动更新关联点(Core层)
|
||||
UpdateAerialPathRelatedPointsCore(coreRoute, point.Index);
|
||||
|
||||
// 保存更改到数据库
|
||||
_pathPlanningManager.UpdateRoute(coreRoute);
|
||||
|
||||
// 触发路径点列表更新事件,确保UI刷新
|
||||
_pathPlanningManager.RaisePathPointsListUpdated(coreRoute, "编辑坐标");
|
||||
|
||||
// 刷新视图
|
||||
UpdatePathVisualization();
|
||||
|
||||
@ -1241,6 +1233,248 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行编辑起吊高度命令
|
||||
/// </summary>
|
||||
private void ExecuteEditLiftHeight(PathPointViewModel point)
|
||||
{
|
||||
if (point == null) return;
|
||||
if (SelectedPathRoute == null) return;
|
||||
|
||||
// 确保是吊装路径
|
||||
if (SelectedPathRoute.PathType != NavisworksTransport.PathType.Aerial ||
|
||||
SelectedPathRoute.AerialSubType != NavisworksTransport.AerialSubType.ThreeStepHoisting)
|
||||
{
|
||||
LogManager.Warning("只有吊装路径才能编辑起吊高度");
|
||||
return;
|
||||
}
|
||||
|
||||
// 确保是起点
|
||||
if (point.Type != NavisworksTransport.PathPointType.StartPoint)
|
||||
{
|
||||
LogManager.Warning("只有起点才能编辑起吊高度");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// 获取路径点列表
|
||||
var points = SelectedPathRoute.Points;
|
||||
if (points.Count != 4)
|
||||
{
|
||||
LogManager.Warning($"吊装路径必须有4个路径点,当前有{points.Count}个");
|
||||
return;
|
||||
}
|
||||
|
||||
var startPoint = points[0];
|
||||
var liftPoint = points[1];
|
||||
var moveEndPoint = points[2];
|
||||
|
||||
// 计算当前起吊高度(米)
|
||||
double currentHeightMeters = UnitsConverter.ConvertToMeters(liftPoint.Z - startPoint.Z);
|
||||
|
||||
// 显示对话框
|
||||
var dialog = new AerialHeightDialog(currentHeightMeters);
|
||||
if (dialog.ShowDialog() == true)
|
||||
{
|
||||
// 转换为模型单位
|
||||
double newHeightModelUnits = UnitsConverter.ConvertFromMeters(dialog.LiftHeightMeters);
|
||||
|
||||
// 更新提升点和平移终点的Z坐标
|
||||
liftPoint.Z = startPoint.Z + newHeightModelUnits;
|
||||
moveEndPoint.Z = startPoint.Z + newHeightModelUnits;
|
||||
|
||||
// 同步更新到底层数据模型
|
||||
if (_pathPlanningManager != null)
|
||||
{
|
||||
var coreRoute = _pathPlanningManager.Routes.FirstOrDefault(r => r.Id == SelectedPathRoute.Id);
|
||||
if (coreRoute != null)
|
||||
{
|
||||
var coreLiftPoint = coreRoute.Points.FirstOrDefault(p => p.Id == liftPoint.Id);
|
||||
var coreMoveEndPoint = coreRoute.Points.FirstOrDefault(p => p.Id == moveEndPoint.Id);
|
||||
|
||||
if (coreLiftPoint != null)
|
||||
{
|
||||
coreLiftPoint.Z = liftPoint.Z;
|
||||
}
|
||||
if (coreMoveEndPoint != null)
|
||||
{
|
||||
coreMoveEndPoint.Z = moveEndPoint.Z;
|
||||
}
|
||||
|
||||
// 更新路径的提升高度
|
||||
coreRoute.LiftHeightMeters = dialog.LiftHeightMeters;
|
||||
|
||||
// 保存更改到数据库
|
||||
_pathPlanningManager.UpdateRoute(coreRoute);
|
||||
|
||||
// 刷新视图
|
||||
UpdatePathVisualization();
|
||||
|
||||
LogManager.Info($"已更新吊装路径起吊高度为 {dialog.LiftHeightMeters:F2}米");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogManager.Error($"编辑起吊高度对话框操作失败: {ex.Message}", ex);
|
||||
System.Windows.MessageBox.Show($"无法打开编辑对话框: {ex.Message}", "错误", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置吊装路径路径点的属性(CanModifyPoint、CanEditCoordinates、CanDelete、ShowLiftHeightButton)
|
||||
/// </summary>
|
||||
private void SetAerialPathPointProperties(PathPointViewModel point, int index, int totalCount)
|
||||
{
|
||||
if (point == null) return;
|
||||
|
||||
point.Index = index;
|
||||
|
||||
// 吊装路径:4个路径点
|
||||
if (totalCount == 4)
|
||||
{
|
||||
switch (index)
|
||||
{
|
||||
case 0: // 起吊点
|
||||
point.CanModifyPoint = true;
|
||||
point.CanEditCoordinates = true;
|
||||
point.CanDelete = false;
|
||||
point.ShowLiftHeightButton = true;
|
||||
break;
|
||||
case 1: // 提升点
|
||||
point.CanModifyPoint = false;
|
||||
point.CanEditCoordinates = false;
|
||||
point.CanDelete = false;
|
||||
point.ShowLiftHeightButton = false;
|
||||
break;
|
||||
case 2: // 平移终点
|
||||
point.CanModifyPoint = false;
|
||||
point.CanEditCoordinates = false;
|
||||
point.CanDelete = false;
|
||||
point.ShowLiftHeightButton = false;
|
||||
break;
|
||||
case 3: // 下降点
|
||||
point.CanModifyPoint = true;
|
||||
point.CanEditCoordinates = true;
|
||||
point.CanDelete = false;
|
||||
point.ShowLiftHeightButton = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 非标准吊装路径,使用默认值
|
||||
point.CanModifyPoint = true;
|
||||
point.CanEditCoordinates = true;
|
||||
point.CanDelete = true;
|
||||
point.ShowLiftHeightButton = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从Core路径创建PathPointViewModel列表(统一处理吊装路径属性)
|
||||
/// </summary>
|
||||
private List<PathPointViewModel> CreatePathPointViewModelsFromCoreRoute(PathRoute coreRoute)
|
||||
{
|
||||
var points = new List<PathPointViewModel>();
|
||||
|
||||
foreach (var corePoint in coreRoute.Points)
|
||||
{
|
||||
var wpfPoint = new PathPointViewModel
|
||||
{
|
||||
Id = corePoint.Id,
|
||||
Name = corePoint.Name,
|
||||
X = corePoint.X,
|
||||
Y = corePoint.Y,
|
||||
Z = corePoint.Z,
|
||||
Type = corePoint.Type
|
||||
};
|
||||
points.Add(wpfPoint);
|
||||
}
|
||||
|
||||
// 设置吊装路径路径点属性
|
||||
if (coreRoute.PathType == NavisworksTransport.PathType.Aerial &&
|
||||
coreRoute.AerialSubType == NavisworksTransport.AerialSubType.ThreeStepHoisting)
|
||||
{
|
||||
for (int i = 0; i < points.Count; i++)
|
||||
{
|
||||
SetAerialPathPointProperties(points[i], i, points.Count);
|
||||
}
|
||||
}
|
||||
|
||||
return points;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新吊装路径的关联点(UI层)
|
||||
/// </summary>
|
||||
/// <param name="pathRoute">路径</param>
|
||||
/// <param name="modifiedPointIndex">修改的点的索引</param>
|
||||
private void UpdateAerialPathRelatedPoints(PathRouteViewModel pathRoute, int modifiedPointIndex)
|
||||
{
|
||||
if (pathRoute.PathType != NavisworksTransport.PathType.Aerial ||
|
||||
pathRoute.AerialSubType != NavisworksTransport.AerialSubType.ThreeStepHoisting ||
|
||||
pathRoute.Points.Count != 4)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var points = pathRoute.Points;
|
||||
|
||||
// 修改起点(索引0):更新提升点(索引1)的X,Y坐标
|
||||
if (modifiedPointIndex == 0)
|
||||
{
|
||||
var startPoint = points[0];
|
||||
var liftPoint = points[1];
|
||||
liftPoint.X = startPoint.X;
|
||||
liftPoint.Y = startPoint.Y;
|
||||
}
|
||||
// 修改终点(索引3):更新平移终点(索引2)的X,Y坐标
|
||||
else if (modifiedPointIndex == 3)
|
||||
{
|
||||
var endPoint = points[3];
|
||||
var moveEndPoint = points[2];
|
||||
moveEndPoint.X = endPoint.X;
|
||||
moveEndPoint.Y = endPoint.Y;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新吊装路径的关联点(Core层)
|
||||
/// </summary>
|
||||
/// <param name="coreRoute">Core路径</param>
|
||||
/// <param name="modifiedPointIndex">修改的点的索引</param>
|
||||
private void UpdateAerialPathRelatedPointsCore(PathRoute coreRoute, int modifiedPointIndex)
|
||||
{
|
||||
if (coreRoute.PathType != NavisworksTransport.PathType.Aerial ||
|
||||
coreRoute.AerialSubType != NavisworksTransport.AerialSubType.ThreeStepHoisting ||
|
||||
coreRoute.Points.Count != 4)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var points = coreRoute.Points;
|
||||
|
||||
// 修改起点(索引0):更新提升点(索引1)的X,Y坐标
|
||||
if (modifiedPointIndex == 0)
|
||||
{
|
||||
var startPoint = points[0];
|
||||
var liftPoint = points[1];
|
||||
liftPoint.X = startPoint.X;
|
||||
liftPoint.Y = startPoint.Y;
|
||||
}
|
||||
// 修改终点(索引3):更新平移终点(索引2)的X,Y坐标
|
||||
else if (modifiedPointIndex == 3)
|
||||
{
|
||||
var endPoint = points[3];
|
||||
var moveEndPoint = points[2];
|
||||
moveEndPoint.X = endPoint.X;
|
||||
moveEndPoint.Y = endPoint.Y;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 自动路径规划命令
|
||||
@ -2309,19 +2543,11 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
// 设置时间信息
|
||||
pathViewModel.SetTimeInfo(coreRoute.CreatedTime, coreRoute.LastModified);
|
||||
|
||||
// 转换路径点
|
||||
foreach (var corePoint in coreRoute.Points)
|
||||
// 使用统一的辅助方法创建路径点
|
||||
var pathPoints = CreatePathPointViewModelsFromCoreRoute(coreRoute);
|
||||
foreach (var point in pathPoints)
|
||||
{
|
||||
var wpfPoint = new PathPointViewModel
|
||||
{
|
||||
Id = corePoint.Id,
|
||||
Name = corePoint.Name,
|
||||
X = corePoint.X,
|
||||
Y = corePoint.Y,
|
||||
Z = corePoint.Z,
|
||||
Type = corePoint.Type
|
||||
};
|
||||
pathViewModel.Points.Add(wpfPoint);
|
||||
pathViewModel.Points.Add(point);
|
||||
}
|
||||
|
||||
PathRoutes.Add(pathViewModel);
|
||||
@ -3042,8 +3268,9 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
|
||||
// 同步路径点数据
|
||||
pathViewModel.Points.Clear();
|
||||
foreach (var point in e.Route.Points)
|
||||
for (int i = 0; i < e.Route.Points.Count; i++)
|
||||
{
|
||||
var point = e.Route.Points[i];
|
||||
var pointViewModel = new PathPointViewModel
|
||||
{
|
||||
Id = point.Id,
|
||||
@ -3051,7 +3278,8 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
X = point.Position.X,
|
||||
Y = point.Position.Y,
|
||||
Z = point.Position.Z,
|
||||
Type = point.Type
|
||||
Type = point.Type,
|
||||
Index = i
|
||||
};
|
||||
pathViewModel.Points.Add(pointViewModel);
|
||||
}
|
||||
@ -3219,19 +3447,11 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
// 设置时间信息
|
||||
autoPathViewModel.SetTimeInfo(e.Route.CreatedTime, e.Route.LastModified);
|
||||
|
||||
// 转换路径点
|
||||
foreach (var corePoint in e.Route.Points)
|
||||
// 使用统一的辅助方法创建路径点
|
||||
var pathPoints = CreatePathPointViewModelsFromCoreRoute(e.Route);
|
||||
foreach (var point in pathPoints)
|
||||
{
|
||||
var wpfPoint = new PathPointViewModel
|
||||
{
|
||||
Id = corePoint.Id,
|
||||
Name = corePoint.Name,
|
||||
X = corePoint.X,
|
||||
Y = corePoint.Y,
|
||||
Z = corePoint.Z,
|
||||
Type = corePoint.Type
|
||||
};
|
||||
autoPathViewModel.Points.Add(wpfPoint);
|
||||
autoPathViewModel.Points.Add(point);
|
||||
}
|
||||
|
||||
LogManager.Info($"*** 已创建PathRouteViewModel,包含 {autoPathViewModel.Points.Count} 个点 ***");
|
||||
@ -3332,19 +3552,11 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
// 设置时间信息
|
||||
dbPathViewModel.SetTimeInfo(coreRoute.CreatedTime, coreRoute.LastModified);
|
||||
|
||||
// 转换路径点
|
||||
foreach (var corePoint in coreRoute.Points)
|
||||
// 使用统一的辅助方法创建路径点
|
||||
var pathPoints = CreatePathPointViewModelsFromCoreRoute(coreRoute);
|
||||
foreach (var point in pathPoints)
|
||||
{
|
||||
var wpfPoint = new PathPointViewModel
|
||||
{
|
||||
Id = corePoint.Id,
|
||||
Name = corePoint.Name,
|
||||
X = corePoint.X,
|
||||
Y = corePoint.Y,
|
||||
Z = corePoint.Z,
|
||||
Type = corePoint.Type
|
||||
};
|
||||
dbPathViewModel.Points.Add(wpfPoint);
|
||||
dbPathViewModel.Points.Add(point);
|
||||
}
|
||||
|
||||
LogManager.Info($"*** 已创建PathRouteViewModel(数据库路径),包含 {dbPathViewModel.Points.Count} 个点 ***");
|
||||
|
||||
@ -26,7 +26,7 @@ NavisworksTransport 检测动画页签视图 - 采用与类别设置和分层管
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<!-- 转换器资源 -->
|
||||
<converters:BoolToVisibilityConverter x:Key="BoolToVisConverter"/>
|
||||
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
|
||||
|
||||
<!-- 动画控制页面特有的样式 -->
|
||||
<Style x:Key="ProgressBarStyle" TargetType="ProgressBar">
|
||||
@ -183,11 +183,11 @@ NavisworksTransport 检测动画页签视图 - 采用与类别设置和分层管
|
||||
<TextBlock Text="当前未选择任何对象"
|
||||
Style="{StaticResource StatusTextStyle}"
|
||||
Foreground="#FF777777"
|
||||
Visibility="{Binding HasManualCollisionTargets, Converter={StaticResource BoolToVisConverter}, ConverterParameter=Inverse}"/>
|
||||
Visibility="{Binding HasManualCollisionTargets, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter=Inverse}"/>
|
||||
|
||||
<ListView ItemsSource="{Binding ManualCollisionTargets}"
|
||||
Margin="0,5,0,0"
|
||||
Visibility="{Binding HasManualCollisionTargets, Converter={StaticResource BoolToVisConverter}}"
|
||||
Visibility="{Binding HasManualCollisionTargets, Converter={StaticResource BoolToVisibilityConverter}}"
|
||||
MinHeight="80"
|
||||
BorderBrush="#FFE2E8F0"
|
||||
BorderThickness="1">
|
||||
@ -242,7 +242,7 @@ NavisworksTransport 检测动画页签视图 - 采用与类别设置和分层管
|
||||
|
||||
<!-- 方式1:选择模型物体 -->
|
||||
<Grid Margin="0,5,0,0"
|
||||
Visibility="{Binding UseVirtualVehicle, Converter={StaticResource BoolToVisConverter}, ConverterParameter=Inverse}">
|
||||
Visibility="{Binding UseVirtualVehicle, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter=Inverse}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
@ -273,7 +273,7 @@ NavisworksTransport 检测动画页签视图 - 采用与类别设置和分层管
|
||||
|
||||
<!-- 方式2:虚拟车辆 -->
|
||||
<Grid Margin="0,5,0,0"
|
||||
Visibility="{Binding UseVirtualVehicle, Converter={StaticResource BoolToVisConverter}}">
|
||||
Visibility="{Binding UseVirtualVehicle, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
@ -306,7 +306,7 @@ NavisworksTransport 检测动画页签视图 - 采用与类别设置和分层管
|
||||
Style="{StaticResource StatusTextStyle}"
|
||||
Foreground="#FF666666"
|
||||
Margin="5,0,0,5"
|
||||
Visibility="{Binding UseVirtualVehicle, Converter={StaticResource BoolToVisConverter}}"/>
|
||||
Visibility="{Binding UseVirtualVehicle, Converter={StaticResource BoolToVisibilityConverter}}"/>
|
||||
|
||||
<!-- 选择路径 -->
|
||||
<Grid Margin="0,5,0,0">
|
||||
@ -342,7 +342,7 @@ NavisworksTransport 检测动画页签视图 - 采用与类别设置和分层管
|
||||
Style="{StaticResource StatusTextStyle}"
|
||||
Foreground="#FF666666"
|
||||
Margin="0,5,0,0"
|
||||
Visibility="{Binding CanGenerateAnimation, Converter={StaticResource BoolToVisConverter}, ConverterParameter=Inverse}"/>
|
||||
Visibility="{Binding CanGenerateAnimation, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter=Inverse}"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
@ -407,12 +407,12 @@ NavisworksTransport 检测动画页签视图 - 采用与类别设置和分层管
|
||||
<TextBlock Text="当前路径暂无碰撞检测结果"
|
||||
Style="{StaticResource StatusTextStyle}"
|
||||
Foreground="#FF777777"
|
||||
Visibility="{Binding HasClashDetectiveResults, Converter={StaticResource BoolToVisConverter}, ConverterParameter=Inverse}"
|
||||
Visibility="{Binding HasClashDetectiveResults, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter=Inverse}"
|
||||
Margin="0,5,0,0"/>
|
||||
|
||||
<ListView ItemsSource="{Binding ClashDetectiveResults}"
|
||||
Margin="0,5,0,0"
|
||||
Visibility="{Binding HasClashDetectiveResults, Converter={StaticResource BoolToVisConverter}}"
|
||||
Visibility="{Binding HasClashDetectiveResults, Converter={StaticResource BoolToVisibilityConverter}}"
|
||||
MinHeight="120"
|
||||
MaxHeight="200"
|
||||
BorderBrush="#FFE2E8F0"
|
||||
@ -493,12 +493,12 @@ NavisworksTransport 检测动画页签视图 - 采用与类别设置和分层管
|
||||
<TextBlock Text="请先在碰撞检测历史中选择一个检测结果"
|
||||
Style="{StaticResource StatusTextStyle}"
|
||||
Foreground="#FF777777"
|
||||
Visibility="{Binding ClashDetectiveResults.Count, Converter={StaticResource BoolToVisConverter}, ConverterParameter=Inverse}"
|
||||
Visibility="{Binding ClashDetectiveResults.Count, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter=Inverse}"
|
||||
Margin="0,5,0,0"/>
|
||||
|
||||
<ListView ItemsSource="{Binding SelectedClashDetectiveResult.CollisionObjects}"
|
||||
Margin="0,5,0,0"
|
||||
Visibility="{Binding SelectedClashDetectiveResult.CollisionObjects.Count, Converter={StaticResource BoolToVisConverter}}"
|
||||
Visibility="{Binding SelectedClashDetectiveResult.CollisionObjects.Count, Converter={StaticResource BoolToVisibilityConverter}}"
|
||||
MinHeight="120"
|
||||
MaxHeight="200"
|
||||
BorderBrush="#FFE2E8F0"
|
||||
|
||||
@ -25,7 +25,7 @@ NavisworksTransport 分层管理页签视图 - 重构优化版本
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<!-- 转换器资源 -->
|
||||
<converters:BoolToVisibilityConverter x:Key="BoolToVisConverter"/>
|
||||
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
|
||||
<converters:IndexConverter x:Key="IndexConverter"/>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
@ -113,7 +113,7 @@ NavisworksTransport 分层管理页签视图 - 重构优化版本
|
||||
|
||||
<!-- 分层属性显示区域 -->
|
||||
<GroupBox Header="当前分层属性" Margin="0,10,0,0"
|
||||
Visibility="{Binding ShowLayerAttributeInfo, Converter={StaticResource BoolToVisConverter}}">
|
||||
Visibility="{Binding ShowLayerAttributeInfo, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<StackPanel Margin="10">
|
||||
<TextBlock Text="{Binding CurrentLayerAttributeInfo}"
|
||||
Style="{StaticResource StatusTextStyle}"
|
||||
@ -162,7 +162,7 @@ NavisworksTransport 分层管理页签视图 - 重构优化版本
|
||||
SelectedItem="{Binding SelectedCustomLayerOption}"
|
||||
Margin="5,2"
|
||||
IsEnabled="{Binding IsNotProcessing}"
|
||||
Visibility="{Binding ShowCustomLayerOptions, Converter={StaticResource BoolToVisConverter}}"
|
||||
Visibility="{Binding ShowCustomLayerOptions, Converter={StaticResource BoolToVisibilityConverter}}"
|
||||
ToolTip="选择自定义分层的具体类型"/>
|
||||
|
||||
<Label Grid.Column="3" Content="遍历深度:" VerticalAlignment="Center" Margin="10,0,0,0"/>
|
||||
@ -221,7 +221,7 @@ NavisworksTransport 分层管理页签视图 - 重构优化版本
|
||||
<ListView Grid.Row="0"
|
||||
ItemsSource="{Binding SplitPreviewResults}"
|
||||
SelectedItem="{Binding SelectedPreviewResult}"
|
||||
Visibility="{Binding ShowPreviewResults, Converter={StaticResource BoolToVisConverter}}"
|
||||
Visibility="{Binding ShowPreviewResults, Converter={StaticResource BoolToVisibilityConverter}}"
|
||||
Margin="0,0,0,10">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
@ -256,7 +256,7 @@ NavisworksTransport 分层管理页签视图 - 重构优化版本
|
||||
|
||||
<StackPanel Grid.Row="0"
|
||||
VerticalAlignment="Center"
|
||||
Visibility="{Binding ShowPreviewPrompt, Converter={StaticResource BoolToVisConverter}}">
|
||||
Visibility="{Binding ShowPreviewPrompt, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<TextBlock Text="点击[预览]生成分层列表,或查看错误信息"
|
||||
Style="{StaticResource StatusTextStyle}"
|
||||
HorizontalAlignment="Center"/>
|
||||
|
||||
@ -27,7 +27,7 @@ NavisworksTransport 主控制面板 - 采用与其他视图一致的Navisworks 2
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<!-- 转换器资源 -->
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVisConverter"/>
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
|
||||
@ -92,7 +92,7 @@ NavisworksTransport 主控制面板 - 采用与其他视图一致的Navisworks 2
|
||||
<ProgressBar Height="20"
|
||||
Value="{Binding ProgressPercentage}"
|
||||
IsIndeterminate="{Binding IsIndeterminateProgress}"
|
||||
Visibility="{Binding IsProcessing, Converter={StaticResource BoolToVisConverter}}"/>
|
||||
Visibility="{Binding IsProcessing, Converter={StaticResource BoolToVisibilityConverter}}"/>
|
||||
|
||||
<TextBlock Text="{Binding StatusText}"
|
||||
HorizontalAlignment="Left"
|
||||
|
||||
@ -26,7 +26,7 @@ NavisworksTransport 类别设置页签视图 - 参考分层管理页签的设计
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<!-- 转换器资源 -->
|
||||
<converters:BoolToVisibilityConverter x:Key="BoolToVisConverter"/>
|
||||
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
|
||||
<converters:IndexConverter x:Key="IndexConverter"/>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
|
||||
@ -25,7 +25,7 @@ NavisworksTransport 路径编辑页签视图 - 采用与动画控制和分层管
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<!-- 转换器资源 -->
|
||||
<converters:BoolToVisibilityConverter x:Key="BoolToVisConverter"/>
|
||||
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
|
||||
<converters:PathTypeConverter x:Key="PathTypeConverter"/>
|
||||
|
||||
<!-- 滑块样式 -->
|
||||
@ -318,34 +318,48 @@ NavisworksTransport 路径编辑页签视图 - 采用与动画控制和分层管
|
||||
<GridViewColumn Header="点名称" DisplayMemberBinding="{Binding Name}" Width="80"/>
|
||||
<GridViewColumn Header="坐标" DisplayMemberBinding="{Binding CoordinateString}" Width="140"/>
|
||||
<GridViewColumn Header="类型" DisplayMemberBinding="{Binding TypeDisplayString}" Width="60"/>
|
||||
<GridViewColumn Header="操作" Width="120">
|
||||
<GridViewColumn Header="操作" Width="180">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<Button Content="坐标编辑"
|
||||
ToolTip="编辑坐标..."
|
||||
Command="{Binding DataContext.EditPointCoordinatesCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
Padding="2"
|
||||
<Button Content="起吊高度"
|
||||
ToolTip="修改起吊高度..."
|
||||
Command="{Binding DataContext.EditLiftHeightCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
Padding="2"
|
||||
FontSize="10"
|
||||
Width="52"
|
||||
Width="52"
|
||||
Height="20"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Margin="0,0,2,0"/>
|
||||
<Button Content="删除"
|
||||
Margin="0,0,2,0"
|
||||
Visibility="{Binding ShowLiftHeightButton, Converter={StaticResource BoolToVisibilityConverter}}"/>
|
||||
<Button Content="坐标编辑"
|
||||
ToolTip="编辑坐标..."
|
||||
Command="{Binding DataContext.EditPointCoordinatesCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
Padding="2"
|
||||
FontSize="10"
|
||||
Width="52"
|
||||
Height="20"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Margin="0,0,2,0"
|
||||
Visibility="{Binding CanEditCoordinates, Converter={StaticResource BoolToVisibilityConverter}}"/>
|
||||
<Button Content="删除"
|
||||
ToolTip="删除路径点"
|
||||
Command="{Binding DataContext.DeletePointCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
Command="{Binding DataContext.DeletePointCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
Background="#FFFFE6E6"
|
||||
Foreground="#FF8B0000"
|
||||
Padding="2"
|
||||
Padding="2"
|
||||
FontSize="10"
|
||||
Width="44"
|
||||
Width="44"
|
||||
Height="20"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Margin="0"/>
|
||||
Margin="0"
|
||||
Visibility="{Binding CanDelete, Converter={StaticResource BoolToVisibilityConverter}}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user