diff --git a/src/UI/WPF/Models/PathRouteViewModel.cs b/src/UI/WPF/Models/PathRouteViewModel.cs index 830a7e2..73f2262 100644 --- a/src/UI/WPF/Models/PathRouteViewModel.cs +++ b/src/UI/WPF/Models/PathRouteViewModel.cs @@ -128,26 +128,6 @@ namespace NavisworksTransport.UI.WPF.ViewModels set => SetProperty(ref _index, value); } - /// - /// 是否可以修改路径点(通过3D视图点击) - /// - public bool CanModifyPoint { get; set; } = true; - - /// - /// 是否可以编辑坐标 - /// - public bool CanEditCoordinates { get; set; } = true; - - /// - /// 是否可以删除路径点 - /// - public bool CanDelete { get; set; } = true; - - /// - /// 是否显示起吊高度按钮(仅吊装路径的起点) - /// - public bool ShowLiftHeightButton { get; set; } = false; - /// /// 坐标字符串表示 /// diff --git a/src/UI/WPF/ViewModels/PathEditingViewModel.cs b/src/UI/WPF/ViewModels/PathEditingViewModel.cs index 0b2e2d1..d095b80 100644 --- a/src/UI/WPF/ViewModels/PathEditingViewModel.cs +++ b/src/UI/WPF/ViewModels/PathEditingViewModel.cs @@ -652,7 +652,6 @@ 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; } @@ -686,8 +685,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels public bool CanExecuteSaveAsPath => SelectedPathRoute != null && SelectedPathRoute.Points.Count > 0; public bool CanExecuteModifyPoint => SelectedPathPoint != null && - _pathPlanningManager?.PathEditState != PathEditState.EditingPoint && - SelectedPathPoint.CanModifyPoint; + _pathPlanningManager?.PathEditState != PathEditState.EditingPoint; public bool CanExecuteCancelModifyPoint => _pathPlanningManager?.PathEditState == PathEditState.EditingPoint; #endregion @@ -825,7 +823,6 @@ namespace NavisworksTransport.UI.WPF.ViewModels SelectStartPointCommand = new RelayCommand(async () => await ExecuteSelectStartPointAsync()); SelectEndPointCommand = new RelayCommand(async () => await ExecuteSelectEndPointAsync()); EditPointCoordinatesCommand = new RelayCommand(ExecuteEditPointCoordinates); - EditLiftHeightCommand = new RelayCommand(ExecuteEditLiftHeight); AutoPlanPathCommand = new RelayCommand(async () => await ExecuteAutoPlanPathAsync(), () => CanExecuteAutoPlanPath); ClearAutoPathCommand = new RelayCommand(async () => await ExecuteClearAutoPathAsync()); ImportPathCommand = new RelayCommand(async () => await ExecuteImportPathAsync()); @@ -1230,146 +1227,6 @@ namespace NavisworksTransport.UI.WPF.ViewModels } } - /// - /// 执行编辑起吊高度命令 - /// - 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); - } - } - - /// - /// 设置吊装路径路径点的属性(CanModifyPoint、CanEditCoordinates、CanDelete、ShowLiftHeightButton) - /// - 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; - } - } - /// /// 从Core路径创建PathPointViewModel列表(统一处理吊装路径属性) /// @@ -1391,16 +1248,6 @@ namespace NavisworksTransport.UI.WPF.ViewModels 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; } diff --git a/src/UI/WPF/Views/PathEditingView.xaml b/src/UI/WPF/Views/PathEditingView.xaml index cf4ad12..0eb8207 100644 --- a/src/UI/WPF/Views/PathEditingView.xaml +++ b/src/UI/WPF/Views/PathEditingView.xaml @@ -322,18 +322,6 @@ NavisworksTransport 路径编辑页签视图 - 采用与动画控制和分层管 -