feat(junction): add reference geometry comparison layer

This commit is contained in:
que01 committed 2026-09-07 16:45:37 +08:00
1 parent 4519cad562
commit 92ab2edd96
11 files changed
+107 -5

No files matched your search

+19 -4
View File
@@ -67,6 +67,7 @@ import {
const layerLabels: Array<[LayerName, string]> = [
['osm', '方向道路参考线'],
['reference', '参考几何叠加'],
['native', '自研道路与路口面'],
['sidewalks', '路缘与步行带'],
['lanes', '车道与转向路径'],
@@ -78,10 +79,9 @@ const layerLabels: Array<[LayerName, string]> = [
['signals', '红绿灯设施'],
['junctionHotspots', '路口编辑热区'],
];
const defaultLayers = Object.fromEntries(layerLabels.map(([key]) => [key, key !== 'edgeLines'])) as Record<
LayerName,
boolean
>;
const defaultLayers = Object.fromEntries(
layerLabels.map(([key]) => [key, key !== 'edgeLines' && key !== 'reference']),
) as Record<LayerName, boolean>;
const direction = (road: Road) => (road.direction === 'forward' ? '沿 OSM 方向' : '逆 OSM 方向');
const label = (road: Road) => road.tags.name || `${road.highway}(OSM ${road.osmWayIds.join(', ')})`;
const laneIndex = (id: string) => Number(id.split(':').at(-1));
@@ -89,6 +89,7 @@ function App() {
const [state, setState] = useState<WorkbenchState>();
const [selected, setSelected] = useState<Road | null>(null);
const [layers, setLayers] = useState(defaultLayers);
const [referenceOpacity, setReferenceOpacity] = useState(0.55);
const [scene, setScene] = useState(false);
const [junctionHotspots, setJunctionHotspots] = useState(true);
const [status, setStatus] = useState('正在加载工作台...');
@@ -1003,6 +1004,19 @@ function App() {
</label>
);
})}
{state.junctionReference ? (
<label>
参考透明度
<input
type="range"
min="0.1"
max="1"
step="0.05"
value={referenceOpacity}
onChange={(event) => setReferenceOpacity(Number(event.target.value))}
/>
</label>
) : null}
<hr />
<hr />
<details className="issues-details">
@@ -1051,6 +1065,7 @@ function App() {
scene={scene}
junctionHotspots={junctionHotspots}
junctionNodeMarkers={junctionNodeMarkers}
referenceOpacity={referenceOpacity}
onJunctionHotspot={(ref: JunctionRef, _coordinate, descriptor) => {
openJunction(ref);
const approachRoad = descriptor.approachRoadIds