Files
road-compiler/.trellis/tasks/08-26-direct-manipulation-road-editor/research/current-system.md
que01 93f09e399e chore(road-editor): plan direct-edit task tree and add client test infra
Planning: parent design.md becomes the single authoritative contract
(constraint model with 6 kinds, handle manifest, coordinate/unit
layering, preview sequencing, storage layout and lazy migration, area
config snapshot, API contract). Work is split into four independently
verifiable child tasks with per-step gates and rollback points.

Test infra: pin vitest 4.1.11, add test:client:unit for client pure
logic, extend prettier globs to root *.ts so vitest.config.ts is checked.

Add .gitignore: the repo had none, so inputs/, outputs/, workbench-data/
and the client build output were untracked rather than ignored.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-26 17:33:42 +08:00

2.1 KiB

当前系统能力地图

编译链路

src/compile/compiler.js:16 读取 OSM 和 native-road-overrides.json,调用 compileRoadModel()compileGeometry(),写入 staging 目录后原子替换产物目录。生成 GeoJSON 因此是可丢弃、可重建的派生层。

src/compile/native-road.js:79 将 OSM way 按共享节点拆分为方向道路;每条道路有稳定的 road:way/<way>[:segment/<n>]:<direction> ID、segmentId、OSM 节点端点和中心线。道路面/步行带/车道线/中心线/路口/连接线均由这个模型计算。

可直接复用

现有能力 直接操纵中的职责
道路、端点、车道与 segment ID 约束的语义锚点和 OSM 重导入后的匹配基础
native-road-overrides/v1 校验与 stale diagnostics 新 schema 的版本化校验、失效检测和编辑列表
applyRoadOverrides() 把可反推的拖拽收敛为既有 widthMeters、步行带等参数
compileGeometry() 约束生效后的权威重算边界
feature native_idroad_idsegment_idosm_node_id 渲染 feature 到语义编辑目标的回链
OpenLayers 单实例 + source registry 手柄、预览和选中态可作为独立 source/layer 增量更新,避免重建容器
暂存/保存/重新编译 API 命令历史与持久化操作的基础链路

当前缺口

  • 没有描述“一个渲染边界/顶点对应哪个语义控制点”的 handle manifest。
  • 现有 road override 只能整体宽度/车道数,不表达沿道路位置变化、边缘偏移、局部过渡或路口角部约束。
  • 没有操作日志、撤销/重做、预览求解器或冲突 rebase 状态。
  • 路口模板在 area 配置中,不在 overrides 文件;直接操纵要明确哪些路口细节可落到 area 模板、哪些可成为用户覆盖项。

约束

不要将道路面 polygon、标线 polygon 或任意 OpenLayers Feature 坐标作为主要持久化编辑内容。它们没有足够的拓扑语义,且在 OSM 拆段、路口重算或编译器升级后很难可靠重放。