Files
road-compiler/.trellis/tasks/08-26-direct-manipulation-road-editor/research/drawtonomy.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
Raw Blame History

Drawtonomy可验证的设计证据

本笔记仅基于本机 /Users/que01/Project/drawtonomy 的公开源码与文档。该 checkout 不包含编辑器 Canvas、指针事件、选择或历史实现不能据此断言它具体如何处理拖拽状态机。

公开事实

  • README.md 将其描述为 topology-aware lane、snap 与 point sharing连接会随编辑保持。
  • packages/drawtonomy-sdk/src/types.ts 定义 pointlinestringlanelane 用 leftBoundaryId / rightBoundaryId 引用边界,边界以 pointIds 引用点,next/prev 表示车道关系。
  • packages/drawtonomy-sdk/src/exporter/osmToShapes.ts 从 Lanelet2 导入时复用相同的点和 linestring对相邻道路保留共享边界与方向反转信息。
  • packages/drawtonomy-sdk/src/exporter/laneCenterline.ts 从左右边界按归一化弧长采样,导出中心线和宽度;中心线是派生数据。
  • docs/exporter.md 指出可重新编辑的 SVG 内嵌完整 snapshot导出器只从对象图读取数据。

可迁移原则

  1. 拥有关系而非复制关系:共享点/边界只保存一次,依赖对象通过 ID 引用。因此一个动作自然波及所有关联几何。
  2. 编辑源与展示/导出分离:编辑对象图是源,中心线、边界渲染、导出格式是派生物。
  3. 显式拓扑:车道连接不是靠距离猜测,而是用 next / prev 表示。
  4. 可重新打开的完整状态:持久化内容足以重新构建编辑场景,而不是一张结果图。

不应直接照搬

Drawtonomy 是从空白画布或 Lanelet2 形状开始编辑的创作工具;本项目以 OSM 为权威输入、编译器推导道路横断面和路口。若完全改为点/边界对象图,会失去现有 OSM 重导入、规则推导和可追溯性,且制造第二个不一致的地图源。

对本项目的结论

借鉴其“语义对象图 + 依赖重算 + 共享锚点”的原则,但将持久化内容定义为附着在 OSM 派生语义 ID 上的约束,而不是迁移到 Drawtonomy 的自由形状 snapshot。