把路径可视化设置放到路径页签,统一可视化风格架构(颜色+透明度)
This commit is contained in:
parent
10f408e361
commit
0081015d0b
@ -46,62 +46,62 @@ namespace NavisworksTransport
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 渲染颜色类型枚举
|
||||
/// 可视化元素样式名称枚举
|
||||
/// </summary>
|
||||
public enum RenderColorType
|
||||
public enum RenderStyleName
|
||||
{
|
||||
/// <summary>
|
||||
/// 路径起点颜色(绿色)
|
||||
/// 路径起点样式(绿色)
|
||||
/// </summary>
|
||||
StartPoint,
|
||||
|
||||
/// <summary>
|
||||
/// 路径终点颜色(红色)
|
||||
/// 路径终点样式(红色)
|
||||
/// </summary>
|
||||
EndPoint,
|
||||
|
||||
/// <summary>
|
||||
/// 路径中间点颜色(洋红色)
|
||||
/// 路径中间点样式(蓝色)
|
||||
/// </summary>
|
||||
WayPoint,
|
||||
|
||||
/// <summary>
|
||||
/// 连线颜色(橙色)
|
||||
/// 连线样式(橙色)
|
||||
/// </summary>
|
||||
Line,
|
||||
|
||||
/// <summary>
|
||||
/// 车辆通行空间颜色(淡蓝色亚克力)
|
||||
/// 车辆通行空间样式(灰色)
|
||||
/// </summary>
|
||||
VehicleSpace,
|
||||
|
||||
/// <summary>
|
||||
/// 预览点颜色(白色)
|
||||
/// 预览点样式(白色)
|
||||
/// </summary>
|
||||
PreviewPoint,
|
||||
|
||||
/// <summary>
|
||||
/// 预览连线颜色(灰色)
|
||||
/// 预览连线样式(灰色)
|
||||
/// </summary>
|
||||
PreviewLine,
|
||||
|
||||
/// <summary>
|
||||
/// 未到达终点颜色(深红色)
|
||||
/// 未到达终点样式(深红色)
|
||||
/// </summary>
|
||||
UnreachedEndPoint,
|
||||
|
||||
/// <summary>
|
||||
/// 网格通道颜色(绿色)
|
||||
/// 网格通道样式(浅绿色)
|
||||
/// </summary>
|
||||
GridChannel,
|
||||
|
||||
/// <summary>
|
||||
/// 网格障碍物颜色(灰色)
|
||||
/// 网格障碍物样式(灰色)
|
||||
/// </summary>
|
||||
GridObstacle,
|
||||
|
||||
/// <summary>
|
||||
/// 网格未知区域颜色(红色)
|
||||
/// 网格未知区域样式(深橙色)
|
||||
/// </summary>
|
||||
GridUnknown
|
||||
}
|
||||
@ -109,7 +109,7 @@ namespace NavisworksTransport
|
||||
/// <summary>
|
||||
/// 渲染样式,包含颜色和透明度
|
||||
/// </summary>
|
||||
public struct RenderStyle
|
||||
public readonly struct RenderStyle
|
||||
{
|
||||
/// <summary>
|
||||
/// 颜色
|
||||
@ -511,7 +511,7 @@ namespace NavisworksTransport
|
||||
// 圆弧段使用半透明灰色,直线段使用正常颜色
|
||||
if (pathLineMarker.SegmentType == PathSegmentType.Arc)
|
||||
{
|
||||
graphics.Color(GetRenderColor(RenderColorType.PreviewLine), 0.5); // 半透明灰色
|
||||
graphics.Color(GetRenderStyle(RenderStyleName.PreviewLine).Color, 0.5); // 半透明灰色
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -905,7 +905,7 @@ namespace NavisworksTransport
|
||||
if (!visualization.PathRoute.IsComplete && visualization.PathRoute.OriginalEndPoint != null)
|
||||
{
|
||||
var originalEndPoint = visualization.PathRoute.OriginalEndPoint;
|
||||
var unreachedStyle = GetRenderStyle(RenderColorType.UnreachedEndPoint);
|
||||
var unreachedStyle = GetRenderStyle(RenderStyleName.UnreachedEndPoint);
|
||||
var grayEndMarker = new CircleMarker
|
||||
{
|
||||
Center = originalEndPoint,
|
||||
@ -941,7 +941,7 @@ namespace NavisworksTransport
|
||||
{
|
||||
StartPoint = currentPoint.Position,
|
||||
EndPoint = nextPoint.Position,
|
||||
Color = GetRenderColor(RenderColorType.Line),
|
||||
Color = GetRenderStyle(RenderStyleName.Line).Color,
|
||||
Radius = GetLineRadius() * 0.5, // 比实际路径细
|
||||
SegmentType = PathSegmentType.Straight,
|
||||
FromIndex = currentPoint.Index,
|
||||
@ -993,7 +993,7 @@ namespace NavisworksTransport
|
||||
{
|
||||
StartPoint = edge.SampledPoints.First(),
|
||||
EndPoint = edge.SampledPoints.Last(),
|
||||
Color = GetRenderColor(RenderColorType.Line),
|
||||
Color = GetRenderStyle(RenderStyleName.Line).Color,
|
||||
Radius = GetLineRadius(),
|
||||
SegmentType = PathSegmentType.Straight,
|
||||
SampledPoints = edge.SampledPoints
|
||||
@ -1008,7 +1008,7 @@ namespace NavisworksTransport
|
||||
{
|
||||
StartPoint = edge.Trajectory.Ts,
|
||||
EndPoint = edge.Trajectory.Te,
|
||||
Color = GetRenderColor(RenderColorType.Line),
|
||||
Color = GetRenderStyle(RenderStyleName.Line).Color,
|
||||
Radius = GetLineRadius(),
|
||||
SegmentType = PathSegmentType.Arc,
|
||||
Trajectory = edge.Trajectory,
|
||||
@ -1032,7 +1032,7 @@ namespace NavisworksTransport
|
||||
if (edge.Trajectory == null) return;
|
||||
|
||||
// 切点颜色与路径点相同
|
||||
var tangentColor = GetRenderColor(RenderColorType.WayPoint);
|
||||
var tangentColor = GetRenderStyle(RenderStyleName.WayPoint).Color;
|
||||
|
||||
// 进入切点Ts
|
||||
var tsMarker = new SquareMarker
|
||||
@ -1078,7 +1078,7 @@ namespace NavisworksTransport
|
||||
// 计算车辆通行空间高度(米):车辆高度 + 安全间隙
|
||||
double vehicleSpaceHeightInMeters = _vehicleHeight + _safetyMargin;
|
||||
|
||||
var style = GetRenderStyle(RenderColorType.VehicleSpace);
|
||||
var style = GetRenderStyle(RenderStyleName.VehicleSpace);
|
||||
return new VehicleSpaceMarker
|
||||
{
|
||||
StartPoint = fromPoint.Position,
|
||||
@ -1110,26 +1110,26 @@ namespace NavisworksTransport
|
||||
// 根据网格类型确定样式
|
||||
if (point.Name.Contains("空洞") || point.Name.Contains("Unknown"))
|
||||
{
|
||||
gridStyle = GetRenderStyle(RenderColorType.GridUnknown);
|
||||
gridStyle = GetRenderStyle(RenderStyleName.GridUnknown);
|
||||
}
|
||||
else if (point.Name.Contains("障碍") || point.Name.Contains("Obstacle"))
|
||||
{
|
||||
gridStyle = GetRenderStyle(RenderColorType.GridObstacle);
|
||||
gridStyle = GetRenderStyle(RenderStyleName.GridObstacle);
|
||||
}
|
||||
else if (point.Name.Contains("通道") || point.Name.Contains("Channel") || point.Name.Contains("开放"))
|
||||
{
|
||||
gridStyle = GetRenderStyle(RenderColorType.GridChannel);
|
||||
gridStyle = GetRenderStyle(RenderStyleName.GridChannel);
|
||||
}
|
||||
// 也可以通过Notes字段检查
|
||||
else if (!string.IsNullOrEmpty(point.Notes) && point.Notes.StartsWith("GridType:"))
|
||||
{
|
||||
var gridTypeStr = point.Notes.Substring(9); // 去掉"GridType:"前缀
|
||||
if (gridTypeStr == "Unknown")
|
||||
gridStyle = GetRenderStyle(RenderColorType.GridUnknown);
|
||||
gridStyle = GetRenderStyle(RenderStyleName.GridUnknown);
|
||||
else if (gridTypeStr == "Obstacle")
|
||||
gridStyle = GetRenderStyle(RenderColorType.GridObstacle);
|
||||
gridStyle = GetRenderStyle(RenderStyleName.GridObstacle);
|
||||
else
|
||||
gridStyle = GetRenderStyle(RenderColorType.GridChannel);
|
||||
gridStyle = GetRenderStyle(RenderStyleName.GridChannel);
|
||||
}
|
||||
|
||||
// 门网格点使用50%透明度覆盖默认透明度
|
||||
@ -1201,45 +1201,45 @@ namespace NavisworksTransport
|
||||
#region 颜色管理
|
||||
|
||||
/// <summary>
|
||||
/// 根据颜色类型获取对应的渲染样式(颜色+透明度)
|
||||
/// 根据样式名称获取对应的渲染样式(颜色+透明度)
|
||||
/// </summary>
|
||||
/// <param name="colorType">颜色类型</param>
|
||||
/// <param name="styleName">样式名称</param>
|
||||
/// <returns>对应的渲染样式</returns>
|
||||
private RenderStyle GetRenderStyle(RenderColorType colorType)
|
||||
private RenderStyle GetRenderStyle(RenderStyleName styleName)
|
||||
{
|
||||
switch (colorType)
|
||||
switch (styleName)
|
||||
{
|
||||
case RenderColorType.StartPoint:
|
||||
case RenderStyleName.StartPoint:
|
||||
return new RenderStyle(Color.FromByteRGB(76, 175, 80), 0.9); // Material Green起点,10%透明
|
||||
|
||||
case RenderColorType.EndPoint:
|
||||
case RenderStyleName.EndPoint:
|
||||
return new RenderStyle(Color.FromByteRGB(244, 67, 54), 0.9); // Material Red终点,10%透明
|
||||
|
||||
case RenderColorType.WayPoint:
|
||||
case RenderStyleName.WayPoint:
|
||||
return new RenderStyle(Color.FromByteRGB(33, 150, 243), 0.9); // Material Blue路径点,10%透明
|
||||
|
||||
case RenderColorType.Line:
|
||||
case RenderStyleName.Line:
|
||||
return new RenderStyle(Color.FromByteRGB(255, 152, 0), 0.85); // Material Orange连线,15%透明
|
||||
|
||||
case RenderColorType.VehicleSpace:
|
||||
case RenderStyleName.VehicleSpace:
|
||||
return new RenderStyle(Color.FromByteRGB(158, 158, 158), 0.4); // Material Grey车辆空间,60%透明
|
||||
|
||||
case RenderColorType.PreviewPoint:
|
||||
case RenderStyleName.PreviewPoint:
|
||||
return new RenderStyle(Color.White, 0.7); // 白色预览点,30%透明
|
||||
|
||||
case RenderColorType.PreviewLine:
|
||||
case RenderStyleName.PreviewLine:
|
||||
return new RenderStyle(Color.FromByteRGB(128, 128, 128), 0.7); // 灰色预览连线,30%透明
|
||||
|
||||
case RenderColorType.UnreachedEndPoint:
|
||||
case RenderStyleName.UnreachedEndPoint:
|
||||
return new RenderStyle(Color.FromByteRGB(139, 0, 0), 0.7); // 深红色未到达终点,30%透明
|
||||
|
||||
case RenderColorType.GridChannel:
|
||||
case RenderStyleName.GridChannel:
|
||||
return new RenderStyle(Color.FromByteRGB(129, 199, 132), 0.8); // Material Light Green网格通道,20%透明
|
||||
|
||||
case RenderColorType.GridObstacle:
|
||||
case RenderStyleName.GridObstacle:
|
||||
return new RenderStyle(Color.FromByteRGB(117, 117, 117), 0.8); // Material Grey网格障碍物,20%透明
|
||||
|
||||
case RenderColorType.GridUnknown:
|
||||
case RenderStyleName.GridUnknown:
|
||||
return new RenderStyle(Color.FromByteRGB(255, 112, 67), 0.8); // Material Deep Orange网格未知区域,20%透明
|
||||
|
||||
default:
|
||||
@ -1247,16 +1247,6 @@ namespace NavisworksTransport
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据颜色类型获取对应的颜色(向后兼容方法)
|
||||
/// </summary>
|
||||
/// <param name="colorType">颜色类型</param>
|
||||
/// <returns>对应的颜色</returns>
|
||||
private Color GetRenderColor(RenderColorType colorType)
|
||||
{
|
||||
return GetRenderStyle(colorType).Color;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
@ -1447,7 +1437,7 @@ namespace NavisworksTransport
|
||||
double radius = GetRadiusForPointType(previewPoint.Type);
|
||||
|
||||
// 获取预览点样式(颜色+透明度)
|
||||
var previewStyle = GetRenderStyle(RenderColorType.PreviewPoint);
|
||||
var previewStyle = GetRenderStyle(RenderStyleName.PreviewPoint);
|
||||
|
||||
// 创建预览点标记
|
||||
_previewMarker = new CircleMarker
|
||||
@ -1527,7 +1517,7 @@ namespace NavisworksTransport
|
||||
{
|
||||
StartPoint = prevPoint.Position,
|
||||
EndPoint = previewPoint.Position,
|
||||
Color = GetRenderColor(RenderColorType.PreviewLine), // 预览连线颜色
|
||||
Color = GetRenderStyle(RenderStyleName.PreviewLine).Color, // 预览连线颜色
|
||||
Radius = GetLineRadius() // 使用与正常连线相同的直径
|
||||
};
|
||||
_previewLines.Add(line1);
|
||||
@ -1537,7 +1527,7 @@ namespace NavisworksTransport
|
||||
{
|
||||
StartPoint = previewPoint.Position,
|
||||
EndPoint = nextPoint.Position,
|
||||
Color = GetRenderColor(RenderColorType.PreviewLine), // 预览连线颜色
|
||||
Color = GetRenderStyle(RenderStyleName.PreviewLine).Color, // 预览连线颜色
|
||||
Radius = GetLineRadius()
|
||||
};
|
||||
_previewLines.Add(line2);
|
||||
@ -1629,7 +1619,7 @@ namespace NavisworksTransport
|
||||
{
|
||||
StartPoint = prevPoint.Position,
|
||||
EndPoint = previewPoint.Position,
|
||||
Color = GetRenderColor(RenderColorType.PreviewLine), // 预览连线颜色
|
||||
Color = GetRenderStyle(RenderStyleName.PreviewLine).Color, // 预览连线颜色
|
||||
Radius = GetLineRadius()
|
||||
};
|
||||
_previewLines.Add(line1);
|
||||
@ -1643,7 +1633,7 @@ namespace NavisworksTransport
|
||||
{
|
||||
StartPoint = previewPoint.Position,
|
||||
EndPoint = nextPoint.Position,
|
||||
Color = GetRenderColor(RenderColorType.PreviewLine), // 预览连线颜色
|
||||
Color = GetRenderStyle(RenderStyleName.PreviewLine).Color, // 预览连线颜色
|
||||
Radius = GetLineRadius()
|
||||
};
|
||||
_previewLines.Add(line2);
|
||||
@ -1738,12 +1728,12 @@ namespace NavisworksTransport
|
||||
switch (pointType)
|
||||
{
|
||||
case PathPointType.StartPoint:
|
||||
return GetRenderColor(RenderColorType.StartPoint); // 起点绿色
|
||||
return GetRenderStyle(RenderStyleName.StartPoint).Color; // 起点绿色
|
||||
case PathPointType.EndPoint:
|
||||
return GetRenderColor(RenderColorType.EndPoint); // 终点红色
|
||||
return GetRenderStyle(RenderStyleName.EndPoint).Color; // 终点红色
|
||||
case PathPointType.WayPoint:
|
||||
default:
|
||||
return GetRenderColor(RenderColorType.WayPoint); // 路径中间点洋红色
|
||||
return GetRenderStyle(RenderStyleName.WayPoint).Color; // 路径中间点蓝色
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -74,6 +74,15 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
private bool _isGridSizeManuallyEnabled = false; // 是否启用手动网格大小设置
|
||||
private double _gridSize; // 网格大小(米)
|
||||
|
||||
// 可视化参数
|
||||
private bool _showWalkableGrid = false;
|
||||
private bool _showObstacleGrid = false;
|
||||
private bool _showUnknownGrid = false;
|
||||
private bool _showDoorGrid = false;
|
||||
private GridPointType _gridPointType = GridPointType.Rectangle;
|
||||
private bool _isStandardLineMode = true;
|
||||
private bool _isVehicleSpaceMode = false;
|
||||
|
||||
// 路径策略参数
|
||||
private PathStrategyOption _selectedPathStrategy;
|
||||
private ObservableCollection<PathStrategyOption> _pathStrategyOptions;
|
||||
@ -361,6 +370,155 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
#region 可视化参数属性
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示可通行网格点
|
||||
/// </summary>
|
||||
public bool ShowWalkableGrid
|
||||
{
|
||||
get => _showWalkableGrid;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _showWalkableGrid, value))
|
||||
{
|
||||
OnGridVisualizationChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示障碍物网格点
|
||||
/// </summary>
|
||||
public bool ShowObstacleGrid
|
||||
{
|
||||
get => _showObstacleGrid;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _showObstacleGrid, value))
|
||||
{
|
||||
OnGridVisualizationChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示未知区域网格点
|
||||
/// </summary>
|
||||
public bool ShowUnknownGrid
|
||||
{
|
||||
get => _showUnknownGrid;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _showUnknownGrid, value))
|
||||
{
|
||||
OnGridVisualizationChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示门网格点
|
||||
/// </summary>
|
||||
public bool ShowDoorGrid
|
||||
{
|
||||
get => _showDoorGrid;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _showDoorGrid, value))
|
||||
{
|
||||
OnGridVisualizationChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 网格点类型
|
||||
/// </summary>
|
||||
public GridPointType GridPointType
|
||||
{
|
||||
get => _gridPointType;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _gridPointType, value))
|
||||
{
|
||||
OnPropertyChanged(nameof(IsRectanglePointType));
|
||||
OnPropertyChanged(nameof(IsCirclePointType));
|
||||
OnGridPointTypeChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否使用立方体点类型
|
||||
/// </summary>
|
||||
public bool IsRectanglePointType
|
||||
{
|
||||
get => _gridPointType == GridPointType.Rectangle;
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
GridPointType = GridPointType.Rectangle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否使用圆形点类型
|
||||
/// </summary>
|
||||
public bool IsCirclePointType
|
||||
{
|
||||
get => _gridPointType == GridPointType.Circle;
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
GridPointType = GridPointType.Circle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否使用标准连线模式
|
||||
/// </summary>
|
||||
public bool IsStandardLineMode
|
||||
{
|
||||
get => _isStandardLineMode;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _isStandardLineMode, value))
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
IsVehicleSpaceMode = false;
|
||||
OnPathVisualizationModeChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否使用车辆通行空间模式
|
||||
/// </summary>
|
||||
public bool IsVehicleSpaceMode
|
||||
{
|
||||
get => _isVehicleSpaceMode;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _isVehicleSpaceMode, value))
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
IsStandardLineMode = false;
|
||||
OnPathVisualizationModeChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 路径策略选项集合
|
||||
/// </summary>
|
||||
@ -2134,6 +2292,96 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 网格可视化设置变更事件处理
|
||||
/// </summary>
|
||||
private void OnGridVisualizationChanged()
|
||||
{
|
||||
try
|
||||
{
|
||||
LogManager.Info($"网格可视化设置已更改: 通行={ShowWalkableGrid}, 障碍物={ShowObstacleGrid}, 未知={ShowUnknownGrid}, 门={ShowDoorGrid}");
|
||||
|
||||
// 通知路径规划管理器更新网格可视化
|
||||
if (_pathPlanningManager != null)
|
||||
{
|
||||
_pathPlanningManager.UpdateGridVisualizationSettings(
|
||||
showWalkable: ShowWalkableGrid,
|
||||
showObstacle: ShowObstacleGrid,
|
||||
showUnknown: ShowUnknownGrid,
|
||||
showDoor: ShowDoorGrid);
|
||||
|
||||
UpdateMainStatus("网格可视化设置已更新");
|
||||
}
|
||||
else
|
||||
{
|
||||
LogManager.Warning("无法获取路径规划管理器,网格可视化设置可能不会立即生效");
|
||||
UpdateMainStatus("网格可视化设置已保存");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogManager.Error($"应用网格可视化设置失败: {ex.Message}", ex);
|
||||
UpdateMainStatus("网格可视化设置应用失败");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 网格点类型变更事件处理
|
||||
/// </summary>
|
||||
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("网格点类型应用失败");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 路径可视化模式变更事件处理
|
||||
/// </summary>
|
||||
private void OnPathVisualizationModeChanged()
|
||||
{
|
||||
try
|
||||
{
|
||||
var renderPlugin = PathPointRenderPlugin.Instance;
|
||||
if (renderPlugin != null)
|
||||
{
|
||||
var mode = IsVehicleSpaceMode ? PathVisualizationMode.VehicleSpace : PathVisualizationMode.StandardLine;
|
||||
renderPlugin.VisualizationMode = mode;
|
||||
|
||||
LogManager.Info($"路径可视化模式已更改: {(IsVehicleSpaceMode ? "车辆通行空间" : "标准连线")}");
|
||||
UpdateMainStatus("路径可视化模式已更新");
|
||||
}
|
||||
else
|
||||
{
|
||||
LogManager.Warning("无法获取PathPointRenderPlugin实例");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogManager.Error($"应用路径可视化模式失败: {ex.Message}", ex);
|
||||
UpdateMainStatus("路径可视化模式更新失败");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清理自动路径相关的事件订阅
|
||||
/// </summary>
|
||||
|
||||
@ -19,19 +19,6 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
|
||||
private readonly UIStateManager _uiStateManager;
|
||||
|
||||
// 网格可视化开关字段
|
||||
private bool _showWalkableGrid = false;
|
||||
private bool _showObstacleGrid = false;
|
||||
private bool _showUnknownGrid = false;
|
||||
private bool _showDoorGrid = false;
|
||||
|
||||
// 网格点类型字段
|
||||
private GridPointType _gridPointType = GridPointType.Rectangle;
|
||||
|
||||
// 路径可视化模式字段
|
||||
private bool _isStandardLineMode = true;
|
||||
private bool _isVehicleSpaceMode = false;
|
||||
|
||||
// 日志管理字段
|
||||
private ObservableCollection<string> _logLevels;
|
||||
private string _selectedLogLevel = "Info";
|
||||
@ -48,152 +35,6 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
|
||||
#region 公共属性
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示可通行网格点
|
||||
/// </summary>
|
||||
public bool ShowWalkableGrid
|
||||
{
|
||||
get => _showWalkableGrid;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _showWalkableGrid, value))
|
||||
{
|
||||
OnGridVisualizationChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示障碍物网格点
|
||||
/// </summary>
|
||||
public bool ShowObstacleGrid
|
||||
{
|
||||
get => _showObstacleGrid;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _showObstacleGrid, value))
|
||||
{
|
||||
OnGridVisualizationChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示未知区域网格点
|
||||
/// </summary>
|
||||
public bool ShowUnknownGrid
|
||||
{
|
||||
get => _showUnknownGrid;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _showUnknownGrid, value))
|
||||
{
|
||||
OnGridVisualizationChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示门网格点
|
||||
/// </summary>
|
||||
public bool ShowDoorGrid
|
||||
{
|
||||
get => _showDoorGrid;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _showDoorGrid, value))
|
||||
{
|
||||
OnGridVisualizationChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 网格点类型
|
||||
/// </summary>
|
||||
public GridPointType GridPointType
|
||||
{
|
||||
get => _gridPointType;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _gridPointType, value))
|
||||
{
|
||||
// 通知相关的单选按钮属性更新
|
||||
OnPropertyChanged(nameof(IsRectanglePointType));
|
||||
OnPropertyChanged(nameof(IsCirclePointType));
|
||||
OnGridPointTypeChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否使用立方体点类型
|
||||
/// </summary>
|
||||
public bool IsRectanglePointType
|
||||
{
|
||||
get => _gridPointType == GridPointType.Rectangle;
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
GridPointType = GridPointType.Rectangle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否使用点状点类型
|
||||
/// </summary>
|
||||
public bool IsCirclePointType
|
||||
{
|
||||
get => _gridPointType == GridPointType.Circle;
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
GridPointType = GridPointType.Circle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否使用标准连线模式
|
||||
/// </summary>
|
||||
public bool IsStandardLineMode
|
||||
{
|
||||
get => _isStandardLineMode;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _isStandardLineMode, value))
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
IsVehicleSpaceMode = false;
|
||||
OnPathVisualizationModeChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否使用车辆通行空间模式
|
||||
/// </summary>
|
||||
public bool IsVehicleSpaceMode
|
||||
{
|
||||
get => _isVehicleSpaceMode;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _isVehicleSpaceMode, value))
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
IsStandardLineMode = false;
|
||||
OnPathVisualizationModeChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 日志级别集合
|
||||
/// </summary>
|
||||
@ -389,99 +230,6 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 网格可视化设置变更事件处理
|
||||
/// </summary>
|
||||
private void OnGridVisualizationChanged()
|
||||
{
|
||||
try
|
||||
{
|
||||
LogManager.Info($"网格可视化设置已更改: 通行={ShowWalkableGrid}, 障碍物={ShowObstacleGrid}, 未知={ShowUnknownGrid}, 门={ShowDoorGrid}");
|
||||
|
||||
// 通知路径规划管理器更新网格可视化
|
||||
var pathPlanningManager = GetPathPlanningManager();
|
||||
if (pathPlanningManager != null)
|
||||
{
|
||||
// 应用新的可视化设置
|
||||
pathPlanningManager.UpdateGridVisualizationSettings(
|
||||
showWalkable: ShowWalkableGrid,
|
||||
showObstacle: ShowObstacleGrid,
|
||||
showUnknown: ShowUnknownGrid,
|
||||
showDoor: ShowDoorGrid);
|
||||
|
||||
UpdateMainStatus("网格可视化设置已更新");
|
||||
}
|
||||
else
|
||||
{
|
||||
LogManager.Warning("无法获取路径规划管理器,网格可视化设置可能不会立即生效");
|
||||
UpdateMainStatus("网格可视化设置已保存");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogManager.Error($"应用网格可视化设置失败: {ex.Message}", ex);
|
||||
UpdateMainStatus("网格可视化设置应用失败");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 网格点类型变更事件处理
|
||||
/// </summary>
|
||||
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("网格点类型应用失败");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 路径可视化模式变更事件处理
|
||||
/// </summary>
|
||||
private void OnPathVisualizationModeChanged()
|
||||
{
|
||||
try
|
||||
{
|
||||
var renderPlugin = PathPointRenderPlugin.Instance;
|
||||
if (renderPlugin != null)
|
||||
{
|
||||
var mode = IsVehicleSpaceMode ? PathVisualizationMode.VehicleSpace : PathVisualizationMode.StandardLine;
|
||||
renderPlugin.VisualizationMode = mode;
|
||||
|
||||
LogManager.Info($"路径可视化模式已更改: {(IsVehicleSpaceMode ? "车辆通行空间" : "标准连线")}");
|
||||
UpdateMainStatus("路径可视化模式已更新");
|
||||
}
|
||||
else
|
||||
{
|
||||
LogManager.Warning("无法获取PathPointRenderPlugin实例");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogManager.Error($"应用路径可视化模式失败: {ex.Message}", ex);
|
||||
UpdateMainStatus("路径可视化模式更新失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取路径规划管理器实例
|
||||
/// </summary>
|
||||
@ -530,9 +278,6 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
var currentLevel = LogManager.GetLogLevel();
|
||||
SelectedLogLevel = currentLevel.ToString();
|
||||
|
||||
// 设置默认网格点类型
|
||||
GridPointType = GridPointType.Rectangle;
|
||||
|
||||
// 初始化系统信息
|
||||
PluginVersion = "v1.0";
|
||||
NavisworksVersion = "2026";
|
||||
|
||||
@ -364,14 +364,14 @@ NavisworksTransport 路径编辑页签视图 - 采用与动画控制和分层管
|
||||
<Border BorderBrush="#FFD4E7FF" BorderThickness="1" CornerRadius="0" Margin="0,0,0,15" Padding="12">
|
||||
<StackPanel>
|
||||
<Label Content="路径文件管理" Style="{StaticResource SectionHeaderStyle}"/>
|
||||
|
||||
|
||||
<!-- 文件操作按钮 -->
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,10">
|
||||
<Button Content="导入"
|
||||
Command="{Binding ImportPathCommand}"
|
||||
<Button Content="导入"
|
||||
Command="{Binding ImportPathCommand}"
|
||||
Style="{StaticResource SecondaryButtonStyle}"/>
|
||||
<Button Content="导出全部"
|
||||
Command="{Binding ExportPathCommand}"
|
||||
<Button Content="导出全部"
|
||||
Command="{Binding ExportPathCommand}"
|
||||
Style="{StaticResource SecondaryButtonStyle}"
|
||||
IsEnabled="{Binding CanExecuteExportPath}"/>
|
||||
<Button Content="导出选中路径"
|
||||
@ -383,15 +383,125 @@ NavisworksTransport 路径编辑页签视图 - 采用与动画控制和分层管
|
||||
Style="{StaticResource SecondaryButtonStyle}"
|
||||
IsEnabled="{Binding CanExecuteSaveAsPath}"/>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 区域5: 可视化设置 -->
|
||||
<Border BorderBrush="#FFD4E7FF" BorderThickness="1" CornerRadius="0" Margin="0,0,0,15" Padding="12">
|
||||
<StackPanel>
|
||||
<Label Content="可视化设置" Style="{StaticResource SectionHeaderStyle}"/>
|
||||
|
||||
<!-- 网格可视化开关 -->
|
||||
<Grid Margin="0,10,0,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Grid.Column="0"
|
||||
Content="网格可视化:"
|
||||
Style="{StaticResource ParameterLabelStyle}"
|
||||
Width="100"
|
||||
VerticalAlignment="Center"/>
|
||||
|
||||
<StackPanel Grid.Column="1"
|
||||
Orientation="Horizontal"
|
||||
VerticalAlignment="Center"
|
||||
Margin="5,0,0,0">
|
||||
<CheckBox Content="通行"
|
||||
IsChecked="{Binding ShowWalkableGrid}"
|
||||
Margin="0,0,20,0"
|
||||
VerticalAlignment="Center"
|
||||
ToolTip="显示可通行的网格点"/>
|
||||
<CheckBox Content="障碍物"
|
||||
IsChecked="{Binding ShowObstacleGrid}"
|
||||
Margin="0,0,20,0"
|
||||
VerticalAlignment="Center"
|
||||
ToolTip="显示障碍物网格点"/>
|
||||
<CheckBox Content="未知"
|
||||
IsChecked="{Binding ShowUnknownGrid}"
|
||||
Margin="0,0,20,0"
|
||||
VerticalAlignment="Center"
|
||||
ToolTip="显示未知区域网格点"/>
|
||||
<CheckBox Content="门"
|
||||
IsChecked="{Binding ShowDoorGrid}"
|
||||
VerticalAlignment="Center"
|
||||
ToolTip="显示门网格点(50%透明绿色)"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<!-- 路径可视化设置 -->
|
||||
<Grid Margin="0,10,0,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Grid.Column="0"
|
||||
Content="路径可视化:"
|
||||
Style="{StaticResource ParameterLabelStyle}"
|
||||
Width="100"
|
||||
VerticalAlignment="Center"/>
|
||||
|
||||
<StackPanel Grid.Column="1"
|
||||
Orientation="Vertical"
|
||||
Margin="5,0,0,0">
|
||||
<!-- 可视化模式选择 -->
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,5">
|
||||
<RadioButton Content="标准连线"
|
||||
GroupName="PathVisualizationMode"
|
||||
IsChecked="{Binding IsStandardLineMode}"
|
||||
Margin="0,0,20,0"
|
||||
VerticalAlignment="Center"
|
||||
ToolTip="显示标准圆柱形连线"/>
|
||||
<RadioButton Content="通行空间"
|
||||
GroupName="PathVisualizationMode"
|
||||
IsChecked="{Binding IsVehicleSpaceMode}"
|
||||
VerticalAlignment="Center"
|
||||
ToolTip="显示通行空间(矩形通道)"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<!-- 网格点类型设置 -->
|
||||
<Grid Margin="0,10,0,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Grid.Column="0"
|
||||
Content="网格点类型:"
|
||||
Style="{StaticResource ParameterLabelStyle}"
|
||||
Width="100"
|
||||
VerticalAlignment="Center"/>
|
||||
|
||||
<StackPanel Grid.Column="1"
|
||||
Orientation="Horizontal"
|
||||
VerticalAlignment="Center"
|
||||
Margin="5,0,0,0">
|
||||
<RadioButton Content="正方形"
|
||||
GroupName="GridPointType"
|
||||
IsChecked="{Binding IsRectanglePointType}"
|
||||
Margin="0,0,20,0"
|
||||
VerticalAlignment="Center"
|
||||
ToolTip="显示立方体网格点"/>
|
||||
<RadioButton Content="圆"
|
||||
GroupName="GridPointType"
|
||||
IsChecked="{Binding IsCirclePointType}"
|
||||
VerticalAlignment="Center"
|
||||
ToolTip="显示圆形网格点"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 区域5: 3D交互指南 -->
|
||||
<!-- 区域6: 3D交互指南 -->
|
||||
<Border BorderBrush="#FFD4E7FF" BorderThickness="1" CornerRadius="0" Margin="0,0,0,0" Padding="12">
|
||||
<StackPanel>
|
||||
<Label Content="3D交互操作指南" Style="{StaticResource SectionHeaderStyle}"/>
|
||||
|
||||
|
||||
<!-- 操作说明 -->
|
||||
<StackPanel Margin="0,5,0,0">
|
||||
<TextBlock Text="自动路径规划:"
|
||||
@ -403,7 +513,7 @@ NavisworksTransport 路径编辑页签视图 - 采用与动画控制和分层管
|
||||
<TextBlock Text="• 调整车辆尺寸和安全间隙参数后点击"自动规划路径""
|
||||
Style="{StaticResource StatusTextStyle}"
|
||||
Margin="10,2"/>
|
||||
|
||||
|
||||
<TextBlock Text="路径编辑:"
|
||||
FontWeight="SemiBold"
|
||||
Margin="0,8,0,2"/>
|
||||
|
||||
@ -77,115 +77,13 @@ NavisworksTransport 系统管理页签视图 - 采用与其他页签一致的Nav
|
||||
<Border BorderBrush="#FFD4E7FF" BorderThickness="1" CornerRadius="0" Margin="0,0,0,15" Padding="12">
|
||||
<StackPanel>
|
||||
<Label Content="插件设置" Style="{StaticResource SectionHeaderStyle}"/>
|
||||
|
||||
|
||||
<!-- 设置操作按钮 -->
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,10">
|
||||
<Button Content="参数设置"
|
||||
Command="{Binding OpenSettingsCommand}"
|
||||
Style="{StaticResource ActionButtonStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- 网格可视化开关 -->
|
||||
<Grid Margin="0,10,0,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Grid.Column="0"
|
||||
Content="网格可视化:"
|
||||
Style="{StaticResource ParameterLabelStyle}"
|
||||
Width="100"
|
||||
VerticalAlignment="Center"/>
|
||||
|
||||
<StackPanel Grid.Column="1"
|
||||
Orientation="Horizontal"
|
||||
VerticalAlignment="Center"
|
||||
Margin="5,0,0,0">
|
||||
<CheckBox Content="通行"
|
||||
IsChecked="{Binding ShowWalkableGrid}"
|
||||
Margin="0,0,20,0"
|
||||
VerticalAlignment="Center"
|
||||
ToolTip="显示可通行的网格点"/>
|
||||
<CheckBox Content="障碍物"
|
||||
IsChecked="{Binding ShowObstacleGrid}"
|
||||
Margin="0,0,20,0"
|
||||
VerticalAlignment="Center"
|
||||
ToolTip="显示障碍物网格点"/>
|
||||
<CheckBox Content="未知"
|
||||
IsChecked="{Binding ShowUnknownGrid}"
|
||||
Margin="0,0,20,0"
|
||||
VerticalAlignment="Center"
|
||||
ToolTip="显示未知区域网格点"/>
|
||||
<CheckBox Content="门"
|
||||
IsChecked="{Binding ShowDoorGrid}"
|
||||
VerticalAlignment="Center"
|
||||
ToolTip="显示门网格点(50%透明绿色)"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<!-- 路径可视化设置 -->
|
||||
<Grid Margin="0,10,0,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Grid.Column="0"
|
||||
Content="路径可视化:"
|
||||
Style="{StaticResource ParameterLabelStyle}"
|
||||
Width="100"
|
||||
VerticalAlignment="Center"/>
|
||||
|
||||
<StackPanel Grid.Column="1"
|
||||
Orientation="Vertical"
|
||||
Margin="5,0,0,0">
|
||||
<!-- 可视化模式选择 -->
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,5">
|
||||
<RadioButton Content="标准连线"
|
||||
GroupName="PathVisualizationMode"
|
||||
IsChecked="{Binding IsStandardLineMode}"
|
||||
Margin="0,0,20,0"
|
||||
VerticalAlignment="Center"
|
||||
ToolTip="显示标准圆柱形连线"/>
|
||||
<RadioButton Content="通行空间"
|
||||
GroupName="PathVisualizationMode"
|
||||
IsChecked="{Binding IsVehicleSpaceMode}"
|
||||
VerticalAlignment="Center"
|
||||
ToolTip="显示通行空间(矩形通道)"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<!-- 网格点类型设置 -->
|
||||
<Grid Margin="0,10,0,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Grid.Column="0"
|
||||
Content="网格点类型:"
|
||||
Style="{StaticResource ParameterLabelStyle}"
|
||||
Width="100"
|
||||
VerticalAlignment="Center"/>
|
||||
|
||||
<StackPanel Grid.Column="1"
|
||||
Orientation="Horizontal"
|
||||
VerticalAlignment="Center"
|
||||
Margin="5,0,0,0">
|
||||
<RadioButton Content="正方形"
|
||||
GroupName="GridPointType"
|
||||
IsChecked="{Binding IsRectanglePointType}"
|
||||
Margin="0,0,20,0"
|
||||
VerticalAlignment="Center"
|
||||
ToolTip="显示立方体网格点"/>
|
||||
<RadioButton Content="圆"
|
||||
GroupName="GridPointType"
|
||||
IsChecked="{Binding IsCirclePointType}"
|
||||
VerticalAlignment="Center"
|
||||
ToolTip="显示圆形网格点"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user