移除路径编辑视图中的起吊高度相关功能,简化路径点操作界面
This commit is contained in:
parent
e2fb22efe6
commit
52ca335e9f
@ -128,26 +128,6 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
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>
|
||||
|
||||
@ -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<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());
|
||||
@ -1230,146 +1227,6 @@ 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>
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -322,18 +322,6 @@ NavisworksTransport 路径编辑页签视图 - 采用与动画控制和分层管
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<Button Content="起吊高度"
|
||||
ToolTip="修改起吊高度..."
|
||||
Command="{Binding DataContext.EditLiftHeightCommand, 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 ShowLiftHeightButton, Converter={StaticResource BoolToVisibilityConverter}}"/>
|
||||
<Button Content="坐标编辑"
|
||||
ToolTip="编辑坐标..."
|
||||
Command="{Binding DataContext.EditPointCoordinatesCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
@ -344,8 +332,7 @@ NavisworksTransport 路径编辑页签视图 - 采用与动画控制和分层管
|
||||
Height="20"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Margin="0,0,2,0"
|
||||
Visibility="{Binding CanEditCoordinates, Converter={StaticResource BoolToVisibilityConverter}}"/>
|
||||
Margin="0,0,2,0"/>
|
||||
<Button Content="删除"
|
||||
ToolTip="删除路径点"
|
||||
Command="{Binding DataContext.DeletePointCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
@ -358,8 +345,7 @@ NavisworksTransport 路径编辑页签视图 - 采用与动画控制和分层管
|
||||
Height="20"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Margin="0"
|
||||
Visibility="{Binding CanDelete, Converter={StaticResource BoolToVisibilityConverter}}"/>
|
||||
Margin="0"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user