Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,10 @@ Direct2D 的虚线段长以描边宽度为单位、线帽是平的,这边也
对得上是**可以证明的**,改完跑一次 `bun run verify:ground`:它
拿 `Ground/<FIR>/airports/*.json` 加 `<FIR>.sct`、`<FIR>.ese`、`GRpluginStands.txt`
和 `Ground/NavData/naip.json` 跑一遍 `buildAirportFromSource`(有
`Ground/<FIR>/layers/<ICAO>.json` 的机场跑 `buildPrebuiltAirport`),和
`Sector/<FIR>/Plugins/GroundMap/ground.json` 里对应的机场逐字节比较,漂了就非零
退出。检查范围和结果以命令输出为准,不在文档中固定机场或图层数量。
`Ground/<FIR>/layers/<ICAO>.json` 的机场跑 `buildPrebuiltAirport`),
与扇区包中选定的 `ground.json` 逐字节比较。选目录的规则和 `merge.py` 一样:
`Plugins/CANGroundRender/` 存在就用它,否则用 `Plugins/GroundMap/`。选定目录内
缺少 `ground.json` 或产物不一致时以非零状态退出。检查范围和结果以命令输出为准。
两个参数的 `undefined` 和 `[]` 不是一回事:
`undefined` 是"没有扇区文件,跑道用 OSM 近似",`[]` 是"扇区文件在,但它没有这
个机场的跑道行"(ZL02、ZL03 那种只在站位表里的场,产物里本来就没有跑道层)。
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ can-api 再检查 `apps:manage`、当前开发者资格和应用所有权。
`merge.py` 把 `cos(36°)` 当纬度传给抽稀函数那个怪癖也抄了。改动那边而不改这边
的下场,是预览和管制员机器上装的那份对不上,而预览工具唯一不能犯的就是这个
错。`bun run verify:ground` 用源文件重建机场和 world 图层,与扇区包中的
`ground.json` 逐字节比较。检查范围和结果以命令输出为准。
`ground.json` 逐字节比较。优先使用已有的 `Plugins/CANGroundRender/`,否则使用
`Plugins/GroundMap/`。选定目录缺少 `ground.json` 时检查失败,不改读另一个目录。
检查范围和结果以命令输出为准。

## 部署

Expand Down
15 changes: 12 additions & 3 deletions scripts/verify-ground-port.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* 退出码非零就是漂了。差异会打印出第一处不同的位置 —— 通常是某个常量,或者
* merge.py 那边加了一层而这边没跟。
*/
import { readdirSync, readFileSync, existsSync } from "node:fs";
import { readdirSync, readFileSync, existsSync, statSync } from "node:fs";
import { join } from "node:path";
import { fileURLToPath } from "node:url";

Expand Down Expand Up @@ -81,11 +81,20 @@ let checked = 0;
let failed = 0;

for (const [fir, sctName] of Object.entries(FIRS)) {
const groundJson = join(SECTOR, fir, "Plugins/GroundMap/ground.json");
// Like Ground/tools/common.py:deploy_dir, select the directory, not the file.
const plugins = join(SECTOR, fir, "Plugins");
const preferred = join(plugins, "CANGroundRender");
const preferredStat = statSync(preferred, { throwIfNoEntry: false });
const deployDir = preferredStat?.isDirectory()
? preferred
: join(plugins, "GroundMap");
const groundJson = join(deployDir, "ground.json");
const airportsDir = join(GROUND, fir, "airports");
const layersDir = join(GROUND, fir, "layers");
if (!existsSync(groundJson)) {
console.log(`${fir}: 扇区包里没有 ground.json,跳过`);
checked++;
failed++;
console.log(`[x] ${fir}: 找不到 ${groundJson}`);
continue;
}
const truth = json(groundJson);
Expand Down
4 changes: 2 additions & 2 deletions src/components/GroundPreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
*
* 两条路进来,走的是同一个渲染器:
*
* - **合并产物** `Sector/<FIR>/Plugins/GroundMap/ground.json`:插件读什么就画
* 什么,一比一。
* - **合并产物** `ground.json`(扇区包的 `Plugins/CANGroundRender/` 或
* `Plugins/GroundMap/`):插件读什么就画什么,一比一。
* - **每机场源文件** `Ground/<FIR>/airports/<ICAO>.json`:先在浏览器里跑一遍
* `merge.py`(`lib/groundMap.ts`),再画。手工改完一个机场,拖进来就能看,
* 不用先合并再开 EuroScope。
Expand Down
4 changes: 2 additions & 2 deletions src/lib/groundMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* 这个站不碰 Ground 仓库,也不带任何地面数据:文件是使用者自己拖进来的,全部
* 在浏览器里解析。之所以要在这里重做一遍合并,是因为**手工编辑的是每机场文
* 件**(`Ground/<FIR>/airports/<ICAO>.json`),而插件读的是合并产物
* (`Sector/<FIR>/Plugins/GroundMap/ground.json`)—— 改一笔要跑一次 merge.py
* 再开 EuroScope 才看得见,这个来回是这个页面要消掉的东西。
* `ground.json`(扇区包的 `Plugins/CANGroundRender/` 或 `Plugins/GroundMap/`)。
* 改一笔要跑一次 merge.py 再开 EuroScope 才看得见,这个来回是这个页面要消掉的东西。
*
* **逐行照着 merge.py 抄,包括它的常量和它的怪癖**(见 `dp()` 在 world 图层上
* 的调用)。这里"更正确"一点,预览就和真正装到管制员机器上的那份对不上了 ——
Expand Down
Loading