From bbb58c963459fff8532055579af207d74324d6ef Mon Sep 17 00:00:00 2001 From: tian <11429339@qq.com> Date: Wed, 27 May 2026 14:38:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=89=A9=E4=BD=93=E7=AA=97?= =?UTF-8?q?=E5=8F=A3:=20=E6=8F=90=E5=8D=87=E9=AB=98=E5=BA=A6=E2=86=92?= =?UTF-8?q?=E4=B8=8A=E4=B8=8B=E5=81=8F=E7=A7=BB,=20=E5=85=81=E8=AE=B8?= =?UTF-8?q?=E8=B4=9F=E5=80=BC,=20=E7=AA=97=E5=8F=A3=E5=8A=A0=E5=AE=BD,=20?= =?UTF-8?q?=E6=B8=85=E7=90=86=E6=8F=90=E7=A4=BA=E6=96=87=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 字段名: 提升高度 → 上下偏移 (UI标签/日志/注释/状态栏) - 移除负值校验,允许向下偏移 (EditRotationWindow.xaml.cs) - 修复两处 <=0 拦截 (ApplyGroundPathObjectLiftOffset, ResolveGroundPathObjectLiftOffsetVector) - 窗口宽度 400→440, 调低标题栏/去除副标题/去除提示文字行 --- src/Core/Animation/PathAnimationManager.cs | 10 +++++----- src/UI/WPF/ViewModels/AnimationControlViewModel.cs | 10 +++++----- src/UI/WPF/Views/EditRotationWindow.xaml | 14 ++++---------- src/UI/WPF/Views/EditRotationWindow.xaml.cs | 12 +++--------- 4 files changed, 17 insertions(+), 29 deletions(-) diff --git a/src/Core/Animation/PathAnimationManager.cs b/src/Core/Animation/PathAnimationManager.cs index abd1504..8665814 100644 --- a/src/Core/Animation/PathAnimationManager.cs +++ b/src/Core/Animation/PathAnimationManager.cs @@ -133,7 +133,7 @@ namespace NavisworksTransport.Core.Animation // === 角度修正 === private LocalEulerRotationCorrection _objectRotationCorrection = LocalEulerRotationCorrection.Zero; // 物体绕宿主 X/Y/Z 轴的角度修正 - private double _groundPathObjectLiftHeight; // 地面路径物体额外提升高度(模型单位) + private double _groundPathObjectLiftHeight; // 地面路径物体上下偏移(模型单位,负值向下) // === 碰撞排除列表缓存管理(从LogisticsAnimationManager迁移)=== private ModelItem _currentCachedAnimationObject; @@ -5428,7 +5428,7 @@ namespace NavisworksTransport.Core.Animation LogManager.Info( $"[起点摆放] 已应用物体调整请求: 模式={_objectStartPlacementMode}, 角度={_objectRotationCorrection}, " + - $"提升高度={request.VerticalLiftInMeters:F3}m"); + $"上下偏移={request.VerticalLiftInMeters:F3}m"); if (_animatedObject != null && _pathPoints != null && _pathPoints.Count > 0) { @@ -5464,7 +5464,7 @@ namespace NavisworksTransport.Core.Animation public void SetObjectStartVerticalLiftDirect(double verticalLiftInMeters) { _groundPathObjectLiftHeight = UnitsConverter.ConvertFromMeters(verticalLiftInMeters); - LogManager.Debug($"[起点摆放] 直接设置地面路径提升高度: {verticalLiftInMeters:F3}m"); + LogManager.Debug($"[起点摆放] 直接设置地面路径上下偏移: {verticalLiftInMeters:F3}m"); } public void SetObjectStartPlacementMode(ObjectStartPlacementMode placementMode) @@ -5504,7 +5504,7 @@ namespace NavisworksTransport.Core.Animation double verticalLiftModelUnits, CoordinateSystemType hostType) { - if (verticalLiftModelUnits <= 0.0) + if (Math.Abs(verticalLiftModelUnits) < 1e-9) { return Vector3.Zero; } @@ -5515,7 +5515,7 @@ namespace NavisworksTransport.Core.Animation private Point3D ApplyGroundPathObjectLiftOffset(Point3D trackedCenter) { - if (_route == null || _route.PathType != PathType.Ground || _groundPathObjectLiftHeight <= 0.0) + if (_route == null || _route.PathType != PathType.Ground || Math.Abs(_groundPathObjectLiftHeight) < 1e-9) { return trackedCenter; } diff --git a/src/UI/WPF/ViewModels/AnimationControlViewModel.cs b/src/UI/WPF/ViewModels/AnimationControlViewModel.cs index d5ca03f..bba6223 100644 --- a/src/UI/WPF/ViewModels/AnimationControlViewModel.cs +++ b/src/UI/WPF/ViewModels/AnimationControlViewModel.cs @@ -2191,7 +2191,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels ObjectRotationCorrection = placementRequest.RotationCorrection; string liftSummary = enableGroundLift - ? $", 提升高度={_objectGroundLiftHeightInMeters:F3}m" + ? $", 上下偏移={_objectGroundLiftHeightInMeters:F3}m" : string.Empty; string statusSummary = placementRequest.PreserveInitialPose ? $"物体已调整为平移模式{liftSummary}" @@ -2199,7 +2199,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels LogManager.Info( $"物体调整已更新: 模式={placementRequest.PlacementMode}, 角度={_objectRotationCorrection}, " + - $"提升高度={_objectGroundLiftHeightInMeters:F3}m"); + $"上下偏移={_objectGroundLiftHeightInMeters:F3}m"); UpdateMainStatus(statusSummary); // 更新通行空间可视化(考虑旋转后的尺寸) @@ -4736,7 +4736,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels // 地面路径:物体的长度方向(X轴,前进方向)朝向路径方向 // 通行空间沿路径方向 = X方向尺寸(长度),垂直于路径方向 = Y方向尺寸(宽度),高度上方加间隙(下方不需要,因为有地面) passageAcrossPath = effectiveWidth + 2 * safetyMargin; // 旋转后宽度 + 2*间隙(垂直于路径方向) - passageNormalToPath = effectiveHeight + (_objectGroundLiftHeightInMeters * metersToUnitsPassage) + safetyMargin; // 物体高度 + 提升高度 + 上方间隙 + passageNormalToPath = effectiveHeight + (_objectGroundLiftHeightInMeters * metersToUnitsPassage) + safetyMargin; // 物体高度 + 上下偏移 + 上方间隙 passageAlongPath = effectiveLength; // 旋转后长度(沿路径方向) // 地面路径不需要分段参数 passageNormalToPathVertical = passageNormalToPath; @@ -4780,7 +4780,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels // 物体的长度方向(X轴,前进方向)朝向路径方向 // 通行空间沿路径方向 = X方向尺寸(长度),垂直于路径方向 = Y方向尺寸(宽度),高度上方加间隙(下方不需要,因为有地面) passageAcrossPath = effectiveWidth + 2 * safetyMargin; // 旋转后宽度 + 2*间隙(垂直于路径方向) - passageNormalToPath = effectiveHeight + (_objectGroundLiftHeightInMeters * metersToUnitsPassage) + safetyMargin; // 物体高度 + 提升高度 + 上方间隙 + passageNormalToPath = effectiveHeight + (_objectGroundLiftHeightInMeters * metersToUnitsPassage) + safetyMargin; // 物体高度 + 上下偏移 + 上方间隙 passageAlongPath = effectiveLength; // 旋转后长度(沿路径方向) // 地面路径不需要分段参数 passageNormalToPathVertical = passageNormalToPath; @@ -4824,7 +4824,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels passageAlongPath, passageNormalToPathVertical, passageNormalToPathHorizontal); - LogManager.Debug($"[通行空间可视化] 已设置通行空间参数: 沿路径={passageAlongPath / metersToUnitsPassage:F2}m, 垂直路径={passageAcrossPath / metersToUnitsPassage:F2}m, 法线={passageNormalToPath / metersToUnitsPassage:F2}m, 提升高度={_objectGroundLiftHeightInMeters:F2}m, 安全间隙={_safetyMarginInMeters:F2}m"); + LogManager.Debug($"[通行空间可视化] 已设置通行空间参数: 沿路径={passageAlongPath / metersToUnitsPassage:F2}m, 垂直路径={passageAcrossPath / metersToUnitsPassage:F2}m, 法线={passageNormalToPath / metersToUnitsPassage:F2}m, 上下偏移={_objectGroundLiftHeightInMeters:F2}m, 安全间隙={_safetyMarginInMeters:F2}m"); // 根据路径类型决定是否切换到物体通行空间模式 bool enableObjectSpace = false; diff --git a/src/UI/WPF/Views/EditRotationWindow.xaml b/src/UI/WPF/Views/EditRotationWindow.xaml index 77aa36d..4f6ee25 100644 --- a/src/UI/WPF/Views/EditRotationWindow.xaml +++ b/src/UI/WPF/Views/EditRotationWindow.xaml @@ -2,7 +2,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:converters="clr-namespace:NavisworksTransport.UI.WPF.Converters" - Title="调整物体" Height="430" Width="400" + Title="调整物体" Height="380" Width="440" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" ShowInTaskbar="False" @@ -28,7 +28,6 @@ - @@ -78,7 +77,7 @@ - + @@ -98,13 +97,13 @@ - + - + - - diff --git a/src/UI/WPF/Views/EditRotationWindow.xaml.cs b/src/UI/WPF/Views/EditRotationWindow.xaml.cs index 26e110a..24ff086 100644 --- a/src/UI/WPF/Views/EditRotationWindow.xaml.cs +++ b/src/UI/WPF/Views/EditRotationWindow.xaml.cs @@ -89,8 +89,8 @@ namespace NavisworksTransport.UI.WPF.Views public bool IsGroundLiftEnabled => _isGroundLiftEnabled; public string GroundLiftHint => _isGroundLiftEnabled - ? "仅地面路径生效,用于模拟物体下方物流小车带来的整体抬升。" - : "提升高度当前仅对地面路径生效。"; + ? "仅地面路径生效,正值向上偏移,负值向下偏移。" + : "上下偏移当前仅对地面路径生效。"; public ObjectStartPlacementRequest AdjustmentRequest => _adjustmentRequest; @@ -273,17 +273,11 @@ namespace NavisworksTransport.UI.WPF.Views return false; } - if (!TryUpdateNumberTextBox(GroundLiftTextBox, "请输入有效的提升高度。")) + if (!TryUpdateNumberTextBox(GroundLiftTextBox, "请输入有效的上下偏移值。")) { return false; } - if (GroundPathLiftHeightInMeters < 0.0) - { - ShowInputError("提升高度必须大于或等于 0。", GroundLiftTextBox); - return false; - } - return true; }