feat(workbench): stabilize junction tools workspace

This commit is contained in:
que01 committed 2026-09-04 09:46:19 +08:00
1 parent e6b822416d
commit f10a5da325
22 files changed
+1078 -53

No files matched your search

@@ -4,13 +4,13 @@
## 目标
用地图上的可识别路口区域作为入口,进入专用的局部 JunctionTools 工作区,在不破坏主地图编辑状态的前提下逐步承载路口几何、进口、控制设施和诊断编辑。远景参考 MATLAB RoadRunner 的路口局部编辑体验,但首期只建立可靠的识别、热区、进入/返回和单路口编辑基础,不追求一次实现完整路口建模。
用地图上的可识别路口区域作为入口,进入一个独立的 JunctionTools 路口编辑页面。页面专注展示单个路口及其完整局部上下文,在同一可视化画布和同一编辑会话中同时承载路口几何、已有设施、参数双向联动、预览和诊断。主地图只负责发现、导航和返回,不承载完整路口编辑体验。
## 当前产品设想
- 主地图识别普通路口和已配置的复杂路口 cluster,并以可点击热区表达,而不是依赖点击某一条道路或控制柄。
- 点击热区后进入独立 JunctionTools 编辑器,聚焦路口局部上下文;返回主地图时保留原地图视角、选中对象和未保存编辑。
- 编辑器逐步扩展为路口专用工作区:进口宽度、cutback、角部圆角、路口面、车道/connector、斑马线、停止线和诊断在同一 session 中协调。
- 编辑器首版即作为一体化路口工作区:进口宽度、cutback、角部圆角、路口面、车道/connector、斑马线、停止线、信号灯和诊断在同一 session 中协调;内部可以分区,但用户不需要跨页面切换。
- 所有编辑复用现有 direct-edit 文档、preview、revision、undo/redo 和导出契约,不建立第二套持久化几何。
## RoadRunner 对标拆解
@@ -27,8 +27,8 @@ RoadRunner 的路口能力不能简化成几个拖拽手柄。对本项目有价
## 分阶段方向
- 阶段 A:派生路口热区和识别状态(普通 node、已确认 cluster、候选 cluster),点击后进入/返回工作区。
- 阶段 B:单路口局部上下文和现有 `junction-approach-width`、`junction-cutback`、`junction-corner-radius` 编辑闭环。
- 阶段 C:车道/connector、斑马线、停止线、信号灯的联动编辑和冲突诊断。
- 阶段 B:独立单路口页面、局部上下文和现有三项几何参数编辑闭环。
- 阶段 C:在同一页面接入车道/connector、斑马线、停止线、信号灯的联动编辑和冲突诊断;这是实现顺序,不是拆开的产品功能。
- 阶段 D:cluster 多节点、多进口、多角部及更接近 RoadRunner 的拓扑创作能力。
阶段 A 不应把热区写成新的几何事实;它应由编译模型和 junction plan 派生,避免出现 UI 有路口而编译器不认的第二套数据。
@@ -91,6 +91,14 @@ RoadRunner 的路口能力不能简化成几个拖拽手柄。对本项目有价
## 验收标准
### 独立一体化页面方向(2026-09-03)
- [ ] `/junction/:type/:id` 是独立路口编辑页面,进入后自动聚焦单个路口;主地图只作为入口和返回目标。
- [ ] 页面画布持续展示路口几何与已有斑马线、停止线、信号灯,参数面板不得遮挡主要路口视图。
- [ ] 几何参数和已有设施调整在同一页面、同一 draft/preview/undo/apply/save/cancel 链路中完成。
- [ ] 表单与地图操作双向同步:表单修改反映到画布,地图拖拽回写参数;失败预览保留最后有效几何并显示诊断。
- [ ] 首版支持已有设施的移动或已有字段修改,不创建、删除或跨路口迁移设施;cluster 与 candidate 继续只读。
- [ ] 从路口面或诊断可进入工作区,并能带位置返回主地图。
- [ ] 三项能力各自可拖,首次拖拽即有 ghost,防抖后显示服务端权威几何。
- [ ] 预览包含全部受影响派生对象:道路面、路口面、步行带、车道中心线、connector/movement、停止线、斑马线、标线。
@@ -3,7 +3,7 @@
"name": "direct-edit-junction-tools",
"title": "最小 JunctionTools",
"description": "单一普通路口的进口宽度、cutback、单角部圆角与预览/应用/取消",
"status": "planning",
"status": "in_progress",
"dev_type": null,
"scope": null,
"package": null,
@@ -0,0 +1,154 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>JunctionTools UI Prototype</title>
<style>
:root {
color: #dfe9e5;
background: #101a18;
font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 1080px; }
button, input { font: inherit; }
button { cursor: pointer; }
.app { min-height: 100vh; display: grid; grid-template-rows: 64px 1fr 38px; }
.topbar { display: flex; align-items: center; gap: 22px; padding: 0 22px; background: #173b32; border-bottom: 1px solid #2d594d; }
.brand { letter-spacing: .14em; font-size: 12px; color: #95b5aa; text-transform: uppercase; }
.title { font-size: 18px; font-weight: 700; color: #f5fbf8; }
.crumb { color: #9eb9ae; font-size: 13px; }
.topbar-spacer { flex: 1; }
.top-action { border: 1px solid #6d988a; color: #e9f4ef; background: transparent; padding: 8px 12px; border-radius: 4px; }
.top-action.primary { background: #d3e9df; border-color: #d3e9df; color: #183a31; font-weight: 700; }
.workspace { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 360px; }
.canvas { position: relative; overflow: hidden; background: #d9dfda; }
.canvas-head { position: absolute; z-index: 2; left: 20px; top: 18px; display: flex; gap: 8px; }
.chip { border: 1px solid #b3c0ba; background: #eff4f0e8; color: #29483e; border-radius: 4px; padding: 7px 10px; font-size: 12px; box-shadow: 0 2px 8px #263b3222; }
.chip.active { border-color: #2f755d; background: #e0f1e8; color: #205a45; }
.map-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-label { font-size: 13px; fill: #345448; font-weight: 700; }
.map-note { position: absolute; left: 20px; bottom: 18px; padding: 9px 12px; color: #3c574d; background: #eef3efdf; border: 1px solid #b8c7bf; border-radius: 4px; font-size: 12px; }
.inspector { overflow: auto; padding: 20px 18px; background: #f7faf8; color: #20352d; border-left: 1px solid #cad9d1; }
.section { padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid #dbe6e0; }
.section:last-child { border-bottom: 0; }
.section-title { margin: 0 0 12px; font-size: 14px; color: #173b32; }
.section-subtitle { margin: -5px 0 12px; color: #71847b; font-size: 12px; }
.field { display: grid; grid-template-columns: 1fr 104px; gap: 10px; align-items: center; margin: 11px 0; }
.field label { font-size: 13px; }
.field small { display: block; color: #82938b; font-size: 11px; margin-top: 3px; }
.field input { width: 100%; border: 1px solid #aabdb3; border-radius: 3px; padding: 7px 8px; color: #173b32; background: white; text-align: right; }
.unit { position: relative; }
.unit span { position: absolute; right: 8px; top: 8px; color: #7c9187; font-size: 12px; pointer-events: none; }
.unit input { padding-right: 28px; }
.range { height: 4px; margin: 6px 0 0; border-radius: 10px; background: #c9d9d1; }
.range i { display: block; width: 57%; height: 100%; background: #3d8b6c; border-radius: 10px; }
.facility { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-top: 1px solid #e5ede8; font-size: 13px; }
.facility:first-of-type { border-top: 0; }
.facility strong { color: #245b47; }
.status { display: flex; align-items: center; gap: 8px; color: #2e7558; font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #3d9a6c; }
.diagnostic { padding: 9px 10px; background: #edf5f0; border-left: 3px solid #3d8b6c; color: #45665a; font-size: 12px; line-height: 1.5; }
.actions { display: flex; gap: 8px; }
.action { flex: 1; padding: 9px 8px; border: 1px solid #9bb2a7; border-radius: 3px; background: white; color: #245241; }
.action.main { background: #286b52; color: white; border-color: #286b52; }
.footer { display: flex; align-items: center; gap: 18px; padding: 0 20px; background: #18322b; color: #b7cdc3; font-size: 12px; }
.footer strong { color: #e1f1ea; }
.legend { margin-left: auto; display: flex; gap: 14px; }
.legend span::before { content: ''; display: inline-block; width: 9px; height: 9px; margin-right: 5px; border-radius: 50%; background: currentColor; }
.legend .geometry { color: #2f7e61; }
.legend .facility-dot { color: #b1783c; }
</style>
</head>
<body>
<div class="app">
<header class="topbar">
<span class="brand">JunctionTools</span>
<span class="title">路口节点 1140799919</span>
<span class="crumb">独立编辑页面 / 普通路口</span>
<span class="topbar-spacer"></span>
<button class="top-action">撤销</button>
<button class="top-action">重做</button>
<button class="top-action">返回主地图</button>
<button class="top-action primary">保存并重新生成</button>
</header>
<main class="workspace">
<section class="canvas" aria-label="路口可视化画布">
<div class="canvas-head">
<span class="chip active">路口几何</span>
<span class="chip">斑马线</span>
<span class="chip">停止线</span>
<span class="chip">信号灯</span>
</div>
<svg class="map-svg" viewBox="0 0 900 700" role="img" aria-label="单个路口及其设施预览">
<rect width="900" height="700" fill="#d9dfda" />
<path d="M0 285 H900 V415 H0 Z" fill="#7e8987" />
<path d="M385 0 H515 V700 H385 Z" fill="#7e8987" />
<path d="M0 280 H900 M0 420 H900 M380 0 V700 M520 0 V700" stroke="#d5dcda" stroke-width="3" />
<path d="M0 350 H900 M450 0 V700" stroke="#f4f5ed" stroke-width="2" stroke-dasharray="14 13" opacity=".7" />
<path d="M320 285 H580 V415 H320 Z" fill="#697673" stroke="#286b52" stroke-width="4" stroke-dasharray="9 7" />
<g fill="#f5f8ef">
<path d="M346 265 h75 v12 h-75z M346 423 h75 v12 h-75z" />
<path d="M479 265 h75 v12 h-75z M479 423 h75 v12 h-75z" />
<path d="M305 305 h12 v90 h-12z M573 305 h12 v90 h-12z" />
</g>
<g stroke="#e8eee9" stroke-width="9" opacity=".95">
<path d="M347 286 V330 M365 286 V330 M383 286 V330 M401 286 V330" />
<path d="M499 370 V414 M517 370 V414 M535 370 V414 M553 370 V414" />
</g>
<g fill="none" stroke="#b1783c" stroke-width="6"><path d="M330 275 H430" /><path d="M470 425 H570" /></g>
<g fill="#d4934b" stroke="#704c2b" stroke-width="2"><circle cx="300" cy="270" r="9" /><circle cx="600" cy="430" r="9" /><circle cx="565" cy="270" r="9" /></g>
<g fill="#2f7e61" stroke="#f2fff8" stroke-width="3"><circle cx="450" cy="285" r="11" /><circle cx="385" cy="350" r="11" /><circle cx="515" cy="350" r="11" /><circle cx="450" cy="415" r="11" /></g>
<g stroke="#2f7e61" stroke-width="2" fill="none"><path d="M450 285 L450 210" /><path d="M385 350 L300 350" /><path d="M515 350 L600 350" /><path d="M450 415 L450 490" /></g>
<g class="map-label"><text x="30" y="80">北进口</text><text x="680" y="80">东进口</text><text x="30" y="635">南进口</text><text x="680" y="635">西进口</text></g>
<g fill="#173b32"><text x="655" y="520" class="map-label">预览中 · 路口边界</text></g>
</svg>
<div class="map-note">拖动绿色控制点调整几何;橙色设施可单独移动或编辑</div>
</section>
<aside class="inspector" aria-label="路口配置与诊断">
<section class="section">
<h2 class="section-title">路口几何</h2>
<p class="section-subtitle">修改后立即在画布显示服务端预览</p>
<div class="field"><label>北进口宽度<small>合法范围 3.6–12.0 m</small></label><div class="unit"><input value="7.20" /><span>m</span></div></div>
<div class="range"><i></i></div>
<div class="field"><label>东进口 cutback<small>合法范围 1.0–18.0 m</small></label><div class="unit"><input value="5.40" /><span>m</span></div></div>
<div class="range"><i style="width: 32%"></i></div>
<div class="field"><label>北→东角部圆角<small>合法范围 1.0–12.0 m</small></label><div class="unit"><input value="4.00" /><span>m</span></div></div>
<div class="range"><i style="width: 40%"></i></div>
</section>
<section class="section">
<h2 class="section-title">已有设施</h2>
<p class="section-subtitle">选择画布中的设施可编辑其语义参数</p>
<div class="facility"><span>斑马线 · 北侧</span><strong>6 条带 · 退让 1.5 m</strong></div>
<div class="facility"><span>停止线 · 北侧</span><strong>偏移 2.7 m</strong></div>
<div class="facility"><span>信号灯组 · 3 组</span><strong>可移动 / 可旋转</strong></div>
</section>
<section class="section">
<h2 class="section-title">验证诊断</h2>
<div class="diagnostic">当前几何合法,进口截面连续,路口面无自交。所有预览对象均落在所属道路范围内。</div>
</section>
<section class="section">
<div class="status"><span class="dot"></span><strong>预览已同步</strong><span>preview #18 · 142 ms</span></div>
</section>
<div class="actions">
<button class="action">放弃草稿</button>
<button class="action main">应用到工作区</button>
</div>
</aside>
</main>
<footer class="footer">
<strong>草稿 · 3 项未应用</strong>
<span>路口面、斑马线、停止线将随本次预览同步更新</span>
<div class="legend"><span class="geometry">几何控制</span><span class="facility-dot">设施控制</span></div>
</footer>
</div>
</body>
</html>