feat: make crosswalk size a constraint the geometry stage reads

Every zebra was six stripes at 3m by 0.45m on a 0.9m pitch, all literals. Depth
and stripe count are now a constraint, junction-crosswalk-size, and the loop
reads them.

The span across the road stays derived rather than stored: it is count times
pitch, and pitch is fixed because stripe and gap widths are standardised while
the road they cross is not. Widening a crossing means adding stripes, which is
what a real one does, and it is why the span quantises in 0.9m steps.

That also fixes a span pinned at 4.95m regardless of the street. Measured, every
crossing sat on a 6.50m carriageway and covered under four fifths of it. The
default now follows the segment width — both directions, since a crossing spans
the carriageway — giving eight stripes and 6.74m, reaching the kerb rather than
stopping short. Fixture baselines move for exactly two entries on the one area
with crossings; the area without them is untouched.

No handle is published yet. design.md requires proving compileGeometry() consumes
a parameter before any grip is drawn — the rule left over from profile.interval
shipping a handle that did nothing — so the grips come next, on a value already
known to work.

Adding the kind made the client's exhaustive scalar switch fail to compile, which
is the check working: size is a pair and has no dragged-scalar form, so that case
now says so and throws rather than writing half a value.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
que01andClaude Opus 5 committed 2026-08-31 17:10:45 +08:00
1 parent 84c82f3f09
commit f3924caa5c
10 files changed
+176 -13

No files matched your search

@@ -38,6 +38,7 @@ type RoadConstraintKind =
| 'junction-cutback'
| 'junction-corner-radius'
| 'junction-crosswalk-inset'
| 'junction-crosswalk-size'
| 'junction-stop-line-offset'
```
@@ -50,14 +51,21 @@ type RoadConstraintKind =
| `junction-cutback` | `junction-approach` | `{ cutbackMeters }` | 米 | JunctionTools |
| `junction-corner-radius` | `junction-corner` | `{ radiusMeters }` | 米 | JunctionTools |
| `junction-crosswalk-inset` | `junction-approach` | `{ insetMeters }` | 米,斑马线距路口边界的退让 | 主地图 / JunctionTools |
| `junction-crosswalk-size` | `junction-approach` | `{ depthMeters, stripeCount }` | 米 + 整数条带数 | 主地图 |
| `junction-stop-line-offset` | `junction-approach` | `{ offsetMeters }` | 米,停止线沿进口后退的距离 | 主地图 / JunctionTools |
前 6 个 kind 对应 PRD 首期范围(外缘、步行带、车道分隔 + 进口、cutback、角部)。
后 2 个于 2026-08-28 追加,是「更多元素可直接操纵」方向的第一类扩展:控制标线的**位置**
`junction-crosswalk-inset` 与 `junction-stop-line-offset` 于 2026-08-28 追加,是「更多元素可直接操纵」方向的第一类扩展:控制标线的**位置**
成为可编辑参数。它们不改变路口形状,只移动标线,因此不触发路口边界重算。
放置是否成立的判据(`STOP_LINE_MAX_APPROACH_DISTANCE_METERS` 等)不在此范围内。
`junction-crosswalk-size` 于 2026-08-31 追加,是第一个改变标线**自身尺寸**而非位置的 kind。
横跨道路的跨度不是存储值,而是 `stripeCount × pitch` 派生;pitch 固定 0.9m 不可编辑,
因为条带宽与间隙在现实中是标准化的,而它横跨的道路不是。加宽靠增加条带数,
所以跨度是**量化**的。同批修掉了「跨度恒为 4.95m,与路宽无关」的缺陷:
无约束时条带数由整段车行道宽度推导。
新增 kind 的前提:**几何阶段必须已经消费它**。本项目曾为 `profile.interval` 交付过
一个拖动无效果的手柄(见 `08-26-direct-edit-map-editor/research/interval-not-applied.md`),
所以扩展 kind 时先证明 `compileGeometry()` 读取该参数,再画任何手柄。