fix: resolve EM overview marker and segment overlaps

This commit is contained in:
梁薄云
2026-08-09 19:43:47 +08:00
parent 2705487651
commit 444cc3af2a
4 changed files with 60 additions and 18 deletions
@@ -60,13 +60,15 @@ internal static class SampleSnapshotFactory
new VisualizationPose(2d + offset, 1d, 0d),
new[]
{
new VisualizationPolyline("active-segment", "活动方向段", "active-segment", VisualizationLineStyle.Solid,
Points((0d, 1d), (3d, 1d), (6d, 2d))),
new VisualizationPolyline("previous", "上一轮轨迹", "previous", VisualizationLineStyle.Dashed, Points((1d, 1d), (2.5d, 1d), (4d, 1.3d))),
new VisualizationPolyline("current", "当前轨迹", "current", VisualizationLineStyle.Solid, Points((2d + offset, 1d), (3.8d + offset, 1.2d), (5.8d + offset, 1.9d)))
},
new[]
{
new VisualizationMarker("vehicle", "vehicle", "车辆", new VisualizationPoint(2d + offset, 1d)),
new VisualizationMarker("plan-start", "plan-start", "计划起点", new VisualizationPoint(2d + offset, 1d)),
new VisualizationMarker("plan-start", "plan-start", "计划起点", new VisualizationPoint(0d, 1d)),
new VisualizationMarker("gear-switch-end", "gear-switch-end", "换向点 1 / s_end", new VisualizationPoint(6d, 2d))
},
CreateCharts(offset),
@@ -1,3 +1,4 @@
using System;
using System.Linq;
using TrajectoryPlanningVisualization;
@@ -65,6 +66,8 @@ internal static class WebAssetChecks
"vehicle marker no longer uses world-scale heavy strokes");
Verification.True(css.Contains(".marker-vehicle"), "vehicle marker semantic class");
Verification.True(css.Contains(".marker-plan-start"), "plan start marker semantic class");
Verification.True(css.Contains(".marker-plan-start { fill: none;"),
"plan start marker remains hollow when it overlaps the smoothed-path start");
Verification.True(css.Contains(".marker-gear-switch"), "gear-switch marker semantic class");
Verification.True(css.Contains(".marker-final-goal"), "final goal marker semantic class");
Verification.True(js.Contains("末点后无时间区间"), "jerk terminal explanation");
@@ -85,6 +88,29 @@ internal static class WebAssetChecks
"overview builds legend entries from current snapshot data");
Verification.True(js.Contains("legendChinese"),
"overview reuses exported Chinese polyline legends");
Verification.True(
js.Contains("smoothStartMarker.labelChinese || \"平滑路径起点\"") &&
js.Contains("planStartMarker.labelChinese || \"EM 规划起点\"") &&
js.Contains("vehicleMarker.labelChinese || \"当前车辆\"") &&
js.Contains("gearMarker.labelChinese || \"换向点 / s_end\"") &&
js.Contains("goalMarker.labelChinese || \"平滑路径终点\""),
"overview marker legends prefer the first matching marker label with canonical fallbacks");
Verification.True(js.Contains("const hasDynamicActiveSegment = dynamicLines.some("),
"overview detects whether the frame supplies a dynamic active segment");
Verification.True(js.Contains(
".filter(segment => !hasDynamicActiveSegment || segment.segmentIndex !== frame.activeSegmentIndex)"),
"overview omits the matching static segment when its dynamic active segment exists");
Verification.True(js.Contains("if (active)") &&
!js.Contains("if (active || directionSegments.length)"),
"overview legend activates the current direction segment from dynamic data only");
int renderWorldStart = js.IndexOf("function renderWorld()", StringComparison.Ordinal);
int renderDynamicLines = js.IndexOf("const dynamicLines = safeArray(frame.dynamicPolylines);",
renderWorldStart, StringComparison.Ordinal);
int renderStaticSegments = js.IndexOf("safeArray(snapshot.directionSegments)",
renderDynamicLines, StringComparison.Ordinal);
Verification.True(renderWorldStart >= 0 && renderDynamicLines > renderWorldStart &&
renderStaticSegments > renderDynamicLines,
"overview derives dynamic lines before rendering static direction segments");
Verification.True(js.Contains("atob"), "compact occupancy bitset is decoded in browser");
Verification.True(!html.Contains("http://") && !html.Contains("https://"), "page has no CDN URL");
}
@@ -100,6 +126,14 @@ internal static class WebAssetChecks
"smoke snapshot exposes the smoothed comparison path");
Verification.True(staticSnapshot.StaticMarkers.Any(marker => marker.Kind == "smooth-start"),
"smoke snapshot exposes the smoothed-path start marker");
Verification.Equal(1, dynamicSnapshot.DynamicPolylines.Count(line => line.Kind == "active-segment"),
"smoke snapshot has exactly one dynamic active segment");
VisualizationMarker smoothStart = staticSnapshot.StaticMarkers.Single(marker => marker.Kind == "smooth-start");
VisualizationMarker planStart = dynamicSnapshot.DynamicMarkers.Single(marker => marker.Kind == "plan-start");
Verification.NearlyEqual(smoothStart.Position.X, planStart.Position.X,
"smoke snapshot overlaps smoothed-path and plan-start x coordinates");
Verification.NearlyEqual(smoothStart.Position.Y, planStart.Position.Y,
"smoke snapshot overlaps smoothed-path and plan-start y coordinates");
Verification.Equal(2, staticSnapshot.DirectionSegments.Count, "smoke snapshot has two direction segments");
Verification.True(staticSnapshot.StaticMarkers.Any(marker => marker.Kind == "gear-switch"), "smoke snapshot has a gear marker");
Verification.True(staticSnapshot.ConfigurationGroups.Count > 0, "smoke snapshot has effective configuration");