From f18dd0c0ebbcd5d667fc3ba6c5db58d372143ac5 Mon Sep 17 00:00:00 2001 From: que01 Date: Wed, 9 Sep 2026 11:14:28 +0800 Subject: [PATCH] feat(junction): list sourced islands --- .../client/src/junction/JunctionWorkspace.tsx | 3 ++- .../client/src/junction/facilities.test.ts | 22 +++++++++++++++++++ workbench/client/src/junction/facilities.ts | 14 +++++++++++- 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/workbench/client/src/junction/JunctionWorkspace.tsx b/workbench/client/src/junction/JunctionWorkspace.tsx index 0f77793..deff923 100644 --- a/workbench/client/src/junction/JunctionWorkspace.tsx +++ b/workbench/client/src/junction/JunctionWorkspace.tsx @@ -44,7 +44,7 @@ interface Props { selectedFacility?: ElementSelection | null; onSelectFacility?: (facility: { id: string; - kind: 'crosswalk' | 'stop-line' | 'signal'; + kind: 'crosswalk' | 'stop-line' | 'signal' | 'island'; crossingKey?: string; }) => void; signalUids?: readonly string[]; @@ -441,6 +441,7 @@ export function JunctionWorkspace({ : undefined } onClick={() => onSelectFacility?.(facility)} + disabled={facility.kind === 'island'} > {facility.label} diff --git a/workbench/client/src/junction/facilities.test.ts b/workbench/client/src/junction/facilities.test.ts index 971749a..d09c5f2 100644 --- a/workbench/client/src/junction/facilities.test.ts +++ b/workbench/client/src/junction/facilities.test.ts @@ -109,3 +109,25 @@ it('preserves source versus inferred evidence for generated complex facilities', }, ]); }); + +it('lists sourced traffic islands as read-only facilities', () => { + const state = { + layers: { + nativeIntersectionSurface: { + type: 'FeatureCollection', + features: [ + feature({ native_id: 'osm-traffic-island:way-1', kind: 'island', facility_evidence: 'source-osm-region' }), + ], + }, + }, + trafficSignals: { assemblies: { type: 'FeatureCollection', features: [] } }, + } as unknown as WorkbenchState; + expect(junctionFacilities(state, [], [road])).toEqual([ + { + id: 'island:osm-traffic-island:way-1', + kind: 'island', + label: '导流岛 · 来源 · 来源 OSM', + evidence: 'source-osm-region', + }, + ]); +}); diff --git a/workbench/client/src/junction/facilities.ts b/workbench/client/src/junction/facilities.ts index 1ff62fe..de0d3e5 100644 --- a/workbench/client/src/junction/facilities.ts +++ b/workbench/client/src/junction/facilities.ts @@ -3,7 +3,7 @@ import { junctionRoadName } from './labels'; export interface JunctionFacility { id: string; - kind: 'crosswalk' | 'stop-line' | 'signal'; + kind: 'crosswalk' | 'stop-line' | 'signal' | 'island'; label: string; crossingKey?: string; evidence?: 'source-crossing-node' | 'inferred-road-envelope' | 'source-osm-region'; @@ -75,6 +75,18 @@ export function junctionFacilities( ...(evidence ? { evidence } : {}), }); } + for (const feature of state.layers.nativeIntersectionSurface?.features ?? []) { + if (text(feature.properties?.kind) !== 'island') continue; + const id = text(feature.properties?.native_id) ?? text(feature.properties?.object_key); + if (!id) continue; + const evidence = evidenceOf(feature); + result.set(`island:${id}`, { + id: `island:${id}`, + kind: 'island', + label: `导流岛${evidenceSuffix(evidence)} · 来源 OSM`, + ...(evidence ? { evidence } : {}), + }); + } for (const feature of state.trafficSignals.assemblies.features) { const nodeIdsForSignal = [text(feature.properties?.node_id), text(feature.properties?.control_id)].filter( (value): value is string => value !== null,