清理一些todo和无效文件和代码

This commit is contained in:
tian 2025-09-17 12:06:28 +08:00
parent f698322e35
commit 5dfa24be86
13 changed files with 24 additions and 1383 deletions

View File

@ -58,7 +58,6 @@ NavisworksTransportPlugin/
│ │ ├── VisibilityManager.cs # 可见性控制
│ │ └── ... # 其他核心组件
│ ├── UI/
│ │ ├── Forms/ # 旧版WinForms UI (逐渐被WPF替代)
│ │ └── WPF/ # 新版WPF UI
│ │ ├── ViewModels/ # MVVM ViewModels
│ │ ├── Views/ # MVVM Views (UserControls)

View File

@ -1 +1,3 @@
# 版本号
0.12.0

View File

@ -113,7 +113,6 @@ namespace NavisworksTransport.Core.Animation
// === 双向播放和步进控制 ===
private int _playbackDirection = 1; // 播放方向1=正向,-1=反向
private double _playbackSpeed = 1.0; // 播放速度倍率
private bool _isStepMode = false; // 是否处于步进模式
// === 性能监控 ===
private int _fpsFrameCount = 0;

View File

@ -23,21 +23,6 @@ namespace NavisworksTransport
VehicleSpace
}
/// <summary>
/// 高度计算模式枚举
/// </summary>
public enum VehicleHeightMode
{
/// <summary>
/// 固定高度 - 使用车辆高度+安全间隙
/// </summary>
FixedHeight,
/// <summary>
/// 自动高度 - 根据网格大小计算
/// </summary>
AutoHeight
}
/// <summary>
/// 渲染颜色类型枚举
@ -153,7 +138,7 @@ namespace NavisworksTransport
public double Width { get; set; }
/// <summary>
/// 通道高度(车辆高度+安全间隙或自动高度
/// 通道高度(车辆高度+安全间隙
/// </summary>
public double Height { get; set; }
@ -300,13 +285,12 @@ namespace NavisworksTransport
// 路径可视化模式配置
private PathVisualizationMode _visualizationMode = PathVisualizationMode.StandardLine;
private VehicleHeightMode _vehicleHeightMode = VehicleHeightMode.FixedHeight;
// 车辆参数默认值可以从PathPlanningManager获取
private double _vehicleLength = 2.0; // 米
private double _vehicleWidth = 1.5; // 米
private double _vehicleLength = 1.0; // 米
private double _vehicleWidth = 1.0; // 米
private double _vehicleHeight = 2.0; // 米
private double _safetyMargin = 0.3; // 米
private double _safetyMargin = 0.25; // 米
// 静态实例,用于外部访问
private static PathPointRenderPlugin _instance;
@ -338,22 +322,6 @@ namespace NavisworksTransport
}
}
/// <summary>
/// 车辆高度计算模式
/// </summary>
public VehicleHeightMode VehicleHeightMode
{
get { return _vehicleHeightMode; }
set
{
_vehicleHeightMode = value;
// 只有在车辆空间模式下才需要刷新
if (_visualizationMode == PathVisualizationMode.VehicleSpace)
{
RefreshNormalPaths();
}
}
}
/// <summary>
/// 是否启用渲染
@ -855,19 +823,8 @@ namespace NavisworksTransport
// 计算车辆通行空间宽度(米)
double vehicleInflationWidthInMeters = Math.Max(_vehicleLength, _vehicleWidth) + 2 * _safetyMargin;
// 计算车辆通行空间高度(米)
double vehicleSpaceHeightInMeters;
if (_vehicleHeightMode == VehicleHeightMode.FixedHeight)
{
// 固定高度模式:车辆高度 + 安全间隙
vehicleSpaceHeightInMeters = _vehicleHeight + _safetyMargin;
}
else
{
// 自动高度模式:根据网格大小计算
vehicleSpaceHeightInMeters = _currentGridSizeInMeters * 2.0; // 网格大小的2倍作为默认高度
vehicleSpaceHeightInMeters = Math.Max(vehicleSpaceHeightInMeters, _vehicleHeight + _safetyMargin); // 确保不小于车辆高度
}
// 计算车辆通行空间高度(米):车辆高度 + 安全间隙
double vehicleSpaceHeightInMeters = _vehicleHeight + _safetyMargin;
var style = GetRenderStyle(RenderColorType.VehicleSpace);
return new VehicleSpaceMarker
@ -983,7 +940,7 @@ namespace NavisworksTransport
LogManager.WriteLog($"[车辆参数] 更新车辆参数: 长={vehicleLength:F2}m, 宽={vehicleWidth:F2}m, 高={vehicleHeight:F2}m, 安全间隙={safetyMargin:F2}m");
// 车辆参数改变时刷新所有普通路径
// 车辆参数改变时刷新车辆空间模式下的所有普通路径
if (_visualizationMode == PathVisualizationMode.VehicleSpace)
{
RefreshNormalPaths();

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,6 @@ namespace NavisworksTransport.PathPlanning
{
private readonly CategoryAttributeManager _categoryManager;
private readonly ChannelBasedGridBuilder _channelBuilder;
private VerticalScanProcessor _verticalScanner;
/// <summary>
/// 构造函数
@ -43,7 +42,6 @@ namespace NavisworksTransport.PathPlanning
{
_categoryManager = new CategoryAttributeManager();
_channelBuilder = new ChannelBasedGridBuilder();
_verticalScanner = null;
}
/// <summary>

View File

@ -446,18 +446,6 @@ namespace NavisworksTransport.PathPlanning
return points;
}
/// <summary>
/// 验证物流碰撞(未来实现)
/// </summary>
/// <param name="points">路径点列表</param>
/// <returns>是否通过碰撞检测</returns>
private bool ValidatePathCollision(List<PathPoint> points)
{
// TODO: 实现碰撞检测验证
LogManager.Info("[碰撞检测] 功能尚未实现");
return true;
}
#endregion
}
}

View File

@ -160,7 +160,7 @@ namespace NavisworksTransport.UI.WPF.Commands
LogManager.Info($"[FloorAnalysisCommand] 开始楼层分析,深度限制: {_maxDepth}");
LogManager.Info($"[FloorAnalysisCommand] 当前线程ID: {System.Threading.Thread.CurrentThread.ManagedThreadId}");
var document = Autodesk.Navisworks.Api.Application.ActiveDocument;
var document = Application.ActiveDocument;
if (document?.Models?.Count == 0)
{
return new FloorAnalysisResult
@ -254,7 +254,7 @@ namespace NavisworksTransport.UI.WPF.Commands
{
LogManager.Info($"[RefreshAttributesCommand] 开始刷新属性,深度限制: {_maxDepth}");
var document = Autodesk.Navisworks.Api.Application.ActiveDocument;
var document = Application.ActiveDocument;
if (document?.Models?.Count == 0)
{
return new RefreshAttributesResult
@ -308,7 +308,7 @@ namespace NavisworksTransport.UI.WPF.Commands
{
LogManager.Info("[SelectNodesCommand] 开始获取选中节点");
var document = Autodesk.Navisworks.Api.Application.ActiveDocument;
var document = Application.ActiveDocument;
var selection = document?.CurrentSelection;
var count = selection?.SelectedItems?.Count ?? 0;
@ -358,7 +358,7 @@ namespace NavisworksTransport.UI.WPF.Commands
{
LogManager.Info($"[ApplyFloorAttributesCommand] 开始应用楼层属性: {_selectedFloorAttribute}");
var document = Autodesk.Navisworks.Api.Application.ActiveDocument;
var document = Application.ActiveDocument;
var selection = document?.CurrentSelection;
if (selection?.SelectedItems?.Count == 0)
@ -371,9 +371,6 @@ namespace NavisworksTransport.UI.WPF.Commands
};
}
// TODO: 这里实现实际的楼层属性设置逻辑
// 暂时返回成功结果作为占位符
var count = selection.SelectedItems.Count;
LogManager.Info($"[ApplyFloorAttributesCommand] 成功为 {count} 个节点设置楼层属性");
@ -633,7 +630,7 @@ namespace NavisworksTransport.UI.WPF.Commands
{
LogManager.Info($"[SaveSelectedItemsCommand] 开始保存选中项目到: {_filePath ?? ""}");
var document = Autodesk.Navisworks.Api.Application.ActiveDocument;
var document = Application.ActiveDocument;
var selection = document?.CurrentSelection;
if (selection?.SelectedItems?.Count == 0)
@ -646,10 +643,6 @@ namespace NavisworksTransport.UI.WPF.Commands
};
}
// TODO: 这里实现实际的保存选中项目逻辑
// 如果_filePath为null使用默认的文件选择对话框
// 暂时返回成功结果作为占位符
var count = selection.SelectedItems.Count;
LogManager.Info($"[SaveSelectedItemsCommand] 成功保存 {count} 个选中项目到: {_filePath ?? ""}");
@ -687,7 +680,7 @@ namespace NavisworksTransport.UI.WPF.Commands
{
try
{
var document = Autodesk.Navisworks.Api.Application.ActiveDocument;
var document = Application.ActiveDocument;
var selection = document?.CurrentSelection;
var count = selection?.SelectedItems?.Count ?? 0;

View File

@ -41,8 +41,6 @@ namespace NavisworksTransport.UI.WPF.ViewModels
/// <summary>
/// 路径编辑页面专用ViewModel
/// 暂时使用空实现避免与主LogisticsControlViewModel功能重复
/// TODO: 后续将从LogisticsControlViewModelcopy.cs迁移完整业务逻辑
/// </summary>
public class PathEditingViewModel : ViewModelBase, IDisposable
{

View File

@ -31,8 +31,6 @@ namespace NavisworksTransport.UI.WPF.ViewModels
// 路径可视化模式字段
private bool _isStandardLineMode = true;
private bool _isVehicleSpaceMode = false;
private bool _isFixedHeightMode = true;
private bool _isAutoHeightMode = false;
private ObservableCollection<string> _logLevels;
private string _selectedLogLevel = "Info";
private string _pluginVersion = "v1.0";
@ -167,43 +165,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
}
}
/// <summary>
/// 是否使用固定高度模式
/// </summary>
public bool IsFixedHeightMode
{
get => _isFixedHeightMode;
set
{
if (SetProperty(ref _isFixedHeightMode, value))
{
if (value)
{
IsAutoHeightMode = false;
OnVehicleHeightModeChanged();
}
}
}
}
/// <summary>
/// 是否使用自动高度模式
/// </summary>
public bool IsAutoHeightMode
{
get => _isAutoHeightMode;
set
{
if (SetProperty(ref _isAutoHeightMode, value))
{
if (value)
{
IsFixedHeightMode = false;
OnVehicleHeightModeChanged();
}
}
}
}
/// <summary>
/// 日志级别集合
@ -459,36 +421,6 @@ namespace NavisworksTransport.UI.WPF.ViewModels
}
}
/// <summary>
/// 车辆高度模式变更事件处理
/// </summary>
private void OnVehicleHeightModeChanged()
{
try
{
var renderPlugin = PathPointRenderPlugin.Instance;
if (renderPlugin != null)
{
var mode = IsAutoHeightMode ? VehicleHeightMode.AutoHeight : VehicleHeightMode.FixedHeight;
renderPlugin.VehicleHeightMode = mode;
// 在高度模式变更时也同步车辆参数(特别是高度参数)
SyncVehicleParametersFromPathEditingViewModel();
LogManager.Info($"车辆高度模式已更改: {(IsAutoHeightMode ? "" : "")}");
UpdateMainStatus("车辆高度模式已更新");
}
else
{
LogManager.Warning("无法获取PathPointRenderPlugin实例");
}
}
catch (Exception ex)
{
LogManager.Error($"应用车辆高度模式失败: {ex.Message}", ex);
UpdateMainStatus("车辆高度模式更新失败");
}
}
/// <summary>
/// 获取路径规划管理器实例

View File

@ -74,13 +74,10 @@ NavisworksTransport 关于对话框 - 采用与主界面一致的Navisworks 2026
<TextBlock Grid.Row="1" Grid.Column="1" Text="1.0.0" Style="{StaticResource DialogInfoTextStyle}"/>
<Label Grid.Row="2" Grid.Column="0" Content="发布日期:" Style="{StaticResource DialogInfoLabelStyle}"/>
<TextBlock Grid.Row="2" Grid.Column="1" Text="2024年8月" Style="{StaticResource DialogInfoTextStyle}"/>
<TextBlock Grid.Row="2" Grid.Column="1" Text="2024年9月" Style="{StaticResource DialogInfoTextStyle}"/>
<Label Grid.Row="3" Grid.Column="0" Content="开发语言:" Style="{StaticResource DialogInfoLabelStyle}"/>
<TextBlock Grid.Row="3" Grid.Column="1" Text="C# .NET Framework 4.8" Style="{StaticResource DialogInfoTextStyle}"/>
<Label Grid.Row="4" Grid.Column="0" Content="UI框架:" Style="{StaticResource DialogInfoLabelStyle}"/>
<TextBlock Grid.Row="4" Grid.Column="1" Text="WPF + MVVM" Style="{StaticResource DialogInfoTextStyle}"/>
<Label Grid.Row="3" Grid.Column="0" Content="运行时框架:" Style="{StaticResource DialogInfoLabelStyle}"/>
<TextBlock Grid.Row="3" Grid.Column="1" Text=".NET Framework 4.8" Style="{StaticResource DialogInfoTextStyle}"/>
</Grid>
<!-- 功能描述 -->
@ -91,13 +88,15 @@ NavisworksTransport 关于对话框 - 采用与主界面一致的Navisworks 2026
<TextBlock Style="{StaticResource DialogDescriptionStyle}" Margin="20,10">
<Run Text="主要特性:" FontWeight="Medium" Foreground="#FF2B579A"/>
<LineBreak/>
<Run Text="• 智能路径规划与A*算法优化"/>
<Run Text="• 智能分层与导出"/>
<LineBreak/>
<Run Text="• 自动路径规划"/>
<LineBreak/>
<Run Text="• 实时碰撞检测与冲突分析"/>
<LineBreak/>
<Run Text="• 流畅的3D动画演示"/>
<LineBreak/>
<Run Text="• 完整的物流类别管理系统"/>
<Run Text="• 完整的物流类别管理"/>
</TextBlock>
</StackPanel>

View File

@ -62,7 +62,7 @@ NavisworksTransport 帮助对话框 - 采用与主界面一致的Navisworks 2026
<!-- 分层管理 -->
<Label Content="1. 分层管理" Style="{StaticResource SubSectionHeaderStyle}"/>
<TextBlock Text="• 选择分层策略,对分层结果进行预览"
<TextBlock Text="• 选择自定义或智能分层策略,对分层结果进行预览"
Style="{StaticResource DialogContentTextStyle}"/>
<TextBlock Text="• 按设置的NWD文件选项根据分层导出多个文件"
Style="{StaticResource DialogContentTextStyle}"/>

View File

@ -131,18 +131,6 @@ namespace NavisworksTransport.UI.WPF
LogManager.Info("使用已存在的PathPlanningManager实例");
}
// TODO: 后续任务中将重新实现事件订阅
// 暂时注释掉事件订阅,避免编译错误
/*
_pathPlanningManager.PathEditStateChanged += OnPathEditStateChanged;
_pathPlanningManager.PathPointAddedIn3D += OnPathPointAddedIn3D;
_pathPlanningManager.PathPointRemovedFrom3D += OnPathPointRemovedFrom3D;
_pathPlanningManager.PathPointsListUpdated += OnPathPointsListUpdated;
_pathPlanningManager.CurrentRouteChanged += OnCurrentRouteChanged;
_pathPlanningManager.StatusChanged += OnPathManagerStatusChanged;
_pathPlanningManager.ErrorOccurred += OnPathManagerErrorOccurred;
*/
LogManager.Info("PathPlanningManager初始化完成");
}
catch (Exception ex)
@ -350,21 +338,6 @@ namespace NavisworksTransport.UI.WPF
// 清理SystemManagementViewModel
SystemManagementViewModel?.Cleanup();
// TODO: 清理路径规划管理器事件订阅
// 暂时注释掉,避免编译错误
/*
if (_pathPlanningManager != null)
{
_pathPlanningManager.PathEditStateChanged -= OnPathEditStateChanged;
_pathPlanningManager.PathPointAddedIn3D -= OnPathPointAddedIn3D;
_pathPlanningManager.PathPointRemovedFrom3D -= OnPathPointRemovedFrom3D;
_pathPlanningManager.PathPointsListUpdated -= OnPathPointsListUpdated;
_pathPlanningManager.CurrentRouteChanged -= OnCurrentRouteChanged;
_pathPlanningManager.StatusChanged -= OnPathManagerStatusChanged;
_pathPlanningManager.ErrorOccurred -= OnPathManagerErrorOccurred;
}
*/
// 清理 Clash Detective 集成
GlobalExceptionHandler.CleanupClashDetectiveIntegration();