feat(junction): list sourced islands
This commit is contained in:
1 parent
db904d3194
commit
f18dd0c0eb
3 files changed
+37
-2
No files matched your search
@@ -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}
|
||||
</button>
|
||||
|
||||
@@ -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',
|
||||
},
|
||||
]);
|
||||
});
|
||||
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user