调整物体窗口: 提升高度→上下偏移, 允许负值, 窗口加宽, 清理提示文字
- 字段名: 提升高度 → 上下偏移 (UI标签/日志/注释/状态栏) - 移除负值校验,允许向下偏移 (EditRotationWindow.xaml.cs) - 修复两处 <=0 拦截 (ApplyGroundPathObjectLiftOffset, ResolveGroundPathObjectLiftOffsetVector) - 窗口宽度 400→440, 调低标题栏/去除副标题/去除提示文字行
This commit is contained in:
parent
3e43b20102
commit
bbb58c9634
@ -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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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 @@
|
||||
<Border Grid.Row="0" Background="#FFF8FBFF" BorderBrush="#FFD4E7FF" BorderThickness="0,0,0,1" Padding="20,15">
|
||||
<StackPanel>
|
||||
<TextBlock Text="调整物体" FontWeight="SemiBold" FontSize="14" Foreground="#FF2B579A"/>
|
||||
<TextBlock Text="设置物体在路径起点处的角度修正;地面路径可额外输入提升高度" FontSize="10" Foreground="#FF666666" Margin="0,3,0,0"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
@ -78,7 +77,7 @@
|
||||
</Grid>
|
||||
|
||||
<!-- Z轴 -->
|
||||
<Grid Margin="0,0,0,12">
|
||||
<Grid Margin="0,0,0,8">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="110"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
@ -98,13 +97,13 @@
|
||||
<TextBlock Grid.Column="2" Text="°" VerticalAlignment="Center" FontSize="11" Foreground="#FF666666" Margin="8,0,0,0"/>
|
||||
</Grid>
|
||||
|
||||
<Grid Margin="0,0,0,12">
|
||||
<Grid Margin="0,0,0,8">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="110"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="50"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="提升高度:" VerticalAlignment="Center" FontSize="11" Foreground="#FF333333"/>
|
||||
<TextBlock Text="上下偏移:" VerticalAlignment="Center" FontSize="11" Foreground="#FF333333"/>
|
||||
<TextBox Grid.Column="1"
|
||||
x:Name="GroundLiftTextBox"
|
||||
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"/>
|
||||
</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"/>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user