Refactor area preview orchestration

This commit is contained in:
2026-08-04 12:55:20 +08:00
parent 0ce7d1ea5e
commit 396df5127c
16 changed files with 541 additions and 455 deletions

View File

@@ -488,6 +488,21 @@ File records use this shape:
所有权属于独立 `preview` manifest。否则单跑 `--stages preview` 会把 Cesium manifest
错误判 stale。
### Preview Assembly Boundary
`build-area.js` 是 stage orchestrator它检查 GLB / metadata、按既有顺序写 route、vehicle、
runtime 与 HTML并写 preview manifest。预览内容实现不得回流到这里
- `lib/vehicle-route.js`OSM XML -> route JSON object保持坐标、排序、lane offset 和
`generatedAt` 语义。
- `lib/vehicle-model.js`-> preview vehicle glTF object保持 mesh/material 名称和内嵌
buffer layout。
- `lib/area-preview.js`:复制 browser runtime、生成 HTML、HTML/script JSON 转义和
preview summary。
这是保持 standalone `--stages preview` 与 preview manifest ownership 不变的边界;这些模块
不能读取 area config、写 stage manifest 或启动外部进程。
`preview` manifest:
- `inputs.config`
@@ -549,6 +564,10 @@ Manifest files are written atomically via `*.tmp` then `renameSync`.
- `node --check scripts/build-area.js`
- `node --check scripts/diagnose-area.js`
- `node --check scripts/check-area.js`
- `node --check scripts/lib/vehicle-route.js`
- `node --check scripts/lib/vehicle-model.js`
- `node --check scripts/lib/area-preview.js`
- `npm run test:preview-assets`
- `npm run build:area -- --config config/areas/nantaizi-lake-innovation-valley.json --stages intermediates`
- `npm run build:area -- --config config/areas/nantaizi-lake-innovation-valley.json --stages blender`
- `npm run build:area -- --config config/areas/nantaizi-lake-innovation-valley.json --stages cesium`

View File

@@ -87,7 +87,7 @@ config/areas/<id>.json
| 文件 | 行数 | 职责 |
|---|---|---|
| `build-area.js` | 961 | 主入口:区域配置读取、阶段调度、Cesium 预览页、车辆巡航和 stage manifest 写入 |
| `build-area.js` | 约 530 | 主入口:区域配置读取、阶段调度、preview 文件写入和 stage manifest ownership |
| `diagnose-area.js` | 36 | 快速诊断入口:调用共享 area diagnostics 并打印完整报告 |
| `check-area.js` | 74 | 区域质量门入口:调用共享 area diagnostics输出 PASS/FAIL 并设置退出码 |
| `lib/area-diagnostics.js` | 776 | 共享区域诊断事实源OSM、产物、metadata、stage manifest、GLB digest 和质量门分类 |
@@ -96,6 +96,9 @@ config/areas/<id>.json
| `build-osm2streets-qgis.js` | 1468 | intermediatesosm2streets 解析、图层拆分、人行道转角合成、GeoPackage 与 QGIS 工程生成 |
| `reimport-gpkg.js` | 179 | reimportGeoPackage → GeoJSON 反向导出 |
| `lib/scene-layers.js` | 164 | 九个图层的单一事实源 + 四个派生函数 |
| `lib/vehicle-route.js` | 约 180 | 从 OSM 提取确定性预览巡航路线 |
| `lib/vehicle-model.js` | 约 150 | 生成内嵌 buffer 的预览车辆 glTF |
| `lib/area-preview.js` | 约 110 | 复制 preview runtime、生成 HTML 与转义配置注入 |
| `lib/cesium-preview.js` / `.css` | 672 / 230 | 预览页运行时,见 [../preview/](../preview/index.md) |
| `normalize-lane-arrows.py` | 182 | 合并 osm2streets 的三角网箭头(跑在 QGIS Python 里) |
| `parity.js` | 270 | 产物一致性校验驱动 |