增加检测间隙的同步
This commit is contained in:
parent
a52d8fdacb
commit
a235a65a20
@ -231,6 +231,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
private double _virtualVehicleLength; // 虚拟车辆长度(米)
|
||||
private double _virtualVehicleWidth; // 虚拟车辆宽度(米)
|
||||
private double _virtualVehicleHeight; // 虚拟车辆高度(米)
|
||||
private double _safetyMargin; // 检测间隙(米),从路径编辑同步
|
||||
|
||||
// 手工碰撞对象相关字段
|
||||
private bool _isManualCollisionTargetEnabled = false;
|
||||
@ -602,16 +603,26 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
private set => SetProperty(ref _virtualVehicleHeight, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检测间隙(米)- 只读,从路径编辑同步
|
||||
/// </summary>
|
||||
public double SafetyMargin
|
||||
{
|
||||
get => _safetyMargin;
|
||||
private set => SetProperty(ref _safetyMargin, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置虚拟车辆参数(由主ViewModel调用)
|
||||
/// </summary>
|
||||
public void SetVirtualVehicleParameters(double length, double width, double height)
|
||||
public void SetVirtualVehicleParameters(double length, double width, double height, double safetyMargin)
|
||||
{
|
||||
VirtualVehicleLength = length;
|
||||
VirtualVehicleWidth = width;
|
||||
VirtualVehicleHeight = height;
|
||||
SafetyMargin = safetyMargin;
|
||||
|
||||
LogManager.Info($"[AnimationControlViewModel] 虚拟车辆参数已更新: {length:F1}m × {width:F1}m × {height:F1}m");
|
||||
LogManager.Info($"[AnimationControlViewModel] 虚拟车辆参数已更新: {length:F1}m × {width:F1}m × {height:F1}m, 检测间隙: {safetyMargin:F2}m");
|
||||
|
||||
// 如果当前使用虚拟车辆模式,更新生成动画的可用状态
|
||||
if (UseVirtualVehicle)
|
||||
@ -2419,13 +2430,8 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
// 计算通行空间尺寸(米)
|
||||
double passageWidth, passageHeight, passageLength;
|
||||
|
||||
// 获取安全间隙(从配置)
|
||||
var config = Core.Config.ConfigManager.Instance?.Current;
|
||||
if (config == null)
|
||||
{
|
||||
throw new InvalidOperationException("[通行空间可视化] 无法获取配置文件");
|
||||
}
|
||||
double safetyMargin = config.PathEditing.SafetyMarginMeters;
|
||||
// 使用从路径编辑同步过来的检测间隙
|
||||
double safetyMargin = SafetyMargin;
|
||||
|
||||
if (UseVirtualVehicle)
|
||||
{
|
||||
|
||||
@ -417,7 +417,8 @@ namespace NavisworksTransport.UI.WPF
|
||||
// 当车辆参数变化时,同步到AnimationControlView
|
||||
else if (e.PropertyName == nameof(PathEditingViewModel.VehicleLength) ||
|
||||
e.PropertyName == nameof(PathEditingViewModel.VehicleWidth) ||
|
||||
e.PropertyName == nameof(PathEditingViewModel.VehicleHeight))
|
||||
e.PropertyName == nameof(PathEditingViewModel.VehicleHeight) ||
|
||||
e.PropertyName == nameof(PathEditingViewModel.SafetyMargin))
|
||||
{
|
||||
SyncVehicleParametersToAnimationView();
|
||||
}
|
||||
@ -441,9 +442,10 @@ namespace NavisworksTransport.UI.WPF
|
||||
AnimationControlView.ViewModel.SetVirtualVehicleParameters(
|
||||
pathEditingVM.VehicleLength,
|
||||
pathEditingVM.VehicleWidth,
|
||||
pathEditingVM.VehicleHeight
|
||||
pathEditingVM.VehicleHeight,
|
||||
pathEditingVM.SafetyMargin
|
||||
);
|
||||
LogManager.Debug($"车辆参数已同步到动画控制视图: {pathEditingVM.VehicleLength:F1}×{pathEditingVM.VehicleWidth:F1}×{pathEditingVM.VehicleHeight:F1}m");
|
||||
LogManager.Debug($"车辆参数已同步到动画控制视图: {pathEditingVM.VehicleLength:F1}×{pathEditingVM.VehicleWidth:F1}×{pathEditingVM.VehicleHeight:F1}m, 检测间隙: {pathEditingVM.SafetyMargin:F2}m");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user