调整物体窗口: 提升高度→上下偏移, 允许负值, 窗口加宽, 清理提示文字

- 字段名: 提升高度 → 上下偏移 (UI标签/日志/注释/状态栏)
- 移除负值校验,允许向下偏移 (EditRotationWindow.xaml.cs)
- 修复两处 <=0 拦截 (ApplyGroundPathObjectLiftOffset, ResolveGroundPathObjectLiftOffsetVector)
- 窗口宽度 400→440, 调低标题栏/去除副标题/去除提示文字行
This commit is contained in:
tian 2026-05-27 14:38:27 +08:00
parent 3e43b20102
commit bbb58c9634
4 changed files with 17 additions and 29 deletions

View File

@ -133,7 +133,7 @@ namespace NavisworksTransport.Core.Animation
// === 角度修正 === // === 角度修正 ===
private LocalEulerRotationCorrection _objectRotationCorrection = LocalEulerRotationCorrection.Zero; // 物体绕宿主 X/Y/Z 轴的角度修正 private LocalEulerRotationCorrection _objectRotationCorrection = LocalEulerRotationCorrection.Zero; // 物体绕宿主 X/Y/Z 轴的角度修正
private double _groundPathObjectLiftHeight; // 地面路径物体额外提升高度(模型单位 private double _groundPathObjectLiftHeight; // 地面路径物体上下偏移(模型单位,负值向下
// === 碰撞排除列表缓存管理从LogisticsAnimationManager迁移=== // === 碰撞排除列表缓存管理从LogisticsAnimationManager迁移===
private ModelItem _currentCachedAnimationObject; private ModelItem _currentCachedAnimationObject;
@ -5428,7 +5428,7 @@ namespace NavisworksTransport.Core.Animation
LogManager.Info( LogManager.Info(
$"[起点摆放] 已应用物体调整请求: 模式={_objectStartPlacementMode}, 角度={_objectRotationCorrection}, " + $"[起点摆放] 已应用物体调整请求: 模式={_objectStartPlacementMode}, 角度={_objectRotationCorrection}, " +
$"提升高度={request.VerticalLiftInMeters:F3}m"); $"上下偏移={request.VerticalLiftInMeters:F3}m");
if (_animatedObject != null && _pathPoints != null && _pathPoints.Count > 0) if (_animatedObject != null && _pathPoints != null && _pathPoints.Count > 0)
{ {
@ -5464,7 +5464,7 @@ namespace NavisworksTransport.Core.Animation
public void SetObjectStartVerticalLiftDirect(double verticalLiftInMeters) public void SetObjectStartVerticalLiftDirect(double verticalLiftInMeters)
{ {
_groundPathObjectLiftHeight = UnitsConverter.ConvertFromMeters(verticalLiftInMeters); _groundPathObjectLiftHeight = UnitsConverter.ConvertFromMeters(verticalLiftInMeters);
LogManager.Debug($"[起点摆放] 直接设置地面路径提升高度: {verticalLiftInMeters:F3}m"); LogManager.Debug($"[起点摆放] 直接设置地面路径上下偏移: {verticalLiftInMeters:F3}m");
} }
public void SetObjectStartPlacementMode(ObjectStartPlacementMode placementMode) public void SetObjectStartPlacementMode(ObjectStartPlacementMode placementMode)
@ -5504,7 +5504,7 @@ namespace NavisworksTransport.Core.Animation
double verticalLiftModelUnits, double verticalLiftModelUnits,
CoordinateSystemType hostType) CoordinateSystemType hostType)
{ {
if (verticalLiftModelUnits <= 0.0) if (Math.Abs(verticalLiftModelUnits) < 1e-9)
{ {
return Vector3.Zero; return Vector3.Zero;
} }
@ -5515,7 +5515,7 @@ namespace NavisworksTransport.Core.Animation
private Point3D ApplyGroundPathObjectLiftOffset(Point3D trackedCenter) 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; return trackedCenter;
} }

View File

@ -2191,7 +2191,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
ObjectRotationCorrection = placementRequest.RotationCorrection; ObjectRotationCorrection = placementRequest.RotationCorrection;
string liftSummary = enableGroundLift string liftSummary = enableGroundLift
? $", 提升高度={_objectGroundLiftHeightInMeters:F3}m" ? $", 上下偏移={_objectGroundLiftHeightInMeters:F3}m"
: string.Empty; : string.Empty;
string statusSummary = placementRequest.PreserveInitialPose string statusSummary = placementRequest.PreserveInitialPose
? $"物体已调整为平移模式{liftSummary}" ? $"物体已调整为平移模式{liftSummary}"
@ -2199,7 +2199,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
LogManager.Info( LogManager.Info(
$"物体调整已更新: 模式={placementRequest.PlacementMode}, 角度={_objectRotationCorrection}, " + $"物体调整已更新: 模式={placementRequest.PlacementMode}, 角度={_objectRotationCorrection}, " +
$"提升高度={_objectGroundLiftHeightInMeters:F3}m"); $"上下偏移={_objectGroundLiftHeightInMeters:F3}m");
UpdateMainStatus(statusSummary); UpdateMainStatus(statusSummary);
// 更新通行空间可视化(考虑旋转后的尺寸) // 更新通行空间可视化(考虑旋转后的尺寸)
@ -4736,7 +4736,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
// 地面路径物体的长度方向X轴前进方向朝向路径方向 // 地面路径物体的长度方向X轴前进方向朝向路径方向
// 通行空间沿路径方向 = X方向尺寸长度垂直于路径方向 = Y方向尺寸宽度高度上方加间隙下方不需要因为有地面 // 通行空间沿路径方向 = X方向尺寸长度垂直于路径方向 = Y方向尺寸宽度高度上方加间隙下方不需要因为有地面
passageAcrossPath = effectiveWidth + 2 * safetyMargin; // 旋转后宽度 + 2*间隙(垂直于路径方向) passageAcrossPath = effectiveWidth + 2 * safetyMargin; // 旋转后宽度 + 2*间隙(垂直于路径方向)
passageNormalToPath = effectiveHeight + (_objectGroundLiftHeightInMeters * metersToUnitsPassage) + safetyMargin; // 物体高度 + 提升高度 + 上方间隙 passageNormalToPath = effectiveHeight + (_objectGroundLiftHeightInMeters * metersToUnitsPassage) + safetyMargin; // 物体高度 + 上下偏移 + 上方间隙
passageAlongPath = effectiveLength; // 旋转后长度(沿路径方向) passageAlongPath = effectiveLength; // 旋转后长度(沿路径方向)
// 地面路径不需要分段参数 // 地面路径不需要分段参数
passageNormalToPathVertical = passageNormalToPath; passageNormalToPathVertical = passageNormalToPath;
@ -4780,7 +4780,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
// 物体的长度方向X轴前进方向朝向路径方向 // 物体的长度方向X轴前进方向朝向路径方向
// 通行空间沿路径方向 = X方向尺寸长度垂直于路径方向 = Y方向尺寸宽度高度上方加间隙下方不需要因为有地面 // 通行空间沿路径方向 = X方向尺寸长度垂直于路径方向 = Y方向尺寸宽度高度上方加间隙下方不需要因为有地面
passageAcrossPath = effectiveWidth + 2 * safetyMargin; // 旋转后宽度 + 2*间隙(垂直于路径方向) passageAcrossPath = effectiveWidth + 2 * safetyMargin; // 旋转后宽度 + 2*间隙(垂直于路径方向)
passageNormalToPath = effectiveHeight + (_objectGroundLiftHeightInMeters * metersToUnitsPassage) + safetyMargin; // 物体高度 + 提升高度 + 上方间隙 passageNormalToPath = effectiveHeight + (_objectGroundLiftHeightInMeters * metersToUnitsPassage) + safetyMargin; // 物体高度 + 上下偏移 + 上方间隙
passageAlongPath = effectiveLength; // 旋转后长度(沿路径方向) passageAlongPath = effectiveLength; // 旋转后长度(沿路径方向)
// 地面路径不需要分段参数 // 地面路径不需要分段参数
passageNormalToPathVertical = passageNormalToPath; passageNormalToPathVertical = passageNormalToPath;
@ -4824,7 +4824,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
passageAlongPath, passageAlongPath,
passageNormalToPathVertical, passageNormalToPathVertical,
passageNormalToPathHorizontal); 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; bool enableObjectSpace = false;

View File

@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:NavisworksTransport.UI.WPF.Converters" xmlns:converters="clr-namespace:NavisworksTransport.UI.WPF.Converters"
Title="调整物体" Height="430" Width="400" Title="调整物体" Height="380" Width="440"
WindowStartupLocation="CenterScreen" WindowStartupLocation="CenterScreen"
ResizeMode="NoResize" ResizeMode="NoResize"
ShowInTaskbar="False" ShowInTaskbar="False"
@ -28,7 +28,6 @@
<Border Grid.Row="0" Background="#FFF8FBFF" BorderBrush="#FFD4E7FF" BorderThickness="0,0,0,1" Padding="20,15"> <Border Grid.Row="0" Background="#FFF8FBFF" BorderBrush="#FFD4E7FF" BorderThickness="0,0,0,1" Padding="20,15">
<StackPanel> <StackPanel>
<TextBlock Text="调整物体" FontWeight="SemiBold" FontSize="14" Foreground="#FF2B579A"/> <TextBlock Text="调整物体" FontWeight="SemiBold" FontSize="14" Foreground="#FF2B579A"/>
<TextBlock Text="设置物体在路径起点处的角度修正;地面路径可额外输入提升高度" FontSize="10" Foreground="#FF666666" Margin="0,3,0,0"/>
</StackPanel> </StackPanel>
</Border> </Border>
@ -78,7 +77,7 @@
</Grid> </Grid>
<!-- Z轴 --> <!-- Z轴 -->
<Grid Margin="0,0,0,12"> <Grid Margin="0,0,0,8">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="110"/> <ColumnDefinition Width="110"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
@ -98,13 +97,13 @@
<TextBlock Grid.Column="2" Text="°" VerticalAlignment="Center" FontSize="11" Foreground="#FF666666" Margin="8,0,0,0"/> <TextBlock Grid.Column="2" Text="°" VerticalAlignment="Center" FontSize="11" Foreground="#FF666666" Margin="8,0,0,0"/>
</Grid> </Grid>
<Grid Margin="0,0,0,12"> <Grid Margin="0,0,0,8">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="110"/> <ColumnDefinition Width="110"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
<ColumnDefinition Width="50"/> <ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Text="提升高度:" VerticalAlignment="Center" FontSize="11" Foreground="#FF333333"/> <TextBlock Text="上下偏移:" VerticalAlignment="Center" FontSize="11" Foreground="#FF333333"/>
<TextBox Grid.Column="1" <TextBox Grid.Column="1"
x:Name="GroundLiftTextBox" x:Name="GroundLiftTextBox"
Text="{Binding GroundPathLiftHeightInMeters, Mode=TwoWay, UpdateSourceTrigger=Explicit, Converter={StaticResource EditableNumberConverter}, ConverterParameter=0.###, ValidatesOnExceptions=True, NotifyOnValidationError=True}" Text="{Binding GroundPathLiftHeightInMeters, Mode=TwoWay, UpdateSourceTrigger=Explicit, Converter={StaticResource EditableNumberConverter}, ConverterParameter=0.###, ValidatesOnExceptions=True, NotifyOnValidationError=True}"
@ -118,11 +117,6 @@
<TextBlock Grid.Column="2" Text="m" VerticalAlignment="Center" FontSize="11" Foreground="#FF666666" Margin="8,0,0,0"/> <TextBlock Grid.Column="2" Text="m" VerticalAlignment="Center" FontSize="11" Foreground="#FF666666" Margin="8,0,0,0"/>
</Grid> </Grid>
<TextBlock Text="{Binding GroundLiftHint}"
FontSize="10"
Foreground="#FF666666"
Margin="0,0,0,12"/>
<!-- 快捷按钮 --> <!-- 快捷按钮 -->
<TextBlock Text="快捷角度(作用于当前焦点输入框):" FontSize="10" Foreground="#FF666666" Margin="0,0,0,8"/> <TextBlock Text="快捷角度(作用于当前焦点输入框):" FontSize="10" Foreground="#FF666666" Margin="0,0,0,8"/>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">

View File

@ -89,8 +89,8 @@ namespace NavisworksTransport.UI.WPF.Views
public bool IsGroundLiftEnabled => _isGroundLiftEnabled; public bool IsGroundLiftEnabled => _isGroundLiftEnabled;
public string GroundLiftHint => _isGroundLiftEnabled public string GroundLiftHint => _isGroundLiftEnabled
? "仅地面路径生效,用于模拟物体下方物流小车带来的整体抬升。" ? "仅地面路径生效,正值向上偏移,负值向下偏移。"
: "提升高度当前仅对地面路径生效。"; : "上下偏移当前仅对地面路径生效。";
public ObjectStartPlacementRequest AdjustmentRequest => _adjustmentRequest; public ObjectStartPlacementRequest AdjustmentRequest => _adjustmentRequest;
@ -273,17 +273,11 @@ namespace NavisworksTransport.UI.WPF.Views
return false; return false;
} }
if (!TryUpdateNumberTextBox(GroundLiftTextBox, "请输入有效的提升高度。")) if (!TryUpdateNumberTextBox(GroundLiftTextBox, "请输入有效的上下偏移值。"))
{ {
return false; return false;
} }
if (GroundPathLiftHeightInMeters < 0.0)
{
ShowInputError("提升高度必须大于或等于 0。", GroundLiftTextBox);
return false;
}
return true; return true;
} }