diff --git a/$null b/$null
new file mode 100644
index 0000000..ce3e5ba
--- /dev/null
+++ b/$null
@@ -0,0 +1 @@
+Active code page: 65001
diff --git a/src/Core/PathPointRenderPlugin.cs b/src/Core/PathPointRenderPlugin.cs
index efeb319..baf88ef 100644
--- a/src/Core/PathPointRenderPlugin.cs
+++ b/src/Core/PathPointRenderPlugin.cs
@@ -23,6 +23,27 @@ namespace NavisworksTransport
VehicleSpace
}
+ ///
+ /// 网格点类型枚举
+ ///
+ public enum GridPointType
+ {
+ ///
+ /// 球形
+ ///
+ Sphere,
+
+ ///
+ /// 立方体
+ ///
+ Cube,
+
+ ///
+ /// 点
+ ///
+ Point
+ }
+
///
/// 渲染颜色类型枚举
@@ -283,6 +304,9 @@ namespace NavisworksTransport
// 路径可视化模式配置
private PathVisualizationMode _visualizationMode = PathVisualizationMode.StandardLine;
+ // 网格点类型配置
+ private GridPointType _gridPointType = GridPointType.Cube;
+
// 车辆参数(必须通过SetVehicleParameters方法设置)
private double _vehicleLength;
private double _vehicleWidth;
@@ -319,6 +343,20 @@ namespace NavisworksTransport
}
}
+ ///
+ /// 网格点类型
+ ///
+ public GridPointType GridPointType
+ {
+ get { return _gridPointType; }
+ set
+ {
+ _gridPointType = value;
+ // 类型改变时刷新所有网格路径
+ RefreshGridPaths();
+ }
+ }
+
///
/// 是否启用渲染
@@ -406,7 +444,7 @@ namespace NavisworksTransport
foreach (var pointMarker in visualization.PointMarkers)
{
graphics.Color(pointMarker.Color, pointMarker.Alpha);
- graphics.Sphere(pointMarker.Center, pointMarker.Radius);
+ RenderPointMarker(graphics, pointMarker);
}
// 渲染所有连线(删除频繁的调试日志以避免日志泛滥)
@@ -428,7 +466,7 @@ namespace NavisworksTransport
if (_previewMarker != null && _previewMarker.IsVisible)
{
graphics.Color(_previewMarker.Color, 0.7); // 使用半透明效果
- graphics.Sphere(_previewMarker.Position, _previewMarker.Radius);
+ RenderPointMarker(graphics, _previewMarker);
}
// 渲染预览连线(灰色)
@@ -614,6 +652,32 @@ namespace NavisworksTransport
}
}
+ ///
+ /// 刷新所有网格路径
+ ///
+ private void RefreshGridPaths()
+ {
+ lock (_lockObject)
+ {
+ var gridPathIds = _pathVisualizations.Keys
+ .Where(id => IsGridVisualizationPath(id))
+ .ToList();
+
+ foreach (var pathId in gridPathIds)
+ {
+ if (_pathVisualizations.TryGetValue(pathId, out var visualization))
+ {
+ BuildPointMarkersOnly(visualization);
+ }
+ }
+
+ if (gridPathIds.Count > 0)
+ {
+ RequestViewRefresh();
+ }
+ }
+ }
+
///
/// 移除路径
///
@@ -855,6 +919,7 @@ namespace NavisworksTransport
Alpha = isGridVisualization ? gridStyle.Alpha : 1.0,
Filled = true,
PointType = point.Type,
+ GridPointType = isGridVisualization ? _gridPointType : GridPointType.Sphere, // 网格点使用配置的类型,其他点使用球形
SequenceNumber = point.Index, // 使用Index而不是任意序号
CreatedTime = DateTime.Now
};
@@ -1533,6 +1598,57 @@ namespace NavisworksTransport
}
+ ///
+ /// 渲染点标记
+ ///
+ /// 图形上下文
+ /// 点标记
+ private void RenderPointMarker(Graphics graphics, CircleMarker pointMarker)
+ {
+ switch (pointMarker.GridPointType)
+ {
+ case GridPointType.Cube:
+ // 渲染立方体
+ RenderCubeMarker(graphics, pointMarker);
+ break;
+ case GridPointType.Point:
+ // 渲染点
+ graphics.Point(pointMarker.Center);
+ break;
+ case GridPointType.Sphere:
+ default:
+ // 渲染球形(默认)
+ graphics.Sphere(pointMarker.Center, pointMarker.Radius);
+ break;
+ }
+ }
+
+ ///
+ /// 渲染立方体标记
+ ///
+ /// 图形上下文
+ /// 点标记
+ private void RenderCubeMarker(Graphics graphics, CircleMarker pointMarker)
+ {
+ // 计算立方体的边长(直径的一半)
+ double halfSide = pointMarker.Radius;
+
+ // 定义立方体的三个轴向量(沿X、Y、Z轴)
+ var xVector = new Vector3D(halfSide * 2, 0, 0);
+ var yVector = new Vector3D(0, halfSide * 2, 0);
+ var zVector = new Vector3D(0, 0, halfSide * 2);
+
+ // 计算立方体原点(中心点减去各轴向量的一半)
+ var origin = new Point3D(
+ pointMarker.Center.X - halfSide,
+ pointMarker.Center.Y - halfSide,
+ pointMarker.Center.Z - halfSide
+ );
+
+ // 使用Cuboid API渲染立方体
+ graphics.Cuboid(origin, xVector, yVector, zVector, pointMarker.Filled);
+ }
+
///
/// 请求视图刷新(带防抖机制)
///
@@ -1683,6 +1799,11 @@ namespace NavisworksTransport
///
public PathPointType PointType { get; set; }
+ ///
+ /// 网格点类型
+ ///
+ public GridPointType GridPointType { get; set; } = GridPointType.Sphere;
+
///
/// 序号
///
diff --git a/src/UI/WPF/ViewModels/SystemManagementViewModel.cs b/src/UI/WPF/ViewModels/SystemManagementViewModel.cs
index 5dab89e..7d9ab6f 100644
--- a/src/UI/WPF/ViewModels/SystemManagementViewModel.cs
+++ b/src/UI/WPF/ViewModels/SystemManagementViewModel.cs
@@ -25,6 +25,11 @@ namespace NavisworksTransport.UI.WPF.ViewModels
private bool _showObstacleGrid = false;
private bool _showUnknownGrid = false;
private bool _showDoorGrid = false;
+
+ // 网格点类型字段
+ private GridPointType _gridPointType = GridPointType.Cube;
+ private ObservableCollection _gridPointTypes;
+
// 路径可视化模式字段
private bool _isStandardLineMode = true;
private bool _isVehicleSpaceMode = false;
@@ -104,6 +109,71 @@ namespace NavisworksTransport.UI.WPF.ViewModels
}
}
}
+
+ ///
+ /// 网格点类型
+ ///
+ public GridPointType GridPointType
+ {
+ get => _gridPointType;
+ set
+ {
+ if (SetProperty(ref _gridPointType, value))
+ {
+ // 通知相关的单选按钮属性更新
+ OnPropertyChanged(nameof(IsCubePointType));
+ OnPropertyChanged(nameof(IsSpherePointType));
+ OnPropertyChanged(nameof(IsPointPointType));
+ OnGridPointTypeChanged();
+ }
+ }
+ }
+
+ ///
+ /// 是否使用立方体点类型
+ ///
+ public bool IsCubePointType
+ {
+ get => _gridPointType == GridPointType.Cube;
+ set
+ {
+ if (value)
+ {
+ GridPointType = GridPointType.Cube;
+ }
+ }
+ }
+
+ ///
+ /// 是否使用球形点类型
+ ///
+ public bool IsSpherePointType
+ {
+ get => _gridPointType == GridPointType.Sphere;
+ set
+ {
+ if (value)
+ {
+ GridPointType = GridPointType.Sphere;
+ }
+ }
+ }
+
+ ///
+ /// 是否使用点状点类型
+ ///
+ public bool IsPointPointType
+ {
+ get => _gridPointType == GridPointType.Point;
+ set
+ {
+ if (value)
+ {
+ GridPointType = GridPointType.Point;
+ }
+ }
+ }
+
///
/// 是否使用标准连线模式
///
@@ -369,6 +439,36 @@ namespace NavisworksTransport.UI.WPF.ViewModels
UpdateMainStatus("网格可视化设置应用失败");
}
}
+
+ ///
+ /// 网格点类型变更事件处理
+ ///
+ private void OnGridPointTypeChanged()
+ {
+ try
+ {
+ LogManager.Info($"网格点类型已更改: {GridPointType}");
+
+ // 通知路径点渲染插件更新网格点类型
+ var renderPlugin = PathPointRenderPlugin.Instance;
+ if (renderPlugin != null)
+ {
+ renderPlugin.GridPointType = GridPointType;
+ UpdateMainStatus("网格点类型已更新");
+ }
+ else
+ {
+ LogManager.Warning("无法获取PathPointRenderPlugin实例,网格点类型可能不会立即生效");
+ UpdateMainStatus("网格点类型已保存");
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Error($"应用网格点类型失败: {ex.Message}", ex);
+ UpdateMainStatus("网格点类型应用失败");
+ }
+ }
+
///
/// 路径可视化模式变更事件处理
///
@@ -446,6 +546,9 @@ namespace NavisworksTransport.UI.WPF.ViewModels
var currentLevel = LogManager.GetLogLevel();
SelectedLogLevel = currentLevel.ToString();
+ // 设置默认网格点类型
+ GridPointType = GridPointType.Cube;
+
// 初始化系统信息
PluginVersion = "v1.0";
NavisworksVersion = "2026";
diff --git a/src/UI/WPF/Views/SystemManagementView.xaml b/src/UI/WPF/Views/SystemManagementView.xaml
index 02123e7..3f2026c 100644
--- a/src/UI/WPF/Views/SystemManagementView.xaml
+++ b/src/UI/WPF/Views/SystemManagementView.xaml
@@ -154,6 +154,43 @@ NavisworksTransport 系统管理页签视图 - 采用与其他页签一致的Nav
ToolTip="显示通行空间(矩形通道)"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+