将安全阶段的弧线段渲染为告警样式(红色)

This commit is contained in:
tian 2026-01-06 09:53:38 +08:00
parent 409b39ce78
commit 7fc62537d1

View File

@ -113,7 +113,12 @@ namespace NavisworksTransport
/// <summary>
/// 切点样式(深红色)
/// </summary>
TangentPoint
TangentPoint,
/// <summary>
/// 安全警告样式(红色)
/// </summary>
SafetyWarning
}
/// <summary>
@ -1090,18 +1095,32 @@ namespace NavisworksTransport
else if (edge.SegmentType == PathSegmentType.Arc && edge.Trajectory != null)
{
// 圆弧段检查Trajectory是否有效
// 检查是否发生安全截断
bool hasSafetyTruncation = edge.Trajectory.ActualRadius < edge.Trajectory.RequestedRadius;
// 如果发生安全截断,使用安全警告样式
Color arcLineColor = lineColor;
double arcLineOpacity = lineOpacity;
if (hasSafetyTruncation)
{
var warningStyle = GetRenderStyle(RenderStyleName.SafetyWarning);
arcLineColor = warningStyle.Color;
arcLineOpacity = warningStyle.Alpha;
}
var arcMarker = new LineMarker
{
StartPoint = edge.Trajectory.Ts,
EndPoint = edge.Trajectory.Te,
Color = lineColor,
Color = arcLineColor,
Radius = GetLineRadius(),
SegmentType = PathSegmentType.Arc,
Trajectory = edge.Trajectory,
SampledPoints = edge.SampledPoints,
Height = heightInModelUnits, // 根据模式设置高度
Width = widthInModelUnits, // 根据模式设置宽度
Opacity = lineOpacity // 根据模式设置透明度
Opacity = arcLineOpacity // 根据模式设置透明度
};
visualization.PathLineMarkers.Add(arcMarker);
@ -1349,6 +1368,9 @@ namespace NavisworksTransport
case RenderStyleName.TangentPoint:
return new RenderStyle(Color.FromByteRGB(244, 67, 54), 0.8); // Material Red切点20%透明
case RenderStyleName.SafetyWarning:
return new RenderStyle(Color.FromByteRGB(244, 67, 54), 0.85); // Material Red安全警告15%透明
default:
return new RenderStyle(Color.White, 1.0); // 默认白色,完全不透明
}