feat(junction): classify complex junction shapes

This commit is contained in:
que01 committed 2026-09-07 10:52:12 +08:00
1 parent 38ea779d9b
commit a359f88edc
13 files changed
+440 -14

No files matched your search

@@ -88,6 +88,10 @@ export function JunctionWorkspace({
),
);
}, [descriptor, state?.debug?.junctionClusters]);
const shapeSummary = useMemo(
() => state?.debug?.junctionShapes?.find((shape) => shape.clusterId === descriptor.ref.id),
[descriptor.ref.id, state?.debug?.junctionShapes],
);
const candidate = useMemo(() => {
return candidateForJunction(state, descriptor);
}, [descriptor, state]);
@@ -192,6 +196,14 @@ export function JunctionWorkspace({
</header>
<div className="junction-workspace__body">
<dl>
{shapeSummary ? (
<>
<dt>路口形态</dt>
<dd>
{shapeSummary.label} · {shapeSummary.armCount} 条有效道路臂
</dd>
</>
) : null}
<dt>组成节点</dt>
<dd>{descriptor.nodeIds.length ? `${descriptor.nodeIds.length} 个路口节点` : '—'}</dd>
<dt>进口道路</dt>
+12 -1
View File
@@ -70,6 +70,13 @@ export interface JunctionClusterConfig {
nodeIds: string[];
coreRadiusMeters?: number;
}
export interface JunctionShapeSummary {
clusterId: string;
kind: string;
label: string;
armCount: number;
throughPairCount: number;
}
export interface Diagnostic {
id: string;
message: string;
@@ -94,5 +101,9 @@ export interface WorkbenchState {
comparison: Record<string, unknown>;
layers: Record<string, GeoJson | null>;
junctionReference?: { converted: GeoJson };
debug?: { junctionCandidates: JunctionCandidate[]; junctionClusters?: JunctionClusterConfig[] } | null;
debug?: {
junctionCandidates: JunctionCandidate[];
junctionClusters?: JunctionClusterConfig[];
junctionShapes?: JunctionShapeSummary[];
} | null;
}
+12
View File
@@ -245,6 +245,17 @@ function state(area, junctionReference = null, debug = false) {
};
const trafficRuntime = runtime(trafficSignals);
const compiled = readCompiled(area);
const junctionShapes = debug
? (readLayer(path.join(nativeDir, 'layers', 'road_surface.geojson')).features || [])
.filter((feature) => feature.properties?.kind === 'complex-core' && feature.properties?.cluster_id)
.map((feature) => ({
clusterId: String(feature.properties.cluster_id),
kind: String(feature.properties.shape_kind || 'unsupported'),
label: String(feature.properties.shape_label || '暂不支持的路口形态'),
armCount: Number(feature.properties.arm_count) || 0,
throughPairCount: Number(feature.properties.through_pair_count) || 0,
}))
: [];
return {
areaId: area.id,
activeRevisionId: revisionStore.active.activeRevisionId,
@@ -258,6 +269,7 @@ function state(area, junctionReference = null, debug = false) {
nodeIds: (cluster.nodeIds || []).map(String),
coreRadiusMeters: cluster.coreRadiusMeters,
})),
junctionShapes,
}
: null,
compiled,