diff --git a/.gitignore b/.gitignore index 935d258..e07eb96 100644 --- a/.gitignore +++ b/.gitignore @@ -68,3 +68,6 @@ courseware/ # 工具链临时备份 buildsh/cross/*.cmake.bak + +# Gradle 全局缓存(不是项目文件) +.gradle-home/ diff --git a/.workbuddy/memory/2026-11-21.md b/.workbuddy/memory/2026-11-21.md index 12becb9..b377035 100644 --- a/.workbuddy/memory/2026-11-21.md +++ b/.workbuddy/memory/2026-11-21.md @@ -328,3 +328,11 @@ mingw-w64 14.0.0_3 携带 GCC 16.2,与 Flutter 插件(flutter_inappwebview_w 2. 签到用 DateTime.UtcNow.Date → 东八区早上 8 点才算新一天,7 点前可同日签到两次 - 修:UserService 4 处 + UserPayload 1 处改 DateTime.Today(本地日历日);人品值/二选一跨天计数一并修 - 实测(本地 07:33 / UTC 07-21):last_sign_in=2026-11-22,重复签到被拒,人品值按本地日重置 + +## build-bot version 参数 + macOS 提速 + XHGit PR #40(11-22 08:00) +- 需求:`@build-bot build mac version=1.1.3` 编指定版本;mac 大小写不敏感;提速 Mac 编译 +- build-bot.yml:prepare 解析 `version=x.y.z`(grep -oiE,大小写不敏感)→ 覆盖 props 版本 → 透传给 build.sh/build.ps1;回帖和 Release notes 显示版本 +- 提速:两个工作流 mac job 都加 actions/cache(NuGet packages + CocoaPods Pods/Caches),runner 从 macos-latest 固定 macos-14 原生 arm64 +- 脚本层已有并行(Flutter ‖ dotnet publish)+ dt_tool 缓存 + _trash,未重复改 +- 提交 8b4cabb(分支 ci/buildbot-mac-speed),推 origin2 后经 Gitea API 创建 PR #40 → main(mergeable=true) +- PR 创建方式:git credential fill 拿账号密码 → curl -u basic auth POST /api/v1/repos/Morris/GC/pulls(token 方式 401,basic auth 201) diff --git a/Directory.Build.props b/C#/Directory.Build.props similarity index 90% rename from Directory.Build.props rename to C#/Directory.Build.props index 2cafea2..f81500c 100644 --- a/Directory.Build.props +++ b/C#/Directory.Build.props @@ -15,7 +15,7 @@ disable 8.2.2 11.3.9 1.1.2 diff --git a/Directory.Build.targets b/C#/Directory.Build.targets similarity index 100% rename from Directory.Build.targets rename to C#/Directory.Build.targets diff --git a/GC-BOOT/GC-BOOT.csproj b/C#/GC-BOOT/GC-BOOT.csproj similarity index 91% rename from GC-BOOT/GC-BOOT.csproj rename to C#/GC-BOOT/GC-BOOT.csproj index 29c3225..b48c453 100644 --- a/GC-BOOT/GC-BOOT.csproj +++ b/C#/GC-BOOT/GC-BOOT.csproj @@ -20,7 +20,6 @@ - diff --git a/GC-BOOT/Program.cs b/C#/GC-BOOT/Program.cs similarity index 62% rename from GC-BOOT/Program.cs rename to C#/GC-BOOT/Program.cs index 0a21454..2d43e26 100644 --- a/GC-BOOT/Program.cs +++ b/C#/GC-BOOT/Program.cs @@ -1,4 +1,6 @@ using System; +using Avalonia; +using Avalonia.WebView.Desktop; using GC.Services; using GC.Download; @@ -20,11 +22,13 @@ internal static class Program // 上次下载的启动器新版,到这次启动才应用 if (DownloadModuleHost.Factory.TryApplyPending(paths)) return; - // 界面只有 Flutter 一套(内置 Avalonia 界面已移除)。 - if (FlutterShell.TryRun(args)) return; - - // 找不到前端:给出明确提示后退出,不要静默启动一个没有界面的后端进程。 - FlutterShell.ReportMissingUi(); - Environment.Exit(1); + // 所有界面统一由 Avalonia 承载(主窗口 / 模型窗口 / 课件),不再依赖 Flutter。 + BuildAvaloniaApp().StartWithClassicDesktopLifetime(args); } + + public static AppBuilder BuildAvaloniaApp() + => AppBuilder.Configure() + .UsePlatformDetect() + .UseDesktopWebView() + .LogToTrace(); } diff --git a/GC-BOOT/app.manifest b/C#/GC-BOOT/app.manifest similarity index 100% rename from GC-BOOT/app.manifest rename to C#/GC-BOOT/app.manifest diff --git a/GC-DOWNLOAD/DirectoryRemote.cs b/C#/GC-DOWNLOAD/DirectoryRemote.cs similarity index 100% rename from GC-DOWNLOAD/DirectoryRemote.cs rename to C#/GC-DOWNLOAD/DirectoryRemote.cs diff --git a/GC-DOWNLOAD/DownloadCenter.cs b/C#/GC-DOWNLOAD/DownloadCenter.cs similarity index 100% rename from GC-DOWNLOAD/DownloadCenter.cs rename to C#/GC-DOWNLOAD/DownloadCenter.cs diff --git a/GC-DOWNLOAD/DownloadModuleFactory.cs b/C#/GC-DOWNLOAD/DownloadModuleFactory.cs similarity index 100% rename from GC-DOWNLOAD/DownloadModuleFactory.cs rename to C#/GC-DOWNLOAD/DownloadModuleFactory.cs diff --git a/GC-DOWNLOAD/GC-DOWNLOAD.csproj b/C#/GC-DOWNLOAD/GC-DOWNLOAD.csproj similarity index 100% rename from GC-DOWNLOAD/GC-DOWNLOAD.csproj rename to C#/GC-DOWNLOAD/GC-DOWNLOAD.csproj diff --git a/GC-DOWNLOAD/GitCodeReleaseRemote.cs b/C#/GC-DOWNLOAD/GitCodeReleaseRemote.cs similarity index 100% rename from GC-DOWNLOAD/GitCodeReleaseRemote.cs rename to C#/GC-DOWNLOAD/GitCodeReleaseRemote.cs diff --git a/GC-DOWNLOAD/GitCodeRemote.cs b/C#/GC-DOWNLOAD/GitCodeRemote.cs similarity index 100% rename from GC-DOWNLOAD/GitCodeRemote.cs rename to C#/GC-DOWNLOAD/GitCodeRemote.cs diff --git a/GC-DOWNLOAD/GiteaRemote.cs b/C#/GC-DOWNLOAD/GiteaRemote.cs similarity index 100% rename from GC-DOWNLOAD/GiteaRemote.cs rename to C#/GC-DOWNLOAD/GiteaRemote.cs diff --git a/GC-DOWNLOAD/LauncherArtifacts.cs b/C#/GC-DOWNLOAD/LauncherArtifacts.cs similarity index 100% rename from GC-DOWNLOAD/LauncherArtifacts.cs rename to C#/GC-DOWNLOAD/LauncherArtifacts.cs diff --git a/GC-DOWNLOAD/LauncherUpdater.cs b/C#/GC-DOWNLOAD/LauncherUpdater.cs similarity index 100% rename from GC-DOWNLOAD/LauncherUpdater.cs rename to C#/GC-DOWNLOAD/LauncherUpdater.cs diff --git a/GC-DOWNLOAD/ModelInstaller.cs b/C#/GC-DOWNLOAD/ModelInstaller.cs similarity index 100% rename from GC-DOWNLOAD/ModelInstaller.cs rename to C#/GC-DOWNLOAD/ModelInstaller.cs diff --git a/GC-DOWNLOAD/ModelSourceClient.cs b/C#/GC-DOWNLOAD/ModelSourceClient.cs similarity index 100% rename from GC-DOWNLOAD/ModelSourceClient.cs rename to C#/GC-DOWNLOAD/ModelSourceClient.cs diff --git a/GC-DOWNLOAD/ResumableDownloader.cs b/C#/GC-DOWNLOAD/ResumableDownloader.cs similarity index 100% rename from GC-DOWNLOAD/ResumableDownloader.cs rename to C#/GC-DOWNLOAD/ResumableDownloader.cs diff --git a/GC-DOWNLOAD/SavedogLauncher.cs b/C#/GC-DOWNLOAD/SavedogLauncher.cs similarity index 100% rename from GC-DOWNLOAD/SavedogLauncher.cs rename to C#/GC-DOWNLOAD/SavedogLauncher.cs diff --git a/GC-DOWNLOAD/SourceSelector.cs b/C#/GC-DOWNLOAD/SourceSelector.cs similarity index 100% rename from GC-DOWNLOAD/SourceSelector.cs rename to C#/GC-DOWNLOAD/SourceSelector.cs diff --git a/GC-DOWNLOAD/UpdateService.cs b/C#/GC-DOWNLOAD/UpdateService.cs similarity index 100% rename from GC-DOWNLOAD/UpdateService.cs rename to C#/GC-DOWNLOAD/UpdateService.cs diff --git a/GC-DOWNLOAD/ZipSafety.cs b/C#/GC-DOWNLOAD/ZipSafety.cs similarity index 100% rename from GC-DOWNLOAD/ZipSafety.cs rename to C#/GC-DOWNLOAD/ZipSafety.cs diff --git a/GC-DRAW/PlayerWindow.cs b/C#/GC-DRAW/PlayerWindow.cs similarity index 100% rename from GC-DRAW/PlayerWindow.cs rename to C#/GC-DRAW/PlayerWindow.cs diff --git a/GC-SAVEDOG/Applier.cs b/C#/GC-SAVEDOG/Applier.cs similarity index 99% rename from GC-SAVEDOG/Applier.cs rename to C#/GC-SAVEDOG/Applier.cs index 8f5e966..b850c08 100644 --- a/GC-SAVEDOG/Applier.cs +++ b/C#/GC-SAVEDOG/Applier.cs @@ -502,7 +502,7 @@ internal sealed class Applier /// /// 把 的内容替换进 。 /// - /// 发布包是「整目录」(启动器 + 后端运行时 + Flutter 前端资源),只搬一个 exe 会留下 + /// 发布包是「整目录」(启动器 + 后端运行时 + 课件资源),只搬一个 exe 会留下 /// 旧后端 / 旧界面,所以这里按目录整体替换: /// 1. 安装目录里「新版没有」的条目 → 移到 backup(旧版本残留,如上一版的旧文件名); /// 2. 与新版同名的条目 → 先移到 backup,再把新版放进来(覆盖正在被占用的文件会失败, diff --git a/GC-SAVEDOG/GC-SAVEDOG.csproj b/C#/GC-SAVEDOG/GC-SAVEDOG.csproj similarity index 100% rename from GC-SAVEDOG/GC-SAVEDOG.csproj rename to C#/GC-SAVEDOG/GC-SAVEDOG.csproj diff --git a/GC-SAVEDOG/Log.cs b/C#/GC-SAVEDOG/Log.cs similarity index 100% rename from GC-SAVEDOG/Log.cs rename to C#/GC-SAVEDOG/Log.cs diff --git a/GC-SAVEDOG/Program.cs b/C#/GC-SAVEDOG/Program.cs similarity index 100% rename from GC-SAVEDOG/Program.cs rename to C#/GC-SAVEDOG/Program.cs diff --git a/GC-SAVEDOG/SavedogJson.cs b/C#/GC-SAVEDOG/SavedogJson.cs similarity index 100% rename from GC-SAVEDOG/SavedogJson.cs rename to C#/GC-SAVEDOG/SavedogJson.cs diff --git a/C#/GC-SPEC.md b/C#/GC-SPEC.md new file mode 100644 index 0000000..7047e47 --- /dev/null +++ b/C#/GC-SPEC.md @@ -0,0 +1,200 @@ +# GC 多语言完整版统一规范 + +本文件定义 6 种语言重写版必须遵守的**结构**、**功能**、**模型算法**契约。 +源码仓库根目录的 `GC/`、`GC-DOWNLOAD/`、`GC-SAVEDOG/`、`model/` 保持不动。 + +## 1. 目录结构(6 语言一致) + +``` +GC-<语言>/ + README.md 说明 + 构建方式 + 与原仓库的对应关系 + build.sh 一键编译脚本,产出 gcctl 可执行文件 + src/ + core/ 启动器核心(路径/设置/哈希/JSON/版本/模型扫描/安全/日志) + models/ 5 个教学模型(与 model/ 下模型一一对应) + main. 统一 CLI 入口,单进程承载全部功能(禁止前后端分离) + gcctl 编译产物(可执行文件) +``` + +语言与扩展名:C++ → `.cpp`,Rust → `.rs`,Go → `.go`,Java → `.java`,Zig → `.zig`,C → `.c`。 + +## 2. 功能清单(6 语言一致) + +### 2.1 启动器核心 core + +| 功能 | 命令 | 行为契约 | +|---|---|---| +| 文件哈希 | `hash-file ` | SHA-256 小写十六进制 | +| 目录指纹 | `hash-dir ` | 相对路径 `/` 分隔,按 ordinal 升序,拼接 `\0\n` 后取 SHA-256;跳过隐藏文件、`bin/`、`obj/`、`*.user` | +| 规范化 JSON | `canonical ` | 对象键递归升序、无空白、UTF-8、非 ASCII 不转义、移除根级 `signature` | +| 版本规整 | `version-normalize ` | 去 `GCL-/GC-/release-/v/V` 前缀,只留开头数字与点 | +| 版本比较 | `version-compare ` | 输出 -1 / 0 / 1 | +| 路径布局 | `paths [root]` | 打印 `.GC/{bin,config,model,cache,update,safedog,logs}` 与 `config/settings.json` | +| 默认设置 | `settings-default` | 输出默认 `settings.json`(language=auto, theme=light, fps=120, mem=2048, source=xhmcl) | +| 模型扫描 | `model-scan ` | 扫描 `//.json`,按 id 排序,输出 `id\tversion\tname\tsize\tdir` | +| 安全路径 | `safezip-name ` | 拒绝绝对路径、`../`、盘符、UNC、空名,输出 OK/REJECT | +| 人类体积 | `human-size ` | B/KB/MB/GB,`1536 → 1.5 KB` | +| 自检 | `selftest` | 运行所有内置断言,全部 PASS 退出码 0 | + +### 2.2 教学模型 models(功能一致,下载可不一致) + +| 模型 | 对应原仓库 | 必须实现的功能(命令) | +|---|---|---| +| 比例尺 | `model/scale-calculator` | `model scale solve `(mode=real/map/scale)、`model scale human `、`model scale segment `、`model scale grade `、`model scale spectrum `、`model scale quiz `、`model scale check ` | +| 等高线 | `model/contour-map` | `model contour build [size]`(生成高度场)、`model contour sample `、`model contour levels `、`model contour extract `(Marching Squares 折线数)、`model contour classify `、`model contour color `、`model contour slope ` | +| 地球自转 | `model/earth-rotation` | `model rotation subsolar `(太阳直射纬度)、`model rotation date `、`model rotation angle ` | +| 地球公转 | `model/earth-revolution` | `model revolution subsolar `、`model revolution season `(最近节气)、`model revolution step
` | +| 地理 | `model/earth-geography` | `model geo zones`(五带边界)、`model geo declination `(五带判定)、`model geo latlon `(单位向量) | + +**模型算法必须与 C# 源码逐字等价**(见 SPEC 附录的公式)。 + +## 3. 一致性硬性要求 + +1. **结构一致**:6 个目录的 `src/core`、`src/models`、`main`、`build.sh` 一一对应。 +2. **功能一致**:所有 CLI 命令在 6 语言都实现;同一输入必须给出同一输出(允许浮点末位差异)。 +3. **禁止前后端分离**:单进程 CLI,无 HTTP 服务、无 Flutter 前端;模型功能直接链接进主程序。 +4. **下载可不一致**:`model download` 允许各语言用各自 HTTP 实现,不作为一致性校验项。 +5. **模型功能一致**:5 个模型的算法与输出在 6 语言完全一致。 + +## 4. 统一自检向量(必须全部 PASS) + +``` +hash-file("hello") = 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 +hash-dir(a.txt="hello") = ed54360a4d7244bfcde6dca611fd00dbfbdf508c47ad104b711f8429a6d2604d +version-normalize("GCL-v1.0.6-beta") = 1.0.6 +version-compare(v1.0.6, 1.0.7) = -1 +canonical({"b":1,"a":"中文"}) = {"a":"中文","b":1} +safezip-name("../x") = REJECT;safezip-name("a/b.txt") = OK +human-size(1536) = 1.5 KB +scale solve(real, 3, 0, 100000) → realCm = 300000 +scale human(300000) → 3 km +scale grade(100000) = large;grade(500000) = medium;grade(10000000) = small +contour levels(mountain) 含 100 的倍数;extract 返回折线数 > 0 +rotation subsolar(90, 23.5) = 23.5;subsolar(0, 23.5) = 0 +revolution season(90) = summerSolstice +geo declination(40) = northTemperate;declination(0) = tropics +``` + +## 5. 附录:模型核心公式(源自 C# 源码) + +### 比例尺 ScaleMath +- `Solve`: real = mapCm*N;map = realCm/N;scale N = realCm/mapCm +- `HumanReal(cm)`: <100 → cm;<100000 → 米(cm/100);否则公里(cm/100000) +- `PickSegment`: 在 `1/2/5×10^k (k=-3..9)` 里选 `|log10(cand)-log10(ideal)|` 最小,`ideal=targetPx*N/(100*pxPerCm)` +- `Grade`: N≤100000 large;≤1000000 medium;else small +- `SpectrumPosition`: clamp((log10(N)-3)/6, 0, 1) + +### 等高线 TerrainField / TerrainAnalyzer +- 山峰高度场:`h = 120 + Σ H_i*exp(-d²*1.15)`,d=((u-U)/RU,(v-V)/RV) +- 等高距:plain=5, hill=10, 其他=100 +- Marching Squares:角点 h00,h10,h11,h01 组成 4bit 索引,10 种情形连线段,再按端点连通性串折线 +- `Classify`: 先查 Tags 标注区,再按 slope>8.5=cliff、局部最大=peak、鞍部、横切曲率 <−0.55=ridge />0.55=valley +- `ColorForHeight`: 200m 一档,9 级固定 RGB + +### 地球 CelestialView +- `SubsolarLatitude(revolution) = asin(sin(tilt°)*sin(orbit°)) * 180/π`(tilt 默认 23.5) +- 角度推进:`spin = (spin + dt*speed*60) % 360`;`orbit = (orbit + dt*speed*12) % 360` +- `DateForAngle(deg)`: `2025-01-01 + (79 + deg/360*365.2422) 天` +- 节气:0°春分 / 90°夏至 / 180°秋分 / 270°冬至 +- `LatLonToUnit`: `(cosLat*sinLon, sinLat, cosLat*cosLon)` + +### 地理 GeoModels +- 五带:热带 |lat|<23.5、温带 23.5≤|lat|<66.5、寒带 |lat|≥66.5 + +--- + +## 6. GUI 层规范(追加,用户要求完整图形界面) + +所有 6 个语言版本必须提供**真原生图形界面**,单进程、不前后端分离。SDL2 统一图形层(用户选定)。 + +### 6.1 运行方式 + +``` +./gcctl # 无参数 = 启动 GUI 主窗口(替代原 CLI 的默认 help 行为) +./gcctl gui # 显式启动 GUI +./gcctl # 保留全部 CLI 命令(自检、批处理仍可用) +./gcctl selftest # 自检仍为纯命令行 +``` + +**注意**:为保持与已完成的 20 项 CLI 自检一致,`selftest` 不启动 GUI。GUI 有独立的 `gui-selftest`(可选)。 + +### 6.2 GUI 窗口结构(6 语言一致) + +单窗口、顶部标签页切换 5 个模型 + 启动器首页: + +``` +┌──────────────────────────────────────────────┐ +│ GC 天文教学模型 [首页][比例尺][等高线][自转][公转][地理] │ ← 标签栏 +├──────────────────────────────────────────────┤ +│ │ +│ 模型画布 / 内容区 │ ← 用 SDL2 绘制 +│ │ +├──────────────────────────────────────────────┤ +│ [◀][⏸/▶][▶] 速度:1x 状态栏 │ ← 控制栏(动画模型) +└──────────────────────────────────────────────┘ +``` + +### 6.3 五个模型的 GUI 交互(完整交互,与原仓库对等) + +| 标签 | 画面 | 交互 | 调用的 core/models 函数 | +|---|---|---|---| +| 首页 | 模型卡片列表 + 状态 | 点击卡片切换标签 | `ScanModels` | +| 比例尺 | 线段比例尺 + 数字/文字式 | 输入 mapCm/realCm/N,切换求解模式,实时重绘 | `ScaleSolve`, `PickSegment`, `Grade` | +| 等高线 | 高度场分层设色 + 等高线 | 切换 5 种地形/5 种地貌,鼠标悬停显示海拔与判读结果 | `TerrainField`, `ExtractContour`, `Classify` | +| 自转 | 地球球体 + 晨昏线 + 直射点 | 播放/暂停、拖动旋转、速度调节、显示赤纬 | `StepAngles`, `SubsolarLatitude` | +| 公转 | 轨道 + 四季标记 + 地球 | 播放/暂停、跳到节气、显示直射纬度 | `SubsolarLatitude`, `NearestSeason`, `DateForAngle` | +| 地理 | 经纬网 + 五带 | 鼠标悬停经纬度 → 高亮所属温度带 | `LatLonToUnit`, `Declination` | + +### 6.4 各语言的 SDL2 接入 + +SDL2 framework 已安装到 `~/Library/Frameworks/SDL2.framework`(用户目录,未写 Homebrew)。 + +| 语言 | 接入方式 | 编译参数 | +|---|---|---| +| C | 直接 include | `-F "$HOME/Library/Frameworks" -framework SDL2` | +| C++ | 直接 include | 同 C | +| Zig | `@cImport` | `-F ... -framework SDL2` | +| Rust | `sdl2` crate(link framework) | `SDL2_FRAMEWORK` 环境变量 + build.rs | +| Go | cgo 直接调 SDL2 C API | `#cgo CFLAGS: -F.../Frameworks` `#cgo LDFLAGS: -framework SDL2` | +| Java | Swing(JDK 标准库,SDL2 通过 JNI 可选) | 无需 SDL2,用 Swing 实现同等 GUI | + +Java 例外说明:Java 生态原生 GUI 是 Swing/AWT(JDK 自带、跨平台、零依赖),比 JNI 包 SDL2 更稳定,GUI 行为与 SDL2 版一致。 + +### 6.5 GUI 与 CLI 共享同一套模型算法 + +GUI 只负责绘制和交互,**所有计算调用 `src/models` 和 `src/core` 的同一函数**,保证 GUI 与 CLI 输出一致(例如 GUI 比例尺窗口显示的数值 == `gcctl model scale solve` 的输出)。禁止在 GUI 里另写一套算法。 + +### 6.6 动画 + +- 自转/公转用 SDL2 定时器(约 60 FPS)驱动 `StepAngles`,每帧重绘 +- 播放/暂停/速度按钮控制 `speed` 参数 +- 全局变量帧计数器显示在状态栏(便于自检) + +### 6.7 SDL2 关键编译配置(已验证,直接复用) + +SDL2 framework 已装到 `~/Library/Frameworks/SDL2.framework`,头文件软链已建:`~/.local/sdl2inc/SDL2 -> ~/Library/Frameworks/SDL2.framework/Headers`。 + +**已验证的 Go cgo 配置**(`sdl_probe` 通过,`SDL_Init(VIDEO)=0`): +```go +/* +#cgo CFLAGS: -I/Users/mmm/.local/sdl2inc +#cgo LDFLAGS: -F/Users/mmm/Library/Frameworks -framework SDL2 -Wl,-rpath,/Users/mmm/Library/Frameworks +#include +*/ +import "C" +``` + +要点: +1. framework 内部头用 `SDL2/xxx.h` 互相引用,所以 include 路径必须是 `~/.local/sdl2inc`(其下有 `SDL2/` 软链),不能用 `SDL2.framework/Headers` 直接作为 `-I`。 +2. 运行时必须加 `-Wl,-rpath,/Users/mmm/Library/Frameworks`,否则 dyld 报 `Library not loaded: @rpath/SDL2.framework`。 +3. C/C++/Zig 编译同样加 `-I/Users/mmm/.local/sdl2inc -F/Users/mmm/Library/Frameworks -framework SDL2 -Wl,-rpath,/Users/mmm/Library/Frameworks`。 +4. Rust `sdl2` crate 若走 framework,需设 `SDL2_FRAMEWORK=/Users/mmm/Library/Frameworks/SDL2.framework`,并保证 rpath。若 crate 链接困难,改用 `std::process::Command` 调用一个极简 C shim(但优先 crate)。 + +### 6.8 macOS 主线程要求(重要) + +macOS Cocoa 要求所有 UI 调用发生在主线程,否则崩溃: +`NSInternalInconsistencyException: nextEventMatchingMask should only be called from the Main Thread!` + +- **Go**:`RunGUI()` 开头必须 `runtime.LockOSThread()`(已验证) +- **C/C++/Zig/Rust/Java**:原生程序主线程天然是 UI 线程,无此问题 +- 冒烟测试:`./gcctl gui` 后台运行 3 秒后 kill,无异常输出即通过 diff --git a/GC-UI/CI.md b/C#/GC-UI/CI.md similarity index 100% rename from GC-UI/CI.md rename to C#/GC-UI/CI.md diff --git a/GC-UI/README.md b/C#/GC-UI/README.md similarity index 100% rename from GC-UI/README.md rename to C#/GC-UI/README.md diff --git a/GC-UI/backend/GC.UI.Server/ApiModels.cs b/C#/GC-UI/backend/GC.UI.Server/ApiModels.cs similarity index 97% rename from GC-UI/backend/GC.UI.Server/ApiModels.cs rename to C#/GC-UI/backend/GC.UI.Server/ApiModels.cs index 354c3e7..700fe0a 100644 --- a/GC-UI/backend/GC.UI.Server/ApiModels.cs +++ b/C#/GC-UI/backend/GC.UI.Server/ApiModels.cs @@ -4,7 +4,7 @@ namespace GC.UI.Server; // --------------------------------------------------------------------------- // 前后端之间的数据契约(HTTP + JSON,camelCase)。 -// 前端(Flutter)只认这些字段,不认 .NET 类型;后端换实现不影响前端。 +// HTTP 客户端只认这些字段,不认 .NET 类型;后端换实现不影响契约。 // --------------------------------------------------------------------------- public sealed record HealthDto( diff --git a/GC-UI/backend/GC.UI.Server/AvaloniaHost.cs b/C#/GC-UI/backend/GC.UI.Server/AvaloniaHost.cs similarity index 98% rename from GC-UI/backend/GC.UI.Server/AvaloniaHost.cs rename to C#/GC-UI/backend/GC.UI.Server/AvaloniaHost.cs index 3261aa5..00bb273 100644 --- a/GC-UI/backend/GC.UI.Server/AvaloniaHost.cs +++ b/C#/GC-UI/backend/GC.UI.Server/AvaloniaHost.cs @@ -16,9 +16,9 @@ namespace GC.UI.Server; /// 模型窗口宿主。 /// /// 为什么渲染这一层留在 .NET:模型 dll 通过 IModelRuntime.CreateView 返回的是 -/// Avalonia ,这是模型契约的一部分。把渲染栈换成 Flutter 等于换掉契约, +/// Avalonia ,这是模型契约的一部分。换掉渲染栈等于换掉契约, /// 所有已发布模型都会失效。所以前后端分离的切法是: -/// · 界面(首页 / 下载 / 设置 / 关于)→ Flutter 前端 +/// · 界面(首页 / 下载 / 设置 / 关于)→ Avalonia 主窗口 /// · 模型窗口(模型自带界面)→ 仍由 .NET 承载,前端只发一条「启动模型」的指令 /// /// 这里惰性启动一个没有主窗口的 Avalonia 桌面生命周期,之后所有模型窗口都在它的 UI 线程上创建。 diff --git a/GC-UI/backend/GC.UI.Server/BackendServer.cs b/C#/GC-UI/backend/GC.UI.Server/BackendServer.cs similarity index 99% rename from GC-UI/backend/GC.UI.Server/BackendServer.cs rename to C#/GC-UI/backend/GC.UI.Server/BackendServer.cs index 773414c..b6784ae 100644 --- a/GC-UI/backend/GC.UI.Server/BackendServer.cs +++ b/C#/GC-UI/backend/GC.UI.Server/BackendServer.cs @@ -36,7 +36,7 @@ public static class BackendServer /// 构建后端。返回的 尚未启动: /// 独立进程直接 Run(),启动器用 StartAsync() 之后继续拉起界面。 /// - /// 界面是 Flutter,但**模型窗口仍由 Avalonia 承载**(模型契约返回的是 Avalonia Control)。 + /// 主界面已是 Avalonia;本后端仅用于独立 HTTP 部署场景。 ///
public static WebApplication Start(string[] args, int port) => Start(args, port, out _); @@ -73,7 +73,7 @@ public static class BackendServer }); // 桌面端(Windows/macOS)走原生 HTTP,不需要 CORS; - // 这里放开本机回环来源,方便用 `flutter run -d chrome` 调试界面。 + // 这里放开本机回环来源,方便本地调试客户端。 builder.Services.AddCors(options => options.AddDefaultPolicy(policy => policy .SetIsOriginAllowed(origin => Uri.TryCreate(origin, UriKind.Absolute, out var uri) && @@ -415,7 +415,7 @@ app.MapGet("/api/health", () => Results.Ok(new HealthDto( return Results.File(package.PreviewPath, GuessImageContentType(package.PreviewPath)); }); - // 模型改为客户端内渲染(Flutter):这里只确认模型存在并把 id 交回去, + // 模型由客户端渲染:这里只确认模型存在并把 id 交回去, // 不再拉起 Avalonia 窗口。保留接口是为了老客户端不至于 404。 app.MapPost("/api/models/{id}/launch", async (string id) => { @@ -689,7 +689,7 @@ app.MapGet("/api/health", () => Results.Ok(new HealthDto( contributors, // 「关于」页展示的技术栈信息:源码语言与前端框架。 SourceLanguage: "C#", - Frontend: "Flutter")); + Frontend: "Avalonia")); }); // ---- 系统集成 ------------------------------------------------------------- diff --git a/GC-UI/backend/GC.UI.Server/GC.UI.Server.csproj b/C#/GC-UI/backend/GC.UI.Server/GC.UI.Server.csproj similarity index 84% rename from GC-UI/backend/GC.UI.Server/GC.UI.Server.csproj rename to C#/GC-UI/backend/GC.UI.Server/GC.UI.Server.csproj index a98e53e..27fe783 100644 --- a/GC-UI/backend/GC.UI.Server/GC.UI.Server.csproj +++ b/C#/GC-UI/backend/GC.UI.Server/GC.UI.Server.csproj @@ -3,9 +3,9 @@ diff --git a/GC-UI/backend/GC.UI.Server/Program.cs b/C#/GC-UI/backend/GC.UI.Server/Program.cs similarity index 70% rename from GC-UI/backend/GC.UI.Server/Program.cs rename to C#/GC-UI/backend/GC.UI.Server/Program.cs index 907f362..c99ee48 100644 --- a/GC-UI/backend/GC.UI.Server/Program.cs +++ b/C#/GC-UI/backend/GC.UI.Server/Program.cs @@ -4,5 +4,5 @@ using GC.UI.Server; // 启动器在进程内直接调用 BackendServer.Start,不会走到这里。 var app = BackendServer.StartFromCommandLine(args); -// 纯 HTTP 后端(模型渲染在 Flutter 客户端里),跑起来常驻即可。 +// 纯 HTTP 后端(供独立部署 / 外部客户端使用),跑起来常驻即可。 app.Run(); diff --git a/GC-UI/backend/GC.UI.Server/UserService.cs b/C#/GC-UI/backend/GC.UI.Server/UserService.cs similarity index 100% rename from GC-UI/backend/GC.UI.Server/UserService.cs rename to C#/GC-UI/backend/GC.UI.Server/UserService.cs diff --git a/GC.sln b/C#/GC.sln similarity index 100% rename from GC.sln rename to C#/GC.sln diff --git a/C#/GC/src/App.axaml b/C#/GC/src/App.axaml new file mode 100644 index 0000000..9f09ac6 --- /dev/null +++ b/C#/GC/src/App.axaml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + #2F6BFF + + + #EDF2FC + #DDE7F8 + #BAC9E6 + #9FB4DD + #111A2E + #111A2E + + #2F6BFF + #1F4FD0 + #183FA8 + + + + + + + diff --git a/C#/GC/src/App.axaml.cs b/C#/GC/src/App.axaml.cs new file mode 100644 index 0000000..58123dc --- /dev/null +++ b/C#/GC/src/App.axaml.cs @@ -0,0 +1,141 @@ +using System; +using System.Threading.Tasks; +using Avalonia; +using Avalonia.Controls; +using Avalonia.Controls.ApplicationLifetimes; +using Avalonia.Markup.Xaml; +using GC.Services; +using GC.ViewModels; +using GC.Views; + +namespace GC; + +public partial class App : Application +{ + public override void Initialize() => AvaloniaXamlLoader.Load(this); + + /// 初始化课件 WebView(macOS WKWebView / Windows WebView2 / Linux WebKitGTK)。 + public override void RegisterServices() + { + base.RegisterServices(); + AvaloniaWebView.AvaloniaWebViewBuilder.Initialize(default!); + } + + public override void OnFrameworkInitializationCompleted() + { + if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) + { + var services = AppServices.Create(); + + // 诊断模式:只验证模型程序集能否加载(发布包里也用它做冒烟测试) + if (Environment.GetEnvironmentVariable("EMS_SELFTEST") == "1") + { + var code = SelfTest(services); + Avalonia.Threading.Dispatcher.UIThread.Post( + () => desktop.Shutdown(code), Avalonia.Threading.DispatcherPriority.Background); + return; + } + + // 启动加速:先建空窗口并显示,再在首帧之后构造 ViewModel。 + // MainViewModel 会扫描模型、加载封面、读设置,同步做会让 + // 「双击到看见窗口」明显变慢;先出窗口,内容随后填充。 + var window = new MainWindow(); + window.Show(); + + // 健康标记:GC-SAVEDOG 正在等这个文件。主窗口能显示出来, + // 就说明「新版本确实能启动」,它据此决定保留新版还是回滚。 + StartupHealth.MarkHealthy(services.Paths.UpdateRoot, + LauncherRuntimeInfo.CurrentLauncherVersion); + + // 首帧之后再构造 ViewModel:Post 而非依赖 Opened, + // 因为 Opened 在某些情况下不触发(headless / 部分平台), + // 会导致 DataContext 一直是 null、主页面白屏。 + // 扫描模型 / 加载封面在后台线程做,UI 线程只负责赋值, + // 这样窗口能立刻响应,不会卡在白屏。 + MainViewModel vm = null!; + Task.Run(() => new MainViewModel(services)) + .ContinueWith(t => + { + vm = t.Result; + Avalonia.Threading.Dispatcher.UIThread.Post(() => + { + window.DataContext = vm; + WireMainViewModel(vm, window, services, desktop); + }, Avalonia.Threading.DispatcherPriority.Background); + }, System.Threading.Tasks.TaskScheduler.Default); + + // 应用图标不依赖 ViewModel,先设好让窗口一出现就有图标 + try + { + using var iconStream = Avalonia.Platform.AssetLoader.Open( + new Uri("avares://GC.Core/Assets/icon.png")); + window.Icon = new Avalonia.Controls.WindowIcon(iconStream); + } + catch { /* 图标缺失不影响启动 */ } + + desktop.MainWindow = window; + desktop.ShutdownMode = ShutdownMode.OnMainWindowClose; + } + + base.OnFrameworkInitializationCompleted(); + } + + /// + /// 主窗口显示后再接上 ViewModel:绑定对话框、启动后台更新检查。 + /// 拆出来是为了让窗口先出现,模型扫描不影响「双击到出窗口」。 + /// + private static void WireMainViewModel(MainViewModel vm, MainWindow window, + AppServices services, IClassicDesktopStyleApplicationLifetime desktop) + { + _ = desktop; + vm.ConfirmHandler = async message => + { + var dialog = new ConfirmWindow(message); + return await dialog.ShowDialog(window); + }; + + // 发现启动器新版本:弹窗询问,用户选「更新」才下载并安排替换 + vm.LauncherUpdateHandler = async newVersion => + { + var dialog = new ConfirmWindow( + title: "发现新版本", + message: $"启动器有新版本 v{newVersion},是否立即更新?\n\n" + + "更新会下载新版程序,下次启动时自动替换当前版本;" + + "选择取消则继续使用当前版本,但模型仍会更新到最新。", + confirmText: "更新", + cancelText: "取消"); + return await dialog.ShowDialog(window); + }; + + // 主窗口已显示,后台检查模型 / 启动器更新,不阻塞界面 + if (Environment.GetEnvironmentVariable("EMS_NO_UPDATE") != "1") + { + Avalonia.Threading.Dispatcher.UIThread.Post( + () => _ = vm.RunStartupUpdateAsync(), + Avalonia.Threading.DispatcherPriority.Background); + } + } + + /// 逐个加载模型,打印结果;返回退出码(0 = 全部成功)。 + private static int SelfTest(AppServices services) + { + var packages = services.Models.Scan(); + Console.WriteLine($"模型库: {services.Paths.ModelRoot}"); + Console.WriteLine($"模型数: {packages.Count}"); + var failed = 0; + foreach (var package in packages) + { + try + { + using var loaded = services.ModelHost.Load(package, () => { }); + Console.WriteLine($"OK {package.Id} -> {loaded.View.GetType().FullName}"); + } + catch (Exception ex) + { + failed++; + Console.WriteLine($"FAIL {package.Id}: {ex.Message}"); + } + } + return failed == 0 ? 0 : 1; + } +} diff --git a/GC/src/Assets/i18n/en.json b/C#/GC/src/Assets/i18n/en.json similarity index 99% rename from GC/src/Assets/i18n/en.json rename to C#/GC/src/Assets/i18n/en.json index e8ae8d9..a99b18b 100644 --- a/GC/src/Assets/i18n/en.json +++ b/C#/GC/src/Assets/i18n/en.json @@ -7,6 +7,7 @@ "nav.download": "Download", "nav.settings": "Settings", "nav.about": "About", + "nav.courseware": "Contour Course", "home.title": "Model library", "home.subtitle": "Pick a model and explain rotation, revolution and the seasons with an interactive 3D scene.", "home.launch": "Launch model", diff --git a/GC/src/Assets/i18n/zh-CN.json b/C#/GC/src/Assets/i18n/zh-CN.json similarity index 99% rename from GC/src/Assets/i18n/zh-CN.json rename to C#/GC/src/Assets/i18n/zh-CN.json index 0c3b1b3..b246a65 100644 --- a/GC/src/Assets/i18n/zh-CN.json +++ b/C#/GC/src/Assets/i18n/zh-CN.json @@ -7,6 +7,7 @@ "nav.download": "下载", "nav.settings": "设置", "nav.about": "关于", + "nav.courseware": "等高线课件", "home.title": "模型库", "home.subtitle": "选择模型,用可交互的三维演示讲清自转、公转与四季成因。", "home.launch": "启动模型", diff --git a/GC/src/Assets/icon-1024.png b/C#/GC/src/Assets/icon-1024.png similarity index 100% rename from GC/src/Assets/icon-1024.png rename to C#/GC/src/Assets/icon-1024.png diff --git a/GC/src/Assets/icon-128.png b/C#/GC/src/Assets/icon-128.png similarity index 100% rename from GC/src/Assets/icon-128.png rename to C#/GC/src/Assets/icon-128.png diff --git a/GC/src/Assets/icon-256.png b/C#/GC/src/Assets/icon-256.png similarity index 100% rename from GC/src/Assets/icon-256.png rename to C#/GC/src/Assets/icon-256.png diff --git a/GC/src/Assets/icon-32.png b/C#/GC/src/Assets/icon-32.png similarity index 100% rename from GC/src/Assets/icon-32.png rename to C#/GC/src/Assets/icon-32.png diff --git a/GC/src/Assets/icon-512.png b/C#/GC/src/Assets/icon-512.png similarity index 100% rename from GC/src/Assets/icon-512.png rename to C#/GC/src/Assets/icon-512.png diff --git a/GC/src/Assets/icon-64.png b/C#/GC/src/Assets/icon-64.png similarity index 100% rename from GC/src/Assets/icon-64.png rename to C#/GC/src/Assets/icon-64.png diff --git a/GC/src/Assets/icon.ico b/C#/GC/src/Assets/icon.ico similarity index 100% rename from GC/src/Assets/icon.ico rename to C#/GC/src/Assets/icon.ico diff --git a/GC/src/Assets/icon.png b/C#/GC/src/Assets/icon.png similarity index 100% rename from GC/src/Assets/icon.png rename to C#/GC/src/Assets/icon.png diff --git a/GC/src/GC.Core.csproj b/C#/GC/src/GC.Core.csproj similarity index 69% rename from GC/src/GC.Core.csproj rename to C#/GC/src/GC.Core.csproj index 8fd26b8..ffc17ed 100644 --- a/GC/src/GC.Core.csproj +++ b/C#/GC/src/GC.Core.csproj @@ -9,14 +9,13 @@ - + - + @@ -24,6 +23,8 @@ + + diff --git a/GC/src/Models/AppSettings.cs b/C#/GC/src/Models/AppSettings.cs similarity index 100% rename from GC/src/Models/AppSettings.cs rename to C#/GC/src/Models/AppSettings.cs diff --git a/GC/src/Models/ModelManifest.cs b/C#/GC/src/Models/ModelManifest.cs similarity index 100% rename from GC/src/Models/ModelManifest.cs rename to C#/GC/src/Models/ModelManifest.cs diff --git a/GC/src/Security/CanonicalJson.cs b/C#/GC/src/Security/CanonicalJson.cs similarity index 100% rename from GC/src/Security/CanonicalJson.cs rename to C#/GC/src/Security/CanonicalJson.cs diff --git a/GC/src/Security/ContentHash.cs b/C#/GC/src/Security/ContentHash.cs similarity index 100% rename from GC/src/Security/ContentHash.cs rename to C#/GC/src/Security/ContentHash.cs diff --git a/GC/src/Security/ManifestLoader.cs b/C#/GC/src/Security/ManifestLoader.cs similarity index 100% rename from GC/src/Security/ManifestLoader.cs rename to C#/GC/src/Security/ManifestLoader.cs diff --git a/GC/src/Security/ManifestSignature.cs b/C#/GC/src/Security/ManifestSignature.cs similarity index 100% rename from GC/src/Security/ManifestSignature.cs rename to C#/GC/src/Security/ManifestSignature.cs diff --git a/GC/src/Security/ModelIntegrity.cs b/C#/GC/src/Security/ModelIntegrity.cs similarity index 100% rename from GC/src/Security/ModelIntegrity.cs rename to C#/GC/src/Security/ModelIntegrity.cs diff --git a/GC/src/Security/SafeArchive.cs b/C#/GC/src/Security/SafeArchive.cs similarity index 100% rename from GC/src/Security/SafeArchive.cs rename to C#/GC/src/Security/SafeArchive.cs diff --git a/GC/src/Security/SavedogProtocol.cs b/C#/GC/src/Security/SavedogProtocol.cs similarity index 100% rename from GC/src/Security/SavedogProtocol.cs rename to C#/GC/src/Security/SavedogProtocol.cs diff --git a/GC/src/Security/SignatureKeyring.cs b/C#/GC/src/Security/SignatureKeyring.cs similarity index 100% rename from GC/src/Security/SignatureKeyring.cs rename to C#/GC/src/Security/SignatureKeyring.cs diff --git a/GC/src/Security/StartupHealth.cs b/C#/GC/src/Security/StartupHealth.cs similarity index 100% rename from GC/src/Security/StartupHealth.cs rename to C#/GC/src/Security/StartupHealth.cs diff --git a/GC/src/Services/AppPaths.cs b/C#/GC/src/Services/AppPaths.cs similarity index 100% rename from GC/src/Services/AppPaths.cs rename to C#/GC/src/Services/AppPaths.cs diff --git a/GC/src/Services/AppServices.cs b/C#/GC/src/Services/AppServices.cs similarity index 100% rename from GC/src/Services/AppServices.cs rename to C#/GC/src/Services/AppServices.cs diff --git a/GC/src/Services/ContributorsService.cs b/C#/GC/src/Services/ContributorsService.cs similarity index 100% rename from GC/src/Services/ContributorsService.cs rename to C#/GC/src/Services/ContributorsService.cs diff --git a/C#/GC/src/Services/CoursewareServer.cs b/C#/GC/src/Services/CoursewareServer.cs new file mode 100644 index 0000000..1a46cce --- /dev/null +++ b/C#/GC/src/Services/CoursewareServer.cs @@ -0,0 +1,158 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Net; +using System.Text; +using System.Threading.Tasks; + +namespace GC.Services; + +/// +/// 等高线课件本地静态服务器。 +/// +/// 课件是 HTML+CSS+JS+视频,直接用 file:// 加载会被 WebView 的同源策略拦住 +/// (视频 Range 请求、fetch 本地资源都会失败),所以起一个只监听回环地址的 +/// 微型 HTTP 服务器,端口自动分配,支持 Range 以便视频拖动。 +/// +/// 资源根目录优先取「可执行文件旁 courseware/」(发布布局), +/// 回退到用户目录下的 .GC/courseware/,开发时也能用。 +/// +public sealed class CoursewareServer : IDisposable +{ + private readonly HttpListener _listener = new(); + private readonly string _root; + private bool _disposed; + + public int Port { get; } + + public string BaseUrl => $"http://127.0.0.1:{Port}/"; + + public CoursewareServer() + { + _root = FindRoot() ?? throw new DirectoryNotFoundException("找不到课件目录 courseware/"); + + // 端口 0 = 系统自动分配,避免与用户程序或后端冲突 + Port = PickFreePort(); + _listener.Prefixes.Add($"http://127.0.0.1:{Port}/"); + _listener.Start(); + _ = Task.Run(ServeLoop); + } + + private static int PickFreePort() + { + var probe = new System.Net.Sockets.TcpListener(IPAddress.Loopback, 0); + probe.Start(); + var port = ((IPEndPoint)probe.LocalEndpoint).Port; + probe.Stop(); + return port; + } + + private static string? FindRoot() + { + var candidates = new List + { + Environment.GetEnvironmentVariable("GC_COURSEWARE_DIR") ?? "", + Path.Combine(AppContext.BaseDirectory, "courseware"), + Path.Combine(Directory.GetCurrentDirectory(), "courseware"), + }; + try + { + var home = AppPaths.Discover().HomeRoot; + candidates.Add(Path.Combine(home, "courseware")); + } + catch { /* 目录探测失败时只看前两个候选 */ } + + foreach (var dir in candidates) + if (File.Exists(Path.Combine(dir, "index.html"))) return dir; + return null; + } + + private async Task ServeLoop() + { + while (!_disposed) + { + HttpListenerContext ctx; + try { ctx = await _listener.GetContextAsync(); } + catch { break; } + + _ = Task.Run(() => Handle(ctx)); + } + } + + private void Handle(HttpListenerContext ctx) + { + try + { + var rel = Uri.UnescapeDataString(ctx.Request.Url!.AbsolutePath.TrimStart('/')); + if (string.IsNullOrEmpty(rel)) rel = "index.html"; + rel = rel.Replace('/', Path.DirectorySeparatorChar); + + // 规范化 + 越界检查:只允许读课件目录内的文件 + var full = Path.GetFullPath(Path.Combine(_root, rel)); + var rootFull = Path.GetFullPath(_root) + Path.DirectorySeparatorChar; + if (!full.StartsWith(rootFull, StringComparison.OrdinalIgnoreCase) || + !File.Exists(full)) + { + ctx.Response.StatusCode = 404; + ctx.Response.Close(); + return; + } + + var bytes = File.ReadAllBytes(full); + ctx.Response.ContentType = GuessMime(full); + ctx.Response.Headers.Add("Accept-Ranges", "bytes"); + + var range = ctx.Request.Headers["Range"]; + if (!string.IsNullOrEmpty(range) && + range.StartsWith("bytes=", StringComparison.OrdinalIgnoreCase) && + range.Contains('-')) + { + var parts = range[6..].Split('-', 2); + long start = 0; + long end = bytes.Length - 1; + if (!string.IsNullOrEmpty(parts[0])) long.TryParse(parts[0], out start); + if (parts.Length > 1 && !string.IsNullOrEmpty(parts[1])) long.TryParse(parts[1], out end); + if (start >= 0 && start <= end && start < bytes.Length) + { + if (end >= bytes.Length) end = bytes.Length - 1; + var len = (int)(end - start + 1); + ctx.Response.StatusCode = 206; + ctx.Response.Headers.Add("Content-Range", $"bytes {start}-{end}/{bytes.Length}"); + ctx.Response.ContentLength64 = len; + ctx.Response.OutputStream.Write(bytes, (int)start, len); + ctx.Response.Close(); + return; + } + } + + ctx.Response.ContentLength64 = bytes.Length; + ctx.Response.OutputStream.Write(bytes, 0, bytes.Length); + ctx.Response.Close(); + } + catch + { + try { ctx.Response.Close(); } catch { /* 客户端已断开 */ } + } + } + + private static string GuessMime(string path) => Path.GetExtension(path).ToLowerInvariant() switch + { + ".html" or ".htm" => "text/html; charset=utf-8", + ".css" => "text/css; charset=utf-8", + ".js" => "application/javascript; charset=utf-8", + ".json" => "application/json; charset=utf-8", + ".jpg" or ".jpeg" => "image/jpeg", + ".png" => "image/png", + ".webp" => "image/webp", + ".gif" => "image/gif", + ".mp4" => "video/mp4", + _ => "application/octet-stream" + }; + + public void Dispose() + { + if (_disposed) return; + _disposed = true; + try { _listener.Stop(); _listener.Close(); } catch { /* 已关闭 */ } + } +} diff --git a/GC/src/Services/DownloadContracts.cs b/C#/GC/src/Services/DownloadContracts.cs similarity index 92% rename from GC/src/Services/DownloadContracts.cs rename to C#/GC/src/Services/DownloadContracts.cs index 2ec995d..e970ad1 100644 --- a/GC/src/Services/DownloadContracts.cs +++ b/C#/GC/src/Services/DownloadContracts.cs @@ -156,10 +156,9 @@ public static class LauncherRuntimeInfo } /// -/// 界面(Flutter)与后端(GC.UI.Server)之间的约定:端口、环境变量名。 +/// HTTP 后端(GC.UI.Server)的端口与令牌约定,供独立部署 / 外部客户端使用。 /// -/// 之前这个端口在 GC-BOOT、后端、Flutter 前端各写了一遍 17890,改一处就断链; -/// 现在统一由这里定义,启动器选好端口后通过环境变量传给另外两边。 +/// 主界面已改为进程内 Avalonia,不经过 HTTP;这些常量仅用于可选的独立后端进程。 /// public static class GcUiContract { @@ -174,9 +173,9 @@ public static class GcUiContract public const string PortEnvVar = "GC_UI_PORT"; /// - /// 启动器为本次会话生成的一次性令牌,经环境变量同时传给进程内后端与 Flutter 前端。 - /// 前端每个请求都要带该令牌,后端据此确认对方是自己拉起的那个前端; - /// 同机伪装进程即便占了端口,也没有令牌,无法被前端当成后端复用。 + /// 独立后端进程的一次性令牌,经环境变量传给 HTTP 客户端。 + /// 客户端每个请求都要带该令牌,后端据此确认对方是自己拉起的; + /// 同机伪装进程即便占了端口,也没有令牌,无法被当成后端复用。 /// public const string TokenEnvVar = "GC_UI_TOKEN"; diff --git a/GC/src/Services/GcLog.cs b/C#/GC/src/Services/GcLog.cs similarity index 100% rename from GC/src/Services/GcLog.cs rename to C#/GC/src/Services/GcLog.cs diff --git a/GC/src/Services/Json.cs b/C#/GC/src/Services/Json.cs similarity index 100% rename from GC/src/Services/Json.cs rename to C#/GC/src/Services/Json.cs diff --git a/C#/GC/src/Services/LauncherUpdateFlow.cs b/C#/GC/src/Services/LauncherUpdateFlow.cs new file mode 100644 index 0000000..6b92e56 --- /dev/null +++ b/C#/GC/src/Services/LauncherUpdateFlow.cs @@ -0,0 +1,124 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Avalonia; +using Avalonia.Controls; +using Avalonia.Controls.ApplicationLifetimes; +using Avalonia.Threading; +using GC.Views; + +namespace GC.Services; + +/// +/// 启动器更新的完整交互流程(「检查更新」与「重新下载启动器」共用): +/// 1. 关闭主窗口与所有模型窗口; +/// 2. 弹出圆角进度窗; +/// 3. 下载最新版到当前目录(与旧版并列); +/// 4. 安排替换脚本、关进度窗、退出进程。 +/// 失败时恢复主窗口,继续使用当前版本。 +/// +public static class LauncherUpdateFlow +{ + private static bool _running; + public static bool IsRunning => _running; + + public static async Task RunAsync(AppServices services, string title) + { + if (_running) return; + _running = true; + + var desktop = Application.Current?.ApplicationLifetime + as IClassicDesktopStyleApplicationLifetime; + var mainWindow = desktop?.MainWindow; + var progressWindow = new UpdaterWindow(title); + + try + { + // 1. 关闭所有窗口 + if (desktop != null) desktop.MainWindow = null; + try { mainWindow?.Close(); } catch { } + foreach (var w in OpenWindows().ToList()) + { + try { w.Close(); } catch { } + } + + // 2. 进度窗 + progressWindow.Show(); + progressWindow.Report(0, "准备更新…"); + await Dispatcher.UIThread.InvokeAsync(() => { }, DispatcherPriority.Render); + + // 3. 下载 + var progress = new Progress(p => + progressWindow.Report(p.Value, p.Stage)); + + var result = await services.LauncherUpdates.DownloadAsync( + services.Paths, services.Updates.Remote, progress); + + if (result.State == UpdateRunState.Failed) + { + progressWindow.Report(0, "更新失败", result.Message); + await Task.Delay(2200); + _running = false; + progressWindow.Close(); + RestoreMainWindow(desktop, mainWindow); + return; + } + + progressWindow.Report(1, $"v{result.Version} 下载完成,正在重启…"); + + // 4. 安排替换(下次启动生效 / 脚本接管重启) + var scheduled = services.LauncherUpdates.ScheduleApply( + services.Paths, result.PackageName ?? ""); + + if (!scheduled) + { + progressWindow.Report(0, "无法安排更新", "请检查安装目录是否可写"); + await Task.Delay(2200); + _running = false; + progressWindow.Close(); + RestoreMainWindow(desktop, mainWindow); + return; + } + + await Task.Delay(400); + progressWindow.Close(); + desktop?.Shutdown(); + } + catch (Exception ex) + { + Console.Error.WriteLine($"更新流程异常: {ex}"); + _running = false; + try { progressWindow.Close(); } catch { } + RestoreMainWindow(desktop, mainWindow); + } + } + + private static void RestoreMainWindow( + IClassicDesktopStyleApplicationLifetime? desktop, Window? mainWindow) + { + if (desktop == null || mainWindow == null) return; + try + { + desktop.MainWindow = mainWindow; + mainWindow.Show(); + mainWindow.Activate(); + } + catch (Exception ex) + { + Console.Error.WriteLine($"恢复主窗口失败: {ex.Message}"); + } + } + + private static IEnumerable OpenWindows() + { + if (Application.Current?.ApplicationLifetime + is not IClassicDesktopStyleApplicationLifetime d) + yield break; + foreach (var w in d.Windows) + { + if (w is UpdaterWindow) continue; + yield return w; + } + } +} diff --git a/GC/src/Services/Localization.cs b/C#/GC/src/Services/Localization.cs similarity index 89% rename from GC/src/Services/Localization.cs rename to C#/GC/src/Services/Localization.cs index 2f932eb..86f7502 100644 --- a/GC/src/Services/Localization.cs +++ b/C#/GC/src/Services/Localization.cs @@ -4,6 +4,8 @@ using System.ComponentModel; using System.Globalization; using System.IO; using System.Text.Json; +using Avalonia.Data; +using Avalonia.Markup.Xaml; namespace GC.Services; @@ -72,7 +74,7 @@ public sealed class L : INotifyPropertyChanged { try { - // 界面已迁到 Flutter,这里不能再依赖 Avalonia 的 avares:// 资源加载 + // 多语言表以嵌入资源方式加载(不依赖 avares:// 的外部文件) var asm = typeof(L).Assembly; using var stream = asm.GetManifestResourceStream($"GC.Core.Assets.i18n.{code}.json"); if (stream == null) return null; @@ -130,3 +132,14 @@ public sealed class LocalizedString : INotifyPropertyChanged internal void Refresh() => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Value))); } +/// XAML 用法:Text="{loc:Loc nav.home}" +public sealed class LocExtension : MarkupExtension +{ + public LocExtension() { } + public LocExtension(string key) => Key = key; + public string Key { get; set; } = ""; + + public override object ProvideValue(IServiceProvider serviceProvider) + => new Binding(nameof(LocalizedString.Value)) { Source = L.I.For(Key) }; +} + diff --git a/GC/src/Services/MemoryBudget.cs b/C#/GC/src/Services/MemoryBudget.cs similarity index 100% rename from GC/src/Services/MemoryBudget.cs rename to C#/GC/src/Services/MemoryBudget.cs diff --git a/GC/src/Services/ModelHost.cs b/C#/GC/src/Services/ModelHost.cs similarity index 100% rename from GC/src/Services/ModelHost.cs rename to C#/GC/src/Services/ModelHost.cs diff --git a/GC/src/Services/ModelRepository.cs b/C#/GC/src/Services/ModelRepository.cs similarity index 100% rename from GC/src/Services/ModelRepository.cs rename to C#/GC/src/Services/ModelRepository.cs diff --git a/GC/src/Services/ModelScanner.cs b/C#/GC/src/Services/ModelScanner.cs similarity index 100% rename from GC/src/Services/ModelScanner.cs rename to C#/GC/src/Services/ModelScanner.cs diff --git a/GC/src/Services/ReleaseModels.cs b/C#/GC/src/Services/ReleaseModels.cs similarity index 100% rename from GC/src/Services/ReleaseModels.cs rename to C#/GC/src/Services/ReleaseModels.cs diff --git a/GC/src/Services/RuntimeLayout.cs b/C#/GC/src/Services/RuntimeLayout.cs similarity index 100% rename from GC/src/Services/RuntimeLayout.cs rename to C#/GC/src/Services/RuntimeLayout.cs diff --git a/GC/src/Services/SettingsService.cs b/C#/GC/src/Services/SettingsService.cs similarity index 100% rename from GC/src/Services/SettingsService.cs rename to C#/GC/src/Services/SettingsService.cs diff --git a/GC/src/Services/SharedHttpClientFactory.cs b/C#/GC/src/Services/SharedHttpClientFactory.cs similarity index 100% rename from GC/src/Services/SharedHttpClientFactory.cs rename to C#/GC/src/Services/SharedHttpClientFactory.cs diff --git a/GC/src/Services/Shell.cs b/C#/GC/src/Services/Shell.cs similarity index 100% rename from GC/src/Services/Shell.cs rename to C#/GC/src/Services/Shell.cs diff --git a/GC/src/Services/SourcePreset.cs b/C#/GC/src/Services/SourcePreset.cs similarity index 100% rename from GC/src/Services/SourcePreset.cs rename to C#/GC/src/Services/SourcePreset.cs diff --git a/GC/src/Services/UpdateModels.cs b/C#/GC/src/Services/UpdateModels.cs similarity index 100% rename from GC/src/Services/UpdateModels.cs rename to C#/GC/src/Services/UpdateModels.cs diff --git a/GC/src/Services/VersionUtil.cs b/C#/GC/src/Services/VersionUtil.cs similarity index 100% rename from GC/src/Services/VersionUtil.cs rename to C#/GC/src/Services/VersionUtil.cs diff --git a/C#/GC/src/Styles/AppTheme.axaml b/C#/GC/src/Styles/AppTheme.axaml new file mode 100644 index 0000000..8bac7da --- /dev/null +++ b/C#/GC/src/Styles/AppTheme.axaml @@ -0,0 +1,325 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/C#/GC/src/ViewModels/AboutViewModel.cs b/C#/GC/src/ViewModels/AboutViewModel.cs new file mode 100644 index 0000000..ea77657 --- /dev/null +++ b/C#/GC/src/ViewModels/AboutViewModel.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Threading.Tasks; +using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Input; +using GC.Services; + +namespace GC.ViewModels; + +/// 「关于」页面:版本号 + 开发者(读取仓库 contributors)。 +public partial class AboutViewModel : ObservableObject +{ + private readonly AppServices _services; + private bool _loaded; + + public ObservableCollection Contributors { get; } = new(); + + [ObservableProperty] private bool _isLoading = true; + [ObservableProperty] private string _statusText = ""; + [ObservableProperty] private bool _hasContributors; + + public AboutViewModel(AppServices services) + { + _services = services; + LoadCommand = new AsyncRelayCommand(() => LoadAsync(force: true)); + } + + public string AppName => "Morris GC"; + + /// 启动器版本号,如 v1.0.2。 + public string VersionText => "v" + LauncherRuntimeInfo.CurrentLauncherVersion; + + /// 当前平台标识,如 win-x64 / osx-arm64。 + public string PlatformText => LauncherRuntimeInfo.CurrentRid; + + public string RepositoryText => _services.Settings.Current.UpdateRepository; + + public string ContributorsTitle => "开发者"; + + public IAsyncRelayCommand LoadCommand { get; } + + /// 每次进入页面时调用(首次才真正联网拉取)。 + public void OnShown() + { + if (_loaded) return; + _ = LoadAsync(force: false); + } + + private async Task LoadAsync(bool force) + { + if (_loaded && !force) return; + _loaded = true; + + IsLoading = true; + StatusText = "正在读取贡献者…"; + try + { + var list = await ContributorsService.FetchAsync(_services.Settings.Current.UpdateRepository); + Contributors.Clear(); + foreach (var c in list) + Contributors.Add(new ContributorItem(c)); + + HasContributors = Contributors.Count > 0; + StatusText = HasContributors ? $"{Contributors.Count} 位贡献者" : "暂无贡献者信息"; + } + catch (Exception ex) + { + StatusText = "读取失败:" + ex.Message; + } + finally + { + IsLoading = false; + } + } + + [RelayCommand] + private void OpenRepository() => Shell.OpenUrl(RepositoryText); + + /// 重新下载启动器:关闭所有窗口,进度窗下载新版,完成后重启。 + [RelayCommand] + private async System.Threading.Tasks.Task ReinstallLauncher() + { + if (LauncherUpdateFlow.IsRunning) return; + await LauncherUpdateFlow.RunAsync(_services, "正在重新下载启动器"); + } +} + +/// 一位贡献者的展示项。 +public sealed class ContributorItem +{ + public ContributorItem(Contributor c) + { + Name = c.DisplayName; + Contributions = c.Contributions; + AvatarUrl = c.AvatarUrl; + } + + public string Name { get; } + public int Contributions { get; } + public string? AvatarUrl { get; } + public string ContributionsText => $"{Contributions} 次提交"; + public bool HasAvatar => !string.IsNullOrWhiteSpace(AvatarUrl); +} diff --git a/C#/GC/src/ViewModels/DownloadViewModel.cs b/C#/GC/src/ViewModels/DownloadViewModel.cs new file mode 100644 index 0000000..a958b20 --- /dev/null +++ b/C#/GC/src/ViewModels/DownloadViewModel.cs @@ -0,0 +1,411 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.ComponentModel; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Input; +using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Input; +using GC.Models; +using GC.Services; + +namespace GC.ViewModels; + +public partial class DownloadViewModel : ObservableObject +{ + private readonly AppServices _services; + private readonly MainViewModel _main; + private bool _initialized; + // 每次切源取消上一次加载,并用 generation 序号丢弃过期结果,避免并发写 Models 集合 + private CancellationTokenSource? _loadCts; + private int _loadGeneration; + + public ObservableCollection Sources { get; } = new(); + public ObservableCollection Models { get; } = new(); + public ObservableCollection Jobs => _services.Downloads.Jobs; + + [ObservableProperty] private SourceItemViewModel? _selectedSource; + [ObservableProperty] private string _importUrl = ""; + [ObservableProperty] private bool _isBusy; + [ObservableProperty] private string _statusMessage = ""; + [ObservableProperty] private bool _hasModels; + [ObservableProperty] private bool _isBackgroundOpen = true; + [ObservableProperty] private string _jobSummary = ""; + [ObservableProperty] private bool _hasJobs; + [ObservableProperty] private bool _isSourceEmpty; + + public DownloadViewModel(AppServices services, MainViewModel main) + { + _services = services; + _main = main; + Jobs.CollectionChanged += OnJobsChanged; + foreach (var job in Jobs) job.PropertyChanged += OnJobPropertyChanged; + L.I.LanguageChanged += RefreshLanguage; + RebuildSources(); + UpdateJobState(); + } + + public string BackgroundTitle => L.I["dl.background"]; + public string ImportHint => L.I["dl.hint"]; + + // ------------------------------------------------------------ 页面生命周期 + public void OnShown() + { + if (_initialized) return; + _initialized = true; + if (SelectedSource == null) + SelectedSource = Sources.FirstOrDefault(s => s.Model.Enabled && !string.IsNullOrWhiteSpace(s.Model.Url)) + ?? Sources.FirstOrDefault(); + } + + // ------------------------------------------------------------ 模型源 + private void RebuildSources() + { + var keepId = SelectedSource?.Model.Id; + Sources.Clear(); + foreach (var source in _services.Settings.Current.Sources) + Sources.Add(new SourceItemViewModel(source, this, _services)); + + SelectedSource = Sources.FirstOrDefault(s => s.Model.Id == keepId) ?? SelectedSource; + } + + partial void OnSelectedSourceChanged(SourceItemViewModel? value) + { + if (value == null) return; + if (string.IsNullOrWhiteSpace(value.Model.Url)) + { + Models.Clear(); + HasModels = false; + IsSourceEmpty = true; + StatusMessage = L.I["dl.pickSource"]; + return; + } + _ = LoadAsync(value, force: false); + } + + internal void OnSourceEnabledChanged(SourceItemViewModel source) + { + if (!source.Model.Enabled && SelectedSource == source) Models.Clear(); + } + + internal void RemoveSource(SourceItemViewModel source) + { + if (source.Model.BuiltIn) return; // 内置默认源不允许删除 + _services.Settings.Current.Sources.Remove(source.Model); + _services.Settings.Save(); + var wasSelected = SelectedSource == source; + Sources.Remove(source); + if (wasSelected) + { + SelectedSource = Sources.FirstOrDefault(); + if (SelectedSource == null) + { + Models.Clear(); + HasModels = false; + } + } + } + + /// + /// 只允许两个内置源(Xhmcl / GitCode),不再接受任意地址。 + /// 旧的「自定义源」入口统一改为:按测速结果切换到更快的那个源。 + /// + [RelayCommand] + private async Task ImportAsync() + { + var fastest = await _services.Selector.PickFastestAsync(force: true); + var target = Sources.FirstOrDefault(x => + SourcePreset.Find(fastest.Id) != null && + SourcePreset.Detect(x.Model.Url).Id == fastest.Id); + + if (target == null) + { + StatusMessage = "没有可用的下载源"; + return; + } + + SelectedSource = target; + var lat = _services.Selector.LastLatency; + StatusMessage = $"已切换到 {fastest.Name}" + + (lat.Count > 0 ? "(" + string.Join(",", lat.Select(kv => + $"{SourcePreset.Find(kv.Key)?.Name ?? kv.Key} {kv.Value}ms")) + ")" : ""); + await LoadAsync(target, force: true); + } + + private static string DeriveName(string url) + { + var trimmed = url.TrimEnd('/', '\\'); + var slash = trimmed.LastIndexOfAny(new[] { '/', '\\' }); + var name = slash >= 0 ? trimmed[(slash + 1)..] : trimmed; + if (name.EndsWith(".git", StringComparison.OrdinalIgnoreCase)) name = name[..^4]; + if (name.EndsWith(".zip", StringComparison.OrdinalIgnoreCase)) name = name[..^4]; + return string.IsNullOrWhiteSpace(name) ? url : name; + } + + [RelayCommand] + private async Task RefreshAsync() + { + if (SelectedSource == null) return; + await LoadAsync(SelectedSource, force: true); + } + + internal async Task RefreshFromSource(SourceItemViewModel source) + { + SelectedSource = source; + await LoadAsync(source, force: true); + } + + private async Task LoadAsync(SourceItemViewModel source, bool force) + { + if (!source.Model.Enabled) return; + + // 取消上一次尚未完成的加载,避免快速切换源时并发 Clear/写入同一集合 + _loadCts?.Cancel(); + _loadCts?.Dispose(); + _loadCts = new CancellationTokenSource(); + var ct = _loadCts.Token; + var generation = ++_loadGeneration; + + IsBusy = true; + StatusMessage = L.I["dl.syncing"]; + try + { + // 第 6 项:下载页与启动更新用同一个源、同一种下载方式。 + // 每次加载前先让选择器给出最快源(有缓存,不会真的每次都测)。 + try + { + var fastest = await _services.Selector.PickFastestAsync(false, ct); + if (fastest.Id != SourcePreset.Detect(source.Model.Url).Id) + { + var prefer = Sources.FirstOrDefault(x => + SourcePreset.Detect(x.Model.Url).Id == fastest.Id && x.Model.Enabled); + if (prefer != null && prefer != source) + { + SelectedSource = prefer; + source = prefer; + } + } + } + catch { /* 测速失败就沿用当前源 */ } + + var index = await _services.Sources.FetchAsync(source.Model, force, null, ct); + // 只有「仍是当前选中源 + 仍是最新一次加载」才可以写 UI 集合 + if (ct.IsCancellationRequested || generation != _loadGeneration || SelectedSource != source) + return; + + if (index.Error != null) + { + Models.Clear(); + HasModels = false; + IsSourceEmpty = true; + StatusMessage = DescribeError(index.Error); + return; + } + + var installedIds = new HashSet( + _services.Models.Scan().Select(p => p.Id), StringComparer.OrdinalIgnoreCase); + + Models.Clear(); + foreach (var model in index.Models) + { + Models.Add(new RemoteModelRowViewModel(model, source, + installedIds.Contains(model.Id), DownloadCommand)); + } + + HasModels = Models.Count > 0; + IsSourceEmpty = Models.Count == 0; + StatusMessage = index.FromCache + ? $"{L.I.F("dl.ready", Models.Count)} · {L.I["dl.fromCache"]}" + : L.I.F("dl.ready", Models.Count); + } + catch (OperationCanceledException) + { + // 被更新的加载取代或页面关闭:忽略,不覆盖新结果 + } + catch (Exception ex) + { + if (!ct.IsCancellationRequested) StatusMessage = ex.Message; + } + finally + { + // 只有最后一次加载才复位 Busy,避免旧任务把新任务的忙碌状态清掉 + if (generation == _loadGeneration) IsBusy = false; + } + } + + private static string DescribeError(string error) + { + if (error.StartsWith("dl.", StringComparison.Ordinal)) + { + var text = L.I[error]; + return text == error ? error : text; + } + return error; + } + + // ------------------------------------------------------------ 下载 + [RelayCommand] + private async Task DownloadAsync(RemoteModelRowViewModel row) + { + if (row == null) return; + row.RowOpacity = 0; + row.RowHeight = 0; + IsBackgroundOpen = true; + + _services.Downloads.Enqueue(row.Model); + + await Task.Delay(240); + Models.Remove(row); + HasModels = Models.Count > 0; + IsSourceEmpty = Models.Count == 0; + } + + [RelayCommand] + private void CancelJob(IDownloadJob? job) + { + if (job != null) _services.Downloads.Cancel(job); + } + + [RelayCommand] + private void RetryJob(IDownloadJob? job) + { + if (job != null) _services.Downloads.Retry(job); + } + + [RelayCommand] + private void RemoveJob(IDownloadJob? job) + { + if (job != null) _services.Downloads.Remove(job); + } + + [RelayCommand] + private void ClearFinished() => _services.Downloads.ClearFinished(); + + [RelayCommand] + private void ToggleBackground() => IsBackgroundOpen = !IsBackgroundOpen; + + // ------------------------------------------------------------ 任务展示 + private void OnJobsChanged(object? sender, NotifyCollectionChangedEventArgs e) + { + if (e.NewItems != null) + foreach (IDownloadJob job in e.NewItems) job.PropertyChanged += OnJobPropertyChanged; + if (e.OldItems != null) + foreach (IDownloadJob job in e.OldItems) job.PropertyChanged -= OnJobPropertyChanged; + UpdateJobState(); + } + + private void OnJobPropertyChanged(object? sender, PropertyChangedEventArgs e) + { + if (e.PropertyName == nameof(IDownloadJob.State)) + { + if (sender is IDownloadJob { State: DownloadState.Completed }) + _services.Models.NotifyChanged(); + } + UpdateJobState(); + } + + private void UpdateJobState() + { + HasJobs = Jobs.Count > 0; + JobSummary = $"{L.I["dl.background"]} ({Jobs.Count})"; + OnPropertyChanged(nameof(JobSummary)); + } + + private void RefreshLanguage() + { + foreach (var source in Sources) source.RefreshLanguage(); + foreach (var model in Models) model.RefreshLanguage(); + foreach (var job in Jobs) job.RefreshText(); + OnPropertyChanged(nameof(BackgroundTitle)); + OnPropertyChanged(nameof(ImportHint)); + UpdateJobState(); + } +} + +public partial class SourceItemViewModel : ObservableObject +{ + private readonly DownloadViewModel _owner; + private readonly AppServices _services; + + public ModelSource Model { get; } + + public SourceItemViewModel(ModelSource model, DownloadViewModel owner, AppServices services) + { + Model = model; + _owner = owner; + _services = services; + RemoveCommand = new RelayCommand(() => _owner.RemoveSource(this)); + RefreshCommand = new AsyncRelayCommand(async () => await _owner.RefreshFromSource(this)); + } + + public string Name => string.IsNullOrWhiteSpace(Model.Name) ? Model.Id : Model.Name; + public string HostText => string.IsNullOrWhiteSpace(Model.Url) ? L.I["dl.noSource"] : Model.DisplayHost; + public bool HasUrl => !string.IsNullOrWhiteSpace(Model.Url); + /// 内置默认源不可删除(下载页隐藏删除按钮)。 + public bool CanRemove => !Model.BuiltIn; + + public bool Enabled + { + get => Model.Enabled; + set + { + if (Model.Enabled == value) return; + Model.Enabled = value; + _services.Settings.Save(); + OnPropertyChanged(); + _owner.OnSourceEnabledChanged(this); + } + } + + public ICommand RemoveCommand { get; } + public ICommand RefreshCommand { get; } + + public void RefreshLanguage() + { + OnPropertyChanged(nameof(Name)); + OnPropertyChanged(nameof(HostText)); + } +} + +public partial class RemoteModelRowViewModel : ObservableObject +{ + public RemoteModel Model { get; } + public SourceItemViewModel Source { get; } + + public RemoteModelRowViewModel(RemoteModel model, SourceItemViewModel source, bool installed, ICommand downloadCommand) + { + Model = model; + Source = source; + Installed = installed; + DownloadCommand = downloadCommand; + } + + public string Name => Model.LocalizedName; + public string Description => Model.LocalizedDescription; + public string VersionText => "v" + Model.Manifest.Version; + public string SizeText => ModelScanner.HumanSize(Model.SizeBytes); + public string MetaText => $"{VersionText} · {SizeText}"; + public string TagsText => string.Join(" · ", Model.Manifest.Tags ?? new List()); + public bool HasTags => !string.IsNullOrWhiteSpace(TagsText); + + [ObservableProperty] private bool _installed; + [ObservableProperty] private double _rowHeight = 92; + [ObservableProperty] private double _rowOpacity = 1; + + public string ButtonText => Installed ? L.I["dl.reinstall"] : L.I["dl.download"]; + public ICommand DownloadCommand { get; } + + partial void OnInstalledChanged(bool value) => OnPropertyChanged(nameof(ButtonText)); + + public void RefreshLanguage() + { + OnPropertyChanged(nameof(Name)); + OnPropertyChanged(nameof(Description)); + OnPropertyChanged(nameof(MetaText)); + OnPropertyChanged(nameof(TagsText)); + OnPropertyChanged(nameof(ButtonText)); + } +} diff --git a/C#/GC/src/ViewModels/HomeViewModel.cs b/C#/GC/src/ViewModels/HomeViewModel.cs new file mode 100644 index 0000000..fe5f6e3 --- /dev/null +++ b/C#/GC/src/ViewModels/HomeViewModel.cs @@ -0,0 +1,148 @@ +using System; +using System.Collections.ObjectModel; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Input; +using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Input; +using GC.Models; +using Avalonia.Media.Imaging; +using GC.Services; + +namespace GC.ViewModels; + +public partial class HomeViewModel : ObservableObject +{ + private readonly AppServices _services; + private readonly MainViewModel _main; + + public ObservableCollection Models { get; } = new(); + + [ObservableProperty] private ModelCardViewModel? _selected; + [ObservableProperty] private bool _isEmpty; + + public string CountText => L.I.F("home.count", Models.Count); + public string SourceCountText => _services.Settings.Current.Sources + .Count(s => s.Enabled && !string.IsNullOrWhiteSpace(s.Url)).ToString(); + public string MemoryText => $"{_services.Memory.BudgetMb} MB"; + public string SelectedHint => Selected == null ? L.I["home.recent"] : L.I["home.launchHint"]; + + public HomeViewModel(AppServices services, MainViewModel main) + { + _services = services; + _main = main; + _services.Models.Changed += Refresh; + L.I.LanguageChanged += RefreshLanguage; + Refresh(); + } + + public void Refresh() + { + var keepId = Selected?.Package.Id; + Models.Clear(); + foreach (var package in _services.Models.Scan()) + Models.Add(new ModelCardViewModel(package, _services, this)); + + Selected = Models.FirstOrDefault(m => m.Package.Id == keepId) ?? Models.FirstOrDefault(); + IsEmpty = Models.Count == 0; + RefreshLanguage(); + } + + private void RefreshLanguage() + { + OnPropertyChanged(nameof(CountText)); + OnPropertyChanged(nameof(SourceCountText)); + OnPropertyChanged(nameof(MemoryText)); + OnPropertyChanged(nameof(SelectedHint)); + foreach (var model in Models) model.RefreshLanguage(); + } + + public void LaunchModel(ModelCardViewModel card) + { + Selected = card; + _main.PlayModel(card.Package); + } + + public async Task DeleteAsync(ModelCardViewModel card) + { + if (!await _main.ConfirmAsync(L.I.F("home.deleteConfirm", card.Name))) return; + _services.Models.Delete(card.Package.Id); + _services.Models.NotifyChanged(); + Refresh(); + } + + [RelayCommand] + private void Launch() + { + var card = Selected ?? Models.FirstOrDefault(); + if (card != null) _main.PlayModel(card.Package); + } + + [RelayCommand] + private void OpenDownload() => _main.GoDownload(); + + [RelayCommand] + private void OpenSettings() => _main.GoSettings(); + + [RelayCommand] + private void OpenFolder() => Shell.OpenFolder(_services.Paths.ModelRoot); +} + +public partial class ModelCardViewModel : ObservableObject +{ + private readonly AppServices _services; + private Bitmap? _preview; + + public ModelPackage Package { get; } + + public ModelCardViewModel(ModelPackage package, AppServices services, HomeViewModel home) + { + Package = package; + _services = services; + LaunchCommand = new RelayCommand(() => home.LaunchModel(this)); + DeleteCommand = new AsyncRelayCommand(() => home.DeleteAsync(this)); + OpenFolderCommand = new RelayCommand(() => Shell.OpenFolder(package.Directory)); + } + + public string Name => Package.LocalizedName; + public string Description => Package.LocalizedDescription; + public string VersionText => "v" + Package.Manifest.Version; + public string SizeText => ModelScanner.HumanSize(Package.SizeBytes); + public string MetaText => $"{VersionText} · {SizeText}"; + public string TagsText => string.Join(" · ", Package.Manifest.Tags ?? new()); + public bool HasTags => !string.IsNullOrWhiteSpace(TagsText); + public string AuthorText => string.IsNullOrWhiteSpace(Package.Manifest.Author) ? "" : Package.Manifest.Author; + + /// 封面图来自模型包自带的 preview.png —— 启动器只显示,不渲染。 + public Bitmap? Preview + { + get + { + if (_preview != null) return _preview; + try + { + if (File.Exists(Package.PreviewPath)) _preview = new Bitmap(Package.PreviewPath); + } + catch (Exception ex) + { + Console.Error.WriteLine($"读取模型封面失败 {Package.Id}: {ex.Message}"); + } + return _preview; + } + } + + public bool HasPreview => Preview != null; + + public ICommand LaunchCommand { get; } + public ICommand DeleteCommand { get; } + public ICommand OpenFolderCommand { get; } + + public void RefreshLanguage() + { + OnPropertyChanged(nameof(Name)); + OnPropertyChanged(nameof(Description)); + OnPropertyChanged(nameof(MetaText)); + OnPropertyChanged(nameof(TagsText)); + } +} diff --git a/C#/GC/src/ViewModels/MainViewModel.cs b/C#/GC/src/ViewModels/MainViewModel.cs new file mode 100644 index 0000000..a3a226a --- /dev/null +++ b/C#/GC/src/ViewModels/MainViewModel.cs @@ -0,0 +1,228 @@ +using System; +using System.Linq; +using System.Threading.Tasks; +using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Input; +using GC.Models; +using GC.Services; + +namespace GC.ViewModels; + +public partial class MainViewModel : ObservableObject +{ + private readonly AppServices _services; + private bool _updateRunning; + + public HomeViewModel Home { get; } + public DownloadViewModel Download { get; } + public SettingsViewModel Settings { get; } + public AboutViewModel About { get; } + + /// 模型宿主:按清单加载模型自带的功能程序集。 + public ModelHost Models { get; } + + [ObservableProperty] private ObservableObject _current = null!; + [ObservableProperty] private bool _isHomeActive = true; + [ObservableProperty] private bool _isDownloadActive; + [ObservableProperty] private bool _isSettingsActive; + [ObservableProperty] private bool _isAboutActive; + + // 启动更新状态条 + [ObservableProperty] private bool _updateBarVisible; + [ObservableProperty] private bool _updateBusy; + [ObservableProperty] private double _updateProgress; + [ObservableProperty] private string _updateStatus = ""; + [ObservableProperty] private string _updateDetail = ""; + [ObservableProperty] private string _launcherNotice = ""; + + /// 由主窗口注入的确认对话框。 + public Func>? ConfirmHandler { get; set; } + + /// + /// 由主窗口注入的「发现启动器新版本」对话框。 + /// 参数为新版本号,返回 true 表示用户选择更新。 + /// + public Func>? LauncherUpdateHandler { get; set; } + + public event Action? PlayerRequested; + + /// 打开等高线课件窗口(由主窗口接线)。 + public event Action? CoursewareRequested; + + public string VersionText => "v" + LauncherRuntimeInfo.CurrentLauncherVersion; + public string PlatformText => LauncherRuntimeInfo.CurrentRid; + + public MainViewModel(AppServices services) + { + _services = services; + Models = services.ModelHost; + Home = new HomeViewModel(services, this); + Download = new DownloadViewModel(services, this); + Settings = new SettingsViewModel(services); + About = new AboutViewModel(services); + Current = Home; + } + + partial void OnCurrentChanged(ObservableObject value) + { + IsHomeActive = value is HomeViewModel; + IsDownloadActive = value is DownloadViewModel; + IsSettingsActive = value is SettingsViewModel; + IsAboutActive = value is AboutViewModel; + } + + [RelayCommand] + public void GoHome() + { + Home.Refresh(); + Current = Home; + } + + [RelayCommand] + public void GoDownload() + { + Current = Download; + Download.OnShown(); + } + + [RelayCommand] + public void GoSettings() + { + Settings.Refresh(); + Current = Settings; + } + + [RelayCommand] + public void GoAbout() + { + About.OnShown(); + Current = About; + } + + /// 打开等高线课件(独立 Avalonia WebView 窗口)。 + [RelayCommand] + public void OpenCourseware() => CoursewareRequested?.Invoke(); + + /// 启动模型:交给模型自己的程序集,在独立窗口中运行。 + public void PlayModel(ModelPackage package) + { + _services.Memory.Refresh(); + PlayerRequested?.Invoke(package); + } + + public async Task ConfirmAsync(string message) + => ConfirmHandler == null || await ConfirmHandler(message); + + // ---- 自动更新 ---------------------------------------------------------- + + /// 启动后由 App 调用:后台检查更新,不阻塞主界面。 + public Task RunStartupUpdateAsync() => RunUpdateAsync(false); + + /// 状态条 / 设置页的「检查更新」,忽略自动开关强制检查。 + [RelayCommand] + private Task CheckUpdate() => RunUpdateAsync(true); + + private async Task RunUpdateAsync(bool force) + { + if (_updateRunning) return; + _updateRunning = true; + try + { + UpdateBarVisible = true; + UpdateBusy = true; + UpdateProgress = 0; + UpdateStatus = L.I["update.checking"]; + UpdateDetail = ""; + LauncherNotice = ""; + + // 在 UI 线程构造,进度回调自动回到 UI 线程 + var progress = new Progress(p => + { + UpdateProgress = Math.Clamp(p.Value, 0, 1); + UpdateStatus = p.Message; + UpdateDetail = p.Detail ?? ""; + }); + + // 双源测速:Xhmcl / GitCode 取快的那个(第 5 项)。 + // 启动更新与下载页共用同一个选择器,保证两处用同一个源、同一种下载方式。 + UpdateStatus = "正在选择最快的下载源…"; + try + { + var fastest = await _services.Selector.PickFastestAsync( + force, default); + _services.Updates.UseRemote(_services.DownloadModule.CreateRemote(fastest)); + var lat = _services.Selector.LastLatency; + UpdateDetail = "源:" + fastest.Name + + (lat.Count > 0 ? "(" + string.Join(",", lat.Select(kv => + $"{SourcePreset.Find(kv.Key)?.Name ?? kv.Key} {kv.Value}ms")) + ")" : ""); + } + catch (Exception ex) + { + Console.Error.WriteLine($"[update] 测速失败,沿用当前源: {ex.Message}"); + } + + // 启动器:读 Release latest 版本号,与当前运行版本不同就弹窗询问 + var latest = await _services.LauncherUpdates.CheckAsync(_services.Updates.Remote); + if (latest != null) + { + var agreed = LauncherUpdateHandler != null && + await LauncherUpdateHandler(latest); + if (agreed) + { + // 走完整更新流程(关窗 -> 进度窗下载 -> 重启) + UpdateBusy = false; + _updateRunning = false; + UpdateBarVisible = false; + await LauncherUpdateFlow.RunAsync(_services, "正在更新启动器"); + return; + } + + UpdateStatus = $"启动器有新版本 v{latest}(已跳过)"; + UpdateDetail = "点击「检查更新」可再次更新,模型仍会同步到最新"; + } + + // 模型:同步到最新版 + var result = await _services.Updates.RunAsync(force, progress, default); + + UpdateStatus = result.Message; + UpdateDetail = result.Error ?? ""; + LauncherNotice = result.LauncherMessage ?? ""; + + // 首次启动 + 断网:本地一个模型都没有,这时候不能只留一个空页面。 + // 明确告诉用户「没坏、可以怎么办」,并保留状态条(不自动隐藏)。 + if (result.Outcome == UpdateOutcome.Unavailable && Home.Models.Count == 0) + { + UpdateStatus = "暂时连不上模型源,模型库为空"; + UpdateDetail = "可以到「下载」页点重试,或把模型文件夹放进 .GC/model/ 后重新打开"; + return; + } + + // 模型下载完成后本次启动就刷新列表,立刻可用 + if (result.UpdatedModels > 0) Home.Refresh(); + + if ((result.Outcome == UpdateOutcome.NoChange || result.Outcome == UpdateOutcome.Applied) && + string.IsNullOrEmpty(LauncherNotice)) + _ = AutoHideAsync(); + } + catch (Exception ex) + { + UpdateStatus = L.I["update.offline"]; + UpdateDetail = ex.Message; + } + finally + { + UpdateBusy = false; + _updateRunning = false; + } + } + + private async Task AutoHideAsync() + { + try + { + await Task.Delay(6000); + if (!_updateRunning && string.IsNullOrEmpty(LauncherNotice)) UpdateBarVisible = false; + } + catch { /* 忽略 */ } + } +} diff --git a/C#/GC/src/ViewModels/SettingsViewModel.cs b/C#/GC/src/ViewModels/SettingsViewModel.cs new file mode 100644 index 0000000..59aec31 --- /dev/null +++ b/C#/GC/src/ViewModels/SettingsViewModel.cs @@ -0,0 +1,217 @@ +using System; +using System.Collections.ObjectModel; +using System.Linq; +using System.Runtime.InteropServices; +using System.Windows.Input; +using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Input; +using GC.Models; +using GC.Services; + +namespace GC.ViewModels; + +public sealed class LanguageOption +{ + public string Code { get; init; } = "auto"; + public string Label { get; set; } = ""; + public override string ToString() => Label; +} + +public partial class SettingsViewModel : ObservableObject +{ + private readonly AppServices _services; + private bool _loading = true; + + public ObservableCollection Sources { get; } = new(); + public ObservableCollection Languages { get; } = new(); + public int[] FrameRates { get; } = { 24, 30, 60, 90, 120 }; + + [ObservableProperty] private LanguageOption? _selectedLanguage; + [ObservableProperty] private int _selectedFps = 120; + [ObservableProperty] private double _memoryValue = 2048; + [ObservableProperty] private bool _memoryAuto = true; + [ObservableProperty] private string _statusMessage = ""; + [ObservableProperty] private bool _autoUpdate = true; + + public string UpdateSourceText => _services.Updates.Remote.DisplayName; + public string LastCheckText + { + get + { + var value = _services.Settings.Current.LastUpdateCheck; + if (string.IsNullOrWhiteSpace(value)) return L.I["update.never"]; + return DateTimeOffset.TryParse(value, out var time) + ? time.ToLocalTime().ToString("yyyy-MM-dd HH:mm") : value!; + } + } + public string PendingText => string.IsNullOrWhiteSpace(_services.Settings.Current.PendingLauncherVersion) + ? L.I["update.none"] : _services.Settings.Current.PendingLauncherVersion!; + + public string MemoryValueText => MemoryAuto + ? $"{L.I["set.memory.auto"]} ({_services.Memory.BudgetMb} MB)" + : $"{(int)Math.Round(MemoryValue)} MB"; + public string UsageText => _services.Memory.UsageText; + public string ModelRoot => _services.Paths.ModelRoot; + public string DataRoot => _services.Paths.DataRoot; + public string PlatformText => $"{RuntimeInformation.OSDescription} · {RuntimeInformation.RuntimeIdentifier}"; + public string VersionText => "v1.0.0"; + public string MemoryHint => L.I["set.memory.hint"]; + + public SettingsViewModel(AppServices services) + { + _services = services; + L.I.LanguageChanged += OnLanguageChanged; + Refresh(); + _loading = false; + } + + public void Refresh() + { + _loading = true; + BuildLanguages(); + var settings = _services.Settings.Current; + SelectedFps = settings.RenderFps; + MemoryValue = settings.MemoryMb; + MemoryAuto = settings.MemoryAuto; + AutoUpdate = settings.AutoUpdateOnStartup; + + Sources.Clear(); + foreach (var source in settings.Sources) + Sources.Add(new SettingsSourceViewModel(source, _services, this)); + + _loading = false; + OnPropertyChanged(nameof(UsageText)); + OnPropertyChanged(nameof(MemoryValueText)); + OnPropertyChanged(nameof(MemoryHint)); + OnPropertyChanged(nameof(ModelRoot)); + OnPropertyChanged(nameof(DataRoot)); + OnPropertyChanged(nameof(UpdateSourceText)); + OnPropertyChanged(nameof(LastCheckText)); + OnPropertyChanged(nameof(PendingText)); + } + + partial void OnAutoUpdateChanged(bool value) + { + if (_loading) return; + _services.Settings.Apply(s => s.AutoUpdateOnStartup = value); + } + + private void BuildLanguages() + { + var current = _services.Settings.Current.Language; + Languages.Clear(); + Languages.Add(new LanguageOption { Code = "auto", Label = L.I["set.language.auto"] }); + foreach (var (code, label) in L.Supported) + Languages.Add(new LanguageOption { Code = code, Label = label }); + SelectedLanguage = Languages.FirstOrDefault(l => l.Code == current) ?? Languages[0]; + } + + private void OnLanguageChanged() + { + _loading = true; + BuildLanguages(); + _loading = false; + Refresh(); + } + + partial void OnSelectedLanguageChanged(LanguageOption? value) + { + if (_loading || value == null) return; + _services.Settings.Apply(s => s.Language = value.Code); + L.I.SetLanguage(value.Code); + } + + partial void OnSelectedFpsChanged(int value) + { + if (_loading) return; + _services.Settings.Apply(s => s.RenderFps = Math.Clamp(value, 12, 120)); + } + + partial void OnMemoryValueChanged(double value) + { + if (_loading) return; + var mb = (int)Math.Round(value); + _services.Settings.Apply(s => s.MemoryMb = mb); + _services.Memory.Apply(mb); + OnPropertyChanged(nameof(MemoryValueText)); + OnPropertyChanged(nameof(UsageText)); + } + + partial void OnMemoryAutoChanged(bool value) + { + if (_loading) return; + _services.Settings.Apply(s => s.MemoryAuto = value); + _services.Memory.ApplyAuto(value, (int)Math.Round(MemoryValue)); + OnPropertyChanged(nameof(MemoryValueText)); + OnPropertyChanged(nameof(UsageText)); + } + + [RelayCommand] + private void OpenModelFolder() => Shell.OpenFolder(_services.Paths.ModelRoot); + + [RelayCommand] + private void OpenDataFolder() => Shell.OpenFolder(_services.Paths.DataRoot); + + [RelayCommand] + private void ClearCache() + { + // 模型数据由模型自己管理;这里只回收启动器侧托管内存 + System.GC.Collect(); + System.GC.WaitForPendingFinalizers(); + _services.Memory.Refresh(); + StatusMessage = L.I["set.cacheCleared"]; + OnPropertyChanged(nameof(UsageText)); + } + + [RelayCommand] + private void ApplyMemory() + { + _services.Memory.Apply((int)Math.Round(MemoryValue)); + StatusMessage = L.I["common.applied"]; + OnPropertyChanged(nameof(UsageText)); + } + + internal void RemoveSource(SettingsSourceViewModel source) + { + if (source.Model.BuiltIn) return; // 内置默认源不允许删除 + _services.Settings.Current.Sources.Remove(source.Model); + _services.Settings.Save(); + Sources.Remove(source); + _services.Settings.Notify(); + } +} + +public partial class SettingsSourceViewModel : ObservableObject +{ + private readonly AppServices _services; + private readonly SettingsViewModel _owner; + + public ModelSource Model { get; } + + public SettingsSourceViewModel(ModelSource model, AppServices services, SettingsViewModel owner) + { + Model = model; + _services = services; + _owner = owner; + RemoveCommand = new RelayCommand(() => _owner.RemoveSource(this)); + } + + public string Name => string.IsNullOrWhiteSpace(Model.Name) ? Model.Id : Model.Name; + public string UrlText => string.IsNullOrWhiteSpace(Model.Url) ? L.I["dl.noSource"] : Model.Url; + /// 内置默认源不可删除。 + public bool CanRemove => !Model.BuiltIn; + + public bool Enabled + { + get => Model.Enabled; + set + { + if (Model.Enabled == value) return; + Model.Enabled = value; + _services.Settings.Save(); + OnPropertyChanged(); + } + } + + public ICommand RemoveCommand { get; } +} diff --git a/C#/GC/src/Views/AboutView.axaml b/C#/GC/src/Views/AboutView.axaml new file mode 100644 index 0000000..66d0d31 --- /dev/null +++ b/C#/GC/src/Views/AboutView.axaml @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - -
- - -
- -
- - 点击“开始实验”,观看形成交线视频 -
- -
- - - - - - - - diff --git a/GC-UI/frontend/lib/api_client.dart b/GC-UI/frontend/lib/api_client.dart deleted file mode 100644 index ec6eaa8..0000000 --- a/GC-UI/frontend/lib/api_client.dart +++ /dev/null @@ -1,778 +0,0 @@ -import 'dart:convert'; -import 'dart:io'; - -import 'package:http/http.dart' as http; - -/// 后端返回的错误(HTTP 非 2xx,或后端明确返回 ok=false)。 -class ApiException implements Exception { - ApiException(this.message, {this.statusCode}); - - final String message; - final int? statusCode; - - @override - String toString() => message; -} - -/// 已安装模型。 -class ModelInfo { - ModelInfo.fromJson(Map json) - : id = json['id'] as String? ?? '', - name = json['name'] as String? ?? '', - description = json['description'] as String? ?? '', - version = json['version'] as String? ?? '', - author = json['author'] as String? ?? '', - sizeBytes = (json['sizeBytes'] as num?)?.toInt() ?? 0, - sizeText = json['sizeText'] as String? ?? '', - tags = _stringList(json['tags']), - hasPreview = json['hasPreview'] as bool? ?? false, - previewUrl = json['previewUrl'] as String? ?? '', - directory = json['directory'] as String? ?? '', - dataDirectory = json['dataDirectory'] as String? ?? ''; - - final String id; - final String name; - final String description; - final String version; - final String author; - final int sizeBytes; - final String sizeText; - final List tags; - final bool hasPreview; - final String previewUrl; - final String directory; - final String dataDirectory; - - String get metaText => 'v$version · $sizeText'; -} - -/// 模型源。 -class SourceInfo { - SourceInfo.fromJson(Map json) - : id = json['id'] as String? ?? '', - name = json['name'] as String? ?? '', - url = json['url'] as String? ?? '', - enabled = json['enabled'] as bool? ?? false, - builtIn = json['builtIn'] as bool? ?? false, - host = json['host'] as String? ?? ''; - - final String id; - final String name; - final String url; - final bool enabled; - final bool builtIn; - final String host; -} - -/// 远端可下载模型。 -class RemoteModelInfo { - RemoteModelInfo.fromJson(Map json) - : id = json['id'] as String? ?? '', - name = json['name'] as String? ?? '', - description = json['description'] as String? ?? '', - version = json['version'] as String? ?? '', - sizeBytes = (json['sizeBytes'] as num?)?.toInt() ?? 0, - sizeText = json['sizeText'] as String? ?? '', - sourceId = json['sourceId'] as String? ?? '', - installed = json['installed'] as bool? ?? false, - installedVersion = json['installedVersion'] as String?; - - final String id; - final String name; - final String description; - final String version; - final int sizeBytes; - final String sizeText; - final String sourceId; - final bool installed; - final String? installedVersion; -} - -/// 一次远端源索引结果。 -class SourceIndexInfo { - SourceIndexInfo.fromJson(Map json) - : sourceId = json['sourceId'] as String? ?? '', - root = json['root'] as String? ?? '', - fromCache = json['fromCache'] as bool? ?? false, - error = json['error'] as String?, - resolvedFrom = json['resolvedFrom'] as String? ?? '', - models = (json['models'] as List? ?? const []) - .map((e) => RemoteModelInfo.fromJson(e as Map)) - .toList(); - - final String sourceId; - final String root; - final bool fromCache; - final String? error; - final String resolvedFrom; - final List models; -} - -/// 下载任务。 -class JobInfo { - JobInfo.fromJson(Map json) - : id = json['id'] as String? ?? '', - modelId = json['modelId'] as String? ?? '', - name = json['name'] as String? ?? '', - version = json['version'] as String? ?? '', - state = json['state'] as String? ?? 'Queued', - progress = (json['progress'] as num?)?.toDouble() ?? 0, - statusText = json['statusText'] as String? ?? '', - detailText = json['detailText'] as String? ?? '', - error = json['error'] as String?, - isActive = json['isActive'] as bool? ?? false, - canRetry = json['canRetry'] as bool? ?? false, - isDone = json['isDone'] as bool? ?? false; - - final String id; - final String modelId; - final String name; - final String version; - final String state; - final double progress; - final String statusText; - final String detailText; - final String? error; - final bool isActive; - final bool canRetry; - final bool isDone; -} - -/// 「重新下载启动器」的结果。 -/// -/// State: Ready(已下载并通过 sha256 校验)/ UpToDate(已是最新,无需重下)/ Failed。 -class LauncherRedownloadInfo { - LauncherRedownloadInfo.fromJson(Map json) - : state = json['state'] as String? ?? '', - version = json['version'] as String? ?? '', - message = json['message'] as String? ?? '', - steps = ((json['steps'] as List?) ?? const []) - .map((e) => e.toString()) - .toList(); - - final String state; - final String version; - final String message; - final List steps; - - bool get ok => state == 'Ready' || state == 'UpToDate'; -} - -/// 界面语言选项。 -class LanguageInfo { - LanguageInfo.fromJson(Map json) - : code = json['code'] as String? ?? '', - label = json['label'] as String? ?? ''; - - final String code; - final String label; -} - -/// 设置。 -class SettingsInfo { - SettingsInfo.fromJson(Map json) - : language = json['language'] as String? ?? 'auto', - theme = json['theme'] as String? ?? 'light', - accentColor = json['accentColor'] as String? ?? '#8FB6FF', - renderFps = (json['renderFps'] as num?)?.toInt() ?? 120, - memoryMb = (json['memoryMb'] as num?)?.toInt() ?? 2048, - memoryAuto = json['memoryAuto'] as bool? ?? true, - autoUpdateOnStartup = json['autoUpdateOnStartup'] as bool? ?? true, - requireSignedManifest = json['requireSignedManifest'] as bool? ?? true, - updateRepository = json['updateRepository'] as String? ?? '', - updateLocalRoot = json['updateLocalRoot'] as String?, - modelRootOverride = json['modelRootOverride'] as String?, - memoryBudgetMb = (json['memoryBudgetMb'] as num?)?.toInt() ?? 0, - memoryUsageText = json['memoryUsageText'] as String? ?? '', - modelRoot = json['modelRoot'] as String? ?? '', - dataRoot = json['dataRoot'] as String? ?? '', - settingsFile = json['settingsFile'] as String? ?? '', - version = json['version'] as String? ?? '', - platform = json['platform'] as String? ?? '', - sources = (json['sources'] as List? ?? const []) - .map((e) => SourceInfo.fromJson(e as Map)) - .toList(), - languages = (json['languages'] as List? ?? const []) - .map((e) => LanguageInfo.fromJson(e as Map)) - .toList(); - - final String language; - final String theme; - final String accentColor; - final int renderFps; - final int memoryMb; - final bool memoryAuto; - final bool autoUpdateOnStartup; - final bool requireSignedManifest; - final String updateRepository; - final String? updateLocalRoot; - final String? modelRootOverride; - final int memoryBudgetMb; - final String memoryUsageText; - final String modelRoot; - final String dataRoot; - final String settingsFile; - final String version; - final String platform; - final List sources; - final List languages; -} - -/// 设置补丁:只提交要改的字段。 -class SettingsPatch { - const SettingsPatch({ - this.language, - this.theme, - this.accentColor, - this.renderFps, - this.memoryMb, - this.memoryAuto, - this.autoUpdateOnStartup, - this.requireSignedManifest, - this.updateRepository, - this.updateLocalRoot, - this.modelRootOverride, - }); - - final String? language; - final String? theme; - final String? accentColor; - final int? renderFps; - final int? memoryMb; - final bool? memoryAuto; - final bool? autoUpdateOnStartup; - final bool? requireSignedManifest; - final String? updateRepository; - final String? updateLocalRoot; - final String? modelRootOverride; - - Map toJson() { - final map = {}; - if (language != null) map['language'] = language; - if (theme != null) map['theme'] = theme; - if (accentColor != null) map['accentColor'] = accentColor; - if (renderFps != null) map['renderFps'] = renderFps; - if (memoryMb != null) map['memoryMb'] = memoryMb; - if (memoryAuto != null) map['memoryAuto'] = memoryAuto; - if (autoUpdateOnStartup != null) map['autoUpdateOnStartup'] = autoUpdateOnStartup; - if (requireSignedManifest != null) map['requireSignedManifest'] = requireSignedManifest; - if (updateRepository != null) map['updateRepository'] = updateRepository; - if (updateLocalRoot != null) map['updateLocalRoot'] = updateLocalRoot; - if (modelRootOverride != null) map['modelRootOverride'] = modelRootOverride; - return map; - } -} - -/// 健康检查。 -class HealthInfo { - HealthInfo.fromJson(Map json) - : ok = json['ok'] as bool? ?? false, - version = json['version'] as String? ?? '', - platform = json['platform'] as String? ?? '', - uiAvailable = json['uiAvailable'] as bool? ?? false, - uiError = json['uiError'] as String?, - sessionProof = json['sessionProof'] as String?; - - final bool ok; - final String version; - final String platform; - final bool uiAvailable; - final String? uiError; - /// 后端会话令牌的指纹;前端可用于诊断「是否连到了正确的后端」。 - final String? sessionProof; -} - -/// 一次更新检查的结果。 -class UpdateCheckInfo { - UpdateCheckInfo.fromJson(Map json) - : outcome = json['outcome'] as String? ?? '', - message = json['message'] as String? ?? '', - updatedModels = (json['updatedModels'] as num?)?.toInt() ?? 0, - modelNames = _stringList(json['modelNames']), - launcherMessage = json['launcherMessage'] as String?, - error = json['error'] as String?, - launcherLatest = json['launcherLatest'] as String?, - sourceName = json['sourceName'] as String? ?? ''; - - final String outcome; - final String message; - final int updatedModels; - final List modelNames; - final String? launcherMessage; - final String? error; - final String? launcherLatest; - final String sourceName; -} - -/// 贡献者。 -class ContributorInfo { - ContributorInfo.fromJson(Map json) - : name = json['name'] as String? ?? '', - contributions = (json['contributions'] as num?)?.toInt() ?? 0, - avatarUrl = json['avatarUrl'] as String?; - - final String name; - final int contributions; - final String? avatarUrl; -} - -/// 关于页数据。 -class AboutInfo { - AboutInfo.fromJson(Map json) - : appName = json['appName'] as String? ?? '', - version = json['version'] as String? ?? '', - platform = json['platform'] as String? ?? '', - repository = json['repository'] as String? ?? '', - sourceLanguage = json['sourceLanguage'] as String? ?? 'C#', - frontend = json['frontend'] as String? ?? 'Flutter', - contributors = (json['contributors'] as List? ?? const []) - .map((e) => ContributorInfo.fromJson(e as Map)) - .toList(); - - final String appName; - final String version; - final String platform; - final String repository; - - /// 源码语言(后端 / 模型层),由后端 `/api/about` 返回。 - final String sourceLanguage; - - /// 前端框架,由后端 `/api/about` 返回。 - final String frontend; - - final List contributors; -} - -/// 通用操作结果。 -class ActionResult { - ActionResult.fromJson(Map json) - : ok = json['ok'] as bool? ?? false, - message = json['message'] as String? ?? ''; - - final bool ok; - final String message; -} - -List _stringList(dynamic value) => - (value as List? ?? const []).map((e) => e.toString()).toList(); - -/// 握手文件内容。 -class _Endpoint { - const _Endpoint(this.url, this.token); - - final String url; - final String? token; -} - -/// GC-UI 后端客户端。 -/// -/// 后端是本地伴随进程,端口由启动器(GC-BOOT)选定后通过 `GC_UI_PORT` -/// 环境变量传进来 —— 这样端口被占用时换端口不用重新编译前端。 -/// 也可用 `--dart-define=GC_UI_BASE_URL=http://127.0.0.1:12345` 强制指定。 -class GcApi { - GcApi({String? baseUrl}) - : baseUrl = baseUrl ?? defaultBaseUrl; - - /// 后端地址。可被 [rediscover] 更新(后端换端口 / 首次靠握手文件发现)。 - String baseUrl; - - /// 复用同一个 HTTP 连接:轮询(下载任务每秒一次)时每次都新建连接 - /// 会不断握手,桌面端也能明显看到延迟抖动。 - static final http.Client _client = http.Client(); - - /// 兜底默认端口,与后端 GC.Services.GcUiContract.DefaultPort 保持一致。 - static const int fallbackPort = 17890; - - static String get defaultBaseUrl { - const fromDefine = String.fromEnvironment('GC_UI_BASE_URL'); - if (fromDefine.isNotEmpty) return fromDefine; - - final fromEnvUrl = Platform.environment['GC_UI_BASE_URL']; - if (fromEnvUrl != null && fromEnvUrl.isNotEmpty) return fromEnvUrl; - - // 启动器通过 GC_UI_PORT 传端口(主路径)。 - final port = int.tryParse(Platform.environment['GC_UI_PORT'] ?? ''); - if (port != null) return 'http://127.0.0.1:$port'; - - // 没有环境变量(例如直接从 Finder 打开 GC-UI.app):读后端写的握手文件。 - final discovered = _readEndpointFile(); - if (discovered != null) return discovered.url; - - return 'http://127.0.0.1:$fallbackPort'; - } - - /// 后端启动时写的握手文件:地址 + 会话令牌。 - static _Endpoint? _endpoint; - - /// 依次尝试的运行目录。打包后 GC-UI.app 在 GC.app/Contents/MacOS/ 下, - /// 直接 Finder 打开时 Directory.current 可能是 `/`,所以要把可执行文件周围都试一遍。 - static List _candidateRoots() { - final roots = []; - void add(String path) { - if (path.isEmpty) return; - final root = path.endsWith('/') ? path.substring(0, path.length - 1) : path; - if (!roots.contains(root)) roots.add(root); - } - - add(Platform.environment['GC_UI_HOME'] ?? ''); - try { - add(Directory.current.path); - } catch (_) {} - - try { - var dir = File(Platform.resolvedExecutable).parent; - // GC-UI.app/Contents/MacOS -> 逐级向上都可能是 .GC 所在目录 - for (var i = 0; i < 4; i++) { - add(dir.path); - if (dir.parent.path == dir.path) break; - dir = dir.parent; - } - } catch (_) {} - - return roots; - } - - static _Endpoint? _readEndpointFile({bool refresh = false}) { - if (!refresh && _endpoint != null) return _endpoint; - - for (final root in _candidateRoots()) { - try { - final file = File('$root/.GC/ui-backend.json'); - try { - final logFile = File('${Directory.systemTemp.path}/gc-api-debug.log'); - logFile.writeAsStringSync('[api] 检查: $root/.GC/ui-backend.json (exists=${file.existsSync()})\n', mode: FileMode.append); - } catch (_) {} - if (!file.existsSync()) continue; - - // 只认 24 小时内的记录:更早的多半是上次遗留,连过去只会得到「无法连接」 - final age = DateTime.now().difference(file.lastModifiedSync()); - if (age.inHours >= 24) continue; - - final decoded = jsonDecode(file.readAsStringSync()); - if (decoded is! Map) continue; - - String? url; - final rawUrl = decoded['url']; - if (rawUrl is String && rawUrl.startsWith('http://127.0.0.1:')) { - url = rawUrl; - } else { - final port = (decoded['port'] as num?)?.toInt(); - if (port != null && port > 0 && port < 65536) { - url = 'http://127.0.0.1:$port'; - } - } - if (url == null) continue; - - final token = decoded['token']; - return _endpoint = _Endpoint(url, token is String && token.isNotEmpty ? token : null); - } catch (_) { - // 文件损坏 / 无权限:试下一个候选目录 - } - } - return _endpoint = null; - } - - /// 重新解析后端地址与令牌(后端重启换端口、或环境变量缺失时用)。 - /// 返回 true 表示地址或令牌发生了变化,值得重试一次。 - bool rediscover() { - final before = (_endpoint?.url, _sessionToken); - _endpoint = null; - final endpoint = _readEndpointFile(refresh: true); - - if (endpoint?.token != null && endpoint!.token != _sessionToken) { - _sessionToken = endpoint.token; - } - - final envUrl = Platform.environment['GC_UI_BASE_URL']; - final envPort = int.tryParse(Platform.environment['GC_UI_PORT'] ?? ''); - final resolved = (envUrl != null && envUrl.isNotEmpty) - ? envUrl - : (envPort != null - ? 'http://127.0.0.1:$envPort' - : (endpoint?.url ?? 'http://127.0.0.1:$fallbackPort')); - - if (resolved != baseUrl) { - baseUrl = resolved; - return true; - } - return (before.$1 != _endpoint?.url) || (before.$2 != _sessionToken); - } - - /// 启动器注入的一次性会话令牌:环境变量优先,其次握手文件。 - /// 后端在发布包模式下校验它,防止前端连到同机伪造的「后端」。 - static String? _sessionToken = _readSessionToken(); - - static String? _readSessionToken() { - const fromDefine = String.fromEnvironment('GC_UI_TOKEN'); - if (fromDefine.isNotEmpty) return fromDefine; - final fromEnv = Platform.environment['GC_UI_TOKEN']; - if (fromEnv != null && fromEnv.isNotEmpty) return fromEnv; - // 环境变量没传进来(Finder 直接打开 GC-UI.app):用握手文件里的令牌 - return _readEndpointFile()?.token; - } - - /// 是否拿到了会话令牌(诊断用)。 - bool get hasSessionToken => _sessionToken != null; - - /// 用户 session token:登录时后端返回,只放内存。 - /// 持久化由后端负责(写 .GC/user/user.yaml),下次启动后端会用它自动登录, - /// 前端不需要自己去猜 .GC 在哪。 - static String? _userToken; - static String? get userToken => _userToken; - - /// 带会话令牌的请求头;没有令牌时返回 const 空 map(调试/独立后端模式)。 - Map get _authHeaders => { - if (_sessionToken != null) 'X-GC-UI-Token': _sessionToken!, - if (_userToken != null) 'X-User-Token': _userToken!, - }; - - Uri _uri(String path, [Map? query]) => - Uri.parse('$baseUrl$path').replace(queryParameters: query); - - Future _send(String method, String path, - {Map? query, - Object? body, - Duration? timeout}) async { - try { - return await _sendOnce(method, path, - query: query, body: body, timeout: timeout); - } on ApiException catch (e) { - // HTTP 层错误(后端明确回了 4xx/5xx)不是连接问题,直接抛。 - if (e.statusCode != null) rethrow; - // 连接层失败:可能是电脑睡眠唤醒后旧连接已死,或后端换了端口。 - // 重新解析地址后重试一次。只对 GET 自动重试——POST(签到/扣积分) - // 在连接不确定的情况下重发可能重复计费,宁可让用户手动再点。 - if (method != 'GET') rethrow; - if (!rediscover()) rethrow; - return await _sendOnce(method, path, - query: query, body: body, timeout: timeout); - } - } - - Future _sendOnce(String method, String path, - {Map? query, - Object? body, - Duration? timeout}) async { - final uri = _uri(path, query); - final auth = _authHeaders; - late http.Response response; - try { - switch (method) { - case 'GET': - response = await _client.get(uri, headers: auth) - .timeout(timeout ?? const Duration(seconds: 30)); - break; - case 'POST': - response = await _client - .post(uri, - headers: {...auth, 'Content-Type': 'application/json'}, - body: body == null ? null : jsonEncode(body)) - .timeout(timeout ?? const Duration(seconds: 120)); - break; - case 'DELETE': - response = await _client.delete(uri, headers: auth) - .timeout(timeout ?? const Duration(seconds: 30)); - break; - default: - throw ApiException('不支持的方法 $method'); - } - } on ApiException { - rethrow; - } catch (error) { - throw ApiException('无法连接后端($baseUrl):$error'); - } - - final text = utf8.decode(response.bodyBytes); - dynamic decoded; - if (text.isNotEmpty) { - try { - decoded = jsonDecode(text); - } catch (_) { - decoded = null; - } - } - - if (response.statusCode >= 400) { - final message = decoded is Map - ? (decoded['message'] as String? ?? 'HTTP ${response.statusCode}') - : 'HTTP ${response.statusCode}'; - throw ApiException(message, statusCode: response.statusCode); - } - - return decoded; - } - - List> _asList(dynamic value) => - (value as List? ?? const []) - .map((e) => e as Map) - .toList(); - - Future health() async => - HealthInfo.fromJson(await _send('GET', '/api/health') as Map); - - Future> models() async => - _asList(await _send('GET', '/api/models')).map(ModelInfo.fromJson).toList(); - - Future launchModel(String id) async => ActionResult.fromJson( - await _send('POST', '/api/models/$id/launch') as Map); - - Future deleteModel(String id) async => ActionResult.fromJson( - await _send('DELETE', '/api/models/$id') as Map); - - Future settings() async => - SettingsInfo.fromJson(await _send('GET', '/api/settings') as Map); - - Future saveSettings(SettingsPatch patch) async => - SettingsInfo.fromJson(await _send('POST', '/api/settings', body: patch.toJson()) - as Map); - - Future> sources() async => - _asList(await _send('GET', '/api/sources')).map(SourceInfo.fromJson).toList(); - - Future remoteModels({String? sourceId, bool force = false}) async => - SourceIndexInfo.fromJson(await _send('GET', '/api/remote/models', query: { - if (sourceId != null) 'sourceId': sourceId, - 'force': force.toString(), - }) as Map); - - /// 重新下载本机启动器包,返回时后端已完成 sha256 完整性校验。 - Future redownloadLauncher() async => - LauncherRedownloadInfo.fromJson(await _send( - 'POST', - '/api/launcher/redownload', - timeout: const Duration(minutes: 10), - ) as Map); - - Future> jobs() async => - _asList(await _send('GET', '/api/download/jobs')).map(JobInfo.fromJson).toList(); - - Future startDownload(String sourceId, String modelId) async => - JobInfo.fromJson(await _send('POST', '/api/download', - body: {'sourceId': sourceId, 'modelId': modelId}) as Map); - - Future cancelJob(String id) async => JobInfo.fromJson( - await _send('POST', '/api/download/$id/cancel') as Map); - - Future retryJob(String id) async => JobInfo.fromJson( - await _send('POST', '/api/download/$id/retry') as Map); - - Future removeJob(String id) async => JobInfo.fromJson( - await _send('POST', '/api/download/$id/remove') as Map); - - Future clearFinished() async => ActionResult.fromJson( - await _send('POST', '/api/download/clear-finished') as Map); - - Future checkUpdate({bool force = true}) async => - UpdateCheckInfo.fromJson( - await _send('POST', '/api/update/check', body: {'force': force}) - as Map); - - Future about() async => - AboutInfo.fromJson(await _send('GET', '/api/about') as Map); - - Future openFolder(String path) async => ActionResult.fromJson( - await _send('POST', '/api/shell/open-folder', body: {'path': path}) - as Map); - - Future openUrl(String url) async => ActionResult.fromJson( - await _send('POST', '/api/shell/open-url', body: {'url': url}) - as Map); - - /// 模型封面图地址(直接给 Image.network 用,带不上自定义头,令牌走 query 参数)。 - String previewUrl(ModelInfo model) { - if (_sessionToken == null) return '$baseUrl${model.previewUrl}'; - final uri = Uri.parse('$baseUrl${model.previewUrl}'); - return uri.replace(queryParameters: { - ...uri.queryParameters, - 'X-GC-UI-Token': _sessionToken!, - }).toString(); - } - - // ==================== 用户系统 ==================== - - /// 取一个人机验证题(算术题,5 分钟内有效、一次性)。 - Future captcha() async { - final r = await _send('GET', '/api/user/captcha'); - return CaptchaInfo.fromJson(r as Map); - } - - /// 当前登录用户;未登录返回 null(后端会用 .GC/user/user.yaml 自动登录)。 - Future?> me() async { - try { - final r = await _send('GET', '/api/user/me'); - return r as Map?; - } on ApiException catch (e) { - if (e.statusCode == 401 || e.statusCode == 403) { - _userToken = null; - return null; - } - rethrow; - } - } - - Future> register(String username, String password, - {required String captchaId, required String captchaAnswer}) async { - final r = await _send('POST', '/api/user/register', body: { - 'username': username, - 'password': password, - 'captchaId': captchaId, - 'captcha': captchaAnswer, - }); - return r as Map; - } - - Future> login(String username, String password) async { - final r = await _send('POST', '/api/user/login', - body: {'username': username, 'password': password}); - final result = r as Map; - _userToken = result['session_token'] as String?; - return result; - } - - /// 退出登录:清掉后端的 user.yaml 与内存 token。 - Future logout() async { - try { - await _send('POST', '/api/user/logout'); - } catch (_) { - // 后端连不上也要让界面退出 - } - _userToken = null; - } - - Future> signin() async { - final r = await _send('POST', '/api/user/signin'); - return r as Map; - } - - /// 换主题色:只传颜色,价格由后端判定(预置 50 / 自定义 150)。 - Future> changeTheme(String color) async { - final r = await _send('POST', '/api/user/theme', body: {'color': color}); - return r as Map; - } - - /// 摇人品值。价格由后端算:当天第一次免费,之后按当日次数阶梯计费。 - Future> rollFortune() async { - final r = await _send('POST', '/api/user/fortune'); - return r as Map; - } - - /// 二选一。当天第一次免费,之后每次 0.5 积分。 - Future> pickOne(String optionA, String optionB) async { - final r = await _send('POST', '/api/user/pick', - body: {'optionA': optionA, 'optionB': optionB}); - return r as Map; - } -} - -/// 人机验证题 -class CaptchaInfo { - const CaptchaInfo({required this.id, required this.question}); - - final String id; - final String question; - - factory CaptchaInfo.fromJson(Map json) => CaptchaInfo( - id: json['id'] as String? ?? '', - question: json['question'] as String? ?? '', - ); -} diff --git a/GC-UI/frontend/lib/controller.dart b/GC-UI/frontend/lib/controller.dart deleted file mode 100644 index 727b08d..0000000 --- a/GC-UI/frontend/lib/controller.dart +++ /dev/null @@ -1,210 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/foundation.dart'; - -import 'api_client.dart'; -import 'i18n.dart'; -import 'theme.dart'; - -/// 外壳状态:后端客户端 + 设置 + 健康状态 + 更新状态条。 -/// -/// 各页面只读这里的数据、通过这里的方法改后端,避免每页各持一份状态。 -class ShellController extends ChangeNotifier { - ShellController({GcApi? api}) : api = api ?? GcApi(); - - final GcApi api; - - int index = 0; - SettingsInfo? settings; - HealthInfo? health; - String? loadError; - - bool updateBarVisible = false; - bool updateBusy = false; - double updateProgress = 0; - String updateStatus = ''; - String updateDetail = ''; - String launcherNotice = ''; - - /// 模型库版本号:安装 / 删除 / 下载完成后自增,首页据此重新拉列表。 - /// - /// 首页被 `Offstage` 保活,切走再切回不会重建;没有这个信号时, - /// 下载完模型回到首页仍然显示旧的空列表。 - int modelsRevision = 0; - - Timer? _retryTimer; - int _retryAttempt = 0; - - bool get backendReady => settings != null; - - Future bootstrap() async { - _retryTimer?.cancel(); - - HealthInfo? healthResult; - SettingsInfo? settingsResult; - Object? firstError; - - // 两个请求互不依赖,并行发;各自捕获异常,避免一方失败时 - // 另一个的 Future 抛成未处理异常(Flutter 会在控制台打出恶性警告)。 - await Future.wait(>[ - () async { - try { - healthResult = await api.health(); - } catch (error) { - firstError ??= error; - } - }(), - () async { - try { - settingsResult = await api.settings(); - } catch (error) { - firstError ??= error; - } - }(), - ]); - - if (healthResult != null) health = healthResult; - if (settingsResult != null) { - settings = settingsResult; - _applySettings(settingsResult!); - // 主题色现在归用户账号所有(设置页不再提供),启动时按当前用户恢复 - unawaited(_applyUserTheme()); - } - - if (firstError != null && settingsResult == null) { - loadError = firstError.toString(); - _scheduleRetry(); - } else { - loadError = null; - _retryAttempt = 0; - } - - notifyListeners(); - } - - /// 后端没起来时自动重试(1s、2s、4s、之后每次 8s,共 10 次 ≈ 70 秒), - /// 不必让用户手动点。重试前 rediscover() 重新解析地址与令牌。 - void _scheduleRetry() { - if (_retryAttempt >= 10) return; - final seconds = 1 << _retryAttempt.clamp(0, 3); // 1,2,4,8,8,8…(封顶 8s) - _retryAttempt++; - _retryTimer?.cancel(); - _retryTimer = Timer(Duration(seconds: seconds), () { - if (settings == null) { - // 后端可能刚换端口(端口占用)或刚写好握手文件:重试前重新解析一次 - api.rediscover(); - bootstrap(); - } - }); - } - - void _applySettings(SettingsInfo value) { - I18n.setLanguage(value.language); - // 强调色不再来自设置:由用户账号的 theme_color 决定(见 _applyUserTheme) - GcPalette.applyTheme(value.theme); - } - - /// 按当前登录用户的 theme_color 应用强调色;未登录时保持默认。 - Future applyUserTheme() => _applyUserTheme(); - - Future _applyUserTheme() async { - try { - final resp = await api.me(); - final hex = resp?['theme_color'] as String?; - if (hex != null && hex.isNotEmpty) GcPalette.apply('#$hex'); - } catch (_) { - // 后端没起来或未登录:保持当前颜色即可 - } - } - - void goTo(int value) { - if (index == value) return; - index = value; - notifyListeners(); - } - - // 模型视图已回退为后端开 Avalonia 独立窗口(见 AvaloniaHost), - // Flutter 内嵌的 activeModelId / openModel / ModelViewPage 一套已移除。 - - /// 模型库有变化(安装 / 删除 / 下载完成):通知首页刷新。 - void modelsChanged() { - modelsRevision++; - notifyListeners(); - } - - Future reloadSettings() async { - try { - settings = await api.settings(); - loadError = null; - _applySettings(settings!); - } catch (error) { - loadError = error.toString(); - } - notifyListeners(); - } - - Future saveSettings(SettingsPatch patch) async { - try { - settings = await api.saveSettings(patch); - loadError = null; - _applySettings(settings!); - } catch (error) { - loadError = error.toString(); - } - notifyListeners(); - } - - void setUpdateStatus({ - bool? visible, - bool? busy, - double? progress, - String? status, - String? detail, - String? notice, - }) { - if (visible != null) updateBarVisible = visible; - if (busy != null) updateBusy = busy; - if (progress != null) updateProgress = progress; - if (status != null) updateStatus = status; - if (detail != null) updateDetail = detail; - if (notice != null) launcherNotice = notice; - notifyListeners(); - } - - /// 检查模型 / 启动器更新(设置页与状态条共用)。 - Future checkUpdate({bool force = true}) async { - if (updateBusy) return; - setUpdateStatus( - visible: true, - busy: true, - progress: 0, - status: T('update.checking'), - detail: '', - notice: '', - ); - - try { - final result = await api.checkUpdate(force: force); - setUpdateStatus( - busy: false, - progress: 1, - status: result.message.isEmpty ? T('update.done') : result.message, - detail: result.error ?? '', - notice: result.launcherMessage ?? '', - ); - if (result.updatedModels > 0) modelsChanged(); - } catch (error) { - setUpdateStatus( - busy: false, - status: T('update.offline'), - detail: error.toString(), - ); - } - } - - @override - void dispose() { - _retryTimer?.cancel(); - super.dispose(); - } -} diff --git a/GC-UI/frontend/lib/i18n.dart b/GC-UI/frontend/lib/i18n.dart deleted file mode 100644 index e5a7d7e..0000000 --- a/GC-UI/frontend/lib/i18n.dart +++ /dev/null @@ -1,430 +0,0 @@ -import 'package:flutter/widgets.dart'; - -/// 轻量 i18n:键值表 + 运行时切换,和后端 `GC/src/Assets/i18n/*.json` 的键保持一致。 -class I18n { - I18n._(); - - static const List supported = ['zh-CN', 'en']; - - static final ValueNotifier language = ValueNotifier('zh-CN'); - - static const Map> _tables = >{ - 'zh-CN': { - 'app.name': 'Morris GC', - 'app.tagline': '天文教学模型 · 可视化启动器', - 'nav.home': '主页', - 'nav.courseware': '等高线课件', - 'nav.download': '下载', - 'nav.settings': '设置', - 'nav.about': '关于', - 'nav.user': '用户', - 'home.title': '模型库', - 'home.subtitle': '选择模型,用可交互的三维演示讲清自转、公转与四季成因。', - 'home.launch': '启动模型', - 'home.download': '下载模型', - 'home.settings': '设置', - 'home.installed': '已安装模型', - 'home.count': '{0} 个模型', - 'home.noDescription': '暂无简介', - 'home.empty': '模型库还是空的', - 'home.emptyHint': '启动时会自动检查并下载模型。若当前断网:可把模型文件夹放进 .GC/model/ 后重新打开,或联网后在「下载」页点重试。', - 'home.emptyAction': '去下载模型', - 'home.open': '打开目录', - 'home.delete': '删除', - 'home.deleteConfirm': '删除模型「{0}」?模型文件会从本地模型库移除。', - 'home.stats.models': '已安装', - 'home.stats.sources': '模型源', - 'home.stats.memory': '内存预算', - 'home.recent': '选择模型后点击「启动模型」', - 'home.noBuiltin': '「{0}」暂时没有内置渲染实现', - 'model.back': '返回', - 'model.missing': '这个模型还没有 Flutter 实现', - 'model.missingHint': '模型窗口已全部改为应用内渲染,该模型暂未迁移。', - 'home.launchHint': '模型直接在应用内运行,可播放/暂停、切换视角并使用教学要点。', - 'dl.title': '下载模型', - 'dl.subtitle': '从内置模型源读取可下载模型;模型源在「设置」里查看。', - 'dl.sources': '模型源', - 'dl.refresh': '刷新', - 'dl.available': '可用模型', - 'dl.download': '下载', - 'dl.installed': '已安装', - 'dl.reinstall': '重新下载', - 'dl.background': '后台任务', - 'dl.bgEmpty': '暂无后台任务', - 'dl.cancel': '取消', - 'dl.retry': '重试', - 'dl.clearDone': '清除已完成', - 'dl.removeTask': '移除', - 'dl.status.queued': '排队中', - 'dl.status.downloading': '下载中', - 'dl.status.done': '已完成', - 'dl.status.failed': '失败', - 'dl.status.canceled': '已取消', - 'dl.empty': '这个源里没有模型', - 'dl.emptyHint': '仓库需要包含 model/<模型ID>/<模型ID>.json 结构', - 'dl.syncing': '正在读取模型源…', - 'dl.ready': '共 {0} 个模型', - 'dl.fromCache': '本地缓存', - 'dl.pickSource': '选择一个模型源,查看可下载的模型', - 'set.title': '设置', - 'set.subtitle': '模型源、启动时内存分配与本地存储。', - 'set.general': '通用', - 'set.appearance': '外观', - 'set.theme': '主题模式', - 'set.theme.desc': '深色、浅色,或跟随系统设置。', - 'set.theme.dark': '深色', - 'set.theme.light': '浅色', - 'set.theme.system': '跟随系统', - 'set.language': '界面语言', - 'set.language.auto': '跟随系统', - 'set.fps': '渲染帧率', - 'set.fps.desc': '越高越顺滑,CPU 占用也越高。', - 'set.memory': '启动时运行内存分配', - 'set.memory.desc': '启动器把这份预算交给模型:模型自己决定用它缓存多少数据(贴图分辨率、缓冲等)。', - 'set.memory.current': '当前占用', - 'set.memory.auto': '自动(根据设备内存分配)', - 'set.memory.hint': '建议 2048 MB 以上,低配设备可选 1024 MB。', - 'set.sources': '模型源', - 'set.sources.desc': '停用的模型源不会出现在下载页。', - 'set.sourceEnabled': '启用', - 'set.storage': '存储', - 'set.modelDir': '模型库目录', - 'set.dataDir': '数据目录', - 'set.openFolder': '打开文件夹', - 'set.clearCache': '清理缓存', - 'set.cacheCleared': '缓存已清理', - 'set.about': '关于', - 'set.version': '版本', - 'set.platform': '平台', - 'set.license': '许可', - 'set.licenseValue': 'MIT', - 'set.checkUpdate': '检查更新', - 'set.checkUpdate.desc': '启动时自动检查模型与启动器是否为最新版。', - 'set.backend': '后端服务', - 'set.backend.desc': '界面(Flutter)与后端(.NET)分离,后端只监听本机回环地址。', - 'set.backend.ui': '模型窗口宿主', - 'set.backend.uiOk': '可用', - 'set.backend.uiBad': '不可用', - 'update.title': '自动更新', - 'update.auto': '启动时自动检查更新', - 'update.checkNow': '检查更新', - 'update.source': '更新源', - 'update.lastCheck': '上次检查', - 'update.never': '尚未检查', - 'update.none': '无', - 'update.checking': '正在检查更新…', - 'update.offline': '暂时无法连接更新服务器,继续使用本地模型', - 'update.noChange': '模型与启动器均为最新版', - 'update.applied': '已更新 {0} 个模型,立即生效', - 'update.done': '更新检查完成', - 'update.pendingReady': '启动器新版 {0} 已就绪,下次启动生效', - 'common.cancel': '取消', - 'common.confirm': '确定', - 'common.delete': '删除', - 'common.close': '关闭', - 'common.open': '打开', - 'common.applied': '已应用', - 'common.confirmTitle': '请确认', - 'common.retry': '重试', - 'common.loading': '加载中…', - 'common.error': '出错了', - 'common.refresh': '刷新', - 'about.developers': '开发者', - 'about.contributorsHint': '来自仓库提交记录', - 'about.repository': '仓库', - 'about.openRepository': '打开仓库', - 'about.redownload': '重新下载启动器', - 'about.redownloading': '正在下载并校验…', - 'about.redownloadOk': '已下载 v{0},完整性校验通过(sha256 一致),重启后生效', - 'about.redownloadFail': '重新下载失败', - 'about.contributions': '{0} 次提交', - 'about.noContributors': '暂无贡献者信息', - 'about.architecture': '架构', - 'about.architectureValue': 'Flutter 前端 + .NET 后端(本地 HTTP)', - 'about.sourceLanguage': '源码语言', - 'about.frontend': '前端', - 'about.gitService': 'Git 服务', - 'about.thanks': '感谢', - 'about.thanksHint': '特别感谢以下朋友的支持', - 'about.thanksGit': 'Git 服务与部署支持', - 'about.thanksGeo': '地理学科内容指导', - 'user.points': '积分', - 'user.days': '连续签到', - 'user.signin': '签到', - 'user.login': '登录', - 'user.register': '注册', - 'user.pick': '二选一', - 'user.themeColor': '主题颜色', - 'user.username': '用户名', - 'user.password': '密码', - 'user.option1': '选项一', - 'user.option2': '选项二', - 'user.pickRandom': '随机选择', - 'user.switchToRegister': '没有账号?去注册', - 'user.switchToLogin': '已有账号?去登录', - 'user.loginSuccess': '登录成功', - 'user.registerSuccess': '注册成功', - 'user.signinSuccess': '签到成功', - 'user.alreadySigned': '今天已经签到过了', - 'user.fillAll': '请填写用户名和密码', - 'user.fillOptions': '请填写两个选项', - 'user.loginFirst': '请先登录', - 'user.notLoggedIn': '未登录', - 'user.loginHint': '登录后可签到攒积分、解锁主题色', - 'user.logout': '退出登录', - 'user.logoutDone': '已退出登录', - 'user.cycleDay': '第 {0} / {1} 天', - 'user.signedToday': '今天已签到,明天再来', - 'user.signedTodayShort': '已签到', - 'user.nextReward': '现在签到可得 {0} 积分', - 'user.refunded': '已退回', - 'user.usernameRule': '1–20 个字符,不能有空格,不能与他人重复', - 'user.captcha': '人机验证', - 'user.captchaMissing': '请先获取人机验证题', - 'user.captchaAnswer': '验证码答案', - 'user.fillCaptcha': '请填写验证码答案', - 'user.refreshCaptcha': '换一题', - 'user.noRecharge': '积分只能通过每日签到获得,不提供任何充值渠道。', - 'user.fortune': '人品值', - 'user.fortuneDesc': '每天可以无限次计算,纯属娱乐,不影响积分。', - 'user.fortuneIdle': '点一下,看看今天手气', - 'user.fortuneRoll': '开始计算', - 'user.fortuneAgain': '再算一次', - 'user.pickDesc': '填两个选项,随机帮你选一个。', - 'user.pickResult': '结果:', - 'user.themeDesc': '默认蓝色免费;预置色 50 积分一个,自定义色 150 积分一个。', - 'user.custom': '自定义', - 'user.customColor': '自定义颜色', - 'user.customColorCost': '自定义颜色需要 {0} 积分。', - 'user.confirmBuy': '购买并应用', - 'user.hexInvalid': '格式应为 #RRGGBB', - 'user.free': '免费', - 'user.themeUpdated': '主题色已更新', - 'user.refundHint': '1 小时内换色可退 80%,当前可退(剩余 {0})', - 'user.minutes': '分钟', - 'user.seconds': '秒', - }, - 'en': { - 'app.name': 'Morris GC', - 'app.tagline': 'Astronomy teaching models · visual launcher', - 'nav.home': 'Home', - 'nav.courseware': 'Contour Course', - 'nav.download': 'Download', - 'nav.settings': 'Settings', - 'nav.about': 'About', - 'nav.user': 'User', - 'home.title': 'Model library', - 'home.subtitle': 'Pick a model and explain rotation, revolution and the seasons with an interactive 3D scene.', - 'home.launch': 'Launch model', - 'home.download': 'Get models', - 'home.settings': 'Settings', - 'home.installed': 'Installed models', - 'home.count': '{0} models', - 'home.noDescription': 'No description', - 'home.empty': 'No models yet', - 'home.emptyHint': 'Models are checked and downloaded on startup. Offline: drop model folders into .GC/model/ and reopen, or retry from the Download page once online.', - 'home.emptyAction': 'Get models', - 'home.open': 'Open folder', - 'home.delete': 'Delete', - 'home.deleteConfirm': 'Delete the model "{0}"? Its files will be removed from the local library.', - 'home.stats.models': 'Installed', - 'home.stats.sources': 'Sources', - 'home.stats.memory': 'Memory budget', - 'home.recent': 'Select a model, then press Launch', - 'home.noBuiltin': '"{0}" has no built-in renderer yet', - 'model.back': 'Back', - 'model.missing': 'No Flutter renderer for this model', - 'model.missingHint': 'Model windows are rendered in-app now; this model has not been migrated yet.', - 'home.launchHint': 'Models render inside the app with play/pause, view controls and teaching notes.', - 'dl.title': 'Download', - 'dl.subtitle': 'Read downloadable models from the built-in sources; manage sources in Settings.', - 'dl.sources': 'Sources', - 'dl.refresh': 'Refresh', - 'dl.available': 'Available models', - 'dl.download': 'Download', - 'dl.installed': 'Installed', - 'dl.reinstall': 'Re-download', - 'dl.background': 'Background tasks', - 'dl.bgEmpty': 'No background tasks', - 'dl.cancel': 'Cancel', - 'dl.retry': 'Retry', - 'dl.clearDone': 'Clear finished', - 'dl.removeTask': 'Remove', - 'dl.status.queued': 'Queued', - 'dl.status.downloading': 'Downloading', - 'dl.status.done': 'Completed', - 'dl.status.failed': 'Failed', - 'dl.status.canceled': 'Canceled', - 'dl.empty': 'No models in this source', - 'dl.emptyHint': 'A source needs model//.json layout', - 'dl.syncing': 'Reading model source…', - 'dl.ready': '{0} models', - 'dl.fromCache': 'cached', - 'dl.pickSource': 'Select a source to see available models', - 'set.title': 'Settings', - 'set.subtitle': 'Model sources, startup memory allocation and local storage.', - 'set.general': 'General', - 'set.appearance': 'Appearance', - 'set.theme': 'Theme mode', - 'set.theme.desc': 'Dark, light, or follow the system setting.', - 'set.theme.dark': 'Dark', - 'set.theme.light': 'Light', - 'set.theme.system': 'System', - 'set.language': 'Language', - 'set.language.auto': 'System', - 'set.fps': 'Render frame rate', - 'set.fps.desc': 'Higher is smoother but uses more CPU.', - 'set.memory': 'Startup memory allocation', - 'set.memory.desc': 'The launcher hands this budget to each model; models decide how much data to cache with it.', - 'set.memory.current': 'In use', - 'set.memory.auto': 'Auto (allocate based on device memory)', - 'set.memory.hint': '2048 MB or more is recommended; 1024 MB for low-end devices.', - 'set.sources': 'Model sources', - 'set.sources.desc': 'Disabled sources are hidden from the Download page.', - 'set.sourceEnabled': 'Enabled', - 'set.storage': 'Storage', - 'set.modelDir': 'Model library', - 'set.dataDir': 'Data folder', - 'set.openFolder': 'Open folder', - 'set.clearCache': 'Clear cache', - 'set.cacheCleared': 'Cache cleared', - 'set.about': 'About', - 'set.version': 'Version', - 'set.platform': 'Platform', - 'set.license': 'License', - 'set.licenseValue': 'MIT', - 'set.checkUpdate': 'Check for updates', - 'set.checkUpdate.desc': 'Check on startup whether models and the launcher are up to date.', - 'set.backend': 'Backend service', - 'set.backend.desc': 'The UI (Flutter) and the backend (.NET) are separate; the backend only listens on loopback.', - 'set.backend.ui': 'Model window host', - 'set.backend.uiOk': 'available', - 'set.backend.uiBad': 'unavailable', - 'update.title': 'Auto update', - 'update.auto': 'Check for updates on startup', - 'update.checkNow': 'Check now', - 'update.source': 'Update source', - 'update.lastCheck': 'Last check', - 'update.never': 'Never', - 'update.none': 'None', - 'update.checking': 'Checking for updates…', - 'update.offline': 'Update server unavailable — continuing with local models', - 'update.noChange': 'Models and launcher are up to date', - 'update.applied': 'Updated {0} models, applied now', - 'update.done': 'Update check complete', - 'update.pendingReady': 'Launcher {0} is ready, applies on next start', - 'common.cancel': 'Cancel', - 'common.confirm': 'Confirm', - 'common.delete': 'Delete', - 'common.close': 'Close', - 'common.open': 'Open', - 'common.applied': 'Applied', - 'common.confirmTitle': 'Please confirm', - 'common.retry': 'Retry', - 'common.loading': 'Loading…', - 'common.error': 'Something went wrong', - 'common.refresh': 'Refresh', - 'about.developers': 'Developers', - 'about.contributorsHint': 'From repository commits', - 'about.repository': 'Repository', - 'about.openRepository': 'Open repository', - 'about.redownload': 'Re-download launcher', - 'about.redownloading': 'Downloading and verifying…', - 'about.redownloadOk': 'Downloaded v{0}, integrity verified (sha256 matched); applies after restart', - 'about.redownloadFail': 'Re-download failed', - 'about.contributions': '{0} commits', - 'about.noContributors': 'No contributor information', - 'about.architecture': 'Architecture', - 'about.architectureValue': 'Flutter frontend + .NET backend (local HTTP)', - 'about.sourceLanguage': 'Source language', - 'about.frontend': 'Frontend', - 'about.gitService': 'Git hosting', - 'about.thanks': 'Thanks', - 'about.thanksHint': 'Special thanks to', - 'about.thanksGit': 'Git hosting and deployment', - 'about.thanksGeo': 'Geography content guidance', - 'user.points': 'Points', - 'user.days': 'Streak', - 'user.signin': 'Sign In', - 'user.login': 'Login', - 'user.register': 'Register', - 'user.pick': 'Pick One', - 'user.themeColor': 'Theme Color', - 'user.username': 'Username', - 'user.password': 'Password', - 'user.option1': 'Option A', - 'user.option2': 'Option B', - 'user.pickRandom': 'Random', - 'user.switchToRegister': 'No account? Register', - 'user.switchToLogin': 'Have account? Login', - 'user.loginSuccess': 'Login successful', - 'user.registerSuccess': 'Registration successful', - 'user.signinSuccess': 'Signed in', - 'user.alreadySigned': 'Already signed in today', - 'user.fillAll': 'Please fill in username and password', - 'user.fillOptions': 'Please fill in both options', - 'user.loginFirst': 'Please login first', - 'user.notLoggedIn': 'Not signed in', - 'user.loginHint': 'Sign in to earn points and unlock theme colors', - 'user.logout': 'Sign out', - 'user.logoutDone': 'Signed out', - 'user.cycleDay': 'Day {0} / {1}', - 'user.signedToday': 'Signed in today, come back tomorrow', - 'user.signedTodayShort': 'Signed', - 'user.nextReward': 'Sign in now for {0} points', - 'user.refunded': 'refunded', - 'user.usernameRule': '1–20 chars, no spaces, must be unique', - 'user.captcha': 'Verification', - 'user.captchaMissing': 'Please load the verification question first', - 'user.captchaAnswer': 'Answer', - 'user.fillCaptcha': 'Please answer the verification question', - 'user.refreshCaptcha': 'New question', - 'user.noRecharge': 'Points come from daily check-ins only. There is no way to buy points.', - 'user.fortune': 'Luck Meter', - 'user.fortuneDesc': 'Unlimited rolls per day. Just for fun — no points involved.', - 'user.fortuneIdle': 'Tap to see how lucky you are today', - 'user.fortuneRoll': 'Roll', - 'user.fortuneAgain': 'Roll again', - 'user.pickDesc': 'Two options, one random pick.', - 'user.pickResult': 'Result:', - 'user.themeDesc': 'Default blue is free; preset colors cost 50, custom colors 150.', - 'user.custom': 'Custom', - 'user.customColor': 'Custom color', - 'user.customColorCost': 'A custom color costs {0} points.', - 'user.confirmBuy': 'Buy & apply', - 'user.hexInvalid': 'Format must be #RRGGBB', - 'user.free': 'Free', - 'user.themeUpdated': 'Theme color updated', - 'user.refundHint': 'Change within 1 hour for a 80% refund (left {0})', - 'user.minutes': 'min', - 'user.seconds': 's', - }, - }; - - /// 取一条文案;`{0}` 这类占位符用 [args] 填充。 - static String t(String key, [List args = const []]) { - final table = _tables[language.value] ?? _tables['zh-CN']!; - var text = table[key] ?? _tables['zh-CN']![key] ?? key; - for (var i = 0; i < args.length; i++) { - text = text.replaceAll('{$i}', '${args[i]}'); - } - return text; - } - - /// 把后端语言设置(auto / zh-CN / en)解析成实际语言。 - static String resolve(String? preference) { - if (preference != null && preference.isNotEmpty && preference != 'auto') { - return preference.startsWith('en') ? 'en' : 'zh-CN'; - } - final locale = WidgetsBinding.instance.platformDispatcher.locale; - return locale.languageCode == 'zh' ? 'zh-CN' : 'en'; - } - - static void setLanguage(String code) { - final resolved = resolve(code); - if (language.value != resolved) language.value = resolved; - } -} - -/// 便捷取词:`T('nav.home')`。 -String T(String key, [List args = const []]) => I18n.t(key, args); diff --git a/GC-UI/frontend/lib/main.dart b/GC-UI/frontend/lib/main.dart deleted file mode 100644 index 96286a5..0000000 --- a/GC-UI/frontend/lib/main.dart +++ /dev/null @@ -1,69 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'controller.dart'; -import 'i18n.dart'; -import 'shell.dart'; -import 'theme.dart'; - -void main() { - // 桌面端无需异步初始化外部插件:尽早绑定并直接渲染首帧, - // 让窗口在引擎就绪后立刻出现,后端探测在外壳里异步进行。 - WidgetsFlutterBinding.ensureInitialized(); - runApp(const GcUiApp()); -} - -/// GC-UI 前端:Flutter 桌面应用(Windows / macOS / Linux)。 -/// -/// 界面全部在这里;模型扫描、下载、更新、设置、模型窗口宿主都在后端 -/// (GC-UI/backend/GC.UI.Server,本地 HTTP 服务)。 -class GcUiApp extends StatefulWidget { - const GcUiApp({super.key}); - - @override - State createState() => _GcUiAppState(); -} - -class _GcUiAppState extends State { - final ShellController _controller = ShellController(); - - @override - Widget build(BuildContext context) { - // 语言、强调色、主题模式都会触发重建:只重建 MaterialApp 的主题层, - // 不触碰页面状态(页面由 ShellPage 自己持有)。 - return ValueListenableBuilder( - valueListenable: I18n.language, - builder: (context, language, _) { - return ValueListenableBuilder( - valueListenable: GcPalette.accent, - builder: (context, accent, _) { - return ValueListenableBuilder( - valueListenable: GcPalette.mode, - builder: (context, mode, _) { - return MaterialApp( - title: 'Morris GC', - debugShowCheckedModeBanner: false, - // 桌面端不要移动端那套拉伸回弹和边缘光晕。 - scrollBehavior: const GcScrollBehavior(), - theme: buildGcTheme(Brightness.light), - darkTheme: buildGcTheme(Brightness.dark), - themeMode: mode, - // GcColors 是静态取值,必须按当前实际亮度(含跟随系统)绑定, - // 再用 key 强制子树重建,否则切主题后颜色仍是上一套。 - builder: (context, child) { - final brightness = Theme.of(context).brightness; - GcColors.bind(brightness); - return KeyedSubtree( - key: ValueKey(brightness == Brightness.dark), - child: child ?? const SizedBox.shrink(), - ); - }, - home: ShellPage(controller: _controller), - ); - }, - ); - }, - ); - }, - ); - } -} diff --git a/GC-UI/frontend/lib/models/user.dart b/GC-UI/frontend/lib/models/user.dart deleted file mode 100644 index 942448d..0000000 --- a/GC-UI/frontend/lib/models/user.dart +++ /dev/null @@ -1,164 +0,0 @@ -/// 用户记录(对应后端 UserPayload) -class UserRecord { - const UserRecord({ - required this.username, - required this.points, - required this.consecutiveDays, - required this.cycleDay, - required this.cycleDays, - required this.todaySigned, - required this.nextReward, - this.lastSignIn, - this.themeColor, - this.themePaid = 0, - this.refundSeconds = 0, - }); - - final String username; - - /// 积分,精确到 0.01 - final double points; - - /// 连续签到天数(断签会重置) - final int consecutiveDays; - - /// 当前处在 30 天周期的第几天(1–30) - final int cycleDay; - - /// 周期长度,固定 30 - final int cycleDays; - - /// 今天是否已签到 - final bool todaySigned; - - /// 下一次签到能拿多少分 - final int nextReward; - - final String? lastSignIn; - - /// 形如 `4A90D9`(不带 #) - final String? themeColor; - - /// 当前这个颜色实际花了多少分 - final double themePaid; - - /// 退款窗口剩余秒数(0 表示没有可退的) - final int refundSeconds; - - factory UserRecord.fromJson(Map json) { - return UserRecord( - username: json['username'] as String? ?? '', - points: (json['points'] as num?)?.toDouble() ?? 0, - consecutiveDays: (json['consecutive_days'] as num?)?.toInt() ?? 0, - cycleDay: (json['cycle_day'] as num?)?.toInt() ?? 1, - cycleDays: (json['cycle_days'] as num?)?.toInt() ?? 30, - todaySigned: json['today_signed'] as bool? ?? false, - nextReward: (json['next_reward'] as num?)?.toInt() ?? 10, - lastSignIn: json['last_sign_in'] as String?, - themeColor: json['theme_color'] as String?, - themePaid: (json['theme_paid'] as num?)?.toDouble() ?? 0, - refundSeconds: (json['refund_seconds'] as num?)?.toInt() ?? 0, - ); - } -} - -/// 签到奖励:30 天一循环,第 7/14/21/28 天给周奖励,第 30 天给满月奖励。 -/// 与后端 `UserService.GetSignInReward` 保持一致。 -class SignInRewards { - static const int cycleDays = 30; - - static int getReward(int day) { - var d = day; - if (d < 1) d = 1; - if (d > cycleDays) d = ((d - 1) % cycleDays) + 1; - switch (d) { - case 7: - return 30; - case 14: - return 40; - case 21: - return 50; - case 28: - return 60; - case 30: - return 100; - } - if (d <= 6) return 10; - if (d <= 13) return 15; - if (d <= 20) return 20; - if (d <= 27) return 25; - return 40; - } -} - -/// 主题颜色:预置色 50 分一个,自定义色 150 分一个,默认蓝免费。 -class ThemeColor { - const ThemeColor({required this.name, required this.hex, required this.cost}); - - final String name; - final String hex; - final int cost; - - /// 默认色(免费) - static const String defaultHex = '4A90D9'; - - /// 预置色单价 - static const int presetCost = 50; - - /// 自定义色单价 - static const int customCost = 150; - - /// 购买后 1 小时内换色可退 80% - static const Duration refundWindow = Duration(hours: 1); - static const double refundRate = 0.8; - - static const List predefined = [ - ThemeColor(name: '蓝色', hex: defaultHex, cost: 0), - ThemeColor(name: '红色', hex: 'E74C3C', cost: presetCost), - ThemeColor(name: '绿色', hex: '27AE60', cost: presetCost), - ThemeColor(name: '紫色', hex: '9B59B6', cost: presetCost), - ThemeColor(name: '橙色', hex: 'F39C12', cost: presetCost), - ThemeColor(name: '青色', hex: '1ABC9C', cost: presetCost), - ThemeColor(name: '粉色', hex: 'E91E63', cost: presetCost), - ThemeColor(name: '深蓝', hex: '2C3E50', cost: presetCost), - ]; - - /// 某个十六进制颜色的价格;默认蓝 0,预置色 50,其它 150。 - static int costOf(String hex) { - final h = hex.replaceAll('#', '').toUpperCase(); - if (h == defaultHex) return 0; - for (final c in predefined) { - if (c.hex.toUpperCase() == h) return presetCost; - } - return customCost; - } -} - -/// 积分显示:整数不带小数位,小数保留到 0.01(去掉多余的 0)。 -String formatPoints(double v) { - var s = v.toStringAsFixed(2); - if (s.endsWith('.00')) return s.substring(0, s.length - 3); - if (s.endsWith('0')) return s.substring(0, s.length - 1); - return s; -} - -/// 人品值结果 -class FortuneResult { - const FortuneResult(this.value, this.comment); - - final int value; - final String comment; - - /// 0–100,越高越「人品爆发」 - static String commentFor(int value) { - if (value >= 96) return '欧皇附体,今天买彩票吧'; - if (value >= 90) return '运气爆棚,适合干大事'; - if (value >= 80) return '手气不错,稳'; - if (value >= 65) return '中上水平,稍微努一下'; - if (value >= 50) return '普普通通,够用'; - if (value >= 35) return '有点背,低调点'; - if (value >= 20) return '今天别赌任何东西'; - if (value >= 8) return '极差,建议躺平'; - return '非酋之王,明天再来'; - } -} diff --git a/GC-UI/frontend/lib/pages.dart b/GC-UI/frontend/lib/pages.dart deleted file mode 100644 index 12bab19..0000000 --- a/GC-UI/frontend/lib/pages.dart +++ /dev/null @@ -1,9 +0,0 @@ -// 页面聚合导出:四个页面按职责拆到 pages/ 子目录。 -// 保留这个文件是为了让 shell.dart 等调用方的 import 路径不变。 - -export 'pages/home.dart'; -export 'pages/courseware.dart'; -export 'pages/download.dart'; -export 'pages/settings.dart'; -export 'pages/about.dart'; -export 'pages/user_page.dart'; diff --git a/GC-UI/frontend/lib/pages/about.dart b/GC-UI/frontend/lib/pages/about.dart deleted file mode 100644 index 5092df7..0000000 --- a/GC-UI/frontend/lib/pages/about.dart +++ /dev/null @@ -1,487 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/material.dart'; - -import '../api_client.dart'; -import '../controller.dart'; -import '../i18n.dart'; -import '../theme.dart'; - -// --------------------------------------------------------------------------- -// 关于页(从原 pages.dart 拆出,公开类名不变) -// --------------------------------------------------------------------------- - -// --------------------------------------------------------------------------- -// 关于页 -// --------------------------------------------------------------------------- - -class AboutPageView extends StatefulWidget { - const AboutPageView({super.key, required this.controller, this.initialAbout}); - - final ShellController controller; - - /// 预置数据(仅用于测试 / 截图,正常运行时为 null,由后端提供)。 - final AboutInfo? initialAbout; - - @override - State createState() => _AboutPageViewState(); -} - -class _AboutPageViewState extends State { - AboutInfo? _about; - bool _loading = true; - String? _error; - - /// 重新下载启动器的进行状态与结果 - bool _redownloading = false; - String? _redownloadMsg; - bool? _redownloadOk; - - @override - void initState() { - super.initState(); - final preset = widget.initialAbout; - if (preset != null) { - _about = preset; - _loading = false; - return; - } - _load(); - } - - Future _load() async { - setState(() { - _loading = true; - _error = null; - }); - try { - final about = await widget.controller.api.about(); - if (!mounted) return; - setState(() { - _about = about; - _loading = false; - }); - } catch (error) { - if (!mounted) return; - setState(() { - _error = error.toString(); - _loading = false; - }); - } - } - - /// 重新下载启动器包:后端下完会用清单里的 sha256 逐块校验, - /// 校验不过会直接返回失败,不会留下半个坏包。 - Future _redownloadLauncher() async { - setState(() { - _redownloading = true; - _redownloadMsg = null; - _redownloadOk = null; - }); - try { - final result = await widget.controller.api.redownloadLauncher(); - if (!mounted) return; - setState(() { - _redownloading = false; - _redownloadOk = result.ok; - _redownloadMsg = result.ok - ? T('about.redownloadOk', [result.version]) - : (result.message.isEmpty ? T('about.redownloadFail') : result.message); - }); - } catch (error) { - if (!mounted) return; - setState(() { - _redownloading = false; - _redownloadOk = false; - _redownloadMsg = error.toString(); - }); - } - } - - @override - Widget build(BuildContext context) { - return ListView( - padding: const EdgeInsets.fromLTRB( - GcSpace.xxl, - GcSpace.xxl, - GcSpace.xxl, - GcSpace.xxxl, - ), - children: [ - GcPageHeader( - title: T('nav.about'), - subtitle: T('app.tagline'), - ), - const SizedBox(height: GcSpace.xxl), - if (_loading) - const Padding( - padding: EdgeInsets.symmetric(vertical: 48), - child: Center( - child: SizedBox( - width: 22, - height: 22, - child: CircularProgressIndicator(strokeWidth: 2), - ), - ), - ) - else if (_error != null) - GcMessage( - title: T('common.error'), - message: _error, - icon: Icons.error_outline_rounded, - color: GcColors.danger, - action: OutlinedButton( - onPressed: _load, - child: Text(T('common.retry')), - ), - ) - else ...[ - _versionCard(), - const SizedBox(height: GcSpace.lg), - _contributorsCard(), - const SizedBox(height: GcSpace.lg), - _thanksCard(), - ], - ], - ); - } - - Widget _versionCard() { - final about = _about; - - // 左边身份卡、右边信息表:宽屏两栏,窄屏自动堆叠。 - final identity = Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Row( - children: [ - Container( - width: 44, - height: 44, - alignment: Alignment.center, - decoration: BoxDecoration( - color: GcColors.accentSoft, - borderRadius: BorderRadius.circular(GcRadius.card), - ), - child: Text( - '◎', - style: TextStyle( - fontSize: 22, height: 1.1, color: GcColors.accent), - ), - ), - const SizedBox(width: GcSpace.lg), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Text( - about?.appName ?? 'Morris GC', - style: TextStyle( - fontSize: 20, - height: 1.3, - fontWeight: FontWeight.w600, - color: GcColors.ink, - ), - ), - const SizedBox(height: 2), - Text( - T('app.tagline'), - style: TextStyle( - fontSize: 12.5, - height: 1.5, - color: GcColors.faint, - ), - ), - ], - ), - ), - ], - ), - const SizedBox(height: GcSpace.lg), - Wrap( - spacing: GcSpace.sm, - runSpacing: GcSpace.sm, - children: [ - GcPill('v${about?.version ?? '—'}', color: GcColors.accent), - ], - ), - const SizedBox(height: GcSpace.lg), - Wrap( - spacing: GcSpace.sm, - runSpacing: GcSpace.sm, - children: [ - OutlinedButton( - onPressed: () async { - final url = about?.repository; - if (url == null || url.isEmpty) return; - try { - await widget.controller.api.openUrl(url); - } catch (_) { - // 忽略 - } - }, - child: Text(T('about.openRepository')), - ), - OutlinedButton.icon( - onPressed: _redownloading ? null : _redownloadLauncher, - icon: _redownloading - ? const SizedBox( - width: 14, - height: 14, - child: CircularProgressIndicator(strokeWidth: 2), - ) - : const Icon(Icons.refresh_rounded, size: 16), - label: Text( - _redownloading - ? T('about.redownloading') - : T('about.redownload'), - ), - ), - ], - ), - if (_redownloadMsg != null) ...[ - const SizedBox(height: GcSpace.md), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Icon( - _redownloadOk == true - ? Icons.verified_rounded - : Icons.error_outline_rounded, - size: 16, - color: _redownloadOk == true ? GcColors.ok : GcColors.danger, - ), - const SizedBox(width: GcSpace.xs + 2), - Expanded( - child: Text( - _redownloadMsg!, - style: TextStyle( - fontSize: 12, - height: 1.45, - color: _redownloadOk == true - ? GcColors.muted - : GcColors.danger, - ), - ), - ), - ], - ), - ], - ], - ); - - final details = Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - mainAxisSize: MainAxisSize.min, - children: [ - GcFieldRow( - label: T('set.platform'), - value: about?.platform ?? '—', - ), - GcFieldRow( - label: T('about.architecture'), - value: T('about.architectureValue'), - ), - GcFieldRow( - label: T('about.sourceLanguage'), - value: about?.sourceLanguage ?? 'C#', - ), - GcFieldRow( - label: T('about.frontend'), - value: about?.frontend ?? 'Flutter', - ), - GcFieldRow( - label: T('about.gitService'), - value: 'itxiaohui', - ), - GcFieldRow( - label: T('set.license'), - value: T('set.licenseValue'), - ), - ], - ); - - return GcCard( - padding: const EdgeInsets.all(GcSpace.xxl), - child: LayoutBuilder( - builder: (context, constraints) { - if (constraints.maxWidth < 720) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - identity, - const GcDivider(verticalPadding: GcSpace.lg), - details, - ], - ); - } - return Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded(flex: 4, child: identity), - const SizedBox(width: GcSpace.xxxl), - Expanded(flex: 5, child: details), - ], - ); - }, - ), - ); - } - - Widget _contributorsCard() { - final contributors = _about?.contributors ?? const []; - return GcCard( - padding: const EdgeInsets.all(GcSpace.xxl), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - GcSectionTitle( - T('about.developers'), - subtitle: T('about.contributorsHint'), - ), - const SizedBox(height: GcSpace.lg), - if (contributors.isEmpty) - GcHint(T('about.noContributors')) - else - Wrap( - spacing: GcSpace.xl, - runSpacing: GcSpace.md, - children: [ - for (final contributor in contributors) - SizedBox( - width: 220, - child: Row( - children: [ - CircleAvatar( - radius: 18, - backgroundColor: GcColors.surfaceAlt, - backgroundImage: contributor.avatarUrl == null - ? null - : NetworkImage(contributor.avatarUrl!), - child: contributor.avatarUrl == null - ? Text( - '◎', - style: TextStyle( - fontSize: 14, - color: GcColors.accent, - ), - ) - : null, - ), - const SizedBox(width: GcSpace.md), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Text( - contributor.name, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 13, - height: 1.4, - fontWeight: FontWeight.w600, - color: GcColors.ink, - ), - ), - Text( - T( - 'about.contributions', - [contributor.contributions], - ), - style: TextStyle( - fontSize: 11.5, - height: 1.4, - color: GcColors.faint, - ), - ), - ], - ), - ), - ], - ), - ), - ], - ), - ], - ), - ); - } - - /// 特别感谢:与「开发者」分开列 —— 提供 Git 服务不等于往仓库提交代码, - /// 混进贡献者列表会让提交数失去意义。 - Widget _thanksCard() { - return GcCard( - padding: const EdgeInsets.all(GcSpace.xxl), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - GcSectionTitle( - T('about.thanks'), - subtitle: T('about.thanksHint'), - ), - const SizedBox(height: GcSpace.lg), - Wrap( - spacing: GcSpace.xl, - runSpacing: GcSpace.md, - children: [ - _creditTile('地理洪老师', 'about.thanksGeo'), - _creditTile('itxiaohui', 'about.thanksGit'), - ], - ), - ], - ), - ); - } - - Widget _creditTile(String name, String roleKey) { - return SizedBox( - width: 220, - child: Row( - children: [ - CircleAvatar( - radius: 18, - backgroundColor: GcColors.surfaceAlt, - child: Text( - '◎', - style: TextStyle(fontSize: 14, color: GcColors.accent), - ), - ), - const SizedBox(width: GcSpace.md), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Text( - name, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 13, - height: 1.4, - fontWeight: FontWeight.w600, - color: GcColors.ink, - ), - ), - Text( - T(roleKey), - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 11.5, - height: 1.4, - color: GcColors.faint, - ), - ), - ], - ), - ), - ], - ), - ); - } -} diff --git a/GC-UI/frontend/lib/pages/courseware.dart b/GC-UI/frontend/lib/pages/courseware.dart deleted file mode 100644 index be8898c..0000000 --- a/GC-UI/frontend/lib/pages/courseware.dart +++ /dev/null @@ -1,294 +0,0 @@ -import 'dart:async'; -import 'dart:io'; - -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_inappwebview/flutter_inappwebview.dart'; - -import '../theme.dart'; - -/// 等高线课件页:用 WebView 承载去除授权验证后的离线 HTML 课件。 -/// -/// 资源(index.html + assets/)作为 Flutter assets 打包。桌面 WebView 不能直接 -/// 读 flutter assets,因此用一个仅监听 127.0.0.1 的静态服务器(端口 0 自动分配, -/// 不与后端/其他进程冲突)把 assets 暴露成 http://127.0.0.1:/ 再交给 -/// WebView 加载。图片、视频、Three.js 与全部交互都保持原课件原样。 -class CoursewarePage extends StatefulWidget { - const CoursewarePage({super.key}); - - @override - State createState() => _CoursewarePageState(); -} - -class _CoursewarePageState extends State - with AutomaticKeepAliveClientMixin { - @override - bool get wantKeepAlive => true; - - HttpServer? _server; - int? _port; - InAppWebViewController? _controller; - double _progress = 0; - String? _error; - Directory? _extractDir; - - /// 打包后的 app 工作目录不固定,不能直接用相对路径读 flutter assets。 - /// 首次进入时把课件资源解压到临时目录,服务器再从这里提供文件。 - Future _extractAssets() async { - final dir = await Directory.systemTemp.createTemp('gc-courseware-'); - final manifest = await AssetManifest.loadFromAssetBundle(rootBundle); - const prefix = 'courseware/'; - for (final key in manifest.listAssets()) { - if (!key.startsWith(prefix)) continue; - final rel = key.substring(prefix.length); - if (rel.isEmpty) continue; - final data = await rootBundle.load(key); - final out = File('${dir.path}/$rel'); - await out.parent.create(recursive: true); - await out.writeAsBytes(data.buffer.asUint8List( - data.offsetInBytes, data.lengthInBytes)); - } - return dir; - } - - @override - void initState() { - super.initState(); - _start(); - } - - Future _start() async { - try { - _extractDir = await _extractAssets(); - final server = await HttpServer.bind(InternetAddress.loopbackIPv4, 0); - _server = server; - _port = server.port; - server.listen(_handleRequest); - if (mounted) setState(() {}); - } catch (e) { - if (mounted) setState(() => _error = e.toString()); - } - } - - /// 只服务课件目录内的文件,路径做规范化防止越界。 - Future _handleRequest(HttpRequest req) async { - var path = Uri.decodeFull(req.uri.path); - if (path == '/' || path.isEmpty) path = '/index.html'; - // 去掉开头斜杠,拼到资源根目录 - final rel = path.replaceFirst(RegExp(r'^/+'), ''); - final normalized = _normalize(rel); - final file = File('${_extractDir?.path ?? "."}/$normalized'); - try { - if (!await file.exists()) { - req.response.statusCode = HttpStatus.notFound; - req.response.write('404 $rel'); - await req.response.close(); - return; - } - final length = await file.length(); - // _mimeOf 返回完整 MIME(含主/子类型);charset 由 HTML 的 meta 声明。 - req.response.headers.contentType = ContentType.parse(_mimeOf(rel)); - req.response.headers.set('Accept-Ranges', 'bytes'); - - // 视频拖动依赖 HTTP Range;解析 "bytes=start-end" 返回 206。 - final range = req.headers.value('range'); - if (range != null && range.startsWith('bytes=')) { - final span = range.substring(6).split('-'); - var start = int.tryParse(span.first) ?? 0; - var end = span.length > 1 ? int.tryParse(span.last) : null; - if (start < 0) start = 0; - if (start >= length) { - req.response.statusCode = HttpStatus.requestedRangeNotSatisfiable; - req.response.headers.set('Content-Range', 'bytes */$length'); - await req.response.close(); - return; - } - end ??= length - 1; - if (end >= length) end = length - 1; - if (end < start) end = start; - req.response.statusCode = HttpStatus.partialContent; - req.response.headers.set('Content-Range', 'bytes $start-$end/$length'); - req.response.headers.set('Content-Length', '${end - start + 1}'); - await req.response.addStream( - file.openRead(start, end + 1).cast>()); - await req.response.close(); - return; - } - - req.response.headers.set('Content-Length', '$length'); - await req.response.addStream(file.openRead().cast>()); - await req.response.close(); - } catch (e) { - req.response.statusCode = HttpStatus.internalServerError; - await req.response.close(); - } - } - - /// 折叠 .. 与 .,防止 ../ 越界读取其他文件。 - static String _normalize(String path) { - final parts = []; - for (final seg in path.split('/')) { - if (seg.isEmpty || seg == '.') continue; - if (seg == '..') { - if (parts.isNotEmpty) parts.removeLast(); - continue; - } - parts.add(seg); - } - return parts.join('/'); - } - - static String _mimeOf(String path) { - final ext = path.split('.').last.toLowerCase(); - switch (ext) { - case 'html': - case 'htm': - return 'text/html'; - case 'css': - return 'text/css'; - case 'js': - return 'text/javascript'; - case 'json': - return 'application/json'; - case 'png': - return 'image/png'; - case 'jpg': - case 'jpeg': - return 'image/jpeg'; - case 'gif': - return 'image/gif'; - case 'svg': - return 'image/svg+xml'; - case 'mp4': - return 'video/mp4'; - case 'webm': - return 'video/webm'; - case 'ico': - return 'image/x-icon'; - default: - return 'application/octet-stream'; - } - } - - Future _reload() async { - if (_port == null) return; - await _controller?.loadUrl( - urlRequest: URLRequest( - url: WebUri('http://127.0.0.1:$_port/index.html'), - ), - ); - } - - @override - void dispose() { - unawaited(() async { - await _server?.close(); - try { - await _extractDir?.delete(recursive: true); - } catch (_) { - // 临时目录清理失败无需影响页面销毁。 - } - }()); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - super.build(context); - return Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - _toolbar(), - Expanded(child: _body()), - ], - ); - } - - Widget _toolbar() { - return Container( - padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12), - decoration: BoxDecoration( - color: GcColors.surface, - border: Border(bottom: BorderSide(color: GcColors.line)), - ), - child: Row( - children: [ - const Icon(Icons.terrain_rounded, size: 20), - const SizedBox(width: 10), - const Text( - '等高线地形 · 五大典型地貌判读', - style: TextStyle(fontSize: 15, fontWeight: FontWeight.w600), - ), - const Spacer(), - IconButton( - tooltip: '刷新', - icon: const Icon(Icons.refresh_rounded, size: 18), - onPressed: _reload, - ), - IconButton( - tooltip: '全屏', - icon: const Icon(Icons.fullscreen_rounded, size: 18), - onPressed: () => _controller?.evaluateJavascript( - source: 'document.documentElement.requestFullscreen?.();', - ), - ), - ], - ), - ); - } - - Widget _body() { - if (_error != null) { - return Center(child: Text('课件加载失败:$_error')); - } - if (_port == null) { - return const Center(child: CircularProgressIndicator(strokeWidth: 2)); - } - return _webview(); - } - - Widget _webview() { - return Stack( - children: [ - InAppWebView( - initialUrlRequest: URLRequest( - url: WebUri('http://127.0.0.1:$_port/index.html'), - ), - initialSettings: InAppWebViewSettings( - javaScriptEnabled: true, - mediaPlaybackRequiresUserGesture: false, - allowsInlineMediaPlayback: true, - supportZoom: false, - clearCache: false, - // 本地可信内容,允许混合加载。 - mixedContentMode: MixedContentMode.MIXED_CONTENT_ALWAYS_ALLOW, - ), - onWebViewCreated: (controller) => _controller = controller, - onProgressChanged: (_, progress) { - if (mounted && progress < 100) { - setState(() => _progress = progress / 100); - } - }, - onLoadStop: (_, __) { - if (mounted) setState(() => _progress = 1); - }, - onReceivedError: (_, request, error) { - if (mounted) { - setState(() => _error = '${error.type} ${error.description}'); - } - }, - ), - if (_progress < 1) - Positioned( - top: 0, - left: 0, - right: 0, - child: SizedBox( - height: 2, - child: LinearProgressIndicator(value: _progress), - ), - ), - ], - ); - } -} diff --git a/GC-UI/frontend/lib/pages/download.dart b/GC-UI/frontend/lib/pages/download.dart deleted file mode 100644 index c9e3403..0000000 --- a/GC-UI/frontend/lib/pages/download.dart +++ /dev/null @@ -1,676 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/material.dart'; - -import '../api_client.dart'; -import '../controller.dart'; -import '../i18n.dart'; -import '../theme.dart'; - -// --------------------------------------------------------------------------- -// 下载页(从原 pages.dart 拆出,公开类名不变) -// --------------------------------------------------------------------------- - -// --------------------------------------------------------------------------- -// 下载页 -// --------------------------------------------------------------------------- - -class DownloadPageView extends StatefulWidget { - const DownloadPageView({ - super.key, - required this.controller, - this.initialSources, - this.initialIndex, - this.initialJobs, - }); - - final ShellController controller; - - /// 预置数据(仅用于测试 / 截图,正常运行时为 null,由后端提供)。 - final List? initialSources; - final SourceIndexInfo? initialIndex; - final List? initialJobs; - - @override - State createState() => _DownloadPageViewState(); -} - -class _DownloadPageViewState extends State { - List _sources = const []; - SourceIndexInfo? _index; - List _jobs = const []; - String? _selectedSourceId; - bool _loading = true; - String? _error; - Timer? _poll; - - /// 页面是否可见(被切走后仍保活,但没必要继续请求后端)。 - bool _visible = true; - - /// 上一次轮询时是否有活跃任务,用来判断「刚刚全部结束」。 - bool _hadActive = false; - - @override - void initState() { - super.initState(); - final presetSources = widget.initialSources; - if (presetSources != null) { - _sources = presetSources; - _index = widget.initialIndex; - _jobs = widget.initialJobs ?? const []; - _selectedSourceId = presetSources.isEmpty ? null : presetSources.first.id; - _loading = false; - return; - } - _load(); - _schedulePoll(const Duration(seconds: 2)); - } - - @override - void didChangeDependencies() { - super.didChangeDependencies(); - // TickerMode 由外壳的 Offstage 控制:切到别的页时变 false。 - _visible = TickerMode.of(context); - } - - @override - void dispose() { - _poll?.cancel(); - super.dispose(); - } - - /// 单次 Timer 链:有活跃任务时 1 秒一次,空闲时降到 5 秒,不可见时 10 秒。 - /// - /// 以前是 `Timer.periodic(1s)` 且永不停止 —— 只要进过下载页,之后每秒都 - /// 在请求 `/api/download/jobs`,哪怕没有任何任务、页面也早就切走了。 - void _schedulePoll(Duration delay) { - _poll?.cancel(); - _poll = Timer(delay, _pollOnce); - } - - Future _pollOnce() async { - if (!mounted) return; - - if (!_visible) { - _schedulePoll(const Duration(seconds: 10)); - return; - } - - _hadActive = _jobs.any((job) => job.isActive); - await _refreshJobs(); - if (!mounted) return; - - final active = _jobs.any((job) => job.isActive); - // 活跃 → 空闲:这一轮里下载结束了,首页的模型列表已经过期。 - if (_hadActive && !active) widget.controller.modelsChanged(); - _hadActive = active; - - _schedulePoll(Duration(seconds: active ? 1 : 5)); - } - - Future _load() async { - setState(() { - _loading = true; - _error = null; - }); - try { - // 三个请求互不依赖,一起发出去: - // 源列表(本地,几乎即时)、任务列表、模型索引(要打远端,最慢) - // 以前是 sources → models → jobs 串行等三轮,进页面白等多一秒。 - final sourcesFuture = widget.controller.api.sources(); - final jobsFuture = widget.controller.api.jobs(); - final indexFuture = widget.controller.api.remoteModels( - sourceId: _selectedSourceId, - ); - - final sources = await sourcesFuture; - final preferred = sources.where((s) => s.enabled).toList(); - final selected = _selectedSourceId ?? - (preferred.isNotEmpty - ? preferred.first.id - : (sources.isNotEmpty ? sources.first.id : '')); - - // 源列表是本地的,先画出来:右侧模型列表还在等远端索引,左侧不必陪着转圈 - if (mounted) { - setState(() { - _sources = sources; - _selectedSourceId = selected; - }); - } - - final index = await indexFuture; - final jobs = await jobsFuture; - - if (!mounted) return; - setState(() { - _sources = sources; - _selectedSourceId = selected; - _index = index; - _jobs = jobs; - _loading = false; - }); - } catch (error) { - if (!mounted) return; - setState(() { - _error = error.toString(); - _loading = false; - }); - } - } - - Future _refreshJobs() async { - try { - final jobs = await widget.controller.api.jobs(); - if (!mounted) return; - setState(() => _jobs = jobs); - } catch (_) { - // 轮询失败不打扰用户,下一次再试 - } - } - - Future _selectSource(String id) async { - setState(() { - _selectedSourceId = id; - _loading = true; - _error = null; - }); - try { - final index = await widget.controller.api.remoteModels(sourceId: id); - if (!mounted) return; - setState(() { - _index = index; - _loading = false; - }); - } catch (error) { - if (!mounted) return; - setState(() { - _error = error.toString(); - _loading = false; - }); - } - } - - Future _download(RemoteModelInfo model) async { - final sourceId = _selectedSourceId; - if (sourceId == null) return; - try { - await widget.controller.api.startDownload(sourceId, model.id); - await _refreshJobs(); - } catch (error) { - if (!mounted) return; - setState(() => _error = error.toString()); - } - } - - Future _jobAction( - Future Function(String id) action, String id) async { - try { - await action(id); - await _refreshJobs(); - } catch (error) { - if (!mounted) return; - setState(() => _error = error.toString()); - } - } - - @override - Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.fromLTRB( - GcSpace.xxl, GcSpace.xxl, GcSpace.xxl, GcSpace.xl), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox(width: 268, child: _sourcePanel()), - const SizedBox(width: GcSpace.xl), - Expanded(child: _modelPanel()), - ], - ), - ); - } - - Widget _sourcePanel() { - return GcCard( - padding: const EdgeInsets.all(GcSpace.lg), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - GcSectionTitle(T('dl.sources')), - const SizedBox(height: GcSpace.xs + 2), - GcHint(T('dl.subtitle')), - const SizedBox(height: GcSpace.md), - for (final source in _sources) - Padding( - padding: const EdgeInsets.only(bottom: GcSpace.xs + 2), - child: _sourceTile(source), - ), - const SizedBox(height: GcSpace.sm), - SizedBox( - width: double.infinity, - child: OutlinedButton.icon( - onPressed: _load, - icon: const Icon(Icons.refresh_rounded, size: 18), - label: Text(T('dl.refresh')), - ), - ), - ], - ), - ); - } - - Widget _sourceTile(SourceInfo source) { - final selected = source.id == _selectedSourceId; - return Material( - color: selected ? GcColors.accentSoft : Colors.transparent, - borderRadius: BorderRadius.circular(GcRadius.control), - child: InkWell( - borderRadius: BorderRadius.circular(GcRadius.control), - hoverColor: GcColors.surfaceAlt, - onTap: () => _selectSource(source.id), - child: Container( - padding: const EdgeInsets.symmetric( - horizontal: GcSpace.md, - vertical: GcSpace.md - 2, - ), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(GcRadius.control), - border: Border.all( - color: selected - ? GcColors.accent.withOpacity(0.45) - : Colors.transparent, - ), - ), - child: Row( - children: [ - Icon( - selected - ? Icons.radio_button_checked_rounded - : Icons.radio_button_unchecked_rounded, - size: 16, - color: selected ? GcColors.accent : GcColors.ghost, - ), - const SizedBox(width: GcSpace.sm + 2), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Text( - source.name, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 13, - height: 1.35, - fontWeight: FontWeight.w600, - color: selected ? GcColors.accent : GcColors.ink, - ), - ), - const SizedBox(height: 1), - Text( - source.host, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 11.5, - height: 1.35, - color: GcColors.faint, - ), - ), - ], - ), - ), - if (!source.enabled) const GcPill('off', subtle: true), - ], - ), - ), - ), - ); - } - - Widget _modelPanel() { - final models = _index?.models ?? const []; - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - GcPageHeader( - title: T('dl.available'), - subtitle: _index == null - ? null - : (_index!.fromCache - ? '${T('dl.ready', [ - models.length - ])} · ${T('dl.fromCache')}' - : T('dl.ready', [models.length])), - trailing: IconButton( - tooltip: T('common.refresh'), - onPressed: _load, - icon: const Icon(Icons.refresh_rounded, size: 18), - ), - ), - const SizedBox(height: GcSpace.lg), - Expanded( - child: ListView( - padding: const EdgeInsets.only(bottom: GcSpace.sm), - children: [ - if (_loading) - const Padding( - padding: EdgeInsets.symmetric(vertical: 48), - child: Center( - child: SizedBox( - width: 22, - height: 22, - child: CircularProgressIndicator(strokeWidth: 2), - ), - ), - ) - else if (_error != null) - GcMessage( - title: T('common.error'), - message: _error, - icon: Icons.cloud_off_rounded, - color: GcColors.danger, - action: OutlinedButton( - onPressed: _load, - child: Text(T('common.retry')), - ), - ) - else if (models.isEmpty) - GcMessage( - title: T('dl.empty'), - message: T('dl.emptyHint'), - icon: Icons.inbox_rounded, - ) - else - for (final model in models) - Padding( - padding: const EdgeInsets.only(bottom: GcSpace.md), - child: _remoteRow(model), - ), - const SizedBox(height: GcSpace.sm), - _jobsPanel(), - ], - ), - ), - ], - ); - } - - Widget _remoteRow(RemoteModelInfo model) { - return GcCard( - padding: const EdgeInsets.fromLTRB( - GcSpace.lg, - GcSpace.md + 2, - GcSpace.lg, - GcSpace.md + 2, - ), - child: Row( - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Flexible( - child: Text( - model.name, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 14, - height: 1.35, - fontWeight: FontWeight.w600, - color: GcColors.ink, - ), - ), - ), - const SizedBox(width: GcSpace.sm), - Text( - 'v${model.version} · ${model.sizeText}', - style: TextStyle( - fontSize: 12, - height: 1.35, - color: GcColors.faint, - ), - ), - if (model.installed) ...[ - const SizedBox(width: GcSpace.sm), - GcPill(T('dl.installed'), color: GcColors.ok), - ], - ], - ), - const SizedBox(height: GcSpace.xs + 1), - Text( - model.description, - maxLines: 2, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 12.5, - height: 1.5, - color: GcColors.muted, - ), - ), - ], - ), - ), - const SizedBox(width: GcSpace.lg), - _downloadAction(model), - ], - ), - ); - } - - /// 该模型是否有进行中的下载任务。 - JobInfo? _activeJobFor(String modelId) { - for (final job in _jobs) { - if (job.isActive && job.modelId == modelId) return job; - } - return null; - } - - /// 按钮位:空闲时是「下载 / 重新下载」,下载中就变成这一行的进度条。 - Widget _downloadAction(RemoteModelInfo model) { - final job = _activeJobFor(model.id); - if (job == null) { - if (model.installed) { - return OutlinedButton( - onPressed: () => _download(model), - child: Text(T('dl.reinstall')), - ); - } - return FilledButton( - onPressed: () => _download(model), - child: Text(T('dl.download')), - ); - } - - final value = job.progress.clamp(0.0, 1.0).toDouble(); - final percent = (value * 100).round(); - final detail = job.detailText.isNotEmpty ? job.detailText : job.statusText; - - return SizedBox( - width: 148, - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Row( - children: [ - Text( - '$percent%', - style: TextStyle( - fontSize: 12.5, - height: 1.2, - fontWeight: FontWeight.w600, - color: GcColors.accent, - ), - ), - const SizedBox(width: GcSpace.xs + 2), - if (detail.isNotEmpty) - Expanded( - child: Text( - detail, - maxLines: 1, - overflow: TextOverflow.ellipsis, - textAlign: TextAlign.right, - style: TextStyle( - fontSize: 11, - height: 1.2, - color: GcColors.faint, - ), - ), - ), - TextButton( - onPressed: () => - _jobAction(widget.controller.api.cancelJob, job.id), - style: TextButton.styleFrom( - minimumSize: const Size(0, 22), - padding: const EdgeInsets.symmetric(horizontal: GcSpace.sm), - tapTargetSize: MaterialTapTargetSize.shrinkWrap, - ), - child: Text( - T('dl.cancel'), - style: const TextStyle(fontSize: 11.5), - ), - ), - ], - ), - const SizedBox(height: 3), - ClipRRect( - borderRadius: BorderRadius.circular(3), - child: LinearProgressIndicator( - // 还没拿到进度时走不确定态,避免显示 0% 让人以为卡住 - value: value > 0 ? value : null, - minHeight: 6, - backgroundColor: GcColors.surfaceAlt, - ), - ), - ], - ), - ); - } - - Widget _jobsPanel() { - return GcCard( - padding: const EdgeInsets.all(GcSpace.lg), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - GcSectionTitle( - T('dl.background'), - trailing: TextButton( - onPressed: () async { - try { - await widget.controller.api.clearFinished(); - await _refreshJobs(); - } catch (_) { - // 忽略 - } - }, - child: Text(T('dl.clearDone')), - ), - ), - const SizedBox(height: GcSpace.md), - if (_jobs.isEmpty) - GcHint(T('dl.bgEmpty')) - else - for (final job in _jobs) - Padding( - padding: const EdgeInsets.only(bottom: GcSpace.md), - child: _jobRow(job), - ), - ], - ), - ); - } - - Widget _jobRow(JobInfo job) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Expanded( - child: Text( - '${job.name} v${job.version}', - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 13, - height: 1.35, - fontWeight: FontWeight.w600, - color: GcColors.ink, - ), - ), - ), - GcPill( - _stateLabel(job.state), - color: job.state == 'Failed' - ? GcColors.danger - : job.state == 'Completed' - ? GcColors.ok - : GcColors.accent, - ), - const SizedBox(width: GcSpace.sm), - if (job.isActive) - TextButton( - onPressed: () => - _jobAction(widget.controller.api.cancelJob, job.id), - child: Text(T('dl.cancel')), - ) - else if (job.canRetry) - TextButton( - onPressed: () => - _jobAction(widget.controller.api.retryJob, job.id), - child: Text(T('dl.retry')), - ) - else - TextButton( - onPressed: () => - _jobAction(widget.controller.api.removeJob, job.id), - child: Text(T('dl.removeTask')), - ), - ], - ), - const SizedBox(height: GcSpace.sm - 2), - ClipRRect( - borderRadius: BorderRadius.circular(2), - child: LinearProgressIndicator( - value: job.progress.clamp(0, 1).toDouble(), - minHeight: 4, - backgroundColor: GcColors.surfaceAlt, - ), - ), - const SizedBox(height: GcSpace.xs + 1), - Text( - job.error ?? job.detailText, - style: TextStyle( - fontSize: 11.5, - height: 1.4, - color: GcColors.faint, - ), - ), - ], - ); - } - - String _stateLabel(String state) { - switch (state) { - case 'Queued': - return T('dl.status.queued'); - case 'Running': - case 'Downloading': - return T('dl.status.downloading'); - case 'Completed': - return T('dl.status.done'); - case 'Failed': - return T('dl.status.failed'); - case 'Canceled': - return T('dl.status.canceled'); - default: - return state; - } - } -} diff --git a/GC-UI/frontend/lib/pages/home.dart b/GC-UI/frontend/lib/pages/home.dart deleted file mode 100644 index 234a918..0000000 --- a/GC-UI/frontend/lib/pages/home.dart +++ /dev/null @@ -1,692 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/material.dart'; - -import '../api_client.dart'; -import '../controller.dart'; -import '../i18n.dart'; -import '../theme.dart'; - -// --------------------------------------------------------------------------- -// 首页:模型库(从原 pages.dart 拆出,公开类名不变) -// --------------------------------------------------------------------------- - -// --------------------------------------------------------------------------- -// 首页:模型库 -// --------------------------------------------------------------------------- - -class HomePageView extends StatefulWidget { - const HomePageView({super.key, required this.controller, this.initialModels}); - - final ShellController controller; - - /// 预置模型列表(仅用于测试 / 截图,正常运行时为 null,由后端提供)。 - final List? initialModels; - - @override - State createState() => _HomePageViewState(); -} - -class _HomePageViewState extends State { - List _models = const []; - bool _loading = true; - String? _error; - String? _notice; - int _lastRevision = 0; - - @override - void initState() { - super.initState(); - widget.controller.addListener(_onControllerChanged); - _lastRevision = widget.controller.modelsRevision; - - final preset = widget.initialModels; - if (preset != null) { - _models = preset; - _loading = false; - } else { - _load(); - } - } - - @override - void dispose() { - widget.controller.removeListener(_onControllerChanged); - super.dispose(); - } - - /// 下载完成 / 删除模型后重新拉列表:页面被 Offstage 保活,不会自己重建。 - void _onControllerChanged() { - if (!mounted) return; - final revision = widget.controller.modelsRevision; - if (revision == _lastRevision) return; - _lastRevision = revision; - if (widget.initialModels != null) return; // 截图 / 测试用的预置数据 - _load(); - } - - Future _load() async { - setState(() { - _loading = true; - _error = null; - }); - try { - final models = await widget.controller.api.models(); - if (!mounted) return; - setState(() { - _models = models; - _loading = false; - }); - } catch (error) { - if (!mounted) return; - setState(() { - _error = error.toString(); - _loading = false; - }); - } - } - - Future _launch(ModelInfo model) async { - setState(() => _notice = null); - try { - // 模型窗口由后端用 Avalonia 打开(模型契约返回的是 Avalonia Control), - // 前端只负责发这条指令并显示结果。 - final result = await widget.controller.api.launchModel(model.id); - if (!mounted) return; - setState(() => _notice = result.message); - } catch (error) { - if (!mounted) return; - setState(() => _notice = error.toString()); - } - } - - Future _delete(ModelInfo model) async { - final confirmed = await showDialog( - context: context, - builder: (context) => AlertDialog( - backgroundColor: GcColors.surface, - title: Text(T('common.confirmTitle')), - content: Text(T('home.deleteConfirm', [model.name])), - actions: [ - TextButton( - onPressed: () => Navigator.of(context).pop(false), - child: Text(T('common.cancel')), - ), - FilledButton( - onPressed: () => Navigator.of(context).pop(true), - child: Text(T('common.delete')), - ), - ], - ), - ); - if (confirmed != true) return; - - try { - await widget.controller.api.deleteModel(model.id); - await _load(); - } catch (error) { - if (!mounted) return; - setState(() => _notice = error.toString()); - } - } - - Future _openFolder(String path) async { - try { - await widget.controller.api.openFolder(path); - } catch (error) { - if (!mounted) return; - setState(() => _notice = error.toString()); - } - } - - @override - Widget build(BuildContext context) { - final settings = widget.controller.settings; - return RefreshIndicator( - onRefresh: _load, - color: GcColors.accent, - backgroundColor: GcColors.surface, - child: ListView( - physics: const AlwaysScrollableScrollPhysics(), - padding: const EdgeInsets.fromLTRB( - GcSpace.xxl, GcSpace.xxl, GcSpace.xxl, GcSpace.xxxl), - children: [ - _hero(settings), - const SizedBox(height: GcSpace.xxl), - _sectionHeader(), - if (_notice != null) ...[ - const SizedBox(height: GcSpace.md), - GcMessage( - title: _notice!, - icon: Icons.info_outline_rounded, - color: GcColors.warn, - ), - ], - const SizedBox(height: GcSpace.lg), - if (_loading) - const Padding( - padding: EdgeInsets.symmetric(vertical: 48), - child: Center( - child: SizedBox( - width: 22, - height: 22, - child: CircularProgressIndicator(strokeWidth: 2), - ), - ), - ) - else if (_error != null) - GcMessage( - title: T('common.error'), - message: _error, - icon: Icons.cloud_off_rounded, - color: GcColors.danger, - action: OutlinedButton( - onPressed: _load, - child: Text(T('common.retry')), - ), - ) - else if (_models.isEmpty) - _emptyState() - else - LayoutBuilder( - builder: (context, constraints) { - const spacing = GcSpace.lg; - final columns = - (constraints.maxWidth / 320).floor().clamp(1, 4); - final cardWidth = - (constraints.maxWidth - spacing * (columns - 1)) / columns; - return Wrap( - spacing: spacing, - runSpacing: spacing, - children: [ - for (final model in _models) - SizedBox( - width: cardWidth, - child: _ModelCard( - model: model, - previewUrl: widget.controller.api.previewUrl(model), - onLaunch: () => _launch(model), - onOpenFolder: () => _openFolder(model.directory), - onDelete: () => _delete(model), - ), - ), - ], - ); - }, - ), - ], - ), - ); - } - - /// 顶部横幅:产品定位 + 主操作 + 关键指标。 - /// - /// 不用渐变:深色主题下的低对比渐变会让整块区域发灰,看起来就是「糊」。 - Widget _hero(SettingsInfo? settings) { - final enabledSources = - settings?.sources.where((s) => s.enabled).length ?? 0; - return GcCard( - padding: const EdgeInsets.all(GcSpace.xxl + 2), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'MODEL LIBRARY', - style: TextStyle( - fontSize: 11, - height: 1.2, - letterSpacing: 1.4, - fontWeight: FontWeight.w600, - color: GcColors.accent, - ), - ), - const SizedBox(height: GcSpace.md), - Text( - T('home.title'), - style: TextStyle( - fontSize: 26, - height: 1.25, - fontWeight: FontWeight.w600, - letterSpacing: -0.2, - color: GcColors.ink, - ), - ), - const SizedBox(height: GcSpace.sm), - ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 460), - child: Text( - T('home.subtitle'), - style: TextStyle( - fontSize: 13, - height: 1.65, - color: GcColors.muted, - ), - ), - ), - const SizedBox(height: GcSpace.xl), - Row( - children: [ - FilledButton.icon( - onPressed: - _models.isEmpty ? null : () => _launch(_models.first), - icon: const Icon(Icons.play_arrow_rounded, size: 18), - label: Text(T('home.launch')), - ), - const SizedBox(width: GcSpace.md), - OutlinedButton( - onPressed: () => widget.controller.goTo(2), - child: Text(T('home.download')), - ), - const SizedBox(width: GcSpace.xs), - TextButton( - onPressed: () => widget.controller.goTo(3), - child: Text(T('home.settings')), - ), - ], - ), - const SizedBox(height: GcSpace.md), - Text( - T('home.launchHint'), - style: TextStyle( - fontSize: 12, - height: 1.55, - color: GcColors.faint, - ), - ), - ], - ), - ), - const SizedBox(width: GcSpace.xxl), - Container( - padding: const EdgeInsets.symmetric( - horizontal: GcSpace.xl, - vertical: GcSpace.lg, - ), - decoration: BoxDecoration( - color: GcColors.surfaceAlt, - borderRadius: BorderRadius.circular(GcRadius.control), - border: Border.all(color: GcColors.line), - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - GcMetric( - value: '${_models.length}', - label: T('home.stats.models'), - ), - _metricDivider(), - GcMetric( - value: '$enabledSources', - label: T('home.stats.sources'), - ), - _metricDivider(), - GcMetric( - value: '${settings?.memoryBudgetMb ?? 0}', - label: T('home.stats.memory'), - ), - ], - ), - ), - ], - ), - ); - } - - Widget _metricDivider() { - return Container( - width: 1, - height: 34, - margin: const EdgeInsets.symmetric(horizontal: GcSpace.xl), - color: GcColors.line, - ); - } - - Widget _sectionHeader() { - return Row( - children: [ - Text( - T('home.installed'), - style: TextStyle( - fontSize: 16, - height: 1.4, - fontWeight: FontWeight.w600, - color: GcColors.ink, - ), - ), - const SizedBox(width: GcSpace.sm), - GcPill(T('home.count', [_models.length]), subtle: true), - const Spacer(), - IconButton( - tooltip: T('common.refresh'), - onPressed: _load, - icon: const Icon(Icons.refresh_rounded, size: 18), - ), - ], - ); - } - - Widget _emptyState() { - return GcCard( - padding: const EdgeInsets.symmetric( - horizontal: GcSpace.xxxl, - vertical: 40, - ), - child: Column( - children: [ - Container( - width: 52, - height: 52, - alignment: Alignment.center, - decoration: BoxDecoration( - color: GcColors.accentSoft, - borderRadius: BorderRadius.circular(GcRadius.panel), - ), - child: Icon( - Icons.travel_explore_rounded, - size: 26, - color: GcColors.accent, - ), - ), - const SizedBox(height: GcSpace.lg), - Text( - T('home.empty'), - style: TextStyle( - fontSize: 16, - height: 1.4, - fontWeight: FontWeight.w600, - color: GcColors.ink, - ), - ), - const SizedBox(height: GcSpace.sm), - ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 420), - child: Text( - T('home.emptyHint'), - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 12.5, - height: 1.7, - color: GcColors.muted, - ), - ), - ), - const SizedBox(height: GcSpace.xl), - FilledButton( - onPressed: () => widget.controller.goTo(2), - child: Text(T('home.emptyAction')), - ), - ], - ), - ); - } -} - -class _ModelCard extends StatefulWidget { - const _ModelCard({ - required this.model, - required this.previewUrl, - required this.onLaunch, - required this.onOpenFolder, - required this.onDelete, - }); - - final ModelInfo model; - final String previewUrl; - final VoidCallback onLaunch; - final VoidCallback onOpenFolder; - final VoidCallback onDelete; - - @override - State<_ModelCard> createState() => _ModelCardState(); -} - -class _ModelCardState extends State<_ModelCard> { - bool _hover = false; - - @override - Widget build(BuildContext context) { - final model = widget.model; - return MouseRegion( - onEnter: (_) => setState(() => _hover = true), - onExit: (_) => setState(() => _hover = false), - cursor: SystemMouseCursors.click, - child: GcCard( - padding: EdgeInsets.zero, - clip: true, - borderColor: _hover ? GcColors.lineStrong : GcColors.line, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _cover(model), - Padding( - padding: const EdgeInsets.fromLTRB( - GcSpace.lg, - GcSpace.md + 2, - GcSpace.lg, - GcSpace.md, - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Expanded( - child: Text( - model.name, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 14.5, - height: 1.35, - fontWeight: FontWeight.w600, - color: GcColors.ink, - ), - ), - ), - const SizedBox(width: GcSpace.sm), - Text( - model.sizeText, - style: TextStyle( - fontSize: 12, - height: 1.35, - color: GcColors.faint, - ), - ), - ], - ), - const SizedBox(height: GcSpace.sm - 2), - SizedBox( - height: 36, - child: Text( - model.description.isEmpty - ? T('home.noDescription') - : model.description, - maxLines: 2, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 12.5, - height: 1.45, - color: model.description.isEmpty - ? GcColors.faint - : GcColors.muted, - ), - ), - ), - if (model.tags.isNotEmpty) ...[ - const SizedBox(height: GcSpace.sm + 2), - SizedBox( - height: 20, - child: Wrap( - spacing: 6, - runSpacing: 6, - children: [ - for (final tag in model.tags.take(3)) - GcPill(tag, subtle: true), - ], - ), - ), - ], - const SizedBox(height: GcSpace.md + 2), - Row( - children: [ - FilledButton.icon( - onPressed: widget.onLaunch, - icon: const Icon(Icons.play_arrow_rounded, size: 18), - label: Text(T('home.launch')), - ), - const Spacer(), - IconButton( - tooltip: T('home.open'), - onPressed: widget.onOpenFolder, - icon: const Icon(Icons.folder_open_rounded, size: 18), - ), - IconButton( - tooltip: T('home.delete'), - onPressed: widget.onDelete, - icon: - const Icon(Icons.delete_outline_rounded, size: 18), - ), - ], - ), - ], - ), - ), - ], - ), - ), - ); - } - - /// 封面:按卡片宽度和屏幕像素比解码,避免被放大后发虚。 - Widget _cover(ModelInfo model) { - final dpr = MediaQuery.devicePixelRatioOf(context); - final decodeWidth = - (MediaQuery.sizeOf(context).width * dpr).clamp(320, 900).round(); - return SizedBox( - height: 156, - width: double.infinity, - child: Stack( - fit: StackFit.expand, - children: [ - _PreviewFallback(model: model), - if (model.hasPreview) - Image.network( - widget.previewUrl, - fit: BoxFit.cover, - cacheWidth: decodeWidth, - filterQuality: FilterQuality.medium, - gaplessPlayback: true, - errorBuilder: (context, error, stack) => const SizedBox.shrink(), - ), - DecoratedBox( - decoration: BoxDecoration( - // 只用「透明 → 深色」的遮罩,别用 alphaBlend:叠加不透明底色 - // 会把整张封面盖平,占位字母也跟着消失。 - gradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - GcColors.appBg.withOpacity(0.0), - GcColors.appBg.withOpacity(0.32), - GcColors.appBg.withOpacity(0.88), - ], - stops: const [0.42, 0.72, 1.0], - ), - ), - ), - Positioned( - left: GcSpace.md, - right: GcSpace.sm, - bottom: GcSpace.sm, - child: Row( - children: [ - if (model.version.isNotEmpty) - GcPill('v${model.version}', color: GcColors.accent), - if (model.author.isNotEmpty) ...[ - const SizedBox(width: GcSpace.sm), - Flexible( - child: Text( - model.author, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 11.5, - height: 1.3, - color: GcColors.muted, - ), - ), - ), - ], - const Spacer(), - AnimatedOpacity( - opacity: _hover ? 1 : 0, - duration: const Duration(milliseconds: 140), - child: Container( - width: 26, - height: 26, - decoration: BoxDecoration( - color: GcColors.accentFill, - shape: BoxShape.circle, - ), - child: Icon( - Icons.play_arrow_rounded, - size: 18, - color: GcColors.onAccent, - ), - ), - ), - ], - ), - ), - ], - ), - ); - } -} - -/// 没有封面时的占位:型号首字 + 淡淡的网格感,比一个大「◎」更像封面。 -class _PreviewFallback extends StatelessWidget { - const _PreviewFallback({this.model}); - - final ModelInfo? model; - - @override - Widget build(BuildContext context) { - final label = (model?.name ?? '').characters.isEmpty - ? '◎' - : model!.name.characters.first; - return DecoratedBox( - decoration: BoxDecoration( - gradient: LinearGradient( - begin: Alignment.topLeft, - end: Alignment.bottomRight, - colors: [ - Color.alphaBlend( - GcColors.accent.withOpacity(0.22), - GcColors.surfaceAlt, - ), - GcColors.surfaceAlt, - ], - ), - ), - child: Center( - child: Text( - label, - style: TextStyle( - fontSize: 46, - height: 1.0, - fontWeight: FontWeight.w600, - color: Color.alphaBlend( - GcColors.accent.withOpacity(0.55), - GcColors.surfaceAlt, - ), - ), - ), - ), - ); - } -} diff --git a/GC-UI/frontend/lib/pages/settings.dart b/GC-UI/frontend/lib/pages/settings.dart deleted file mode 100644 index 1c98a21..0000000 --- a/GC-UI/frontend/lib/pages/settings.dart +++ /dev/null @@ -1,562 +0,0 @@ -import 'package:flutter/material.dart'; - -import '../api_client.dart'; -import '../controller.dart'; -import '../i18n.dart'; -import '../theme.dart'; - -// --------------------------------------------------------------------------- -// 设置页(从原 pages.dart 拆出,公开类名不变) -// --------------------------------------------------------------------------- - -// --------------------------------------------------------------------------- -// 设置页 -// --------------------------------------------------------------------------- - -class SettingsPageView extends StatefulWidget { - const SettingsPageView({super.key, required this.controller}); - - final ShellController controller; - - @override - State createState() => _SettingsPageViewState(); -} - -class _SettingsPageViewState extends State { - double _memory = 2048; - bool _memoryAuto = true; - int _fps = 120; - bool _autoUpdate = true; - String _language = 'auto'; - ThemeMode _themeMode = ThemeMode.dark; - - /// 上一次同步所用的设置对象。以前用的是 `bool _synced` —— 只同步一次, - /// 之后外部(更新状态条、其它页面)改了设置,本页仍显示旧值。 - SettingsInfo? _syncedFrom; - String? _status; - - @override - void initState() { - super.initState(); - widget.controller.reloadSettings(); - } - - void _syncFrom(SettingsInfo settings) { - if (identical(_syncedFrom, settings)) return; - _syncedFrom = settings; - _memory = settings.memoryMb.toDouble(); - _memoryAuto = settings.memoryAuto; - _fps = settings.renderFps; - _autoUpdate = settings.autoUpdateOnStartup; - _language = settings.language; - _themeMode = GcPalette.parseMode(settings.theme); - } - - @override - Widget build(BuildContext context) { - final settings = widget.controller.settings; - if (settings == null) { - return const Center( - child: SizedBox( - width: 22, - height: 22, - child: CircularProgressIndicator(strokeWidth: 2), - ), - ); - } - _syncFrom(settings); - - return LayoutBuilder( - builder: (context, constraints) { - final twoColumns = constraints.maxWidth >= 960; - final cards = [ - _generalCard(settings), - _appearanceCard(settings), - _memoryCard(settings), - _sourcesCard(settings), - _storageCard(settings), - _updateCard(settings), - _backendCard(settings), - ]; - - Widget column(List items) => Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - for (var i = 0; i < items.length; i++) ...[ - if (i > 0) const SizedBox(height: GcSpace.lg), - items[i], - ], - ], - ); - - final left = []; - final right = []; - for (var i = 0; i < cards.length; i++) { - if (twoColumns && i.isOdd) { - right.add(cards[i]); - } else { - left.add(cards[i]); - } - } - - return SingleChildScrollView( - padding: const EdgeInsets.fromLTRB( - GcSpace.xxl, - GcSpace.xxl, - GcSpace.xxl, - GcSpace.xxxl, - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - GcPageHeader( - title: T('set.title'), - subtitle: T('set.subtitle'), - trailing: _status == null - ? null - : GcPill( - _status!, - color: GcColors.ok, - icon: Icons.check_rounded, - ), - ), - const SizedBox(height: GcSpace.xxl), - if (twoColumns) - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded(child: column(left)), - const SizedBox(width: GcSpace.lg), - Expanded(child: column(right)), - ], - ) - else - column(cards), - ], - ), - ); - }, - ); - } - - Widget _label(String text) { - return Text( - text, - style: TextStyle(fontSize: 13, height: 1.5, color: GcColors.muted), - ); - } - - Widget _cardRow(String label, Widget control) { - return Padding( - padding: const EdgeInsets.symmetric(vertical: GcSpace.sm), - child: Row( - children: [ - SizedBox(width: 124, child: _label(label)), - Expanded(child: control), - ], - ), - ); - } - - Widget _generalCard(SettingsInfo settings) { - return GcCard( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - GcSectionTitle(T('set.general')), - const SizedBox(height: GcSpace.lg), - _cardRow( - T('set.language'), - Align( - alignment: Alignment.centerLeft, - child: DropdownButton( - value: _language, - dropdownColor: GcColors.surfaceAlt, - underline: const SizedBox.shrink(), - borderRadius: BorderRadius.circular(GcRadius.control), - // 从主题样式派生,才能继承字体族(自建 TextStyle 会丢掉 - // fontFamily,中文就回退成系统兜底字体)。 - style: Theme.of(context).textTheme.bodyLarge!.copyWith( - fontSize: 13, - height: 1.4, - fontWeight: FontWeight.w400, - color: GcColors.ink, - ), - items: >[ - DropdownMenuItem( - value: 'auto', - child: Text(T('set.language.auto')), - ), - for (final language in settings.languages) - DropdownMenuItem( - value: language.code, - child: Text(language.label), - ), - ], - onChanged: (value) async { - if (value == null) return; - setState(() => _language = value); - await widget.controller - .saveSettings(SettingsPatch(language: value)); - }, - ), - ), - ), - _cardRow( - T('set.fps'), - Row( - children: [ - Expanded( - child: Slider( - value: _fps.toDouble(), - min: 24, - max: 120, - divisions: 4, - label: '$_fps', - onChanged: (value) => setState(() => _fps = value.round()), - onChangeEnd: (value) async { - await widget.controller.saveSettings( - SettingsPatch(renderFps: value.round())); - if (mounted) { - setState(() => _status = T('common.applied')); - } - }, - ), - ), - SizedBox( - width: 48, - child: Text( - '$_fps', - textAlign: TextAlign.end, - style: TextStyle( - fontSize: 13, - height: 1.4, - fontWeight: FontWeight.w600, - color: GcColors.ink, - ), - ), - ), - ], - ), - ), - GcHint(T('set.fps.desc')), - ], - ), - ); - } - - Widget _appearanceCard(SettingsInfo settings) { - return GcCard( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - GcSectionTitle(T('set.appearance')), - const SizedBox(height: GcSpace.md), - GcHint(T('set.theme.desc')), - const SizedBox(height: GcSpace.md), - SegmentedButton( - segments: >[ - ButtonSegment( - value: ThemeMode.dark, - label: Text(T('set.theme.dark')), - icon: const Icon(Icons.dark_mode_outlined, size: 16), - ), - ButtonSegment( - value: ThemeMode.light, - label: Text(T('set.theme.light')), - icon: const Icon(Icons.light_mode_outlined, size: 16), - ), - ButtonSegment( - value: ThemeMode.system, - label: Text(T('set.theme.system')), - icon: const Icon(Icons.brightness_auto_outlined, size: 16), - ), - ], - selected: {_themeMode}, - showSelectedIcon: false, - onSelectionChanged: (selection) async { - final mode = selection.first; - setState(() => _themeMode = mode); - GcPalette.mode.value = mode; // 立即预览 - await widget.controller.saveSettings( - SettingsPatch(theme: GcPalette.modeToName(mode))); - if (mounted) setState(() => _status = T('common.applied')); - }, - ), - ], - ), - ); - } - - Widget _memoryCard(SettingsInfo settings) { - return GcCard( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - GcSectionTitle(T('set.memory')), - const SizedBox(height: GcSpace.md), - GcHint(T('set.memory.desc')), - const SizedBox(height: GcSpace.lg), - Row( - children: [ - Switch( - value: _memoryAuto, - onChanged: (value) async { - setState(() => _memoryAuto = value); - await widget.controller - .saveSettings(SettingsPatch(memoryAuto: value)); - }, - ), - const SizedBox(width: GcSpace.md), - Expanded( - child: Text( - T('set.memory.auto'), - style: TextStyle( - fontSize: 13, - height: 1.5, - color: GcColors.muted, - ), - ), - ), - ], - ), - const SizedBox(height: GcSpace.xs), - Row( - children: [ - Expanded( - child: Slider( - value: _memory, - min: 512, - max: 16384, - divisions: 62, - label: '${_memory.round()} MB', - onChanged: _memoryAuto - ? null - : (value) => setState(() => _memory = value), - onChangeEnd: (value) async { - await widget.controller - .saveSettings(SettingsPatch(memoryMb: value.round())); - if (mounted) setState(() => _status = T('common.applied')); - }, - ), - ), - SizedBox( - width: 104, - child: Text( - '${_memory.round()} MB', - textAlign: TextAlign.end, - style: TextStyle( - fontSize: 13, - height: 1.4, - fontWeight: FontWeight.w600, - color: GcColors.ink, - ), - ), - ), - ], - ), - const SizedBox(height: GcSpace.xs), - GcHint('${T('set.memory.current')}: ${settings.memoryUsageText}'), - const SizedBox(height: GcSpace.xs), - GcHint(T('set.memory.hint')), - ], - ), - ); - } - - Widget _sourcesCard(SettingsInfo settings) { - return GcCard( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - GcSectionTitle(T('set.sources')), - const SizedBox(height: GcSpace.md), - GcHint(T('set.sources.desc')), - const SizedBox(height: GcSpace.md), - for (final source in settings.sources) - Padding( - padding: const EdgeInsets.only(bottom: GcSpace.md), - child: Row( - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Text( - source.name, - style: TextStyle( - fontSize: 13, - height: 1.4, - fontWeight: FontWeight.w600, - color: GcColors.ink, - ), - ), - const SizedBox(height: 1), - Text( - source.url, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 11.5, - height: 1.4, - color: GcColors.faint, - ), - ), - ], - ), - ), - const SizedBox(width: GcSpace.sm), - if (source.enabled) - GcPill(T('set.sourceEnabled'), color: GcColors.ok) - else - const GcPill('—', subtle: true), - ], - ), - ), - ], - ), - ); - } - - Widget _storageCard(SettingsInfo settings) { - return GcCard( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - GcSectionTitle(T('set.storage')), - const SizedBox(height: GcSpace.md), - GcFieldRow( - label: T('set.modelDir'), - value: settings.modelRoot, - selectable: true, - valueColor: GcColors.muted, - ), - GcFieldRow( - label: T('set.dataDir'), - value: settings.dataRoot, - selectable: true, - valueColor: GcColors.muted, - ), - const SizedBox(height: GcSpace.md), - Wrap( - spacing: GcSpace.sm + 2, - runSpacing: GcSpace.sm + 2, - children: [ - OutlinedButton( - onPressed: () async { - try { - await widget.controller.api.openFolder(settings.modelRoot); - } catch (error) { - if (mounted) setState(() => _status = error.toString()); - } - }, - child: Text(T('set.openFolder')), - ), - OutlinedButton( - onPressed: () async { - await widget.controller.checkUpdate(force: true); - if (mounted) setState(() => _status = T('set.cacheCleared')); - }, - child: Text(T('set.clearCache')), - ), - ], - ), - ], - ), - ); - } - - Widget _updateCard(SettingsInfo settings) { - return GcCard( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - GcSectionTitle(T('update.title')), - const SizedBox(height: GcSpace.md), - GcHint(T('set.checkUpdate.desc')), - const SizedBox(height: GcSpace.md), - Row( - children: [ - Switch( - value: _autoUpdate, - onChanged: (value) async { - setState(() => _autoUpdate = value); - await widget.controller - .saveSettings(SettingsPatch(autoUpdateOnStartup: value)); - }, - ), - const SizedBox(width: GcSpace.md), - Expanded( - child: Text( - T('update.auto'), - style: TextStyle( - fontSize: 13, - height: 1.5, - color: GcColors.muted, - ), - ), - ), - ], - ), - const SizedBox(height: GcSpace.sm), - GcFieldRow( - label: T('update.source'), - value: settings.updateRepository, - selectable: true, - valueColor: GcColors.muted, - ), - const SizedBox(height: GcSpace.md), - FilledButton( - onPressed: () => widget.controller.checkUpdate(force: true), - child: Text(T('update.checkNow')), - ), - ], - ), - ); - } - - Widget _backendCard(SettingsInfo settings) { - final health = widget.controller.health; - return GcCard( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - GcSectionTitle(T('set.backend')), - const SizedBox(height: GcSpace.md), - GcHint(T('set.backend.desc')), - const SizedBox(height: GcSpace.md), - GcFieldRow( - label: 'API', - value: widget.controller.api.baseUrl, - selectable: true, - valueColor: GcColors.muted, - ), - GcFieldRow( - label: T('set.version'), - value: settings.version, - valueColor: GcColors.muted, - ), - GcFieldRow( - label: T('set.platform'), - value: settings.platform, - valueColor: GcColors.muted, - ), - GcFieldRow( - label: T('set.backend.ui'), - value: health == null - ? '—' - : health.uiAvailable - ? T('set.backend.uiOk') - : '${T('set.backend.uiBad')}${health.uiError == null ? '' : ' · ${health.uiError}'}', - valueColor: health == null - ? GcColors.muted - : health.uiAvailable - ? GcColors.ok - : GcColors.danger, - ), - ], - ), - ); - } -} diff --git a/GC-UI/frontend/lib/pages/user_page.dart b/GC-UI/frontend/lib/pages/user_page.dart deleted file mode 100644 index 6357367..0000000 --- a/GC-UI/frontend/lib/pages/user_page.dart +++ /dev/null @@ -1,903 +0,0 @@ -import 'package:flutter/material.dart'; - -import '../controller.dart'; -import '../api_client.dart'; -import '../i18n.dart'; -import '../theme.dart'; -import '../models/user.dart'; - -/// 用户页面:账号(注册/登录/人机验证)、签到、人品值、二选一、主题色 -class UserPage extends StatefulWidget { - const UserPage({super.key, required this.controller}); - - final ShellController controller; - - @override - State createState() => _UserPageState(); -} - -class _UserPageState extends State { - UserRecord? _user; - bool _loading = true; - String? _error; - - // 登录 / 注册 - final _usernameCtrl = TextEditingController(); - final _passwordCtrl = TextEditingController(); - final _captchaCtrl = TextEditingController(); - bool _isLogin = true; - CaptchaInfo? _captcha; - bool _captchaLoading = false; - bool _submitting = false; - - // 人品值 - FortuneResult? _fortune; - bool _rolling = false; - - // 二选一 - final _option1Ctrl = TextEditingController(); - final _option2Ctrl = TextEditingController(); - String? _randomResult; - - @override - void initState() { - super.initState(); - _loadUser(); - } - - @override - void dispose() { - _usernameCtrl.dispose(); - _passwordCtrl.dispose(); - _captchaCtrl.dispose(); - _option1Ctrl.dispose(); - _option2Ctrl.dispose(); - super.dispose(); - } - - // ---------------------------------------------------------------- 账号 - - Future _loadUser() async { - setState(() { - _loading = true; - _error = null; - }); - try { - final resp = await widget.controller.api.me(); - if (!mounted) return; - setState(() { - _user = resp == null ? null : UserRecord.fromJson(resp); - _loading = false; - }); - _applyTheme(); - } catch (e) { - if (!mounted) return; - setState(() { - _loading = false; - _error = e.toString(); - }); - } - } - - /// 用户买的主题色覆盖全局强调色 - void _applyTheme() { - final hex = _user?.themeColor; - if (hex == null || hex.isEmpty) return; - GcPalette.apply('#$hex'); - } - - Future _refreshCaptcha() async { - setState(() => _captchaLoading = true); - try { - final c = await widget.controller.api.captcha(); - if (!mounted) return; - setState(() { - _captcha = c; - _captchaLoading = false; - _captchaCtrl.clear(); - }); - } catch (e) { - if (!mounted) return; - setState(() => _captchaLoading = false); - _toast(e.toString()); - } - } - - Future _submit() async { - final username = _usernameCtrl.text.trim(); - final password = _passwordCtrl.text; - - if (username.isEmpty || password.isEmpty) { - _toast(T('user.fillAll')); - return; - } - - if (!_isLogin) { - if (_captcha == null) { - _toast(T('user.captchaMissing')); - return; - } - if (_captchaCtrl.text.trim().isEmpty) { - _toast(T('user.fillCaptcha')); - return; - } - } - - setState(() => _submitting = true); - try { - if (_isLogin) { - await widget.controller.api.login(username, password); - } else { - await widget.controller.api.register( - username, - password, - captchaId: _captcha!.id, - captchaAnswer: _captchaCtrl.text.trim(), - ); - await widget.controller.api.login(username, password); - } - - final resp = await widget.controller.api.me(); - if (!mounted) return; - setState(() { - _user = resp == null ? null : UserRecord.fromJson(resp); - _usernameCtrl.clear(); - _passwordCtrl.clear(); - _captchaCtrl.clear(); - _captcha = null; - _submitting = false; - }); - _applyTheme(); - _toast(_isLogin ? T('user.loginSuccess') : T('user.registerSuccess')); - } catch (e) { - if (!mounted) return; - setState(() => _submitting = false); - // 注册失败时换一题:验证码是一次性的 - if (!_isLogin) _refreshCaptcha(); - _toast(e.toString()); - } - } - - Future _logout() async { - await widget.controller.api.logout(); - if (!mounted) return; - setState(() { - _user = null; - _fortune = null; - }); - GcPalette.accent.value = GcPalette.defaultAccent; - _toast(T('user.logoutDone')); - } - - Future _signin() async { - try { - final resp = await widget.controller.api.signin(); - if (!mounted) return; - - if (resp['message'] == '今日已签到') { - _toast(T('user.alreadySigned')); - return; - } - - final payload = resp['user'] as Map?; - final reward = (resp['reward'] as num?)?.toInt() ?? 0; - setState(() { - if (payload != null) _user = UserRecord.fromJson(payload); - }); - _toast('${T('user.signinSuccess')} +$reward ${T('user.points')}'); - } catch (e) { - if (!mounted) return; - _toast(e.toString()); - } - } - - // ---------------------------------------------------------------- 人品值 - - Future _rollFortune() async { - if (_user == null) { - _toast(T('user.loginFirst')); - return; - } - setState(() => _rolling = true); - try { - // 服务端算随机数和价格:当天第一次免费,之后按当日次数阶梯计费 - final resp = await widget.controller.api.rollFortune(); - if (!mounted) return; - final value = (resp['value'] as num?)?.toInt() ?? 0; - final cost = (resp['cost'] as num?)?.toDouble() ?? 0; - setState(() { - _fortune = FortuneResult(value, resp['comment'] as String? ?? FortuneResult.commentFor(value)); - final payload = resp['user'] as Map?; - if (payload != null) _user = UserRecord.fromJson(payload); - _rolling = false; - }); - _toast(cost > 0 ? '本次消耗 ${formatPoints(cost)} 积分' : '今日首次免费'); - } catch (e) { - if (!mounted) return; - setState(() => _rolling = false); - _toast(e.toString()); - } - } - - // ---------------------------------------------------------------- 二选一 - - Future _pickRandom() async { - final a = _option1Ctrl.text.trim(); - final b = _option2Ctrl.text.trim(); - if (a.isEmpty || b.isEmpty) { - _toast(T('user.fillOptions')); - return; - } - if (_user == null) { - _toast(T('user.loginFirst')); - return; - } - try { - // 服务端随机 + 计费:当天第一次免费,之后每次 0.5 积分 - final resp = await widget.controller.api.pickOne(a, b); - if (!mounted) return; - final cost = (resp['cost'] as num?)?.toDouble() ?? 0; - setState(() { - _randomResult = resp['choice'] as String?; - final payload = resp['user'] as Map?; - if (payload != null) _user = UserRecord.fromJson(payload); - }); - _toast(cost > 0 ? '本次消耗 ${formatPoints(cost)} 积分' : '今日首次免费'); - } catch (e) { - if (!mounted) return; - _toast(e.toString()); - } - } - - // ---------------------------------------------------------------- 主题色 - - Future _changeTheme(String hex) async { - if (_user == null) { - _toast(T('user.loginFirst')); - return; - } - try { - final resp = await widget.controller.api.changeTheme(hex); - if (!mounted) return; - - final payload = resp['user'] as Map?; - setState(() { - if (payload != null) _user = UserRecord.fromJson(payload); - }); - _applyTheme(); - - final refunded = (resp['refunded'] as num?)?.toInt() ?? 0; - _toast(refunded > 0 - ? '${T('user.themeUpdated')},${T('user.refunded')} +$refunded' - : T('user.themeUpdated')); - } catch (e) { - if (!mounted) return; - _toast(e.toString()); - } - } - - Future _pickCustomColor() async { - if (_user == null) { - _toast(T('user.loginFirst')); - return; - } - - final controller = TextEditingController(text: '#7C6CFF'); - final hex = await showDialog( - context: context, - builder: (ctx) => StatefulBuilder( - builder: (ctx, setLocal) { - final raw = controller.text.replaceAll('#', '').trim(); - final valid = raw.length == 6 && int.tryParse(raw, radix: 16) != null; - final preview = valid - ? Color(0xFF000000 | int.parse(raw, radix: 16)) - : GcColors.surface; - - return AlertDialog( - title: Text(T('user.customColor')), - content: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - T('user.customColorCost', ['${ThemeColor.customCost}']), - style: TextStyle(color: GcColors.muted, fontSize: 13), - ), - const SizedBox(height: GcSpace.md), - TextField( - controller: controller, - autofocus: true, - decoration: InputDecoration( - labelText: '#RRGGBB', - border: const OutlineInputBorder(), - errorText: valid || raw.isEmpty ? null : T('user.hexInvalid'), - ), - onChanged: (_) => setLocal(() {}), - ), - const SizedBox(height: GcSpace.md), - Row( - children: [ - Container( - width: 44, - height: 44, - decoration: BoxDecoration( - color: preview, - borderRadius: BorderRadius.circular(GcRadius.control), - border: Border.all(color: GcColors.line), - ), - ), - const SizedBox(width: GcSpace.md), - Expanded( - child: Text( - valid ? '#${raw.toUpperCase()}' : '—', - style: TextStyle(color: GcColors.muted), - ), - ), - ], - ), - ], - ), - actions: [ - TextButton( - onPressed: () => Navigator.of(ctx).pop(), - child: Text(T('common.cancel')), - ), - FilledButton( - onPressed: - valid ? () => Navigator.of(ctx).pop(raw.toUpperCase()) : null, - child: Text(T('user.confirmBuy')), - ), - ], - ); - }, - ), - ); - - controller.dispose(); - if (hex != null) await _changeTheme(hex); - } - - // ---------------------------------------------------------------- 工具 - - void _toast(String message) { - if (!mounted) return; - ScaffoldMessenger.of(context) - ..hideCurrentSnackBar() - ..showSnackBar(SnackBar(content: Text(message))); - } - - String _formatRefund(int seconds) { - if (seconds >= 60) return '${seconds ~/ 60} ${T('user.minutes')}'; - return '$seconds ${T('user.seconds')}'; - } - - // ---------------------------------------------------------------- UI - - @override - Widget build(BuildContext context) { - if (_loading) { - return Scaffold( - backgroundColor: GcColors.appBg, - body: const Center(child: CircularProgressIndicator()), - ); - } - - return Scaffold( - backgroundColor: GcColors.appBg, - body: SingleChildScrollView( - padding: const EdgeInsets.all(GcSpace.xxl), - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - _header(), - const SizedBox(height: GcSpace.lg), - if (_user == null) ...[ - _authCard(), - const SizedBox(height: GcSpace.lg), - ], - _fortuneCard(), - const SizedBox(height: GcSpace.lg), - _pickCard(), - const SizedBox(height: GcSpace.lg), - _themeCard(), - if (_error != null) ...[ - const SizedBox(height: GcSpace.md), - Text(_error!, style: TextStyle(color: GcColors.danger)), - ], - ], - ), - ), - ); - } - - Widget _header() { - final user = _user; - return GcCard( - padding: const EdgeInsets.all(GcSpace.lg), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - CircleAvatar( - radius: 22, - backgroundColor: GcColors.accentSoft, - child: Icon(Icons.person_rounded, color: GcColors.accent), - ), - const SizedBox(width: GcSpace.md), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - user?.username ?? T('user.notLoggedIn'), - style: const TextStyle( - fontSize: 18, fontWeight: FontWeight.w700), - ), - const SizedBox(height: 2), - Text( - user == null - ? T('user.loginHint') - : '${T('user.points')} ${formatPoints(user.points)} · ' - '${T('user.days')} ${user.consecutiveDays}', - style: TextStyle(color: GcColors.muted, fontSize: 13), - ), - ], - ), - ), - if (user != null) - OutlinedButton( - onPressed: _logout, - child: Text(T('user.logout')), - ), - ], - ), - if (user != null) ...[ - const SizedBox(height: GcSpace.lg), - Row( - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - T('user.cycleDay', - ['${user.cycleDay}', '${user.cycleDays}']), - style: TextStyle(color: GcColors.muted, fontSize: 13), - ), - const SizedBox(height: 6), - ClipRRect( - borderRadius: BorderRadius.circular(GcRadius.pill), - child: LinearProgressIndicator( - value: user.cycleDay / user.cycleDays, - minHeight: 6, - backgroundColor: GcColors.surfaceAlt, - ), - ), - const SizedBox(height: 6), - Text( - user.todaySigned - ? T('user.signedToday') - : T('user.nextReward', ['${user.nextReward}']), - style: TextStyle(color: GcColors.faint, fontSize: 12), - ), - ], - ), - ), - const SizedBox(width: GcSpace.lg), - FilledButton( - onPressed: user.todaySigned ? null : _signin, - child: Text(user.todaySigned - ? T('user.signedTodayShort') - : T('user.signin')), - ), - ], - ), - ], - ], - ), - ); - } - - Widget _authCard() { - return GcCard( - padding: const EdgeInsets.all(GcSpace.lg), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Text( - _isLogin ? T('user.login') : T('user.register'), - style: - const TextStyle(fontSize: 16, fontWeight: FontWeight.w600), - ), - const Spacer(), - TextButton( - onPressed: () { - setState(() { - _isLogin = !_isLogin; - _captcha = null; - _captchaCtrl.clear(); - }); - if (!_isLogin) _refreshCaptcha(); - }, - child: Text(_isLogin - ? T('user.switchToRegister') - : T('user.switchToLogin')), - ), - ], - ), - const SizedBox(height: GcSpace.md), - TextField( - controller: _usernameCtrl, - decoration: InputDecoration( - labelText: T('user.username'), - helperText: _isLogin ? null : T('user.usernameRule'), - border: const OutlineInputBorder(), - ), - ), - const SizedBox(height: GcSpace.md), - TextField( - controller: _passwordCtrl, - obscureText: true, - decoration: InputDecoration( - labelText: T('user.password'), - border: const OutlineInputBorder(), - ), - onSubmitted: (_) => _submit(), - ), - - // 注册才需要人机验证 - if (!_isLogin) ...[ - const SizedBox(height: GcSpace.lg), - Row( - children: [ - Expanded( - child: Container( - padding: const EdgeInsets.symmetric( - horizontal: GcSpace.md, vertical: GcSpace.md), - decoration: BoxDecoration( - color: GcColors.surfaceAlt, - borderRadius: BorderRadius.circular(GcRadius.control), - border: Border.all(color: GcColors.line), - ), - child: Row( - children: [ - Icon(Icons.shield_outlined, - size: 18, color: GcColors.muted), - const SizedBox(width: GcSpace.sm), - Text( - _captchaLoading - ? T('common.loading') - : (_captcha?.question ?? T('user.captcha')), - style: const TextStyle( - fontSize: 15, - fontWeight: FontWeight.w600, - letterSpacing: 1), - ), - ], - ), - ), - ), - IconButton( - tooltip: T('user.refreshCaptcha'), - onPressed: _captchaLoading ? null : _refreshCaptcha, - icon: const Icon(Icons.refresh_rounded), - ), - ], - ), - const SizedBox(height: GcSpace.md), - TextField( - controller: _captchaCtrl, - keyboardType: TextInputType.number, - decoration: InputDecoration( - labelText: T('user.captchaAnswer'), - border: const OutlineInputBorder(), - ), - onSubmitted: (_) => _submit(), - ), - ], - - const SizedBox(height: GcSpace.lg), - SizedBox( - height: GcSize.control, - child: FilledButton( - onPressed: _submitting ? null : _submit, - child: _submitting - ? const SizedBox( - width: 18, - height: 18, - child: CircularProgressIndicator(strokeWidth: 2)) - : Text(_isLogin ? T('user.login') : T('user.register')), - ), - ), - const SizedBox(height: GcSpace.sm), - Text( - T('user.noRecharge'), - style: TextStyle(color: GcColors.faint, fontSize: 12), - ), - ], - ), - ); - } - - Widget _fortuneCard() { - return GcCard( - padding: const EdgeInsets.all(GcSpace.lg), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(T('user.fortune'), - style: - const TextStyle(fontSize: 16, fontWeight: FontWeight.w600)), - const SizedBox(height: 4), - Text(T('user.fortuneDesc'), - style: TextStyle(color: GcColors.muted, fontSize: 13)), - const SizedBox(height: GcSpace.lg), - Row( - children: [ - Container( - width: 96, - height: 96, - alignment: Alignment.center, - decoration: BoxDecoration( - color: GcColors.accentSoft, - shape: BoxShape.circle, - border: Border.all(color: GcColors.accent, width: 2), - ), - child: Text( - _rolling ? '…' : (_fortune?.value.toString() ?? '?'), - style: const TextStyle( - fontSize: 34, fontWeight: FontWeight.w700, height: 1.0), - ), - ), - const SizedBox(width: GcSpace.lg), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - _fortune?.comment ?? T('user.fortuneIdle'), - style: const TextStyle( - fontSize: 14, fontWeight: FontWeight.w600), - ), - const SizedBox(height: GcSpace.md), - FilledButton( - onPressed: _rolling ? null : _rollFortune, - child: Text(_fortune == null - ? T('user.fortuneRoll') - : T('user.fortuneAgain')), - ), - ], - ), - ), - ], - ), - ], - ), - ); - } - - Widget _pickCard() { - return GcCard( - padding: const EdgeInsets.all(GcSpace.lg), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(T('user.pick'), - style: - const TextStyle(fontSize: 16, fontWeight: FontWeight.w600)), - const SizedBox(height: 4), - Text(T('user.pickDesc'), - style: TextStyle(color: GcColors.muted, fontSize: 13)), - const SizedBox(height: GcSpace.md), - Row( - children: [ - Expanded( - child: TextField( - controller: _option1Ctrl, - decoration: InputDecoration( - labelText: T('user.option1'), - border: const OutlineInputBorder(), - ), - ), - ), - const SizedBox(width: GcSpace.md), - Expanded( - child: TextField( - controller: _option2Ctrl, - decoration: InputDecoration( - labelText: T('user.option2'), - border: const OutlineInputBorder(), - ), - ), - ), - ], - ), - const SizedBox(height: GcSpace.md), - Row( - children: [ - FilledButton( - onPressed: _pickRandom, - child: Text(T('user.pickRandom')), - ), - if (_randomResult != null) ...[ - const SizedBox(width: GcSpace.lg), - Expanded( - child: Container( - padding: const EdgeInsets.symmetric( - horizontal: GcSpace.md, vertical: GcSpace.sm), - decoration: BoxDecoration( - color: GcColors.accentSoft, - borderRadius: BorderRadius.circular(GcRadius.control), - ), - child: Text( - '${T('user.pickResult')} ${_randomResult!}', - style: const TextStyle( - fontSize: 15, fontWeight: FontWeight.w600), - ), - ), - ), - ], - ], - ), - ], - ), - ); - } - - Widget _themeCard() { - final user = _user; - final current = user?.themeColor?.toUpperCase(); - final canRefund = (user?.refundSeconds ?? 0) > 0; - - return GcCard( - padding: const EdgeInsets.all(GcSpace.lg), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(T('user.themeColor'), - style: - const TextStyle(fontSize: 16, fontWeight: FontWeight.w600)), - const SizedBox(height: 4), - Text(T('user.themeDesc'), - style: TextStyle(color: GcColors.muted, fontSize: 13)), - if (canRefund) ...[ - const SizedBox(height: 6), - Text( - T('user.refundHint', [_formatRefund(user!.refundSeconds)]), - style: TextStyle(color: GcColors.ok, fontSize: 12), - ), - ], - const SizedBox(height: GcSpace.lg), - Wrap( - spacing: GcSpace.md, - runSpacing: GcSpace.md, - children: [ - ...ThemeColor.predefined.map((c) => _swatch( - name: c.name, - hex: c.hex, - cost: c.cost, - selected: current == c.hex.toUpperCase(), - )), - _customSwatch( - selected: current != null && - ThemeColor.costOf(current) == ThemeColor.customCost, - ), - ], - ), - ], - ), - ); - } - - Widget _swatch({ - required String name, - required String hex, - required int cost, - required bool selected, - }) { - final points = _user?.points ?? 0; - final affordable = cost == 0 || points >= cost; - - return InkWell( - onTap: () => _changeTheme(hex), - borderRadius: BorderRadius.circular(GcRadius.control), - child: Column( - children: [ - Stack( - children: [ - Container( - width: 56, - height: 56, - decoration: BoxDecoration( - color: Color(0xFF000000 | int.parse(hex, radix: 16)), - borderRadius: BorderRadius.circular(GcRadius.control), - border: Border.all( - color: selected ? GcColors.accent : GcColors.line, - width: selected ? 2.5 : 1, - ), - ), - ), - if (selected) - const Positioned( - right: 3, - bottom: 3, - child: Icon(Icons.check_circle_rounded, - size: 16, color: Colors.white), - ), - if (!affordable) - Positioned.fill( - child: Container( - decoration: BoxDecoration( - // ignore: deprecated_member_use - color: Colors.black.withOpacity(0.45), - borderRadius: BorderRadius.circular(GcRadius.control), - ), - child: const Icon(Icons.lock_outline, - size: 18, color: Colors.white), - ), - ), - ], - ), - const SizedBox(height: 4), - Text(name, style: TextStyle(fontSize: 11, color: GcColors.muted)), - Text( - cost == 0 ? T('user.free') : '$cost', - style: TextStyle( - fontSize: 11, - color: affordable ? GcColors.faint : GcColors.danger, - ), - ), - ], - ), - ); - } - - Widget _customSwatch({required bool selected}) { - final canAfford = (_user?.points ?? 0) >= ThemeColor.customCost; - return InkWell( - onTap: _pickCustomColor, - borderRadius: BorderRadius.circular(GcRadius.control), - child: Column( - children: [ - Container( - width: 56, - height: 56, - decoration: BoxDecoration( - gradient: const SweepGradient( - colors: [ - Color(0xFFFF7A7A), - Color(0xFFFFC46B), - Color(0xFF6BE3A2), - Color(0xFF4FD1C5), - Color(0xFF7C6CFF), - Color(0xFFFF8FB1), - Color(0xFFFF7A7A), - ], - ), - borderRadius: BorderRadius.circular(GcRadius.control), - border: Border.all( - color: selected ? GcColors.accent : GcColors.line, - width: selected ? 2.5 : 1, - ), - ), - child: Icon(Icons.colorize_rounded, - size: 20, color: canAfford ? Colors.white : Colors.white70), - ), - const SizedBox(height: 4), - Text(T('user.custom'), - style: TextStyle(fontSize: 11, color: GcColors.muted)), - Text( - '${ThemeColor.customCost}', - style: TextStyle( - fontSize: 11, - color: canAfford ? GcColors.faint : GcColors.danger, - ), - ), - ], - ), - ); - } -} diff --git a/GC-UI/frontend/lib/shell.dart b/GC-UI/frontend/lib/shell.dart deleted file mode 100644 index 120a3fc..0000000 --- a/GC-UI/frontend/lib/shell.dart +++ /dev/null @@ -1,473 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'controller.dart'; -import 'i18n.dart'; -import 'pages.dart'; -import 'theme.dart'; -import 'window_chrome.dart'; - -/// 侧边栏导航项。 -class _NavItem { - const _NavItem(this.icon, this.labelKey); - - final IconData icon; - final String labelKey; -} - -const List<_NavItem> _navItems = <_NavItem>[ - _NavItem(Icons.dashboard_rounded, 'nav.home'), - _NavItem(Icons.terrain_rounded, 'nav.courseware'), - _NavItem(Icons.download_rounded, 'nav.download'), - _NavItem(Icons.tune_rounded, 'nav.settings'), - _NavItem(Icons.info_outline_rounded, 'nav.about'), - _NavItem(Icons.person_rounded, 'nav.user'), -]; - -/// 桌面端滚动行为:去掉移动端的拉伸回弹和边缘光晕,滚轮更跟手。 -class GcScrollBehavior extends MaterialScrollBehavior { - const GcScrollBehavior(); - - @override - Widget buildOverscrollIndicator( - BuildContext context, - Widget child, - ScrollableDetails details, - ) { - return child; - } - - @override - ScrollPhysics getScrollPhysics(BuildContext context) { - return const ClampingScrollPhysics(parent: AlwaysScrollableScrollPhysics()); - } -} - -/// 应用外壳:左侧导航 + 右侧内容 + 底部更新状态条。 -class ShellPage extends StatefulWidget { - const ShellPage({super.key, required this.controller}); - - final ShellController controller; - - @override - State createState() => _ShellPageState(); -} - -class _ShellPageState extends State { - /// 页面缓存:键为「索引:语言」。同一个页面只构建一次,切走时用 - /// [Offstage] 保活(不参与布局/绘制),切回来无需重建、状态也不丢。 - final Map _pages = {}; - - @override - void initState() { - super.initState(); - widget.controller.bootstrap(); - } - - @override - Widget build(BuildContext context) { - return AnimatedBuilder( - animation: widget.controller, - builder: (context, _) { - final controller = widget.controller; - return Scaffold( - backgroundColor: GcColors.appBg, - body: Column( - children: [ - // 自绘标题栏(macOS):系统标题栏已隐藏,最小化/最大化/关闭在这里画 - const GcTitleBar(), - Expanded( - child: Row( - children: [ - _Sidebar(controller: controller), - Container(width: 1, color: GcColors.line), - Expanded( - child: Column( - children: [ - Expanded(child: _content(controller)), - if (controller.updateBarVisible) - _UpdateBar(controller: controller), - ], - ), - ), - ], - ), - ), - ], - ), - ); - }, - ); - } - - Widget _content(ShellController controller) { - // 课件页是纯前端资源,不依赖后端:即使后端未就绪也可打开。 - // 注意 _buildPage 内部对 index 1 返回课件页,这里单独放行它。 - final courseware = controller.index == 1; - if (!courseware && !controller.backendReady) { - if (controller.loadError != null) { - return _BackendDown(controller: controller); - } - return const Center( - child: SizedBox( - width: 22, - height: 22, - child: CircularProgressIndicator(strokeWidth: 2), - ), - ); - } - - // 只构建当前页;其余已访问页面保留在树上但处于 Offstage。 - final key = '${controller.index}:${I18n.language.value}'; - _pages.putIfAbsent(key, () => _buildPage(controller, controller.index)); - - final visibleKey = key; - return Stack( - children: [ - for (final entry in _pages.entries) - Offstage( - offstage: entry.key != visibleKey, - child: TickerMode( - enabled: entry.key == visibleKey, - child: entry.value, - ), - ), - ], - ); - } - - Widget _buildPage(ShellController controller, int index) { - switch (index) { - case 1: - // 课件页自持有 WebView 状态,不需要 controller。 - return const CoursewarePage(); - case 2: - return DownloadPageView(controller: controller); - case 3: - return SettingsPageView(controller: controller); - case 4: - return AboutPageView(controller: controller); - case 5: - return UserPage(controller: controller); - default: - return HomePageView(controller: controller); - } - } -} - -class _Sidebar extends StatelessWidget { - const _Sidebar({required this.controller}); - - final ShellController controller; - - @override - Widget build(BuildContext context) { - final settings = controller.settings; - return Container( - width: GcSize.sidebar, - color: GcColors.sideBg, - padding: const EdgeInsets.fromLTRB( - GcSpace.xl, GcSpace.xxl, GcSpace.lg, GcSpace.lg), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _brand(), - const SizedBox(height: GcSpace.xxxl), - const Padding( - padding: EdgeInsets.only(left: 10, bottom: GcSpace.sm), - child: Text( - 'MENU', - style: TextStyle( - fontSize: 11, - height: 1.2, - letterSpacing: 1.4, - fontWeight: FontWeight.w600, - color: Color(0xFF5C6A80), - ), - ), - ), - for (var i = 0; i < _navItems.length; i++) - _NavButton( - item: _navItems[i], - active: controller.index == i, - onTap: () => controller.goTo(i), - ), - const Spacer(), - Container(height: 1, color: GcColors.line), - const SizedBox(height: GcSpace.md), - Padding( - padding: const EdgeInsets.only(left: 10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'v${settings?.version ?? '—'}', - style: TextStyle( - fontSize: 12, - height: 1.4, - fontWeight: FontWeight.w600, - color: GcColors.muted, - ), - ), - const SizedBox(height: 2), - Text( - settings?.platform ?? '—', - style: TextStyle( - fontSize: 11.5, - height: 1.4, - color: GcColors.ghost, - ), - ), - ], - ), - ), - ], - ), - ); - } - - /// 品牌区:一个渐变圆角标 + 名称 + 一句定位。 - Widget _brand() { - return Row( - children: [ - Container( - width: 32, - height: 32, - alignment: Alignment.center, - decoration: BoxDecoration( - color: GcColors.accentSoft, - borderRadius: BorderRadius.circular(9), - border: Border.all( - color: Color.alphaBlend( - GcColors.accent.withOpacity(0.35), GcColors.sideBg), - ), - ), - child: Text( - '◎', - style: TextStyle(fontSize: 16, height: 1.1, color: GcColors.accent), - ), - ), - const SizedBox(width: GcSpace.md), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Text( - 'Morris GC', - style: TextStyle( - fontSize: 14, - height: 1.3, - fontWeight: FontWeight.w600, - color: GcColors.ink, - ), - ), - const SizedBox(height: 1), - Text( - 'SCIENCE · CLASSROOM', - style: TextStyle( - fontSize: 10, - height: 1.3, - letterSpacing: 0.9, - fontWeight: FontWeight.w600, - color: GcColors.ghost, - ), - ), - ], - ), - ), - ], - ); - } -} - -class _NavButton extends StatelessWidget { - const _NavButton({ - required this.item, - required this.active, - required this.onTap, - }); - - final _NavItem item; - final bool active; - final VoidCallback onTap; - - @override - Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.only(bottom: GcSpace.xs), - child: Material( - color: active ? GcColors.accentSoft : Colors.transparent, - borderRadius: BorderRadius.circular(GcRadius.control), - child: InkWell( - borderRadius: BorderRadius.circular(GcRadius.control), - onTap: onTap, - hoverColor: GcColors.surfaceHover, - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: GcSpace.md, - vertical: 11, - ), - child: Row( - children: [ - Icon( - item.icon, - size: 17, - color: active ? GcColors.accent : GcColors.faint, - ), - const SizedBox(width: GcSpace.md), - Text( - T(item.labelKey), - style: TextStyle( - fontSize: 13.5, - height: 1.2, - fontWeight: active ? FontWeight.w600 : FontWeight.w400, - color: active ? GcColors.accent : GcColors.muted, - ), - ), - ], - ), - ), - ), - ), - ); - } -} - -class _UpdateBar extends StatelessWidget { - const _UpdateBar({required this.controller}); - - final ShellController controller; - - @override - Widget build(BuildContext context) { - return Container( - decoration: BoxDecoration( - color: GcColors.surface, - border: Border(top: BorderSide(color: GcColors.line)), - ), - padding: const EdgeInsets.symmetric( - horizontal: GcSpace.xxl, - vertical: GcSpace.md, - ), - child: Row( - children: [ - Icon( - Icons.sync_rounded, - size: 18, - color: GcColors.accent, - ), - const SizedBox(width: GcSpace.md), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Text( - controller.updateStatus, - style: TextStyle( - fontSize: 13, - height: 1.35, - fontWeight: FontWeight.w600, - color: GcColors.ink, - ), - overflow: TextOverflow.ellipsis, - ), - if (controller.updateDetail.isNotEmpty) - Text( - controller.updateDetail, - style: TextStyle( - fontSize: 12, - height: 1.4, - color: GcColors.faint, - ), - overflow: TextOverflow.ellipsis, - ), - if (controller.launcherNotice.isNotEmpty) - Text( - controller.launcherNotice, - style: TextStyle( - fontSize: 12, - height: 1.4, - color: GcColors.warn, - ), - ), - ], - ), - ), - if (controller.updateBusy) ...[ - const SizedBox(width: GcSpace.lg), - SizedBox( - width: 140, - child: ClipRRect( - borderRadius: BorderRadius.circular(3), - child: LinearProgressIndicator( - value: controller.updateProgress > 0 - ? controller.updateProgress.clamp(0, 1).toDouble() - : null, - minHeight: 4, - ), - ), - ), - ], - const SizedBox(width: GcSpace.lg), - TextButton( - onPressed: controller.updateBusy - ? null - : () => controller.checkUpdate(force: true), - child: Text(T('update.checkNow')), - ), - ], - ), - ); - } -} - -class _BackendDown extends StatelessWidget { - const _BackendDown({required this.controller}); - - final ShellController controller; - - @override - Widget build(BuildContext context) { - return Center( - child: ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 520), - child: GcCard( - padding: const EdgeInsets.all(GcSpace.xxl), - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Icon(Icons.error_outline_rounded, - size: 20, color: GcColors.danger), - const SizedBox(width: GcSpace.sm), - Text( - T('common.error'), - style: TextStyle( - fontSize: 16, - height: 1.35, - fontWeight: FontWeight.w600, - color: GcColors.ink, - ), - ), - ], - ), - const SizedBox(height: GcSpace.md), - GcHint(controller.loadError ?? ''), - const SizedBox(height: GcSpace.xs), - GcHint('${T('set.backend')}: ${controller.api.baseUrl}' - ' · ${controller.api.hasSessionToken ? '令牌已就绪' : '缺少会话令牌'}'), - const SizedBox(height: GcSpace.lg), - FilledButton( - onPressed: controller.bootstrap, - child: Text(T('common.retry')), - ), - ], - ), - ), - ), - ); - } -} diff --git a/GC-UI/frontend/lib/theme.dart b/GC-UI/frontend/lib/theme.dart deleted file mode 100644 index f7239d1..0000000 --- a/GC-UI/frontend/lib/theme.dart +++ /dev/null @@ -1,1049 +0,0 @@ -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; - -// --------------------------------------------------------------------------- -// 设计令牌 -// --------------------------------------------------------------------------- - -/// 间距 / 圆角:全应用统一取值,避免各处 13.5、17 之类的散数。 -class GcSpace { - GcSpace._(); - - static const double xs = 4; - static const double sm = 8; - static const double md = 12; - static const double lg = 16; - static const double xl = 20; - static const double xxl = 24; - static const double xxxl = 32; -} - -/// 圆角。 -class GcRadius { - GcRadius._(); - - static const double control = 8; - static const double card = 12; - static const double panel = 16; - static const double pill = 999; -} - -/// 尺寸:侧栏 / 控件高度。 -class GcSize { - GcSize._(); - - static const double sidebar = 248; - static const double control = 40; - static const double controlSmall = 32; -} - -/// 字体。 -/// -/// 中文界面「发糊」的一大来源是字体回退到了很细的旧字体:Windows 上 -/// Segoe UI 没有中文字形,缺字时由系统回退,字号一小就糊成一片。 -/// 这里显式指定「拉丁用系统 UI 字体 + 中文用雅黑 / 苹方」,并把行高 -/// 钉死,避免不同平台的默认行高把中文挤在一起。 -class GcFonts { - GcFonts._(); - - /// 拉丁字形字体。macOS 留空,走系统默认(苹方),不要写死字体名。 - static String? get family { - if (kIsWeb) return null; - switch (defaultTargetPlatform) { - case TargetPlatform.windows: - return 'Segoe UI'; - case TargetPlatform.linux: - return 'Noto Sans'; - default: - return null; - } - } - - /// 中文字形回退顺序:先细体、再常规体,最后才是旧版回退。 - static List get fallback { - if (kIsWeb) return const ['Noto Sans CJK SC', 'sans-serif']; - switch (defaultTargetPlatform) { - case TargetPlatform.windows: - return const [ - 'Microsoft YaHei UI', - 'Microsoft YaHei', - 'SimHei' - ]; - case TargetPlatform.linux: - return const [ - 'Noto Sans CJK SC', - 'Noto Sans SC', - 'WenQuanYi Micro Hei' - ]; - default: - return const [ - 'PingFang SC', - 'Hiragino Sans GB', - 'Noto Sans CJK SC' - ]; - } - } -} - -/// 主题偏好(可在设置页切换,并持久化到后端 settings.theme)。 -class GcPalette { - GcPalette._(); - - /// 默认强调色,与 Avalonia 启动器一致。 - static const Color defaultAccent = Color(0xFF8FB6FF); - - static final ValueNotifier accent = - ValueNotifier(defaultAccent); - - /// 当前主题模式(dark / light / system)。 - static final ValueNotifier mode = - ValueNotifier(ThemeMode.dark); - - /// 设置页可选的预设色板。 - static const List presets = [ - Color(0xFF8FB6FF), // 极光蓝(默认) - Color(0xFF7C6CFF), // 星云紫 - Color(0xFF4FD1C5), // 湖水青 - Color(0xFF6BE3A2), // 极光绿 - Color(0xFFFFC46B), // 暖阳橙 - Color(0xFFFF8FB1), // 樱粉 - Color(0xFFFF7A7A), // 珊瑚红 - Color(0xFFB0BEC5), // 石墨灰 - ]; - - /// 把后端设置里的 `theme` 字符串转成 [ThemeMode](未知值按深色处理)。 - static ThemeMode parseMode(String? value) { - switch ((value ?? '').trim().toLowerCase()) { - case 'light': - return ThemeMode.light; - case 'system': - return ThemeMode.system; - case 'dark': - default: - return ThemeMode.dark; - } - } - - /// 把 [ThemeMode] 转回后端设置的字符串。 - static String modeToName(ThemeMode value) { - switch (value) { - case ThemeMode.light: - return 'light'; - case ThemeMode.system: - return 'system'; - case ThemeMode.dark: - return 'dark'; - } - } - - /// 应用主题模式(来自后端设置)。 - static void applyTheme(String? value) { - final next = parseMode(value); - if (mode.value != next) mode.value = next; - } - - /// 把 `#RRGGBB` / `RRGGBB` 解析为颜色;非法返回 null。 - static Color? parseHex(String? value) { - if (value == null) return null; - var hex = value.trim(); - if (hex.startsWith('#')) hex = hex.substring(1); - if (hex.length == 8) hex = hex.substring(2); // 忽略 alpha - if (hex.length != 6) return null; - final parsed = int.tryParse(hex, radix: 16); - if (parsed == null) return null; - return Color(0xFF000000 | parsed); - } - - /// 颜色转 `#RRGGBB`。 - static String toHex(Color color) { - // ignore: deprecated_member_use - final rgb = color.value & 0xFFFFFF; - return '#${rgb.toRadixString(16).padLeft(6, '0').toUpperCase()}'; - } - - /// 应用颜色(来自后端设置或用户点选)。 - static void apply(String? hex) { - final color = parseHex(hex); - if (color == null) return; - // ignore: deprecated_member_use - if (accent.value.value != color.value) accent.value = color; - } -} - -/// 配色:浅色 / 深色两套,按当前 [Brightness] 取值。 -/// -/// 深色不再用「深蓝底 + 半透明白」,而是中性石墨底 + 高对比正文: -/// 半透明叠加会让中文笔画边缘出现灰边,看着就是「糊」。这里所有文字 -/// 颜色都是不透明的实色。 -class GcColors { - GcColors._(); - - static bool _dark = true; - - static bool get isDark => _dark; - - /// 由 `MaterialApp.builder` 在每次构建前按实际亮度绑定。 - static void bind(Brightness brightness) => - _dark = brightness == Brightness.dark; - - static Color _pick(int dark, int light) => Color(_dark ? dark : light); - - // ---- 底与面 ---- - static Color get appBg => _pick(0xFF080B12, 0xFFF3F6FB); - static Color get sideBg => _pick(0xFF0C1119, 0xFFFFFFFF); - static Color get surface => _pick(0xFF131B28, 0xFFFFFFFF); - static Color get surfaceAlt => _pick(0xFF1A2434, 0xFFEDF2F9); - static Color get surfaceHover => _pick(0xFF202B3D, 0xFFE2EAF5); - - // ---- 描边 ---- - static Color get line => _pick(0xFF243044, 0xFFDEE6F1); - static Color get lineStrong => _pick(0xFF33425A, 0xFFC4D1E3); - - // ---- 文字 ---- - static Color get ink => _pick(0xFFEAF0FA, 0xFF0E1522); - static Color get muted => _pick(0xFFA7B4C8, 0xFF48566B); - static Color get faint => _pick(0xFF7E8CA3, 0xFF69788E); - static Color get ghost => _pick(0xFF5C6A80, 0xFF94A2B6); - - // ---- 状态 ---- - static Color get warn => _pick(0xFFF2C57C, 0xFF9A5B00); - static Color get danger => _pick(0xFFF08A8A, 0xFFB3261E); - static Color get ok => _pick(0xFF74DFA8, 0xFF12714A); - - /// 当前强调色(动态,跟随设置)。 - static Color get accent => GcPalette.accent.value; - - /// 主按钮填充色:深色主题直接用强调色(浅底深字最清晰), - /// 浅色主题把强调色压深,避免白底上「浅蓝底 + 白字」看不清。 - static Color get accentFill => _dark ? accent : _darken(accent, 0.18); - - /// 强调色上的文字 / 图标颜色,按对比度自动取深色或白色。 - static Color get onAccent { - final fill = accentFill; - // 阈值 0.42:粉紫色(低亮度)走白字,天蓝 / 薄荷(高亮度)走深字。 - return fill.computeLuminance() > 0.42 - ? const Color(0xFF0A1226) - : Colors.white; - } - - /// 强调色的淡底(选中项 / 标签背景)。用不透明混色,不用 withOpacity: - /// 半透明色叠在卡片上会让下层的圆角描边透出来,边缘发脏。 - static Color get accentSoft => - Color.lerp(surface, accent, _dark ? 0.16 : 0.12)!; - - static Color _darken(Color color, double amount) { - final hsl = HSLColor.fromColor(color); - return hsl - .withSaturation((hsl.saturation + amount * 0.35).clamp(0.0, 1.0)) - .withLightness((hsl.lightness - amount).clamp(0.0, 1.0)) - .toColor(); - } -} - -/// 按指定亮度构建主题。 -/// -/// [fontFamily] / [fontFamilyFallback] 默认取 [GcFonts] 的平台字体栈; -/// 截图 / 自动化测试需要换成自己加载的字体时,从这里传,才能连按钮、 -/// 输入框这些「主题内嵌样式」一起换掉。 -/// -/// 注意:不要在这里改 [GcColors] 的全局状态 —— MaterialApp 会同时构建 -/// theme 与 darkTheme,后构建的那个会把状态写脏。亮度绑定由 `main.dart` -/// 的 builder 统一完成。 -ThemeData buildGcTheme( - Brightness brightness, { - String? fontFamily, - List? fontFamilyFallback, -}) { - final family = fontFamily ?? GcFonts.family; - final fallback = fontFamilyFallback ?? GcFonts.fallback; - final isDark = brightness == Brightness.dark; - final base = isDark - ? ThemeData.dark(useMaterial3: true) - : ThemeData.light(useMaterial3: true); - - Color pick(int dark, int light) => Color(isDark ? dark : light); - - final appBg = pick(0xFF080B12, 0xFFF3F6FB); - final surface = pick(0xFF131B28, 0xFFFFFFFF); - final surfaceAlt = pick(0xFF1A2434, 0xFFEDF2F9); - final surfaceHover = pick(0xFF202B3D, 0xFFE2EAF5); - final line = pick(0xFF243044, 0xFFDEE6F1); - final lineStrong = pick(0xFF33425A, 0xFFC4D1E3); - final ink = pick(0xFFEAF0FA, 0xFF0E1522); - final muted = pick(0xFFA7B4C8, 0xFF48566B); - final faint = pick(0xFF7E8CA3, 0xFF69788E); - final danger = pick(0xFFF08A8A, 0xFFB3261E); - final accent = GcPalette.accent.value; - final accentFill = isDark ? accent : _darkenTheme(accent, 0.18); - final accentSoft = Color.lerp(surface, accent, isDark ? 0.16 : 0.12)!; - final onAccent = accentFill.computeLuminance() > 0.42 - ? const Color(0xFF0A1226) - : Colors.white; - - // 字号 / 行高在这里定义;字体族必须最后统一 apply —— - // 下面每个 TextStyle 都是新建对象,不会继承前面的 fontFamily, - // 漏掉就会回退到系统默认字体(中文尤其糊)。 - final textTheme = base.textTheme - .copyWith( - // 页面主标题 - displaySmall: TextStyle( - fontSize: 28, - height: 1.24, - fontWeight: FontWeight.w600, - letterSpacing: -0.2, - color: ink, - ), - headlineMedium: TextStyle( - fontSize: 24, - height: 1.28, - fontWeight: FontWeight.w600, - letterSpacing: -0.2, - color: ink, - ), - headlineSmall: TextStyle( - fontSize: 20, - height: 1.32, - fontWeight: FontWeight.w600, - color: ink, - ), - // 分区标题 - titleLarge: TextStyle( - fontSize: 16, - height: 1.4, - fontWeight: FontWeight.w600, - color: ink, - ), - titleMedium: TextStyle( - fontSize: 14, - height: 1.45, - fontWeight: FontWeight.w600, - color: ink, - ), - titleSmall: TextStyle( - fontSize: 13, - height: 1.45, - fontWeight: FontWeight.w600, - color: ink, - ), - // 正文 - bodyLarge: TextStyle(fontSize: 14, height: 1.6, color: ink), - bodyMedium: TextStyle(fontSize: 13, height: 1.6, color: muted), - bodySmall: TextStyle(fontSize: 12, height: 1.55, color: faint), - // 按钮 / 标签 - labelLarge: const TextStyle( - fontSize: 13, - height: 1.2, - fontWeight: FontWeight.w600, - letterSpacing: 0, - ), - labelMedium: TextStyle( - fontSize: 12, - height: 1.2, - fontWeight: FontWeight.w600, - color: muted, - ), - labelSmall: TextStyle( - fontSize: 11, - height: 1.2, - fontWeight: FontWeight.w600, - letterSpacing: 0.6, - color: faint, - ), - ) - // 只统一字体族,不动上面各自设置的字号与颜色。 - .apply( - fontFamily: family, - fontFamilyFallback: fallback, - ); - - final buttonShape = RoundedRectangleBorder( - borderRadius: BorderRadius.circular(GcRadius.control), - ); - - ButtonStyle buttonStyle({ - required Color background, - required Color foreground, - Color? border, - bool transparent = false, - }) { - Color blend(Color base, double v) => - Color.lerp(base, isDark ? Colors.white : Colors.black, v)!; - final Color normal = transparent ? Colors.transparent : background; - final Color hover = transparent ? surfaceAlt : blend(background, 0.07); - final Color pressed = transparent ? surfaceHover : blend(background, 0.14); - return ButtonStyle( - minimumSize: const WidgetStatePropertyAll(Size(0, GcSize.control)), - padding: const WidgetStatePropertyAll( - EdgeInsets.symmetric(horizontal: 18), - ), - shape: WidgetStatePropertyAll(buttonShape), - textStyle: WidgetStatePropertyAll(textTheme.labelLarge!), - elevation: const WidgetStatePropertyAll(0), - backgroundColor: WidgetStateProperty.resolveWith((states) { - if (states.contains(WidgetState.disabled)) { - return transparent ? Colors.transparent : blend(background, 0.04); - } - if (states.contains(WidgetState.pressed)) return pressed; - if (states.contains(WidgetState.hovered) || - states.contains(WidgetState.focused)) { - return hover; - } - return normal; - }), - foregroundColor: WidgetStateProperty.resolveWith((states) { - if (states.contains(WidgetState.disabled)) return faint; - return foreground; - }), - overlayColor: const WidgetStatePropertyAll(Colors.transparent), - side: border == null - ? null - : WidgetStateProperty.resolveWith((states) { - if (states.contains(WidgetState.disabled)) { - return BorderSide(color: line); - } - if (states.contains(WidgetState.hovered)) { - return BorderSide(color: lineStrong); - } - return BorderSide(color: border); - }), - ); - } - - return base.copyWith( - scaffoldBackgroundColor: appBg, - colorScheme: base.colorScheme.copyWith( - brightness: brightness, - primary: accentFill, - onPrimary: onAccent, - secondary: accent, - onSecondary: onAccent, - surface: surface, - onSurface: ink, - error: danger, - outline: lineStrong, - outlineVariant: line, - surfaceContainerHighest: surfaceAlt, - ), - textTheme: textTheme, - dividerColor: line, - dividerTheme: DividerThemeData(color: line, thickness: 1, space: 1), - cardTheme: CardTheme( - color: surface, - elevation: 0, - margin: EdgeInsets.zero, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(GcRadius.card), - side: BorderSide(color: line), - ), - ), - filledButtonTheme: FilledButtonThemeData( - style: buttonStyle( - background: accentFill, - foreground: onAccent, - border: accentFill, - ), - ), - outlinedButtonTheme: OutlinedButtonThemeData( - style: buttonStyle( - background: Colors.transparent, - foreground: ink, - border: lineStrong, - transparent: true, - ), - ), - textButtonTheme: TextButtonThemeData( - style: TextButton.styleFrom( - minimumSize: const Size(0, GcSize.controlSmall), - padding: const EdgeInsets.symmetric(horizontal: 12), - foregroundColor: muted, - textStyle: textTheme.labelLarge, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(GcRadius.control), - ), - ).copyWith( - foregroundColor: WidgetStateProperty.resolveWith((states) { - if (states.contains(WidgetState.disabled)) return faint; - if (states.contains(WidgetState.hovered)) return ink; - return muted; - }), - backgroundColor: WidgetStateProperty.resolveWith((states) { - if (states.contains(WidgetState.hovered)) return surfaceAlt; - return Colors.transparent; - }), - overlayColor: const WidgetStatePropertyAll(Colors.transparent), - ), - ), - iconButtonTheme: IconButtonThemeData( - style: IconButton.styleFrom( - minimumSize: const Size(32, 32), - foregroundColor: muted, - highlightColor: Colors.transparent, - hoverColor: surfaceAlt, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(GcRadius.control), - ), - ), - ), - sliderTheme: base.sliderTheme.copyWith( - activeTrackColor: accent, - thumbColor: accent, - inactiveTrackColor: line, - trackHeight: 4, - overlayShape: const RoundSliderOverlayShape(overlayRadius: 16), - thumbShape: const RoundSliderThumbShape(enabledThumbRadius: 7), - ), - switchTheme: SwitchThemeData( - thumbColor: WidgetStateProperty.resolveWith( - (states) => states.contains(WidgetState.selected) ? onAccent : faint, - ), - trackColor: WidgetStateProperty.resolveWith((states) { - if (states.contains(WidgetState.selected)) return accentFill; - return isDark ? surfaceAlt : line; - }), - trackOutlineColor: WidgetStateProperty.resolveWith( - (states) => - states.contains(WidgetState.selected) ? accentFill : lineStrong, - ), - ), - progressIndicatorTheme: ProgressIndicatorThemeData( - color: accent, - linearTrackColor: isDark ? surfaceAlt : line, - linearMinHeight: 4, - circularTrackColor: Colors.transparent, - ), - tooltipTheme: TooltipThemeData( - waitDuration: const Duration(milliseconds: 500), - decoration: BoxDecoration( - color: isDark ? const Color(0xFF1D2739) : const Color(0xFF0E1522), - borderRadius: BorderRadius.circular(6), - ), - textStyle: TextStyle( - color: isDark ? ink : Colors.white, - fontSize: 12, - height: 1.4, - ), - ), - dialogTheme: DialogTheme( - backgroundColor: surface, - surfaceTintColor: Colors.transparent, - elevation: 0, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(GcRadius.panel), - side: BorderSide(color: line), - ), - titleTextStyle: textTheme.titleLarge, - contentTextStyle: textTheme.bodyMedium?.copyWith(color: muted), - ), - snackBarTheme: SnackBarThemeData( - backgroundColor: - isDark ? const Color(0xFF1D2739) : const Color(0xFF0E1522), - contentTextStyle: - TextStyle(color: isDark ? ink : Colors.white, fontSize: 13), - behavior: SnackBarBehavior.floating, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), - elevation: 0, - ), - dropdownMenuTheme: DropdownMenuThemeData( - menuStyle: MenuStyle( - backgroundColor: WidgetStatePropertyAll(surfaceAlt), - surfaceTintColor: - const WidgetStatePropertyAll(Colors.transparent), - shape: WidgetStatePropertyAll( - RoundedRectangleBorder( - borderRadius: BorderRadius.circular(GcRadius.control), - side: BorderSide(color: line), - ), - ), - ), - textStyle: textTheme.bodyLarge, - ), - popupMenuTheme: PopupMenuThemeData( - color: surfaceAlt, - surfaceTintColor: Colors.transparent, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(GcRadius.control), - side: BorderSide(color: line), - ), - textStyle: textTheme.bodyMedium?.copyWith(color: ink), - ), - segmentedButtonTheme: SegmentedButtonThemeData( - style: ButtonStyle( - minimumSize: const WidgetStatePropertyAll(Size(0, 36)), - padding: const WidgetStatePropertyAll( - EdgeInsets.symmetric(horizontal: 14), - ), - textStyle: WidgetStatePropertyAll(textTheme.labelLarge!), - backgroundColor: WidgetStateProperty.resolveWith((states) { - return states.contains(WidgetState.selected) - ? accentSoft - : Colors.transparent; - }), - foregroundColor: WidgetStateProperty.resolveWith((states) { - return states.contains(WidgetState.selected) ? ink : muted; - }), - side: WidgetStatePropertyAll(BorderSide(color: lineStrong)), - shape: WidgetStatePropertyAll( - RoundedRectangleBorder( - borderRadius: BorderRadius.circular(GcRadius.control)), - ), - ), - ), - inputDecorationTheme: InputDecorationTheme( - filled: true, - fillColor: surfaceAlt, - isDense: true, - contentPadding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12), - hintStyle: TextStyle(color: faint, fontSize: 13), - helperStyle: TextStyle(color: faint, fontSize: 12), - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(GcRadius.control), - borderSide: BorderSide(color: line), - ), - enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(GcRadius.control), - borderSide: BorderSide(color: line), - ), - focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(GcRadius.control), - borderSide: BorderSide(color: accent, width: 1.4), - ), - ), - scrollbarTheme: ScrollbarThemeData( - thickness: const WidgetStatePropertyAll(8), - radius: const Radius.circular(4), - thumbColor: WidgetStateProperty.resolveWith((states) { - if (states.contains(WidgetState.hovered) || - states.contains(WidgetState.dragged)) { - return faint; - } - return lineStrong; - }), - crossAxisMargin: 2, - mainAxisMargin: 2, - ), - splashFactory: NoSplash.splashFactory, - highlightColor: Colors.transparent, - ); -} - -Color _darkenTheme(Color color, double amount) { - final hsl = HSLColor.fromColor(color); - return hsl - .withSaturation((hsl.saturation + amount * 0.4).clamp(0.0, 1.0)) - .withLightness((hsl.lightness - amount).clamp(0.0, 1.0)) - .toColor(); -} - -// --------------------------------------------------------------------------- -// 通用组件 -// --------------------------------------------------------------------------- - -/// 通用卡片容器:一层描边 + 极浅投影,不用半透明叠色。 -class GcCard extends StatelessWidget { - const GcCard({ - super.key, - required this.child, - this.padding, - this.width, - this.radius, - this.color, - this.borderColor, - this.clip = false, - }); - - final Widget child; - final EdgeInsetsGeometry? padding; - final double? width; - final double? radius; - final Color? color; - final Color? borderColor; - final bool clip; - - @override - Widget build(BuildContext context) { - final r = radius ?? GcRadius.card; - return Container( - width: width, - padding: padding ?? const EdgeInsets.all(GcSpace.xl), - clipBehavior: clip ? Clip.antiAlias : Clip.none, - decoration: BoxDecoration( - color: color ?? GcColors.surface, - borderRadius: BorderRadius.circular(r), - border: Border.all(color: borderColor ?? GcColors.line), - ), - child: child, - ); - } -} - -/// 分区标题:左侧标题 + 右侧操作。 -class GcSectionTitle extends StatelessWidget { - const GcSectionTitle(this.text, {super.key, this.trailing, this.subtitle}); - - final String text; - final Widget? trailing; - final String? subtitle; - - @override - Widget build(BuildContext context) { - return Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Text( - text, - style: TextStyle( - fontSize: 15, - height: 1.4, - fontWeight: FontWeight.w600, - color: GcColors.ink, - ), - ), - if (subtitle != null) ...[ - const SizedBox(height: GcSpace.xs), - Text( - subtitle!, - style: TextStyle( - fontSize: 12, - height: 1.5, - color: GcColors.faint, - ), - ), - ], - ], - ), - ), - if (trailing != null) trailing!, - ], - ); - } -} - -/// 说明文字。 -class GcHint extends StatelessWidget { - const GcHint(this.text, {super.key, this.maxLines, this.align}); - - final String text; - final int? maxLines; - final TextAlign? align; - - @override - Widget build(BuildContext context) => Text( - text, - maxLines: maxLines, - textAlign: align, - overflow: maxLines == null ? null : TextOverflow.ellipsis, - style: TextStyle( - fontSize: 12, - height: 1.6, - color: GcColors.faint, - ), - ); -} - -/// 页面标题区:大标题 + 一句说明 + 右侧操作。 -class GcPageHeader extends StatelessWidget { - const GcPageHeader({ - super.key, - required this.title, - this.subtitle, - this.trailing, - }); - - final String title; - final String? subtitle; - final Widget? trailing; - - @override - Widget build(BuildContext context) { - return Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Text( - title, - style: TextStyle( - fontSize: 22, - height: 1.3, - fontWeight: FontWeight.w600, - letterSpacing: -0.1, - color: GcColors.ink, - ), - ), - if (subtitle != null && subtitle!.isNotEmpty) ...[ - const SizedBox(height: GcSpace.xs + 2), - Text( - subtitle!, - style: TextStyle( - fontSize: 13, - height: 1.6, - color: GcColors.muted, - ), - ), - ], - ], - ), - ), - if (trailing != null) ...[ - const SizedBox(width: GcSpace.lg), - Padding( - padding: const EdgeInsets.only(top: 2), - child: trailing!, - ), - ], - ], - ); - } -} - -/// 小胶囊标签(版本 / 标签 / 状态)。 -class GcPill extends StatelessWidget { - const GcPill( - this.text, { - super.key, - this.color, - this.subtle = false, - this.icon, - }); - - final String text; - final Color? color; - final bool subtle; - final IconData? icon; - - @override - Widget build(BuildContext context) { - final tint = color ?? GcColors.muted; - final background = subtle - ? GcColors.surfaceAlt - : Color.alphaBlend(tint.withOpacity(0.16), GcColors.surface); - return Container( - padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3), - decoration: BoxDecoration( - color: background, - borderRadius: BorderRadius.circular(GcRadius.pill), - border: Border.all( - color: subtle - ? GcColors.line - : Color.alphaBlend(tint.withOpacity(0.34), GcColors.surface), - ), - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - if (icon != null) ...[ - Icon(icon, size: 11, color: subtle ? GcColors.faint : tint), - const SizedBox(width: 4), - ], - Text( - text, - style: TextStyle( - fontSize: 11, - height: 1.25, - fontWeight: FontWeight.w600, - color: subtle ? GcColors.faint : tint, - ), - ), - ], - ), - ); - } -} - -/// 数字指标块(首页 / 关于页用)。 -class GcMetric extends StatelessWidget { - const GcMetric({ - super.key, - required this.value, - required this.label, - this.valueColor, - }); - - final String value; - final String label; - final Color? valueColor; - - @override - Widget build(BuildContext context) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Text( - value, - style: TextStyle( - fontSize: 20, - height: 1.2, - fontWeight: FontWeight.w600, - letterSpacing: -0.2, - color: valueColor ?? GcColors.ink, - ), - ), - const SizedBox(height: GcSpace.xs), - Text( - label, - style: TextStyle( - fontSize: 12, - height: 1.4, - color: GcColors.faint, - ), - ), - ], - ); - } -} - -/// 统一的空状态 / 错误提示块。 -class GcMessage extends StatelessWidget { - const GcMessage({ - super.key, - required this.title, - this.message, - this.icon, - this.color, - this.action, - }); - - final String title; - final String? message; - final IconData? icon; - final Color? color; - final Widget? action; - - @override - Widget build(BuildContext context) { - final tint = color ?? GcColors.faint; - return GcCard( - padding: const EdgeInsets.symmetric( - horizontal: GcSpace.xxl, - vertical: GcSpace.xl, - ), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (icon != null) ...[ - Container( - width: 34, - height: 34, - decoration: BoxDecoration( - color: GcColors.surfaceAlt, - borderRadius: BorderRadius.circular(GcRadius.control), - ), - alignment: Alignment.center, - child: Icon(icon, size: 18, color: tint), - ), - const SizedBox(width: GcSpace.md), - ], - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Text( - title, - style: TextStyle( - fontSize: 14, - height: 1.45, - fontWeight: FontWeight.w600, - color: GcColors.ink, - ), - ), - if (message != null && message!.isNotEmpty) ...[ - const SizedBox(height: GcSpace.xs + 2), - Text( - message!, - style: TextStyle( - fontSize: 12, - height: 1.6, - color: GcColors.faint, - ), - ), - ], - if (action != null) ...[ - const SizedBox(height: GcSpace.md), - action!, - ], - ], - ), - ), - ], - ), - ); - } -} - -/// 设置页 / 关于页的「标签 + 值」行。 -class GcFieldRow extends StatelessWidget { - const GcFieldRow({ - super.key, - required this.label, - required this.value, - this.selectable = false, - this.valueColor, - this.trailing, - }); - - final String label; - final String value; - final bool selectable; - final Color? valueColor; - final Widget? trailing; - - @override - Widget build(BuildContext context) { - final style = TextStyle( - fontSize: 13, - height: 1.55, - color: valueColor ?? GcColors.ink, - ); - return Padding( - padding: const EdgeInsets.symmetric(vertical: 6), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - width: 132, - child: Text( - label, - style: TextStyle( - fontSize: 13, - height: 1.55, - color: GcColors.muted, - ), - ), - ), - Expanded( - child: selectable - ? SelectableText(value, style: style) - : Text(value, style: style), - ), - if (trailing != null) ...[ - const SizedBox(width: GcSpace.sm), - trailing!, - ], - ], - ), - ); - } -} - -/// 细分割线。 -class GcDivider extends StatelessWidget { - const GcDivider({super.key, this.verticalPadding = GcSpace.md}); - - final double verticalPadding; - - @override - Widget build(BuildContext context) => Padding( - padding: EdgeInsets.symmetric(vertical: verticalPadding), - child: Container(height: 1, color: GcColors.line), - ); -} diff --git a/GC-UI/frontend/lib/window_chrome.dart b/GC-UI/frontend/lib/window_chrome.dart deleted file mode 100644 index 047f46e..0000000 --- a/GC-UI/frontend/lib/window_chrome.dart +++ /dev/null @@ -1,164 +0,0 @@ -import 'dart:io'; - -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; - -import 'theme.dart'; - -/// 自绘窗口按钮的通道(macOS 侧在 macos/Runner/MainFlutterWindow.swift 实现)。 -/// -/// 系统标题栏已去掉(titleVisibility = .hidden + fullSizeContentView), -/// 最小化 / 最大化 / 关闭 全部由 Flutter 画,外观跟界面统一。 -class GcWindow { - GcWindow._(); - - static const MethodChannel _channel = MethodChannel('gc/window'); - - /// 只有 macOS 走了自绘标题栏;其它平台保留系统标题栏,不显示自绘按钮。 - static bool get supported => !kIsWeb && Platform.isMacOS; - - static Future minimize() => _invoke('minimize'); - static Future close() => _invoke('close'); - static Future toggleMaximize() => _invoke('toggleMaximize'); - - /// 开始拖拽窗口。用原生 performDrag,比在 Flutter 里模拟位置更跟手。 - static Future beginDrag() => _invoke('beginDrag'); - - static Future isMaximized() async { - if (!supported) return false; - try { - return await _channel.invokeMethod('isMaximized') ?? false; - } catch (_) { - return false; - } - } - - static Future _invoke(String method) async { - if (!supported) return; - try { - await _channel.invokeMethod(method); - } catch (_) { - // 通道不可用(例如截图测试环境)时静默忽略 - } - } -} - -/// 顶部标题栏:左侧应用名 + 右侧自绘的最小化 / 最大化 / 关闭。 -/// -/// 只在 macOS 显示;其它平台系统标题栏还在,这里返回零高度占位。 -class GcTitleBar extends StatelessWidget { - const GcTitleBar({super.key, this.title = 'Morris GC'}); - - final String title; - - static const double height = 38; - - @override - Widget build(BuildContext context) { - if (!GcWindow.supported) return const SizedBox.shrink(); - - return GestureDetector( - behavior: HitTestBehavior.opaque, - onPanStart: (_) => GcWindow.beginDrag(), - child: Container( - height: height, - // 与主题底色保持一致:浅色主题是纯白,深色主题是深色面板色。 - // 不叠强调色 —— 标题栏属于窗口底色,染色会显得和内容区不是一套。 - decoration: BoxDecoration( - color: GcColors.sideBg, - border: Border(bottom: BorderSide(color: GcColors.line)), - ), - padding: const EdgeInsets.only(left: GcSpace.xl, right: GcSpace.sm), - child: Row( - children: [ - Text( - title, - style: TextStyle( - fontSize: 12.5, - height: 1.2, - fontWeight: FontWeight.w600, - letterSpacing: 0.2, - color: GcColors.faint, - ), - ), - const Spacer(), - _WindowButton( - icon: Icons.remove_rounded, - tooltip: '最小化', - onTap: GcWindow.minimize, - ), - _WindowButton( - icon: Icons.crop_square_rounded, - tooltip: '最大化', - onTap: GcWindow.toggleMaximize, - ), - _WindowButton( - icon: Icons.close_rounded, - tooltip: '关闭', - danger: true, - onTap: GcWindow.close, - ), - ], - ), - ), - ); - } -} - -class _WindowButton extends StatefulWidget { - const _WindowButton({ - required this.icon, - required this.tooltip, - required this.onTap, - this.danger = false, - }); - - final IconData icon; - final String tooltip; - final Future Function() onTap; - final bool danger; - - @override - State<_WindowButton> createState() => _WindowButtonState(); -} - -class _WindowButtonState extends State<_WindowButton> { - bool _hover = false; - - @override - Widget build(BuildContext context) { - final Color bg = _hover - ? (widget.danger - ? GcColors.danger.withOpacity(0.16) - : GcColors.surfaceHover) - : Colors.transparent; - - return Tooltip( - message: widget.tooltip, - waitDuration: const Duration(milliseconds: 500), - child: MouseRegion( - cursor: SystemMouseCursors.basic, - onEnter: (_) => setState(() => _hover = true), - onExit: (_) => setState(() => _hover = false), - child: GestureDetector( - onTap: () => widget.onTap(), - child: AnimatedContainer( - duration: const Duration(milliseconds: 110), - width: 40, - height: GcTitleBar.height, - alignment: Alignment.center, - color: bg, - child: Icon( - widget.icon, - size: 15, - color: _hover - ? (widget.danger ? GcColors.danger : GcColors.ink) - : GcColors.faint, - ), - ), - ), - ), - ); - } -} diff --git a/GC-UI/frontend/linux/.gitignore b/GC-UI/frontend/linux/.gitignore deleted file mode 100644 index d3896c9..0000000 --- a/GC-UI/frontend/linux/.gitignore +++ /dev/null @@ -1 +0,0 @@ -flutter/ephemeral diff --git a/GC-UI/frontend/linux/CMakeLists.txt b/GC-UI/frontend/linux/CMakeLists.txt deleted file mode 100644 index 234d0dd..0000000 --- a/GC-UI/frontend/linux/CMakeLists.txt +++ /dev/null @@ -1,146 +0,0 @@ -# Project-level configuration. -cmake_minimum_required(VERSION 3.10) -project(runner LANGUAGES CXX) - -# The name of the executable created for the application. Change this to change -# the on-disk name of your application. -set(BINARY_NAME "GC-UI") -# The unique GTK application identifier for this application. See: -# https://wiki.gnome.org/HowDoI/ChooseApplicationID -set(APPLICATION_ID "com.xhmcl.GC") - -# Explicitly opt in to modern CMake behaviors to avoid warnings with recent -# versions of CMake. -cmake_policy(SET CMP0063 NEW) - -# Load bundled libraries from the lib/ directory relative to the binary. -set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") - -# Root filesystem for cross-building. -if(FLUTTER_TARGET_PLATFORM_SYSROOT) - set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) - set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) - set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) - set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) - set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) - set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -endif() - -# Define build configuration options. -if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - set(CMAKE_BUILD_TYPE "Debug" CACHE - STRING "Flutter build mode" FORCE) - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS - "Debug" "Profile" "Release") -endif() - -# Compilation settings that should be applied to most targets. -# -# Be cautious about adding new options here, as plugins use this function by -# default. In most cases, you should add new options to specific targets instead -# of modifying this function. -function(APPLY_STANDARD_SETTINGS TARGET) - target_compile_features(${TARGET} PUBLIC cxx_std_14) - target_compile_options(${TARGET} PRIVATE -Wall -Werror) - target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") - target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") -endfunction() - -# Flutter library and tool build rules. -set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") -add_subdirectory(${FLUTTER_MANAGED_DIR}) - -# System-level dependencies. -find_package(PkgConfig REQUIRED) -pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) - -add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") - -# Define the application target. To change its name, change BINARY_NAME above, -# not the value here, or `flutter run` will no longer work. -# -# Any new source files that you add to the application should be added here. -add_executable(${BINARY_NAME} - "main.cc" - "my_application.cc" - "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" -) - -# Apply the standard set of build settings. This can be removed for applications -# that need different build settings. -apply_standard_settings(${BINARY_NAME}) - -# Add dependency libraries. Add any application-specific dependencies here. -target_link_libraries(${BINARY_NAME} PRIVATE flutter) -target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) - -# Run the Flutter tool portions of the build. This must not be removed. -add_dependencies(${BINARY_NAME} flutter_assemble) - -# Only the install-generated bundle's copy of the executable will launch -# correctly, since the resources must in the right relative locations. To avoid -# people trying to run the unbundled copy, put it in a subdirectory instead of -# the default top-level location. -set_target_properties(${BINARY_NAME} - PROPERTIES - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" -) - - -# Generated plugin build rules, which manage building the plugins and adding -# them to the application. -include(flutter/generated_plugins.cmake) - - -# === Installation === -# By default, "installing" just makes a relocatable bundle in the build -# directory. -set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") -# 无条件强制安装到 build 目录下的 bundle:某些环境下 CMAKE_INSTALL_PREFIX -# 会被初始化成 /usr/local,导致 flutter build linux 声称成功、却把产物装进 -# 系统目录,build/.../bundle 是空的。 -set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "Flutter bundle 输出目录" FORCE) - -# Start with a clean build bundle directory every time. -install(CODE " - file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") - " COMPONENT Runtime) - -set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") -set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") - -install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" - COMPONENT Runtime) - -install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" - COMPONENT Runtime) - -install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" - COMPONENT Runtime) - -foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) - install(FILES "${bundled_library}" - DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" - COMPONENT Runtime) -endforeach(bundled_library) - -# Copy the native assets provided by the build.dart from all packages. -set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") -install(DIRECTORY "${NATIVE_ASSETS_DIR}" - DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" - COMPONENT Runtime) - -# Fully re-copy the assets directory on each build to avoid having stale files -# from a previous install. -set(FLUTTER_ASSET_DIR_NAME "flutter_assets") -install(CODE " - file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") - " COMPONENT Runtime) -install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" - DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) - -# Install the AOT library on non-Debug builds only. -if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") - install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" - COMPONENT Runtime) -endif() diff --git a/GC-UI/frontend/linux/flutter/CMakeLists.txt b/GC-UI/frontend/linux/flutter/CMakeLists.txt deleted file mode 100644 index d5bd016..0000000 --- a/GC-UI/frontend/linux/flutter/CMakeLists.txt +++ /dev/null @@ -1,88 +0,0 @@ -# This file controls Flutter-level build steps. It should not be edited. -cmake_minimum_required(VERSION 3.10) - -set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") - -# Configuration provided via flutter tool. -include(${EPHEMERAL_DIR}/generated_config.cmake) - -# TODO: Move the rest of this into files in ephemeral. See -# https://github.com/flutter/flutter/issues/57146. - -# Serves the same purpose as list(TRANSFORM ... PREPEND ...), -# which isn't available in 3.10. -function(list_prepend LIST_NAME PREFIX) - set(NEW_LIST "") - foreach(element ${${LIST_NAME}}) - list(APPEND NEW_LIST "${PREFIX}${element}") - endforeach(element) - set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) -endfunction() - -# === Flutter Library === -# System-level dependencies. -find_package(PkgConfig REQUIRED) -pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) -pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) -pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) - -set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") - -# Published to parent scope for install step. -set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) -set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) -set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) -set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) - -list(APPEND FLUTTER_LIBRARY_HEADERS - "fl_basic_message_channel.h" - "fl_binary_codec.h" - "fl_binary_messenger.h" - "fl_dart_project.h" - "fl_engine.h" - "fl_json_message_codec.h" - "fl_json_method_codec.h" - "fl_message_codec.h" - "fl_method_call.h" - "fl_method_channel.h" - "fl_method_codec.h" - "fl_method_response.h" - "fl_plugin_registrar.h" - "fl_plugin_registry.h" - "fl_standard_message_codec.h" - "fl_standard_method_codec.h" - "fl_string_codec.h" - "fl_value.h" - "fl_view.h" - "flutter_linux.h" -) -list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") -add_library(flutter INTERFACE) -target_include_directories(flutter INTERFACE - "${EPHEMERAL_DIR}" -) -target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") -target_link_libraries(flutter INTERFACE - PkgConfig::GTK - PkgConfig::GLIB - PkgConfig::GIO -) -add_dependencies(flutter flutter_assemble) - -# === Flutter tool backend === -# _phony_ is a non-existent file to force this command to run every time, -# since currently there's no way to get a full input/output list from the -# flutter tool. -add_custom_command( - OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} - ${CMAKE_CURRENT_BINARY_DIR}/_phony_ - COMMAND ${CMAKE_COMMAND} -E env - ${FLUTTER_TOOL_ENVIRONMENT} - "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" - ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} - VERBATIM -) -add_custom_target(flutter_assemble DEPENDS - "${FLUTTER_LIBRARY}" - ${FLUTTER_LIBRARY_HEADERS} -) diff --git a/GC-UI/frontend/linux/main.cc b/GC-UI/frontend/linux/main.cc deleted file mode 100644 index e7c5c54..0000000 --- a/GC-UI/frontend/linux/main.cc +++ /dev/null @@ -1,6 +0,0 @@ -#include "my_application.h" - -int main(int argc, char** argv) { - g_autoptr(MyApplication) app = my_application_new(); - return g_application_run(G_APPLICATION(app), argc, argv); -} diff --git a/GC-UI/frontend/linux/my_application.cc b/GC-UI/frontend/linux/my_application.cc deleted file mode 100644 index d4cc6fd..0000000 --- a/GC-UI/frontend/linux/my_application.cc +++ /dev/null @@ -1,124 +0,0 @@ -#include "my_application.h" - -#include -#ifdef GDK_WINDOWING_X11 -#include -#endif - -#include "flutter/generated_plugin_registrant.h" - -struct _MyApplication { - GtkApplication parent_instance; - char** dart_entrypoint_arguments; -}; - -G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) - -// Implements GApplication::activate. -static void my_application_activate(GApplication* application) { - MyApplication* self = MY_APPLICATION(application); - GtkWindow* window = - GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); - - // Use a header bar when running in GNOME as this is the common style used - // by applications and is the setup most users will be using (e.g. Ubuntu - // desktop). - // If running on X and not using GNOME then just use a traditional title bar - // in case the window manager does more exotic layout, e.g. tiling. - // If running on Wayland assume the header bar will work (may need changing - // if future cases occur). - gboolean use_header_bar = TRUE; -#ifdef GDK_WINDOWING_X11 - GdkScreen* screen = gtk_window_get_screen(window); - if (GDK_IS_X11_SCREEN(screen)) { - const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); - if (g_strcmp0(wm_name, "GNOME Shell") != 0) { - use_header_bar = FALSE; - } - } -#endif - if (use_header_bar) { - GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); - gtk_widget_show(GTK_WIDGET(header_bar)); - gtk_header_bar_set_title(header_bar, "Morris GC"); - gtk_header_bar_set_show_close_button(header_bar, TRUE); - gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); - } else { - gtk_window_set_title(window, "Morris GC"); - } - - gtk_window_set_default_size(window, 1280, 720); - gtk_widget_show(GTK_WIDGET(window)); - - g_autoptr(FlDartProject) project = fl_dart_project_new(); - fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); - - FlView* view = fl_view_new(project); - gtk_widget_show(GTK_WIDGET(view)); - gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); - - fl_register_plugins(FL_PLUGIN_REGISTRY(view)); - - gtk_widget_grab_focus(GTK_WIDGET(view)); -} - -// Implements GApplication::local_command_line. -static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { - MyApplication* self = MY_APPLICATION(application); - // Strip out the first argument as it is the binary name. - self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); - - g_autoptr(GError) error = nullptr; - if (!g_application_register(application, nullptr, &error)) { - g_warning("Failed to register: %s", error->message); - *exit_status = 1; - return TRUE; - } - - g_application_activate(application); - *exit_status = 0; - - return TRUE; -} - -// Implements GApplication::startup. -static void my_application_startup(GApplication* application) { - //MyApplication* self = MY_APPLICATION(object); - - // Perform any actions required at application startup. - - G_APPLICATION_CLASS(my_application_parent_class)->startup(application); -} - -// Implements GApplication::shutdown. -static void my_application_shutdown(GApplication* application) { - //MyApplication* self = MY_APPLICATION(object); - - // Perform any actions required at application shutdown. - - G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application); -} - -// Implements GObject::dispose. -static void my_application_dispose(GObject* object) { - MyApplication* self = MY_APPLICATION(object); - g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); - G_OBJECT_CLASS(my_application_parent_class)->dispose(object); -} - -static void my_application_class_init(MyApplicationClass* klass) { - G_APPLICATION_CLASS(klass)->activate = my_application_activate; - G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; - G_APPLICATION_CLASS(klass)->startup = my_application_startup; - G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown; - G_OBJECT_CLASS(klass)->dispose = my_application_dispose; -} - -static void my_application_init(MyApplication* self) {} - -MyApplication* my_application_new() { - return MY_APPLICATION(g_object_new(my_application_get_type(), - "application-id", APPLICATION_ID, - "flags", G_APPLICATION_NON_UNIQUE, - nullptr)); -} diff --git a/GC-UI/frontend/linux/my_application.h b/GC-UI/frontend/linux/my_application.h deleted file mode 100644 index 72271d5..0000000 --- a/GC-UI/frontend/linux/my_application.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef FLUTTER_MY_APPLICATION_H_ -#define FLUTTER_MY_APPLICATION_H_ - -#include - -G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, - GtkApplication) - -/** - * my_application_new: - * - * Creates a new Flutter-based application. - * - * Returns: a new #MyApplication. - */ -MyApplication* my_application_new(); - -#endif // FLUTTER_MY_APPLICATION_H_ diff --git a/GC-UI/frontend/macos/.gitignore b/GC-UI/frontend/macos/.gitignore deleted file mode 100644 index 746adbb..0000000 --- a/GC-UI/frontend/macos/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -# Flutter-related -**/Flutter/ephemeral/ -**/Pods/ - -# Xcode-related -**/dgph -**/xcuserdata/ diff --git a/GC-UI/frontend/macos/Flutter/Flutter-Debug.xcconfig b/GC-UI/frontend/macos/Flutter/Flutter-Debug.xcconfig deleted file mode 100644 index 4b81f9b..0000000 --- a/GC-UI/frontend/macos/Flutter/Flutter-Debug.xcconfig +++ /dev/null @@ -1,2 +0,0 @@ -#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" -#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/GC-UI/frontend/macos/Flutter/Flutter-Release.xcconfig b/GC-UI/frontend/macos/Flutter/Flutter-Release.xcconfig deleted file mode 100644 index 5caa9d1..0000000 --- a/GC-UI/frontend/macos/Flutter/Flutter-Release.xcconfig +++ /dev/null @@ -1,2 +0,0 @@ -#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" -#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/GC-UI/frontend/macos/Podfile b/GC-UI/frontend/macos/Podfile deleted file mode 100644 index 4a5a5e3..0000000 --- a/GC-UI/frontend/macos/Podfile +++ /dev/null @@ -1,47 +0,0 @@ -platform :osx, '12.0' - -# CocoaPods analytics sends network stats synchronously affecting flutter build latency. -ENV['COCOAPODS_DISABLE_STATS'] = 'true' - -project 'Runner', { - 'Debug' => :debug, - 'Profile' => :release, - 'Release' => :release, -} - -def flutter_root - generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) - unless File.exist?(generated_xcode_build_settings_path) - raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" - end - - File.foreach(generated_xcode_build_settings_path) do |line| - matches = line.match(/FLUTTER_ROOT\=(.*)/) - return matches[1].strip if matches - end - raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" -end - -require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) - -flutter_macos_podfile_setup - -target 'Runner' do - use_frameworks! - use_modular_headers! - - flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) - target 'RunnerTests' do - inherit! :search_paths - end -end - -post_install do |installer| - installer.pods_project.targets.each do |target| - flutter_additional_macos_build_settings(target) - # Xcode 27 起最低部署目标为 12.0;逐个 pod 提升,避免旧 pod 的 10.13/10.14 报错。 - target.build_configurations.each do |config| - config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '12.0' - end - end -end diff --git a/GC-UI/frontend/macos/Runner.xcodeproj/project.pbxproj b/GC-UI/frontend/macos/Runner.xcodeproj/project.pbxproj deleted file mode 100644 index 797fd1a..0000000 --- a/GC-UI/frontend/macos/Runner.xcodeproj/project.pbxproj +++ /dev/null @@ -1,801 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 54; - objects = { - -/* Begin PBXAggregateTarget section */ - 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = { - isa = PBXAggregateTarget; - buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; - buildPhases = ( - 33CC111E2044C6BF0003C045 /* ShellScript */, - ); - dependencies = ( - ); - name = "Flutter Assemble"; - productName = FLX; - }; -/* End PBXAggregateTarget section */ - -/* Begin PBXBuildFile section */ - 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C80D7294CF71000263BE5 /* RunnerTests.swift */; }; - 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; - 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; - 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; - 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; - 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; - 6115A3AA09C0554E004627A7 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8206FEA4073335056184BFE7 /* Pods_RunnerTests.framework */; }; - D97968A61668AD5CB0F4AD81 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A3E308B8A5C9BFB85DE87E1A /* Pods_Runner.framework */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 33CC10E52044A3C60003C045 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 33CC10EC2044A3C60003C045; - remoteInfo = Runner; - }; - 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 33CC10E52044A3C60003C045 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 33CC111A2044C6BA0003C045; - remoteInfo = FLX; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 33CC110E2044A8840003C045 /* Bundle Framework */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - ); - name = "Bundle Framework"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 182DFB26FB114E38C6E212AD /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; - 280B76C220FC1F5F9A19A983 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; - 331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; - 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; - 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; - 33CC10ED2044A3C60003C045 /* gc_ui.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = gc_ui.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; - 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; - 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; }; - 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; }; - 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; - 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; - 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; - 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; - 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; - 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; - 41137AAB2DF4C73772AD6680 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; - 75F404C3BC9A85A0940A1E7A /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; - 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; - 8206FEA4073335056184BFE7 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 8892D008E4FA6821A291BE17 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; - 8EFF00FDE3D0667C00609F10 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; - 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; - A3E308B8A5C9BFB85DE87E1A /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 331C80D2294CF70F00263BE5 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 6115A3AA09C0554E004627A7 /* Pods_RunnerTests.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 33CC10EA2044A3C60003C045 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - D97968A61668AD5CB0F4AD81 /* Pods_Runner.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 331C80D6294CF71000263BE5 /* RunnerTests */ = { - isa = PBXGroup; - children = ( - 331C80D7294CF71000263BE5 /* RunnerTests.swift */, - ); - path = RunnerTests; - sourceTree = ""; - }; - 33BA886A226E78AF003329D5 /* Configs */ = { - isa = PBXGroup; - children = ( - 33E5194F232828860026EE4D /* AppInfo.xcconfig */, - 9740EEB21CF90195004384FC /* Debug.xcconfig */, - 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, - 333000ED22D3DE5D00554162 /* Warnings.xcconfig */, - ); - path = Configs; - sourceTree = ""; - }; - 33CC10E42044A3C60003C045 = { - isa = PBXGroup; - children = ( - 33FAB671232836740065AC1E /* Runner */, - 33CEB47122A05771004F2AC0 /* Flutter */, - 331C80D6294CF71000263BE5 /* RunnerTests */, - 33CC10EE2044A3C60003C045 /* Products */, - D73912EC22F37F3D000D13A0 /* Frameworks */, - A82E8A367D68D5C69E25C9BA /* Pods */, - ); - sourceTree = ""; - }; - 33CC10EE2044A3C60003C045 /* Products */ = { - isa = PBXGroup; - children = ( - 33CC10ED2044A3C60003C045 /* gc_ui.app */, - 331C80D5294CF71000263BE5 /* RunnerTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - 33CC11242044D66E0003C045 /* Resources */ = { - isa = PBXGroup; - children = ( - 33CC10F22044A3C60003C045 /* Assets.xcassets */, - 33CC10F42044A3C60003C045 /* MainMenu.xib */, - 33CC10F72044A3C60003C045 /* Info.plist */, - ); - name = Resources; - path = ..; - sourceTree = ""; - }; - 33CEB47122A05771004F2AC0 /* Flutter */ = { - isa = PBXGroup; - children = ( - 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, - 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, - 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, - 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, - ); - path = Flutter; - sourceTree = ""; - }; - 33FAB671232836740065AC1E /* Runner */ = { - isa = PBXGroup; - children = ( - 33CC10F02044A3C60003C045 /* AppDelegate.swift */, - 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, - 33E51913231747F40026EE4D /* DebugProfile.entitlements */, - 33E51914231749380026EE4D /* Release.entitlements */, - 33CC11242044D66E0003C045 /* Resources */, - 33BA886A226E78AF003329D5 /* Configs */, - ); - path = Runner; - sourceTree = ""; - }; - A82E8A367D68D5C69E25C9BA /* Pods */ = { - isa = PBXGroup; - children = ( - 280B76C220FC1F5F9A19A983 /* Pods-Runner.debug.xcconfig */, - 8EFF00FDE3D0667C00609F10 /* Pods-Runner.release.xcconfig */, - 41137AAB2DF4C73772AD6680 /* Pods-Runner.profile.xcconfig */, - 75F404C3BC9A85A0940A1E7A /* Pods-RunnerTests.debug.xcconfig */, - 8892D008E4FA6821A291BE17 /* Pods-RunnerTests.release.xcconfig */, - 182DFB26FB114E38C6E212AD /* Pods-RunnerTests.profile.xcconfig */, - ); - name = Pods; - path = Pods; - sourceTree = ""; - }; - D73912EC22F37F3D000D13A0 /* Frameworks */ = { - isa = PBXGroup; - children = ( - A3E308B8A5C9BFB85DE87E1A /* Pods_Runner.framework */, - 8206FEA4073335056184BFE7 /* Pods_RunnerTests.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 331C80D4294CF70F00263BE5 /* RunnerTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; - buildPhases = ( - EBEBA5BB2F5B8B60B8CBB8D2 /* [CP] Check Pods Manifest.lock */, - 331C80D1294CF70F00263BE5 /* Sources */, - 331C80D2294CF70F00263BE5 /* Frameworks */, - 331C80D3294CF70F00263BE5 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 331C80DA294CF71000263BE5 /* PBXTargetDependency */, - ); - name = RunnerTests; - productName = RunnerTests; - productReference = 331C80D5294CF71000263BE5 /* RunnerTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 33CC10EC2044A3C60003C045 /* Runner */ = { - isa = PBXNativeTarget; - buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; - buildPhases = ( - 6098269FDFAA15D26448E434 /* [CP] Check Pods Manifest.lock */, - 33CC10E92044A3C60003C045 /* Sources */, - 33CC10EA2044A3C60003C045 /* Frameworks */, - 33CC10EB2044A3C60003C045 /* Resources */, - 33CC110E2044A8840003C045 /* Bundle Framework */, - 3399D490228B24CF009A79C7 /* ShellScript */, - A1BACCAA4E3E0600DECC8167 /* [CP] Embed Pods Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - 33CC11202044C79F0003C045 /* PBXTargetDependency */, - ); - name = Runner; - productName = Runner; - productReference = 33CC10ED2044A3C60003C045 /* gc_ui.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 33CC10E52044A3C60003C045 /* Project object */ = { - isa = PBXProject; - attributes = { - BuildIndependentTargetsInParallel = YES; - LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 1510; - ORGANIZATIONNAME = ""; - TargetAttributes = { - 331C80D4294CF70F00263BE5 = { - CreatedOnToolsVersion = 14.0; - TestTargetID = 33CC10EC2044A3C60003C045; - }; - 33CC10EC2044A3C60003C045 = { - CreatedOnToolsVersion = 9.2; - LastSwiftMigration = 1100; - ProvisioningStyle = Automatic; - SystemCapabilities = { - com.apple.Sandbox = { - enabled = 1; - }; - }; - }; - 33CC111A2044C6BA0003C045 = { - CreatedOnToolsVersion = 9.2; - ProvisioningStyle = Manual; - }; - }; - }; - buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; - compatibilityVersion = "Xcode 9.3"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 33CC10E42044A3C60003C045; - productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 33CC10EC2044A3C60003C045 /* Runner */, - 331C80D4294CF70F00263BE5 /* RunnerTests */, - 33CC111A2044C6BA0003C045 /* Flutter Assemble */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 331C80D3294CF70F00263BE5 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 33CC10EB2044A3C60003C045 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, - 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 3399D490228B24CF009A79C7 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; - }; - 33CC111E2044C6BF0003C045 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - Flutter/ephemeral/FlutterInputs.xcfilelist, - ); - inputPaths = ( - Flutter/ephemeral/tripwire, - ); - outputFileListPaths = ( - Flutter/ephemeral/FlutterOutputs.xcfilelist, - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; - }; - 6098269FDFAA15D26448E434 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - A1BACCAA4E3E0600DECC8167 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - EBEBA5BB2F5B8B60B8CBB8D2 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 331C80D1294CF70F00263BE5 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 33CC10E92044A3C60003C045 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, - 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, - 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 331C80DA294CF71000263BE5 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 33CC10EC2044A3C60003C045 /* Runner */; - targetProxy = 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */; - }; - 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; - targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { - isa = PBXVariantGroup; - children = ( - 33CC10F52044A3C60003C045 /* Base */, - ); - name = MainMenu.xib; - path = Runner; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 331C80DB294CF71000263BE5 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 75F404C3BC9A85A0940A1E7A /* Pods-RunnerTests.debug.xcconfig */; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CURRENT_PROJECT_VERSION = 1; - GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.morris.gc.gcUi.RunnerTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/gc_ui.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/gc_ui"; - }; - name = Debug; - }; - 331C80DC294CF71000263BE5 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 8892D008E4FA6821A291BE17 /* Pods-RunnerTests.release.xcconfig */; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CURRENT_PROJECT_VERSION = 1; - GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.morris.gc.gcUi.RunnerTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/gc_ui.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/gc_ui"; - }; - name = Release; - }; - 331C80DD294CF71000263BE5 /* Profile */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 182DFB26FB114E38C6E212AD /* Pods-RunnerTests.profile.xcconfig */; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CURRENT_PROJECT_VERSION = 1; - GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.morris.gc.gcUi.RunnerTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/gc_ui.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/gc_ui"; - }; - name = Profile; - }; - 338D0CE9231458BD00FA5F75 /* Profile */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEAD_CODE_STRIPPING = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_USER_SCRIPT_SANDBOXING = NO; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 12.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; - }; - name = Profile; - }; - 338D0CEA231458BD00FA5F75 /* Profile */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 5.0; - }; - name = Profile; - }; - 338D0CEB231458BD00FA5F75 /* Profile */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_STYLE = Manual; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Profile; - }; - 33CC10F92044A3C60003C045 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEAD_CODE_STRIPPING = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - ENABLE_USER_SCRIPT_SANDBOXING = NO; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 12.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - 33CC10FA2044A3C60003C045 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEAD_CODE_STRIPPING = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_USER_SCRIPT_SANDBOXING = NO; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 12.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; - }; - name = Release; - }; - 33CC10FC2044A3C60003C045 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - }; - name = Debug; - }; - 33CC10FD2044A3C60003C045 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 5.0; - }; - name = Release; - }; - 33CC111C2044C6BA0003C045 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_STYLE = Manual; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 33CC111D2044C6BA0003C045 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_STYLE = Automatic; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 331C80DB294CF71000263BE5 /* Debug */, - 331C80DC294CF71000263BE5 /* Release */, - 331C80DD294CF71000263BE5 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 33CC10F92044A3C60003C045 /* Debug */, - 33CC10FA2044A3C60003C045 /* Release */, - 338D0CE9231458BD00FA5F75 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 33CC10FC2044A3C60003C045 /* Debug */, - 33CC10FD2044A3C60003C045 /* Release */, - 338D0CEA231458BD00FA5F75 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 33CC111C2044C6BA0003C045 /* Debug */, - 33CC111D2044C6BA0003C045 /* Release */, - 338D0CEB231458BD00FA5F75 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 33CC10E52044A3C60003C045 /* Project object */; -} diff --git a/GC-UI/frontend/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/GC-UI/frontend/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d9810..0000000 --- a/GC-UI/frontend/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/GC-UI/frontend/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/GC-UI/frontend/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme deleted file mode 100644 index 44440af..0000000 --- a/GC-UI/frontend/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/GC-UI/frontend/macos/Runner.xcworkspace/contents.xcworkspacedata b/GC-UI/frontend/macos/Runner.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 21a3cc1..0000000 --- a/GC-UI/frontend/macos/Runner.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/GC-UI/frontend/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/GC-UI/frontend/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d9810..0000000 --- a/GC-UI/frontend/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/GC-UI/frontend/macos/Runner/AppDelegate.swift b/GC-UI/frontend/macos/Runner/AppDelegate.swift deleted file mode 100644 index 8e02df2..0000000 --- a/GC-UI/frontend/macos/Runner/AppDelegate.swift +++ /dev/null @@ -1,9 +0,0 @@ -import Cocoa -import FlutterMacOS - -@main -class AppDelegate: FlutterAppDelegate { - override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { - return true - } -} diff --git a/GC-UI/frontend/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/GC-UI/frontend/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index a2ec33f..0000000 --- a/GC-UI/frontend/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "images" : [ - { - "size" : "16x16", - "idiom" : "mac", - "filename" : "app_icon_16.png", - "scale" : "1x" - }, - { - "size" : "16x16", - "idiom" : "mac", - "filename" : "app_icon_32.png", - "scale" : "2x" - }, - { - "size" : "32x32", - "idiom" : "mac", - "filename" : "app_icon_32.png", - "scale" : "1x" - }, - { - "size" : "32x32", - "idiom" : "mac", - "filename" : "app_icon_64.png", - "scale" : "2x" - }, - { - "size" : "128x128", - "idiom" : "mac", - "filename" : "app_icon_128.png", - "scale" : "1x" - }, - { - "size" : "128x128", - "idiom" : "mac", - "filename" : "app_icon_256.png", - "scale" : "2x" - }, - { - "size" : "256x256", - "idiom" : "mac", - "filename" : "app_icon_256.png", - "scale" : "1x" - }, - { - "size" : "256x256", - "idiom" : "mac", - "filename" : "app_icon_512.png", - "scale" : "2x" - }, - { - "size" : "512x512", - "idiom" : "mac", - "filename" : "app_icon_512.png", - "scale" : "1x" - }, - { - "size" : "512x512", - "idiom" : "mac", - "filename" : "app_icon_1024.png", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} diff --git a/GC-UI/frontend/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/GC-UI/frontend/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png deleted file mode 100644 index 82b6f9d..0000000 Binary files a/GC-UI/frontend/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png and /dev/null differ diff --git a/GC-UI/frontend/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/GC-UI/frontend/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png deleted file mode 100644 index 13b35eb..0000000 Binary files a/GC-UI/frontend/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png and /dev/null differ diff --git a/GC-UI/frontend/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/GC-UI/frontend/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png deleted file mode 100644 index 0a3f5fa..0000000 Binary files a/GC-UI/frontend/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png and /dev/null differ diff --git a/GC-UI/frontend/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/GC-UI/frontend/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png deleted file mode 100644 index bdb5722..0000000 Binary files a/GC-UI/frontend/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png and /dev/null differ diff --git a/GC-UI/frontend/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/GC-UI/frontend/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png deleted file mode 100644 index f083318..0000000 Binary files a/GC-UI/frontend/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png and /dev/null differ diff --git a/GC-UI/frontend/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/GC-UI/frontend/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png deleted file mode 100644 index 326c0e7..0000000 Binary files a/GC-UI/frontend/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png and /dev/null differ diff --git a/GC-UI/frontend/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/GC-UI/frontend/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png deleted file mode 100644 index 2f1632c..0000000 Binary files a/GC-UI/frontend/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png and /dev/null differ diff --git a/GC-UI/frontend/macos/Runner/Base.lproj/MainMenu.xib b/GC-UI/frontend/macos/Runner/Base.lproj/MainMenu.xib deleted file mode 100644 index 80e867a..0000000 --- a/GC-UI/frontend/macos/Runner/Base.lproj/MainMenu.xib +++ /dev/null @@ -1,343 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/GC-UI/frontend/macos/Runner/Configs/AppInfo.xcconfig b/GC-UI/frontend/macos/Runner/Configs/AppInfo.xcconfig deleted file mode 100644 index b75d33e..0000000 --- a/GC-UI/frontend/macos/Runner/Configs/AppInfo.xcconfig +++ /dev/null @@ -1,14 +0,0 @@ -// Application-level settings for the Runner target. -// -// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the -// future. If not, the values below would default to using the project name when this becomes a -// 'flutter create' template. - -// The application's name. By default this is also the title of the Flutter window. -PRODUCT_NAME = GC-UI - -// The application's bundle identifier -PRODUCT_BUNDLE_IDENTIFIER = com.morris.gc.gcUi - -// The copyright displayed in application information -PRODUCT_COPYRIGHT = Copyright © 2026 Morris. All rights reserved. diff --git a/GC-UI/frontend/macos/Runner/Configs/Debug.xcconfig b/GC-UI/frontend/macos/Runner/Configs/Debug.xcconfig deleted file mode 100644 index 36b0fd9..0000000 --- a/GC-UI/frontend/macos/Runner/Configs/Debug.xcconfig +++ /dev/null @@ -1,2 +0,0 @@ -#include "../../Flutter/Flutter-Debug.xcconfig" -#include "Warnings.xcconfig" diff --git a/GC-UI/frontend/macos/Runner/Configs/Release.xcconfig b/GC-UI/frontend/macos/Runner/Configs/Release.xcconfig deleted file mode 100644 index dff4f49..0000000 --- a/GC-UI/frontend/macos/Runner/Configs/Release.xcconfig +++ /dev/null @@ -1,2 +0,0 @@ -#include "../../Flutter/Flutter-Release.xcconfig" -#include "Warnings.xcconfig" diff --git a/GC-UI/frontend/macos/Runner/Configs/Warnings.xcconfig b/GC-UI/frontend/macos/Runner/Configs/Warnings.xcconfig deleted file mode 100644 index 42bcbf4..0000000 --- a/GC-UI/frontend/macos/Runner/Configs/Warnings.xcconfig +++ /dev/null @@ -1,13 +0,0 @@ -WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings -GCC_WARN_UNDECLARED_SELECTOR = YES -CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES -CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE -CLANG_WARN__DUPLICATE_METHOD_MATCH = YES -CLANG_WARN_PRAGMA_PACK = YES -CLANG_WARN_STRICT_PROTOTYPES = YES -CLANG_WARN_COMMA = YES -GCC_WARN_STRICT_SELECTOR_MATCH = YES -CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES -CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES -GCC_WARN_SHADOW = YES -CLANG_WARN_UNREACHABLE_CODE = YES diff --git a/GC-UI/frontend/macos/Runner/DebugProfile.entitlements b/GC-UI/frontend/macos/Runner/DebugProfile.entitlements deleted file mode 100644 index 3ba6c12..0000000 --- a/GC-UI/frontend/macos/Runner/DebugProfile.entitlements +++ /dev/null @@ -1,14 +0,0 @@ - - - - - com.apple.security.app-sandbox - - com.apple.security.cs.allow-jit - - com.apple.security.network.client - - com.apple.security.network.server - - - diff --git a/GC-UI/frontend/macos/Runner/Info.plist b/GC-UI/frontend/macos/Runner/Info.plist deleted file mode 100644 index 4789daa..0000000 --- a/GC-UI/frontend/macos/Runner/Info.plist +++ /dev/null @@ -1,32 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIconFile - - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - $(FLUTTER_BUILD_NAME) - CFBundleVersion - $(FLUTTER_BUILD_NUMBER) - LSMinimumSystemVersion - $(MACOSX_DEPLOYMENT_TARGET) - NSHumanReadableCopyright - $(PRODUCT_COPYRIGHT) - NSMainNibFile - MainMenu - NSPrincipalClass - NSApplication - - diff --git a/GC-UI/frontend/macos/Runner/MainFlutterWindow.swift b/GC-UI/frontend/macos/Runner/MainFlutterWindow.swift deleted file mode 100644 index f61000d..0000000 --- a/GC-UI/frontend/macos/Runner/MainFlutterWindow.swift +++ /dev/null @@ -1,61 +0,0 @@ -import Cocoa -import FlutterMacOS - -class MainFlutterWindow: NSWindow { - override func awakeFromNib() { - let flutterViewController = FlutterViewController() - let windowFrame = self.frame - self.contentViewController = flutterViewController - self.setFrame(windowFrame, display: true) - - // 去掉系统标题栏(应用名 + 红绿灯按钮),改由 Flutter 自绘: - // fullSizeContentView 让内容铺满整窗,titlebarAppearsTransparent + titleVisibility - // 隐藏标题栏文字与背景,三个系统按钮一并隐藏。 - // 注意:不要动 styleMask 里的 .resizable,否则窗口无法缩放。 - self.titleVisibility = .hidden - self.titlebarAppearsTransparent = true - self.styleMask.insert(.fullSizeContentView) - self.standardWindowButton(.closeButton)?.isHidden = true - self.standardWindowButton(.miniaturizeButton)?.isHidden = true - self.standardWindowButton(.zoomButton)?.isHidden = true - self.isMovableByWindowBackground = true - - // 自绘按钮 -> 原生窗口操作 - let channel = FlutterMethodChannel( - name: "gc/window", - binaryMessenger: flutterViewController.engine.binaryMessenger - ) - channel.setMethodCallHandler { [weak self] call, result in - guard let self = self else { - result(FlutterMethodNotImplemented) - return - } - switch call.method { - case "minimize": - self.miniaturize(nil) - result(nil) - case "toggleMaximize": - // NSWindow.zoom(_:) 自带切换语义:放大状态下再调即还原 - self.zoom(nil) - result(nil) - case "close": - self.close() - result(nil) - case "isMaximized": - result(self.isZoomed) - case "beginDrag": - // 拖拽整窗:用系统拖拽,比在 Dart 里逐帧挪窗口平滑 - if let event = NSApp.currentEvent { - self.performDrag(with: event) - } - result(nil) - default: - result(FlutterMethodNotImplemented) - } - } - - RegisterGeneratedPlugins(registry: flutterViewController) - - super.awakeFromNib() - } -} diff --git a/GC-UI/frontend/macos/Runner/Release.entitlements b/GC-UI/frontend/macos/Runner/Release.entitlements deleted file mode 100644 index 7a2230d..0000000 --- a/GC-UI/frontend/macos/Runner/Release.entitlements +++ /dev/null @@ -1,12 +0,0 @@ - - - - - com.apple.security.app-sandbox - - com.apple.security.network.client - - com.apple.security.network.server - - - diff --git a/GC-UI/frontend/macos/RunnerTests/RunnerTests.swift b/GC-UI/frontend/macos/RunnerTests/RunnerTests.swift deleted file mode 100644 index 61f3bd1..0000000 --- a/GC-UI/frontend/macos/RunnerTests/RunnerTests.swift +++ /dev/null @@ -1,12 +0,0 @@ -import Cocoa -import FlutterMacOS -import XCTest - -class RunnerTests: XCTestCase { - - func testExample() { - // If you add code to the Runner application, consider adding tests here. - // See https://developer.apple.com/documentation/xctest for more information about using XCTest. - } - -} diff --git a/GC-UI/frontend/pubspec.lock b/GC-UI/frontend/pubspec.lock deleted file mode 100644 index 6e7708d..0000000 --- a/GC-UI/frontend/pubspec.lock +++ /dev/null @@ -1,322 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - async: - dependency: transitive - description: - name: async - sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.11.0" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.1.1" - characters: - dependency: transitive - description: - name: characters - sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.3.0" - clock: - dependency: transitive - description: - name: clock - sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.1.1" - collection: - dependency: transitive - description: - name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.18.0" - cupertino_icons: - dependency: "direct main" - description: - name: cupertino_icons - sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.0.8" - fake_async: - dependency: transitive - description: - name: fake_async - sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.3.1" - flutter: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_inappwebview: - dependency: "direct main" - description: - name: flutter_inappwebview - sha256: "80092d13d3e29b6227e25b67973c67c7210bd5e35c4b747ca908e31eb71a46d5" - url: "https://pub.flutter-io.cn" - source: hosted - version: "6.1.5" - flutter_inappwebview_android: - dependency: transitive - description: - name: flutter_inappwebview_android - sha256: "62557c15a5c2db5d195cb3892aab74fcaec266d7b86d59a6f0027abd672cddba" - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.1.3" - flutter_inappwebview_internal_annotations: - dependency: transitive - description: - name: flutter_inappwebview_internal_annotations - sha256: "787171d43f8af67864740b6f04166c13190aa74a1468a1f1f1e9ee5b90c359cd" - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.2.0" - flutter_inappwebview_ios: - dependency: transitive - description: - name: flutter_inappwebview_ios - sha256: "5818cf9b26cf0cbb0f62ff50772217d41ea8d3d9cc00279c45f8aabaa1b4025d" - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.1.2" - flutter_inappwebview_macos: - dependency: transitive - description: - name: flutter_inappwebview_macos - sha256: c1fbb86af1a3738e3541364d7d1866315ffb0468a1a77e34198c9be571287da1 - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.1.2" - flutter_inappwebview_platform_interface: - dependency: transitive - description: - name: flutter_inappwebview_platform_interface - sha256: cf5323e194096b6ede7a1ca808c3e0a078e4b33cc3f6338977d75b4024ba2500 - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.3.0+1" - flutter_inappwebview_web: - dependency: transitive - description: - name: flutter_inappwebview_web - sha256: "55f89c83b0a0d3b7893306b3bb545ba4770a4df018204917148ebb42dc14a598" - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.1.2" - flutter_inappwebview_windows: - dependency: transitive - description: - name: flutter_inappwebview_windows - sha256: "8b4d3a46078a2cdc636c4a3d10d10f2a16882f6be607962dbfff8874d1642055" - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.6.0" - flutter_lints: - dependency: "direct dev" - description: - name: flutter_lints - sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c" - url: "https://pub.flutter-io.cn" - source: hosted - version: "4.0.0" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" - flutter_web_plugins: - dependency: transitive - description: flutter - source: sdk - version: "0.0.0" - http: - dependency: "direct main" - description: - name: http - sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412" - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.6.0" - http_parser: - dependency: transitive - description: - name: http_parser - sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" - url: "https://pub.flutter-io.cn" - source: hosted - version: "4.0.2" - leak_tracker: - dependency: transitive - description: - name: leak_tracker - sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" - url: "https://pub.flutter-io.cn" - source: hosted - version: "10.0.5" - leak_tracker_flutter_testing: - dependency: transitive - description: - name: leak_tracker_flutter_testing - sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" - url: "https://pub.flutter-io.cn" - source: hosted - version: "3.0.5" - leak_tracker_testing: - dependency: transitive - description: - name: leak_tracker_testing - sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" - url: "https://pub.flutter-io.cn" - source: hosted - version: "3.0.1" - lints: - dependency: transitive - description: - name: lints - sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235" - url: "https://pub.flutter-io.cn" - source: hosted - version: "4.0.0" - matcher: - dependency: transitive - description: - name: matcher - sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.12.16+1" - material_color_utilities: - dependency: transitive - description: - name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.11.1" - meta: - dependency: transitive - description: - name: meta - sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.15.0" - path: - dependency: transitive - description: - name: path - sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.9.0" - plugin_platform_interface: - dependency: transitive - description: - name: plugin_platform_interface - sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.1.8" - sky_engine: - dependency: transitive - description: flutter - source: sdk - version: "0.0.99" - source_span: - dependency: transitive - description: - name: source_span - sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.10.0" - stack_trace: - dependency: transitive - description: - name: stack_trace - sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.11.1" - stream_channel: - dependency: transitive - description: - name: stream_channel - sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.1.2" - string_scanner: - dependency: transitive - description: - name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.2.0" - term_glyph: - dependency: transitive - description: - name: term_glyph - sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.2.1" - test_api: - dependency: transitive - description: - name: test_api - sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.7.2" - typed_data: - dependency: transitive - description: - name: typed_data - sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.4.0" - vector_math: - dependency: transitive - description: - name: vector_math - sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.1.4" - vm_service: - dependency: transitive - description: - name: vm_service - sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" - url: "https://pub.flutter-io.cn" - source: hosted - version: "14.2.5" - web: - dependency: transitive - description: - name: web - sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.1.1" -sdks: - dart: ">=3.5.4 <4.0.0" - flutter: ">=3.24.0" diff --git a/GC-UI/frontend/pubspec.yaml b/GC-UI/frontend/pubspec.yaml deleted file mode 100644 index 8c535f7..0000000 --- a/GC-UI/frontend/pubspec.yaml +++ /dev/null @@ -1,95 +0,0 @@ -name: gc_ui -description: "GC launcher UI (Flutter frontend)" -# The following line prevents the package from being accidentally published to -# pub.dev using `flutter pub publish`. This is preferred for private packages. -publish_to: 'none' # Remove this line if you wish to publish to pub.dev - -# The following defines the version and build number for your application. -# A version number is three numbers separated by dots, like 1.2.43 -# followed by an optional build number separated by a +. -# Both the version and the builder number may be overridden in flutter -# build by specifying --build-name and --build-number, respectively. -# In Android, build-name is used as versionName while build-number used as versionCode. -# Read more about Android versioning at https://developer.android.com/studio/publish/versioning -# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. -# Read more about iOS versioning at -# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -# In Windows, build-name is used as the major, minor, and patch parts -# of the product and file versions while build-number is used as the build suffix. -version: 1.1.1+1 - -environment: - sdk: ^3.5.4 - -# Dependencies specify other packages that your package needs in order to work. -# To automatically upgrade your package dependencies to the latest versions -# consider running `flutter pub upgrade --major-versions`. Alternatively, -# dependencies can be manually updated by changing the version numbers below to -# the latest version available on pub.dev. To see which dependencies have newer -# versions available, run `flutter pub outdated`. -dependencies: - flutter: - sdk: flutter - - # 与 GC-UI 后端(本地 HTTP 服务)通信 - http: ^1.2.2 - - # 桌面 WebView:承载离线等高线课件(Win/macOS/Linux) - flutter_inappwebview: 6.1.5 - - # The following adds the Cupertino Icons font to your application. - # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^1.0.8 - -dev_dependencies: - flutter_test: - sdk: flutter - - # The "flutter_lints" package below contains a set of recommended lints to - # encourage good coding practices. The lint set provided by the package is - # activated in the `analysis_options.yaml` file located at the root of your - # package. See that file for information about deactivating specific lint - # rules and activating additional ones. - flutter_lints: ^4.0.0 - -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec - -# The following section is specific to Flutter packages. -flutter: - - # The following line ensures that the Material Icons font is - # included with your application, so that you can use the icons in - # the material Icons class. - uses-material-design: true - - assets: - # 离线等高线课件(去除授权验证后的纯净版),整体作为目录打包。 - - courseware/ - - courseware/assets/ - - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/to/resolution-aware-images - - # For details regarding adding assets from package dependencies, see - # https://flutter.dev/to/asset-from-package - - # To add custom fonts to your application, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts from package dependencies, - # see https://flutter.dev/to/font-from-package diff --git a/GC-UI/frontend/test/backend_contract_test.dart b/GC-UI/frontend/test/backend_contract_test.dart deleted file mode 100644 index 697dd41..0000000 --- a/GC-UI/frontend/test/backend_contract_test.dart +++ /dev/null @@ -1,95 +0,0 @@ -import 'dart:io'; - -import 'package:flutter_test/flutter_test.dart'; -import 'package:gc_ui/api_client.dart'; - -/// 前后端契约联调测试。 -/// -/// 需要 GC-UI 后端正在运行(`dotnet run --project GC-UI/backend/GC.UI.Server`)。 -/// 后端没起时整组跳过,不会让 CI 变红。 -/// -/// 注意:flutter_test 默认把所有 HTTP 请求拦成 400,这里显式放开真实网络。 -void main() { - setUpAll(() { - HttpOverrides.global = null; - }); - - final api = GcApi( - baseUrl: const String.fromEnvironment( - 'GC_UI_BASE_URL', - defaultValue: 'http://127.0.0.1:17890', - ), - ); - - Future backendUp() async { - try { - await api.health(); - return true; - } catch (_) { - return false; - } - } - - test('health / settings / models / sources / jobs 都能解析', () async { - if (!await backendUp()) { - markTestSkipped('后端未运行,跳过联调测试'); - return; - } - - final health = await api.health(); - expect(health.ok, isTrue); - expect(health.version, isNotEmpty); - expect(health.platform, isNotEmpty); - - final settings = await api.settings(); - expect(settings.modelRoot, isNotEmpty); - expect(settings.dataRoot, isNotEmpty); - expect(settings.renderFps, greaterThan(0)); - expect(settings.memoryMb, greaterThan(0)); - expect(settings.languages, isNotEmpty); - expect(settings.sources, isNotEmpty); - - final models = await api.models(); - for (final model in models) { - expect(model.id, isNotEmpty); - expect(model.name, isNotEmpty); - } - - final sources = await api.sources(); - expect(sources, isNotEmpty); - expect(sources.first.id, isNotEmpty); - - final jobs = await api.jobs(); - expect(jobs, isA>()); - }); - - test('设置补丁能写回并读出一致', () async { - if (!await backendUp()) { - markTestSkipped('后端未运行,跳过联调测试'); - return; - } - - final before = await api.settings(); - final updated = await api.saveSettings( - SettingsPatch(renderFps: before.renderFps == 60 ? 90 : 60), - ); - expect(updated.renderFps, before.renderFps == 60 ? 90 : 60); - - final restored = await api.saveSettings( - SettingsPatch(renderFps: before.renderFps), - ); - expect(restored.renderFps, before.renderFps); - }); - - test('越界路径被后端拒绝', () async { - if (!await backendUp()) { - markTestSkipped('后端未运行,跳过联调测试'); - return; - } - - await expectLater( - api.openFolder('/etc'), - throwsA(isA()), - ); - }); -} diff --git a/GC-UI/frontend/test/widget_test.dart b/GC-UI/frontend/test/widget_test.dart deleted file mode 100644 index 87c4117..0000000 --- a/GC-UI/frontend/test/widget_test.dart +++ /dev/null @@ -1,85 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:gc_ui/api_client.dart'; -import 'package:gc_ui/i18n.dart'; -import 'package:gc_ui/theme.dart'; - -void main() { - group('I18n', () { - test('resolves auto to a supported language', () { - expect(I18n.supported.contains(I18n.resolve('auto')), isTrue); - expect(I18n.resolve('en-US'), 'en'); - expect(I18n.resolve('zh-CN'), 'zh-CN'); - }); - - test('translates keys and fills placeholders', () { - I18n.language.value = 'zh-CN'; - expect(T('nav.home'), '主页'); - expect(T('home.count', [3]), '3 个模型'); - - I18n.language.value = 'en'; - expect(T('nav.home'), 'Home'); - expect(T('home.count', [3]), '3 models'); - }); - - test('falls back to the key for unknown entries', () { - expect(T('does.not.exist'), 'does.not.exist'); - }); - }); - - group('SettingsPatch', () { - test('only serialises the fields that were set', () { - const patch = SettingsPatch(renderFps: 60, memoryAuto: false); - expect(patch.toJson(), { - 'renderFps': 60, - 'memoryAuto': false, - }); - }); - - test('empty patch serialises to an empty map', () { - expect(const SettingsPatch().toJson(), isEmpty); - }); - }); - - group('GcApi', () { - test('builds model preview urls from the base url', () { - final api = GcApi(baseUrl: 'http://127.0.0.1:17890'); - final model = ModelInfo.fromJson({ - 'id': 'solar-system', - 'name': '太阳系', - 'previewUrl': '/api/models/solar-system/preview', - }); - expect(api.previewUrl(model), - 'http://127.0.0.1:17890/api/models/solar-system/preview'); - }); - - test('parses a model payload', () { - final model = ModelInfo.fromJson({ - 'id': 'earth', - 'name': '地球', - 'version': '1.2.0', - 'sizeBytes': 1048576, - 'sizeText': '1.0 MB', - 'tags': ['天文', '地球'], - 'hasPreview': true, - }); - expect(model.id, 'earth'); - expect(model.tags, ['天文', '地球']); - expect(model.metaText, 'v1.2.0 · 1.0 MB'); - }); - }); - - group('theme', () { - testWidgets('renders a card with its child', (tester) async { - await tester.pumpWidget( - MaterialApp( - theme: buildGcTheme(Brightness.dark), - home: const Scaffold( - body: GcCard(child: Text('hello')), - ), - ), - ); - expect(find.text('hello'), findsOneWidget); - }); - }); -} diff --git a/GC-UI/frontend/tool/render_shots_test.dart b/GC-UI/frontend/tool/render_shots_test.dart deleted file mode 100644 index 457eedd..0000000 --- a/GC-UI/frontend/tool/render_shots_test.dart +++ /dev/null @@ -1,443 +0,0 @@ -import 'dart:io'; -import 'dart:ui' as ui; - -import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:gc_ui/api_client.dart'; -import 'package:gc_ui/controller.dart'; -import 'package:gc_ui/i18n.dart'; -import 'package:gc_ui/pages.dart'; -import 'package:gc_ui/shell.dart'; -import 'package:gc_ui/theme.dart'; - -/// 视觉检查:把真实页面渲染成 PNG 写到 test/shots/。 -/// -/// 用 RepaintBoundary 直接取像素,不走 golden 比较器(避免网络图片阻塞)。 -/// 测试环境默认用 Ahem 占位字体,这里显式加载系统中文字体,否则中文全是方块。 -/// -/// 运行(需要后端已在 127.0.0.1:17890 上跑起来): -/// flutter test tool/render_shots_test.dart -void main() { - setUpAll(() async { - // 不要设置 HttpOverrides.global = null:那会打开真实网络, - // flutter_test 的假时钟下 HTTP 定时器永远悬着,用例结束时 - // 会撞上「!timersPending」断言。保持 flutter_test 默认的 FakeHttpClient - // (所有请求立即返回 400),页面本身都用预置数据渲染,不需要后端。 - // 测试环境默认用 Ahem 占位字体(所有字都是方块),必须显式加载一套真字体: - // Linux CI 用 Noto CJK,Windows 本机用 Noto Sans SC / 微软雅黑,macOS 用苹方。 - const candidates = [ - r'C:\Windows\Fonts\Deng.ttf', - r'C:\Windows\Fonts\NotoSansSC-VF.ttf', - r'C:\Windows\Fonts\msyh.ttc', - r'C:\Windows\Fonts\simhei.ttf', - '/System/Library/Fonts/PingFang.ttc', - '/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc', - '/usr/share/fonts/truetype/noto/NotoSansCJK-Regular.ttc', - ]; - for (final path in candidates) { - final file = File(path); - if (!file.existsSync()) continue; - final bytes = file.readAsBytesSync(); - final loader = FontLoader('Noto Sans CJK SC') - ..addFont(Future.value(ByteData.view(bytes.buffer))); - await loader.load(); - break; - } - - // Material 图标字体:flutter_test 不会自动加载,不加载的话所有 Icon - // 都是方框,截图就没法检查图标。SDK 缓存里那份由 flutter test 通过 - // FLUTTER_ROOT 指过来。 - final flutterRoot = Platform.environment['FLUTTER_ROOT']; - if (flutterRoot != null) { - final icons = File( - '$flutterRoot/bin/cache/artifacts/material_fonts/materialicons-regular.otf', - ); - if (icons.existsSync()) { - final bytes = icons.readAsBytesSync(); - final loader = FontLoader('MaterialIcons') - ..addFont(Future.value(ByteData.view(bytes.buffer))); - await loader.load(); - } - } - }); - - SettingsInfo sampleSettings() => SettingsInfo.fromJson({ - 'language': 'zh-CN', - 'theme': 'dark', - 'renderFps': 120, - 'memoryMb': 2048, - 'memoryAuto': true, - 'autoUpdateOnStartup': true, - 'requireSignedManifest': true, - 'updateRepository': 'https://git.xhmcl.com/Morris/GC', - 'memoryBudgetMb': 2048, - 'memoryUsageText': '512 MB / 2048 MB', - 'modelRoot': '/Users/morris/.GC/model', - 'dataRoot': '/Users/morris/.GC/data', - 'settingsFile': '/Users/morris/.GC/settings.json', - 'version': '1.0.7', - 'platform': 'osx-arm64', - 'sources': [ - { - 'id': 'github', - 'name': 'GitHub', - 'url': 'https://github.com/Morris-GC/GC', - 'enabled': true, - 'builtIn': true, - 'host': 'github.com', - }, - { - 'id': 'gitee', - 'name': 'Gitee', - 'url': 'https://gitee.com/morris/gc', - 'enabled': true, - 'builtIn': true, - 'host': 'gitee.com', - }, - ], - 'languages': [ - {'code': 'zh-CN', 'label': '简体中文'}, - {'code': 'en', 'label': 'English'}, - ], - }); - - List sampleModels() => [ - ModelInfo.fromJson({ - 'id': 'contour-map', - 'name': '等高线地图', - 'description': '把三维地形与等高线对应起来,识别山峰、山脊、山谷、鞍部与陡崖。', - 'version': '1.0', - 'author': 'Morris GC', - 'sizeBytes': 147351, - 'sizeText': '143.9 KB', - 'tags': ['地理', '地图', '等高线', '地形'], - 'hasPreview': false, - }), - ModelInfo.fromJson({ - 'id': 'solar-system', - 'name': '太阳系', - 'description': '观察八大行星的公转轨道与相对大小,理解日地月系统的尺度关系。', - 'version': '1.2', - 'author': 'Morris GC', - 'sizeBytes': 2411724, - 'sizeText': '2.3 MB', - 'tags': ['天文', '太阳系', '公转'], - 'hasPreview': false, - }), - ModelInfo.fromJson({ - 'id': 'earth-rotation', - 'name': '地球自转', - 'description': '用可交互的三维地球演示自转方向、昼夜交替与地方时差。', - 'version': '1.1', - 'author': 'Morris GC', - 'sizeBytes': 1887436, - 'sizeText': '1.8 MB', - 'tags': ['天文', '地球', '自转'], - 'hasPreview': false, - }), - ]; - - ShellController sampleController() => ShellController(api: GcApi()) - ..settings = sampleSettings() - ..health = HealthInfo.fromJson({ - 'ok': true, - 'version': '1.0.7', - 'platform': 'osx-arm64', - 'uiAvailable': true, - }); - - /// 外壳用的 controller:bootstrap 直接返回,不去连后端。 - /// - /// 真 ShellPage 会在 initState 里 bootstrap,后端不在时会挂重试定时器, - /// 用例结束时报「!timersPending」。这里只把 bootstrap 换成空实现, - /// 页面里的数据请求仍会走 flutter_test 的假 HTTP(立即 400)。 - ShellController shellController() => _StubShellController() - ..settings = sampleSettings() - ..health = HealthInfo.fromJson({ - 'ok': true, - 'version': '1.0.7', - 'platform': 'osx-arm64', - 'uiAvailable': true, - }); - - Future shoot(WidgetTester tester, String name, Widget page, - {Brightness brightness = Brightness.dark, - Size size = const Size(1280, 860)}) async { - // 1280×860:与发布包窗口默认尺寸(1280×720)接近,再多留一点高度看得到 - // 底部状态条。像素比 1.0,方便逐像素检查描边和文字。 - tester.view.physicalSize = size; - tester.view.devicePixelRatio = 1.0; - addTearDown(tester.view.reset); - - // GcColors 是静态取值,截图前先按目标亮度绑定,否则浅色截图仍是深色配色。 - GcColors.bind(brightness); - - final key = GlobalKey(); - await tester.pumpWidget( - MaterialApp( - debugShowCheckedModeBanner: false, - // 四个页面都用预置数据渲染,不需要后端;字体统一换成测试里加载的 - // 那一套,并且清空 fallback —— 否则主题里的按钮 / 输入框样式会去 - // 找系统字体(测试环境没有),缺字处就画成方块。 - theme: buildGcTheme( - brightness, - fontFamily: 'Noto Sans CJK SC', - fontFamilyFallback: const [], - ), - home: RepaintBoundary( - key: key, - child: Scaffold(backgroundColor: GcColors.appBg, body: page), - ), - ), - ); - await tester.pump(const Duration(milliseconds: 200)); - await tester.pump(const Duration(milliseconds: 300)); - - final boundary = - key.currentContext!.findRenderObject()! as RenderRepaintBoundary; - // toImage / toByteData 要走真实引擎的异步管线,必须放在 runAsync 里, - // 否则 fake async 时钟不会推进,Future 一直不完成(表现为每个用例卡 - // 满 10 分钟超时才返回)。 - final stopwatch = Stopwatch()..start(); - final image = await tester.runAsync( - () => boundary.toImage(pixelRatio: 1.0), - ); - final bytes = await tester.runAsync( - () => image!.toByteData(format: ui.ImageByteFormat.png), - ); - - final dir = Directory('test/shots')..createSync(recursive: true); - File('${dir.path}/$name.png').writeAsBytesSync(bytes!.buffer.asUint8List()); - stopwatch.stop(); - // ignore: avoid_print - print( - '[shots] $name (${brightness.name}) 耗时 ${stopwatch.elapsedMilliseconds} ms'); - } - - testWidgets('home', (tester) async { - I18n.language.value = 'zh-CN'; - await shoot( - tester, - 'home', - HomePageView( - controller: sampleController(), initialModels: sampleModels()), - ); - }); - - testWidgets('download', (tester) async { - I18n.language.value = 'zh-CN'; - await shoot( - tester, - 'download', - DownloadPageView( - controller: sampleController(), - initialSources: [ - SourceInfo.fromJson({ - 'id': 'github', - 'name': 'GitHub', - 'url': 'https://github.com/Morris-GC/GC', - 'enabled': true, - 'builtIn': true, - 'host': 'github.com', - }), - SourceInfo.fromJson({ - 'id': 'gitee', - 'name': 'Gitee', - 'url': 'https://gitee.com/morris/gc', - 'enabled': true, - 'builtIn': true, - 'host': 'gitee.com', - }), - ], - initialIndex: SourceIndexInfo.fromJson({ - 'sourceId': 'github', - 'root': 'https://github.com/Morris-GC/GC', - 'fromCache': false, - 'resolvedFrom': 'version.json', - 'models': [ - { - 'id': 'solar-system', - 'name': '太阳系', - 'description': '观察八大行星的公转轨道与相对大小。', - 'version': '1.2', - 'sizeBytes': 2411724, - 'sizeText': '2.3 MB', - 'sourceId': 'github', - 'installed': true, - 'installedVersion': '1.2', - }, - { - 'id': 'earth-revolution', - 'name': '地球公转', - 'description': '演示公转轨道、四季成因与太阳直射点移动。', - 'version': '1.0', - 'sizeBytes': 2097152, - 'sizeText': '2.0 MB', - 'sourceId': 'github', - 'installed': false, - }, - { - 'id': 'earth-geography', - 'name': '地球地理', - 'description': '经纬网、海陆分布与大洲大洋的交互式讲解。', - 'version': '1.1', - 'sizeBytes': 3145728, - 'sizeText': '3.0 MB', - 'sourceId': 'github', - 'installed': false, - }, - ], - }), - initialJobs: [ - JobInfo.fromJson({ - 'id': 'job-1', - 'modelId': 'earth-revolution', - 'name': '地球公转', - 'version': '1.0', - 'state': 'Downloading', - 'progress': 0.42, - 'statusText': '正在下载 42%', - 'detailText': '860 KB / 2.0 MB', - 'isActive': true, - }), - ], - ), - ); - }); - - testWidgets('settings', (tester) async { - I18n.language.value = 'zh-CN'; - await shoot( - tester, 'settings', SettingsPageView(controller: sampleController())); - }); - - testWidgets('about', (tester) async { - I18n.language.value = 'zh-CN'; - await shoot( - tester, - 'about', - AboutPageView( - controller: sampleController(), - initialAbout: AboutInfo.fromJson({ - 'appName': 'Morris GC', - 'version': '1.0.7', - 'platform': 'osx-arm64', - 'repository': 'https://git.xhmcl.com/Morris/GC', - 'sourceLanguage': 'C#', - 'frontend': 'Flutter', - 'contributors': [ - { - 'name': 'Morris', - 'contributions': 25, - 'avatarUrl': null, - }, - ], - }), - ), - ); - }); - - testWidgets('shell', (tester) async { - I18n.language.value = 'zh-CN'; - final controller = shellController() - ..setUpdateStatus( - visible: true, - busy: false, - progress: 1, - status: '已更新 2 个模型,立即生效', - detail: '模型与启动器均为最新版', - notice: '', - ); - await shoot(tester, 'shell', ShellPage(controller: controller)); - }); - - /// 小窗口回归:1024×680 下不应出现溢出条纹或卡片挤压。 - testWidgets('home-small', (tester) async { - I18n.language.value = 'zh-CN'; - await shoot( - tester, - 'home-small', - HomePageView( - controller: sampleController(), initialModels: sampleModels()), - size: const Size(1024, 680), - ); - }); - - testWidgets('download-small', (tester) async { - I18n.language.value = 'zh-CN'; - await shoot( - tester, - 'download-small', - DownloadPageView( - controller: sampleController(), - initialSources: [ - SourceInfo.fromJson({ - 'id': 'github', - 'name': 'GitHub', - 'url': 'https://github.com/Morris-GC/GC', - 'enabled': true, - 'builtIn': true, - 'host': 'github.com', - }), - ], - initialIndex: SourceIndexInfo.fromJson({ - 'sourceId': 'github', - 'root': 'https://github.com/Morris-GC/GC', - 'fromCache': false, - 'resolvedFrom': 'version.json', - 'models': [ - { - 'id': 'sun', - 'name': '太阳系', - 'description': '观察八大行星的公转轨道与相对大小。', - 'version': '1.2', - 'sizeText': '2.3 MB', - 'installed': true, - }, - ], - }), - initialJobs: const [], - ), - size: const Size(1024, 680), - ); - }); - - testWidgets('settings-small', (tester) async { - I18n.language.value = 'zh-CN'; - await shoot( - tester, - 'settings-small', - SettingsPageView(controller: sampleController()), - size: const Size(1024, 680), - ); - }); - - testWidgets('home-light', (tester) async { - I18n.language.value = 'zh-CN'; - await shoot( - tester, - 'home-light', - HomePageView( - controller: sampleController(), initialModels: sampleModels()), - brightness: Brightness.light, - ); - }); - - testWidgets('settings-light', (tester) async { - I18n.language.value = 'zh-CN'; - await shoot( - tester, - 'settings-light', - SettingsPageView(controller: sampleController()), - brightness: Brightness.light, - ); - }); -} - -/// 只用于截图的 controller:不连后端,避免挂上重试定时器。 -class _StubShellController extends ShellController { - @override - Future bootstrap() async {} -} diff --git a/GC-UI/frontend/windows/.gitignore b/GC-UI/frontend/windows/.gitignore deleted file mode 100644 index d492d0d..0000000 --- a/GC-UI/frontend/windows/.gitignore +++ /dev/null @@ -1,17 +0,0 @@ -flutter/ephemeral/ - -# Visual Studio user-specific files. -*.suo -*.user -*.userosscache -*.sln.docstates - -# Visual Studio build-related files. -x64/ -x86/ - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!*.[Cc]ache/ diff --git a/GC-UI/frontend/windows/CMakeLists.txt b/GC-UI/frontend/windows/CMakeLists.txt deleted file mode 100644 index c740279..0000000 --- a/GC-UI/frontend/windows/CMakeLists.txt +++ /dev/null @@ -1,108 +0,0 @@ -# Project-level configuration. -cmake_minimum_required(VERSION 3.14) -project(gc_ui LANGUAGES CXX) - -# The name of the executable created for the application. Change this to change -# the on-disk name of your application. -set(BINARY_NAME "GC-UI") - -# Explicitly opt in to modern CMake behaviors to avoid warnings with recent -# versions of CMake. -cmake_policy(VERSION 3.14...3.25) - -# Define build configuration option. -get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) -if(IS_MULTICONFIG) - set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" - CACHE STRING "" FORCE) -else() - if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - set(CMAKE_BUILD_TYPE "Debug" CACHE - STRING "Flutter build mode" FORCE) - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS - "Debug" "Profile" "Release") - endif() -endif() -# Define settings for the Profile build mode. -set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") -set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") -set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") -set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") - -# Use Unicode for all projects. -add_definitions(-DUNICODE -D_UNICODE) - -# Compilation settings that should be applied to most targets. -# -# Be cautious about adding new options here, as plugins use this function by -# default. In most cases, you should add new options to specific targets instead -# of modifying this function. -function(APPLY_STANDARD_SETTINGS TARGET) - target_compile_features(${TARGET} PUBLIC cxx_std_17) - target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") - target_compile_options(${TARGET} PRIVATE /EHsc) - target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") - target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") -endfunction() - -# Flutter library and tool build rules. -set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") -add_subdirectory(${FLUTTER_MANAGED_DIR}) - -# Application build; see runner/CMakeLists.txt. -add_subdirectory("runner") - - -# Generated plugin build rules, which manage building the plugins and adding -# them to the application. -include(flutter/generated_plugins.cmake) - - -# === Installation === -# Support files are copied into place next to the executable, so that it can -# run in place. This is done instead of making a separate bundle (as on Linux) -# so that building and running from within Visual Studio will work. -set(BUILD_BUNDLE_DIR "$") -# Make the "install" step default, as it's required to run. -set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) -if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) -endif() - -set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") -set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") - -install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" - COMPONENT Runtime) - -install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" - COMPONENT Runtime) - -install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" - COMPONENT Runtime) - -if(PLUGIN_BUNDLED_LIBRARIES) - install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" - DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" - COMPONENT Runtime) -endif() - -# Copy the native assets provided by the build.dart from all packages. -set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") -install(DIRECTORY "${NATIVE_ASSETS_DIR}" - DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" - COMPONENT Runtime) - -# Fully re-copy the assets directory on each build to avoid having stale files -# from a previous install. -set(FLUTTER_ASSET_DIR_NAME "flutter_assets") -install(CODE " - file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") - " COMPONENT Runtime) -install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" - DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) - -# Install the AOT library on non-Debug builds only. -install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" - CONFIGURATIONS Profile;Release - COMPONENT Runtime) diff --git a/GC-UI/frontend/windows/flutter/CMakeLists.txt b/GC-UI/frontend/windows/flutter/CMakeLists.txt deleted file mode 100644 index 903f489..0000000 --- a/GC-UI/frontend/windows/flutter/CMakeLists.txt +++ /dev/null @@ -1,109 +0,0 @@ -# This file controls Flutter-level build steps. It should not be edited. -cmake_minimum_required(VERSION 3.14) - -set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") - -# Configuration provided via flutter tool. -include(${EPHEMERAL_DIR}/generated_config.cmake) - -# TODO: Move the rest of this into files in ephemeral. See -# https://github.com/flutter/flutter/issues/57146. -set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") - -# Set fallback configurations for older versions of the flutter tool. -if (NOT DEFINED FLUTTER_TARGET_PLATFORM) - set(FLUTTER_TARGET_PLATFORM "windows-x64") -endif() - -# === Flutter Library === -set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") - -# Published to parent scope for install step. -set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) -set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) -set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) -set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) - -list(APPEND FLUTTER_LIBRARY_HEADERS - "flutter_export.h" - "flutter_windows.h" - "flutter_messenger.h" - "flutter_plugin_registrar.h" - "flutter_texture_registrar.h" -) -list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") -add_library(flutter INTERFACE) -target_include_directories(flutter INTERFACE - "${EPHEMERAL_DIR}" -) -target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") -add_dependencies(flutter flutter_assemble) - -# === Wrapper === -list(APPEND CPP_WRAPPER_SOURCES_CORE - "core_implementations.cc" - "standard_codec.cc" -) -list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") -list(APPEND CPP_WRAPPER_SOURCES_PLUGIN - "plugin_registrar.cc" -) -list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") -list(APPEND CPP_WRAPPER_SOURCES_APP - "flutter_engine.cc" - "flutter_view_controller.cc" -) -list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") - -# Wrapper sources needed for a plugin. -add_library(flutter_wrapper_plugin STATIC - ${CPP_WRAPPER_SOURCES_CORE} - ${CPP_WRAPPER_SOURCES_PLUGIN} -) -apply_standard_settings(flutter_wrapper_plugin) -set_target_properties(flutter_wrapper_plugin PROPERTIES - POSITION_INDEPENDENT_CODE ON) -set_target_properties(flutter_wrapper_plugin PROPERTIES - CXX_VISIBILITY_PRESET hidden) -target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) -target_include_directories(flutter_wrapper_plugin PUBLIC - "${WRAPPER_ROOT}/include" -) -add_dependencies(flutter_wrapper_plugin flutter_assemble) - -# Wrapper sources needed for the runner. -add_library(flutter_wrapper_app STATIC - ${CPP_WRAPPER_SOURCES_CORE} - ${CPP_WRAPPER_SOURCES_APP} -) -apply_standard_settings(flutter_wrapper_app) -target_link_libraries(flutter_wrapper_app PUBLIC flutter) -target_include_directories(flutter_wrapper_app PUBLIC - "${WRAPPER_ROOT}/include" -) -add_dependencies(flutter_wrapper_app flutter_assemble) - -# === Flutter tool backend === -# _phony_ is a non-existent file to force this command to run every time, -# since currently there's no way to get a full input/output list from the -# flutter tool. -set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") -set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) -add_custom_command( - OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} - ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} - ${CPP_WRAPPER_SOURCES_APP} - ${PHONY_OUTPUT} - COMMAND ${CMAKE_COMMAND} -E env - ${FLUTTER_TOOL_ENVIRONMENT} - "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" - ${FLUTTER_TARGET_PLATFORM} $ - VERBATIM -) -add_custom_target(flutter_assemble DEPENDS - "${FLUTTER_LIBRARY}" - ${FLUTTER_LIBRARY_HEADERS} - ${CPP_WRAPPER_SOURCES_CORE} - ${CPP_WRAPPER_SOURCES_PLUGIN} - ${CPP_WRAPPER_SOURCES_APP} -) diff --git a/GC-UI/frontend/windows/runner/CMakeLists.txt b/GC-UI/frontend/windows/runner/CMakeLists.txt deleted file mode 100644 index 394917c..0000000 --- a/GC-UI/frontend/windows/runner/CMakeLists.txt +++ /dev/null @@ -1,40 +0,0 @@ -cmake_minimum_required(VERSION 3.14) -project(runner LANGUAGES CXX) - -# Define the application target. To change its name, change BINARY_NAME in the -# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer -# work. -# -# Any new source files that you add to the application should be added here. -add_executable(${BINARY_NAME} WIN32 - "flutter_window.cpp" - "main.cpp" - "utils.cpp" - "win32_window.cpp" - "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" - "Runner.rc" - "runner.exe.manifest" -) - -# Apply the standard set of build settings. This can be removed for applications -# that need different build settings. -apply_standard_settings(${BINARY_NAME}) - -# Add preprocessor definitions for the build version. -target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") -target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") -target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") -target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") -target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") - -# Disable Windows macros that collide with C++ standard library functions. -target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") - -# Add dependency libraries and include directories. Add any application-specific -# dependencies here. -target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) -target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") -target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") - -# Run the Flutter tool portions of the build. This must not be removed. -add_dependencies(${BINARY_NAME} flutter_assemble) diff --git a/GC-UI/frontend/windows/runner/Runner.rc b/GC-UI/frontend/windows/runner/Runner.rc deleted file mode 100644 index 5f4ae22..0000000 --- a/GC-UI/frontend/windows/runner/Runner.rc +++ /dev/null @@ -1,121 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#pragma code_page(65001) -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (United States) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_APP_ICON ICON "resources\\app_icon.ico" - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) -#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD -#else -#define VERSION_AS_NUMBER 1,0,0,0 -#endif - -#if defined(FLUTTER_VERSION) -#define VERSION_AS_STRING FLUTTER_VERSION -#else -#define VERSION_AS_STRING "1.0.0" -#endif - -VS_VERSION_INFO VERSIONINFO - FILEVERSION VERSION_AS_NUMBER - PRODUCTVERSION VERSION_AS_NUMBER - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -#ifdef _DEBUG - FILEFLAGS VS_FF_DEBUG -#else - FILEFLAGS 0x0L -#endif - FILEOS VOS__WINDOWS32 - FILETYPE VFT_APP - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e4" - BEGIN - VALUE "CompanyName", "Morris" "\0" - VALUE "FileDescription", "GC UI" "\0" - VALUE "FileVersion", VERSION_AS_STRING "\0" - VALUE "InternalName", "GC-UI" "\0" - VALUE "LegalCopyright", "Copyright (C) 2026 Morris. All rights reserved." "\0" - VALUE "OriginalFilename", "GC-UI.exe" "\0" - VALUE "ProductName", "Morris GC" "\0" - VALUE "ProductVersion", VERSION_AS_STRING "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 - END -END - -#endif // English (United States) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED diff --git a/GC-UI/frontend/windows/runner/flutter_window.cpp b/GC-UI/frontend/windows/runner/flutter_window.cpp deleted file mode 100644 index 955ee30..0000000 --- a/GC-UI/frontend/windows/runner/flutter_window.cpp +++ /dev/null @@ -1,71 +0,0 @@ -#include "flutter_window.h" - -#include - -#include "flutter/generated_plugin_registrant.h" - -FlutterWindow::FlutterWindow(const flutter::DartProject& project) - : project_(project) {} - -FlutterWindow::~FlutterWindow() {} - -bool FlutterWindow::OnCreate() { - if (!Win32Window::OnCreate()) { - return false; - } - - RECT frame = GetClientArea(); - - // The size here must match the window dimensions to avoid unnecessary surface - // creation / destruction in the startup path. - flutter_controller_ = std::make_unique( - frame.right - frame.left, frame.bottom - frame.top, project_); - // Ensure that basic setup of the controller was successful. - if (!flutter_controller_->engine() || !flutter_controller_->view()) { - return false; - } - RegisterPlugins(flutter_controller_->engine()); - SetChildContent(flutter_controller_->view()->GetNativeWindow()); - - flutter_controller_->engine()->SetNextFrameCallback([&]() { - this->Show(); - }); - - // Flutter can complete the first frame before the "show window" callback is - // registered. The following call ensures a frame is pending to ensure the - // window is shown. It is a no-op if the first frame hasn't completed yet. - flutter_controller_->ForceRedraw(); - - return true; -} - -void FlutterWindow::OnDestroy() { - if (flutter_controller_) { - flutter_controller_ = nullptr; - } - - Win32Window::OnDestroy(); -} - -LRESULT -FlutterWindow::MessageHandler(HWND hwnd, UINT const message, - WPARAM const wparam, - LPARAM const lparam) noexcept { - // Give Flutter, including plugins, an opportunity to handle window messages. - if (flutter_controller_) { - std::optional result = - flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, - lparam); - if (result) { - return *result; - } - } - - switch (message) { - case WM_FONTCHANGE: - flutter_controller_->engine()->ReloadSystemFonts(); - break; - } - - return Win32Window::MessageHandler(hwnd, message, wparam, lparam); -} diff --git a/GC-UI/frontend/windows/runner/flutter_window.h b/GC-UI/frontend/windows/runner/flutter_window.h deleted file mode 100644 index 6da0652..0000000 --- a/GC-UI/frontend/windows/runner/flutter_window.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef RUNNER_FLUTTER_WINDOW_H_ -#define RUNNER_FLUTTER_WINDOW_H_ - -#include -#include - -#include - -#include "win32_window.h" - -// A window that does nothing but host a Flutter view. -class FlutterWindow : public Win32Window { - public: - // Creates a new FlutterWindow hosting a Flutter view running |project|. - explicit FlutterWindow(const flutter::DartProject& project); - virtual ~FlutterWindow(); - - protected: - // Win32Window: - bool OnCreate() override; - void OnDestroy() override; - LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, - LPARAM const lparam) noexcept override; - - private: - // The project to run. - flutter::DartProject project_; - - // The Flutter instance hosted by this window. - std::unique_ptr flutter_controller_; -}; - -#endif // RUNNER_FLUTTER_WINDOW_H_ diff --git a/GC-UI/frontend/windows/runner/main.cpp b/GC-UI/frontend/windows/runner/main.cpp deleted file mode 100644 index 473c57d..0000000 --- a/GC-UI/frontend/windows/runner/main.cpp +++ /dev/null @@ -1,116 +0,0 @@ -#include -#include -#include - -#include "flutter_window.h" -#include "utils.h" - -namespace { - -// Enable DPI awareness (Per-Monitor V2 when available). -// -// The runner.exe.manifest normally declares this, but the mingw/windres cross -// build does not embed the manifest the way the Visual Studio generator does. -// A DPI-unaware process gets bitmap-stretched by Windows on a 125% / 150% -// scaled display, which makes the whole UI (especially small CJK text) look -// blurry. Declaring it again before any window exists costs nothing and does -// not depend on the manifest being present. -// -// Every API is resolved through GetProcAddress: it keeps the binary working on -// older systems and does not require the current SDK / mingw headers to declare -// DPI_AWARENESS_CONTEXT. -#if defined(_MSC_VER) -#pragma warning(push) -#pragma warning(disable : 4191) // FARPROC to typed function pointer, on purpose -#endif - -BOOL TryPerMonitorV2() { - // DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 == (HANDLE)-4 - using Fn = BOOL(WINAPI*)(HANDLE); - HMODULE user32 = ::GetModuleHandleW(L"user32.dll"); - if (user32 == nullptr) return FALSE; - auto set_context = reinterpret_cast( - ::GetProcAddress(user32, "SetProcessDpiAwarenessContext")); - if (set_context == nullptr) return FALSE; - // Cast through INT_PTR: plain -4 to pointer is C4312 at /W4. - return set_context(reinterpret_cast(static_cast(-4))); -} - -void TryPerMonitor() { - // Windows 8.1+: PROCESS_PER_MONITOR_DPI_AWARE == 2 - using Fn = HRESULT(WINAPI*)(int); - HMODULE shcore = ::LoadLibraryW(L"shcore.dll"); - if (shcore == nullptr) return; - auto set_awareness = - reinterpret_cast(::GetProcAddress(shcore, "SetProcessDpiAwareness")); - if (set_awareness != nullptr) { - // E_ACCESSDENIED means the manifest already set awareness: still fine. - set_awareness(2); - } - ::FreeLibrary(shcore); -} - -void TrySystemDpiAware() { - // Windows Vista+: system DPI awareness, better than nothing. - using Fn = BOOL(WINAPI*)(); - HMODULE user32 = ::GetModuleHandleW(L"user32.dll"); - if (user32 == nullptr) return; - auto set_aware = - reinterpret_cast(::GetProcAddress(user32, "SetProcessDPIAware")); - if (set_aware != nullptr) set_aware(); -} - -#if defined(_MSC_VER) -#pragma warning(pop) -#endif - -void EnableDpiAwareness() { - // When the manifest already declared awareness, SetProcessDpiAwarenessContext - // returns FALSE; fall back to the 8.1 and Vista entry points. All three - // failing is harmless: the app still starts, it just scales blurrily. - if (TryPerMonitorV2()) return; - TryPerMonitor(); - TrySystemDpiAware(); -} - -} // namespace - -int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, - _In_ wchar_t *command_line, _In_ int show_command) { - // Must run before the first window is created to take effect. - EnableDpiAwareness(); - - // Attach to console when present (e.g., 'flutter run') or create a - // new console when running with a debugger. - if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { - CreateAndAttachConsole(); - } - - // Initialize COM, so that it is available for use in the library and/or - // plugins. - ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); - - flutter::DartProject project(L"data"); - - std::vector command_line_arguments = - GetCommandLineArguments(); - - project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); - - FlutterWindow window(project); - Win32Window::Point origin(10, 10); - Win32Window::Size size(1280, 720); - if (!window.Create(L"Morris GC", origin, size)) { - return EXIT_FAILURE; - } - window.SetQuitOnClose(true); - - ::MSG msg; - while (::GetMessage(&msg, nullptr, 0, 0)) { - ::TranslateMessage(&msg); - ::DispatchMessage(&msg); - } - - ::CoUninitialize(); - return EXIT_SUCCESS; -} diff --git a/GC-UI/frontend/windows/runner/resource.h b/GC-UI/frontend/windows/runner/resource.h deleted file mode 100644 index 66a65d1..0000000 --- a/GC-UI/frontend/windows/runner/resource.h +++ /dev/null @@ -1,16 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by Runner.rc -// -#define IDI_APP_ICON 101 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 102 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/GC-UI/frontend/windows/runner/resources/app_icon.ico b/GC-UI/frontend/windows/runner/resources/app_icon.ico deleted file mode 100644 index c04e20c..0000000 Binary files a/GC-UI/frontend/windows/runner/resources/app_icon.ico and /dev/null differ diff --git a/GC-UI/frontend/windows/runner/runner.exe.manifest b/GC-UI/frontend/windows/runner/runner.exe.manifest deleted file mode 100644 index 153653e..0000000 --- a/GC-UI/frontend/windows/runner/runner.exe.manifest +++ /dev/null @@ -1,14 +0,0 @@ - - - - - PerMonitorV2 - - - - - - - - - diff --git a/GC-UI/frontend/windows/runner/utils.cpp b/GC-UI/frontend/windows/runner/utils.cpp deleted file mode 100644 index 3a0b465..0000000 --- a/GC-UI/frontend/windows/runner/utils.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "utils.h" - -#include -#include -#include -#include - -#include - -void CreateAndAttachConsole() { - if (::AllocConsole()) { - FILE *unused; - if (freopen_s(&unused, "CONOUT$", "w", stdout)) { - _dup2(_fileno(stdout), 1); - } - if (freopen_s(&unused, "CONOUT$", "w", stderr)) { - _dup2(_fileno(stdout), 2); - } - std::ios::sync_with_stdio(); - FlutterDesktopResyncOutputStreams(); - } -} - -std::vector GetCommandLineArguments() { - // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. - int argc; - wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); - if (argv == nullptr) { - return std::vector(); - } - - std::vector command_line_arguments; - - // Skip the first argument as it's the binary name. - for (int i = 1; i < argc; i++) { - command_line_arguments.push_back(Utf8FromUtf16(argv[i])); - } - - ::LocalFree(argv); - - return command_line_arguments; -} - -std::string Utf8FromUtf16(const wchar_t* utf16_string) { - if (utf16_string == nullptr) { - return std::string(); - } - unsigned int target_length = ::WideCharToMultiByte( - CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, - -1, nullptr, 0, nullptr, nullptr) - -1; // remove the trailing null character - int input_length = (int)wcslen(utf16_string); - std::string utf8_string; - if (target_length == 0 || target_length > utf8_string.max_size()) { - return utf8_string; - } - utf8_string.resize(target_length); - int converted_length = ::WideCharToMultiByte( - CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, - input_length, utf8_string.data(), target_length, nullptr, nullptr); - if (converted_length == 0) { - return std::string(); - } - return utf8_string; -} diff --git a/GC-UI/frontend/windows/runner/utils.h b/GC-UI/frontend/windows/runner/utils.h deleted file mode 100644 index 3879d54..0000000 --- a/GC-UI/frontend/windows/runner/utils.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef RUNNER_UTILS_H_ -#define RUNNER_UTILS_H_ - -#include -#include - -// Creates a console for the process, and redirects stdout and stderr to -// it for both the runner and the Flutter library. -void CreateAndAttachConsole(); - -// Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string -// encoded in UTF-8. Returns an empty std::string on failure. -std::string Utf8FromUtf16(const wchar_t* utf16_string); - -// Gets the command line arguments passed in as a std::vector, -// encoded in UTF-8. Returns an empty std::vector on failure. -std::vector GetCommandLineArguments(); - -#endif // RUNNER_UTILS_H_ diff --git a/GC-UI/frontend/windows/runner/win32_window.cpp b/GC-UI/frontend/windows/runner/win32_window.cpp deleted file mode 100644 index 2b76ac4..0000000 --- a/GC-UI/frontend/windows/runner/win32_window.cpp +++ /dev/null @@ -1,304 +0,0 @@ -#include "win32_window.h" - -#include -#include - -#include "resource.h" - -namespace { - -/// Window attribute that enables dark mode window decorations. -/// -/// Redefined in case the developer's machine has a Windows SDK older than -/// version 10.0.22000.0. -/// See: https://docs.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute -#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE -#define DWMWA_USE_IMMERSIVE_DARK_MODE 20 -#endif - -constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; - -/// Registry key for app theme preference. -/// -/// A value of 0 indicates apps should use dark mode. A non-zero or missing -/// value indicates apps should use light mode. -constexpr const wchar_t kGetPreferredBrightnessRegKey[] = - L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"; -constexpr const wchar_t kGetPreferredBrightnessRegValue[] = L"AppsUseLightTheme"; - -// The number of Win32Window objects that currently exist. -static int g_active_window_count = 0; - -using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); - -// Scale helper to convert logical scaler values to physical using passed in -// scale factor -int Scale(int source, double scale_factor) { - return static_cast(source * scale_factor); -} - -// Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. -// This API is only needed for PerMonitor V1 awareness mode. -void EnableFullDpiSupportIfAvailable(HWND hwnd) { - HMODULE user32_module = LoadLibraryA("User32.dll"); - if (!user32_module) { - return; - } - auto enable_non_client_dpi_scaling = - reinterpret_cast( - GetProcAddress(user32_module, "EnableNonClientDpiScaling")); - if (enable_non_client_dpi_scaling != nullptr) { - enable_non_client_dpi_scaling(hwnd); - } - FreeLibrary(user32_module); -} - -} // namespace - -// Manages the Win32Window's window class registration. -class WindowClassRegistrar { - public: - ~WindowClassRegistrar() = default; - - // Returns the singleton registrar instance. - static WindowClassRegistrar* GetInstance() { - if (!instance_) { - instance_ = new WindowClassRegistrar(); - } - return instance_; - } - - // Returns the name of the window class, registering the class if it hasn't - // previously been registered. - const wchar_t* GetWindowClass(); - - // Unregisters the window class. Should only be called if there are no - // instances of the window. - void UnregisterWindowClass(); - - private: - WindowClassRegistrar() = default; - - static WindowClassRegistrar* instance_; - - bool class_registered_ = false; -}; - -WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; - -const wchar_t* WindowClassRegistrar::GetWindowClass() { - if (!class_registered_) { - WNDCLASS window_class{}; - window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); - window_class.lpszClassName = kWindowClassName; - window_class.style = CS_HREDRAW | CS_VREDRAW; - window_class.cbClsExtra = 0; - window_class.cbWndExtra = 0; - window_class.hInstance = GetModuleHandle(nullptr); - window_class.hIcon = - LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); - window_class.hbrBackground = 0; - window_class.lpszMenuName = nullptr; - window_class.lpfnWndProc = Win32Window::WndProc; - RegisterClass(&window_class); - class_registered_ = true; - } - return kWindowClassName; -} - -void WindowClassRegistrar::UnregisterWindowClass() { - UnregisterClass(kWindowClassName, nullptr); - class_registered_ = false; -} - -Win32Window::Win32Window() { - ++g_active_window_count; -} - -Win32Window::~Win32Window() { - --g_active_window_count; - Destroy(); -} - -bool Win32Window::Create(const std::wstring& title, - const Point& origin, - const Size& size) { - Destroy(); - - const wchar_t* window_class = - WindowClassRegistrar::GetInstance()->GetWindowClass(); - - const POINT target_point = {static_cast(origin.x), - static_cast(origin.y)}; - HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); - UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); - double scale_factor = dpi / 96.0; - - // Cap the initial size to the monitor work area. 1280x720 logical is - // 1920x1080 physical at 150% scaling, which no longer fits on a 1080p - // screen; clamping keeps the window usable instead of hanging off-screen. - int physical_width = Scale(size.width, scale_factor); - int physical_height = Scale(size.height, scale_factor); - MONITORINFO monitor_info{}; - monitor_info.cbSize = sizeof(MONITORINFO); - if (::GetMonitorInfoW(monitor, &monitor_info)) { - const int max_width = - (monitor_info.rcWork.right - monitor_info.rcWork.left) * 92 / 100; - const int max_height = - (monitor_info.rcWork.bottom - monitor_info.rcWork.top) * 92 / 100; - if (physical_width > max_width) physical_width = max_width; - if (physical_height > max_height) physical_height = max_height; - } - - HWND window = CreateWindow( - window_class, title.c_str(), WS_OVERLAPPEDWINDOW, - Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), - physical_width, physical_height, nullptr, nullptr, - GetModuleHandle(nullptr), this); - - if (!window) { - return false; - } - - UpdateTheme(window); - - return OnCreate(); -} - -bool Win32Window::Show() { - return ShowWindow(window_handle_, SW_SHOWNORMAL); -} - -// static -LRESULT CALLBACK Win32Window::WndProc(HWND const window, - UINT const message, - WPARAM const wparam, - LPARAM const lparam) noexcept { - if (message == WM_NCCREATE) { - auto window_struct = reinterpret_cast(lparam); - SetWindowLongPtr(window, GWLP_USERDATA, - reinterpret_cast(window_struct->lpCreateParams)); - - auto that = static_cast(window_struct->lpCreateParams); - EnableFullDpiSupportIfAvailable(window); - that->window_handle_ = window; - } else if (Win32Window* that = GetThisFromHandle(window)) { - return that->MessageHandler(window, message, wparam, lparam); - } - - return DefWindowProc(window, message, wparam, lparam); -} - -LRESULT -Win32Window::MessageHandler(HWND hwnd, - UINT const message, - WPARAM const wparam, - LPARAM const lparam) noexcept { - switch (message) { - case WM_DESTROY: - window_handle_ = nullptr; - Destroy(); - if (quit_on_close_) { - PostQuitMessage(0); - } - return 0; - - case WM_DPICHANGED: { - auto newRectSize = reinterpret_cast(lparam); - LONG newWidth = newRectSize->right - newRectSize->left; - LONG newHeight = newRectSize->bottom - newRectSize->top; - - SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, - newHeight, SWP_NOZORDER | SWP_NOACTIVATE); - - return 0; - } - case WM_SIZE: { - RECT rect = GetClientArea(); - if (child_content_ != nullptr) { - // Size and position the child window. - MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, - rect.bottom - rect.top, TRUE); - } - return 0; - } - - case WM_ACTIVATE: - if (child_content_ != nullptr) { - SetFocus(child_content_); - } - return 0; - - case WM_DWMCOLORIZATIONCOLORCHANGED: - UpdateTheme(hwnd); - return 0; - } - - return DefWindowProc(window_handle_, message, wparam, lparam); -} - -void Win32Window::Destroy() { - OnDestroy(); - - if (window_handle_) { - DestroyWindow(window_handle_); - window_handle_ = nullptr; - } - if (g_active_window_count == 0) { - WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); - } -} - -Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { - return reinterpret_cast( - GetWindowLongPtr(window, GWLP_USERDATA)); -} - -void Win32Window::SetChildContent(HWND content) { - child_content_ = content; - SetParent(content, window_handle_); - RECT frame = GetClientArea(); - - MoveWindow(content, frame.left, frame.top, frame.right - frame.left, - frame.bottom - frame.top, true); - - SetFocus(child_content_); -} - -RECT Win32Window::GetClientArea() { - RECT frame; - GetClientRect(window_handle_, &frame); - return frame; -} - -HWND Win32Window::GetHandle() { - return window_handle_; -} - -void Win32Window::SetQuitOnClose(bool quit_on_close) { - quit_on_close_ = quit_on_close; -} - -bool Win32Window::OnCreate() { - // No-op; provided for subclasses. - return true; -} - -void Win32Window::OnDestroy() { - // No-op; provided for subclasses. -} - -void Win32Window::UpdateTheme(HWND const window) { - DWORD light_mode; - DWORD light_mode_size = sizeof(light_mode); - LSTATUS result = RegGetValue(HKEY_CURRENT_USER, kGetPreferredBrightnessRegKey, - kGetPreferredBrightnessRegValue, - RRF_RT_REG_DWORD, nullptr, &light_mode, - &light_mode_size); - - if (result == ERROR_SUCCESS) { - BOOL enable_dark_mode = light_mode == 0; - DwmSetWindowAttribute(window, DWMWA_USE_IMMERSIVE_DARK_MODE, - &enable_dark_mode, sizeof(enable_dark_mode)); - } -} diff --git a/GC-UI/frontend/windows/runner/win32_window.h b/GC-UI/frontend/windows/runner/win32_window.h deleted file mode 100644 index e901dde..0000000 --- a/GC-UI/frontend/windows/runner/win32_window.h +++ /dev/null @@ -1,102 +0,0 @@ -#ifndef RUNNER_WIN32_WINDOW_H_ -#define RUNNER_WIN32_WINDOW_H_ - -#include - -#include -#include -#include - -// A class abstraction for a high DPI-aware Win32 Window. Intended to be -// inherited from by classes that wish to specialize with custom -// rendering and input handling -class Win32Window { - public: - struct Point { - unsigned int x; - unsigned int y; - Point(unsigned int x, unsigned int y) : x(x), y(y) {} - }; - - struct Size { - unsigned int width; - unsigned int height; - Size(unsigned int width, unsigned int height) - : width(width), height(height) {} - }; - - Win32Window(); - virtual ~Win32Window(); - - // Creates a win32 window with |title| that is positioned and sized using - // |origin| and |size|. New windows are created on the default monitor. Window - // sizes are specified to the OS in physical pixels, hence to ensure a - // consistent size this function will scale the inputted width and height as - // as appropriate for the default monitor. The window is invisible until - // |Show| is called. Returns true if the window was created successfully. - bool Create(const std::wstring& title, const Point& origin, const Size& size); - - // Show the current window. Returns true if the window was successfully shown. - bool Show(); - - // Release OS resources associated with window. - void Destroy(); - - // Inserts |content| into the window tree. - void SetChildContent(HWND content); - - // Returns the backing Window handle to enable clients to set icon and other - // window properties. Returns nullptr if the window has been destroyed. - HWND GetHandle(); - - // If true, closing this window will quit the application. - void SetQuitOnClose(bool quit_on_close); - - // Return a RECT representing the bounds of the current client area. - RECT GetClientArea(); - - protected: - // Processes and route salient window messages for mouse handling, - // size change and DPI. Delegates handling of these to member overloads that - // inheriting classes can handle. - virtual LRESULT MessageHandler(HWND window, - UINT const message, - WPARAM const wparam, - LPARAM const lparam) noexcept; - - // Called when CreateAndShow is called, allowing subclass window-related - // setup. Subclasses should return false if setup fails. - virtual bool OnCreate(); - - // Called when Destroy is called. - virtual void OnDestroy(); - - private: - friend class WindowClassRegistrar; - - // OS callback called by message pump. Handles the WM_NCCREATE message which - // is passed when the non-client area is being created and enables automatic - // non-client DPI scaling so that the non-client area automatically - // responds to changes in DPI. All other messages are handled by - // MessageHandler. - static LRESULT CALLBACK WndProc(HWND const window, - UINT const message, - WPARAM const wparam, - LPARAM const lparam) noexcept; - - // Retrieves a class instance pointer for |window| - static Win32Window* GetThisFromHandle(HWND const window) noexcept; - - // Update the window frame's theme to match the system theme. - static void UpdateTheme(HWND const window); - - bool quit_on_close_ = false; - - // window handle for top level window. - HWND window_handle_ = nullptr; - - // window handle for hosted content. - HWND child_content_ = nullptr; -}; - -#endif // RUNNER_WIN32_WINDOW_H_ diff --git a/Java/.gitignore b/Java/.gitignore new file mode 100644 index 0000000..07364f2 --- /dev/null +++ b/Java/.gitignore @@ -0,0 +1,9 @@ +.gradle/ +.gradle-home/ +build/ +.GC/ +*.class +*.log +.DS_Store +.idea/ +*.iml diff --git a/Java/LICENSE b/Java/LICENSE new file mode 100644 index 0000000..1dfdfc4 --- /dev/null +++ b/Java/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Morris GC + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Java/README.md b/Java/README.md new file mode 100644 index 0000000..9d432d5 --- /dev/null +++ b/Java/README.md @@ -0,0 +1,209 @@ +# GC Java · 天文教学模型启动器(HMCL 风格) + +把原来的 **GC(C# / .NET 8 / Avalonia + Flutter 前后端)** 完整重写为 **单进程 Java / Swing** 桌面应用。 +启动器界面参考 **HMCL** 的左侧导航 + 首页 Hero + 模型卡片布局;五个教学模型的算法、数据、界面与交互全部在 Java 中重新实现,不依赖任何 .NET 运行时。 + +![首页](docs/screenshots/home.png) + +## 快速开始 + +要求:**JDK 17+**(已在 JDK 26 上验证)。项目自带 Gradle Wrapper,首次运行会从**腾讯云镜像**下载 Gradle。 + +```bash +cd Java + +./gradlew run # 启动 HMCL 风格 GUI +./gradlew selftest # 35 项核心 / 模型 / 账户断言 +./gradlew gui-selftest # 无头渲染 5 个模型 + 5 个页面截图到 build/screenshots +./gradlew installDist # 生成可分发的 build/install/gc-java/ +``` + +或使用脚本: + +```bash +./run.sh # GUI(优先使用已构建发行目录) +./gcctl selftest # CLI 自检 +./build.sh # 编译 + 自检 + UI 冒烟 + 组装 build/gc-dist +``` + +Windows:`.\build.ps1`(参数与 `build.sh` 相同,产物在 `build\gc-dist\`)。 + +Gradle Wrapper 固定为 **Gradle 9.9.2**,`gradle/wrapper/gradle-wrapper.properties`: + +```properties +distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-9.9.2-bin.zip +``` + +若网络无法访问腾讯云,可把该地址换成官方 `https://services.gradle.org/distributions/gradle-9.9.2-bin.zip`。 + +## 界面 + +| 页面 | 说明 | +| --- | --- | +| 首页 | HMCL 风格 Hero、模型选择器、启动按钮、统计卡、已安装模型网格、公告 | +| 模型库 | 模型封面、版本、体积、作者;启动 / 打开目录 / 删除 | +| 下载 | 更新源、离线模型源、检查更新、进度、远端模型列表、导入本地模型 | +| 设置 | 语言、深浅主题、渲染帧率、内存预算、自动更新、签名策略、存储目录 | +| 账户 | HMCL 侧边栏本地账户:登录/注册、人机验证、30 天签到、积分、每日人品值、二选一、主题色购买与 1 小时退款 | +| 关于 | 版本、平台、源码语言 Java、构建工具 Gradle 9.9.2、内置模型、许可 | + +| 首页 | 模型库 | 下载 | +| --- | --- | --- | +| ![](docs/screenshots/home.png) | ![](docs/screenshots/models.png) | ![](docs/screenshots/download.png) | + +| 设置 | 关于 | +| --- | --- | +| ![](docs/screenshots/settings.png) | ![](docs/screenshots/about.png) | + +## 本地账户与积分 + +侧边栏底部账号卡打开本地账户窗口(对应原 `GC.UI.Server.UserService`): + +- 注册 / 登录;密码只存 `SHA-512(salt + ":" + password)`,数据在 `.GC/user/` +- 30 天签到周期,连续签到递增积分 +- 每日人品值、每日二选一(积分增减) +- 预置主题色 50 积分、自定义主题色 150 积分;1 小时内换色退 80% +- 购买后立即写入设置并应用到 HMCL 风格强调色 + +## 五个教学模型 + +打开模型后是独立窗口,画布铺满,所有计算与 GUI 共用 `src/main/java/com/gc/model` 下同一套算法。 + +| 模型 | Java 实现 | 功能 | +| --- | --- | --- | +| 比例尺计算器 | `model/scale/ScaleMath` + `ui/ScalePanel` | 求实地/图上/比例尺三种模式、图上/实地双标尺、线段式自动换挡、比例尺光谱、三种写法、大小判读、解题步骤、真实地标、练习闯关 | +| 等高线地形图 | `model/contour/TerrainField` / `TerrainAnalyzer` + `ui/ContourPanel` | 5 种基本地形 + 5 种典型地貌、分层设色、Marching Squares 等高线、河流/山峰/陡崖标注、悬停判读、3D 轴测拖动旋转、等高线演示动画 | +| 地球自转 | `model/earth/EarthMath` + `ui/EarthPanel` | 地球球体、大陆轮廓、经纬网、昼夜/晨昏线、太阳直射点、地轴倾角、播放/暂停/速度/拖动/缩放、迷你轨道、教学要点 | +| 地球公转 | 同上 | 公转轨道、四季与二分二至、地轴指向不变、直射纬度与日期、节气定位、教学要点、地球特写 | +| 地球地理 | `EarthMath` + `ui/GeographyPanel` | 五带划分、七大洲四大洋、海陆轮廓、洲界、六大板块、悬停经纬度与温度带判读 | + +| 比例尺 | 等高线 | +| --- | --- | +| ![](docs/screenshots/scale.png) | ![](docs/screenshots/contour.png) | + +| 自转 | 公转 | 地理 | +| --- | --- | --- | +| ![](docs/screenshots/rotation.png) | ![](docs/screenshots/revolution.png) | ![](docs/screenshots/geography.png) | + +## CLI + +无参数启动 GUI;带参数运行 CLI,GUI 与 CLI 共用算法。 + +```text +gcctl 启动 HMCL 风格 GUI +gcctl selftest 全部内置断言 +gcctl gui-selftest 无头 UI 冒烟 + 截图 +gcctl hash-file SHA-256 +gcctl hash-dir 目录指纹 +gcctl canonical 规范化 JSON +gcctl version-normalize 版本规整 +gcctl version-compare 版本比较(-1/0/1) +gcctl paths [root] .GC 目录布局 +gcctl settings-default 默认设置 +gcctl model-scan [root] 扫描模型库 +gcctl safezip-name zip 路径安全判定 +gcctl human-size 人类可读体积 +gcctl update-check 检查模型 / 启动器更新 +gcctl savedog verify 清单验签 +gcctl savedog apply 应用 .GC/update/apply-request.json +gcctl savedog status 更新状态 +gcctl savedog keygen [dir] [id] 生成 ECDSA P-256 密钥 +gcctl savedog sign 签名清单 +``` + +模型算法命令: + +```text +gcctl model scale solve +gcctl model scale human | segment +gcctl model scale grade | spectrum | quiz | check +gcctl model contour build [size] +gcctl model contour sample | levels | extract +gcctl model contour classify | color | slope +gcctl model rotation subsolar | date | angle +gcctl model revolution subsolar | season | step
+gcctl model geo zones | declination | latlon +``` + +## 运行目录 + +与原版一致,所有用户数据放在程序旁的 `.GC`: + +```text +<安装目录>/ + bin/gc-java 启动脚本(Gradle installDist) + lib/gc-java-2.0.0.jar 应用 + model/ 随包内置的 5 个模型(首次启动复制到 .GC/model) + .GC/ + bin/ 非本体文件 + config/settings.json 设置 + model/ 模型库(首次启动从 model/ 种子化) + cache/ 下载暂存 + update/ 待应用的启动器更新 + safedog/ 更新守护运行目录 + logs/gc-YYYYMMDD.log 中文日志 + logs/gc-YYYYMMDD.en.log 英文日志 +``` + +开发态(仓库内运行)直接使用 `Java/model` 并同步到 `Java/.GC/model`。 +`EMS_HOME`、`EMS_DATA`、`EMS_MODELS` 可覆盖路径。 + +## 从 C# 到 Java 的对应关系 + +| 原 C# 模块 | Java 位置 | 说明 | +| --- | --- | --- | +| `GC/src/Services/*` | `core/AppPaths` `Settings` `Log` `Http` `VersionUtil` `I18n` | 路径、设置、日志、HTTP、版本、语言 | +| `GC/src/Security/*` | `core/Security` `Hash` `Json` | ECDSA 验签、SHA-256、规范化 JSON、安全 zip、完整性、健康标记 | +| `GC/src/Models/*` | `core/ModelManifest` | 模型清单与扫描 | +| `GC-DOWNLOAD/*` | `core/UpdateService` `GiteaRemote` `LocalRemote` `Remote` | 更新清单、Gitea/GitHub/本地源、模型安装 | +| `GC-SAVEDOG/*` | `core/Updater` | verify / apply / status / keygen / sign | +| `GC-UI/backend/.../UserService.cs` | `core/UserService` + `ui/AccountDialog` | 本地注册/登录/签到/积分/主题色 | +| `GC-DRAW/PlayerWindow.cs` | `ui/ModelWindow` | 模型窗口宿主 | +| `GC-UI/frontend/*` | `ui/MainWindow` + `HomePage` / `ModelsPage` / `DownloadPage` / `SettingsPage` / `AboutPage` / `AccountDialog` | HMCL 风格前端 + 本地账户 | +| `model/scale-calculator` | `model/scale` + `ui/ScalePanel` | 比例尺 | +| `model/contour-map` | `model/contour` + `ui/ContourPanel` | 等高线 | +| `model/earth-rotation` / `earth-revolution` | `model/earth` + `ui/EarthPanel` | 地球自转/公转 | +| `model/earth-geography` | `model/earth` + `ui/GeographyPanel` | 地理 | + +模型清单、`scene.json`、`land.json`、`i18n/`、`help.json`、`scales.json`、`coastline.json`、`plates.json` 等数据原样保留在 `Java/model/`,Java 渲染器直接读取。 + +### 为什么不是“加载原 DLL”? + +原模型的界面契约返回的是 Avalonia `Control`,程序集是 **.NET IL**,JVM 无法加载,也不存在 Avalonia 运行时。 +因此 Java 版把五个官方模型**逐项重写**为 Swing 渲染器,并直接复用原模型的算法公式与数据文件; +模型窗口、交互、教学文案、直射纬度/日期/坡度/等高线等计算结果与 C# 源码一致。 +第三方 C# DLL 模型不会被 JVM 执行;如需扩展,按 `BuiltinModels` 注册新的 Java 渲染器即可。 + +## 安全与更新 + +- 版本清单验签:**ECDSA P-256 / SHA-256(IEEE P1363 签名格式)**,内置 `gc-2026-12` 公钥,可用 `GC_TRUSTED_KEYS=id:base64` 注入。 +- 规范化 JSON:递归键排序、无空白、保留数字原文、非 ASCII 不转义、签名时移除根级 `signature`——与 C# 端字节级一致;已用原仓库签名 `C#/version.json` 验证通过。 +- 模型安装:只接受 `.json` 与 `.model/`,先写 cache/staging,复算 `manifestSha256` 与 `filesSha256`,通过后原子替换;远端版本低于本地时**绝不降级**。 +- zip 加固:拒绝绝对路径、`../`、盘符、UNC;限制条目数 20000、解压 2 GiB、压缩比异常。 +- 启动器更新:下载到 `.GC/update/`,`savedog apply` 进行安全解压、备份替换、失败回滚,并写 `health.json` / `state.json` / `last-good.json`。 +- 断网、清单缺失、签名不符:保留本地模型,界面状态栏提示,不会清空模型库。 + +## 自检 + +```text +$ ./gradlew selftest +... +PASS model-scan = 5 +PASS safezip-abs = REJECT +PASS safezip-drive = REJECT + +SELFTEST PASS 35 passed, 0 failed +``` + +`./gradlew gui-selftest` 在无显示环境构造 5 个模型面板与 5 个页面,离屏渲染 PNG;`docs/screenshots/` 即由该命令生成。 + +## 已知边界 + +- 加载 **任意第三方 C# DLL 模型** 不在 Java 版能力范围内(JVM 无法执行 .NET IL);五个官方模型全部可用。 +- 原版 Flutter 前端与 .NET 本地 HTTP 后端合并为**单进程 Swing**,符合“禁止前后端分离”的重写规范。 +- 更新源默认仍是原仓库的 `version.json`;若远端清单版本高于本地,会按签名与哈希校验后安装模型数据。C# 模型包中的 DLL 会被一起下载但 JVM 不加载,渲染使用 Java 内置实现。 +- 主题色自定义、深浅主题、帧率/内存设置已持久化;渲染帧率作为模型动画的参考值(Swing 定时器 16 ms ≈ 60 FPS)。 + +## 许可 + +MIT。原项目版权归 Morris GC;Java 重写版保留原模型数据与教学文案。 diff --git a/Java/build.gradle.kts b/Java/build.gradle.kts new file mode 100644 index 0000000..1ef3b9e --- /dev/null +++ b/Java/build.gradle.kts @@ -0,0 +1,113 @@ +plugins { + application +} + +group = "com.gc" +version = "2.0.0" + +repositories { + mavenCentral() + maven { url = uri("https://mirrors.cloud.tencent.com/nexus/repository/maven-public/") } +} + +// 宿主平台的原生库:JOGL(OpenGL)与 JavaFX WebView(原始 HTML 课件)。 +val hostOs = System.getProperty("os.name").lowercase() +val hostArch = System.getProperty("os.arch").lowercase() +val isMac = hostOs.contains("mac") +val isWin = hostOs.contains("win") +val isArm = hostArch.contains("aarch64") || hostArch.contains("arm64") +val javafxClassifier = when { + isMac -> if (isArm) "mac-aarch64" else "mac" + isWin -> "win" + else -> if (isArm) "linux-aarch64" else "linux" +} +val jogampNatives = when { + isMac -> "natives-macosx-universal" + isWin -> "natives-windows-amd64" + else -> if (isArm) "natives-linux-aarch64" else "natives-linux-amd64" +} +val javafxVersion = "21.0.7" + +dependencies { + // OpenGL:JOGL 2.6(GLJPanel 嵌入 Swing,原生库随后打包进发行目录) + implementation("org.jogamp.jogl:jogl-all:2.6.0") + implementation("org.jogamp.gluegen:gluegen-rt:2.6.0") + runtimeOnly("org.jogamp.jogl:jogl-all:2.6.0:$jogampNatives") + runtimeOnly("org.jogamp.gluegen:gluegen-rt:2.6.0:$jogampNatives") + + // JavaFX WebView:承载原始离线 HTML 课件(视频 / Three.js / 交互) + for (artifact in listOf("base", "graphics", "controls", "media", "web", "swing")) { + implementation("org.openjfx:javafx-$artifact:$javafxVersion:$javafxClassifier") + } +} + +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} + +tasks.withType().configureEach { + options.encoding = "UTF-8" + options.release.set(17) +} + +application { + mainClass.set("com.gc.Main") + applicationDefaultJvmArgs = listOf( + "-Dfile.encoding=UTF-8", + "-Dsun.java2d.uiScale.enabled=true", + "-Dprism.lcdtext=false", + "-Djavafx.animation.fullspeed=true" + ) +} + +tasks.jar { + manifest { + attributes["Main-Class"] = "com.gc.Main" + } + duplicatesStrategy = DuplicatesStrategy.EXCLUDE +} + +tasks.register("selftest") { + group = "verification" + description = "运行全部内置断言(核心 + 5 个模型)" + dependsOn("classes") + classpath = sourceSets.main.get().runtimeClasspath + mainClass.set("com.gc.Main") + args("selftest") + workingDir = projectDir +} + +tasks.register("gui-selftest") { + group = "verification" + description = "无头构造 5 个模型面板与 5 个页面并离屏渲染截图" + dependsOn("classes") + classpath = sourceSets.main.get().runtimeClasspath + mainClass.set("com.gc.Main") + args("gui-selftest") + workingDir = projectDir + jvmArgs("-Djava.awt.headless=true") +} + +tasks.named("run") { + workingDir = projectDir + standardInput = System.`in` +} + +distributions { + main { + contents { + from("model") { into("model") } + from("courseware") { into("courseware") } + from("run.sh", "run.bat", "gcctl") + } + } +} + +tasks.register("printRuntimeClasspath") { + doLast { println(sourceSets.main.get().runtimeClasspath.asPath) } +} + +tasks.named("build") { + dependsOn("selftest") +} diff --git a/Java/build.ps1 b/Java/build.ps1 new file mode 100644 index 0000000..668c034 --- /dev/null +++ b/Java/build.ps1 @@ -0,0 +1,17 @@ +# Windows 一键构建:编译 + 自检 + 离屏 UI 冒烟 + 发行目录 +$ErrorActionPreference = "Stop" +Set-Location $PSScriptRoot +if (-not $env:JAVA_HOME) { + Write-Host "请先设置 JAVA_HOME 指向 JDK 17+" -ForegroundColor Yellow +} +.\gradlew.bat clean selftest gui-selftest installDist --console=plain +if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } +if (Test-Path build\gc-dist) { Remove-Item -Recurse -Force build\gc-dist } +New-Item -ItemType Directory -Path build\gc-dist | Out-Null +Copy-Item -Recurse build\install\gc-java\* build\gc-dist\ +Copy-Item run.bat,run.sh,gcctl build\gc-dist\ +Copy-Item -Recurse model build\gc-dist\model +Write-Host "" +Write-Host "构建完成:build\gc-dist\" -ForegroundColor Green +Write-Host " build\gc-dist\bin\gc-java.bat GUI" +Write-Host " build\gc-dist\bin\gc-java.bat selftest CLI 自检" diff --git a/Java/build.sh b/Java/build.sh new file mode 100755 index 0000000..15d0dfe --- /dev/null +++ b/Java/build.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# 一键构建:编译 + 自检 + 离屏 UI 冒烟 + 组装发行目录 build/gc-dist +set -e +DIR=$(cd "$(dirname "$0")" && pwd) +cd "$DIR" +JAVA_HOME=${JAVA_HOME:-$(/usr/libexec/java_home 2>/dev/null || true)} +./gradlew clean classes selftest gui-selftest installDist --console=plain +rm -rf build/gc-dist +mkdir -p build/gc-dist +cp -R build/install/gc-java/. build/gc-dist/ +cp run.sh run.bat gcctl build/gc-dist/ 2>/dev/null || true +cp -R model build/gc-dist/model +chmod +x build/gc-dist/bin/gc-java build/gc-dist/run.sh 2>/dev/null || true +echo "" +echo "构建完成:build/gc-dist/" +echo " ./build/gc-dist/bin/gc-java # GUI" +echo " ./build/gc-dist/bin/gc-java selftest # CLI 自检" diff --git a/Java/gcctl b/Java/gcctl new file mode 100755 index 0000000..23d3b08 --- /dev/null +++ b/Java/gcctl @@ -0,0 +1,6 @@ +#!/bin/sh +# gcctl 兼容入口:./gcctl -> HMCL 风格 GUI +# ./gcctl selftest -> CLI 自检 +# ./gcctl model ... -> 模型算法命令 +DIR=$(cd "$(dirname "$0")" && pwd) +exec "$DIR/run.sh" "$@" diff --git a/Java/gradle.properties b/Java/gradle.properties new file mode 100644 index 0000000..63227c1 --- /dev/null +++ b/Java/gradle.properties @@ -0,0 +1,4 @@ +org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8 +org.gradle.parallel=true +org.gradle.caching=true +kotlin.daemon.jvmargs=-Xmx1g diff --git a/Java/gradle/wrapper/gradle-wrapper.jar b/Java/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..51cbd2a Binary files /dev/null and b/Java/gradle/wrapper/gradle-wrapper.jar differ diff --git a/Java/gradle/wrapper/gradle-wrapper.properties b/Java/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..dc9c36e --- /dev/null +++ b/Java/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-9.9.2-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/Java/gradlew b/Java/gradlew new file mode 100755 index 0000000..249efbb --- /dev/null +++ b/Java/gradlew @@ -0,0 +1,248 @@ +#!/bin/sh + +# +# Copyright © 2015 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# gradlew start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh gradlew +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/Java/gradlew.bat b/Java/gradlew.bat new file mode 100644 index 0000000..03754c4 --- /dev/null +++ b/Java/gradlew.bat @@ -0,0 +1,112 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem gradlew startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables, and ensure extensions are enabled +setlocal EnableExtensions + +@rem Catch executions from older scripts and ensure they exit cleanly. +@rem This can be removed once we can be reasonably confident that few people +@rem will be migrating directly to this new wrapper. +goto afterSafetyNet +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +goto exitWithErrorLevel +:afterSafetyNet + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +1>&2 echo. +1>&2 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +1>&2 echo. +1>&2 echo Please set the JAVA_HOME variable in your environment to match the +1>&2 echo location of your Java installation. + +"%COMSPEC%" /c exit 1 +goto exitWithErrorLevel + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +1>&2 echo. +1>&2 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +1>&2 echo. +1>&2 echo Please set the JAVA_HOME variable in your environment to match the +1>&2 echo location of your Java installation. + +"%COMSPEC%" /c exit 1 +goto exitWithErrorLevel + +:execute +@rem Setup the command line + + + +@rem Execute gradlew +@rem endlocal doesn't take effect until after the line is parsed and variables are expanded +@rem which allows us to clear the local environment before executing the java command +endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel & goto exitWithErrorLevel + +@rem This label must not be changed. We rely on old scripts being able to jump to this point. +:exitWithErrorLevel +@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts +"%COMSPEC%" /c exit %ERRORLEVEL% diff --git a/Java/model/contour-map/contour-map.json b/Java/model/contour-map/contour-map.json new file mode 100644 index 0000000..b94ad09 --- /dev/null +++ b/Java/model/contour-map/contour-map.json @@ -0,0 +1,30 @@ +{ + "id": "contour-map", + "nameI18n": { + "zh-CN": "等高线地形图", + "en": "Contour Map" + }, + "descriptionI18n": { + "zh-CN": "可旋转 3D 地形 + 等高切割/交线/投影/判坡四步动画,判读山峰、山脊、山谷、鞍部、陡崖五大典型地貌。", + "en": "Rotatable 3D terrain with a four-step animation of contour cutting, lines, projection and slope; identify five classic landforms." + }, + "author": "Morris GC", + "tags": [ + "geography", + "map", + "contour", + "terrain" + ], + "assembly": "ContourMapModel.dll", + "type": "GC.ContourMap.ContourMapFactory", + "version": "1.2", + "chrome": { + "titleBar": "#0C1828", + "titleBorder": "#1B2740", + "titleText": "#EAF2FF", + "button": "#9FB4D4", + "frame": "#0A1524" + }, + "build": "d18eb85c8d", + "updatedAt": "2026-11-21T10:55:36Z" +} diff --git a/Java/model/contour-map/contour-map.model/help.json b/Java/model/contour-map/contour-map.model/help.json new file mode 100644 index 0000000..4d5e963 --- /dev/null +++ b/Java/model/contour-map/contour-map.model/help.json @@ -0,0 +1,118 @@ +{ + "zh-CN": { + "title": "如何使用 · 等高线地形与五大典型地貌", + "sections": [ + { + "h": "开始使用(跟着做)", + "lines": [ + "第 1 步:点右下角「开始实验」,在立体地形里观察水平切面下降、交线形成、垂直投影与疏密判坡四步动画。", + "第 2 步:在立体地形上按住鼠标拖动可旋转视角,滚轮缩放;这是可交互的 3D 地形。", + "第 3 步:点画布上方「五大典型地貌」标签(山峰/山脊/山谷/鞍部/陡崖),画面换成对应的专门地形并叠加完整等高线,观察各自的等高线特征。", + "第 4 步:点底部「俯视图 / 立体图」在等高线地图与 3D 地形间切换;鼠标悬停任意位置,底部显示该点海拔与地形部位。", + "第 5 步:点「上色 / 取消上色」对比分层设色与纯等高线;点「全屏」进入全屏演示。" + ] + }, + { + "h": "键盘快捷键", + "lines": [ + "空格:播放 / 暂停实验。", + "数字 1 – 5:依次切换到山峰、山脊、山谷、鞍部、陡崖。" + ] + }, + { + "h": "四步实验流程", + "lines": [ + "等高切割:一个水平面从山顶向下移动,与山体在同一海拔相交。", + "形成交线:每个水平切面留下一条闭合交线,多层交线共同描述山体起伏。", + "投影成图:各高度的交线沿垂线投影到同一平面,累积成完整等高线图。", + "疏密判坡:坡度着色叠加等高线,陡处线密、缓处线疏。" + ] + }, + { + "h": "五大典型地貌的判读", + "lines": [ + "山峰:等高线闭合,数值由中心向四周递减(若向内降低则为洼地)。", + "山脊:等高线向海拔低处凸出(凸低为脊),脊线是分水线。", + "山谷:等高线向海拔高处凸出(凸高为谷),谷线是集水线,常发育河流。", + "鞍部:两座山峰之间相对低洼,俯视轮廓呈马鞍状收腰。", + "陡崖:等高线密集甚至重合,近乎垂直;n 条线重合时 (n−1)d ≤ ΔH < (n+1)d。" + ] + }, + { + "h": "等高线基础", + "lines": [ + "同一条等高线上各点海拔相等;相邻等高线之间的高差叫等高距(本图 100 米)。", + "等高线越密坡越陡,越疏坡越缓。", + "每 5 条加粗一条叫计曲线,标注海拔便于读数。", + "海拔:某地高出海平面的垂直距离;相对高度:两点海拔之差。" + ] + }, + { + "h": "地图符号", + "lines": [ + "分层设色按固定高程档位套固定色阶(深绿→浅绿→绿→浅黄→黄→浅褐→褐→白)。", + "山峰用 ▲ 加高程数字标注;河流用蓝色线沿谷底绘制;陡崖用红色锯齿线表示。", + "指北针在图幅右上,比例尺在左下,分层设色图例在右下,地形剖面图在底部。" + ] + } + ] + }, + "en": { + "title": "How to use · Contour Lines & Five Landforms", + "sections": [ + { + "h": "Getting started (follow along)", + "lines": [ + "Step 1: press Start to watch the four-step animation — contour cutting, line formation, vertical projection and slope reading.", + "Step 2: drag with the mouse to rotate the 3D terrain, scroll to zoom; it is fully interactive.", + "Step 3: click a landform tab above the canvas (peak / ridge / valley / saddle / cliff) to load its dedicated terrain with its full contour pattern.", + "Step 4: toggle Top view / 3D view at the bottom; hover anywhere to read elevation and terrain feature.", + "Step 5: use Colour / No colour to compare hypsometric tint with pure contour lines; use Fullscreen for presentation." + ] + }, + { + "h": "Keyboard shortcuts", + "lines": [ + "Space: play / pause the experiment.", + "Numbers 1 – 5: switch to peak, ridge, valley, saddle, cliff." + ] + }, + { + "h": "The four experiment steps", + "lines": [ + "Contour cutting: a horizontal plane descends from the summit and intersects the mountain at one elevation.", + "Forming lines: each slice leaves a closed intersection line; stacked lines describe the relief.", + "Projection: intersection lines are projected vertically onto one plane, building the contour map.", + "Slope density: slope shading over contours — dense lines mean steep, sparse lines mean gentle." + ] + }, + { + "h": "Reading the five landforms", + "lines": [ + "Peak: closed contours, values decrease outward (if they decrease inward it is a depression).", + "Ridge: contours bulge toward lower ground; a watershed line.", + "Valley: contours bulge toward higher ground; a drainage line, often a stream.", + "Saddle: low ground between two peaks, pinched like a saddle in plan view.", + "Cliff: contours crowd or overlap, nearly vertical; n overlapping lines: (n−1)d ≤ ΔH < (n+1)d." + ] + }, + { + "h": "Contour basics", + "lines": [ + "All points on one contour share the same elevation; the gap between neighbours is the contour interval (100 m here).", + "Closer contours mean steeper slopes; wider spacing means gentler slopes.", + "Every 5th contour is bolded as an index contour and labelled with elevation.", + "Elevation is height above sea level; relative height is the difference between two elevations." + ] + }, + { + "h": "Map symbols", + "lines": [ + "Hypsometric tint uses fixed colour bands (dark green → light green → green → pale yellow → yellow → light brown → brown → white).", + "Peaks are marked with ▲ plus elevation; rivers are blue lines along valleys; cliffs use a red saw-tooth line.", + "North arrow top-right, scale bar bottom-left, tint legend bottom-right, terrain profile along the bottom." + ] + } + ] + } +} diff --git a/Java/model/contour-map/contour-map.model/i18n/en.json b/Java/model/contour-map/contour-map.model/i18n/en.json new file mode 100644 index 0000000..c0ed82b --- /dev/null +++ b/Java/model/contour-map/contour-map.model/i18n/en.json @@ -0,0 +1,4 @@ +{ + "app.title": "Contour Lines · Five Classic Landforms", + "app.subtitle": "Grade 7 · From 3D relief to contour maps: peaks, ridges, valleys, saddles and cliffs" +} diff --git a/Java/model/contour-map/contour-map.model/i18n/zh-CN.json b/Java/model/contour-map/contour-map.model/i18n/zh-CN.json new file mode 100644 index 0000000..8f9bcb7 --- /dev/null +++ b/Java/model/contour-map/contour-map.model/i18n/zh-CN.json @@ -0,0 +1,4 @@ +{ + "app.title": "等高线地形 · 五大典型地貌判读", + "app.subtitle": "七年级上册 · 从立体地形到平面等高线,判读山峰/山脊/山谷/鞍部/陡崖" +} diff --git a/Java/model/contour-map/contour-map.model/preview.png b/Java/model/contour-map/contour-map.model/preview.png new file mode 100644 index 0000000..669d090 Binary files /dev/null and b/Java/model/contour-map/contour-map.model/preview.png differ diff --git a/Java/model/earth-geography/earth-geography.json b/Java/model/earth-geography/earth-geography.json new file mode 100644 index 0000000..9d3147e --- /dev/null +++ b/Java/model/earth-geography/earth-geography.json @@ -0,0 +1,30 @@ +{ + "id": "earth-geography", + "nameI18n": { + "zh-CN": "地球地理", + "en": "Earth Geography" + }, + "descriptionI18n": { + "zh-CN": "五带划分、七大洲四大洋轮廓、六大板块与洲界,纯线稿教学图。", + "en": "Climate zones, continent/ocean outlines, plates and borders — clean line art." + }, + "assembly": "EarthGeographyModel.dll", + "type": "GC.EarthModels.GeographyModelFactory", + "author": "Morris GC", + "tags": [ + "geography", + "earth", + "atlas" + ], + "dataDir": "earth-geography.model", + "version": "1.9", + "chrome": { + "titleBar": "#0C1828", + "titleBorder": "#1B2740", + "titleText": "#EAF2FF", + "button": "#9FB4D4", + "frame": "#0A1524" + }, + "build": "cc68b8863b", + "updatedAt": "2026-11-21T10:55:36Z" +} diff --git a/Java/model/earth-geography/earth-geography.model/borders.json b/Java/model/earth-geography/earth-geography.model/borders.json new file mode 100644 index 0000000..ce9ae14 --- /dev/null +++ b/Java/model/earth-geography/earth-geography.model/borders.json @@ -0,0 +1 @@ +{"borders":[{"between":"亚洲-非洲","name":"苏伊士运河","lines":[[[32.6,31.3],[32.4,30.5],[32.3,29.9]]]},{"between":"亚洲-欧洲","name":"亚欧分界(乌拉尔山—乌拉尔河—里海—大高加索山—黑海—土耳其海峡)","segments":[{"name":"乌拉尔山","nameI18n":{"zh-CN":"乌拉尔山","en":"Ural Mts."},"lines":[[[66.0,68.5],[64.0,64.0],[60.5,60.0],[58.5,54.0],[57.0,51.0]]]},{"name":"乌拉尔河","nameI18n":{"zh-CN":"乌拉尔河","en":"Ural River"},"lines":[[[57.0,51.0],[55.5,49.0],[53.0,47.0],[51.5,46.5]]]},{"name":"里海","nameI18n":{"zh-CN":"里海","en":"Caspian Sea"},"lines":[[[51.5,46.5],[50.5,44.0],[49.5,41.0],[50.0,38.0],[51.0,36.5]]]},{"name":"大高加索山","nameI18n":{"zh-CN":"大高加索山","en":"Greater Caucasus"},"lines":[[[51.0,36.5],[46.0,42.5],[43.0,42.8],[41.0,43.2]]]},{"name":"黑海","nameI18n":{"zh-CN":"黑海","en":"Black Sea"},"lines":[[[41.0,43.2],[36.0,44.5],[31.0,44.0],[29.0,41.5]]]},{"name":"土耳其海峡","nameI18n":{"zh-CN":"土耳其海峡","en":"Turkish Straits"},"lines":[[[29.0,41.5],[28.0,40.5],[26.5,40.0],[26.2,39.5]]]}],"lines":[[[66.0,68.5],[64.0,64.0],[60.5,60.0],[58.5,54.0],[57.0,51.0],[57.0,51.0],[55.5,49.0],[53.0,47.0],[51.5,46.5],[51.5,46.5],[50.5,44.0],[49.5,41.0],[50.0,38.0],[51.0,36.5],[51.0,36.5],[46.0,42.5],[43.0,42.8],[41.0,43.2],[41.0,43.2],[36.0,44.5],[31.0,44.0],[29.0,41.5],[29.0,41.5],[28.0,40.5],[26.5,40.0],[26.2,39.5]]]},{"between":"欧洲-非洲","name":"直布罗陀海峡","lines":[[[-5.6,36.0],[-4.0,36.2],[0.0,36.5]]]},{"between":"北美-南美","name":"巴拿马运河","lines":[[[-79.6,9.1],[-78.5,8.9],[-77.5,8.6]]]},{"between":"南美-南极","name":"德雷克海峡","nameI18n":{"zh-CN":"德雷克海峡","en":"Drake Passage"},"lines":[[[-68.0,-56.0],[-66.5,-57.5],[-65.0,-59.0],[-63.5,-60.5],[-62.0,-62.0]]]},{"between":"亚洲-北美","name":"白令海峡","lines":[[[-169.0,65.5],[-170.5,65.8],[-172.0,66.0]]]},{"between":"亚洲-大洋洲","name":"印尼群岛","lines":[[[120.0,-1.0],[125.0,-2.0],[130.0,-3.0]]]},{"between":"南极洲","name":"南极圈","lines":[[[-180.0,-66.5],[-170.0,-66.5],[-160.0,-66.5],[-150.0,-66.5],[-140.0,-66.5],[-130.0,-66.5],[-120.0,-66.5],[-110.0,-66.5],[-100.0,-66.5],[-90.0,-66.5],[-80.0,-66.5],[-70.0,-66.5],[-60.0,-66.5],[-50.0,-66.5],[-40.0,-66.5],[-30.0,-66.5],[-20.0,-66.5],[-10.0,-66.5],[0.0,-66.5],[10.0,-66.5],[20.0,-66.5],[30.0,-66.5],[40.0,-66.5],[50.0,-66.5],[60.0,-66.5],[70.0,-66.5],[80.0,-66.5],[90.0,-66.5],[100.0,-66.5],[110.0,-66.5],[120.0,-66.5],[130.0,-66.5],[140.0,-66.5],[150.0,-66.5],[160.0,-66.5],[170.0,-66.5],[180.0,-66.5]]]}]} \ No newline at end of file diff --git a/Java/model/earth-geography/earth-geography.model/coastline.json b/Java/model/earth-geography/earth-geography.model/coastline.json new file mode 100644 index 0000000..cb53534 --- /dev/null +++ b/Java/model/earth-geography/earth-geography.model/coastline.json @@ -0,0 +1 @@ +{"lines":[[[180.0,-16.17],[179.56,-16.64],[179.93,-16.52],[179.93,-16.74],[179.2,-16.71],[178.71,-16.98],[178.5,-16.79],[178.58,-16.62],[180.0,-16.17]],[[143.18,-11.95],[143.11,-12.3],[143.4,-12.64],[143.76,-14.35],[143.96,-14.46],[144.47,-14.23],[145.29,-14.94],[145.43,-16.41],[145.91,-16.91],[146.13,-17.64],[146.03,-18.27],[146.33,-18.55],[146.38,-18.98],[147.42,-19.38],[147.74,-19.77],[148.76,-20.29],[148.88,-20.48],[148.68,-20.58],[149.45,-21.58],[149.7,-22.44],[149.97,-22.55],[150.02,-22.17],[150.54,-22.56],[150.62,-22.37],[150.84,-23.46],[151.83,-24.12],[153.16,-25.96],[153.12,-27.19],[153.62,-28.67],[153.03,-30.56],[152.94,-31.43],[152.47,-32.44],[151.81,-32.9],[151.29,-33.58],[150.81,-35.01],[150.19,-35.83],[149.93,-37.53],[149.48,-37.77],[147.88,-37.93],[146.86,-38.66],[146.22,-38.73],[146.47,-38.84],[146.4,-39.15],[145.4,-38.53],[145.48,-38.24],[144.96,-38.5],[144.72,-38.34],[145.12,-38.09],[144.89,-37.9],[144.4,-38.14],[144.66,-38.21],[143.54,-38.82],[142.46,-38.39],[141.42,-38.36],[140.39,-37.9],[139.78,-37.25],[139.73,-36.37],[138.97,-35.58],[139.29,-35.61],[139.28,-35.38],[138.18,-35.61],[138.51,-35.02],[138.09,-34.17],[137.69,-35.14],[136.88,-35.24],[137.01,-34.92],[137.39,-34.91],[137.49,-34.16],[137.93,-33.58],[137.85,-33.2],[137.99,-33.09],[137.78,-32.58],[137.79,-32.82],[137.24,-33.63],[136.43,-34.03],[135.89,-34.66],[135.97,-34.98],[135.65,-34.94],[135.12,-34.59],[135.45,-34.58],[135.22,-33.96],[134.72,-33.26],[134.3,-33.16],[134.1,-32.75],[134.23,-32.55],[133.66,-32.21],[132.76,-31.96],[132.22,-32.01],[131.14,-31.5],[128.95,-31.7],[127.32,-32.26],[125.92,-32.3],[124.24,-33.02],[123.51,-33.92],[122.15,-33.99],[121.41,-33.83],[119.85,-33.98],[119.45,-34.37],[117.86,-35.05],[116.52,-34.99],[115.01,-34.26],[114.99,-33.52],[115.36,-33.64],[115.68,-33.19],[115.7,-31.7],[115.08,-30.56],[114.86,-29.14],[114.17,-28.08],[114.03,-27.35],[113.19,-26.18],[113.32,-26.24],[113.36,-26.08],[113.58,-26.56],[113.84,-26.5],[113.45,-25.6],[113.71,-25.83],[113.72,-26.13],[113.85,-26.01],[113.99,-26.32],[114.22,-26.29],[114.21,-25.85],[113.42,-24.44],[113.76,-23.42],[113.68,-22.64],[114.02,-21.88],[114.14,-22.48],[114.71,-21.82],[116.71,-20.65],[117.41,-20.72],[119.1,-20.0],[119.59,-20.04],[121.0,-19.6],[121.83,-18.48],[122.34,-18.11],[122.15,-17.55],[122.26,-17.14],[122.97,-16.44],[123.56,-17.52],[123.59,-17.03],[123.83,-17.12],[123.87,-16.92],[123.49,-16.49],[123.61,-16.22],[124.77,-16.4],[124.41,-16.3],[124.65,-15.87],[124.5,-15.97],[124.38,-15.76],[124.44,-15.49],[124.69,-15.27],[125.06,-15.44],[124.84,-15.16],[125.04,-15.0],[125.36,-15.12],[125.18,-14.71],[125.58,-14.48],[125.63,-14.26],[125.66,-14.53],[126.02,-14.49],[126.05,-13.98],[126.57,-14.16],[126.9,-13.74],[127.46,-14.03],[128.2,-14.75],[128.07,-15.33],[128.58,-14.78],[129.06,-14.88],[129.22,-15.16],[129.27,-14.87],[129.63,-15.14],[129.64,-14.85],[129.85,-14.83],[129.38,-14.39],[129.84,-13.57],[130.26,-13.3],[130.17,-12.96],[130.62,-12.65],[130.62,-12.43],[130.87,-12.56],[131.29,-12.07],[131.44,-12.28],[132.41,-12.29],[132.71,-12.12],[132.67,-11.65],[131.82,-11.3],[131.96,-11.18],[135.03,-12.19],[135.92,-11.83],[135.7,-12.21],[136.01,-12.19],[136.08,-12.42],[136.26,-12.43],[136.27,-12.13],[136.54,-11.96],[136.95,-12.35],[136.54,-12.78],[136.46,-13.22],[135.93,-13.3],[135.95,-13.94],[135.45,-14.92],[138.25,-16.72],[139.01,-16.9],[139.25,-17.33],[140.04,-17.7],[140.51,-17.62],[140.83,-17.41],[141.41,-16.07],[141.62,-15.06],[141.47,-13.8],[141.61,-12.94],[141.93,-12.74],[141.69,-12.35],[141.96,-12.05],[142.17,-10.95],[142.6,-10.75],[142.87,-11.82],[143.18,-11.95]],[[178.28,-17.37],[178.59,-17.65],[178.67,-18.08],[177.96,-18.26],[177.32,-18.08],[177.26,-17.86],[177.5,-17.54],[178.28,-17.37]],[[164.2,-20.25],[165.19,-20.77],[166.94,-22.09],[166.97,-22.32],[166.47,-22.26],[164.93,-21.29],[164.38,-20.74],[164.04,-20.17],[164.2,-20.25]],[[127.73,0.85],[127.88,0.83],[128.22,1.4],[128.69,1.57],[128.7,1.11],[128.26,0.73],[128.9,0.22],[127.98,0.47],[127.89,0.3],[127.98,-0.25],[128.43,-0.89],[127.69,-0.24],[127.61,0.85],[127.43,1.14],[127.63,1.84],[128.04,2.2],[127.89,1.83],[128.01,1.33],[127.65,1.01],[127.73,0.85]],[[69.19,-49.11],[69.59,-48.97],[69.64,-49.12],[69.41,-49.18],[69.54,-49.26],[70.32,-49.06],[70.56,-49.2],[70.39,-49.43],[69.76,-49.43],[70.31,-49.58],[70.12,-49.7],[69.15,-49.53],[68.81,-49.7],[68.77,-49.07],[69.0,-48.66],[69.19,-49.11]],[[63.37,80.7],[62.52,80.82],[64.1,81.0],[64.31,81.17],[65.17,81.14],[65.44,80.93],[63.37,80.7]],[[-25.43,70.92],[-25.4,70.65],[-26.22,70.45],[-28.04,70.49],[-27.62,70.91],[-25.82,71.04],[-25.43,70.92]],[[117.31,8.44],[117.35,8.71],[119.22,10.48],[119.55,11.31],[119.69,10.5],[118.78,9.92],[118.44,9.26],[117.31,8.44]],[[122.5,11.62],[122.89,11.44],[123.16,11.54],[123.12,11.29],[122.77,10.82],[121.95,10.44],[122.1,11.64],[121.92,11.85],[122.5,11.62]],[[123.13,9.06],[122.4,9.82],[122.86,10.09],[122.98,10.89],[123.26,10.99],[123.57,10.78],[123.16,9.86],[123.32,9.27],[123.13,9.06]],[[124.58,11.34],[124.93,11.37],[125.03,11.21],[125.01,10.79],[125.27,10.31],[125.14,10.19],[124.99,10.37],[125.03,10.03],[124.78,10.17],[124.79,10.78],[124.45,10.92],[124.33,11.54],[124.58,11.34]],[[125.24,12.53],[125.54,12.19],[125.49,11.59],[125.74,11.05],[125.03,11.34],[125.0,11.77],[124.45,12.15],[124.3,12.57],[125.24,12.53]],[[120.7,13.48],[121.2,13.43],[121.52,13.13],[121.54,12.64],[121.24,12.22],[120.34,13.41],[120.7,13.48]],[[155.96,-6.69],[155.72,-6.86],[155.34,-6.72],[155.2,-6.31],[154.76,-5.93],[154.73,-5.44],[155.09,-5.62],[155.96,-6.69]],[[152.97,-4.76],[152.74,-4.64],[152.67,-4.13],[152.28,-3.58],[150.75,-2.74],[150.82,-2.57],[152.03,-3.25],[153.02,-4.11],[153.13,-4.35],[152.97,-4.76]],[[138.53,-8.27],[137.65,-8.39],[138.08,-7.57],[138.77,-7.39],[138.99,-7.7],[138.53,-8.27]],[[129.75,-2.87],[130.57,-3.13],[130.86,-3.57],[130.81,-3.86],[129.84,-3.33],[129.47,-3.45],[128.93,-3.23],[128.52,-3.45],[128.13,-3.16],[127.9,-3.5],[127.88,-3.22],[128.2,-2.87],[129.75,-2.87]],[[126.86,-3.09],[127.23,-3.39],[127.23,-3.63],[126.69,-3.82],[126.06,-3.42],[126.09,-3.1],[126.86,-3.09]],[[122.78,-8.61],[121.03,-8.94],[119.91,-8.86],[119.81,-8.7],[119.88,-8.42],[120.61,-8.24],[121.44,-8.58],[121.97,-8.46],[122.32,-8.63],[122.92,-8.11],[123.01,-8.33],[122.78,-8.61]],[[120.01,-9.38],[120.8,-10.11],[120.44,-10.29],[119.6,-9.77],[119.08,-9.71],[118.96,-9.52],[119.3,-9.37],[120.01,-9.38]],[[118.24,-8.32],[118.93,-8.3],[119.13,-8.67],[118.75,-8.73],[118.83,-8.83],[118.48,-8.86],[118.38,-8.68],[117.06,-9.1],[116.79,-9.01],[116.83,-8.53],[117.17,-8.37],[117.97,-8.73],[118.23,-8.59],[117.75,-8.15],[118.12,-8.12],[118.24,-8.32]],[[115.45,-8.15],[115.7,-8.41],[115.14,-8.85],[115.06,-8.57],[114.47,-8.17],[115.45,-8.15]],[[106.05,-1.67],[106.37,-2.46],[106.82,-2.57],[106.67,-3.07],[106.0,-2.83],[105.79,-2.18],[105.13,-2.04],[105.46,-1.57],[105.7,-1.73],[105.91,-1.5],[106.05,-1.67]],[[22.62,58.62],[23.32,58.45],[22.37,58.22],[22.0,57.93],[22.19,58.15],[21.88,58.26],[21.86,58.5],[22.62,58.62]],[[21.61,78.6],[22.04,78.58],[22.3,78.23],[23.45,78.15],[23.12,77.99],[24.9,77.76],[22.8,77.28],[22.43,77.32],[22.68,77.55],[21.05,77.44],[20.87,77.56],[21.65,77.92],[20.23,78.48],[21.61,78.6]],[[62.17,80.83],[62.08,80.62],[61.05,80.42],[59.29,80.57],[59.72,80.84],[62.17,80.83]],[[47.44,80.85],[48.45,80.81],[48.68,80.63],[47.7,80.77],[46.14,80.45],[44.91,80.61],[47.44,80.85]],[[50.28,80.93],[51.7,80.69],[48.81,80.35],[48.68,80.3],[48.98,80.16],[47.74,80.08],[47.98,80.21],[46.64,80.3],[49.09,80.52],[49.24,80.82],[50.28,80.93]],[[50.27,69.19],[48.91,68.74],[48.44,68.81],[48.28,69.04],[48.41,69.35],[48.95,69.51],[50.27,69.19]],[[60.45,69.94],[60.44,69.73],[59.73,69.71],[58.95,69.89],[58.47,70.27],[59.05,70.46],[60.45,69.94]],[[92.68,79.69],[91.07,79.98],[93.8,79.91],[92.68,79.69]],[[23.85,35.53],[24.17,35.59],[24.35,35.36],[25.73,35.35],[25.79,35.12],[26.32,35.31],[26.17,35.02],[24.8,34.93],[24.46,35.16],[23.59,35.26],[23.57,35.53],[23.74,35.66],[23.85,35.53]],[[23.41,38.96],[24.13,38.65],[24.28,38.22],[24.58,38.02],[22.87,38.87],[23.41,38.96]],[[34.46,35.59],[33.94,35.29],[34.05,34.99],[33.01,34.57],[32.45,34.73],[32.32,34.95],[32.3,35.08],[32.88,35.18],[32.94,35.39],[33.61,35.35],[34.46,35.59]],[[19.08,57.84],[18.81,57.71],[18.91,57.4],[18.15,56.92],[18.29,57.08],[18.14,57.56],[18.54,57.83],[19.08,57.84]],[[12.57,55.78],[12.21,55.47],[12.41,55.29],[12.09,55.19],[12.05,54.81],[11.86,54.77],[11.65,55.19],[11.29,55.2],[10.98,55.72],[11.63,55.96],[11.82,55.7],[11.87,55.97],[12.22,56.12],[12.58,56.06],[12.57,55.78]],[[-120.56,-73.76],[-120.27,-73.99],[-120.99,-74.16],[-121.0,-74.33],[-122.29,-74.4],[-122.94,-74.3],[-122.62,-73.97],[-123.35,-73.84],[-123.01,-73.67],[-120.56,-73.76]],[[-126.33,-73.29],[-125.26,-73.67],[-125.8,-73.8],[-124.54,-73.74],[-124.04,-73.88],[-124.15,-73.94],[-123.8,-74.08],[-123.84,-74.23],[-125.09,-74.18],[-126.58,-73.67],[-127.21,-73.72],[-127.43,-73.45],[-127.27,-73.3],[-126.33,-73.29]],[[-66.17,-80.08],[-67.81,-79.55],[-66.01,-79.62],[-65.5,-79.95],[-66.17,-80.08]],[[-73.71,-70.64],[-73.55,-70.72],[-74.81,-71.01],[-76.27,-71.13],[-76.51,-70.99],[-74.95,-70.59],[-74.59,-70.79],[-74.4,-70.58],[-73.71,-70.64]],[[-98.09,-71.91],[-98.17,-72.12],[-97.58,-71.88],[-97.58,-72.09],[-97.34,-72.19],[-96.87,-71.85],[-96.12,-71.9],[-96.98,-72.22],[-95.69,-72.06],[-95.58,-72.41],[-96.08,-72.45],[-96.05,-72.58],[-98.16,-72.56],[-102.31,-72.08],[-100.22,-71.83],[-99.78,-72.04],[-98.61,-71.76],[-98.09,-71.91]],[[-74.35,-73.1],[-74.67,-73.28],[-74.37,-73.46],[-74.58,-73.61],[-76.1,-73.15],[-75.28,-73.05],[-75.73,-72.88],[-75.38,-72.82],[-74.34,-72.92],[-74.35,-73.1]],[[-67.99,-67.47],[-68.82,-67.75],[-69.14,-67.52],[-68.34,-66.8],[-67.71,-66.63],[-67.97,-67.03],[-67.69,-67.15],[-68.23,-67.37],[-67.99,-67.47]],[[-178.88,71.58],[-177.5,71.22],[-179.16,70.94],[-180,70.99],[-180,71.54],[-178.88,71.58]],[[-58.85,-51.27],[-58.43,-51.32],[-58.51,-51.48],[-58.27,-51.58],[-58.26,-51.42],[-57.98,-51.38],[-57.79,-51.64],[-58.68,-51.94],[-58.65,-52.1],[-59.2,-52.02],[-59.07,-52.17],[-59.53,-52.24],[-59.57,-51.92],[-59.06,-51.69],[-59.1,-51.49],[-58.85,-51.27]],[[-37.1,-54.07],[-36.33,-54.25],[-35.8,-54.76],[-36.09,-54.87],[-36.89,-54.34],[-38.02,-54.01],[-37.1,-54.07]],[[-73.77,-43.35],[-74.39,-43.23],[-74.04,-41.8],[-73.53,-41.9],[-73.42,-42.19],[-73.47,-42.47],[-73.79,-42.59],[-73.44,-42.94],[-73.77,-43.35]],[[-60.29,-51.46],[-59.27,-51.43],[-59.92,-51.97],[-60.69,-52.19],[-60.96,-52.06],[-60.24,-51.77],[-60.58,-51.71],[-60.24,-51.64],[-60.57,-51.36],[-60.29,-51.46]],[[-74.48,-49.15],[-74.59,-50.01],[-74.76,-50.01],[-74.88,-49.73],[-74.72,-49.42],[-75.07,-49.85],[-75.55,-49.79],[-75.31,-49.49],[-75.47,-49.36],[-75.09,-49.27],[-75.21,-49.15],[-74.9,-48.73],[-74.55,-48.77],[-74.48,-49.15]],[[-61.8,49.09],[-63.04,49.23],[-64.48,49.89],[-63.09,49.77],[-61.82,49.28],[-61.8,49.09]],[[-61.1,45.95],[-60.87,45.98],[-61.06,45.7],[-60.74,45.75],[-60.46,45.97],[-60.73,45.96],[-60.3,46.31],[-59.87,46.16],[-59.83,45.97],[-60.67,45.59],[-61.45,45.72],[-61.41,46.17],[-60.49,47.01],[-60.33,46.77],[-60.49,46.27],[-61.1,45.95]],[[-171.46,63.64],[-170.43,63.7],[-169.56,63.37],[-168.72,63.31],[-169.68,62.96],[-170.53,63.38],[-171.79,63.42],[-171.75,63.7],[-171.46,63.64]],[[-166.13,60.38],[-165.73,60.31],[-165.59,59.91],[-166.15,59.76],[-167.44,60.21],[-166.13,60.38]],[[-163.48,54.98],[-163.08,54.67],[-164.07,54.62],[-164.59,54.4],[-164.9,54.55],[-164.48,54.91],[-163.48,54.98]],[[-77.26,18.46],[-76.35,18.15],[-76.21,17.91],[-76.85,17.97],[-77.2,17.71],[-77.77,17.88],[-78.34,18.29],[-78.22,18.45],[-77.26,18.46]],[[-66.13,18.45],[-65.63,18.38],[-65.97,17.97],[-67.2,17.99],[-67.16,18.5],[-66.13,18.45]],[[-152.9,57.82],[-152.43,57.83],[-152.48,57.7],[-152.22,57.58],[-152.94,57.5],[-152.68,57.34],[-153.73,57.05],[-153.64,56.96],[-153.97,56.77],[-153.79,56.99],[-154.24,57.14],[-154.34,56.92],[-154.71,57.34],[-154.12,57.65],[-153.69,57.3],[-153.84,57.86],[-153.49,57.73],[-153.16,57.97],[-152.9,57.82]],[[-133.57,56.34],[-133.2,56.32],[-132.17,55.48],[-132.63,55.47],[-131.98,55.21],[-132.02,54.73],[-133.12,55.33],[-132.96,55.4],[-133.03,55.59],[-133.68,55.78],[-133.24,55.92],[-133.74,55.97],[-133.57,56.34]],[[-134.97,57.35],[-134.62,56.72],[-134.68,56.22],[-134.98,56.52],[-134.88,56.68],[-135.33,56.82],[-135.2,57.03],[-135.46,57.25],[-135.81,57.01],[-135.82,57.28],[-135.45,57.53],[-134.97,57.35]],[[-134.68,58.16],[-134.24,58.14],[-133.82,57.63],[-134.31,58.03],[-133.91,57.35],[-134.44,57.06],[-134.61,57.14],[-134.49,57.48],[-134.92,58.35],[-134.68,58.16]],[[-135.73,58.24],[-135.61,57.99],[-135.35,58.12],[-134.96,58.02],[-134.97,57.82],[-135.34,57.77],[-134.98,57.72],[-134.93,57.48],[-135.56,57.67],[-135.69,57.42],[-135.91,57.45],[-136.57,57.97],[-136.32,58.22],[-136.14,58.1],[-135.73,58.24]],[[-132.66,54.13],[-132.17,53.95],[-132.46,53.65],[-132.19,53.69],[-132.13,54.03],[-131.67,54.14],[-132.01,53.27],[-132.75,53.31],[-132.43,53.34],[-132.84,53.51],[-133.1,54.01],[-133.05,54.16],[-132.66,54.13]],[[-131.75,53.2],[-131.63,52.92],[-131.97,52.88],[-131.46,52.7],[-131.59,52.58],[-131.14,52.29],[-131.22,52.15],[-132.16,52.78],[-132.14,53.0],[-132.55,53.14],[-131.75,53.2]],[[-63.81,46.47],[-62.02,46.42],[-62.53,46.2],[-62.48,46.0],[-63.02,46.07],[-62.98,46.32],[-63.57,46.21],[-64.4,46.69],[-63.99,47.06],[-64.09,46.77],[-63.81,46.47]],[[-72.51,40.99],[-71.9,41.06],[-73.19,40.65],[-74.03,40.64],[-73.57,40.92],[-72.27,41.15],[-72.51,40.99]],[[151.92,-4.3],[152.41,-4.34],[152.35,-4.82],[151.98,-5.07],[152.08,-5.46],[151.51,-5.55],[151.23,-5.92],[150.47,-6.26],[149.65,-6.29],[148.34,-5.67],[148.43,-5.47],[149.83,-5.52],[150.09,-5.01],[150.18,-5.52],[150.9,-5.45],[151.33,-4.96],[151.67,-4.88],[151.59,-4.2],[151.92,-4.3]],[[127.3,-8.43],[125.41,-9.28],[124.43,-10.15],[123.61,-10.27],[123.71,-9.62],[125.18,-8.65],[126.97,-8.32],[127.3,-8.43]],[[145.04,-40.79],[146.32,-41.16],[148.22,-40.85],[148.34,-42.22],[148.21,-41.97],[148.02,-42.26],[147.98,-43.16],[147.79,-43.22],[147.65,-43.02],[147.8,-42.93],[147.57,-42.85],[147.45,-43.03],[147.3,-42.79],[147.25,-43.22],[147.0,-43.16],[146.87,-43.61],[146.04,-43.55],[145.99,-43.38],[146.21,-43.32],[145.87,-43.29],[145.49,-42.93],[145.2,-42.23],[145.47,-42.49],[145.52,-42.35],[145.24,-42.2],[144.77,-41.39],[144.72,-40.67],[145.04,-40.79]],[[96.53,81.08],[97.83,80.8],[97.11,80.61],[97.42,80.32],[97.17,80.24],[93.87,80.01],[91.52,80.36],[92.83,80.62],[93.26,80.79],[92.61,80.81],[93.36,81.03],[95.8,81.28],[96.53,81.08]],[[97.67,80.16],[98.02,80.02],[97.65,79.76],[98.6,80.05],[100.06,79.78],[99.68,79.32],[99.04,79.29],[99.81,79.1],[99.93,78.96],[99.44,78.83],[94.79,79.09],[94.22,79.4],[93.07,79.5],[94.99,80.1],[97.67,80.16]],[[102.89,79.25],[102.41,78.83],[103.8,79.15],[105.15,78.82],[105.31,78.5],[99.84,77.96],[99.29,78.04],[100.02,78.34],[100.42,78.75],[100.96,78.79],[100.86,78.9],[101.05,79.12],[101.59,79.35],[102.25,79.26],[102.18,79.37],[102.41,79.43],[102.89,79.25]],[[140.05,75.83],[140.82,75.63],[140.99,75.97],[141.49,76.14],[145.36,75.53],[144.02,75.05],[142.82,75.27],[142.7,75.45],[142.94,75.71],[142.31,75.69],[142.09,75.66],[142.2,75.39],[143.13,74.97],[142.47,74.82],[141.99,74.99],[140.27,74.85],[139.68,74.96],[139.1,74.66],[137.22,75.12],[136.95,75.33],[137.29,75.35],[137.27,75.75],[137.71,75.76],[137.56,75.95],[138.92,76.2],[140.05,75.83]],[[142.19,73.9],[143.34,73.57],[143.49,73.25],[139.69,73.43],[140.38,73.48],[141.09,73.87],[142.19,73.9]],[[146.79,75.37],[148.43,75.41],[148.59,75.24],[150.82,75.16],[150.58,74.92],[149.05,74.77],[146.15,75.2],[146.44,75.56],[146.79,75.37]],[[173.27,-34.94],[173.45,-34.84],[174.14,-35.3],[174.32,-35.25],[174.58,-35.79],[174.4,-35.8],[174.8,-36.31],[174.72,-36.84],[175.54,-37.2],[175.46,-36.48],[175.77,-36.73],[176.11,-37.65],[177.27,-37.99],[178.01,-37.55],[178.54,-37.69],[178.27,-38.55],[177.98,-38.72],[177.91,-39.24],[177.52,-39.07],[177.08,-39.22],[176.94,-39.55],[177.11,-39.67],[176.84,-40.16],[175.98,-41.21],[175.31,-41.61],[175.17,-41.42],[174.88,-41.42],[174.87,-41.22],[174.63,-41.29],[175.16,-40.62],[175.16,-40.12],[173.76,-39.32],[174.6,-38.78],[174.93,-37.8],[174.59,-37.1],[174.73,-37.22],[174.93,-37.09],[174.48,-36.94],[174.19,-36.49],[174.43,-36.56],[174.39,-36.24],[173.91,-35.91],[174.06,-36.36],[173.41,-35.54],[173.63,-35.32],[173.38,-35.5],[173.12,-35.2],[173.19,-35.02],[172.71,-34.45],[173.04,-34.43],[173.27,-34.94]],[[173.12,-41.28],[173.95,-40.92],[173.8,-41.27],[174.0,-40.99],[174.3,-41.02],[174.04,-41.24],[174.37,-41.1],[174.07,-41.43],[174.08,-41.67],[174.28,-41.74],[173.22,-42.98],[172.62,-43.27],[172.74,-43.35],[172.53,-43.47],[173.07,-43.68],[173.09,-43.84],[172.48,-43.73],[172.3,-43.87],[172.04,-43.7],[172.18,-43.9],[171.24,-44.26],[171.15,-44.91],[171.0,-44.91],[171.11,-45.04],[170.7,-45.68],[170.78,-45.87],[170.34,-45.99],[169.69,-46.55],[169.1,-46.63],[168.38,-46.6],[168.19,-46.36],[167.54,-46.15],[166.83,-46.23],[166.71,-46.13],[166.92,-45.96],[166.49,-45.96],[166.51,-45.81],[167.0,-45.71],[166.8,-45.65],[166.99,-45.53],[166.73,-45.54],[166.87,-45.31],[167.16,-45.41],[167.03,-45.12],[167.91,-44.66],[167.86,-44.5],[168.37,-44.08],[169.18,-43.91],[170.3,-43.11],[170.74,-43.03],[170.97,-42.72],[171.04,-42.86],[171.49,-41.8],[171.95,-41.54],[172.27,-40.76],[172.94,-40.52],[172.7,-40.67],[172.99,-40.85],[173.12,-41.28]],[[126.01,9.32],[126.31,8.95],[126.14,8.6],[126.46,8.2],[126.58,7.25],[126.19,6.85],[126.19,6.31],[125.82,7.33],[125.69,7.26],[125.38,6.69],[125.67,5.98],[125.35,5.6],[125.23,6.07],[124.93,5.88],[124.08,6.4],[123.98,6.99],[124.21,7.4],[123.67,7.82],[123.49,7.81],[123.39,7.41],[123.1,7.7],[122.84,7.53],[122.62,7.76],[122.14,6.95],[121.96,6.97],[122.24,7.95],[122.91,8.16],[123.44,8.7],[123.85,8.43],[123.8,8.05],[124.2,8.23],[124.41,8.6],[124.73,8.56],[124.87,8.97],[125.14,8.87],[125.21,9.03],[125.5,9.02],[125.47,9.76],[126.01,9.32]],[[121.1,18.61],[121.85,18.3],[122.27,18.46],[122.15,17.66],[122.52,17.12],[122.14,16.18],[121.59,15.93],[121.39,15.32],[121.77,14.17],[122.21,13.93],[122.2,14.15],[122.63,14.32],[122.93,14.19],[123.1,13.75],[123.32,14.06],[123.82,13.84],[123.55,13.65],[123.78,13.11],[124.14,13.04],[124.06,12.57],[123.88,12.69],[123.95,12.92],[123.31,13.04],[123.16,13.44],[122.59,13.91],[122.47,13.89],[122.6,13.19],[121.78,13.94],[121.34,13.65],[120.84,13.88],[120.64,13.8],[120.62,14.19],[120.94,14.64],[120.58,14.88],[120.59,14.48],[120.44,14.45],[120.08,14.85],[119.77,16.25],[120.37,16.11],[120.36,17.64],[120.6,18.51],[121.1,18.61]],[[133.47,-0.73],[134.11,-0.85],[134.19,-2.31],[134.46,-2.83],[134.63,-2.54],[134.7,-2.93],[135.09,-3.35],[135.49,-3.35],[136.39,-2.27],[137.07,-2.1],[137.12,-1.84],[137.91,-1.48],[139.79,-2.35],[140.62,-2.45],[144.48,-3.83],[145.77,-4.82],[145.75,-5.4],[147.42,-5.97],[147.8,-6.32],[147.81,-6.7],[147.12,-6.72],[146.96,-6.93],[147.26,-7.46],[148.13,-8.1],[148.58,-9.05],[149.2,-9.03],[149.26,-9.5],[150.01,-9.69],[149.76,-9.81],[149.87,-10.01],[150.85,-10.24],[150.45,-10.31],[150.65,-10.52],[150.32,-10.65],[149.75,-10.35],[147.77,-10.07],[147.02,-9.39],[146.96,-9.06],[146.63,-8.95],[146.03,-8.08],[144.51,-7.57],[144.14,-7.76],[143.66,-7.46],[143.94,-7.94],[143.52,-8.0],[143.61,-8.2],[142.52,-8.32],[142.21,-8.2],[143.11,-8.47],[143.38,-8.76],[143.37,-8.96],[142.65,-9.33],[142.23,-9.17],[141.13,-9.22],[140.0,-8.2],[140.12,-7.92],[139.39,-8.19],[139.25,-7.98],[138.93,-8.26],[139.09,-7.59],[138.75,-7.25],[139.18,-7.19],[138.6,-6.94],[138.87,-6.86],[138.44,-6.34],[138.38,-5.84],[138.2,-5.81],[138.34,-5.68],[138.09,-5.71],[138.06,-5.46],[137.28,-4.95],[135.2,-4.45],[134.68,-4.08],[134.89,-3.94],[133.97,-3.82],[133.68,-3.48],[133.84,-3.06],[133.52,-3.41],[133.4,-3.9],[132.97,-4.09],[132.75,-3.29],[132.05,-2.92],[131.97,-2.79],[132.72,-2.79],[133.19,-2.44],[133.7,-2.62],[133.92,-2.1],[132.31,-2.24],[132.02,-1.99],[131.93,-1.56],[131.0,-1.43],[131.26,-0.85],[132.39,-0.35],[133.47,-0.73]],[[124.89,0.99],[124.43,0.47],[123.75,0.31],[123.0,0.49],[120.58,0.53],[120.19,0.27],[120.06,-0.56],[120.67,-1.37],[121.15,-1.34],[121.58,-0.83],[121.97,-0.93],[123.17,-0.57],[123.43,-0.78],[123.38,-1.0],[122.9,-0.9],[122.25,-1.55],[121.36,-1.88],[122.29,-2.91],[122.4,-3.2],[122.25,-3.62],[122.85,-4.07],[122.87,-4.39],[122.11,-4.54],[122.04,-4.83],[121.59,-4.76],[121.62,-4.09],[120.89,-3.52],[121.05,-2.75],[120.65,-2.67],[120.26,-2.95],[120.44,-3.71],[120.28,-5.15],[120.43,-5.59],[119.56,-5.61],[119.36,-5.31],[119.62,-4.03],[119.42,-3.48],[118.92,-3.48],[118.78,-2.72],[119.09,-2.48],[119.32,-1.93],[119.51,-0.91],[119.71,-0.68],[119.84,-0.86],[119.72,-0.09],[120.27,0.97],[120.6,0.85],[121.08,1.33],[122.84,0.85],[123.93,0.85],[125.11,1.69],[125.23,1.5],[124.89,0.99]],[[107.37,-6.01],[108.33,-6.29],[108.68,-6.79],[110.43,-6.95],[110.83,-6.42],[111.18,-6.69],[112.54,-6.93],[112.8,-7.55],[113.01,-7.66],[114.07,-7.63],[114.41,-7.79],[114.39,-8.4],[114.58,-8.77],[113.25,-8.29],[111.51,-8.3],[109.28,-7.71],[108.45,-7.8],[106.45,-7.37],[106.52,-7.05],[105.25,-6.83],[105.79,-6.46],[106.08,-5.91],[106.83,-6.1],[107.05,-5.9],[107.37,-6.01]],[[96.49,5.23],[97.55,5.21],[98.25,4.42],[98.31,4.09],[99.73,3.18],[100.52,2.19],[100.89,1.95],[100.83,2.24],[101.05,2.26],[101.48,1.69],[102.02,1.44],[102.39,0.84],[103.03,0.58],[102.55,0.22],[103.34,0.51],[103.67,0.29],[103.79,0.05],[103.43,-0.19],[103.44,-0.58],[103.72,-0.89],[104.36,-1.04],[104.52,-1.82],[104.84,-2.09],[104.65,-2.6],[104.97,-2.37],[105.4,-2.38],[106.04,-3.11],[105.84,-3.61],[105.75,-5.82],[105.35,-5.55],[105.08,-5.75],[104.64,-5.52],[104.6,-5.91],[101.58,-3.17],[100.89,-2.25],[100.29,-0.8],[99.67,0.04],[99.16,0.35],[98.59,1.86],[97.7,2.36],[97.59,2.85],[96.97,3.58],[96.44,3.82],[95.58,4.66],[95.21,5.28],[95.23,5.57],[95.63,5.61],[96.49,5.23]],[[116.81,6.69],[117.23,6.94],[117.69,6.35],[117.5,5.88],[118.0,6.05],[118.12,5.86],[117.97,5.71],[118.35,5.81],[119.26,5.37],[119.13,5.1],[118.26,4.99],[118.19,4.83],[118.55,4.38],[117.7,4.34],[117.5,4.13],[117.78,3.69],[117.06,3.62],[118.07,2.32],[117.79,2.03],[118.98,0.98],[118.53,0.81],[117.91,1.1],[117.96,0.89],[117.52,0.24],[117.56,-0.77],[116.91,-1.22],[116.74,-1.04],[116.75,-1.33],[116.28,-1.78],[116.42,-1.78],[116.31,-2.14],[116.55,-2.41],[116.32,-2.55],[116.26,-3.13],[115.96,-3.6],[114.69,-4.17],[114.53,-3.38],[114.34,-3.44],[114.34,-3.23],[113.7,-3.46],[113.61,-3.2],[113.34,-3.25],[113.03,-2.93],[112.76,-3.32],[111.86,-3.55],[111.69,-2.89],[110.93,-3.07],[110.9,-2.91],[110.26,-2.97],[109.98,-1.27],[109.68,-0.94],[109.29,-0.85],[109.37,-0.64],[109.13,-0.45],[109.26,0.03],[108.94,0.36],[108.91,0.79],[109.08,1.5],[109.63,2.03],[109.86,1.76],[111.22,1.4],[111.03,1.56],[111.21,2.38],[111.44,2.38],[111.51,2.74],[112.99,3.16],[113.92,4.24],[114.01,4.58],[115.0,5.02],[115.43,4.97],[115.58,5.19],[115.42,5.41],[115.88,5.61],[116.78,6.99],[116.81,6.69]],[[67.77,76.24],[61.36,75.31],[60.28,75.01],[60.5,74.91],[59.67,74.61],[59.24,74.69],[59.04,74.49],[58.53,74.5],[58.62,74.23],[57.77,74.01],[57.76,73.77],[57.31,73.84],[57.54,73.66],[56.63,73.3],[54.3,73.35],[53.76,73.77],[54.64,73.96],[55.34,74.42],[56.14,74.5],[55.58,74.63],[56.5,74.96],[55.81,75.12],[56.57,75.1],[56.84,75.35],[57.61,75.34],[58.06,75.66],[60.94,76.07],[61.2,76.28],[64.46,76.38],[67.53,77.01],[68.49,76.93],[68.94,76.71],[67.77,76.24]],[[55.32,73.31],[56.43,73.2],[56.12,72.81],[55.4,72.55],[55.52,72.22],[55.3,71.94],[56.45,71.11],[57.62,70.73],[57.15,70.59],[56.26,70.72],[56.44,70.56],[53.72,70.81],[53.38,70.87],[53.61,70.92],[53.59,71.05],[54.16,71.12],[53.41,71.34],[53.41,71.53],[51.94,71.47],[51.44,71.78],[51.58,72.07],[52.62,72.3],[52.92,72.67],[52.55,72.77],[53.37,72.92],[53.25,73.18],[55.32,73.31]],[[142.76,54.39],[143.32,52.96],[143.19,51.94],[143.82,50.28],[144.71,48.64],[144.05,49.25],[143.1,49.2],[142.56,47.74],[143.22,46.8],[143.49,46.75],[143.58,46.36],[143.43,46.03],[143.28,46.56],[142.58,46.7],[142.08,45.92],[141.83,46.45],[142.18,48.01],[141.87,48.75],[142.14,49.57],[142.21,51.22],[141.72,51.74],[141.66,52.27],[141.82,53.34],[142.53,53.45],[142.71,53.9],[142.34,54.28],[142.76,54.39]],[[143.82,44.12],[144.72,43.93],[145.37,44.33],[145.14,43.66],[145.34,43.3],[145.83,43.39],[144.92,43.0],[143.97,42.88],[143.43,42.42],[143.24,42.0],[141.85,42.58],[140.99,42.34],[140.48,42.56],[140.33,42.29],[141.15,41.8],[140.66,41.82],[140.38,41.52],[140.04,41.47],[140.11,41.91],[139.84,42.28],[139.86,42.58],[140.43,42.95],[140.39,43.3],[141.37,43.28],[141.76,44.48],[141.67,45.4],[141.94,45.51],[143.82,44.12]],[[141.23,41.37],[141.46,41.41],[141.43,40.72],[141.8,40.29],[141.98,39.43],[141.47,38.4],[140.96,38.15],[141.0,37.12],[140.57,36.23],[140.87,35.73],[140.46,35.51],[140.35,35.18],[139.84,34.91],[139.83,35.3],[140.1,35.59],[139.84,35.66],[139.68,35.15],[139.25,35.28],[138.84,34.62],[138.9,35.02],[138.72,35.12],[138.19,34.6],[137.06,34.58],[137.28,34.77],[136.87,34.73],[136.8,35.05],[136.53,34.68],[136.85,34.32],[136.33,34.18],[135.69,33.49],[135.13,34.01],[135.1,34.29],[135.42,34.62],[134.74,34.77],[133.14,34.3],[132.31,34.33],[132.15,33.84],[131.74,34.05],[130.92,33.98],[131.0,34.39],[131.35,34.41],[132.92,35.51],[135.17,35.75],[135.33,35.53],[135.9,35.61],[136.09,35.77],[136.07,36.12],[136.7,36.74],[136.84,37.38],[137.32,37.52],[136.9,37.12],[137.25,36.75],[138.32,37.22],[139.36,38.1],[139.8,38.88],[140.06,39.62],[140.0,39.85],[139.74,39.92],[140.01,40.26],[139.97,40.67],[140.28,40.85],[140.39,41.23],[140.63,41.2],[140.75,40.83],[141.12,40.88],[141.24,41.21],[140.8,41.25],[140.94,41.51],[141.23,41.37]],[[134.36,34.26],[134.64,34.23],[134.74,33.82],[134.18,33.25],[133.63,33.51],[133.29,33.36],[132.8,32.75],[132.5,32.92],[132.41,33.43],[132.03,33.34],[132.64,33.69],[132.94,34.09],[133.19,33.93],[133.95,34.35],[134.36,34.26]],[[131.18,33.6],[131.7,33.6],[131.54,33.27],[131.9,33.26],[132.01,32.92],[131.66,32.47],[131.34,31.41],[131.07,31.44],[131.1,31.26],[130.69,31.02],[130.78,31.71],[130.56,31.56],[130.59,31.18],[130.15,31.41],[130.32,31.6],[130.19,32.09],[130.64,32.62],[130.55,32.83],[130.24,33.18],[130.18,32.85],[130.34,32.7],[130.05,32.77],[129.77,32.57],[129.68,33.06],[129.99,32.85],[129.58,33.24],[130.72,33.93],[131.18,33.6]],[[121.01,22.62],[120.74,21.96],[120.08,23.09],[120.13,23.65],[121.04,25.03],[121.59,25.27],[121.93,24.97],[121.4,23.17],[121.01,22.62]],[[110.89,19.99],[111.01,19.66],[110.64,19.29],[110.45,18.75],[110.02,18.42],[109.52,18.22],[108.7,18.54],[108.67,19.3],[109.26,19.88],[110.59,19.98],[110.65,20.14],[110.89,19.99]],[[79.98,9.81],[80.25,9.8],[80.71,9.37],[81.37,8.43],[81.87,7.29],[81.64,6.42],[80.72,5.98],[80.09,6.15],[79.86,6.83],[79.71,8.18],[80.09,9.58],[80.43,9.48],[79.98,9.81]],[[49.54,-12.43],[49.94,-13.07],[50.44,-15.15],[50.41,-15.63],[50.19,-15.96],[49.89,-15.46],[49.66,-15.52],[49.84,-16.49],[49.45,-17.24],[49.36,-18.34],[47.18,-24.79],[46.73,-25.15],[45.12,-25.54],[44.03,-25.0],[43.67,-24.3],[43.7,-23.42],[43.27,-22.38],[43.5,-21.36],[43.8,-21.18],[44.41,-19.92],[44.45,-19.43],[44.04,-18.29],[43.98,-17.39],[44.42,-16.7],[44.48,-16.22],[46.16,-15.74],[46.4,-15.93],[46.48,-15.51],[46.94,-15.22],[47.1,-15.43],[47.35,-14.77],[47.47,-14.71],[47.48,-15.01],[47.77,-14.64],[47.96,-14.67],[47.77,-14.37],[48.0,-13.96],[47.94,-13.66],[48.26,-13.72],[48.8,-13.27],[48.92,-12.84],[48.79,-12.47],[49.21,-12.08],[49.54,-12.43]],[[-159.05,-79.81],[-161.87,-79.7],[-164.28,-79.25],[-164.13,-79.0],[-163.26,-78.72],[-162.39,-78.76],[-159.68,-79.4],[-159.05,-79.81]],[[-70.33,-79.68],[-71.53,-79.62],[-71.78,-79.44],[-71.45,-79.13],[-67.48,-78.36],[-66.73,-78.38],[-69.25,-79.21],[-69.73,-79.62],[-70.33,-79.68]],[[-45.22,-78.81],[-43.63,-78.85],[-42.97,-79.48],[-42.99,-79.8],[-43.76,-80.02],[-43.53,-80.19],[-49.77,-80.78],[-54.35,-80.76],[-54.35,-80.57],[-53.39,-80.11],[-52.3,-80.14],[-50.4,-79.51],[-50.38,-79.34],[-50.73,-79.28],[-50.24,-78.83],[-50.38,-78.78],[-50.22,-78.61],[-49.08,-78.05],[-46.26,-77.81],[-44.59,-78.03],[-43.78,-78.34],[-43.95,-78.6],[-45.07,-78.66],[-45.22,-78.81]],[[-59.73,-80.34],[-59.83,-80.73],[-60.58,-80.95],[-62.67,-80.83],[-63.14,-80.59],[-64.27,-80.75],[-66.77,-80.29],[-61.63,-80.34],[-61.19,-80.26],[-61.6,-80.21],[-61.68,-80.02],[-60.58,-79.74],[-59.71,-79.88],[-59.79,-80.1],[-59.32,-80.2],[-59.73,-80.34]],[[-70.05,-69.19],[-69.42,-69.58],[-68.31,-70.91],[-68.24,-71.82],[-69.21,-72.53],[-72.37,-72.67],[-73.06,-72.45],[-72.74,-72.28],[-70.87,-72.37],[-70.21,-72.23],[-71.66,-72.25],[-71.9,-72.12],[-70.82,-71.91],[-72.34,-71.63],[-72.93,-71.92],[-73.78,-71.85],[-73.54,-72.02],[-74.0,-72.17],[-75.38,-71.83],[-75.1,-71.56],[-74.39,-71.64],[-74.42,-71.46],[-74.24,-71.39],[-73.48,-71.58],[-73.6,-71.35],[-72.21,-71.33],[-73.06,-71.13],[-72.71,-71.07],[-71.72,-71.14],[-70.38,-70.95],[-69.87,-71.13],[-69.88,-70.88],[-71.19,-70.66],[-70.33,-70.36],[-69.62,-70.4],[-70.33,-70.16],[-71.73,-70.05],[-71.88,-69.91],[-71.74,-69.42],[-72.14,-69.11],[-71.87,-68.94],[-70.42,-68.79],[-70.05,-69.19]],[[-69.17,-52.67],[-68.57,-52.7],[-68.24,-53.08],[-68.43,-53.05],[-68.49,-53.26],[-68.16,-53.31],[-67.29,-54.05],[-66.24,-54.53],[-65.18,-54.68],[-65.47,-54.91],[-66.51,-55.03],[-71.9,-54.6],[-71.8,-54.43],[-70.8,-54.33],[-70.31,-54.53],[-70.86,-54.11],[-70.87,-53.88],[-70.53,-53.63],[-70.38,-53.99],[-70.63,-54.01],[-70.24,-54.35],[-69.74,-54.31],[-69.31,-54.57],[-69.05,-54.43],[-69.99,-54.11],[-70.15,-53.89],[-69.39,-53.37],[-70.21,-53.41],[-70.46,-53.21],[-70.13,-52.94],[-70.38,-52.75],[-69.94,-52.82],[-69.5,-52.49],[-69.17,-52.67]],[[-81.84,23.16],[-79.82,22.89],[-79.28,22.41],[-78.69,22.37],[-77.64,21.8],[-77.5,21.87],[-77.14,21.64],[-77.37,21.61],[-77.25,21.48],[-77.1,21.59],[-76.87,21.33],[-75.72,21.11],[-75.6,21.0],[-75.72,20.71],[-74.88,20.65],[-74.15,20.17],[-75.12,19.9],[-77.72,19.86],[-77.1,20.41],[-77.23,20.64],[-78.12,20.76],[-78.49,21.05],[-78.73,21.59],[-79.36,21.59],[-80.48,22.12],[-81.04,22.07],[-81.19,22.27],[-81.28,22.11],[-81.85,22.21],[-82.08,22.39],[-81.71,22.5],[-81.84,22.67],[-82.74,22.69],[-83.38,22.22],[-83.9,22.17],[-84.03,21.94],[-84.89,21.86],[-84.33,22.07],[-84.36,22.38],[-84.05,22.67],[-83.26,22.97],[-81.84,23.16]],[[20.9,80.25],[22.29,80.05],[22.45,80.4],[23.01,80.47],[23.32,80.42],[23.11,80.19],[24.4,80.36],[26.86,80.16],[27.2,79.91],[25.64,79.4],[22.9,79.23],[22.7,79.33],[22.87,79.41],[20.86,79.4],[19.68,79.59],[20.78,79.75],[18.73,79.76],[18.25,79.93],[18.86,80.04],[17.92,80.14],[19.34,80.12],[19.54,80.16],[19.18,80.33],[19.75,80.23],[19.73,80.48],[20.9,80.25]],[[16.79,79.91],[17.84,79.8],[17.96,79.7],[17.67,79.39],[18.4,79.61],[18.82,79.43],[18.68,79.26],[20.61,79.11],[20.77,79.06],[20.5,78.98],[21.39,78.74],[19.68,78.61],[19.15,78.38],[19.0,78.08],[18.44,78.03],[18.23,77.52],[17.62,77.4],[17.15,77.05],[17.06,76.66],[16.7,76.58],[14.37,77.23],[14.0,77.51],[16.91,77.9],[14.09,77.77],[13.68,78.03],[17.17,78.42],[16.45,78.5],[16.78,78.66],[15.42,78.47],[15.25,78.59],[15.38,78.77],[14.69,78.72],[14.43,78.49],[14.64,78.42],[13.15,78.24],[11.37,78.95],[12.4,78.95],[11.98,79.03],[11.98,79.29],[11.21,79.13],[10.68,79.76],[13.69,79.86],[13.92,79.76],[12.55,79.57],[13.33,79.58],[13.96,79.34],[14.04,79.59],[14.59,79.8],[16.34,78.98],[15.83,79.71],[16.25,80.05],[16.79,79.91]],[[9.63,40.88],[9.8,40.5],[9.56,39.17],[9.06,39.24],[8.97,38.96],[8.65,38.93],[8.42,39.21],[8.55,39.84],[8.22,40.91],[8.57,40.85],[9.23,41.26],[9.63,40.88]],[[9.48,42.8],[9.55,42.13],[9.19,41.38],[8.81,41.59],[8.57,42.36],[9.31,42.71],[9.36,43.02],[9.48,42.8]],[[15.58,38.22],[15.1,37.46],[15.3,37.05],[15.11,36.69],[14.5,36.8],[12.44,37.82],[12.73,38.18],[13.79,37.98],[15.58,38.22]],[[-52.73,69.94],[-52.05,69.81],[-51.9,69.61],[-53.75,69.26],[-54.18,69.4],[-53.66,69.47],[-53.83,69.54],[-54.92,69.71],[-54.79,69.95],[-54.32,69.94],[-54.83,70.13],[-54.37,70.32],[-53.3,70.2],[-52.73,69.94]],[[-127.2,50.64],[-125.48,50.32],[-124.83,49.53],[-124.0,49.22],[-123.28,48.45],[-123.57,48.32],[-125.02,48.71],[-125.14,48.82],[-124.81,49.21],[-124.93,49.01],[-125.54,48.95],[-125.83,49.09],[-125.64,49.19],[-125.95,49.25],[-125.94,49.4],[-126.55,49.42],[-126.54,49.59],[-126.13,49.67],[-127.11,49.88],[-127.25,50.14],[-127.86,50.13],[-127.91,50.45],[-127.49,50.41],[-127.47,50.58],[-128.06,50.5],[-128.35,50.7],[-128.24,50.83],[-127.2,50.64]],[[-71.95,19.72],[-70.95,19.91],[-69.96,19.67],[-69.74,19.3],[-69.23,19.27],[-69.62,19.12],[-68.69,18.91],[-68.36,18.54],[-68.69,18.21],[-69.28,18.44],[-71.03,18.27],[-71.44,17.64],[-72.06,18.23],[-73.52,18.25],[-73.89,18.04],[-74.46,18.39],[-74.39,18.62],[-72.79,18.43],[-72.38,18.57],[-72.81,19.07],[-72.7,19.44],[-73.44,19.72],[-73.31,19.86],[-71.95,19.72]],[[-49.63,-0.23],[-48.39,-0.3],[-48.83,-1.39],[-49.17,-1.41],[-49.23,-1.6],[-49.51,-1.51],[-49.8,-1.79],[-50.51,-1.79],[-50.76,-1.24],[-50.58,-1.1],[-50.8,-0.91],[-50.65,-0.27],[-50.25,-0.12],[-49.63,-0.23]],[[-3.11,58.52],[-3.99,57.96],[-3.86,57.82],[-4.13,57.58],[-2.07,57.7],[-1.78,57.47],[-2.59,56.56],[-3.31,56.36],[-2.67,56.25],[-3.36,56.03],[-3.79,56.09],[-2.6,56.03],[-1.66,55.57],[-1.23,54.7],[-0.08,54.12],[-0.21,54.02],[0.12,53.61],[-0.66,53.72],[0.27,53.34],[0.36,53.16],[0.05,52.91],[1.06,52.96],[1.66,52.75],[1.59,52.12],[0.75,51.73],[0.89,51.57],[0.42,51.47],[1.42,51.36],[1.4,51.18],[0.2,50.76],[-1.42,50.9],[-2.04,50.6],[-3.0,50.72],[-3.4,50.63],[-3.68,50.24],[-4.2,50.39],[-5.12,50.04],[-5.62,50.05],[-4.19,51.19],[-3.14,51.2],[-2.43,51.74],[-3.29,51.39],[-4.39,51.74],[-5.17,51.74],[-5.18,51.95],[-4.22,52.28],[-3.98,52.54],[-4.1,52.91],[-4.68,52.81],[-4.27,53.15],[-3.1,53.26],[-3.06,53.43],[-2.75,53.31],[-3.06,53.51],[-2.85,54.13],[-3.17,54.13],[-3.59,54.56],[-3.04,54.95],[-5.03,54.76],[-5.17,54.99],[-4.68,55.5],[-4.87,55.87],[-4.58,55.94],[-4.8,56.16],[-5.23,55.89],[-5.08,56.2],[-5.41,55.99],[-5.56,55.39],[-5.73,55.33],[-5.5,55.8],[-5.61,56.05],[-5.19,56.76],[-5.65,56.53],[-6.13,56.71],[-5.73,56.85],[-5.86,56.9],[-5.56,57.23],[-5.79,57.38],[-5.58,57.55],[-5.75,57.67],[-5.61,57.88],[-5.16,57.88],[-5.41,58.07],[-5.34,58.24],[-5.01,58.26],[-5.02,58.57],[-3.05,58.63],[-3.11,58.52]],[[-7.18,55.06],[-6.13,55.22],[-5.72,54.82],[-5.88,54.64],[-5.47,54.5],[-5.67,54.55],[-5.61,54.27],[-6.34,53.99],[-6.03,52.93],[-6.46,52.34],[-6.33,52.25],[-6.97,52.25],[-8.06,51.83],[-8.41,51.89],[-8.41,51.71],[-9.3,51.5],[-9.84,51.48],[-9.58,51.69],[-10.12,51.6],[-9.6,51.87],[-10.34,51.8],[-9.91,52.12],[-10.36,52.21],[-9.77,52.25],[-9.91,52.4],[-9.63,52.55],[-8.78,52.68],[-9.92,52.57],[-8.93,53.21],[-10.09,53.41],[-10.12,53.55],[-9.72,53.6],[-9.9,53.73],[-9.58,53.8],[-9.91,53.86],[-9.86,54.09],[-10.06,54.26],[-8.55,54.24],[-8.62,54.35],[-8.13,54.64],[-8.76,54.68],[-8.28,55.15],[-7.67,55.26],[-7.66,54.97],[-7.31,55.37],[-6.96,55.24],[-7.18,55.06]],[[-179.8,68.94],[-178.87,68.75],[-178.06,68.27],[-177.8,68.34],[-178.37,68.57],[-175.34,67.68],[-175.23,67.45],[-175.38,67.36],[-174.85,67.35],[-174.94,67.09],[-174.77,66.78],[-174.93,66.62],[-174.5,66.54],[-174.39,66.34],[-174.09,66.47],[-174.06,66.23],[-173.77,66.44],[-174.23,66.63],[-174.01,66.78],[-174.09,66.94],[-174.55,67.09],[-173.68,67.14],[-173.16,67.07],[-173.26,66.84],[-173.19,66.99],[-172.52,66.95],[-173.01,67.06],[-171.8,66.93],[-170.47,66.32],[-170.6,66.25],[-169.73,66.06],[-170.54,65.86],[-170.67,65.62],[-171.45,65.79],[-171.17,65.5],[-172.78,65.68],[-172.23,65.46],[-172.31,65.28],[-172.66,65.25],[-172.21,65.05],[-173.07,64.85],[-172.38,64.43],[-172.9,64.53],[-173.16,64.28],[-173.38,64.36],[-173.33,64.54],[-173.73,64.36],[-174.57,64.72],[-175.44,64.82],[-175.85,65.01],[-176.09,65.47],[-177.06,65.61],[-178.41,65.5],[-178.94,66.03],[-178.75,66.01],[-178.53,66.4],[-178.87,66.19],[-179.14,66.38],[-179.33,66.16],[-179.68,66.18],[-179.79,65.9],[-179.35,65.52],[-180,65.07],[-180.0,68.98],[-179.8,68.94]],[[-15.54,66.23],[-14.6,66.38],[-15.12,66.1],[-14.7,66.02],[-14.83,65.76],[-14.39,65.79],[-14.47,65.58],[-13.62,65.52],[-13.8,65.36],[-13.57,65.07],[-14.04,64.74],[-14.38,64.75],[-14.63,64.42],[-18.65,63.41],[-20.2,63.56],[-20.49,63.69],[-20.41,63.8],[-21.15,63.95],[-22.65,63.83],[-22.7,64.08],[-22.19,64.04],[-21.46,64.38],[-22.05,64.31],[-21.59,64.63],[-22.11,64.53],[-22.47,64.8],[-24.03,64.86],[-21.89,65.05],[-21.76,65.17],[-22.51,65.2],[-21.84,65.45],[-24.48,65.53],[-23.86,65.54],[-24.09,65.78],[-23.29,65.75],[-23.83,65.85],[-23.52,65.88],[-23.78,66.02],[-23.43,66.02],[-23.6,66.11],[-23.45,66.18],[-22.44,65.91],[-22.45,66.07],[-22.95,66.21],[-22.48,66.27],[-23.12,66.34],[-22.89,66.44],[-21.41,66.03],[-21.38,65.74],[-21.66,65.72],[-21.13,65.27],[-20.8,65.64],[-20.45,65.57],[-20.21,66.1],[-19.49,65.77],[-19.38,66.08],[-18.85,66.18],[-18.14,65.73],[-18.3,66.16],[-17.55,65.96],[-17.15,66.2],[-16.48,66.2],[-16.54,66.45],[-16.25,66.52],[-15.54,66.23]],[[167.08,-77.32],[169.35,-77.53],[166.73,-77.85],[166.22,-77.53],[166.63,-77.38],[166.51,-77.19],[167.08,-77.32]],[[-160.47,-81.59],[-163.95,-81.39],[-162.46,-81.31],[-160.47,-81.59]],[[-20.61,-73.89],[-20.49,-74.49],[-20.82,-74.45],[-21.17,-74.13],[-22.04,-74.11],[-21.13,-73.94],[-20.69,-73.62],[-20.52,-73.71],[-20.61,-73.89]],[[-74.39,-52.92],[-73.14,-53.35],[-74.39,-52.92]],[[-69.7,-54.92],[-68.46,-54.96],[-68.61,-55.16],[-68.28,-55.26],[-68.05,-55.64],[-68.87,-55.45],[-68.89,-55.24],[-69.19,-55.17],[-69.36,-55.3],[-69.18,-55.48],[-69.41,-55.44],[-69.98,-55.15],[-69.88,-54.88],[-69.7,-54.92]],[[159.88,-8.53],[158.94,-8.04],[158.46,-7.54],[159.43,-8.03],[159.88,-8.53]],[[-72.92,-53.48],[-72.2,-53.81],[-72.87,-54.13],[-72.76,-53.87],[-73.21,-53.99],[-73.31,-53.73],[-73.84,-53.55],[-72.92,-53.48]],[[-73.73,-44.4],[-74.0,-44.59],[-73.75,-45.27],[-74.1,-45.33],[-74.62,-44.65],[-74.1,-44.39],[-74.0,-44.14],[-73.73,-44.4]],[[160.75,-8.31],[161.37,-9.61],[160.77,-8.96],[160.59,-8.37],[160.75,-8.31]],[[123.37,9.45],[123.39,9.97],[124.04,11.27],[124.0,10.4],[123.37,9.45]],[[57.81,81.55],[58.56,81.42],[57.86,81.37],[58.02,81.25],[57.45,81.14],[55.47,81.31],[57.81,81.55]],[[54.72,81.12],[57.69,80.79],[55.88,80.63],[54.07,80.81],[54.72,81.12]],[[11.25,78.61],[12.12,78.23],[11.12,78.46],[10.56,78.9],[11.25,78.61]],[[148.6,45.32],[147.66,44.98],[146.9,44.4],[147.92,45.38],[148.32,45.28],[148.81,45.51],[148.84,45.36],[148.6,45.32]],[[146.21,44.5],[146.57,44.44],[145.91,44.1],[145.56,43.66],[145.44,43.74],[146.21,44.5]],[[92.72,11.54],[92.53,11.87],[92.79,12.23],[92.86,13.36],[93.06,13.54],[92.72,11.54]],[[-155.58,19.01],[-155.88,19.07],[-156.05,19.75],[-155.83,20.28],[-155.2,19.99],[-154.8,19.52],[-155.58,19.01]],[[-167.96,53.34],[-169.09,52.83],[-168.29,53.5],[-167.83,53.51],[-167.96,53.34]],[[-166.62,53.9],[-166.23,53.93],[-166.55,53.7],[-166.31,53.7],[-167.81,53.32],[-166.82,53.64],[-167.07,53.78],[-167.04,53.94],[-166.62,53.9]],[[-77.23,25.9],[-77.4,26.02],[-77.24,26.56],[-77.51,26.85],[-77.94,26.9],[-77.53,26.9],[-77.07,26.53],[-77.23,25.9]],[[-91.27,0.03],[-90.8,-0.75],[-91.13,-1.02],[-91.5,-0.86],[-91.12,-0.56],[-91.6,0.0],[-91.27,0.03]],[[-86.59,71.01],[-85.64,71.15],[-84.82,71.03],[-84.7,71.63],[-85.91,71.99],[-85.32,72.23],[-84.28,72.04],[-84.84,72.31],[-84.62,72.38],[-85.34,72.42],[-85.65,72.72],[-85.26,72.95],[-84.26,72.8],[-85.45,73.11],[-83.41,73.63],[-81.61,73.7],[-80.28,72.77],[-81.23,72.31],[-80.61,72.45],[-80.94,72.21],[-80.69,72.1],[-80.92,72.07],[-80.92,71.91],[-79.88,72.18],[-80.11,72.33],[-79.83,72.45],[-79.0,72.27],[-79.01,72.04],[-78.58,71.88],[-78.86,72.1],[-78.7,72.35],[-77.52,72.18],[-78.29,72.36],[-78.42,72.57],[-76.89,72.72],[-75.07,72.32],[-75.92,71.72],[-75.15,72.06],[-74.27,72.04],[-74.32,71.84],[-75.2,71.71],[-74.7,71.68],[-75.0,71.22],[-74.49,71.65],[-73.87,71.77],[-73.71,71.75],[-74.2,71.4],[-73.71,71.59],[-73.18,71.28],[-73.28,71.54],[-72.9,71.68],[-71.64,71.52],[-71.19,71.28],[-72.63,70.83],[-70.67,71.05],[-70.76,70.79],[-71.89,70.43],[-71.28,70.5],[-71.43,70.13],[-70.98,70.58],[-70.08,70.83],[-68.36,70.52],[-70.06,70.04],[-68.78,70.2],[-69.01,69.98],[-68.74,69.94],[-68.12,70.31],[-67.32,70.0],[-67.19,69.76],[-69.25,69.51],[-67.36,69.47],[-66.68,69.26],[-66.8,69.15],[-67.94,69.25],[-69.04,69.1],[-67.75,69.04],[-67.88,68.78],[-69.32,68.86],[-66.71,68.45],[-67.03,68.33],[-66.83,68.22],[-66.92,68.07],[-66.21,68.28],[-66.53,67.85],[-65.94,68.07],[-65.86,67.92],[-65.51,67.97],[-65.4,67.67],[-65.42,67.88],[-64.98,68.04],[-64.83,67.99],[-65.02,67.79],[-64.64,67.84],[-63.85,67.57],[-64.08,67.5],[-64.01,67.35],[-64.7,67.35],[-63.04,67.23],[-63.7,66.82],[-62.12,67.05],[-61.3,66.65],[-62.12,66.64],[-61.58,66.41],[-61.86,66.31],[-62.55,66.41],[-62.41,66.32],[-62.53,66.23],[-61.99,66.03],[-62.62,66.02],[-62.38,65.83],[-62.66,65.64],[-63.46,65.85],[-63.42,65.71],[-63.65,65.66],[-63.34,65.62],[-63.36,65.23],[-63.61,64.93],[-64.35,65.17],[-64.27,65.4],[-64.56,65.12],[-65.4,65.76],[-64.44,66.32],[-65.83,66.0],[-65.66,66.2],[-66.06,66.13],[-66.99,66.63],[-67.31,66.57],[-67.22,66.31],[-67.88,66.47],[-67.18,66.03],[-67.35,65.93],[-68.75,66.2],[-68.22,66.08],[-68.19,65.87],[-67.87,65.77],[-67.94,65.56],[-67.57,65.64],[-67.12,65.44],[-67.34,65.35],[-66.7,64.81],[-66.64,65.0],[-66.22,64.72],[-65.94,64.89],[-65.43,64.73],[-65.28,64.63],[-65.53,64.5],[-65.08,64.44],[-65.58,64.29],[-65.17,64.03],[-64.68,64.03],[-64.8,63.92],[-64.41,63.71],[-64.56,63.68],[-64.51,63.26],[-64.67,63.24],[-65.19,63.76],[-65.07,63.26],[-64.67,62.92],[-65.16,62.93],[-65.11,62.63],[-66.22,63.11],[-66.41,63.03],[-66.66,63.27],[-66.72,63.08],[-67.89,63.73],[-67.72,63.42],[-68.91,63.7],[-68.14,63.17],[-65.98,62.21],[-66.13,62.1],[-66.06,61.91],[-66.32,61.87],[-68.54,62.26],[-69.61,62.77],[-70.24,62.76],[-71.11,63.0],[-70.95,63.12],[-71.5,63.13],[-71.99,63.42],[-71.38,63.58],[-72.29,63.73],[-72.16,63.89],[-72.5,63.82],[-73.45,64.4],[-73.27,64.58],[-74.06,64.42],[-74.68,64.83],[-74.92,64.77],[-74.69,64.5],[-75.72,64.52],[-76.86,64.24],[-77.79,64.37],[-78.17,64.62],[-78.06,64.98],[-77.36,65.2],[-77.33,65.45],[-75.83,65.23],[-75.45,64.84],[-75.36,65.01],[-75.8,65.3],[-73.55,65.48],[-74.42,66.17],[-72.22,67.25],[-73.28,68.36],[-73.82,68.36],[-73.85,68.7],[-74.12,68.7],[-73.99,68.55],[-74.42,68.58],[-74.91,68.82],[-74.74,68.91],[-74.95,68.96],[-74.72,69.05],[-76.58,68.7],[-76.56,69.01],[-75.65,69.21],[-76.52,69.52],[-76.23,69.66],[-77.09,69.64],[-76.86,69.78],[-77.59,69.85],[-77.77,70.24],[-78.28,70.23],[-79.07,70.6],[-79.41,70.4],[-78.93,70.29],[-78.82,70.01],[-79.52,69.89],[-81.65,70.09],[-80.92,69.73],[-81.56,69.94],[-82.29,69.84],[-83.15,70.01],[-85.78,70.04],[-86.32,70.14],[-86.5,70.35],[-86.4,70.47],[-87.9,70.25],[-88.85,70.52],[-89.46,71.06],[-87.14,71.01],[-89.85,71.49],[-90.03,71.95],[-89.66,72.17],[-89.86,72.25],[-89.82,72.47],[-89.22,73.11],[-87.72,73.72],[-85.01,73.78],[-86.0,73.31],[-86.67,72.76],[-86.32,72.46],[-86.22,71.9],[-85.02,71.35],[-86.59,71.01]],[[-69.49,83.02],[-66.42,82.93],[-68.47,82.65],[-64.91,82.9],[-63.5,82.79],[-63.64,82.71],[-63.09,82.56],[-63.25,82.45],[-61.7,82.49],[-61.21,82.34],[-62.18,82.04],[-68.69,81.29],[-64.78,81.49],[-69.55,80.38],[-70.71,80.54],[-70.27,80.23],[-72.06,80.12],[-70.56,80.07],[-71.36,79.91],[-71.11,79.85],[-71.39,79.76],[-74.39,79.87],[-73.47,79.76],[-73.2,79.6],[-73.47,79.5],[-76.9,79.51],[-74.48,79.23],[-74.53,79.05],[-78.58,79.08],[-76.26,79.01],[-74.43,78.72],[-74.88,78.55],[-76.42,78.51],[-75.19,78.33],[-75.97,77.99],[-78.01,77.95],[-78.08,77.52],[-78.49,77.37],[-80.57,77.31],[-81.66,77.53],[-81.28,77.36],[-82.06,77.3],[-81.76,77.2],[-79.5,77.2],[-79.22,76.94],[-78.0,76.85],[-78.28,76.57],[-80.69,76.18],[-81.0,76.22],[-80.83,76.37],[-80.97,76.47],[-82.53,76.72],[-82.23,76.47],[-83.89,76.45],[-84.22,76.67],[-84.28,76.36],[-85.34,76.31],[-86.45,76.58],[-86.68,76.38],[-87.49,76.59],[-87.5,76.39],[-88.4,76.41],[-88.5,76.77],[-88.55,76.42],[-89.57,76.49],[-89.5,76.83],[-86.81,77.19],[-87.68,77.44],[-88.02,77.78],[-86.75,77.86],[-85.59,77.46],[-84.49,77.37],[-83.61,77.44],[-82.59,77.99],[-83.78,77.53],[-84.86,77.5],[-85.29,77.56],[-85.55,77.93],[-84.22,78.18],[-84.91,78.24],[-84.78,78.53],[-85.59,78.11],[-86.22,78.08],[-85.92,78.34],[-87.55,78.18],[-87.49,78.42],[-86.81,78.77],[-85.0,78.91],[-83.27,78.77],[-81.75,78.98],[-84.41,79.0],[-83.58,79.05],[-85.27,79.66],[-86.42,79.84],[-86.61,80.12],[-86.5,80.26],[-83.72,80.23],[-81.69,79.69],[-80.48,79.61],[-80.12,79.67],[-81.01,79.69],[-82.99,80.32],[-76.86,80.86],[-78.72,80.95],[-76.89,81.43],[-79.2,81.12],[-79.76,80.84],[-81.01,80.66],[-82.88,80.58],[-82.22,80.77],[-85.15,80.52],[-86.61,80.63],[-86.25,80.79],[-83.29,81.15],[-85.78,81.03],[-87.71,80.66],[-89.26,80.91],[-84.94,81.29],[-89.62,81.03],[-89.98,81.12],[-89.21,81.25],[-89.67,81.33],[-87.6,81.53],[-90.3,81.4],[-90.61,81.43],[-89.82,81.64],[-91.68,81.64],[-88.06,82.1],[-85.05,81.98],[-86.62,82.22],[-84.9,82.45],[-82.63,82.08],[-82.33,82.09],[-82.75,82.2],[-82.54,82.25],[-79.42,81.85],[-82.45,82.39],[-81.68,82.52],[-82.12,82.63],[-80.81,82.59],[-81.18,82.75],[-81.01,82.78],[-78.75,82.68],[-79.89,82.94],[-77.48,82.88],[-76.01,82.53],[-75.57,82.61],[-77.12,83.01],[-74.41,83.01],[-72.66,82.72],[-73.44,82.95],[-72.81,83.08],[-70.94,82.9],[-71.42,83.02],[-69.49,83.02]],[[-94.31,71.77],[-93.81,71.77],[-93.03,71.34],[-92.98,70.85],[-91.56,70.18],[-92.32,70.23],[-92.51,70.1],[-91.98,70.04],[-92.89,69.67],[-91.91,69.53],[-91.2,69.64],[-91.44,69.53],[-90.42,69.46],[-91.24,69.29],[-90.48,68.88],[-90.57,68.47],[-90.25,68.27],[-89.28,69.25],[-88.04,68.81],[-87.83,68.3],[-88.35,68.29],[-88.31,67.95],[-87.36,67.18],[-86.56,67.48],[-85.95,68.07],[-85.69,68.67],[-84.87,68.77],[-85.11,68.84],[-84.86,69.07],[-85.39,69.23],[-85.51,69.84],[-82.37,69.64],[-82.75,69.49],[-82.23,69.25],[-81.38,69.19],[-81.96,68.88],[-81.25,68.74],[-81.92,68.46],[-82.55,68.45],[-82.22,68.14],[-82.01,68.19],[-82.06,67.93],[-81.29,67.5],[-81.47,67.07],[-83.41,66.37],[-84.54,66.97],[-85.11,66.91],[-84.22,66.68],[-83.87,66.21],[-84.63,66.21],[-85.6,66.57],[-86.71,66.52],[-86.69,66.36],[-85.96,66.12],[-87.45,65.34],[-87.97,65.35],[-89.75,65.94],[-91.43,65.95],[-89.92,65.78],[-88.97,65.35],[-87.03,65.2],[-88.11,64.18],[-88.82,63.99],[-89.2,64.11],[-89.13,63.97],[-90.04,64.14],[-89.86,63.96],[-90.17,63.98],[-90.01,63.8],[-90.16,63.69],[-90.81,63.58],[-93.7,64.15],[-93.56,63.87],[-92.16,63.69],[-92.47,63.55],[-91.84,63.7],[-90.71,63.3],[-90.78,62.97],[-92.36,62.82],[-91.94,62.59],[-92.55,62.55],[-92.77,62.38],[-92.53,62.17],[-93.2,62.37],[-92.91,62.22],[-93.58,61.94],[-93.31,61.77],[-93.91,61.48],[-94.51,60.6],[-94.76,60.5],[-94.79,59.27],[-94.96,59.07],[-94.29,58.72],[-94.33,58.3],[-94.12,58.74],[-93.18,58.73],[-92.43,57.32],[-92.8,56.92],[-90.59,57.22],[-88.83,56.81],[-87.48,56.02],[-85.68,55.6],[-85.22,55.35],[-85.36,55.08],[-85.06,55.29],[-83.91,55.31],[-82.39,55.07],[-82.22,54.81],[-82.42,54.24],[-82.14,53.82],[-82.29,53.03],[-81.6,52.43],[-81.83,52.22],[-80.66,51.76],[-80.44,51.39],[-80.85,51.12],[-80.1,51.28],[-79.35,50.76],[-79.71,51.12],[-79.69,51.35],[-79.3,51.62],[-78.9,51.2],[-78.73,51.5],[-78.98,51.77],[-78.45,52.26],[-79.1,53.66],[-79.0,54.0],[-79.71,54.67],[-77.78,55.29],[-76.76,56.0],[-76.53,56.5],[-76.57,57.18],[-76.89,57.76],[-78.51,58.65],[-78.43,58.9],[-77.76,59.38],[-77.73,59.68],[-77.35,59.58],[-77.48,59.69],[-77.29,60.02],[-77.59,60.09],[-77.45,60.15],[-77.68,60.43],[-77.5,60.54],[-77.79,60.64],[-77.6,60.83],[-78.18,60.82],[-77.51,61.56],[-78.02,61.83],[-78.13,62.28],[-77.37,62.57],[-75.79,62.18],[-75.34,62.31],[-74.63,62.12],[-73.7,62.47],[-72.69,62.12],[-72.77,61.84],[-72.23,61.83],[-72.04,61.68],[-72.22,61.59],[-71.64,61.62],[-71.85,61.44],[-71.42,61.16],[-70.28,61.07],[-69.99,60.86],[-69.47,61.01],[-69.41,60.85],[-69.75,60.49],[-69.67,60.08],[-70.66,60.03],[-69.73,59.92],[-69.58,59.67],[-69.68,59.34],[-69.34,59.3],[-69.53,58.87],[-69.78,58.96],[-70.15,58.76],[-68.7,58.91],[-68.38,58.74],[-68.23,58.48],[-68.36,58.16],[-69.04,57.9],[-68.41,58.05],[-68.02,58.48],[-67.89,58.3],[-68.06,58.14],[-67.76,58.41],[-67.68,57.99],[-67.57,58.21],[-66.36,58.79],[-66.0,58.43],[-66.04,58.82],[-65.38,59.06],[-65.7,59.21],[-65.41,59.31],[-65.47,59.47],[-65.04,59.39],[-65.41,59.54],[-65.43,59.78],[-65.03,59.77],[-65.17,59.91],[-64.82,60.33],[-64.5,60.27],[-64.42,60.17],[-64.77,60.01],[-64.28,60.06],[-64.23,59.74],[-64.06,59.82],[-63.75,59.51],[-63.95,59.38],[-63.41,59.19],[-63.97,59.05],[-63.25,59.07],[-63.28,58.87],[-62.87,58.67],[-63.54,58.33],[-62.59,58.47],[-63.26,58.02],[-62.49,58.15],[-61.96,57.91],[-61.97,57.61],[-62.5,57.49],[-61.92,57.42],[-61.98,57.25],[-61.33,57.01],[-61.37,56.68],[-62.5,56.8],[-61.74,56.53],[-61.94,56.42],[-61.42,56.36],[-61.71,56.23],[-61.37,56.22],[-61.3,56.05],[-61.45,56.0],[-60.34,55.78],[-60.19,55.48],[-60.62,55.06],[-59.76,55.31],[-59.44,55.18],[-59.84,54.81],[-59.26,55.2],[-58.78,54.84],[-57.96,54.88],[-57.4,54.59],[-58.63,54.05],[-60.4,53.65],[-60.1,53.49],[-60.33,53.27],[-57.93,54.1],[-58.31,54.2],[-57.42,54.16],[-57.13,53.79],[-57.52,53.61],[-57.33,53.47],[-56.52,53.77],[-55.97,53.47],[-55.8,52.64],[-56.33,52.55],[-55.75,52.48],[-56.01,52.39],[-55.67,52.19],[-56.98,51.46],[-58.51,51.3],[-60.08,50.26],[-61.73,50.1],[-62.72,50.3],[-66.5,50.21],[-66.94,49.99],[-67.37,49.35],[-68.28,49.2],[-69.67,48.2],[-71.02,48.46],[-69.78,48.1],[-69.99,47.74],[-71.27,46.8],[-72.2,46.56],[-72.98,46.21],[-73.48,45.74],[-74.31,45.53],[-73.97,45.34],[-74.71,45.0],[-73.56,45.42],[-73.16,46.01],[-72.11,46.55],[-70.52,47.03],[-68.82,48.37],[-66.6,49.13],[-65.52,49.27],[-64.57,49.1],[-64.22,48.87],[-64.51,48.84],[-64.25,48.69],[-64.35,48.42],[-65.26,48.02],[-65.93,48.19],[-66.7,48.02],[-65.85,47.91],[-65.61,47.67],[-65.0,47.85],[-64.7,47.73],[-65.32,47.1],[-64.83,47.06],[-64.91,46.89],[-64.54,46.24],[-63.92,46.17],[-64.06,46.02],[-62.75,45.65],[-61.96,45.87],[-61.35,45.57],[-61.28,45.44],[-61.46,45.37],[-61.03,45.29],[-63.6,44.68],[-63.61,44.48],[-64.0,44.65],[-64.29,44.55],[-64.28,44.33],[-65.48,43.52],[-66.13,43.81],[-66.19,44.14],[-65.87,44.57],[-66.09,44.51],[-64.45,45.34],[-64.14,45.02],[-64.09,45.22],[-63.37,45.37],[-64.87,45.35],[-64.31,45.84],[-64.63,45.95],[-64.78,45.64],[-65.88,45.22],[-66.11,45.32],[-66.03,45.42],[-66.44,45.1],[-67.12,45.17],[-66.99,44.83],[-68.06,44.38],[-68.45,44.51],[-68.53,44.26],[-68.81,44.34],[-68.76,44.57],[-69.23,43.99],[-70.18,43.77],[-70.83,42.83],[-70.61,42.62],[-71.05,42.33],[-70.74,42.23],[-70.43,41.76],[-70.0,41.83],[-70.11,42.08],[-69.95,41.68],[-70.66,41.53],[-70.7,41.72],[-71.17,41.49],[-71.15,41.75],[-71.39,41.8],[-71.52,41.38],[-72.92,41.28],[-73.99,40.75],[-73.97,41.25],[-73.93,40.91],[-74.26,40.53],[-73.97,40.4],[-74.08,39.79],[-74.06,39.99],[-74.92,38.94],[-74.9,39.15],[-75.52,39.49],[-75.42,39.79],[-75.07,39.98],[-75.46,39.78],[-75.57,39.48],[-75.04,38.43],[-75.93,37.15],[-75.66,37.95],[-75.85,37.97],[-75.86,38.36],[-76.27,38.44],[-76.26,38.6],[-76.02,38.62],[-76.34,38.71],[-76.17,38.85],[-76.33,38.91],[-76.14,39.08],[-76.24,39.19],[-75.87,39.51],[-76.57,39.27],[-76.39,38.37],[-76.67,38.54],[-76.34,38.09],[-77.23,38.41],[-77.03,38.89],[-77.31,38.4],[-76.26,37.89],[-76.49,37.68],[-77.11,38.17],[-76.31,37.57],[-76.26,37.36],[-76.45,37.27],[-76.76,37.51],[-76.28,37.05],[-77.25,37.33],[-76.67,37.17],[-76.49,36.9],[-76.0,36.91],[-75.53,35.82],[-75.95,36.66],[-75.82,36.11],[-76.15,36.28],[-76.56,36.02],[-76.73,36.23],[-76.73,35.96],[-76.07,35.97],[-76.08,35.69],[-75.85,35.96],[-75.76,35.84],[-76.17,35.35],[-77.04,35.53],[-76.51,35.27],[-76.78,34.99],[-77.07,35.16],[-76.97,35.02],[-76.46,34.99],[-76.44,34.84],[-77.3,34.6],[-77.41,34.73],[-77.38,34.53],[-77.93,33.94],[-77.95,34.17],[-78.01,33.91],[-78.84,33.72],[-79.19,33.24],[-79.23,33.41],[-79.28,33.13],[-79.94,32.67],[-80.63,32.51],[-80.47,32.42],[-80.58,32.29],[-80.8,32.45],[-80.69,32.22],[-81.11,31.88],[-81.44,31.2],[-81.52,30.8],[-81.25,29.79],[-80.52,28.49],[-80.46,27.9],[-80.84,28.76],[-80.05,26.81],[-80.13,25.83],[-80.48,25.23],[-81.11,25.14],[-81.14,25.31],[-80.94,25.26],[-81.36,25.83],[-81.72,25.98],[-81.96,26.49],[-81.83,26.69],[-82.04,26.55],[-82.01,26.96],[-82.29,26.87],[-82.72,27.5],[-82.4,27.84],[-82.64,27.98],[-82.66,27.72],[-82.84,27.85],[-82.65,28.89],[-84.04,30.1],[-85.32,29.68],[-85.68,30.12],[-85.6,30.29],[-85.76,30.17],[-86.45,30.4],[-86.12,30.41],[-86.26,30.49],[-87.2,30.34],[-87.0,30.57],[-87.28,30.34],[-88.01,30.23],[-87.79,30.29],[-88.01,30.69],[-88.14,30.37],[-88.91,30.41],[-89.59,30.17],[-90.13,30.37],[-90.33,30.28],[-90.41,30.14],[-90.17,30.03],[-89.74,30.17],[-89.81,30.01],[-89.63,29.9],[-89.4,30.05],[-89.35,29.82],[-89.72,29.62],[-89.02,29.2],[-89.16,29.02],[-89.38,28.98],[-89.44,29.19],[-90.16,29.54],[-90.14,29.14],[-90.5,29.3],[-90.75,29.13],[-91.29,29.29],[-91.15,29.32],[-91.25,29.56],[-91.89,29.84],[-92.26,29.56],[-93.18,29.78],[-93.83,29.73],[-93.84,29.98],[-93.89,29.69],[-94.76,29.38],[-94.53,29.55],[-94.78,29.55],[-94.74,29.75],[-95.02,29.7],[-94.89,29.37],[-95.85,28.64],[-96.23,28.49],[-96.01,28.63],[-96.64,28.71],[-96.42,28.46],[-97.16,28.14],[-97.07,27.99],[-97.43,27.84],[-97.29,27.67],[-97.44,27.33],[-97.77,27.46],[-97.48,27.24],[-97.44,26.49],[-97.14,26.03],[-97.67,24.39],[-97.86,22.62],[-97.76,22.11],[-97.31,21.56],[-97.41,21.27],[-97.38,21.57],[-97.75,22.03],[-97.64,21.6],[-95.92,18.82],[-95.18,18.7],[-94.46,18.17],[-92.44,18.68],[-91.97,18.72],[-91.91,18.53],[-91.53,18.46],[-91.28,18.62],[-91.44,18.89],[-90.74,19.35],[-90.35,21.01],[-88.47,21.57],[-87.25,21.45],[-87.37,21.57],[-87.03,21.59],[-86.82,21.42],[-86.82,21.0],[-87.69,19.64],[-87.42,19.58],[-87.66,19.35],[-87.5,19.29],[-87.85,18.27],[-88.03,18.84],[-88.35,18.36],[-88.08,18.23],[-88.31,16.63],[-88.89,15.89],[-88.6,15.76],[-88.59,15.95],[-88.13,15.7],[-87.7,15.91],[-86.91,15.76],[-86.36,15.78],[-85.99,16.02],[-84.97,15.99],[-84.26,15.82],[-83.77,15.4],[-84.09,15.4],[-83.76,15.22],[-83.5,15.22],[-83.65,15.37],[-83.37,15.24],[-83.16,14.99],[-83.41,14.82],[-83.19,14.34],[-83.49,13.74],[-83.51,12.41],[-83.59,12.71],[-83.75,12.5],[-83.68,12.02],[-83.83,11.86],[-83.65,11.64],[-83.87,11.3],[-83.35,10.31],[-82.08,8.94],[-81.78,8.96],[-81.89,9.14],[-81.55,8.83],[-81.06,8.81],[-79.58,9.6],[-79.11,9.54],[-77.83,9.07],[-76.79,7.93],[-76.92,8.57],[-76.03,9.37],[-75.64,9.45],[-75.54,10.21],[-75.71,10.14],[-75.25,10.78],[-74.84,11.11],[-74.33,11.0],[-74.52,10.86],[-74.4,10.77],[-74.14,11.32],[-73.31,11.3],[-71.6,12.43],[-71.26,12.34],[-71.14,12.05],[-71.96,11.57],[-71.59,10.66],[-72.11,9.82],[-71.62,9.05],[-71.24,9.16],[-71.05,9.71],[-71.49,10.53],[-71.47,10.96],[-70.1,11.52],[-69.81,11.47],[-69.82,11.67],[-70.19,11.62],[-70.29,11.89],[-70.0,12.18],[-69.63,11.48],[-68.83,11.43],[-68.4,11.16],[-68.14,10.49],[-66.25,10.63],[-65.85,10.26],[-65.13,10.07],[-63.73,10.5],[-64.3,10.63],[-61.88,10.74],[-62.91,10.53],[-62.69,10.29],[-62.74,10.06],[-62.55,10.2],[-62.32,9.78],[-62.08,9.97],[-61.74,9.63],[-61.59,9.89],[-60.79,9.36],[-61.25,8.6],[-61.62,8.6],[-61.3,8.41],[-60.17,8.62],[-58.81,7.74],[-58.48,7.33],[-58.67,6.39],[-58.41,6.85],[-57.98,6.79],[-57.23,6.18],[-57.18,5.53],[-56.97,5.99],[-55.9,5.7],[-55.83,5.96],[-54.36,5.91],[-54.05,5.81],[-54.16,5.36],[-53.85,5.78],[-52.9,5.42],[-52.29,4.94],[-52.33,4.77],[-52.06,4.72],[-52.0,4.35],[-51.83,4.64],[-51.65,4.06],[-51.55,4.31],[-51.22,4.09],[-50.71,2.13],[-50.46,1.83],[-49.96,1.66],[-49.9,1.16],[-50.76,0.22],[-51.28,-0.09],[-51.98,-1.37],[-52.66,-1.55],[-51.95,-1.59],[-50.9,-0.94],[-50.69,-1.76],[-50.4,-2.02],[-49.31,-1.73],[-49.64,-2.66],[-49.21,-1.92],[-48.71,-1.49],[-48.46,-1.61],[-48.35,-1.48],[-48.45,-1.15],[-48.12,-0.74],[-47.42,-0.77],[-47.4,-0.63],[-45.46,-1.36],[-45.33,-1.72],[-45.08,-1.47],[-44.65,-1.75],[-44.54,-2.05],[-44.76,-2.27],[-44.66,-2.37],[-44.44,-2.17],[-44.38,-2.37],[-44.72,-3.21],[-44.23,-2.47],[-44.19,-2.81],[-43.38,-2.38],[-41.48,-2.92],[-39.97,-2.86],[-38.48,-3.72],[-37.17,-4.91],[-35.48,-5.17],[-34.83,-7.02],[-34.84,-7.97],[-35.34,-9.23],[-35.89,-9.69],[-36.4,-10.48],[-37.36,-11.25],[-37.69,-12.1],[-38.24,-12.84],[-38.5,-12.96],[-38.69,-12.62],[-38.85,-12.79],[-39.09,-13.59],[-38.88,-15.86],[-39.2,-17.18],[-39.15,-17.7],[-39.65,-18.25],[-39.78,-19.57],[-40.95,-21.24],[-41.0,-22.0],[-41.71,-22.31],[-42.04,-22.95],[-42.96,-22.97],[-43.15,-22.73],[-43.22,-22.99],[-44.64,-23.05],[-44.57,-23.27],[-45.46,-23.8],[-45.97,-23.8],[-46.87,-24.24],[-47.99,-25.04],[-48.2,-25.42],[-48.4,-25.27],[-48.48,-25.44],[-48.73,-25.37],[-48.4,-25.6],[-48.67,-25.84],[-48.75,-26.27],[-48.55,-27.2],[-48.8,-28.57],[-49.75,-29.36],[-50.92,-31.26],[-52.04,-32.12],[-52.06,-31.83],[-51.27,-31.48],[-50.58,-30.44],[-50.56,-30.25],[-51.02,-30.37],[-51.3,-30.04],[-51.16,-30.36],[-51.28,-30.75],[-51.97,-31.38],[-52.19,-31.89],[-52.13,-32.17],[-52.65,-33.14],[-54.17,-34.67],[-54.9,-34.93],[-55.67,-34.78],[-56.2,-34.91],[-57.17,-34.45],[-57.83,-34.48],[-58.44,-33.72],[-58.36,-33.18],[-58.09,-32.97],[-58.2,-32.47],[-58.17,-32.96],[-58.42,-33.11],[-58.55,-33.66],[-58.39,-34.19],[-58.52,-34.3],[-58.28,-34.68],[-57.17,-35.36],[-57.38,-35.9],[-57.08,-36.3],[-56.72,-36.39],[-56.73,-36.96],[-57.55,-38.09],[-58.18,-38.44],[-61.11,-38.99],[-62.34,-38.8],[-62.3,-39.24],[-62.05,-39.37],[-62.4,-40.2],[-62.25,-40.67],[-62.4,-40.89],[-63.62,-41.16],[-65.07,-40.8],[-64.99,-42.1],[-64.42,-42.43],[-63.8,-42.11],[-63.62,-42.7],[-64.03,-42.88],[-64.49,-42.51],[-64.97,-42.67],[-64.32,-42.97],[-65.25,-43.57],[-65.27,-44.28],[-65.65,-44.66],[-65.64,-45.01],[-66.19,-44.97],[-66.94,-45.26],[-67.6,-46.05],[-67.51,-46.44],[-66.78,-47.01],[-65.85,-47.16],[-65.78,-47.57],[-66.22,-47.83],[-65.81,-47.94],[-67.47,-48.95],[-67.91,-49.98],[-68.26,-50.1],[-68.67,-49.75],[-68.66,-49.94],[-68.98,-50.0],[-68.42,-50.16],[-68.94,-50.38],[-69.36,-51.03],[-69.2,-50.99],[-69.06,-51.55],[-69.47,-51.58],[-68.97,-51.68],[-68.39,-52.31],[-69.24,-52.2],[-70.8,-52.77],[-71.0,-53.78],[-71.3,-53.88],[-72.17,-53.63],[-72.41,-53.35],[-71.94,-53.23],[-71.79,-53.48],[-71.74,-53.23],[-71.29,-53.03],[-71.23,-52.81],[-72.28,-53.13],[-72.55,-53.46],[-73.05,-53.24],[-72.73,-52.76],[-71.51,-52.6],[-72.71,-52.54],[-73.12,-53.07],[-73.64,-52.84],[-73.12,-52.49],[-74.01,-52.64],[-74.3,-52.12],[-73.83,-52.23],[-72.8,-51.95],[-72.57,-52.2],[-72.71,-52.36],[-72.52,-52.26],[-72.54,-51.71],[-73.17,-51.45],[-72.6,-51.8],[-73.52,-52.04],[-74.2,-51.68],[-73.93,-51.62],[-73.94,-51.27],[-74.81,-51.06],[-75.09,-50.68],[-74.69,-50.66],[-74.64,-50.36],[-73.81,-50.94],[-73.65,-50.49],[-73.98,-50.83],[-74.19,-50.48],[-73.95,-50.51],[-74.63,-50.19],[-74.33,-49.98],[-73.96,-49.99],[-74.32,-49.78],[-74.29,-49.6],[-73.84,-49.61],[-74.09,-49.43],[-73.94,-49.02],[-74.22,-49.5],[-74.37,-49.4],[-74.34,-48.6],[-74.01,-48.48],[-74.47,-48.46],[-74.58,-48.0],[-73.39,-48.15],[-73.72,-47.66],[-74.23,-47.97],[-74.66,-47.7],[-74.13,-47.59],[-74.48,-47.43],[-74.16,-47.18],[-74.31,-46.79],[-75.01,-46.74],[-75.02,-46.51],[-75.54,-46.7],[-75.43,-46.94],[-75.71,-46.77],[-74.92,-46.16],[-75.07,-45.88],[-74.16,-45.77],[-73.96,-45.4],[-73.83,-45.45],[-74.02,-46.06],[-74.39,-46.22],[-73.97,-46.15],[-73.73,-45.81],[-73.84,-46.57],[-73.59,-45.9],[-73.73,-45.48],[-72.93,-45.45],[-73.44,-45.24],[-73.41,-45.1],[-72.68,-44.59],[-72.66,-44.44],[-73.27,-44.17],[-73.0,-43.63],[-73.08,-43.32],[-72.76,-43.04],[-72.85,-42.67],[-72.63,-42.51],[-72.77,-42.26],[-72.41,-42.39],[-72.5,-41.98],[-72.82,-41.91],[-72.32,-41.5],[-72.54,-41.69],[-72.95,-41.52],[-73.24,-41.78],[-73.73,-41.74],[-73.62,-41.58],[-73.86,-41.45],[-73.98,-40.97],[-73.23,-39.22],[-73.52,-38.51],[-73.66,-37.34],[-73.6,-37.19],[-73.22,-37.17],[-72.62,-35.59],[-72.22,-35.1],[-72.0,-34.16],[-71.66,-33.65],[-71.74,-33.09],[-71.45,-32.66],[-71.71,-30.63],[-71.32,-29.65],[-71.52,-28.93],[-71.19,-28.38],[-70.65,-26.33],[-70.39,-23.57],[-70.59,-23.25],[-70.33,-22.85],[-70.09,-21.49],[-70.36,-18.4],[-71.34,-17.68],[-71.53,-17.29],[-75.1,-15.41],[-75.93,-14.63],[-76.38,-13.86],[-76.22,-13.37],[-77.15,-12.06],[-77.22,-11.66],[-77.63,-11.29],[-78.76,-8.62],[-80.0,-6.77],[-81.14,-6.06],[-80.88,-5.63],[-81.34,-4.67],[-81.23,-4.23],[-79.96,-3.16],[-79.73,-2.58],[-79.84,-2.07],[-79.93,-2.55],[-80.01,-2.35],[-80.28,-2.71],[-80.96,-2.19],[-80.76,-1.94],[-80.9,-1.08],[-80.45,-0.58],[-80.28,-0.62],[-80.48,-0.37],[-80.05,0.15],[-80.09,0.79],[-78.9,1.21],[-79.03,1.62],[-78.79,1.85],[-78.58,1.77],[-78.59,2.36],[-77.81,2.72],[-77.08,3.91],[-77.26,3.89],[-77.28,4.06],[-77.36,3.94],[-77.52,4.21],[-77.29,4.72],[-77.53,5.54],[-77.25,5.78],[-77.47,6.18],[-77.37,6.58],[-78.42,8.06],[-78.14,8.39],[-77.76,8.13],[-78.1,8.5],[-78.4,8.51],[-78.41,8.36],[-78.95,8.93],[-79.44,9.01],[-79.75,8.6],[-80.46,8.21],[-80.01,7.5],[-80.85,7.22],[-81.06,7.9],[-81.27,7.62],[-81.73,8.14],[-82.68,8.32],[-82.88,8.07],[-83.39,8.72],[-83.29,8.41],[-83.61,8.48],[-83.74,9.15],[-84.58,9.57],[-84.72,9.9],[-85.24,10.24],[-84.89,9.82],[-85.08,9.6],[-85.62,9.9],[-85.85,10.29],[-85.66,10.63],[-85.91,10.9],[-85.75,11.09],[-87.67,12.9],[-87.58,13.04],[-87.34,12.95],[-87.49,13.35],[-87.81,13.4],[-88.02,13.17],[-88.69,13.28],[-88.51,13.18],[-90.48,13.9],[-91.38,13.99],[-94.37,16.29],[-94.0,16.02],[-94.9,16.42],[-95.02,16.28],[-94.8,16.21],[-96.51,15.65],[-97.75,15.97],[-98.76,16.54],[-100.85,17.2],[-101.92,17.96],[-103.44,18.32],[-103.91,18.83],[-104.94,19.31],[-105.48,19.98],[-105.67,20.39],[-105.26,20.58],[-105.51,20.81],[-105.24,21.12],[-105.21,21.49],[-105.65,21.99],[-105.79,22.63],[-106.94,23.88],[-107.77,24.47],[-107.53,24.36],[-107.51,24.49],[-107.95,24.61],[-108.28,25.08],[-108.05,25.07],[-108.79,25.54],[-109.03,25.48],[-108.89,25.73],[-109.2,25.59],[-109.39,25.73],[-109.43,26.03],[-109.12,26.25],[-109.28,26.53],[-109.75,26.7],[-109.94,27.08],[-110.48,27.32],[-110.53,27.86],[-111.12,27.97],[-112.16,29.02],[-113.06,30.65],[-113.05,31.18],[-113.62,31.35],[-113.76,31.56],[-114.15,31.51],[-114.93,31.9],[-114.55,30.02],[-112.87,28.42],[-112.73,27.83],[-112.33,27.52],[-111.86,26.68],[-111.7,26.58],[-111.8,26.88],[-111.57,26.71],[-111.29,25.79],[-110.69,24.87],[-110.66,24.34],[-110.37,24.1],[-110.26,24.34],[-109.42,23.48],[-109.5,23.16],[-110.01,22.89],[-110.36,23.61],[-112.07,24.84],[-112.07,25.57],[-112.38,26.21],[-113.02,26.58],[-113.16,26.95],[-113.6,26.72],[-114.99,27.74],[-114.3,27.87],[-114.07,27.68],[-114.27,27.93],[-114.05,28.43],[-114.94,29.35],[-115.67,29.76],[-116.06,30.8],[-116.66,31.57],[-116.62,31.85],[-117.06,32.34],[-117.47,33.3],[-118.08,33.72],[-118.41,33.74],[-118.51,34.02],[-120.64,34.58],[-120.66,35.12],[-121.88,36.33],[-121.81,36.85],[-122.39,37.21],[-122.5,37.54],[-122.38,37.79],[-122.07,37.48],[-122.31,38.01],[-121.53,38.06],[-122.39,38.15],[-122.52,37.83],[-123.0,37.99],[-122.91,38.2],[-123.7,38.91],[-123.83,39.77],[-124.36,40.37],[-124.07,41.46],[-124.54,42.81],[-124.15,43.69],[-123.99,46.22],[-123.22,46.15],[-124.07,46.28],[-123.89,46.66],[-124.11,46.86],[-123.84,46.96],[-124.14,46.95],[-124.71,48.38],[-122.78,48.14],[-122.66,47.88],[-123.14,47.36],[-122.53,47.92],[-122.58,47.29],[-122.83,47.34],[-123.03,47.14],[-122.63,47.14],[-122.35,47.37],[-122.24,48.01],[-122.66,48.45],[-122.5,48.51],[-122.55,48.76],[-123.2,49.15],[-122.88,49.4],[-123.28,49.34],[-123.19,49.68],[-123.53,49.4],[-123.95,49.53],[-123.99,49.74],[-123.82,49.59],[-123.58,49.68],[-123.87,49.74],[-123.88,50.17],[-124.14,49.79],[-124.7,49.96],[-125.06,50.42],[-124.86,50.87],[-125.06,50.51],[-125.48,50.5],[-125.54,50.65],[-125.64,50.47],[-126.09,50.5],[-126.45,50.59],[-125.9,50.7],[-126.51,50.68],[-126.38,50.84],[-126.52,51.06],[-127.06,50.87],[-127.71,51.15],[-127.42,51.61],[-126.69,51.7],[-127.34,51.71],[-127.64,51.48],[-127.85,51.67],[-127.8,52.19],[-127.44,52.36],[-126.71,52.06],[-127.19,52.46],[-127.01,52.84],[-127.07,52.65],[-127.83,52.25],[-128.1,51.79],[-128.36,52.16],[-127.94,52.55],[-128.27,52.36],[-128.05,52.91],[-128.37,52.83],[-128.53,53.14],[-129.17,53.53],[-128.85,53.7],[-128.91,53.56],[-127.93,53.27],[-128.68,53.55],[-128.76,53.75],[-128.53,53.86],[-128.96,53.84],[-129.56,53.25],[-130.34,53.72],[-130.04,54.13],[-129.63,54.23],[-130.08,54.18],[-130.43,54.42],[-129.56,55.46],[-129.79,55.56],[-130.05,55.06],[-130.03,55.89],[-130.04,55.3],[-130.53,54.75],[-130.85,54.81],[-131.05,55.16],[-130.75,55.32],[-131.13,55.96],[-131.03,56.09],[-131.78,55.88],[-131.94,55.55],[-132.12,55.57],[-132.21,55.75],[-131.84,56.16],[-131.55,56.21],[-132.18,56.42],[-132.82,57.06],[-133.47,57.17],[-133.65,57.64],[-133.12,57.57],[-133.53,57.83],[-133.19,57.88],[-133.72,57.84],[-134.03,58.07],[-133.88,58.52],[-134.21,58.23],[-134.66,58.38],[-135.13,58.84],[-135.36,59.42],[-135.5,59.2],[-135.09,58.25],[-135.9,58.4],[-136.04,58.82],[-135.83,58.9],[-136.15,59.05],[-136.23,58.77],[-136.99,59.03],[-137.06,58.87],[-136.06,58.45],[-136.61,58.24],[-138.51,59.17],[-139.8,59.55],[-139.51,59.7],[-139.51,59.95],[-139.29,59.61],[-139.22,59.82],[-138.99,59.84],[-139.43,60.01],[-140.42,59.71],[-141.41,59.9],[-141.41,60.12],[-141.67,59.97],[-144.15,60.02],[-144.9,60.34],[-144.69,60.67],[-145.25,60.38],[-145.9,60.48],[-145.68,60.65],[-146.57,60.73],[-146.39,60.81],[-146.64,60.9],[-146.6,61.05],[-146.28,61.11],[-147.81,60.88],[-147.99,60.95],[-147.75,61.22],[-148.56,60.83],[-148.26,60.67],[-148.64,60.49],[-147.96,60.48],[-148.43,59.99],[-149.4,60.11],[-149.6,59.77],[-149.71,59.92],[-150.94,59.25],[-151.62,59.19],[-151.95,59.27],[-151.85,59.41],[-151.05,59.77],[-151.45,59.65],[-151.85,59.78],[-151.4,60.27],[-151.32,60.74],[-150.44,61.02],[-149.07,60.88],[-150.05,61.17],[-149.33,61.5],[-149.62,61.49],[-151.59,60.98],[-152.54,60.27],[-153.03,60.3],[-152.66,60.0],[-153.21,59.84],[-153.09,59.71],[-153.65,59.65],[-154.18,59.16],[-153.42,58.96],[-153.44,58.76],[-154.29,58.3],[-154.25,58.16],[-155.01,58.02],[-156.44,57.36],[-156.63,57.01],[-158.41,56.44],[-158.55,56.31],[-158.28,56.2],[-158.48,56.08],[-158.59,56.19],[-159.66,55.63],[-159.77,55.84],[-161.18,55.39],[-161.46,55.38],[-161.2,55.54],[-161.52,55.62],[-162.07,55.14],[-162.39,55.05],[-162.63,55.25],[-162.67,55.0],[-163.12,55.06],[-163.34,54.84],[-163.28,55.12],[-161.7,55.91],[-161.22,56.02],[-160.9,55.99],[-161.0,55.89],[-160.8,55.75],[-160.29,55.8],[-160.54,56.01],[-160.3,56.31],[-158.92,56.88],[-158.68,56.8],[-158.66,57.04],[-158.32,57.3],[-157.46,57.51],[-157.7,57.68],[-157.61,58.05],[-157.19,58.19],[-157.52,58.42],[-156.97,58.74],[-156.81,59.13],[-157.14,58.88],[-158.19,58.61],[-158.5,58.85],[-158.43,59.0],[-158.08,58.98],[-158.81,58.97],[-158.79,58.44],[-158.95,58.41],[-159.67,58.91],[-159.92,58.82],[-160.36,59.05],[-161.36,58.67],[-162.15,58.64],[-161.72,58.79],[-161.64,59.11],[-161.98,59.15],[-161.83,59.59],[-162.42,60.28],[-161.95,60.69],[-162.69,60.27],[-162.57,59.99],[-163.91,59.81],[-165.35,60.54],[-164.81,60.89],[-164.32,60.77],[-164.37,60.59],[-164.0,60.77],[-163.73,60.59],[-163.42,60.76],[-163.91,60.85],[-163.59,60.9],[-165.12,60.93],[-164.87,61.11],[-165.27,61.27],[-165.57,61.1],[-165.86,61.34],[-165.84,61.54],[-166.17,61.65],[-165.81,61.7],[-166.08,61.8],[-165.61,61.87],[-165.71,62.1],[-165.19,62.47],[-164.76,62.5],[-164.59,62.71],[-164.79,62.62],[-164.8,62.92],[-164.38,63.03],[-164.53,63.13],[-164.41,63.22],[-163.29,63.05],[-162.28,63.53],[-161.5,63.47],[-160.93,63.66],[-160.78,63.82],[-160.99,64.25],[-161.49,64.43],[-160.93,64.58],[-160.89,64.8],[-161.13,64.92],[-161.76,64.82],[-162.81,64.37],[-163.2,64.65],[-163.14,64.42],[-163.71,64.59],[-164.98,64.45],[-166.14,64.58],[-166.93,65.16],[-166.16,65.29],[-168.09,65.66],[-166.4,66.14],[-165.63,66.13],[-165.81,66.29],[-164.46,66.59],[-163.64,66.58],[-163.89,66.58],[-163.78,66.53],[-164.03,66.22],[-163.69,66.08],[-161.03,66.19],[-161.92,66.41],[-162.61,66.89],[-162.36,66.95],[-161.59,66.46],[-160.23,66.42],[-160.36,66.61],[-161.4,66.55],[-161.86,66.7],[-161.72,67.02],[-163.53,67.1],[-164.12,67.61],[-166.79,68.36],[-166.38,68.42],[-166.21,68.89],[-164.3,68.94],[-163.54,69.17],[-162.95,69.76],[-161.88,70.33],[-161.76,70.26],[-162.07,70.16],[-161.0,70.31],[-160.12,70.59],[-159.96,70.57],[-160.09,70.33],[-159.87,70.28],[-159.81,70.5],[-159.39,70.53],[-160.08,70.64],[-159.68,70.79],[-157.91,70.86],[-156.47,71.41],[-155.58,71.12],[-156.15,70.93],[-155.97,70.84],[-155.17,71.1],[-154.19,70.8],[-152.3,70.85],[-152.47,70.65],[-151.77,70.56],[-151.94,70.45],[-149.27,70.5],[-144.62,69.98],[-143.22,70.12],[-141.41,69.65],[-139.18,69.52],[-137.87,69.09],[-135.26,68.68],[-135.9,68.93],[-135.58,69.03],[-135.91,69.11],[-135.14,69.47],[-134.46,69.48],[-134.41,69.68],[-133.88,69.51],[-134.17,69.25],[-130.66,70.13],[-129.54,70.11],[-130.83,69.65],[-131.94,69.53],[-133.42,68.84],[-133.2,68.74],[-133.34,68.83],[-132.53,68.88],[-132.74,68.92],[-132.72,69.08],[-131.79,69.43],[-131.06,69.45],[-130.97,69.21],[-130.12,69.72],[-128.9,69.97],[-129.16,69.8],[-128.85,69.75],[-127.68,70.26],[-128.17,70.42],[-127.99,70.57],[-125.73,69.38],[-125.17,69.43],[-125.35,69.66],[-124.77,69.99],[-124.99,70.03],[-124.56,70.15],[-124.41,69.77],[-124.12,69.69],[-124.43,69.38],[-123.53,69.39],[-123.03,69.81],[-121.74,69.8],[-117.23,68.91],[-115.44,68.94],[-113.96,68.4],[-114.77,68.27],[-115.43,67.9],[-115.13,67.82],[-112.5,67.68],[-110.07,67.99],[-109.63,67.73],[-109.04,67.69],[-108.85,67.42],[-108.61,67.6],[-107.99,67.26],[-107.99,67.09],[-108.5,67.09],[-107.26,66.4],[-107.75,66.96],[-107.16,66.88],[-107.96,67.82],[-107.8,68.04],[-106.42,68.2],[-105.75,68.59],[-108.32,68.15],[-108.72,68.3],[-108.35,68.6],[-106.16,68.92],[-105.69,68.83],[-105.38,68.41],[-104.49,68.06],[-103.47,68.11],[-102.32,67.74],[-99.03,67.72],[-98.41,67.81],[-98.7,67.97],[-98.63,68.07],[-97.61,67.63],[-97.16,67.73],[-97.21,67.86],[-98.19,67.92],[-98.65,68.36],[-97.79,68.39],[-97.83,68.53],[-96.98,68.25],[-96.43,68.31],[-96.72,68.04],[-95.97,68.25],[-96.37,67.51],[-96.14,67.27],[-95.72,67.32],[-95.78,67.19],[-95.42,67.16],[-95.42,67.01],[-96.42,67.05],[-95.79,66.62],[-96.04,66.94],[-95.4,66.95],[-95.26,67.26],[-95.65,67.74],[-95.46,68.02],[-94.74,68.07],[-93.45,68.62],[-93.64,68.63],[-93.85,69.0],[-94.06,68.78],[-94.6,68.8],[-94.08,69.12],[-94.25,69.31],[-93.62,69.42],[-93.75,69.23],[-93.43,69.38],[-96.05,69.83],[-96.55,70.33],[-95.88,70.55],[-95.89,70.69],[-96.36,70.68],[-96.55,70.81],[-96.53,71.13],[-96.06,71.41],[-95.56,71.34],[-95.41,71.49],[-95.87,71.57],[-95.2,71.9],[-94.56,71.98],[-94.31,71.77]],[[-82.0,62.95],[-82.11,62.65],[-83.02,62.21],[-83.7,62.16],[-83.91,62.43],[-83.38,62.91],[-82.0,62.95]],[[-104.56,77.14],[-105.22,77.18],[-106.07,77.72],[-105.29,77.64],[-104.54,77.34],[-104.56,77.14]],[[-95.48,77.79],[-93.13,77.66],[-93.84,77.45],[-95.99,77.48],[-96.28,77.63],[-95.48,77.79]],[[-93.54,75.03],[-93.57,74.67],[-94.53,74.64],[-96.6,75.03],[-95.95,75.44],[-94.88,75.63],[-93.91,75.42],[-93.54,75.03]],[[-109.82,78.65],[-109.35,78.37],[-113.29,78.33],[-110.88,78.73],[-109.82,78.65]],[[-118.33,75.58],[-119.39,75.62],[-117.75,76.11],[-117.5,76.08],[-118.33,75.58]],[[-105.29,72.92],[-106.95,73.51],[-106.61,73.7],[-105.11,73.74],[-104.56,73.54],[-104.58,73.35],[-105.29,72.92]],[[-100.0,73.95],[-99.16,73.73],[-97.11,73.79],[-97.0,73.67],[-97.63,73.5],[-97.27,73.39],[-98.43,72.96],[-97.64,73.03],[-97.08,72.76],[-97.13,72.63],[-96.54,72.7],[-96.47,72.43],[-96.8,72.32],[-96.59,72.2],[-96.77,72.05],[-96.61,71.83],[-97.58,71.63],[-98.18,71.66],[-98.32,71.85],[-98.46,71.77],[-98.2,71.44],[-99.17,71.37],[-100.59,72.15],[-101.72,72.31],[-102.71,72.77],[-102.2,73.08],[-101.27,72.72],[-100.13,72.91],[-100.54,73.2],[-99.83,73.21],[-101.52,73.49],[-100.98,73.6],[-100.52,73.45],[-100.98,73.77],[-99.99,73.8],[-100.23,73.89],[-100.0,73.95]],[[-84.92,65.26],[-84.5,65.46],[-82.05,64.64],[-81.68,64.21],[-81.89,64.02],[-80.83,64.09],[-80.26,63.8],[-81.05,63.46],[-82.38,63.71],[-82.47,63.93],[-83.3,64.14],[-84.63,63.31],[-85.39,63.12],[-85.77,63.7],[-87.18,63.59],[-86.93,63.9],[-86.25,64.14],[-86.37,64.57],[-85.81,65.83],[-85.24,65.8],[-85.11,65.62],[-85.24,65.51],[-84.92,65.26]],[[-75.68,68.32],[-75.08,68.17],[-75.2,67.46],[-76.69,67.24],[-77.22,67.51],[-77.23,67.85],[-76.74,68.23],[-75.68,68.32]],[[-79.54,73.65],[-77.21,73.5],[-76.09,72.88],[-79.5,72.76],[-79.94,72.86],[-80.18,73.22],[-80.78,73.33],[-80.86,73.67],[-79.54,73.65]],[[-97.7,76.47],[-97.53,76.11],[-97.6,75.85],[-97.89,75.76],[-97.41,75.67],[-97.34,75.42],[-97.88,75.42],[-97.66,75.15],[-98.07,75.2],[-97.99,75.05],[-100.23,75.01],[-100.48,75.19],[-100.15,75.25],[-100.73,75.35],[-99.19,75.7],[-102.8,75.6],[-102.14,75.88],[-100.97,75.8],[-101.87,76.08],[-101.56,76.24],[-102.14,76.28],[-101.79,76.45],[-99.86,75.92],[-99.69,75.96],[-100.11,76.12],[-99.54,76.15],[-100.89,76.47],[-100.07,76.64],[-98.89,76.47],[-99.02,76.61],[-98.71,76.69],[-97.7,76.47]],[[-103.43,79.32],[-102.91,79.23],[-102.58,78.88],[-101.7,79.08],[-101.04,78.94],[-101.13,78.8],[-100.02,78.73],[-99.58,78.56],[-99.85,78.44],[-99.75,78.3],[-99.0,78.0],[-99.96,77.79],[-101.07,78.19],[-102.73,78.37],[-104.51,78.3],[-105.0,78.52],[-103.57,78.54],[-104.02,78.64],[-103.37,78.74],[-104.19,78.78],[-103.88,78.9],[-104.15,78.99],[-104.9,78.81],[-104.75,79.03],[-105.54,79.03],[-105.39,79.32],[-103.43,79.32]],[[-91.89,81.13],[-90.64,80.59],[-89.24,80.51],[-89.2,80.26],[-88.86,80.17],[-88.2,80.11],[-88.61,80.25],[-88.53,80.42],[-87.67,80.37],[-87.62,80.19],[-87.92,80.1],[-86.98,79.89],[-87.3,79.58],[-86.34,79.64],[-86.01,79.48],[-85.65,79.61],[-85.04,79.28],[-86.96,78.97],[-87.62,78.68],[-87.92,78.75],[-87.82,79.04],[-88.04,79.0],[-88.25,78.67],[-87.98,78.54],[-88.74,78.58],[-88.61,78.39],[-88.82,78.19],[-90.04,78.61],[-89.49,78.17],[-90.46,78.33],[-90.65,78.31],[-90.33,78.19],[-91.41,78.19],[-92.85,78.46],[-91.87,78.54],[-93.27,78.61],[-93.63,78.75],[-93.16,78.78],[-94.17,78.97],[-91.3,79.37],[-95.1,79.29],[-95.73,79.42],[-95.66,79.53],[-94.4,79.74],[-95.86,79.67],[-96.77,80.14],[-94.65,80.05],[-94.26,80.19],[-95.41,80.14],[-96.39,80.31],[-95.55,80.37],[-96.15,80.55],[-95.93,80.72],[-93.93,80.56],[-95.52,80.84],[-95.27,81.0],[-93.24,81.13],[-94.22,81.33],[-91.89,81.13]],[[-94.3,76.91],[-93.21,76.75],[-93.53,76.45],[-91.31,76.68],[-90.54,76.5],[-91.42,76.46],[-89.28,76.3],[-91.41,76.22],[-89.28,75.8],[-89.65,75.56],[-88.92,75.45],[-88.64,75.66],[-85.95,75.39],[-86.07,75.5],[-83.93,75.82],[-82.15,75.83],[-79.66,75.45],[-79.51,75.26],[-80.38,75.03],[-79.4,74.92],[-80.35,74.9],[-80.15,74.8],[-80.26,74.58],[-81.94,74.47],[-82.93,74.57],[-83.1,74.82],[-83.52,74.9],[-83.34,74.77],[-83.53,74.59],[-84.43,74.51],[-88.42,74.49],[-88.56,74.57],[-88.34,74.78],[-88.53,74.83],[-89.56,74.56],[-90.55,74.61],[-90.97,74.72],[-90.88,74.82],[-91.51,74.65],[-91.96,74.79],[-92.08,75.12],[-92.39,75.26],[-92.07,75.66],[-92.19,75.85],[-93.09,76.35],[-95.27,76.26],[-96.04,76.49],[-95.65,76.58],[-96.9,76.75],[-96.4,76.8],[-96.76,76.97],[-95.85,77.07],[-94.3,76.91]],[[-96.2,78.53],[-94.92,78.39],[-95.33,78.22],[-94.93,78.08],[-96.99,77.81],[-97.66,78.09],[-96.94,78.15],[-98.05,78.33],[-98.32,78.48],[-98.06,78.56],[-98.34,78.75],[-97.38,78.78],[-96.2,78.53]],[[-110.46,78.1],[-109.62,78.06],[-110.87,77.83],[-110.15,77.76],[-110.2,77.53],[-111.95,77.34],[-113.16,77.53],[-113.28,77.81],[-110.46,78.1]],[[-115.55,77.36],[-116.33,77.14],[-115.81,76.94],[-116.25,76.9],[-115.95,76.71],[-117.0,76.53],[-117.23,76.28],[-117.99,76.41],[-117.88,76.81],[-118.79,76.51],[-118.62,76.37],[-118.99,76.14],[-119.58,76.33],[-119.74,76.12],[-119.53,76.0],[-119.91,75.86],[-120.41,75.83],[-120.85,76.18],[-121.21,75.98],[-122.4,75.94],[-122.64,76.01],[-122.59,76.16],[-122.9,76.14],[-119.09,77.31],[-116.84,77.34],[-117.04,77.47],[-116.51,77.55],[-115.55,77.36]],[[-108.29,76.06],[-107.72,76.0],[-108.02,75.81],[-107.22,75.89],[-106.91,75.68],[-106.68,76.02],[-105.6,75.93],[-105.48,75.7],[-106.09,75.09],[-107.15,74.93],[-108.83,75.06],[-112.52,74.42],[-113.51,74.43],[-114.38,74.67],[-111.03,75.23],[-113.71,75.07],[-113.85,75.26],[-113.47,75.42],[-114.02,75.43],[-114.17,75.24],[-114.51,75.28],[-114.45,75.09],[-115.73,74.97],[-117.6,75.27],[-117.26,75.46],[-115.14,75.68],[-117.16,75.64],[-114.99,75.9],[-116.67,75.96],[-116.21,76.19],[-114.78,76.17],[-115.83,76.3],[-115.0,76.5],[-114.19,76.45],[-113.82,76.21],[-112.7,76.2],[-111.05,75.55],[-109.09,75.51],[-108.94,75.7],[-109.87,75.93],[-109.43,76.11],[-110.31,76.4],[-108.83,76.82],[-108.47,76.74],[-108.63,76.59],[-108.12,76.23],[-108.29,76.06]],[[-93.17,74.16],[-90.36,73.87],[-92.12,72.75],[-94.21,72.76],[-93.54,72.44],[-94.14,72.0],[-95.19,72.03],[-95.25,72.5],[-95.6,72.88],[-95.63,73.69],[-94.7,73.66],[-95.13,73.88],[-94.97,74.04],[-93.17,74.16]],[[-97.44,69.64],[-96.3,69.34],[-95.75,68.9],[-95.27,68.83],[-96.6,68.46],[-98.9,68.93],[-99.25,68.86],[-99.56,69.03],[-99.46,69.13],[-98.5,69.31],[-98.55,69.57],[-98.04,69.46],[-98.3,69.67],[-98.08,69.83],[-97.44,69.64]],[[-114.52,72.59],[-113.58,72.65],[-113.07,73.0],[-111.27,72.71],[-111.89,72.36],[-111.67,72.3],[-110.2,72.66],[-110.66,73.01],[-110.01,72.98],[-108.75,72.55],[-108.19,71.72],[-107.81,71.63],[-107.31,71.89],[-107.7,72.15],[-108.24,73.15],[-107.94,73.22],[-108.03,73.35],[-106.48,73.2],[-105.42,72.79],[-104.39,71.58],[-104.52,71.06],[-103.58,70.63],[-103.08,70.51],[-103.05,70.66],[-101.56,70.14],[-101.09,70.14],[-100.91,69.81],[-101.04,69.67],[-102.23,69.84],[-102.62,69.55],[-103.44,69.67],[-103.05,69.47],[-103.12,69.2],[-102.15,69.49],[-101.79,69.18],[-101.86,69.02],[-102.89,68.82],[-105.11,68.92],[-105.02,69.08],[-106.14,69.16],[-106.66,69.44],[-107.44,69.0],[-109.47,68.68],[-113.02,68.48],[-113.56,68.77],[-113.69,69.19],[-116.51,69.42],[-117.1,69.8],[-117.19,70.05],[-114.59,70.31],[-111.63,70.31],[-113.76,70.69],[-117.59,70.63],[-118.38,70.97],[-115.3,71.49],[-117.94,71.39],[-118.23,71.47],[-117.74,71.66],[-118.99,71.76],[-118.94,71.99],[-118.21,72.26],[-118.48,72.43],[-118.38,72.53],[-116.57,73.06],[-114.21,73.3],[-114.08,72.91],[-114.52,72.59]],[[-119.74,74.11],[-119.21,74.2],[-119.12,74.02],[-118.54,74.25],[-117.52,74.23],[-115.39,73.5],[-118.96,72.68],[-119.51,72.3],[-120.18,72.21],[-120.62,71.51],[-121.75,71.44],[-122.84,71.1],[-123.31,71.17],[-124.01,71.68],[-125.84,71.98],[-124.99,72.59],[-124.97,72.84],[-124.56,72.94],[-124.8,73.13],[-123.8,73.77],[-124.7,74.35],[-121.5,74.55],[-119.56,74.23],[-119.74,74.11]],[[-102.23,76.02],[-102.01,75.94],[-102.58,75.78],[-103.31,75.76],[-103.04,75.92],[-103.77,75.89],[-103.98,75.93],[-103.8,76.04],[-104.41,76.11],[-102.73,76.31],[-102.23,76.02]],[[-55.46,51.54],[-56.03,51.33],[-55.8,51.03],[-56.73,50.01],[-56.82,49.61],[-56.18,50.12],[-56.16,49.94],[-55.5,49.98],[-56.14,49.62],[-55.87,49.67],[-56.09,49.45],[-55.34,49.37],[-55.23,49.51],[-55.35,49.08],[-54.5,49.53],[-54.45,49.33],[-53.62,49.32],[-53.57,49.14],[-54.16,48.79],[-53.71,48.66],[-54.11,48.39],[-53.03,48.63],[-53.14,48.4],[-53.87,48.02],[-53.64,48.02],[-53.86,47.79],[-53.67,47.65],[-52.87,48.11],[-53.17,47.51],[-52.78,47.77],[-52.65,47.55],[-53.07,46.68],[-53.59,46.64],[-53.6,47.15],[-54.17,46.88],[-53.85,47.44],[-54.19,47.86],[-54.49,47.4],[-54.47,47.55],[-54.86,47.38],[-55.32,46.91],[-55.79,46.87],[-55.92,47.02],[-54.78,47.66],[-55.37,47.66],[-55.58,47.47],[-56.13,47.5],[-55.87,47.59],[-55.86,47.82],[-56.77,47.56],[-58.34,47.73],[-59.26,47.63],[-59.34,47.93],[-58.33,48.52],[-59.17,48.56],[-58.84,48.75],[-58.72,48.6],[-58.4,49.08],[-57.99,48.99],[-57.98,49.23],[-58.21,49.39],[-57.79,49.49],[-57.93,49.7],[-57.04,51.01],[-56.03,51.57],[-55.46,51.54]],[[19.25,70.07],[19.61,70.02],[18.79,69.58],[18.06,69.6],[18.67,69.78],[19.13,70.24],[19.25,70.07]],[[15.76,68.56],[16.28,68.87],[16.55,68.72],[15.97,68.4],[14.26,68.19],[15.41,68.62],[15.48,69.04],[15.89,69.28],[16.13,69.27],[15.81,69.02],[15.93,68.73],[15.76,68.56]],[[-44.87,82.08],[-46.75,82.35],[-47.35,82.6],[-46.4,82.69],[-44.92,82.48],[-44.75,82.4],[-44.87,82.08]],[[-29.95,83.56],[-25.8,83.26],[-32.03,82.98],[-25.12,83.16],[-24.47,82.88],[-21.52,82.59],[-23.12,82.33],[-29.89,82.06],[-25.15,82.0],[-24.29,81.7],[-22.94,82.03],[-21.34,82.07],[-21.13,81.93],[-21.15,81.69],[-23.12,80.78],[-19.63,81.64],[-17.46,81.4],[-16.12,81.78],[-14.24,81.81],[-11.43,81.48],[-14.45,80.99],[-14.23,80.87],[-14.5,80.76],[-16.76,80.57],[-15.94,80.43],[-16.49,80.25],[-19.43,80.26],[-20.15,80.01],[-20.07,79.77],[-19.35,79.73],[-19.41,79.35],[-18.99,79.18],[-21.13,78.66],[-20.96,78.56],[-21.73,77.71],[-20.86,77.91],[-19.49,77.72],[-19.3,77.58],[-20.68,77.62],[-20.23,77.37],[-18.44,77.26],[-18.34,76.92],[-18.61,76.76],[-20.49,76.92],[-22.61,76.68],[-21.88,76.57],[-21.49,76.27],[-19.86,76.12],[-19.96,76.0],[-19.51,75.76],[-19.4,75.49],[-19.53,75.18],[-20.48,75.31],[-21.65,75.02],[-22.23,75.12],[-21.7,74.96],[-20.99,75.07],[-20.8,74.81],[-21.04,74.65],[-20.86,74.64],[-20.42,74.97],[-19.98,74.97],[-19.29,74.55],[-19.27,74.34],[-21.13,74.11],[-21.95,74.24],[-21.76,74.48],[-21.98,74.57],[-21.97,74.39],[-22.33,74.29],[-22.2,74.21],[-22.34,74.06],[-20.37,73.85],[-20.64,73.46],[-22.35,73.27],[-24.16,73.76],[-24.68,73.6],[-25.52,73.85],[-24.78,73.54],[-26.06,73.25],[-27.27,73.44],[-26.54,73.25],[-27.56,73.14],[-24.13,73.41],[-22.04,72.92],[-22.07,72.4],[-22.28,72.34],[-22.29,72.12],[-24.07,72.5],[-24.63,73.04],[-26.66,72.72],[-24.81,72.9],[-24.7,72.51],[-25.2,72.39],[-24.57,72.42],[-21.96,71.75],[-22.48,71.38],[-22.42,71.25],[-22.3,71.43],[-21.75,71.48],[-21.52,70.53],[-22.38,70.46],[-22.44,70.86],[-22.69,70.44],[-23.33,70.45],[-23.97,70.65],[-24.56,71.22],[-25.89,71.57],[-27.09,71.63],[-25.84,71.48],[-25.67,71.27],[-26.72,70.95],[-28.4,70.99],[-27.98,70.84],[-28.15,70.66],[-29.07,70.44],[-26.75,70.48],[-26.51,70.4],[-27.33,70.22],[-27.63,70.03],[-27.38,69.99],[-27.03,70.2],[-25.53,70.35],[-22.21,70.11],[-22.43,69.99],[-23.87,69.74],[-23.74,69.59],[-24.3,69.59],[-24.3,69.44],[-25.19,69.26],[-25.09,69.17],[-26.48,68.68],[-30.72,68.25],[-30.61,68.12],[-30.98,68.06],[-32.33,68.44],[-32.16,67.99],[-33.11,67.66],[-34.63,66.44],[-35.19,66.25],[-35.87,66.44],[-35.63,66.14],[-37.75,65.59],[-38.0,65.71],[-37.28,66.3],[-38.16,66.39],[-37.75,66.26],[-38.14,65.9],[-38.52,66.01],[-38.2,65.71],[-40.17,65.56],[-39.58,65.34],[-40.25,65.05],[-41.09,65.03],[-40.97,64.87],[-40.66,64.92],[-40.18,64.48],[-40.78,64.22],[-41.58,64.3],[-40.62,64.13],[-40.55,63.73],[-41.05,63.51],[-41.39,63.06],[-42.17,63.21],[-41.63,62.97],[-41.91,62.74],[-42.94,62.72],[-42.15,62.57],[-42.32,62.15],[-42.11,61.86],[-42.59,61.72],[-42.32,61.68],[-42.72,60.77],[-43.04,60.52],[-43.92,60.59],[-43.21,60.39],[-43.12,60.06],[-43.32,59.93],[-43.95,60.02],[-43.66,59.86],[-43.91,59.81],[-44.41,59.92],[-44.22,60.27],[-44.61,60.02],[-45.38,60.2],[-45.37,60.37],[-44.76,60.66],[-45.38,60.45],[-46.05,60.62],[-46.14,60.78],[-45.87,61.22],[-46.87,60.82],[-48.18,60.77],[-47.77,61.0],[-48.39,61.01],[-48.43,61.19],[-48.92,61.28],[-49.29,61.59],[-49.38,61.89],[-48.83,62.08],[-49.62,62.0],[-49.55,62.23],[-50.32,62.47],[-50.3,62.72],[-49.79,63.05],[-50.39,62.82],[-51.47,63.64],[-51.55,64.01],[-50.26,64.21],[-51.71,64.2],[-51.23,64.56],[-50.68,64.68],[-50.01,64.45],[-50.12,64.7],[-50.52,64.77],[-50.96,65.2],[-50.72,64.8],[-51.22,64.63],[-51.26,64.76],[-51.92,64.22],[-52.26,65.16],[-52.54,65.33],[-51.09,65.78],[-52.55,65.46],[-53.2,65.59],[-53.11,65.98],[-53.39,66.05],[-51.23,66.88],[-53.04,66.2],[-53.62,66.15],[-53.42,66.65],[-52.39,66.88],[-53.69,66.99],[-53.88,67.14],[-53.8,67.42],[-52.51,67.76],[-50.61,67.53],[-51.17,67.69],[-50.97,67.81],[-52.34,67.84],[-53.73,67.55],[-53.15,68.21],[-51.6,68.06],[-51.17,68.39],[-52.2,68.22],[-53.38,68.3],[-53.04,68.61],[-51.13,68.6],[-50.8,68.79],[-51.25,68.74],[-51.09,69.13],[-50.3,69.17],[-51.08,69.21],[-50.8,69.66],[-50.35,69.8],[-50.5,69.94],[-50.32,70.03],[-52.26,70.06],[-54.01,70.42],[-54.53,70.7],[-52.8,70.75],[-50.68,70.4],[-51.32,70.59],[-51.26,70.85],[-51.77,71.01],[-51.02,71.0],[-53.01,71.18],[-53.12,71.31],[-52.75,71.5],[-51.78,71.68],[-53.44,71.58],[-53.15,71.81],[-53.33,71.79],[-53.81,72.29],[-53.65,72.36],[-53.93,72.32],[-53.46,71.89],[-54.02,71.66],[-53.96,71.46],[-54.69,71.37],[-55.59,71.55],[-55.67,71.69],[-55.32,72.11],[-54.84,72.36],[-55.58,72.18],[-55.64,72.3],[-55.3,72.35],[-55.6,72.45],[-54.92,72.57],[-54.74,72.87],[-55.67,73.01],[-55.29,73.33],[-56.1,73.56],[-55.84,73.76],[-56.23,74.13],[-57.23,74.12],[-56.26,74.53],[-58.57,75.35],[-58.25,75.51],[-58.52,75.69],[-63.29,76.35],[-65.37,76.13],[-67.08,76.19],[-66.83,75.97],[-68.32,76.09],[-69.48,76.4],[-68.11,76.65],[-69.25,76.69],[-69.89,76.83],[-69.69,76.99],[-70.61,76.82],[-71.16,77.07],[-68.14,77.38],[-66.39,77.28],[-66.27,77.52],[-66.82,77.69],[-69.35,77.47],[-70.56,77.72],[-70.11,77.84],[-71.27,77.81],[-72.82,78.19],[-72.47,78.48],[-71.65,78.62],[-65.83,79.17],[-65.29,79.44],[-64.79,80.0],[-64.18,80.1],[-66.84,80.08],[-67.19,80.28],[-64.52,81],[-63.06,80.89],[-63.23,81.08],[-62.99,81.21],[-61.44,81.13],[-61.1,81.4],[-61.2,81.75],[-60.43,81.92],[-59.28,81.88],[-56.62,81.36],[-59.27,81.98],[-58.72,82.09],[-54.55,82.35],[-53.67,82.16],[-53.56,81.65],[-53.04,81.87],[-53.02,82.32],[-50.89,81.89],[-49.54,81.92],[-50.99,82.46],[-50.04,82.47],[-44.73,81.78],[-44.53,81.85],[-44.64,82.1],[-44.24,82.37],[-44.33,82.47],[-45.56,82.75],[-41.43,82.78],[-46.14,82.86],[-46.48,82.95],[-46.17,83.06],[-43.01,83.27],[-41.3,83.1],[-40.36,83.33],[-38.16,83.0],[-37.94,83.16],[-38.75,83.37],[-36.61,83.54],[-29.95,83.56]],[[-57.02,-63.37],[-56.84,-63.63],[-57.46,-63.51],[-59.01,-64.19],[-58.79,-64.52],[-59.46,-64.35],[-59.65,-64.58],[-59.96,-64.43],[-61.06,-64.98],[-61.7,-64.99],[-61.58,-65.19],[-62.15,-65.33],[-61.76,-65.57],[-62.3,-65.84],[-62.01,-66.11],[-60.56,-65.98],[-61.01,-66.11],[-61.03,-66.34],[-61.43,-66.14],[-61.76,-66.43],[-62.12,-66.21],[-62.68,-66.24],[-62.63,-66.71],[-63.26,-66.26],[-63.75,-66.28],[-63.65,-66.38],[-64.08,-66.65],[-63.76,-66.87],[-64.69,-66.81],[-64.78,-67.12],[-65.03,-67.21],[-64.82,-67.31],[-65.5,-67.38],[-65.42,-67.66],[-65.6,-67.88],[-65.47,-68.01],[-65.64,-68.13],[-64.83,-68.13],[-65.45,-68.34],[-65.0,-68.41],[-65.16,-68.62],[-64.08,-68.77],[-64.17,-68.58],[-63.92,-68.5],[-62.93,-68.44],[-63.77,-68.63],[-63.34,-68.81],[-63.46,-69.04],[-62.59,-69.48],[-61.96,-70.12],[-62.38,-70.36],[-61.51,-70.49],[-61.99,-70.73],[-61.96,-70.9],[-61.31,-70.87],[-60.96,-71.25],[-61.96,-71.66],[-61.21,-71.56],[-60.99,-71.66],[-61.03,-71.82],[-62.26,-72.02],[-60.72,-72.07],[-60.73,-72.43],[-61.28,-72.47],[-61.29,-72.6],[-60.53,-72.67],[-60.38,-73.01],[-59.96,-73.03],[-60.12,-73.28],[-62.01,-73.15],[-61.64,-73.5],[-60.79,-73.71],[-61.84,-74.03],[-61.04,-74.12],[-61.84,-74.29],[-60.78,-74.24],[-61.01,-74.48],[-62.23,-74.44],[-61.85,-74.78],[-62.37,-74.95],[-63.18,-74.68],[-63.2,-74.91],[-63.92,-75.0],[-63.23,-75.15],[-64.28,-75.29],[-63.36,-75.45],[-69.3,-76.35],[-70.21,-76.67],[-77.19,-76.63],[-76.25,-77.28],[-72.88,-77.69],[-74.04,-78.11],[-75.4,-78.16],[-80.6,-77.75],[-81.58,-77.85],[-77.43,-78.44],[-77.87,-78.75],[-80.29,-78.82],[-82.61,-78.41],[-83.78,-77.98],[-83.23,-78.4],[-83.76,-78.46],[-83.26,-78.77],[-81.66,-79.1],[-80.89,-79.5],[-80.15,-79.27],[-76.22,-79.39],[-76.03,-79.63],[-76.56,-79.9],[-79.66,-80.0],[-78.18,-80.17],[-76.41,-80.09],[-75.08,-80.86],[-73.03,-80.92],[-70.69,-80.63],[-69.77,-80.96],[-68.59,-80.97],[-65.57,-81.46],[-62.35,-81.58],[-65.62,-81.73],[-64.14,-81.87],[-66.13,-81.95],[-65.84,-81.99],[-65.91,-82.18],[-65.71,-82.28],[-64.92,-82.37],[-60.53,-82.2],[-62.74,-82.53],[-61.92,-82.98],[-61.22,-82.99],[-61.59,-83.34],[-61.42,-83.4],[-59.52,-83.46],[-55.8,-82.48],[-53.99,-82.2],[-48.36,-81.89],[-46.26,-81.95],[-46.05,-82.16],[-46.52,-82.45],[-45.79,-82.5],[-43.67,-82.27],[-41.43,-81.3],[-38.77,-80.88],[-37.21,-81.06],[-35.33,-80.65],[-31.31,-80.45],[-29.53,-80.18],[-23.57,-79.97],[-29.95,-79.6],[-30.21,-79.48],[-30.32,-79.16],[-32.99,-79.23],[-35.52,-78.93],[-36.24,-78.77],[-36.18,-78.47],[-34.08,-77.42],[-32.06,-77.16],[-28.93,-76.37],[-24.27,-75.77],[-18.3,-75.43],[-18.75,-75.24],[-17.44,-74.38],[-15.67,-74.41],[-14.57,-73.94],[-16.22,-73.92],[-15.94,-73.76],[-16.52,-73.64],[-16.43,-73.43],[-15.6,-73.1],[-14.32,-73.12],[-14.0,-73.0],[-14.3,-72.73],[-13.21,-72.78],[-11.5,-72.41],[-10.96,-71.9],[-11.01,-71.76],[-12.15,-71.61],[-12.35,-71.39],[-11.93,-71.29],[-10.82,-71.55],[-10.03,-71.13],[-10.27,-70.94],[-9.23,-71.17],[-8.65,-71.67],[-7.71,-71.55],[-7.59,-71.22],[-7.87,-70.94],[-7.75,-70.84],[-5.94,-70.71],[-5.59,-70.86],[-6.12,-71.33],[-2.02,-71.43],[-1.07,-71.27],[-0.54,-71.71],[0.54,-71.27],[1.91,-71.0],[7.68,-70.36],[8.52,-70.47],[9.14,-70.18],[11.7,-70.77],[12.93,-70.21],[12.63,-70.07],[13.07,-70.05],[13.82,-70.34],[15.81,-70.32],[16.38,-70.14],[16.71,-70.4],[18.12,-70.54],[18.43,-70.29],[19.01,-70.21],[19.2,-70.29],[19.03,-70.67],[19.41,-70.92],[21.07,-70.84],[21.7,-70.26],[22.37,-70.47],[22.28,-70.7],[22.98,-70.81],[24.02,-70.41],[24.76,-70.89],[26.5,-71.02],[30.0,-70.3],[32.62,-70.0],[32.99,-69.62],[32.57,-69.07],[32.64,-68.87],[33.47,-68.67],[34.19,-68.7],[33.81,-69.1],[34.6,-69.09],[35.36,-69.68],[37.79,-69.73],[38.89,-70.17],[38.86,-70.01],[39.7,-69.43],[39.86,-68.97],[40.22,-68.81],[42.96,-68.09],[46.4,-67.62],[46.32,-67.4],[46.56,-67.27],[47.35,-67.36],[47.12,-67.57],[47.49,-67.73],[48.21,-67.7],[48.38,-67.99],[48.65,-67.79],[48.63,-67.52],[49.22,-67.23],[48.47,-67.04],[49.25,-66.94],[50.55,-67.19],[50.52,-66.82],[50.24,-66.6],[50.33,-66.44],[51.88,-66.02],[53.67,-65.86],[55.29,-65.95],[56.86,-66.42],[57.19,-66.61],[56.15,-66.63],[56.48,-66.86],[55.8,-67.2],[56.16,-67.27],[57.63,-67.01],[59.25,-67.48],[60.48,-67.39],[62.69,-67.65],[63.7,-67.51],[68.33,-67.89],[69.56,-67.76],[69.98,-68.46],[69.53,-68.74],[69.63,-69.23],[68.91,-69.37],[69.19,-69.66],[69.08,-69.87],[68.18,-69.84],[67.27,-70.27],[69.25,-70.43],[68.87,-71.03],[68.04,-71.39],[67.43,-72.0],[66.89,-72.95],[66.5,-73.12],[67.32,-73.3],[67.97,-73.09],[67.97,-72.75],[68.42,-72.52],[69.56,-72.38],[71.28,-71.62],[71.77,-70.8],[72.76,-70.4],[72.82,-70.1],[73.33,-69.85],[75.64,-69.85],[76.11,-69.49],[77.82,-69.07],[79.03,-68.17],[83.3,-67.6],[84.48,-67.11],[85.71,-67.16],[87.98,-66.79],[89.7,-66.82],[92.07,-66.51],[93.96,-66.69],[94.84,-66.5],[95.54,-66.63],[98.26,-66.47],[99.37,-66.65],[100.89,-66.36],[101.38,-65.97],[102.67,-65.86],[109.46,-66.91],[110.62,-66.52],[110.59,-66.31],[110.91,-66.08],[113.1,-65.8],[115.64,-66.77],[115.27,-67.03],[113.99,-67.21],[114.03,-67.44],[116.71,-67.05],[118.71,-67.17],[119.77,-66.99],[120.38,-66.98],[119.13,-67.37],[123.97,-66.61],[124.82,-66.69],[125.87,-66.36],[126.67,-66.5],[127.54,-67.05],[128.43,-67.12],[129.24,-67.04],[129.74,-66.47],[130.58,-66.21],[133.44,-66.08],[134.4,-66.48],[135.35,-66.13],[136.55,-66.44],[137.34,-66.35],[142.69,-67.01],[143.73,-66.88],[143.91,-67.09],[144.62,-67.14],[143.98,-67.86],[145.97,-67.62],[146.83,-67.97],[146.8,-68.27],[147.09,-68.37],[150.94,-68.36],[151.29,-68.82],[151.56,-68.69],[153.08,-68.86],[153.71,-68.73],[153.91,-68.32],[155.52,-69.02],[157.48,-69.31],[157.93,-69.18],[159.78,-69.52],[160.21,-69.97],[161.04,-70.32],[161.43,-70.83],[162.19,-71.04],[162.02,-70.44],[162.68,-70.31],[163.35,-70.62],[164.4,-70.51],[167.57,-70.81],[168.17,-71.18],[170.16,-71.63],[170.44,-71.42],[170.86,-71.87],[170.03,-72.12],[169.95,-72.4],[170.26,-72.37],[170.21,-72.56],[168.43,-72.38],[169.83,-72.73],[169.54,-73.05],[169.03,-73.2],[167.16,-73.15],[166.45,-72.94],[166.83,-73.22],[167.71,-73.39],[165.86,-73.59],[166.11,-73.73],[165.35,-73.88],[165.13,-73.38],[164.81,-73.4],[164.98,-73.93],[164.78,-74.03],[165.41,-74.56],[163.74,-74.56],[163.4,-74.38],[162.6,-74.82],[162.41,-75.24],[160.91,-75.33],[162.19,-75.47],[162.82,-75.85],[162.44,-76.16],[162.73,-76.22],[162.82,-76.46],[162.68,-76.57],[162.76,-76.75],[162.45,-76.96],[163.09,-77.03],[163.77,-77.7],[164.49,-77.95],[163.98,-78.22],[164.63,-78.32],[165.42,-78.04],[165.66,-78.31],[167.06,-78.52],[167.05,-78.69],[164.63,-78.6],[162.64,-78.9],[161.67,-78.54],[161.5,-78.68],[161.95,-79.03],[160.87,-79.05],[160.48,-79.2],[160.65,-79.43],[159.98,-79.59],[160.35,-79.69],[159.9,-79.86],[160.56,-80.01],[158.57,-80.42],[160.64,-80.45],[160.52,-80.58],[160.83,-80.73],[160.26,-80.79],[160.72,-80.91],[160.72,-81.2],[160.47,-81.34],[163.68,-82.19],[161.28,-82.49],[164.75,-82.35],[167.12,-82.8],[167.6,-83.05],[168.61,-83.06],[167.66,-83.27],[168.11,-83.36],[171.04,-83.45],[180,-84.35],[180,-90.0],[-180,-90.0],[-180,-84.35],[-156.46,-85.19],[-157.45,-84.91],[-156.62,-84.84],[-165.13,-84.41],[-163.76,-84.31],[-164.69,-84.16],[-164.01,-84.02],[-164.95,-83.81],[-167.8,-83.79],[-169.17,-83.45],[-174.24,-82.79],[-171.82,-82.85],[-168.42,-83.23],[-165.62,-83.22],[-164.45,-83.47],[-163.11,-83.33],[-162.2,-83.52],[-159.44,-83.54],[-157.43,-83.35],[-157.03,-83.23],[-157.68,-83.13],[-155.46,-82.98],[-153.01,-82.45],[-154.72,-81.94],[-153.96,-81.7],[-157.03,-81.32],[-156.53,-81.16],[-148.12,-80.9],[-150.57,-80.35],[-150.22,-80.15],[-148.32,-80.07],[-148.43,-79.93],[-148.13,-79.91],[-148.18,-79.78],[-151.05,-79.46],[-152.14,-79.12],[-154.52,-79.05],[-156.12,-78.75],[-156.47,-78.64],[-154.29,-78.26],[-157.27,-78.2],[-158.29,-77.95],[-158.5,-77.78],[-158.23,-77.5],[-158.21,-77.16],[-158.0,-77.09],[-157.14,-77.24],[-154.81,-77.13],[-149.72,-77.8],[-148.16,-77.46],[-148.74,-77.34],[-148.78,-77.12],[-146.07,-77.49],[-145.6,-77.45],[-145.81,-77.27],[-145.52,-77.2],[-145.97,-77.07],[-145.63,-76.95],[-145.75,-76.75],[-146.78,-76.51],[-149.65,-76.36],[-148.32,-76.1],[-145.44,-76.41],[-146.38,-76.1],[-145.99,-75.89],[-143.57,-75.56],[-142.33,-75.49],[-140.87,-75.75],[-141.22,-75.55],[-139.15,-75.16],[-136.65,-75.16],[-136.23,-74.84],[-135.36,-74.69],[-129.79,-74.89],[-127.02,-74.7],[-121.54,-74.75],[-118.34,-74.38],[-115.22,-74.49],[-114.62,-73.9],[-113.51,-74.09],[-113.75,-74.37],[-113.33,-74.45],[-113.9,-74.64],[-114.11,-74.98],[-111.7,-74.79],[-111.81,-74.27],[-111.63,-74.18],[-110.31,-74.37],[-110.23,-74.54],[-110.3,-74.71],[-111.46,-75.13],[-111.36,-75.22],[-106.62,-75.34],[-103.12,-75.09],[-101.71,-75.13],[-101.04,-75.42],[-98.75,-75.32],[-98.56,-75.19],[-100.47,-74.87],[-100.01,-74.66],[-100.24,-74.48],[-101.25,-74.49],[-101.72,-74.02],[-102.86,-73.78],[-102.41,-73.62],[-100.72,-73.76],[-98.9,-73.61],[-100.44,-73.35],[-102.91,-73.28],[-103.38,-72.82],[-103.11,-72.72],[-102.36,-72.76],[-102.41,-72.99],[-98.21,-73.02],[-96.39,-73.3],[-92.83,-73.17],[-90.92,-73.32],[-90.43,-73.24],[-90.3,-72.98],[-88.78,-72.68],[-88.19,-72.79],[-88.56,-73.12],[-88.42,-73.23],[-87.4,-73.19],[-86.79,-73.36],[-85.8,-73.19],[-84.98,-73.5],[-82.18,-73.86],[-81.31,-73.74],[-81.18,-73.25],[-80.34,-73.41],[-80.61,-73.08],[-80.44,-72.94],[-79.52,-73.09],[-78.79,-73.51],[-76.85,-73.46],[-76.77,-73.57],[-77.05,-73.84],[-75.29,-73.64],[-74.0,-73.7],[-72.93,-73.45],[-69.28,-73.17],[-67.67,-72.83],[-66.83,-72.09],[-67.46,-71.53],[-67.69,-70.69],[-68.4,-70.02],[-68.71,-69.43],[-67.37,-69.41],[-66.97,-69.16],[-67.39,-68.86],[-67.13,-68.77],[-66.79,-68.24],[-67.15,-68.03],[-66.68,-67.56],[-67.55,-67.53],[-67.49,-67.11],[-67.03,-66.94],[-66.9,-67.26],[-66.5,-67.29],[-66.5,-66.69],[-65.77,-66.62],[-65.78,-66.29],[-65.17,-66.12],[-65.27,-65.99],[-64.51,-65.96],[-64.65,-65.75],[-63.82,-65.53],[-64.07,-65.28],[-63.76,-65.03],[-63.06,-65.14],[-63.12,-64.94],[-62.53,-64.83],[-62.5,-64.66],[-61.63,-64.61],[-60.86,-64.07],[-57.39,-63.23],[-57.02,-63.37]],[[178.86,70.83],[178.68,71.11],[180,71.54],[180,70.99],[178.86,70.83]],[[17.98,59.33],[18.51,59.41],[18.62,59.33],[18.29,59.11],[16.98,58.65],[16.21,58.64],[16.92,58.49],[16.65,58.43],[16.77,58.21],[16.55,57.81],[16.53,57.07],[16.0,56.22],[14.71,56.13],[14.21,55.83],[14.34,55.53],[14.17,55.4],[12.89,55.41],[12.97,55.75],[12.47,56.29],[12.8,56.26],[12.66,56.44],[12.88,56.62],[12.42,56.91],[11.43,58.34],[11.25,58.37],[11.15,58.99],[11.39,59.07],[10.83,59.18],[10.6,59.77],[10.18,59.01],[9.56,59.11],[9.66,58.97],[8.17,58.15],[6.73,58.07],[6.55,58.12],[6.66,58.26],[5.59,58.62],[5.61,59.01],[6.1,58.87],[6.36,59.0],[5.89,59.1],[6.42,59.55],[5.17,59.16],[5.24,59.56],[6.22,59.82],[5.73,59.86],[6.35,60.35],[6.57,60.36],[6.53,60.15],[7.0,60.51],[6.15,60.35],[5.15,59.64],[5.21,60.09],[5.69,60.12],[5.29,60.21],[5.14,60.45],[5.65,60.69],[5.12,60.64],[5.01,61.04],[6.78,61.14],[7.04,60.95],[7.04,61.09],[7.6,61.21],[7.35,61.3],[7.44,61.44],[7.28,61.18],[6.6,61.29],[6.38,61.13],[5.33,61.11],[4.99,61.38],[5.34,61.48],[4.91,61.81],[6.73,61.87],[5.27,61.94],[5.14,62.16],[6.69,62.47],[6.14,62.41],[6.35,62.61],[7.57,62.55],[7.69,62.59],[7.54,62.67],[8.1,62.73],[6.74,62.72],[7.57,63.1],[8.62,62.85],[8.16,63.16],[8.64,63.34],[8.36,63.5],[8.58,63.6],[9.14,63.59],[9.16,63.46],[9.7,63.62],[10.02,63.39],[10.76,63.46],[10.72,63.62],[11.37,63.8],[11.18,63.9],[11.46,64.0],[11.31,64.05],[10.05,63.51],[9.57,63.71],[10.57,64.42],[11.63,64.81],[11.3,64.75],[11.49,64.98],[12.16,65.18],[12.51,65.1],[12.92,65.34],[12.13,65.28],[12.69,65.9],[13.03,65.96],[12.78,66.1],[14.03,66.3],[13.12,66.23],[13.21,66.64],[13.96,66.79],[13.65,66.91],[14.11,67.12],[15.42,67.2],[14.44,67.27],[14.96,67.57],[15.59,67.35],[15.69,67.52],[15.25,67.6],[15.3,67.77],[14.78,67.67],[14.8,67.81],[15.62,67.95],[15.29,68.04],[16.01,68.23],[16.31,67.88],[16.39,68.09],[16.2,68.32],[17.55,68.43],[16.51,68.53],[18.1,69.16],[18.26,69.47],[18.86,69.31],[18.61,69.49],[19.69,69.81],[19.64,69.42],[19.96,69.83],[20.32,69.94],[20.34,69.62],[20.11,69.34],[20.74,69.52],[20.53,69.69],[20.62,69.91],[21.43,70.01],[21.98,69.83],[21.36,70.23],[22.68,70.38],[23.35,69.98],[23.38,70.25],[24.42,70.7],[24.26,70.83],[24.66,71.0],[25.77,70.85],[25.21,70.49],[25.04,70.11],[26.51,70.91],[26.73,70.85],[26.59,70.41],[27.55,70.8],[27.33,71.0],[28.14,71.04],[28.38,70.87],[27.9,70.68],[28.27,70.67],[28.19,70.25],[28.83,70.86],[30.07,70.7],[30.96,70.34],[30.26,70.12],[28.78,70.14],[29.6,69.98],[29.7,69.75],[30.24,69.86],[31.55,69.7],[32.0,69.81],[31.98,69.95],[33.01,69.72],[32.09,69.63],[32.38,69.48],[33.45,69.43],[33.14,69.07],[33.68,69.31],[35.86,69.19],[40.97,67.71],[41.13,67.27],[41.36,67.21],[41.19,66.83],[40.1,66.3],[38.65,66.07],[34.48,66.55],[33.15,66.84],[32.93,67.09],[31.89,67.16],[33.66,66.44],[33.36,66.33],[34.69,65.95],[34.78,65.77],[34.41,65.4],[35.03,64.44],[37.44,63.81],[38.06,64.09],[37.95,64.32],[37.18,64.41],[36.58,64.79],[36.53,64.94],[36.88,65.17],[39.76,64.58],[40.45,64.78],[39.8,65.35],[39.82,65.6],[42.21,66.52],[43.23,66.42],[43.65,66.25],[43.54,66.12],[44.1,66.01],[44.49,66.67],[44.43,66.94],[43.78,67.25],[44.2,68.25],[43.33,68.67],[45.89,68.48],[46.69,67.85],[45.53,67.76],[44.9,67.41],[45.88,66.89],[46.49,66.8],[47.66,66.98],[47.88,67.58],[48.83,67.68],[48.75,67.9],[51.99,68.54],[52.4,68.35],[52.72,68.48],[52.34,68.61],[53.8,69.0],[54.49,68.99],[53.8,68.91],[53.97,68.84],[53.76,68.63],[53.93,68.44],[53.26,68.27],[54.86,68.2],[55.42,68.57],[57.13,68.55],[59.06,69.01],[59.37,68.74],[59.1,68.44],[59.73,68.35],[59.92,68.47],[59.9,68.71],[60.49,68.73],[60.93,68.99],[60.17,69.59],[60.91,69.85],[64.19,69.53],[68.5,68.35],[69.14,68.95],[68.54,68.97],[68.01,69.48],[67.62,69.58],[67.06,69.69],[66.9,69.55],[66.93,70.01],[67.24,70.11],[67.28,70.74],[66.7,70.82],[66.85,71.06],[66.64,71.08],[68.27,71.68],[69.39,72.96],[71.5,72.91],[72.81,72.69],[72.57,72.01],[71.87,71.46],[72.7,70.96],[72.7,70.46],[72.47,70.28],[72.58,68.97],[73.59,68.48],[73.14,68.18],[73.07,67.77],[71.85,67.01],[71.36,66.96],[71.54,66.68],[70.72,66.52],[70.38,66.6],[70.69,66.75],[69.01,66.79],[69.19,66.58],[69.98,66.4],[72.07,66.25],[72.42,66.56],[73.79,67.0],[74.08,67.41],[74.77,67.77],[74.74,68.07],[74.39,68.42],[74.58,68.75],[75.12,68.86],[76.46,68.98],[77.24,68.47],[77.17,67.78],[77.77,67.57],[78.92,67.59],[77.59,67.75],[77.67,68.19],[78.0,68.26],[77.65,68.9],[76.0,69.23],[74.81,69.09],[73.78,69.2],[73.89,69.42],[73.58,69.8],[74.34,70.58],[73.09,71.44],[73.67,71.84],[74.99,72.14],[75.06,72.55],[74.79,72.81],[75.37,72.8],[75.6,72.58],[75.74,72.3],[75.27,71.96],[75.5,71.66],[75.28,71.43],[75.73,71.27],[79.02,70.95],[78.49,71.03],[78.21,71.27],[76.43,71.55],[76.03,71.91],[76.87,72.03],[77.55,71.84],[78.19,71.91],[78.02,72.09],[77.41,72.11],[78.48,72.39],[79.42,72.38],[81.66,71.72],[83.11,71.72],[83.23,71.67],[82.98,71.45],[82.32,71.26],[82.16,70.6],[82.22,70.4],[82.59,70.89],[83.01,70.89],[83.03,70.58],[82.68,70.22],[83.08,70.09],[83.07,70.28],[83.74,70.55],[83.15,71.1],[83.53,71.68],[82.09,72.27],[80.83,72.49],[80.66,72.71],[80.84,72.95],[80.42,73.23],[80.58,73.57],[86.89,73.89],[85.79,73.44],[86.68,73.11],[85.91,73.39],[87.57,73.81],[86.0,74.32],[87.23,74.36],[85.79,74.64],[86.2,74.82],[86.86,74.72],[87.47,75.01],[87.01,75.17],[94.16,75.96],[92.99,75.9],[92.86,75.98],[93.26,76.1],[95.58,76.14],[96.08,76.08],[95.65,75.89],[96.5,75.89],[98.66,76.24],[99.77,76.03],[99.54,75.8],[99.85,75.93],[99.83,76.14],[98.81,76.48],[101.6,76.44],[100.93,76.56],[101.1,76.7],[100.91,76.9],[102.61,77.51],[104.02,77.73],[106.06,77.39],[104.2,77.1],[107.43,76.93],[106.41,76.51],[107.72,76.52],[108.18,76.74],[111.11,76.72],[112.09,76.48],[111.94,76.38],[112.62,76.38],[112.8,76.13],[112.66,76.05],[113.27,76.25],[113.56,75.89],[113.86,75.92],[113.57,75.57],[112.47,75.84],[113.73,75.45],[112.92,75.02],[109.84,74.32],[109.81,74.17],[108.2,73.69],[107.27,73.62],[105.14,72.78],[106.48,73.14],[109.86,73.47],[110.87,73.73],[109.75,73.72],[110.26,74.02],[111.55,74.03],[111.23,73.97],[111.4,73.83],[112.15,73.71],[113.03,73.91],[113.42,73.65],[113.16,73.46],[113.49,73.35],[113.47,73.05],[113.16,72.77],[113.67,72.64],[113.22,72.81],[113.89,73.35],[113.51,73.5],[114.06,73.58],[118.45,73.59],[118.94,73.48],[118.46,73.46],[118.43,73.25],[119.75,72.98],[122.54,72.88],[122.75,72.91],[122.53,73.02],[123.16,72.95],[123.62,73.19],[123.32,73.43],[123.42,73.64],[124.54,73.75],[125.6,73.45],[126.25,73.55],[126.55,73.33],[127.03,73.55],[127.74,73.48],[129.1,73.11],[128.6,72.89],[129.25,72.7],[128.42,72.53],[129.28,72.44],[129.41,72.31],[129.28,72.09],[127.73,72.41],[128.91,71.75],[129.21,71.92],[129.46,71.74],[128.84,71.66],[129.76,71.12],[130.76,70.96],[131.02,70.75],[131.56,70.9],[132.65,71.93],[133.69,71.43],[134.7,71.39],[136.09,71.62],[137.94,71.13],[137.84,71.23],[138.31,71.33],[137.92,71.38],[138.23,71.6],[139.98,71.49],[139.69,71.7],[139.72,71.89],[139.36,71.95],[140.19,72.19],[139.18,72.16],[139.14,72.33],[141.08,72.59],[140.65,72.84],[140.81,72.89],[146.25,72.44],[144.9,72.4],[144.17,72.26],[144.47,72.17],[146.83,72.3],[146.11,71.94],[146.23,72.14],[145.76,72.23],[145.76,71.94],[145.06,71.93],[144.99,71.75],[145.19,71.7],[146.07,71.81],[147.26,72.33],[149.5,72.16],[150.02,71.9],[148.92,71.72],[150.67,71.45],[150.1,71.23],[151.58,71.29],[152.09,71.02],[151.76,70.98],[152.51,70.83],[155.9,71.1],[158.7,70.94],[159.91,70.51],[159.83,69.78],[160.91,69.61],[161.04,69.1],[161.34,68.91],[160.86,68.54],[161.57,68.91],[161.54,69.38],[163.2,69.72],[166.88,69.5],[167.86,69.73],[168.3,69.27],[169.31,69.08],[169.61,68.79],[170.54,68.83],[171.0,69.14],[170.58,69.58],[170.16,69.63],[170.5,69.86],[170.49,70.11],[173.28,69.82],[175.92,69.89],[178.85,69.39],[180,68.98],[180,65.07],[178.52,64.6],[176.88,65.08],[176.34,65.05],[177.04,65.0],[177.22,64.86],[177.07,64.79],[176.06,64.96],[174.55,64.68],[176.06,64.91],[176.35,64.7],[176.14,64.59],[177.39,64.77],[177.43,64.44],[177.69,64.31],[178.04,64.22],[178.23,64.36],[178.69,63.84],[178.73,63.67],[178.47,63.57],[179.33,63.19],[179.26,63.01],[179.57,62.77],[179.12,62.32],[177.02,62.78],[177.16,62.56],[173.62,61.72],[173.13,61.41],[172.86,61.47],[172.91,61.31],[172.39,61.06],[170.61,60.44],[170.35,59.97],[169.23,60.6],[167.23,60.41],[166.27,59.86],[166.14,59.98],[166.35,60.48],[165.09,60.1],[164.95,59.84],[164.53,60.06],[164.11,59.9],[163.74,60.03],[163.37,59.78],[163.27,59.3],[162.14,58.45],[161.96,58.08],[162.39,57.72],[162.65,57.95],[163.23,57.79],[162.76,57.24],[162.8,56.81],[163.26,56.69],[163.34,56.23],[162.84,56.07],[162.63,56.23],[163.04,56.52],[162.67,56.49],[162.09,56.09],[161.72,55.5],[162.11,54.75],[161.62,54.52],[160.77,54.54],[160.07,54.19],[159.84,53.78],[160.03,53.13],[159.59,53.24],[158.75,52.91],[158.47,53.03],[158.61,52.87],[158.49,52.38],[158.1,51.81],[156.75,50.97],[155.56,55.2],[156.03,56.75],[156.85,57.29],[156.98,57.47],[156.87,57.8],[158.28,58.01],[162.07,60.47],[163.71,60.92],[163.55,61.03],[164.0,61.34],[163.8,61.46],[164.21,62.29],[165.4,62.49],[164.42,62.7],[163.33,62.55],[163.02,61.89],[163.26,61.7],[163.09,61.57],[162.39,61.66],[160.77,60.75],[160.17,60.64],[160.38,61.02],[159.79,60.96],[160.31,61.89],[159.55,61.72],[159.19,61.93],[157.08,61.68],[154.29,59.83],[154.15,59.53],[154.97,59.45],[155.16,59.19],[154.01,59.08],[153.36,59.22],[152.82,58.93],[152.32,59.03],[151.33,58.88],[151.12,59.08],[152.26,59.22],[151.35,59.56],[150.48,59.49],[149.64,59.77],[149.06,59.63],[149.21,59.49],[148.8,59.53],[148.74,59.37],[148.97,59.37],[148.73,59.26],[146.54,59.46],[146.05,59.17],[145.56,59.41],[142.58,59.24],[140.79,58.3],[140.45,57.81],[138.66,56.97],[137.69,56.14],[135.26,54.94],[135.26,54.73],[135.85,54.58],[136.8,54.62],[136.72,53.8],[137.16,53.82],[137.14,54.18],[137.67,54.28],[137.34,54.1],[137.84,53.95],[137.25,53.55],[137.95,53.6],[138.53,53.96],[138.25,53.52],[138.45,53.54],[138.66,53.74],[138.7,54.32],[139.8,54.26],[141.37,53.29],[141.18,53.02],[140.84,53.09],[141.26,52.84],[141.13,52.44],[141.49,52.18],[140.93,51.62],[140.52,50.8],[140.62,50.08],[140.11,48.42],[138.59,47.06],[137.69,45.82],[135.88,44.37],[135.48,43.84],[134.01,42.95],[133.16,42.7],[132.3,42.88],[132.31,43.31],[131.95,43.09],[132.01,43.28],[131.79,43.26],[131.16,42.63],[130.71,42.66],[130.73,42.33],[130.24,42.18],[129.76,41.71],[129.71,40.86],[127.57,39.78],[127.39,39.21],[128.33,38.68],[129.42,37.06],[129.4,36.05],[129.56,35.95],[129.21,35.18],[128.51,35.1],[128.44,34.87],[127.72,34.95],[127.72,34.72],[127.4,34.82],[127.33,34.46],[127.17,34.55],[127.25,34.76],[126.53,34.31],[126.26,34.67],[126.59,34.82],[126.42,34.82],[126.29,35.15],[126.75,35.87],[126.49,36.69],[126.16,36.77],[126.49,37.01],[126.87,36.82],[126.98,36.94],[126.63,37.78],[126.12,37.74],[125.77,37.98],[125.36,37.73],[124.99,37.93],[125.21,38.08],[124.69,38.13],[125.07,38.56],[125.55,38.69],[125.17,38.81],[125.36,39.53],[124.78,39.76],[124.64,39.62],[124.35,40.01],[122.84,39.6],[121.16,38.73],[121.11,38.92],[121.68,39.11],[121.82,39.39],[121.28,39.38],[121.27,39.55],[122.26,40.5],[121.83,40.97],[121.17,40.9],[120.48,40.23],[119.39,39.75],[118.98,39.18],[117.78,39.13],[117.55,38.69],[117.66,38.42],[118.02,38.18],[118.94,38.04],[119.09,37.7],[118.95,37.33],[119.29,37.14],[119.76,37.16],[120.26,37.68],[120.75,37.83],[121.64,37.46],[122.67,37.4],[122.34,36.83],[121.93,36.96],[120.81,36.63],[120.9,36.44],[120.71,36.41],[120.64,36.13],[120.18,36.2],[120.28,35.98],[119.43,35.3],[119.17,34.85],[120.27,34.27],[120.87,33.02],[120.85,32.66],[121.34,32.42],[121.86,31.82],[121.68,31.71],[120.52,32.11],[120.04,31.94],[120.72,31.98],[121.66,31.32],[121.88,30.92],[120.82,30.36],[120.19,30.24],[120.5,30.3],[120.63,30.13],[121.26,30.3],[122.08,29.87],[121.51,29.48],[121.89,29.63],[121.97,29.49],[121.92,29.14],[121.72,29.26],[121.45,29.13],[121.68,28.95],[121.47,28.64],[121.61,28.29],[121.15,28.33],[120.75,28.01],[120.61,27.41],[120.09,26.67],[119.59,26.79],[119.88,26.33],[119.46,26.05],[119.14,26.12],[119.33,25.95],[119.62,26.0],[119.62,25.39],[119.18,25.45],[119.29,25.23],[118.98,25.21],[118.91,24.93],[118.64,24.84],[118.66,24.62],[117.84,24.47],[118.06,24.25],[117.37,23.59],[116.91,23.65],[116.47,22.95],[115.5,22.72],[115.2,22.82],[114.85,22.62],[114.65,22.75],[114.55,22.53],[114.27,22.54],[114.27,22.3],[113.9,22.4],[114.02,22.51],[113.52,23.1],[113.33,22.91],[113.55,22.22],[113.15,22.07],[113.09,22.21],[112.95,21.91],[112.59,21.78],[112.36,21.98],[112.31,21.74],[111.94,21.85],[111.6,21.56],[111.02,21.51],[110.57,21.21],[110.41,21.34],[110.15,20.95],[110.51,20.52],[110.34,20.3],[109.94,20.3],[109.66,20.92],[109.93,21.48],[109.52,21.69],[109.54,21.54],[109.08,21.44],[109.1,21.59],[108.77,21.63],[108.59,21.9],[108.5,21.63],[107.81,21.5],[107.17,20.95],[106.68,21.0],[106.75,20.73],[106.52,20.29],[105.98,19.94],[105.62,18.97],[106.5,17.95],[106.37,17.75],[107.83,16.32],[108.03,16.33],[108.82,15.38],[109.3,13.86],[109.44,12.6],[109.34,12.75],[109.22,12.65],[109.26,11.96],[108.99,11.34],[107.26,10.4],[107.01,10.66],[106.95,10.4],[106.61,10.46],[106.76,10.3],[106.46,10.3],[106.78,10.12],[106.6,9.86],[106.14,10.22],[106.57,9.64],[106.38,9.56],[105.83,10.0],[106.17,9.4],[105.5,9.09],[105.11,8.63],[104.77,8.6],[105.03,10.07],[104.26,10.54],[103.59,10.55],[103.72,10.89],[103.53,11.15],[103.15,10.91],[103.12,11.46],[102.59,12.2],[101.72,12.69],[100.9,12.65],[100.96,13.43],[100.6,13.57],[100.02,13.35],[99.99,12.17],[99.17,10.32],[99.25,9.27],[99.84,9.29],[99.99,8.59],[100.28,8.27],[100.55,7.23],[100.26,7.78],[100.16,7.6],[100.42,7.19],[101.02,6.86],[101.5,6.87],[103.2,5.26],[103.45,4.67],[103.44,2.93],[103.97,2.26],[104.29,1.48],[104.18,1.36],[103.98,1.62],[103.99,1.46],[103.48,1.33],[101.3,2.88],[101.3,3.25],[100.72,3.97],[100.12,6.44],[99.7,6.88],[99.6,7.36],[99.36,7.37],[98.7,8.26],[98.31,8.23],[98.24,8.77],[98.7,10.19],[98.56,10.04],[98.47,10.68],[98.88,11.72],[98.64,11.74],[98.58,13.16],[98.2,13.98],[98.11,13.71],[98.02,14.65],[97.81,14.86],[97.58,16.02],[97.73,16.57],[97.38,16.52],[97.2,17.09],[96.85,17.4],[96.77,16.71],[96.43,16.5],[96.19,16.77],[96.32,16.44],[95.76,16.17],[95.39,15.72],[95.35,16.1],[95.18,15.83],[94.94,15.82],[94.89,16.18],[94.66,15.9],[94.7,16.51],[94.22,16.02],[94.59,17.57],[94.05,19.29],[93.93,18.9],[93.49,19.37],[93.83,19.24],[94.0,19.44],[93.61,19.78],[93.71,19.91],[93.25,20.07],[93.13,19.86],[93.07,20.38],[92.83,20.18],[92.74,20.56],[92.72,20.3],[92.31,20.79],[92.06,21.18],[91.86,22.35],[91.48,22.89],[90.95,22.6],[90.66,23.02],[90.6,23.59],[90.56,23.42],[90.27,23.46],[90.59,23.27],[90.44,22.75],[90.62,22.36],[90.23,21.83],[90.07,21.89],[90.21,22.16],[89.92,22.12],[89.98,22.47],[89.57,21.77],[89.48,22.28],[89.35,21.72],[89.05,22.09],[89.05,21.65],[88.86,21.75],[88.75,21.58],[88.64,22.12],[88.58,21.66],[88.12,21.64],[88.2,22.14],[87.94,22.37],[88.16,22.12],[87.95,21.82],[86.86,21.24],[86.97,20.7],[86.75,20.31],[86.25,20.05],[86.28,19.92],[85.25,19.76],[85.18,19.59],[85.44,19.63],[84.1,18.29],[82.36,17.1],[82.26,16.56],[81.29,16.34],[80.98,15.76],[80.65,15.89],[80.29,15.71],[80.05,15.07],[80.31,13.48],[80.16,13.71],[80.06,13.61],[80.34,13.36],[79.69,11.31],[79.85,11.2],[79.84,10.32],[79.31,10.26],[78.94,9.57],[79.02,9.33],[79.41,9.19],[78.42,9.11],[78.06,8.38],[77.52,8.08],[76.55,8.9],[76.35,9.92],[75.72,11.36],[74.95,12.56],[74.38,14.49],[73.34,16.46],[72.88,18.64],[73.01,19.02],[72.8,19.08],[72.81,19.3],[72.99,19.28],[72.79,19.36],[72.67,19.83],[72.89,20.67],[72.61,21.46],[73.11,21.75],[72.54,21.7],[72.7,21.97],[72.52,21.98],[72.55,22.16],[72.81,22.23],[72.18,22.27],[72.27,22.09],[72.04,21.82],[72.25,21.53],[72.02,21.16],[71.03,20.74],[70.48,20.84],[68.97,22.29],[69.05,22.44],[69.28,22.29],[70.18,22.57],[70.49,23.09],[69.67,22.76],[68.82,23.05],[68.42,23.57],[68.78,23.85],[68.23,23.6],[68.17,23.86],[67.56,23.88],[67.17,24.76],[66.7,24.86],[66.7,25.23],[66.43,25.57],[66.13,25.49],[66.47,25.45],[64.66,25.18],[64.06,25.4],[63.49,25.21],[61.41,25.1],[60.51,25.44],[60.4,25.31],[59.05,25.42],[57.8,25.65],[57.34,25.79],[57.04,26.8],[56.73,27.13],[56.12,27.14],[54.65,26.51],[53.71,26.73],[52.48,27.62],[51.59,27.86],[50.07,30.2],[49.55,30.03],[49.0,30.51],[48.83,30.04],[47.98,30.01],[48.14,29.57],[47.72,29.39],[48.05,29.36],[48.8,27.72],[50.15,26.66],[50.01,26.68],[50.21,26.31],[50.08,25.96],[50.8,24.79],[50.76,25.4],[51.0,25.98],[51.26,26.15],[51.54,25.9],[51.61,25.05],[51.27,24.61],[51.42,24.53],[51.31,24.34],[51.6,24.34],[51.84,24.01],[52.12,23.97],[52.65,24.16],[54.15,24.17],[56.41,26.35],[56.37,25.02],[56.64,24.47],[57.22,23.92],[58.77,23.52],[59.43,22.66],[59.82,22.51],[59.82,22.3],[58.47,20.41],[58.21,20.42],[58.17,20.59],[57.86,20.24],[57.71,19.68],[57.81,19.02],[56.83,18.75],[56.38,17.99],[55.48,17.84],[55.06,17.04],[54.07,17.01],[52.58,16.47],[52.24,16.17],[52.22,15.66],[49.35,14.64],[48.67,14.05],[47.99,14.05],[46.79,13.47],[45.66,13.34],[45.04,12.82],[43.93,12.62],[43.49,12.7],[43.23,13.27],[43.28,13.69],[42.94,14.94],[42.66,15.23],[42.8,15.33],[42.79,16.45],[42.29,17.43],[41.66,18.01],[40.76,19.75],[39.73,20.39],[39.28,20.97],[38.99,21.88],[39.06,22.59],[38.46,23.71],[37.54,24.29],[37.18,24.82],[37.15,25.29],[35.18,28.04],[34.62,28.07],[34.97,29.55],[34.22,27.76],[33.25,28.57],[32.47,29.93],[32.36,29.63],[32.66,28.93],[33.55,27.9],[33.96,26.65],[35.19,24.48],[35.78,23.94],[35.5,23.78],[35.7,22.95],[36.83,22.1],[37.26,21.11],[37.19,20.12],[37.47,18.82],[38.57,18.07],[39.51,15.53],[39.79,15.12],[39.86,15.47],[40.2,15.01],[41.18,14.62],[41.66,13.98],[42.24,13.59],[42.4,13.21],[43.08,12.82],[43.35,12.37],[43.34,12.03],[42.54,11.5],[43.16,11.57],[44.28,10.47],[44.94,10.44],[45.82,10.84],[46.56,10.75],[47.41,11.17],[50.11,11.53],[50.79,11.98],[51.26,11.83],[51.03,10.45],[51.19,10.55],[51.38,10.39],[50.93,10.34],[50.83,9.43],[47.98,4.5],[46.05,2.48],[43.72,0.86],[41.98,-0.97],[41.39,-1.87],[40.89,-2.02],[40.81,-2.39],[40.22,-2.69],[40.12,-3.25],[39.49,-4.48],[39.23,-4.67],[38.8,-6.07],[39.55,-7.02],[39.29,-7.52],[39.44,-8.01],[39.3,-8.44],[39.64,-9.19],[39.73,-10.0],[40.61,-10.66],[40.4,-11.33],[40.58,-12.64],[40.44,-12.98],[40.57,-12.98],[40.65,-14.54],[40.82,-14.47],[40.84,-14.79],[39.84,-16.44],[39.08,-16.97],[37.51,-17.57],[36.94,-17.99],[36.4,-18.77],[35.85,-18.99],[34.95,-19.81],[34.65,-19.7],[34.7,-20.47],[35.27,-21.65],[35.32,-22.4],[35.46,-22.12],[35.54,-22.3],[35.44,-24.17],[34.99,-24.65],[33.35,-25.26],[32.79,-25.64],[32.59,-26.0],[32.85,-26.27],[32.95,-26.08],[32.89,-26.83],[32.38,-28.5],[31.34,-29.38],[29.97,-31.32],[27.86,-33.05],[26.61,-33.71],[25.81,-33.74],[25.57,-34.03],[25.0,-33.97],[24.6,-34.17],[22.55,-34.01],[21.79,-34.37],[20.53,-34.46],[20.02,-34.79],[18.83,-34.36],[18.75,-34.08],[18.5,-34.11],[18.46,-34.35],[18.35,-34.19],[18.43,-33.72],[17.85,-32.83],[18.32,-32.51],[18.21,-31.74],[17.35,-30.45],[16.74,-29.01],[15.34,-27.39],[14.97,-26.32],[14.84,-25.03],[14.5,-24.2],[14.46,-22.45],[11.78,-18.0],[11.75,-15.83],[12.02,-15.51],[12.55,-13.44],[13.69,-12.12],[13.85,-11.05],[13.0,-9.05],[13.36,-8.69],[13.38,-8.37],[12.82,-6.96],[12.28,-6.12],[13.07,-5.87],[12.45,-6.0],[12.24,-5.81],[11.78,-4.57],[9.72,-2.47],[10.06,-2.55],[9.62,-2.37],[9.04,-1.31],[9.32,-1.63],[9.5,-1.55],[9.06,-1.3],[8.7,-0.59],[8.95,-0.69],[9.3,-0.35],[9.36,0.34],[9.8,0.04],[10.0,0.2],[9.55,0.3],[9.32,0.55],[9.62,0.58],[9.6,1.05],[9.39,1.14],[9.81,1.93],[9.95,3.08],[9.56,3.8],[9.74,3.85],[9.69,4.06],[9.43,3.92],[9.0,4.09],[8.92,4.55],[8.66,4.67],[8.57,4.53],[8.57,4.75],[8.25,4.92],[8.29,4.56],[7.28,4.55],[7.08,4.72],[7.16,4.51],[6.92,4.39],[6.77,4.72],[6.86,4.37],[6.58,4.48],[6.08,4.29],[5.49,4.84],[5.37,5.34],[5.55,5.47],[5.2,5.53],[5.46,5.61],[5.11,5.64],[4.43,6.35],[3.45,6.43],[3.72,6.6],[3.34,6.4],[1.31,6.15],[0.95,5.81],[0.26,5.76],[-2.0,4.76],[-3.25,5.11],[-3.02,5.13],[-3.2,5.35],[-3.35,5.13],[-4.12,5.31],[-5.28,5.21],[-5.06,5.13],[-5.91,5.01],[-7.54,4.35],[-8.26,4.59],[-9.13,5.05],[-11.73,7.09],[-12.49,7.39],[-12.48,7.75],[-12.85,7.82],[-13.27,8.43],[-12.89,8.63],[-13.18,8.58],[-13.21,8.84],[-13.06,8.88],[-13.69,9.54],[-13.69,9.93],[-14.43,10.25],[-14.59,10.77],[-14.89,10.97],[-15.01,10.8],[-15.05,11.14],[-15.22,11.03],[-15.39,11.22],[-15.43,11.5],[-15.07,11.6],[-15.5,11.78],[-15.08,11.97],[-15.94,11.79],[-15.92,11.94],[-16.33,12.05],[-16.25,12.24],[-16.79,12.47],[-16.44,12.61],[-16.77,12.63],[-16.75,13.43],[-16.41,13.27],[-15.43,13.47],[-16.44,13.35],[-16.77,13.9],[-16.62,14.04],[-16.79,14.0],[-17.17,14.64],[-17.54,14.76],[-17.15,14.92],[-16.57,15.73],[-16.46,16.6],[-16.08,17.55],[-16.09,18.52],[-16.51,19.36],[-16.3,19.51],[-16.45,19.47],[-16.21,20.23],[-16.88,21.09],[-17.1,20.86],[-16.93,21.9],[-16.36,22.59],[-15.79,23.79],[-15.98,23.67],[-15.9,23.84],[-14.9,24.72],[-14.47,26.16],[-13.58,26.73],[-12.95,27.91],[-11.55,28.31],[-10.2,29.38],[-9.67,30.11],[-9.65,30.45],[-9.88,30.72],[-9.81,31.43],[-9.35,32.09],[-9.25,32.57],[-8.51,33.25],[-6.9,33.97],[-5.92,35.79],[-5.28,35.9],[-5.25,35.62],[-4.63,35.21],[-3.4,35.21],[-2.97,35.41],[-2.84,35.13],[-1.91,35.09],[1.26,36.52],[3.78,36.9],[4.76,36.9],[5.29,36.65],[6.49,37.09],[6.93,36.92],[7.43,37.06],[7.91,36.86],[9.69,37.34],[9.83,37.13],[10.2,37.21],[10.41,36.73],[10.95,37.06],[11.13,36.87],[10.49,36.26],[11.12,35.24],[10.06,34.21],[10.3,33.73],[10.71,33.69],[10.72,33.51],[10.96,33.63],[11.2,33.25],[12.28,32.86],[13.28,32.91],[15.18,32.39],[15.71,31.43],[17.83,30.93],[18.94,30.29],[19.59,30.41],[20.01,30.8],[20.14,31.2],[19.93,31.82],[20.12,32.22],[21.64,32.94],[23.09,32.62],[23.29,32.21],[24.88,31.98],[25.23,31.53],[26.77,31.47],[29.07,30.83],[31.08,31.6],[31.89,31.54],[32.14,31.34],[31.89,31.48],[31.77,31.29],[32.1,31.09],[32.25,31.3],[32.6,31.07],[33.9,31.18],[34.48,31.59],[35.65,34.25],[35.98,34.55],[35.81,36.31],[36.18,36.81],[36.05,36.91],[35.39,36.58],[34.7,36.82],[33.7,36.18],[32.8,36.04],[31.24,36.82],[30.64,36.87],[30.45,36.27],[29.69,36.16],[29.22,36.32],[28.97,36.72],[27.54,36.68],[28.24,37.03],[27.26,36.98],[27.54,37.16],[27.07,37.66],[27.23,37.98],[26.29,38.28],[26.44,38.64],[26.67,38.34],[27.14,38.45],[26.76,38.71],[27.01,38.89],[26.68,39.29],[26.9,39.55],[26.11,39.47],[26.18,39.99],[26.74,40.4],[29.01,40.39],[28.79,40.53],[29.85,40.76],[29.11,40.94],[29.15,41.22],[31.25,41.11],[32.31,41.73],[33.38,42.02],[35.01,42.06],[35.56,41.63],[36.05,41.68],[36.41,41.27],[36.78,41.36],[38.38,40.92],[39.43,41.11],[40.27,40.96],[41.41,41.42],[41.76,41.97],[41.42,42.74],[39.87,43.47],[38.72,44.29],[36.63,45.15],[36.94,45.29],[36.72,45.37],[36.87,45.43],[37.21,45.27],[37.65,45.38],[37.93,46.0],[38.49,46.09],[37.77,46.64],[38.5,46.66],[38.44,46.81],[39.27,47.04],[39.2,47.27],[37.54,47.08],[36.8,46.71],[35.83,46.62],[35.02,46.11],[35.28,46.28],[35.23,46.44],[34.85,46.19],[35.02,45.7],[35.46,45.32],[36.58,45.39],[36.39,45.06],[35.47,45.1],[33.91,44.39],[33.45,44.55],[33.55,45.1],[32.51,45.4],[33.66,45.95],[33.59,46.1],[32.48,46.08],[31.83,46.28],[32.01,46.43],[31.55,46.55],[32.36,46.48],[32.58,46.62],[32.04,46.64],[31.76,47.21],[31.87,46.65],[31.56,46.78],[30.8,46.55],[30.22,45.87],[29.63,45.72],[29.73,45.34],[29.56,44.84],[29.05,44.76],[29.09,44.98],[28.93,44.97],[28.56,43.5],[28.13,43.4],[27.89,42.75],[27.48,42.47],[27.98,42.05],[28.2,41.55],[29.06,41.23],[28.96,41.01],[27.5,40.97],[26.2,40.08],[26.25,40.31],[26.79,40.63],[26.11,40.61],[25.86,40.84],[25.1,40.99],[23.76,40.75],[23.87,40.42],[24.34,40.15],[23.73,40.33],[23.95,39.97],[23.43,40.26],[23.63,39.92],[23.4,39.99],[23.31,40.22],[22.9,40.4],[22.92,40.59],[22.63,40.5],[22.59,40.04],[23.33,39.17],[23.16,39.1],[23.16,39.26],[22.92,39.31],[23.07,39.04],[22.57,38.87],[23.25,38.66],[24.02,38.14],[24.02,37.68],[23.5,38.03],[23.04,37.88],[23.49,37.44],[23.16,37.33],[22.73,37.54],[23.16,36.45],[22.72,36.79],[22.43,36.48],[22.08,37.03],[21.89,36.74],[21.58,37.08],[21.68,37.39],[21.12,37.89],[21.82,38.33],[22.92,37.96],[23.15,38.18],[22.42,38.44],[21.11,38.38],[20.77,38.87],[21.12,39.03],[20.78,39.01],[20.3,39.33],[19.85,40.04],[19.4,40.28],[19.58,41.79],[18.65,42.44],[17.05,43.02],[17.72,42.85],[16.9,43.39],[15.99,43.52],[15.19,44.17],[15.47,44.27],[14.98,44.6],[14.86,45.08],[14.55,45.3],[14.31,45.34],[13.86,44.84],[13.52,45.48],[13.78,45.63],[13.63,45.77],[12.27,45.45],[12.23,45.24],[12.52,44.97],[12.25,44.72],[12.4,44.22],[13.56,43.57],[14.01,42.69],[14.54,42.24],[15.17,41.93],[16.16,41.9],[15.9,41.51],[17.95,40.66],[18.46,40.22],[18.34,39.82],[17.86,40.28],[16.93,40.46],[16.52,39.75],[17.11,39.38],[17.18,39.0],[16.62,38.8],[16.55,38.41],[16.06,37.94],[15.65,38.03],[16.21,38.94],[15.69,39.99],[14.95,40.24],[14.77,40.67],[14.34,40.6],[14.46,40.73],[14.04,40.81],[13.73,41.24],[13.09,41.24],[11.64,42.29],[11.14,42.39],[11.17,42.53],[10.52,42.97],[10.19,43.95],[8.77,44.42],[8.01,43.88],[7.26,43.7],[6.12,43.07],[4.05,43.59],[3.26,43.19],[3.04,42.84],[3.31,42.29],[3.17,42.26],[3.25,41.94],[2.08,41.29],[1.03,41.06],[0.71,40.82],[0.89,40.72],[0.6,40.62],[-0.33,39.52],[-0.2,39.06],[0.2,38.76],[-0.52,38.32],[-0.81,37.77],[-0.72,37.63],[-1.64,37.39],[-2.19,36.74],[-4.37,36.72],[-5.17,36.42],[-5.62,36.03],[-6.04,36.19],[-6.38,36.64],[-6.22,36.91],[-6.4,36.83],[-6.86,37.28],[-7.83,37.01],[-9.0,37.03],[-8.81,37.43],[-8.88,38.45],[-8.67,38.42],[-9.21,38.45],[-9.25,38.66],[-8.79,39.08],[-9.14,38.74],[-9.48,38.8],[-8.69,40.75],[-8.89,41.77],[-8.89,42.1],[-8.69,42.27],[-8.81,42.64],[-9.03,42.59],[-8.93,42.8],[-9.23,42.98],[-9.18,43.17],[-7.7,43.77],[-7.06,43.55],[-5.85,43.65],[-4.52,43.42],[-3.6,43.52],[-1.99,43.34],[-1.49,43.56],[-1.08,44.69],[-1.25,44.67],[-1.08,45.53],[-0.55,45.0],[-0.79,45.47],[-1.2,45.71],[-1.03,45.74],[-1.15,46.31],[-1.79,46.52],[-2.09,46.87],[-2.15,47.22],[-1.74,47.22],[-2.5,47.31],[-2.43,47.47],[-2.79,47.63],[-4.31,47.82],[-4.68,48.04],[-4.33,48.17],[-4.58,48.29],[-4.24,48.3],[-4.72,48.36],[-4.72,48.54],[-3.23,48.84],[-2.69,48.54],[-1.38,48.65],[-1.86,49.68],[-1.26,49.68],[-1.14,49.39],[-0.16,49.3],[0.42,49.45],[0.13,49.51],[0.19,49.7],[1.41,50.09],[1.77,50.94],[3.43,51.39],[4.23,51.39],[3.45,51.54],[4.27,51.47],[4.0,51.6],[4.18,51.61],[3.95,51.81],[4.03,51.93],[4.48,52.31],[4.77,52.94],[5.53,53.27],[6.82,53.44],[7.2,53.28],[7.05,53.38],[7.21,53.66],[7.63,53.7],[8.01,53.69],[8.2,53.43],[8.33,53.61],[8.49,53.39],[8.62,53.88],[9.21,53.86],[9.78,53.55],[8.98,53.93],[8.91,54.26],[8.64,54.3],[8.96,54.54],[8.68,54.79],[8.65,55.33],[8.13,55.6],[8.16,56.61],[8.67,56.5],[8.89,56.73],[9.2,56.7],[9.26,57.01],[9.11,57.04],[8.77,56.73],[8.27,56.75],[8.62,57.11],[9.43,57.17],[9.96,57.58],[10.61,57.74],[10.28,56.62],[10.93,56.44],[10.75,56.24],[10.32,56.21],[10.18,55.87],[9.9,55.84],[10.02,55.76],[9.59,55.49],[9.67,55.27],[9.45,55.04],[10.02,54.67],[9.87,54.47],[11.01,54.38],[10.86,54.01],[11.4,53.95],[12.57,54.47],[13.03,54.41],[13.72,54.15],[13.95,53.8],[14.58,53.64],[14.56,53.82],[13.93,53.88],[13.83,54.13],[14.38,53.92],[18.09,54.84],[18.76,54.69],[18.44,54.74],[18.84,54.37],[19.41,54.39],[19.86,54.63],[19.98,54.92],[20.68,55.1],[21.11,55.62],[20.59,54.98],[21.19,54.94],[21.03,56.64],[21.73,57.57],[22.55,57.72],[23.65,56.97],[24.38,57.25],[24.3,57.78],[24.53,58.35],[23.77,58.36],[23.51,58.66],[23.68,58.79],[23.43,58.92],[23.49,59.2],[25.51,59.64],[27.89,59.41],[28.06,59.78],[28.34,59.69],[29.15,60.0],[30.12,59.87],[29.72,60.2],[28.64,60.38],[28.51,60.68],[26.54,60.41],[26.57,60.62],[25.76,60.27],[23.02,59.82],[23.2,60.02],[22.91,60.21],[22.46,60.03],[22.59,60.38],[21.44,60.6],[21.36,60.97],[21.61,61.59],[21.26,61.99],[21.34,62.28],[21.1,62.62],[21.65,63.04],[21.55,63.2],[22.32,63.31],[22.24,63.44],[22.53,63.65],[23.6,64.04],[24.56,64.8],[25.29,64.86],[25.37,65.01],[25.35,65.48],[24.68,65.67],[24.63,65.86],[23.1,65.73],[22.4,65.86],[22.25,65.6],[21.41,65.32],[21.57,65.13],[21.14,64.81],[21.52,64.46],[20.76,63.87],[18.61,63.18],[18.31,63.0],[18.46,62.9],[17.88,62.87],[18.04,62.6],[17.38,62.46],[17.63,62.23],[17.38,61.87],[17.46,61.68],[17.2,61.73],[17.13,61.58],[17.25,60.7],[17.96,60.59],[18.99,59.83],[17.98,59.33]],[[50.68,46.94],[49.35,46.52],[49.25,46.29],[48.68,46.09],[48.73,45.9],[47.63,45.58],[47.46,45.68],[47.35,45.22],[46.72,44.45],[47.31,44.1],[47.46,43.55],[47.65,43.88],[47.46,43.03],[47.73,42.68],[49.46,40.8],[50.37,40.28],[49.55,40.19],[49.36,39.35],[49.16,39.03],[48.96,39.08],[48.87,38.39],[49.08,37.67],[50.13,37.41],[50.93,36.81],[51.76,36.62],[53.77,36.93],[53.97,36.82],[53.87,38.95],[53.7,39.21],[53.16,39.27],[53.24,39.61],[53.6,39.55],[53.49,39.91],[52.99,39.99],[53.04,39.77],[52.73,40.4],[52.94,41.04],[53.87,40.65],[54.38,40.69],[54.32,40.84],[54.69,40.87],[54.7,41.07],[54.09,41.52],[53.75,42.13],[52.97,41.98],[52.85,41.2],[52.47,41.89],[52.6,42.76],[51.3,43.17],[51.3,43.48],[50.83,44.19],[50.25,44.41],[50.41,44.62],[51.54,44.53],[51.01,44.92],[51.42,45.36],[53.2,45.33],[52.77,45.57],[53.13,46.19],[53.17,46.67],[52.92,46.95],[52.14,46.83],[51.18,47.11],[50.68,46.94]]]} \ No newline at end of file diff --git a/Java/model/earth-geography/earth-geography.model/continents.json b/Java/model/earth-geography/earth-geography.model/continents.json new file mode 100644 index 0000000..015f3d5 --- /dev/null +++ b/Java/model/earth-geography/earth-geography.model/continents.json @@ -0,0 +1 @@ +{"continents":[{"id":"eurasia","nameI18n":{"zh-CN":"亚欧大陆","en":"Eurasia"},"label":[85,52],"lines":[[[127.7,0.8],[127.9,0.8],[128.2,1.4],[128.7,1.6],[128.7,1.1],[128.3,0.9],[128.3,0.7],[128.9,0.2],[128.0,0.5],[127.9,0.3]],[[127.7,0.3],[127.4,1.1],[127.6,1.8],[128.0,2.2],[128.0,1.3],[127.7,0.8]],[[63.4,80.7],[62.5,80.8],[63.1,81.0],[64.1,81.0],[64.3,81.2],[65.4,81.1],[65.4,80.9],[63.4,80.7]],[[117.3,8.4],[117.3,8.7],[119.2,10.5],[119.3,11.0],[119.6,11.3],[119.5,11.0],[119.7,10.5],[118.8,9.9],[118.4,9.3],[117.3,8.4]],[[122.5,11.6],[122.8,11.6],[122.9,11.4],[123.2,11.5],[122.8,10.8],[122.0,10.4],[122.1,11.6],[121.9,11.9],[122.5,11.6]],[[123.1,9.1],[122.4,9.8],[122.5,10.0],[122.9,10.1],[122.8,10.5],[123.0,10.9],[123.3,11.0],[123.6,10.8],[123.2,9.9],[123.3,9.3],[123.1,9.1]],[[124.6,11.3],[124.9,11.4],[125.3,10.3],[125.1,10.2],[125.0,10.4],[125.0,10.0],[124.8,10.2],[124.7,11.0],[124.4,10.9],[124.3,11.5],[124.6,11.3]],[[125.2,12.5],[125.5,12.2],[125.7,11.1],[125.2,11.1],[124.9,11.6],[125.0,11.8],[124.4,12.2],[124.3,12.6],[125.2,12.5]],[[120.7,13.5],[121.2,13.4],[121.5,13.1],[121.5,12.6],[121.2,12.2],[120.5,13.4],[120.3,13.4],[120.7,13.5]],[[22.6,58.6],[23.3,58.5],[22.0,57.9],[22.2,58.2],[21.9,58.3],[21.9,58.5],[22.6,58.6]],[[21.6,78.6],[22.0,78.6],[22.3,78.2],[23.0,78.3],[23.5,78.1],[23.1,78.0],[24.9,77.8],[22.8,77.3],[22.4,77.3],[22.7,77.6],[21.1,77.4],[20.9,77.6],[21.7,77.9],[20.2,78.5],[21.6,78.6]],[[47.4,80.9],[48.4,80.8],[48.7,80.6],[47.7,80.8],[46.1,80.4],[46.0,80.6],[44.9,80.6],[47.4,80.9]],[[50.3,80.9],[51.7,80.7],[51.0,80.5],[48.8,80.4],[48.7,80.3],[49.0,80.2],[48.4,80.1],[46.6,80.3],[49.1,80.5],[49.2,80.8],[50.3,80.9]],[[50.3,69.2],[50.2,69.0],[48.9,68.7],[48.4,68.8],[48.3,69.0],[48.4,69.3],[49.0,69.5],[50.3,69.2]],[[23.9,35.5],[24.2,35.6],[24.1,35.5],[24.4,35.4],[25.7,35.3],[25.8,35.1],[26.3,35.3],[26.2,35.0]],[[23.9,35.5],[24.2,35.6],[24.1,35.5],[24.4,35.4],[25.7,35.3],[25.8,35.1],[26.3,35.3],[26.2,35.0],[24.8,34.9],[24.5,35.2],[23.6,35.3],[23.7,35.7],[23.9,35.5]],[[23.4,39.0],[23.5,38.8],[24.1,38.6],[24.6,38.0],[22.9,38.9],[23.4,39.0]],[[34.5,35.6],[33.9,35.3],[34.0,35.0],[33.0,34.6],[32.4,34.7],[32.3,35.1],[32.9,35.2],[32.9,35.4],[34.5,35.6]],[[19.1,57.8],[18.8,57.7],[18.9,57.4],[18.1,56.9],[18.3,57.1],[18.1,57.6],[18.9,57.9],[19.1,57.8]],[[12.6,55.8],[12.2,55.5],[12.4,55.3],[12.1,55.2],[12.1,54.8],[11.9,54.8],[11.7,55.2],[11.3,55.2],[11.0,55.7],[11.6,56.0],[11.8,55.7],[11.9,56.0],[12.2,56.1],[12.6,56.1],[12.6,55.8]],[[96.5,81.1],[97.9,80.7],[97.1,80.6],[97.0,80.5],[97.4,80.3],[97.2,80.2],[93.9,80.0],[91.5,80.4],[92.8,80.6],[93.3,80.8],[92.6,80.8],[93.4,81.0],[95.8,81.3],[96.5,81.1]],[[97.7,80.2],[98.0,80.0],[97.6,79.8],[98.4,79.9],[98.6,80.1],[100.1,79.8],[99.7,79.3],[99.0,79.3],[99.9,79.0],[99.4,78.8],[94.8,79.1],[94.2,79.4],[93.1,79.5],[95.0,80.1],[97.7,80.2]],[[102.9,79.3],[102.4,78.8],[103.0,79.1],[103.8,79.1],[105.1,78.8],[105.3,78.5],[104.7,78.3],[99.3,78.0],[100.0,78.3],[100.4,78.8],[101.0,78.8],[100.9,78.9],[101.5,79.3],[102.9,79.3]],[[140.0,75.8],[140.8,75.6],[141.0,76.0],[141.5,76.1],[143.7,75.9],[145.4,75.5],[144.7,75.4],[144.9,75.3],[144.0,75.0],[142.8,75.3],[142.7,75.5],[143.0,75.6],[142.9,75.7],[142.1,75.7],[142.6,75.1],[143.1,75.0],[142.5,74.8],[142.0,75.0],[140.3,74.8],[139.7,75.0],[139.1,74.7],[138.1,74.8],[136.9,75.3],[137.3,75.3],[137.2,75.6],[137.7,75.8],[137.5,75.9],[137.6,76.0],[138.2,76.1],[138.9,76.2],[140.0,75.8]],[[142.2,73.9],[143.5,73.5],[143.5,73.2],[140.7,73.5],[139.7,73.4],[140.4,73.5],[141.1,73.9],[142.2,73.9]],[[146.8,75.4],[150.8,75.2],[150.6,74.9],[148.1,74.8],[146.1,75.2],[146.4,75.6],[146.8,75.4]],[[126.0,9.3],[126.2,9.3],[126.3,9.0],[126.1,8.6],[126.4,8.5],[126.6,7.2],[126.2,6.9],[126.2,6.3],[125.7,7.3],[125.4,6.7],[125.7,6.0],[125.3,5.6],[125.2,6.1],[124.9,5.9],[124.2,6.2],[124.0,7.0],[124.2,7.4],[124.0,7.7],[123.5,7.8],[123.4,7.4],[123.1,7.7],[122.8,7.5],[122.6,7.8],[122.0,7.0],[121.9,7.2],[122.2,7.9],[122.9,8.2],[123.4,8.7],[123.7,8.6],[123.8,8.0],[124.2,8.2],[124.4,8.6],[124.7,8.6],[124.9,9.0],[125.5,9.0],[125.5,9.8],[126.0,9.3]],[[121.1,18.6],[121.8,18.3],[122.3,18.5],[122.2,17.7],[122.5,17.1],[122.1,16.2],[121.6,15.9],[121.4,15.3],[121.7,14.8],[121.6,14.6],[121.9,14.0],[122.2,13.9],[122.2,14.1],[122.6,14.3],[122.9,14.2],[123.1,13.8],[123.3,13.8],[123.3,14.1],[123.8,13.8],[123.5,13.6],[123.8,13.1],[124.1,13.0],[124.1,12.6],[123.9,12.9],[123.3,13.0],[123.2,13.4],[122.6,13.9],[122.6,13.2],[121.8,13.9],[121.3,13.6],[120.8,13.9],[120.6,13.8],[120.6,14.2],[120.9,14.6],[120.6,14.9],[120.6,14.5],[120.4,14.5],[120.1,14.9],[119.8,16.3],[120.2,16.0],[120.4,16.1],[120.3,16.6],[120.6,18.5],[121.1,18.6]],[[124.9,1.0],[124.4,0.5],[123.8,0.3],[123.3,0.3],[123.0,0.5],[120.6,0.5],[120.2,0.3]],[[119.9,0.0],[119.8,0.2],[120.3,1.0],[120.4,0.8],[120.9,1.3],[122.8,0.8],[123.9,0.8],[125.1,1.7],[125.2,1.5],[124.9,1.0]],[[96.5,5.2],[97.5,5.2],[98.3,4.1],[99.7,3.2],[100.5,2.2],[100.9,1.9],[100.8,2.2],[101.0,2.3],[102.4,0.8],[103.0,0.6],[103.0,0.4],[102.5,0.2],[103.3,0.5],[103.7,0.3],[103.8,0.0]],[[99.7,0.0],[99.2,0.4],[98.6,1.9],[97.7,2.4],[97.0,3.6],[96.4,3.8],[95.2,5.3],[95.2,5.6],[95.6,5.6],[96.5,5.2]],[[116.8,6.7],[117.1,7.0],[117.7,6.3],[117.5,5.9],[118.0,6.1],[118.0,5.7],[118.4,5.8],[119.3,5.4],[119.1,5.1],[118.3,5.0],[118.2,4.8],[118.6,4.5],[118.5,4.4],[118.0,4.2],[117.7,4.3],[117.5,4.1],[117.8,3.7],[117.1,3.6],[118.1,2.3],[117.8,2.0],[119.0,1.0],[118.5,0.8],[117.9,1.1],[118.0,0.9],[117.7,0.7],[117.5,0.2]],[[109.3,0.0],[108.9,0.4],[108.9,0.8],[109.4,1.9],[109.6,2.0],[111.2,1.4],[111.0,1.6],[111.3,2.1],[111.2,2.4],[111.4,2.4],[111.5,2.7],[113.0,3.2],[113.9,4.2],[114.0,4.6],[115.4,5.0],[115.6,5.2],[115.4,5.4],[115.9,5.6],[116.8,7.0],[116.8,6.7]],[[59.7,74.7],[58.5,74.5],[58.7,74.3],[58.6,74.2],[57.8,74.0],[57.9,73.8],[57.3,73.8],[57.5,73.7],[56.6,73.3],[55.0,73.5],[54.3,73.4],[53.8,73.8],[55.3,74.4],[56.1,74.5],[55.6,74.6],[56.5,75.0],[56.0,75.0],[55.8,75.1],[56.0,75.2],[56.6,75.1],[56.9,75.2],[56.8,75.4],[57.6,75.3],[58.1,75.7],[58.9,75.9]],[[60.0,76.0],[61.1,76.1],[61.0,76.2],[61.2,76.3],[63.0,76.2],[67.5,77.0],[68.9,76.7],[67.8,76.2]],[[55.3,73.3],[56.4,73.2],[56.1,72.8],[55.7,72.8],[55.4,72.5],[55.5,72.2],[55.3,71.9],[56.5,71.1],[57.6,70.7],[55.8,70.6],[53.7,70.8],[53.4,70.9],[53.6,70.9],[53.6,71.1],[54.2,71.1],[53.4,71.3],[53.4,71.5],[51.9,71.5],[51.4,71.8],[51.6,72.1],[52.3,72.1],[52.6,72.3],[52.9,72.7],[52.6,72.8],[53.4,72.9],[53.2,73.0],[53.3,73.2],[54.8,73.4],[55.3,73.3]],[[142.8,54.4],[143.3,53.0],[143.2,51.9],[143.5,51.5],[144.3,49.2],[144.7,48.9],[144.7,48.6],[144.0,49.2],[143.1,49.2],[142.6,48.1],[142.6,47.7],[143.2,46.8],[143.5,46.8],[143.6,46.4],[143.4,46.0],[143.3,46.6],[142.6,46.7],[142.1,45.9],[141.8,46.5],[142.2,48.0],[141.9,48.8],[142.2,51.2],[141.7,51.7],[141.7,52.3],[141.9,52.8],[141.8,53.3],[142.1,53.5],[142.5,53.4],[142.7,53.7],[142.3,54.3],[142.8,54.4]],[[143.8,44.1],[144.7,43.9],[145.4,44.3],[145.1,43.7],[145.3,43.3],[145.8,43.4],[144.9,43.0],[144.0,42.9],[143.2,42.0],[141.9,42.6],[141.0,42.3],[140.5,42.6],[140.3,42.3],[141.2,41.8],[140.7,41.8],[140.4,41.5],[140.0,41.5],[140.1,41.9],[139.8,42.3],[139.9,42.6],[140.5,43.0],[140.4,43.3],[141.4,43.3],[141.8,44.5],[141.6,45.2],[141.7,45.4],[141.9,45.5],[143.8,44.1]],[[141.2,41.4],[141.5,41.4],[141.4,40.7],[141.8,40.3],[142.0,39.4],[141.5,38.8],[141.5,38.4],[141.1,38.3],[141.0,38.1],[141.0,37.1],[140.6,36.2],[140.9,35.7],[140.5,35.5],[140.4,35.2],[139.8,34.9],[139.8,35.3],[140.1,35.6],[139.8,35.7],[139.7,35.1],[139.2,35.3],[139.1,34.8],[138.8,34.6],[138.9,35.0],[138.7,35.1],[138.2,34.6],[137.1,34.6],[137.3,34.8],[136.9,34.7],[136.8,35.0],[136.5,34.7],[136.9,34.3],[136.3,34.2],[135.7,33.5],[135.1,34.0],[135.1,34.3],[135.4,34.6],[134.7,34.8],[132.7,34.2],[132.3,34.3],[132.1,33.8],[131.7,34.1],[130.9,34.0],[131.0,34.4],[131.4,34.4],[132.9,35.5],[135.2,35.7],[135.3,35.5],[135.9,35.6],[136.1,35.8],[136.0,36.0],[136.7,36.7],[136.8,37.4],[137.3,37.5],[136.9,37.1],[137.0,36.8],[138.3,37.2],[139.4,38.1],[139.8,38.9],[140.1,39.6],[140.0,39.9],[139.7,39.9],[139.9,40.0],[140.0,40.7],[140.3,40.8],[140.4,41.2],[140.6,41.2],[140.7,40.8],[141.1,40.9],[141.2,41.2],[140.8,41.1],[140.8,41.3],[140.9,41.5],[141.2,41.4]],[[134.4,34.3],[134.6,34.2],[134.7,33.8],[134.2,33.2],[133.6,33.5],[133.3,33.4],[133.0,32.8],[132.6,32.8],[132.7,32.9],[132.5,32.9],[132.4,33.4],[132.0,33.3],[132.9,34.1],[133.2,33.9],[133.6,34.0],[133.6,34.2],[134.4,34.3]],[[131.2,33.6],[131.7,33.6],[131.5,33.3],[131.9,33.3],[131.8,33.1],[132.0,32.9],[131.3,31.4],[130.7,31.0],[130.8,31.7],[130.5,31.4],[130.6,31.2],[130.1,31.4],[130.3,31.5],[130.2,32.1],[130.6,32.6],[130.2,33.2],[130.3,32.7],[130.1,32.8],[129.8,32.6],[129.7,33.1],[130.0,32.9],[129.6,33.3],[130.7,33.9],[131.0,33.9],[131.2,33.6]],[[121.0,22.6],[120.8,21.9],[120.7,22.0],[120.6,22.4],[120.3,22.5],[120.1,23.7],[121.0,25.0],[121.6,25.3],[121.9,25.0],[121.8,24.5],[121.4,23.2],[121.0,22.6]],[[110.9,20.0],[111.0,19.7],[110.6,19.3],[110.5,18.7],[109.5,18.2],[108.7,18.5],[108.7,19.3],[109.3,19.9],[110.2,20.1],[110.9,20.0]],[[80.0,9.8],[80.3,9.8],[80.7,9.4],[81.9,7.3],[81.9,6.9],[81.6,6.4],[80.7,6.0],[80.3,6.0],[79.9,6.8],[79.7,8.2],[79.8,8.3],[79.8,8.0],[80.1,9.6],[80.4,9.5],[80.0,9.8]],[[20.9,80.2],[22.3,80.0],[22.5,80.4],[23.0,80.5],[23.3,80.4],[23.1,80.2],[24.4,80.4],[26.9,80.2],[27.2,79.9],[25.6,79.4],[22.9,79.2],[22.7,79.3],[22.9,79.4],[20.1,79.5],[19.7,79.6],[20.8,79.7],[18.7,79.8],[18.3,79.9],[18.9,80.0],[17.9,80.1],[19.3,80.1],[19.5,80.2],[19.2,80.3],[19.8,80.2],[19.6,80.5],[20.9,80.2]],[[16.8,79.9],[18.0,79.7],[17.7,79.4],[18.4,79.6],[19.1,79.2],[20.8,79.1],[20.5,79.0],[21.4,78.7],[19.7,78.6],[19.1,78.4],[19.0,78.1],[18.4,78.0],[18.2,77.5],[17.6,77.4],[17.0,76.8],[17.1,76.7],[16.7,76.6],[14.4,77.2],[14.0,77.5],[16.9,77.9],[14.1,77.8],[13.7,78.0],[17.2,78.4],[16.4,78.5],[16.8,78.7],[15.4,78.5],[15.4,78.8],[15.0,78.6],[14.5,78.7],[14.4,78.5],[14.6,78.4],[13.2,78.2],[11.4,79.0],[12.4,79.0],[12.0,79.0],[11.9,79.2],[12.1,79.3],[11.2,79.1],[10.7,79.5],[10.7,79.8],[12.3,79.7],[13.7,79.9],[13.9,79.8],[12.6,79.6],[13.3,79.6],[14.0,79.3],[14.0,79.6],[14.6,79.8],[15.1,79.7],[16.3,79.0],[15.8,79.7],[16.1,80.0],[16.8,79.9]],[[9.6,40.9],[9.8,40.5],[9.6,40.3],[9.6,39.2],[9.1,39.2],[9.0,39.0],[8.6,38.9],[8.4,39.2],[8.5,40.3],[8.2,40.9],[8.6,40.9],[9.2,41.3],[9.6,40.9]],[[9.5,42.8],[9.6,42.1],[9.2,41.4],[8.6,41.9],[8.6,42.4],[9.3,42.7],[9.4,43.0],[9.5,42.8]],[[15.6,38.2],[15.1,37.5],[15.3,37.1],[15.1,36.7],[14.5,36.8],[12.4,37.8],[12.7,38.2],[12.9,38.0],[13.2,38.2],[13.8,38.0],[15.6,38.2]],[[15.1,37.5],[15.3,37.1],[15.1,36.7],[14.5,36.8],[12.4,37.8]],[[-3.1,58.5],[-3.2,58.3],[-4.0,58.0],[-3.9,57.8],[-4.1,57.6],[-2.1,57.7],[-1.8,57.5],[-2.6,56.6],[-3.3,56.4],[-2.7,56.3],[-3.4,56.0],[-3.8,56.1],[-2.1,55.9],[-1.7,55.6],[-1.2,54.7],[-0.1,54.1],[-0.2,54.0],[0.1,53.6],[-0.7,53.7],[-0.3,53.7],[0.4,53.2],[0.0,52.9],[0.3,52.8],[0.6,53.0],[1.1,53.0],[1.7,52.8],[1.6,52.1],[1.2,52.0],[1.3,51.8],[0.4,51.5],[1.4,51.4],[1.4,51.2],[1.0,50.9],[-1.4,50.9],[-1.3,50.8],[-2.0,50.6],[-3.4,50.6],[-3.7,50.2],[-4.2,50.4],[-4.8,50.3],[-5.1,50.0],[-5.7,50.1],[-4.9,50.5],[-4.2,51.2],[-3.1,51.2],[-2.4,51.7],[-3.3,51.4],[-4.2,51.6],[-4.1,51.7],[-5.2,51.7],[-5.2,52.0],[-4.0,52.5],[-4.1,52.9],[-4.7,52.8],[-4.3,53.1],[-3.1,53.3],[-3.2,53.4],[-2.8,53.3],[-3.1,53.5],[-2.8,54.1],[-3.2,54.1],[-3.6,54.6],[-3.0,55.0],[-4.9,54.7],[-5.2,55.0],[-4.7,55.5],[-4.9,55.7],[-4.9,55.9],[-4.6,55.9],[-4.8,56.2],[-5.2,55.9],[-5.0,56.2],[-5.4,56.0],[-5.7,55.3],[-5.5,55.8],[-5.6,56.1],[-5.2,56.8],[-5.7,56.5],[-6.1,56.7],[-5.7,56.9],[-5.9,56.9],[-5.6,57.1],[-5.8,57.5],[-5.6,57.5],[-5.6,57.9],[-5.2,57.9],[-5.4,58.1],[-5.0,58.3],[-5.0,58.6],[-3.1,58.5]],[[-7.2,55.1],[-6.1,55.2],[-5.7,54.8],[-5.9,54.6],[-5.6,54.7],[-5.5,54.5],[-6.3,54.0],[-6.0,52.9],[-6.5,52.3],[-6.3,52.2],[-7.5,52.1],[-8.1,51.8],[-8.4,51.9],[-8.4,51.7],[-9.3,51.5],[-9.8,51.5],[-9.6,51.7],[-10.1,51.6],[-9.6,51.9],[-10.3,51.8],[-10.4,51.9],[-9.9,52.1],[-10.4,52.2],[-9.8,52.2],[-9.9,52.4],[-8.8,52.7],[-9.9,52.6],[-9.3,53.1],[-8.9,53.2],[-10.1,53.4],[-9.6,53.8],[-9.9,53.9],[-10.1,54.3],[-8.5,54.2],[-8.6,54.3],[-8.1,54.6],[-8.8,54.7],[-8.3,55.1],[-7.7,55.3],[-7.7,55.0],[-7.5,55.0],[-7.3,55.4],[-7.0,55.2],[-7.2,55.1]],[[-15.5,66.2],[-14.6,66.4],[-15.1,66.1],[-14.7,66.0],[-14.8,65.8],[-14.4,65.8],[-14.3,65.7],[-14.5,65.6],[-13.6,65.5],[-13.8,65.4],[-13.6,65.1],[-13.9,65.0],[-14.0,64.7],[-14.4,64.7],[-14.6,64.4],[-18.7,63.4],[-21.2,63.9],[-22.7,63.8],[-22.7,64.1],[-22.2,64.0],[-21.5,64.4],[-22.1,64.3],[-21.6,64.6],[-22.1,64.5],[-22.5,64.8],[-23.8,64.7],[-24.0,64.9],[-21.9,65.0],[-21.8,65.2],[-22.5,65.2],[-21.8,65.4],[-22.9,65.6],[-23.9,65.4],[-24.5,65.5],[-23.9,65.5],[-24.1,65.8],[-23.3,65.8],[-23.8,65.8],[-23.5,65.9],[-23.8,66.0],[-23.4,66.0],[-23.6,66.1],[-23.5,66.2],[-22.4,65.9],[-22.4,66.1],[-22.9,66.2],[-22.5,66.3],[-23.1,66.3],[-22.9,66.4],[-22.4,66.4],[-21.4,66.0],[-21.4,65.7],[-21.7,65.7],[-21.1,65.3],[-20.8,65.6],[-20.5,65.6],[-20.4,66.0],[-20.2,66.1],[-19.5,65.8],[-19.4,66.1],[-18.8,66.2],[-18.1,65.7],[-18.3,66.2],[-17.6,66.0],[-17.2,66.2],[-16.8,66.1],[-16.2,66.5],[-15.5,66.2]],[[57.8,81.5],[58.6,81.4],[57.9,81.4],[58.0,81.3],[57.5,81.1],[55.5,81.3],[57.8,81.5]],[[54.7,81.1],[57.7,80.8],[55.9,80.6],[54.1,80.8],[54.0,80.9],[54.7,81.1]],[[11.2,78.6],[12.1,78.2],[11.1,78.5],[10.6,78.9],[11.2,78.6]],[[148.6,45.3],[147.7,45.0],[146.9,44.4],[147.2,44.9],[147.9,45.2],[147.9,45.4],[148.3,45.3],[148.8,45.5],[148.6,45.3]],[[146.2,44.5],[146.6,44.4],[145.4,43.7],[146.2,44.5]],[[92.7,11.5],[92.5,11.9],[92.8,12.2],[92.7,12.5],[92.9,13.4],[93.1,13.5],[92.7,11.5]],[[19.3,70.1],[19.6,70.0],[18.8,69.6],[18.1,69.6],[19.1,70.0],[19.1,70.2],[19.3,70.1]],[[15.8,68.6],[16.3,68.9],[16.5,68.6],[16.0,68.4],[14.3,68.2],[15.4,68.6],[15.6,68.9],[15.4,68.9],[15.9,69.3],[16.1,69.3],[15.8,69.0],[15.8,68.6]],[[-24.6,81.9],[-24.3,81.7],[-23.2,82.0],[-21.3,82.1],[-21.1,81.7],[-21.5,81.4],[-23.2,80.8],[-19.6,81.6],[-17.5,81.4],[-16.1,81.8],[-14.2,81.8],[-11.4,81.5],[-13.1,81.1],[-14.5,81.0],[-14.2,80.9],[-14.5,80.8],[-16.8,80.6],[-15.9,80.4],[-18.1,80.2],[-19.4,80.3],[-20.1,80.0],[-20.1,79.8],[-19.3,79.7],[-19.4,79.3],[-19.0,79.2],[-19.7,79.1],[-20.1,78.8],[-21.1,78.7],[-21.0,78.6],[-21.7,77.7],[-20.9,77.9],[-19.5,77.7],[-20.7,77.6],[-19.3,77.2],[-18.4,77.3],[-18.3,76.9],[-22.6,76.7],[-21.9,76.6],[-21.5,76.3],[-19.9,76.1],[-20.0,76.0],[-19.5,75.8],[-19.5,75.2],[-20.5,75.3],[-21.6,75.0],[-22.2,75.1],[-21.0,75.1],[-20.8,74.8],[-21.0,74.7],[-20.9,74.6],[-20.4,75.0],[-20.0,75.0],[-19.3,74.5],[-19.3,74.3],[-21.1,74.1],[-22.0,74.2],[-21.8,74.5],[-22.0,74.6],[-22.3,74.1],[-20.4,73.8],[-20.5,73.5],[-22.3,73.3],[-23.2,73.4],[-24.2,73.8],[-24.7,73.6]],[[-24.1,73.4],[-22.0,72.9],[-22.3,72.1],[-24.1,72.5],[-24.6,73.0]],[[-24.6,72.4],[-22.0,71.7],[-22.5,71.4],[-22.4,71.2],[-22.3,71.4],[-21.8,71.5],[-21.5,70.5],[-22.4,70.5],[-22.4,70.9],[-22.7,70.4],[-24.0,70.6],[-24.6,71.2]],[[-23.7,70.1],[-22.2,70.1],[-23.9,69.7],[-23.7,69.6],[-24.3,69.6],[-24.3,69.4]],[[18.0,59.3],[18.5,59.4],[18.6,59.3],[18.3,59.1],[16.2,58.6],[16.9,58.5],[16.7,58.4],[16.7,57.5],[16.0,56.2],[14.7,56.1],[14.8,56.0],[14.2,55.8],[14.2,55.4],[13.3,55.3],[12.9,55.4],[13.0,55.7],[12.5,56.3],[12.8,56.3],[12.7,56.4],[12.9,56.6],[12.4,56.9],[11.9,57.7],[11.7,57.7],[11.7,58.0],[11.2,58.4],[11.1,59.0],[11.4,59.1],[10.8,59.2],[10.6,59.4],[10.6,59.8],[10.2,59.0],[9.6,59.1],[9.7,59.0],[9.3,58.9],[9.4,58.8],[8.2,58.1],[7.0,58.0],[6.9,58.2],[6.6,58.1],[6.7,58.3],[5.6,58.6],[5.6,59.0],[6.4,59.0],[5.9,59.1],[6.4,59.5],[5.2,59.2],[5.2,59.6],[6.2,59.8],[5.7,59.9],[6.3,60.4],[6.6,60.4],[6.5,60.2],[7.0,60.5],[6.2,60.3],[5.1,59.6],[5.2,60.1],[5.7,60.1],[5.1,60.4],[5.6,60.7],[5.1,60.6],[5.0,61.0],[7.0,61.0],[7.6,61.2],[7.3,61.3],[7.4,61.4],[7.3,61.2],[6.6,61.3],[6.4,61.1],[5.3,61.1],[5.0,61.3],[5.3,61.5],[5.0,61.6],[5.0,61.9],[6.7,61.9],[5.3,61.9],[5.1,62.2],[6.7,62.5],[6.1,62.4],[6.4,62.6],[7.6,62.5],[7.7,62.6],[7.5,62.7],[8.1,62.7],[6.7,62.7],[7.6,63.1],[8.1,63.1],[8.6,62.8],[8.2,63.2],[8.6,63.3],[8.4,63.5],[8.6,63.6],[9.7,63.6],[10.0,63.4],[10.8,63.5],[10.7,63.6],[11.4,63.8],[11.2,63.9],[11.5,64.0],[11.3,64.0],[10.1,63.5],[9.6,63.7],[10.6,64.4],[11.6,64.8],[11.3,64.8],[11.5,65.0],[12.9,65.3],[12.1,65.3],[13.0,66.0],[12.8,66.1],[14.0,66.3],[13.1,66.2],[13.2,66.6],[14.0,66.8],[13.7,66.9],[14.1,67.1],[15.4,67.2],[14.4,67.3],[15.0,67.6],[15.6,67.3],[15.7,67.5],[15.2,67.6],[15.3,67.8],[14.8,67.7],[15.1,68.0],[15.6,67.9],[15.3,68.0],[16.0,68.2],[16.3,67.9],[16.4,68.1],[16.2,68.3],[17.6,68.4],[16.5,68.5],[17.4,68.8],[18.3,69.5],[18.9,69.3],[18.6,69.5],[19.7,69.8],[19.6,69.4],[20.3,69.9],[20.3,69.6],[20.0,69.4],[20.1,69.3],[20.7,69.5],[20.5,69.7],[20.6,69.9],[21.4,70.0],[22.0,69.8],[21.8,70.1],[21.4,70.2],[22.7,70.4],[23.4,70.0],[23.4,70.2],[24.7,71.0],[25.3,70.8],[25.8,70.9],[25.2,70.5],[25.0,70.1],[26.5,70.9],[26.7,70.9],[26.6,70.4],[27.5,70.8],[27.2,70.9],[27.3,71.0],[28.4,71.0],[27.9,70.7],[28.3,70.7],[28.2,70.2],[28.8,70.9],[29.7,70.6],[30.1,70.7],[30.2,70.5],[31.0,70.3],[30.3,70.1],[28.8,70.1],[29.6,70.0],[29.7,69.7],[30.1,69.7],[30.2,69.9],[30.4,69.7],[31.5,69.7],[32.0,69.8],[32.0,70.0],[33.0,69.7],[32.1,69.6],[33.5,69.4],[33.1,69.1],[33.7,69.3],[35.9,69.2],[38.4,68.4],[39.6,68.1],[39.8,68.2],[40.4,67.8],[41.0,67.7],[41.1,67.3],[41.4,67.2],[41.2,66.8],[40.1,66.3],[38.7,66.1],[34.8,66.6],[34.5,66.5],[34.5,66.7],[33.1,66.8],[32.8,67.0],[32.9,67.1],[31.9,67.2],[33.2,66.7],[33.2,66.5],[33.7,66.4],[33.4,66.3],[34.7,66.0],[34.8,65.8],[34.4,65.4],[34.8,64.8],[35.0,64.8],[35.0,64.4],[35.6,64.4],[36.4,64.0],[37.4,63.8],[38.0,63.9],[38.1,64.1],[38.0,64.3],[37.2,64.4],[36.6,64.8],[36.5,64.9],[36.9,65.2],[39.8,64.6],[40.4,64.8],[39.8,65.3],[39.8,65.6],[40.7,66.0],[41.5,66.1],[42.2,66.5],[43.7,66.3],[43.5,66.1],[44.1,66.0],[44.5,66.7],[44.3,67.1],[43.8,67.3],[44.2,68.3],[43.3,68.7],[44.0,68.5],[45.9,68.5],[46.7,68.0],[46.7,67.8],[45.5,67.8],[44.9,67.4],[46.5,66.8],[47.7,67.0],[47.9,67.6],[48.9,67.7],[48.7,67.9],[52.0,68.5],[52.4,68.4],[52.7,68.5],[52.3,68.6],[53.8,69.0],[54.5,69.0],[53.8,68.9],[54.0,68.8],[53.8,68.6],[53.9,68.4],[53.3,68.3],[54.9,68.2],[54.9,68.4],[55.4,68.6],[57.1,68.6],[59.1,69.0],[59.4,68.7],[59.1,68.6],[59.1,68.4],[59.7,68.4],[59.9,68.7]],[[-5.9,35.8],[-5.3,35.9],[-5.3,35.6],[-4.6,35.2],[-3.4,35.2],[-3.0,35.4],[-2.8,35.1],[-1.9,35.1],[-0.9,35.7],[-0.4,35.9],[-0.0,35.8],[0.3,36.2],[1.3,36.5],[3.8,36.9],[4.8,36.9],[5.3,36.6],[6.5,37.1],[6.9,36.9],[7.2,37.1],[7.9,36.9],[9.7,37.3],[9.8,37.1],[9.9,37.3],[10.2,37.2],[10.4,36.7],[11.1,37.1],[11.1,36.9],[10.5,36.3],[11.1,35.2]],[[35.9,35.4],[35.8,35.6],[36.0,36.0],[35.8,36.3],[36.2,36.7],[36.0,36.9],[35.4,36.6],[34.7,36.8],[33.7,36.2],[32.8,36.0],[32.0,36.5],[30.6,36.9],[30.4,36.3],[29.7,36.2],[29.2,36.3],[29.0,36.7],[27.5,36.7],[28.2,37.0],[27.3,37.0],[27.5,37.2],[27.2,37.4],[27.2,38.0],[26.3,38.3],[26.4,38.6],[26.6,38.6],[26.7,38.3],[27.1,38.5],[26.8,38.7],[27.0,38.9],[26.7,39.3],[26.9,39.5],[26.1,39.5],[26.2,40.0],[26.7,40.4],[27.3,40.5],[27.5,40.3],[27.7,40.3],[27.7,40.5],[29.0,40.4],[28.8,40.5],[29.8,40.8],[29.1,40.9],[29.1,41.2],[31.3,41.1],[32.3,41.7],[33.4,42.0],[35.0,42.1],[35.6,41.6],[36.1,41.7],[36.4,41.3],[36.8,41.4],[38.4,40.9],[39.4,41.1],[40.3,41.0],[41.4,41.4],[41.8,42.0],[41.4,42.7],[38.7,44.3],[36.6,45.2],[36.9,45.3],[36.7,45.4],[37.6,45.4],[37.9,46.0],[38.1,45.9],[38.2,46.1],[38.5,46.1],[37.8,46.6],[39.3,47.0],[39.2,47.3],[38.7,47.1],[38.8,47.3],[37.5,47.1],[36.8,46.7],[35.8,46.6],[35.0,46.1],[35.3,46.3],[35.2,46.4],[34.9,46.2],[34.9,46.0],[35.5,45.3],[36.2,45.5],[36.6,45.4],[36.4,45.1],[35.5,45.1],[33.9,44.4],[33.5,44.6],[33.6,45.1],[32.5,45.4],[33.7,45.9],[33.6,46.1],[32.5,46.1],[31.8,46.3],[32.0,46.4],[31.6,46.6],[32.6,46.6],[32.0,46.6],[31.8,47.2],[31.9,46.6],[31.5,46.7],[31.6,46.8],[31.4,46.6],[30.8,46.6],[30.2,45.9],[29.6,45.7],[29.6,44.8],[29.0,44.8],[29.1,45.0],[28.9,45.0],[28.9,44.6],[28.6,44.3],[28.6,43.5],[28.1,43.4],[27.9,43.2],[27.9,42.8],[27.5,42.5],[28.2,41.6],[29.1,41.2],[29.0,41.0],[27.5,41.0],[27.3,40.7],[26.2,40.1],[26.8,40.6],[26.1,40.6],[25.1,41.0],[23.8,40.7],[24.3,40.1],[23.9,40.4],[23.7,40.3],[24.0,40.1],[23.9,40.0],[23.4,40.3],[23.6,39.9],[22.9,40.4],[22.9,40.6],[22.6,40.5],[22.6,40.0],[23.3,39.2],[22.8,39.3],[23.1,39.0],[22.6,38.9],[24.0,38.3],[24.0,37.7],[23.5,38.0],[23.0,37.9],[23.5,37.4],[23.2,37.3],[22.7,37.5],[23.2,36.4],[22.7,36.8],[22.5,36.4],[22.1,37.0],[21.9,36.7],[21.6,37.1],[21.7,37.4],[21.1,37.9],[21.8,38.3],[22.9,38.0],[23.1,38.2],[22.4,38.4],[21.1,38.4],[20.8,38.9],[21.1,39.0],[20.3,39.3],[19.9,40.0],[19.3,40.4],[19.5,40.4],[19.3,40.7],[19.5,40.9],[19.4,41.4],[19.6,41.8],[19.2,41.9],[18.6,42.4],[17.0,43.0],[17.7,42.9],[16.9,43.4],[16.0,43.5],[15.1,44.3],[15.5,44.3],[15.0,44.6],[14.9,45.1],[14.6,45.3],[14.3,45.3],[13.9,44.8],[13.6,45.1],[13.5,45.5],[13.8,45.6],[13.6,45.8],[12.3,45.4],[12.2,45.2],[12.5,45.0],[12.2,44.7],[12.4,44.2],[13.6,43.6],[14.0,42.7],[14.5,42.2],[15.2,41.9],[16.2,41.9],[15.9,41.5],[18.0,40.7],[18.5,40.2],[18.3,39.8],[17.9,40.3],[16.9,40.5],[16.5,39.7],[17.1,39.4],[17.2,39.0],[16.6,38.8],[16.1,37.9],[15.6,38.0],[15.6,38.2],[16.2,38.8],[15.7,40.0],[15.0,40.2],[14.8,40.7],[14.3,40.6],[14.5,40.7],[14.0,40.8],[13.7,41.2],[13.1,41.2],[11.6,42.3],[11.1,42.4],[11.2,42.5],[10.5,43.0],[10.2,43.9],[8.8,44.4],[6.6,43.2],[5.4,43.2],[4.1,43.6],[3.3,43.2],[3.0,42.8],[3.3,42.3],[3.2,41.9],[2.1,41.3],[1.0,41.1],[0.7,40.8],[0.9,40.7],[0.6,40.6],[-0.3,39.5],[-0.2,39.1],[0.2,38.8],[-0.5,38.3],[-0.8,37.8],[-0.7,37.6],[-1.3,37.6],[-2.2,36.7],[-4.4,36.7],[-5.2,36.4],[-5.6,36.0],[-6.4,36.6],[-6.2,36.9],[-6.4,36.8],[-6.9,37.3],[-7.8,37.0],[-9.0,37.0],[-8.8,37.4],[-8.9,38.4],[-8.7,38.4],[-9.2,38.4],[-9.2,38.7],[-9.0,38.7],[-8.8,39.1],[-9.1,38.7],[-9.5,38.8],[-9.4,39.3],[-9.1,39.5],[-8.8,40.1],[-8.7,41.1],[-8.9,42.1],[-8.7,42.4],[-9.0,42.6],[-8.9,42.8],[-9.2,43.0],[-9.2,43.2],[-8.2,43.4],[-8.3,43.6],[-7.7,43.8],[-7.1,43.6],[-4.5,43.4],[-2.9,43.5],[-2.0,43.3],[-1.5,43.6],[-1.1,44.7],[-1.1,45.5],[-0.5,45.0],[-0.8,45.5],[-1.2,45.7],[-1.0,45.7],[-1.1,46.3],[-1.8,46.5],[-2.1,46.9],[-2.0,47.0],[-2.2,47.2],[-1.7,47.2],[-2.5,47.3],[-2.4,47.5],[-2.8,47.6],[-4.3,47.8],[-4.4,48.0],[-4.7,48.0],[-4.3,48.2],[-4.6,48.3],[-4.2,48.3],[-4.7,48.5],[-3.2,48.8],[-2.7,48.5],[-1.4,48.7],[-1.6,48.8],[-1.6,49.2],[-1.9,49.7],[-1.3,49.7],[-1.1,49.4],[0.4,49.4],[0.1,49.5],[0.2,49.7],[1.4,50.1],[1.8,50.9],[3.4,51.4],[4.2,51.4],[3.4,51.5],[4.3,51.5],[3.9,51.8],[4.5,52.3],[4.8,52.9],[5.5,53.3],[7.2,53.3],[7.2,53.7],[8.0,53.7],[8.2,53.4],[8.3,53.6],[8.5,53.4],[8.6,53.9],[9.2,53.9],[9.8,53.6],[9.0,53.9],[8.9,54.3],[8.6,54.3],[9.0,54.5],[8.7,54.8],[8.7,55.3],[8.1,55.6],[8.2,56.6],[8.7,56.5],[9.1,56.8],[9.2,56.7],[9.3,57.0],[8.8,56.7],[8.3,56.8],[8.6,57.1],[9.4,57.2],[10.0,57.6],[10.6,57.7],[10.3,56.6],[10.9,56.4],[10.8,56.2],[10.3,56.2],[10.2,55.9],[9.6,55.5],[9.7,55.3],[9.5,55.0],[10.0,54.7],[9.9,54.5],[10.7,54.3],[11.0,54.4],[11.1,54.3],[10.8,54.1],[11.4,53.9],[12.6,54.5],[13.4,54.1],[13.7,54.2],[13.9,53.8],[14.6,53.6],[14.6,53.8],[13.9,53.9],[13.8,54.1],[14.4,53.9],[16.2,54.3],[16.6,54.6],[18.1,54.8],[18.8,54.7],[18.4,54.7],[18.7,54.4],[19.4,54.4],[19.9,54.6],[20.0,54.9],[20.7,55.1],[21.1,55.6],[20.6,55.0],[21.2,54.9],[21.0,56.6],[21.7,57.6],[22.6,57.7],[23.6,57.0],[24.4,57.2],[24.3,57.8],[24.5,58.4],[23.8,58.4],[23.5,58.7],[23.7,58.8],[23.4,58.9],[23.5,59.2],[25.5,59.6],[27.9,59.4],[28.1,59.8],[28.3,59.7],[28.5,59.9],[30.1,59.9],[30.2,60.0],[29.7,60.2],[28.6,60.4],[28.5,60.5],[28.7,60.6],[28.5,60.7],[26.5,60.4],[26.6,60.6],[26.4,60.4],[26.0,60.5],[26.0,60.3],[23.0,59.8],[23.2,60.0],[22.9,60.2],[22.5,60.0],[22.4,60.2],[22.6,60.2],[22.6,60.4],[21.4,60.6],[21.6,61.6],[21.1,62.6],[21.7,63.0],[21.5,63.2],[22.3,63.3],[22.2,63.4],[22.5,63.6],[23.6,64.0],[24.6,64.8],[25.4,65.0],[25.3,65.5],[24.7,65.7],[24.6,65.9],[23.1,65.7],[22.4,65.9],[22.3,65.6],[21.4,65.3],[21.6,65.1],[21.1,64.8],[21.5,64.5],[20.8,63.9],[19.4,63.5],[19.0,63.2],[18.6,63.2],[18.3,63.0],[18.5,62.9],[17.9,62.9],[18.0,62.6],[17.4,62.5],[17.6,62.2],[17.4,61.9],[17.5,61.7],[17.1,61.6],[17.3,60.7],[18.6,60.3],[18.5,60.2],[19.0,59.8],[18.0,59.3]],[[60.5,68.7],[60.9,69.1],[60.2,69.6],[60.9,69.8],[63.4,69.7],[64.9,69.2],[67.0,68.9],[68.5,68.3],[69.1,69.0],[68.5,69.0],[68.1,69.2],[68.0,69.5],[66.9,69.6],[66.9,70.0],[67.2,70.1],[67.3,70.7],[66.7,70.8],[66.8,71.1],[66.6,71.1],[68.3,71.7],[69.4,73.0],[71.5,72.9],[72.8,72.7],[72.6,72.0],[71.9,71.5],[72.7,71.0],[72.7,70.5],[72.5,70.3],[72.6,69.0],[73.6,68.5],[73.1,68.2],[73.1,67.8],[71.8,67.0],[71.4,67.0],[71.5,66.7],[70.7,66.5],[70.4,66.6],[70.7,66.7],[69.0,66.8],[69.2,66.6],[70.0,66.4],[72.3,66.3],[72.4,66.6],[73.8,67.0],[74.1,67.4],[74.8,67.8],[74.4,68.4],[74.6,68.8],[75.1,68.9],[76.5,69.0],[77.2,68.5],[77.2,67.8],[77.8,67.6],[78.9,67.6],[77.6,67.8],[77.5,68.0],[78.0,68.3],[77.7,68.9],[76.0,69.2],[73.8,69.2],[73.9,69.4],[73.6,69.8],[74.3,70.6],[73.1,71.4],[73.7,71.8],[75.0,72.1],[75.1,72.5],[74.8,72.8],[75.4,72.8],[75.6,72.6],[75.7,72.3],[75.2,71.8],[75.5,71.7],[75.3,71.3],[76.9,71.1],[77.6,71.2],[78.3,70.9],[79.1,71.0],[78.5,71.0],[78.2,71.3],[76.4,71.6],[76.0,71.9],[78.2,71.9],[78.0,72.1],[77.4,72.1],[78.5,72.4],[80.8,72.1],[81.7,71.7],[83.2,71.7],[82.3,71.3],[82.2,71.0],[82.2,70.4],[82.9,71.0],[83.0,70.6],[82.7,70.2],[83.1,70.1],[83.1,70.3],[83.5,70.3],[83.7,70.5],[83.2,71.1],[83.5,71.7],[83.2,71.9],[82.6,71.9],[82.1,72.3],[80.8,72.5],[80.8,72.9],[80.4,73.2],[80.6,73.6],[86.9,73.9],[87.0,73.8],[85.8,73.4],[86.7,73.1],[85.9,73.4],[87.6,73.8],[86.0,74.3],[86.4,74.5],[86.9,74.3],[87.2,74.4],[85.8,74.6],[86.2,74.8],[86.9,74.7],[87.5,75.0],[86.9,75.1],[87.0,75.2],[87.7,75.1],[90.2,75.6],[94.2,76.0],[93.0,75.9],[92.9,76.0],[93.3,76.1],[96.1,76.1],[95.7,75.9],[96.5,75.9],[98.7,76.2],[99.8,76.0],[99.5,75.8],[99.9,75.9],[99.8,76.1],[98.8,76.5],[101.6,76.4],[101.7,76.5],[100.9,76.6],[101.1,76.7],[100.9,76.9],[102.6,77.5],[104.0,77.7],[106.1,77.4],[104.2,77.1],[107.4,76.9],[106.4,76.5],[107.7,76.5],[108.2,76.7],[111.1,76.7],[112.1,76.5],[111.9,76.4],[112.6,76.4],[112.7,76.1],[113.3,76.3],[113.6,75.9],[113.9,75.9],[113.6,75.6],[112.5,75.8],[113.7,75.5],[112.9,75.0],[109.8,74.3],[106.7,73.3],[106.2,73.3],[105.1,72.8],[110.9,73.7],[109.7,73.8],[110.3,74.0],[111.1,73.9],[111.1,74.1],[111.6,74.0],[111.2,74.0],[111.4,73.8],[112.1,73.7],[112.8,73.7],[112.8,74.0],[113.0,73.9],[113.5,73.3],[113.5,73.0],[113.1,72.8],[113.7,72.6],[113.2,72.8],[113.9,73.3],[113.5,73.5],[114.1,73.6],[118.5,73.6],[118.9,73.5],[118.5,73.5],[118.4,73.2],[122.8,72.9],[122.5,73.0],[123.2,73.0],[123.6,73.2],[123.3,73.4],[123.4,73.6],[124.5,73.8],[125.6,73.4],[126.3,73.5],[126.6,73.3],[127.0,73.5],[127.7,73.5],[129.1,73.1],[128.6,72.9],[129.0,72.9],[129.2,72.7],[128.4,72.5],[129.3,72.4],[129.3,72.1],[127.7,72.4],[128.9,71.8],[129.1,71.8],[129.1,72.0],[129.5,71.7],[128.8,71.7],[129.8,71.1],[130.5,70.9],[130.8,71.0],[131.0,70.7],[131.6,70.9],[132.7,71.9],[133.7,71.4],[136.1,71.6],[137.9,71.1],[137.8,71.2],[138.3,71.3],[137.9,71.4],[138.2,71.6],[139.2,71.4],[140.0,71.5],[139.4,72.0],[140.2,72.2],[139.1,72.3],[139.6,72.5],[141.1,72.6],[140.7,72.8],[140.8,72.9],[143.5,72.7],[146.3,72.4],[144.9,72.4],[144.2,72.3],[144.5,72.2],[146.8,72.3],[146.1,71.9],[146.2,72.1],[145.8,72.2],[145.8,71.9],[145.1,71.9],[145.0,71.8],[145.2,71.7],[146.1,71.8],[147.3,72.3],[149.5,72.2],[150.0,71.9],[148.9,71.7],[150.7,71.5],[150.1,71.2],[151.0,71.4],[151.6,71.3],[152.1,71.0],[151.8,71.0],[152.5,70.8],[155.9,71.1],[157.4,71.1],[159.4,70.8],[160.0,70.3],[159.7,69.9],[159.8,69.8],[160.9,69.6],[161.0,69.1],[161.3,68.9],[160.9,68.5],[161.6,68.9],[161.5,69.4],[163.2,69.7],[166.9,69.5],[167.9,69.7],[168.2,69.6],[168.3,69.3],[169.3,69.1],[169.6,68.8],[170.5,68.8],[171.0,69.0],[170.6,69.6],[170.2,69.6],[170.5,70.1],[172.6,70.0],[173.3,69.8],[175.9,69.9],[176.9,69.6],[178.8,69.4],[180,69.0],[180,65.1],[178.5,64.6],[177.7,64.7],[176.9,65.1],[176.3,65.0],[177.0,65.0],[177.2,64.9],[177.1,64.8],[176.1,65.0],[175.8,64.8],[174.5,64.7],[176.1,64.9],[176.4,64.7],[176.1,64.6],[177.4,64.8],[177.4,64.4],[178.0,64.2],[178.2,64.4],[178.5,64.0],[178.7,64.0],[178.7,63.7],[178.5,63.6],[179.3,63.2],[179.6,62.8],[179.1,62.3],[177.3,62.6],[177.3,62.8],[177.0,62.8],[177.2,62.6],[174.5,61.8],[173.6,61.7],[173.1,61.4],[172.9,61.5],[172.9,61.3],[170.6,60.4],[170.4,60.0],[169.2,60.6],[167.2,60.4],[166.2,59.8],[166.1,60.0],[166.4,60.5],[165.1,60.1],[165.0,59.8],[164.5,60.1],[164.1,59.9],[163.7,60.0],[163.4,59.8],[163.3,59.3],[162.1,58.4],[162.0,58.1],[162.0,57.9],[162.4,57.7],[162.7,57.9],[163.2,57.8],[163.2,57.6],[162.8,57.4],[162.8,56.8],[163.3,56.7],[163.3,56.2],[163.0,56.0],[162.6,56.2],[163.0,56.5],[162.7,56.5],[162.1,56.1],[161.7,55.5],[162.1,54.8],[161.6,54.5],[161.1,54.6],[160.1,54.2],[159.8,53.8],[160.0,53.1],[159.6,53.2],[158.7,52.9],[158.4,53.0],[158.6,52.9],[158.5,52.4],[158.1,51.8],[156.7,51.0],[155.6,55.2],[155.7,56.1],[156.0,56.8],[157.0,57.5],[156.8,57.7],[156.9,57.8],[158.3,58.0],[162.1,60.5],[163.7,60.9],[163.6,61.0],[164.0,61.3],[163.8,61.5],[164.2,62.3],[164.6,62.5],[165.4,62.5],[164.4,62.7],[163.3,62.6],[163.0,61.9],[163.3,61.7],[163.0,61.5],[162.9,61.7],[162.4,61.7],[160.2,60.6],[160.4,61.0],[159.8,61.0],[160.3,61.9],[159.6,61.7],[159.2,61.9],[157.1,61.7],[154.3,59.8],[154.2,59.5],[155.2,59.4],[155.2,59.2],[154.7,59.1],[153.4,59.2],[152.8,58.9],[151.3,58.9],[151.1,59.1],[152.3,59.2],[151.3,59.6],[150.5,59.5],[150.7,59.6],[149.6,59.8],[149.1,59.6],[149.2,59.5],[148.8,59.5],[148.7,59.4],[149.0,59.4],[148.7,59.3],[146.5,59.5],[146.3,59.2],[145.6,59.4],[142.6,59.2],[140.8,58.3],[140.4,57.8],[138.7,57.0],[137.7,56.1],[135.3,54.9],[135.3,54.7],[136.8,54.6],[136.7,53.8],[137.2,53.8],[137.3,54.0],[137.1,54.2],[137.7,54.3],[137.3,54.1],[137.8,53.9],[137.3,53.5],[137.9,53.6],[138.5,54.0],[138.6,53.8],[138.2,53.5],[138.5,53.5],[138.7,53.7],[138.7,54.3],[139.8,54.3],[140.2,54.1],[140.3,53.8],[141.4,53.3],[141.2,53.0],[140.8,53.1],[141.3,52.8],[141.1,52.4],[141.5,52.2],[141.4,51.9],[140.9,51.6],[140.5,50.8],[140.6,50.1],[140.1,48.4],[138.6,47.1],[137.7,45.8],[136.8,45.2],[135.1,43.5],[134.0,42.9],[133.2,42.7],[132.3,42.9],[132.3,43.3],[131.9,43.1],[132.0,43.3],[131.8,43.3],[131.2,42.6],[130.7,42.7],[130.7,42.3],[130.2,42.2],[129.7,41.6],[129.7,40.9],[128.5,40.1],[127.6,39.8],[127.4,39.2],[128.3,38.7],[129.4,37.1],[129.4,36.1],[129.6,36.1],[129.6,35.9],[129.2,35.2],[128.5,35.1],[128.4,34.9],[127.7,35.0],[127.7,34.7],[127.4,34.8],[127.5,34.6],[127.2,34.5],[127.2,34.8],[126.9,34.4],[126.8,34.5],[126.5,34.3],[126.3,34.7],[126.6,34.8],[126.4,34.8],[126.3,35.2],[126.8,35.9],[126.5,36.2],[126.5,36.7],[126.2,36.8],[126.5,37.0],[127.0,36.9],[126.7,37.2],[126.6,37.8],[126.4,37.9],[126.1,37.7],[125.8,38.0],[125.4,37.7],[125.0,37.9],[125.2,38.1],[124.7,38.1],[125.1,38.6],[125.6,38.7],[125.2,38.8],[125.4,39.5],[124.8,39.8],[124.6,39.6],[124.3,40.0],[124.1,39.8],[123.7,39.9],[122.3,39.4],[121.2,38.7],[121.1,38.9],[121.7,39.1],[121.6,39.2],[121.8,39.4],[121.3,39.5],[122.3,40.5],[121.8,41.0],[121.7,40.8],[121.2,40.9],[120.5,40.2],[119.4,39.8],[119.0,39.2],[117.8,39.1],[117.6,38.7],[117.7,38.4],[118.8,38.1],[119.1,37.7],[119.0,37.3],[119.3,37.1],[119.8,37.2],[120.3,37.7],[120.8,37.8],[122.0,37.4],[122.7,37.4],[122.3,36.8],[122.2,37.0],[121.9,37.0],[120.8,36.6],[120.9,36.4],[120.7,36.4],[120.6,36.1],[120.2,36.2],[120.1,36.1],[120.3,36.0],[119.4,35.3],[119.2,34.8],[120.3,34.3],[120.9,32.7],[121.9,31.8],[121.7,31.7],[120.5,32.1],[120.0,31.9],[120.7,32.0],[121.7,31.3],[121.9,30.9],[120.2,30.2],[120.5,30.3],[120.6,30.1],[121.3,30.3],[122.1,29.9],[121.5,29.5],[121.9,29.6],[121.9,29.1],[121.7,29.3],[121.4,29.1],[121.7,29.0],[121.5,28.9],[121.7,28.9],[121.5,28.6],[121.6,28.3],[121.1,28.3],[121.0,28.0],[120.7,28.0],[120.6,27.4],[120.1,26.7],[119.9,26.6],[119.6,26.8],[119.9,26.3],[119.1,26.1],[119.3,25.9],[119.6,26.0],[119.6,25.4],[119.2,25.4],[119.3,25.2],[119.0,25.2],[118.9,24.9],[118.6,24.8],[118.7,24.6],[117.8,24.5],[118.1,24.2],[117.4,23.6],[117.3,23.7],[116.6,23.4],[116.5,22.9],[115.6,22.9],[115.5,22.7],[115.2,22.8],[114.9,22.6],[114.7,22.8],[114.6,22.5],[114.3,22.5],[114.3,22.3],[113.9,22.4],[114.0,22.5],[113.5,23.1],[113.3,22.9],[113.6,22.6],[113.5,22.2],[113.1,22.2],[113.0,21.9],[112.6,21.8],[112.4,22.0],[112.3,21.7],[111.9,21.9],[111.6,21.6],[111.0,21.5],[110.6,21.2],[110.4,21.3],[110.2,20.9],[110.5,20.5],[110.3,20.3],[109.9,20.3],[110.0,20.4],[109.7,20.9],[109.9,21.5],[109.5,21.7],[109.5,21.5],[109.1,21.4],[109.1,21.6],[108.8,21.6],[108.6,21.9],[108.5,21.6],[108.3,21.7],[107.4,21.3],[107.2,20.9],[106.7,21.0],[106.8,20.7],[106.0,19.9],[105.6,19.0],[106.5,17.9],[106.4,17.7],[108.8,15.4],[109.3,13.9],[109.4,13.0],[109.4,12.6],[109.3,12.8],[109.2,12.6],[109.3,12.0],[109.0,11.3],[107.3,10.4],[107.0,10.7],[106.9,10.4],[106.6,10.5],[106.8,10.3],[106.5,10.3],[106.8,10.1],[106.6,9.9],[106.1,10.2],[106.6,9.6],[105.8,10.0],[106.2,9.4],[105.5,9.1],[105.1,8.6],[104.8,8.6],[104.8,9.6],[105.1,9.9],[105.0,10.1],[103.9,10.7],[103.7,10.5],[103.5,10.7],[103.7,10.9],[103.5,11.1],[103.2,10.9],[103.1,11.5],[102.3,12.4],[102.2,12.3],[101.7,12.7],[100.9,12.7],[101.0,13.4],[100.6,13.6],[100.0,13.4],[100.0,12.2],[99.2,10.3],[99.3,9.3],[99.8,9.3],[100.0,8.6],[100.3,8.3],[100.5,7.2],[100.3,7.8],[100.2,7.6],[100.4,7.2],[101.0,6.9],[101.5,6.9],[103.2,5.3],[103.5,4.7],[103.4,2.9],[104.0,2.3],[104.2,1.4],[104.0,1.6],[103.5,1.3],[101.3,2.9],[101.3,3.3],[100.7,4.0],[100.3,6.0],[99.7,6.9],[99.6,7.4],[99.4,7.4],[98.7,8.3],[98.3,8.2],[98.2,8.8],[98.7,10.2],[98.6,10.0],[98.5,10.7],[98.7,11.0],[98.7,11.6],[98.9,11.7],[98.6,11.7],[98.6,13.2],[98.2,13.7],[98.2,14.0],[98.2,13.6],[98.1,13.7],[98.0,14.7],[97.8,14.9],[97.6,16.0],[97.7,16.6],[97.4,16.5],[96.9,17.4],[96.8,16.7],[96.4,16.5],[96.2,16.8],[96.3,16.4],[95.8,16.2],[95.4,15.7],[95.3,16.1],[95.2,15.8],[94.9,15.8],[94.9,16.2],[94.7,15.9],[94.7,16.5],[94.7,16.3],[94.2,16.0],[94.6,17.6],[94.0,19.3],[93.9,18.9],[93.5,19.4],[93.8,19.2],[94.0,19.4],[93.6,19.8],[93.7,19.9],[93.2,20.1],[93.1,19.9],[93.1,20.4],[92.8,20.2],[92.9,20.3],[92.7,20.6],[92.7,20.3],[92.1,21.2],[91.9,22.4],[91.8,22.3],[91.5,22.9],[91.2,22.6],[90.9,22.6],[90.6,23.6],[90.6,23.4],[90.3,23.5],[90.6,23.3],[90.6,22.9],[90.4,22.8],[90.6,22.4],[90.2,21.8],[90.2,22.2],[90.0,22.0],[89.9,22.1],[90.0,22.5],[89.6,21.8],[89.5,22.3],[89.4,21.7],[89.1,22.1],[88.9,21.9],[89.1,21.7],[88.7,21.6],[88.6,22.1],[88.6,21.7],[88.4,21.6],[88.3,21.8],[88.3,21.6],[88.1,21.6],[88.2,22.1],[87.9,22.4],[88.2,22.1],[87.1,21.5],[86.9,21.2],[87.0,20.7],[86.8,20.3],[86.4,20.0],[86.2,20.1],[86.3,19.9],[85.6,19.7],[85.5,19.9],[85.2,19.8],[85.2,19.6],[85.4,19.6],[84.1,18.3],[82.4,17.1],[82.3,16.6],[81.8,16.3],[81.3,16.3],[81.0,15.8],[80.6,15.9],[80.3,15.7],[80.1,15.1],[80.3,13.5],[80.2,13.7],[80.1,13.6],[80.3,13.4],[79.7,11.3],[79.8,10.3],[79.3,10.3],[78.9,9.6],[79.0,9.3],[79.4,9.2],[79.0,9.3],[78.4,9.1],[78.1,8.4],[77.5,8.1],[76.6,8.9],[75.7,11.4],[74.9,12.6],[74.4,14.5],[73.9,15.1],[73.8,15.7],[73.3,16.5],[72.9,18.6],[73.0,19.2],[72.8,19.0],[72.8,19.3],[73.0,19.3],[72.8,19.4],[72.7,19.8],[72.9,20.7],[72.6,21.4],[73.1,21.8],[72.5,21.7],[72.7,22.0],[72.5,22.0],[72.6,22.2],[72.8,22.2],[72.2,22.3],[72.3,22.1],[72.0,21.8],[72.3,21.5],[72.0,21.2],[71.0,20.7],[70.5,20.8],[69.0,22.3],[70.2,22.6],[70.5,23.1],[69.7,22.8],[68.8,23.1],[68.4,23.6],[68.8,23.9],[68.2,23.6],[68.2,23.9],[67.7,23.8],[67.3,24.2],[67.2,24.8],[66.7,24.9],[66.4,25.6],[66.1,25.5],[66.5,25.4],[64.7,25.2],[64.1,25.4],[63.6,25.4],[63.5,25.2],[62.7,25.3],[62.3,25.1],[60.4,25.3]],[[61.9,25.1],[60.5,25.4],[59.0,25.4],[58.8,25.6],[57.3,25.8],[57.0,26.8],[56.4,27.2],[54.6,26.5],[53.7,26.7],[52.5,27.6],[51.3,28.1],[50.9,29.1],[50.7,29.1],[50.1,30.2],[49.6,30.0],[49.0,30.4],[49.2,30.5],[49.0,30.5],[48.8,30.0],[48.0,30.0],[48.1,29.6],[47.7,29.4],[48.1,29.4],[48.8,27.7],[50.1,26.7],[50.2,26.1],[50.0,26.1],[50.8,24.8],[51.0,26.0],[51.3,26.2],[51.5,25.9],[51.6,25.1],[51.3,24.3],[51.8,24.3],[51.8,24.0],[52.6,24.2],[53.8,24.1],[54.4,24.3],[54.7,24.8],[56.4,26.4],[56.3,25.7],[56.6,24.5],[57.2,23.9],[58.8,23.5],[59.4,22.7],[59.8,22.5],[59.8,22.3],[59.4,21.5],[58.9,21.1],[58.5,20.4],[58.2,20.4],[58.2,20.6],[57.9,20.2],[57.7,19.7],[57.8,19.0],[56.8,18.8],[56.4,18.0],[55.3,17.6],[55.1,17.0],[54.1,17.0],[52.6,16.5],[52.2,16.2],[52.2,15.7],[51.3,15.2],[49.4,14.6],[48.7,14.1],[45.7,13.3],[45.0,12.8],[43.9,12.6],[43.5,12.7],[43.2,13.3],[43.3,13.7],[42.9,15.1],[42.7,15.2],[42.8,16.5],[42.3,17.4],[41.2,18.7],[40.8,19.8],[39.7,20.4],[39.1,21.3],[39.1,22.6],[38.5,23.7],[37.9,24.2],[37.5,24.3],[37.2,24.8],[37.3,25.0],[35.2,28.0],[34.6,28.1],[35.0,29.6],[34.7,29.3],[34.4,28.0],[34.2,27.8],[33.2,28.6],[32.6,30.0],[32.5,29.9],[32.4,29.6],[32.7,28.9],[33.5,27.9],[33.5,27.6],[35.2,24.5],[35.8,23.9],[35.5,23.9],[35.7,22.9],[36.8,22.1],[36.9,21.6],[37.3,21.1],[37.1,21.0],[37.5,18.8],[38.2,18.2],[38.3,18.3],[38.6,18.1],[39.5,15.5],[39.8,15.1],[39.9,15.5],[40.2,15.0],[41.2,14.6],[42.4,13.2],[43.0,12.9],[43.4,12.4],[43.3,12.0],[42.5,11.5],[43.2,11.6],[44.3,10.5],[44.9,10.4],[45.8,10.8],[46.6,10.7],[47.4,11.2],[47.7,11.1],[50.1,11.5],[50.8,12.0],[51.3,11.8],[51.0,10.4],[51.2,10.6],[51.4,10.4],[50.9,10.3],[50.8,9.4],[48.0,4.5],[46.1,2.5],[43.7,0.9],[41.4,-1.9],[40.9,-2.0],[40.8,-2.4],[40.2,-2.7],[40.1,-3.3],[39.5,-4.5],[39.2,-4.7],[38.8,-6.1],[39.5,-7.0],[39.3,-7.5],[39.3,-8.4],[39.8,-9.9],[39.7,-10.0],[40.6,-10.7],[40.4,-11.3]],[[25.2,31.5],[26.8,31.5],[29.1,30.8],[30.9,31.6],[30.6,31.4],[31.1,31.6],[31.9,31.5],[32.1,31.3],[31.9,31.5],[31.8,31.3],[32.1,31.1],[32.3,31.3],[32.6,31.1],[33.9,31.2],[34.5,31.6],[35.6,34.2],[36.0,34.5]],[[-9.7,30.1],[-9.9,30.7],[-9.8,31.4],[-9.3,32.1],[-9.2,32.6],[-8.5,33.3],[-6.9,34.0],[-5.9,35.8],[-5.3,35.9],[-5.3,35.6],[-4.6,35.2],[-3.4,35.2],[-3.0,35.4],[-2.8,35.1],[-1.9,35.1],[-0.9,35.7],[-0.4,35.9],[-0.0,35.8],[0.3,36.2],[1.3,36.5],[3.8,36.9],[4.8,36.9],[5.3,36.6],[6.5,37.1],[6.9,36.9],[7.2,37.1],[7.9,36.9],[9.7,37.3],[9.8,37.1],[9.9,37.3],[10.2,37.2],[10.4,36.7],[11.1,37.1],[11.1,36.9],[10.5,36.3],[11.1,35.2],[10.0,34.1],[10.3,33.7],[10.7,33.7],[10.7,33.5],[11.0,33.6],[11.3,33.3],[11.2,33.2],[12.3,32.9],[13.3,32.9],[15.2,32.4],[15.7,31.4],[17.8,30.9],[18.9,30.3],[19.6,30.4],[20.0,30.8],[20.1,31.2],[19.9,31.8],[20.1,32.2],[20.6,32.6],[21.6,32.9],[23.1,32.6],[23.1,32.3],[23.3,32.2],[24.9,32.0],[25.2,31.5],[26.8,31.5],[29.1,30.8],[30.9,31.6],[30.6,31.4],[31.1,31.6],[31.9,31.5],[32.1,31.3],[31.9,31.5],[31.8,31.3],[32.1,31.1],[32.3,31.3],[32.6,31.1],[33.9,31.2],[34.5,31.6],[35.6,34.2],[36.0,34.5],[35.8,35.6],[36.0,36.0],[35.8,36.3],[36.2,36.8],[36.0,36.9],[35.4,36.6],[34.7,36.8],[33.7,36.2],[32.8,36.0],[32.0,36.5],[30.6,36.9],[30.4,36.3],[29.7,36.2],[29.2,36.3],[29.0,36.7],[27.5,36.7],[28.2,37.0],[27.3,37.0],[27.5,37.2],[27.2,37.4],[27.2,38.0]],[[23.0,37.9],[23.5,37.4],[23.2,37.3],[22.7,37.5],[23.2,36.4],[22.7,36.8],[22.5,36.4],[22.1,37.0],[21.9,36.7],[21.6,37.1],[21.7,37.4],[21.1,37.9]],[[-0.8,37.8],[-0.7,37.6],[-1.3,37.6],[-2.2,36.7],[-4.4,36.7],[-5.2,36.4],[-5.6,36.0],[-6.4,36.6],[-6.2,36.9],[-6.4,36.8],[-6.9,37.3],[-7.8,37.0],[-9.0,37.0],[-8.8,37.4],[-8.9,38.0]],[[50.7,46.9],[49.3,46.5],[49.4,46.4],[48.2,45.7],[47.5,45.7],[47.4,45.2],[46.7,44.5],[47.3,44.1],[47.5,43.6],[47.6,43.9],[47.5,43.0],[47.7,42.7],[49.5,40.8],[50.4,40.3],[49.6,40.2],[49.2,39.0],[49.0,39.1],[48.9,38.4],[49.1,37.7],[50.1,37.4],[50.3,37.1],[50.9,36.8],[51.8,36.6],[53.7,36.9],[54.0,36.8],[53.8,37.9],[53.9,38.9],[53.7,39.2],[53.1,39.4],[53.2,39.6],[53.6,39.5],[53.5,39.9],[53.0,40.0],[53.0,39.8],[52.7,40.4],[52.9,41.0],[53.9,40.6],[54.4,40.7],[54.3,40.8],[54.7,40.9],[54.7,41.1],[54.1,41.5],[53.8,42.1],[53.0,42.0],[52.8,41.7],[52.9,41.2],[52.5,41.9],[52.6,42.8],[51.3,43.2],[51.3,43.5],[50.8,44.2],[50.3,44.4],[50.3,44.6],[51.5,44.5],[51.0,44.9],[51.4,45.4],[53.2,45.3],[52.8,45.6],[53.2,46.7],[52.9,47.0],[52.1,46.8],[51.2,47.1],[50.7,46.9]],[[49.1,37.7],[50.1,37.4],[50.3,37.1],[50.9,36.8],[51.8,36.6],[53.7,36.9],[54.0,36.8],[53.8,37.9]]]},{"id":"africa","nameI18n":{"zh-CN":"非洲大陆","en":"Africa"},"label":[18,2],"lines":[[[23.9,35.5],[24.2,35.6],[24.1,35.5],[24.4,35.4],[25.7,35.3],[25.8,35.1],[26.3,35.3],[26.2,35.0],[24.8,34.9],[24.5,35.2],[23.6,35.3],[23.7,35.7],[23.9,35.5]],[[34.5,35.6],[33.9,35.3],[34.0,35.0],[33.0,34.6],[32.4,34.7],[32.3,35.1],[32.9,35.2],[32.9,35.4],[34.5,35.6]],[[49.5,-12.4],[50.2,-14.0],[50.4,-15.6],[50.2,-16.0],[49.9,-15.5],[49.7,-15.5],[49.8,-16.8],[49.4,-17.2],[49.4,-18.3],[47.2,-24.8],[45.5,-25.6],[45.1,-25.5],[44.0,-25.0],[43.7,-24.3],[43.7,-23.4],[43.3,-22.4],[43.5,-21.4],[43.8,-21.2],[44.4,-19.9],[44.4,-19.4],[44.0,-18.3],[44.0,-17.4],[44.5,-16.2],[46.2,-15.7],[46.4,-15.9],[46.3,-15.7],[46.9,-15.2],[47.0,-15.5],[47.5,-14.7],[47.5,-15.0],[47.8,-14.6],[48.0,-14.7],[47.8,-14.5],[48.0,-14.0],[47.9,-13.7],[48.3,-13.7],[48.8,-13.3],[48.8,-12.5],[49.2,-12.1],[49.5,-12.4]],[[15.1,37.5],[15.3,37.1],[15.1,36.7],[14.5,36.8],[12.4,37.8]],[[54.6,26.5],[53.7,26.7],[52.5,27.6],[51.3,28.1],[50.9,29.1],[50.7,29.1],[50.1,30.2],[49.6,30.0],[49.0,30.4],[49.2,30.5],[49.0,30.5],[48.8,30.0],[48.0,30.0],[48.1,29.6],[47.7,29.4],[48.1,29.4],[48.8,27.7],[50.1,26.7],[50.2,26.1],[50.0,26.1],[50.8,24.8],[51.0,26.0],[51.3,26.2],[51.6,25.1],[51.3,24.3],[51.8,24.3],[51.8,24.0],[52.6,24.2],[53.8,24.1],[54.4,24.3],[54.7,24.8]],[[54.8,17.0],[54.1,17.0],[52.6,16.5],[52.2,16.2],[52.2,15.7],[51.3,15.2],[49.4,14.6],[48.7,14.1],[45.7,13.3],[45.0,12.8],[43.9,12.6],[43.5,12.7],[43.2,13.3],[43.3,13.7],[42.9,15.1],[42.7,15.2],[42.7,16.7],[41.2,18.7],[40.8,19.8],[39.7,20.4],[39.1,21.3],[39.1,22.6],[38.5,23.7],[37.9,24.2],[37.5,24.3],[37.2,24.8],[37.3,25.0],[35.2,28.0],[34.6,28.1],[35.0,29.6],[34.7,29.3],[34.4,28.0],[34.2,27.8],[33.2,28.6],[32.6,30.0],[32.5,29.9],[32.4,29.6],[32.7,28.9],[33.5,27.9],[33.5,27.6],[35.2,24.5],[35.8,23.9],[35.5,23.9],[35.7,22.9],[36.8,22.1],[36.9,21.6],[37.3,21.1],[37.1,21.0],[37.5,18.8],[38.2,18.2],[38.3,18.3],[38.6,18.1],[39.5,15.5],[39.8,15.1],[39.9,15.5],[40.2,15.0],[41.2,14.6],[42.4,13.2],[43.0,12.9],[43.4,12.4],[43.3,12.0],[42.5,11.5],[43.2,11.6],[44.3,10.5],[44.9,10.4],[45.8,10.8],[46.6,10.7],[47.4,11.2],[47.7,11.1],[50.1,11.5],[50.8,12.0],[51.3,11.8],[51.0,10.4],[51.2,10.6],[51.4,10.4],[50.9,10.3],[50.8,9.4],[48.0,4.5],[46.1,2.5],[43.7,0.9],[41.4,-1.9],[40.9,-2.0],[40.8,-2.4],[40.2,-2.7],[40.1,-3.3],[39.5,-4.5],[39.2,-4.7],[38.8,-6.1],[39.5,-7.0],[39.3,-7.5],[39.3,-8.4],[39.8,-9.9],[39.7,-10.0],[40.6,-10.7],[40.4,-11.3],[40.6,-12.6],[40.4,-13.0],[40.6,-13.0],[40.6,-14.5],[40.8,-14.5],[40.8,-14.8],[40.6,-15.5],[39.1,-17.0],[38.1,-17.2],[36.9,-18.0],[36.4,-18.8],[36.3,-18.7],[34.9,-19.8],[34.6,-19.7],[34.8,-19.8],[34.7,-20.5],[35.0,-20.8],[35.3,-21.7],[35.3,-22.4],[35.4,-22.5],[35.5,-22.1],[35.5,-23.8],[35.0,-24.7],[32.8,-25.6],[32.6,-26.0],[32.8,-26.3],[33.0,-26.1],[32.4,-28.5],[31.3,-29.4],[30.0,-31.3],[27.9,-33.1],[26.6,-33.7],[25.8,-33.7],[25.6,-34.0],[25.0,-34.0],[24.8,-34.2],[22.6,-34.0],[21.8,-34.4],[20.5,-34.5],[20.0,-34.8],[18.8,-34.4],[18.8,-34.1],[18.5,-34.1],[18.5,-34.3],[18.5,-33.9],[17.9,-32.8],[18.3,-32.5],[18.2,-31.7],[17.3,-30.4],[16.5,-28.6],[15.7,-28.0],[15.3,-27.4],[14.5,-24.2],[14.5,-22.4],[13.5,-20.9],[12.5,-18.9],[12.0,-18.5],[11.8,-18.0],[11.8,-15.8],[12.6,-13.4],[13.7,-12.1],[13.8,-11.1],[13.0,-9.0],[13.4,-8.7],[13.4,-8.4],[12.3,-6.1],[13.1,-5.9],[12.5,-6.0],[12.2,-5.8],[12.2,-5.3],[11.8,-4.6],[9.7,-2.5],[10.1,-2.5],[9.6,-2.4],[9.3,-1.9],[9.5,-1.9],[9.0,-1.3],[9.5,-1.6],[9.1,-1.3],[8.7,-0.6],[8.9,-0.7],[9.3,-0.4],[9.4,0.3],[9.8,0.0],[10.0,0.2],[9.5,0.3],[9.3,0.6],[9.6,0.6],[9.6,1.1],[9.4,1.1],[9.8,1.9],[9.9,3.1],[9.8,3.6],[9.6,3.6],[9.7,4.1],[9.4,3.9],[9.0,4.1],[8.9,4.6],[8.7,4.7],[8.6,4.5],[8.6,4.8],[8.4,4.7],[8.3,4.9],[8.3,4.6],[7.6,4.5],[7.5,4.7],[7.3,4.5],[7.1,4.7],[7.2,4.5],[6.9,4.4],[6.8,4.7],[6.9,4.4],[6.6,4.3],[6.6,4.5],[6.6,4.3],[6.1,4.3],[5.5,4.8],[5.5,5.5],[5.2,5.5],[5.5,5.6],[5.1,5.6],[4.9,6.0],[4.4,6.3],[3.5,6.4],[3.7,6.6],[3.3,6.4],[1.1,6.1],[0.9,5.8],[0.3,5.8],[-2.0,4.8],[-3.2,5.1],[-3.0,5.1],[-3.2,5.4],[-3.3,5.1],[-4.1,5.3],[-4.6,5.2],[-4.0,5.2],[-4.9,5.1],[-5.4,5.2],[-5.1,5.1],[-5.9,5.0],[-7.5,4.4],[-8.3,4.6],[-9.1,5.1],[-10.3,6.1],[-10.8,6.3],[-10.8,6.5],[-12.5,7.4],[-12.5,7.8],[-12.9,7.8],[-13.3,8.4],[-12.9,8.6],[-13.2,8.6],[-13.1,8.9],[-13.3,9.0],[-13.4,9.4],[-13.7,9.5],[-13.7,9.9],[-14.4,10.2],[-14.6,10.8],[-14.7,10.7],[-14.9,11.0],[-15.0,10.8],[-15.1,11.1],[-15.2,11.0],[-15.2,11.2],[-15.4,11.2],[-15.3,11.4],[-15.5,11.4],[-15.1,11.6],[-15.4,11.6],[-15.5,11.8],[-15.1,12.0],[-15.9,11.8],[-16.3,12.1],[-16.2,12.2],[-16.8,12.5],[-16.4,12.6],[-16.8,12.6],[-16.7,13.5],[-16.6,13.3],[-15.4,13.5],[-16.4,13.4],[-16.8,13.9],[-16.6,14.0],[-16.8,14.0],[-17.5,14.8],[-17.1,14.9],[-16.6,15.7],[-16.5,16.6],[-16.1,17.5],[-16.2,19.0],[-16.5,19.4],[-16.3,19.5],[-16.2,20.2],[-16.4,20.7],[-16.6,20.6],[-16.9,21.1],[-17.0,20.8],[-17.1,20.9],[-16.9,21.9],[-16.4,22.6],[-15.8,23.8],[-16.0,23.7],[-14.9,24.7],[-14.5,26.2],[-13.6,26.7],[-13.2,27.7],[-11.6,28.3],[-10.2,29.4],[-9.7,30.1],[-9.9,30.7],[-9.8,31.4],[-9.3,32.1],[-9.2,32.6],[-8.5,33.3],[-6.9,34.0],[-5.9,35.8],[-5.3,35.9],[-5.3,35.6],[-4.6,35.2],[-3.4,35.2],[-3.0,35.4],[-2.8,35.1],[-1.9,35.1],[-0.9,35.7],[-0.4,35.9],[-0.0,35.8],[0.3,36.2],[1.3,36.5],[3.8,36.9],[4.8,36.9],[5.3,36.6],[6.5,37.1],[6.9,36.9],[7.2,37.1],[7.9,36.9],[9.7,37.3],[9.8,37.1],[9.9,37.3],[10.2,37.2],[10.4,36.7],[11.1,37.1],[11.1,36.9],[10.5,36.3],[11.1,35.2],[10.0,34.1],[10.3,33.7],[10.7,33.7],[10.7,33.5],[11.0,33.6],[11.3,33.3],[11.2,33.2],[12.3,32.9],[13.3,32.9],[15.2,32.4],[15.7,31.4],[17.8,30.9],[18.9,30.3],[19.6,30.4],[20.0,30.8],[20.1,31.2],[19.9,31.8],[20.1,32.2],[20.6,32.6],[21.6,32.9],[23.1,32.6],[23.1,32.3],[23.3,32.2],[24.9,32.0],[25.2,31.5],[26.8,31.5],[29.1,30.8],[30.9,31.6],[30.6,31.4],[31.1,31.6],[31.9,31.5],[32.1,31.3],[31.9,31.5],[31.8,31.3],[32.1,31.1],[32.3,31.3],[32.6,31.1],[33.9,31.2],[34.5,31.6],[35.6,34.2],[36.0,34.5],[35.8,35.6],[36.0,36.0],[35.8,36.3],[36.2,36.8],[36.0,36.9],[35.4,36.6],[34.7,36.8],[33.7,36.2],[32.8,36.0],[32.0,36.5],[30.6,36.9],[30.4,36.3],[29.7,36.2],[29.2,36.3],[29.0,36.7],[27.5,36.7],[28.2,37.0],[27.3,37.0],[27.5,37.2],[27.2,37.4],[27.2,38.0]],[[23.0,37.9],[23.5,37.4],[23.2,37.3],[22.7,37.5],[23.2,36.4],[22.7,36.8],[22.5,36.4],[22.1,37.0],[21.9,36.7],[21.6,37.1],[21.7,37.4],[21.1,37.9]],[[-0.8,37.8],[-0.7,37.6],[-1.3,37.6],[-2.2,36.7],[-4.4,36.7],[-5.2,36.4],[-5.6,36.0],[-6.4,36.6],[-6.2,36.9],[-6.4,36.8],[-6.9,37.3],[-7.8,37.0],[-9.0,37.0],[-8.8,37.4],[-8.9,38.0]],[[49.1,37.7],[50.1,37.4],[50.3,37.1],[50.9,36.8],[51.8,36.6],[53.7,36.9],[54.0,36.8],[53.8,37.9]]]},{"id":"america","nameI18n":{"zh-CN":"美洲大陆","en":"America"},"label":[-88,8],"lines":[[[-58.9,-51.3],[-58.4,-51.3],[-58.5,-51.5],[-58.3,-51.6],[-58.3,-51.4],[-58.0,-51.4],[-57.8,-51.5],[-58.0,-51.6],[-57.8,-51.6],[-58.7,-51.9],[-58.7,-52.1],[-59.2,-52.0],[-59.1,-52.2],[-59.4,-52.3],[-59.6,-51.9],[-59.1,-51.7],[-58.9,-51.3]],[[-37.1,-54.1],[-36.3,-54.3],[-35.8,-54.8],[-36.1,-54.9],[-36.9,-54.3],[-38.0,-54.0],[-37.1,-54.1]],[[-73.8,-43.3],[-74.1,-43.4],[-74.4,-43.2],[-74.0,-41.8],[-73.5,-41.9],[-73.4,-42.2],[-73.5,-42.5],[-73.8,-42.6],[-73.4,-42.9],[-73.8,-43.3]],[[-60.3,-51.5],[-59.3,-51.4],[-59.9,-52.0],[-60.4,-52.2],[-61.0,-52.1],[-60.2,-51.8],[-60.6,-51.7],[-60.2,-51.6],[-60.6,-51.4],[-60.3,-51.5]],[[-74.5,-49.1],[-74.6,-50.0],[-74.8,-50.0],[-74.9,-49.7],[-74.7,-49.4],[-75.0,-49.5],[-75.1,-49.9],[-75.5,-49.8],[-75.5,-49.6],[-75.3,-49.6],[-75.5,-49.4],[-75.1,-49.3],[-75.2,-49.1],[-74.9,-49.0],[-74.9,-48.7],[-74.5,-48.8],[-74.5,-49.1]],[[-61.8,49.1],[-63.0,49.2],[-64.5,49.9],[-63.1,49.8],[-61.8,49.3],[-61.8,49.1]],[[-61.1,45.9],[-60.9,46.0],[-61.1,45.7],[-60.7,45.8],[-60.5,46.0],[-60.7,46.0],[-60.3,46.3],[-59.9,46.2],[-59.8,46.0],[-60.7,45.6],[-61.5,45.7],[-61.4,46.2],[-60.5,47.0],[-60.3,46.8],[-60.5,46.3],[-61.1,45.9]],[[-171.5,63.6],[-170.4,63.7],[-168.7,63.3],[-169.7,63.0],[-171.0,63.5],[-171.5,63.3],[-171.8,63.4],[-171.7,63.7],[-171.5,63.6]],[[-166.1,60.4],[-165.7,60.3],[-165.6,59.9],[-166.1,59.8],[-167.4,60.2],[-166.1,60.4]],[[-163.5,55.0],[-163.1,54.7],[-164.6,54.4],[-164.9,54.5],[-164.5,54.9],[-163.5,55.0]],[[-77.3,18.5],[-76.3,18.2],[-76.2,17.9],[-76.9,18.0],[-76.9,17.8],[-77.1,17.9],[-77.2,17.7],[-77.8,17.9],[-78.3,18.3],[-77.3,18.5]],[[-66.1,18.4],[-65.6,18.4],[-65.6,18.2],[-66.0,18.0],[-67.2,18.0],[-67.3,18.4],[-66.1,18.4]],[[-152.9,57.8],[-152.4,57.8],[-152.5,57.7],[-152.2,57.6],[-153.0,57.5],[-152.7,57.3],[-153.7,57.1],[-153.6,57.0],[-154.0,56.8],[-153.8,57.0],[-154.4,57.1],[-154.2,57.0],[-154.3,56.9],[-154.7,57.3],[-154.5,57.6],[-154.1,57.7],[-153.7,57.3],[-153.8,57.9],[-153.5,57.7],[-153.2,57.8],[-153.2,58.0],[-152.8,57.9],[-152.9,57.8]],[[-133.6,56.3],[-133.2,56.3],[-132.6,55.9],[-132.2,55.5],[-132.6,55.5],[-132.0,55.2],[-132.0,54.7],[-132.6,55.1],[-132.8,55.0],[-133.1,55.3],[-133.0,55.6],[-133.7,55.8],[-133.2,55.9],[-133.7,56.0],[-133.5,56.1],[-133.6,56.3]],[[-135.0,57.4],[-134.6,56.7],[-134.7,56.2],[-135.0,56.5],[-134.9,56.7],[-135.3,56.8],[-135.2,57.0],[-135.5,57.2],[-135.8,57.0],[-135.8,57.3],[-135.4,57.5],[-135.0,57.4]],[[-134.7,58.2],[-134.2,58.1],[-133.8,57.6],[-134.3,58.0],[-133.9,57.4],[-134.4,57.1],[-134.6,57.1],[-134.5,57.5],[-134.7,57.6],[-134.9,58.4],[-134.7,58.2]],[[-135.7,58.2],[-135.7,58.0],[-135.0,58.0],[-135.0,57.8],[-135.3,57.8],[-134.9,57.5],[-135.6,57.7],[-135.7,57.4],[-135.9,57.4],[-136.6,58.0],[-136.3,58.2],[-135.7,58.2]],[[-132.7,54.1],[-132.2,54.0],[-132.2,53.8],[-132.6,53.7],[-132.2,53.7],[-132.1,54.0],[-131.7,54.1],[-132.0,53.3],[-132.7,53.3],[-132.4,53.3],[-133.1,53.8],[-133.0,54.2],[-132.7,54.1]],[[-131.8,53.2],[-131.6,52.9],[-132.0,52.9],[-131.5,52.7],[-131.6,52.6],[-131.1,52.3],[-131.2,52.2],[-132.2,52.8],[-132.3,52.9],[-132.1,53.0],[-132.5,53.1],[-131.8,53.2]],[[-63.8,46.5],[-62.0,46.4],[-62.5,46.2],[-62.5,46.0],[-63.0,46.1],[-63.0,46.3],[-63.6,46.2],[-64.4,46.7],[-64.0,47.1],[-64.1,46.8],[-63.8,46.5]],[[-72.5,41.0],[-74.0,40.6],[-73.6,40.9],[-72.6,41.0],[-72.3,41.2],[-72.5,41.0]],[[-69.2,-52.7],[-68.6,-52.7],[-68.2,-53.1],[-68.5,-53.3],[-68.2,-53.3],[-67.3,-54.0],[-66.2,-54.5],[-65.2,-54.7],[-65.5,-54.9],[-66.5,-55.0],[-68.2,-54.8],[-69.5,-54.9],[-69.7,-54.7],[-70.5,-54.8],[-71.9,-54.6],[-71.8,-54.4],[-70.8,-54.3],[-70.7,-54.5],[-70.3,-54.5],[-70.9,-54.1],[-70.9,-53.9],[-70.5,-53.6],[-70.4,-54.0],[-70.6,-54.0],[-70.2,-54.3],[-69.7,-54.3],[-69.3,-54.6],[-69.0,-54.4],[-70.2,-53.9],[-69.4,-53.4],[-70.2,-53.4],[-70.5,-53.2],[-70.1,-52.9],[-70.4,-52.8],[-69.9,-52.8],[-69.5,-52.5],[-69.2,-52.7]],[[-81.8,23.2],[-79.8,22.9],[-79.9,22.8],[-79.3,22.4],[-78.7,22.4],[-77.6,21.8],[-77.5,21.9],[-77.1,21.6],[-77.4,21.6],[-77.3,21.5],[-77.1,21.6],[-76.8,21.4],[-76.9,21.3],[-75.7,21.1],[-75.7,20.7],[-74.9,20.7],[-74.2,20.2],[-75.1,19.9],[-77.7,19.9],[-77.1,20.4],[-77.2,20.6],[-78.1,20.8],[-78.5,21.1],[-78.7,21.6],[-79.4,21.6],[-81.2,22.3],[-81.3,22.1],[-81.8,22.2],[-82.1,22.4],[-81.7,22.5],[-81.8,22.7],[-82.7,22.7],[-83.4,22.2],[-83.9,22.2],[-84.0,21.9],[-84.9,21.9],[-84.3,22.1],[-84.4,22.4],[-83.3,23.0],[-81.8,23.2]],[[-52.7,69.9],[-52.0,69.8],[-51.9,69.6],[-53.8,69.3],[-54.2,69.4],[-53.7,69.5],[-54.9,69.7],[-54.8,70.0],[-54.3,69.9],[-54.8,70.1],[-54.7,70.3],[-53.3,70.2],[-52.7,69.9]],[[-127.2,50.6],[-125.5,50.3],[-124.8,49.5],[-124.0,49.2],[-123.3,48.5],[-123.6,48.3],[-125.0,48.7],[-125.1,48.8],[-124.8,49.2],[-124.9,49.0],[-125.5,49.0],[-125.8,49.1],[-125.6,49.2],[-126.0,49.2],[-125.9,49.4],[-126.5,49.4],[-126.5,49.6],[-126.1,49.7],[-127.1,49.9],[-127.5,50.2],[-127.9,50.1],[-127.8,50.3],[-128.0,50.3],[-127.5,50.4],[-127.5,50.6],[-128.1,50.5],[-128.3,50.7],[-128.2,50.8],[-127.9,50.9],[-127.2,50.6]],[[-72.0,19.7],[-71.7,19.7],[-71.6,19.9],[-71.0,19.9],[-70.2,19.6],[-70.0,19.7],[-69.7,19.3],[-69.2,19.3],[-69.6,19.1],[-68.7,18.9],[-68.4,18.5],[-68.7,18.2],[-68.9,18.4],[-70.5,18.2],[-71.0,18.3],[-71.4,17.6],[-72.1,18.2],[-73.7,18.2],[-73.9,18.0],[-74.5,18.4],[-74.2,18.7],[-72.8,18.4],[-72.3,18.7],[-72.8,19.1],[-72.7,19.4],[-73.4,19.7],[-73.3,19.9],[-72.0,19.7]],[[-49.6,-0.2],[-48.4,-0.3],[-48.8,-1.4],[-49.2,-1.4],[-49.2,-1.6],[-49.5,-1.5],[-49.8,-1.8],[-50.5,-1.8],[-50.8,-1.2],[-50.6,-1.1],[-50.8,-0.9],[-50.6,-0.3],[-50.2,-0.1],[-49.6,-0.2]],[[-171.8,66.9],[-170.5,66.3],[-170.6,66.2],[-170.3,66.3],[-169.7,66.1],[-170.5,65.9],[-170.7,65.6],[-171.5,65.8],[-171.1,65.5],[-171.9,65.5]],[[-74.4,-52.9],[-73.1,-53.4],[-74.3,-53.1],[-74.7,-52.7],[-74.4,-52.9]],[[-69.7,-54.9],[-68.4,-55.0],[-68.6,-55.2],[-68.0,-55.6],[-68.9,-55.5],[-68.9,-55.2],[-69.3,-55.2],[-69.4,-55.3],[-69.2,-55.5],[-70.0,-55.1],[-69.7,-54.9]],[[-72.9,-53.5],[-72.2,-53.8],[-72.9,-54.1],[-72.8,-53.9],[-73.0,-53.8],[-73.2,-54.0],[-73.3,-53.7],[-73.8,-53.5],[-72.9,-53.5]],[[-73.7,-44.4],[-74.0,-44.5],[-73.8,-44.8],[-73.8,-45.3],[-74.1,-45.3],[-74.6,-44.6],[-74.1,-44.4],[-74.0,-44.1],[-73.7,-44.4]],[[-155.6,19.0],[-155.9,19.1],[-156.0,19.8],[-155.8,20.3],[-155.2,20.0],[-154.8,19.5],[-155.6,19.0]],[[-168.0,53.3],[-169.1,52.8],[-168.3,53.5],[-167.8,53.5],[-168.0,53.3]],[[-166.6,53.9],[-166.2,53.9],[-166.5,53.7],[-166.3,53.7],[-167.8,53.3],[-167.1,53.5],[-167.0,53.7],[-166.8,53.6],[-166.7,53.7],[-167.1,53.9],[-166.6,53.9]],[[-77.2,25.9],[-77.4,26.0],[-77.2,26.2],[-77.2,26.6],[-77.9,26.9],[-77.5,26.9],[-77.1,26.5],[-77.0,26.3],[-77.2,26.2],[-77.2,25.9]],[[-86.6,71.0],[-85.6,71.2],[-85.1,71.2],[-84.8,71.0],[-84.7,71.6],[-85.9,72.0],[-85.3,72.2],[-84.3,72.0],[-84.8,72.3],[-84.6,72.4],[-85.3,72.4],[-85.7,72.7],[-85.3,73.0],[-84.3,72.8],[-85.5,73.1],[-84.4,73.5],[-83.8,73.4],[-83.9,73.5],[-82.7,73.7],[-81.6,73.7],[-80.3,72.8],[-81.2,72.3],[-80.6,72.5],[-80.9,72.2],[-80.7,72.1],[-80.9,72.1],[-80.9,71.9],[-79.9,72.2],[-80.1,72.3],[-79.8,72.4],[-79.0,72.3],[-79.0,72.0],[-78.6,71.9],[-78.9,72.1],[-78.7,72.4],[-77.5,72.2],[-78.3,72.4],[-78.5,72.5],[-78.4,72.6],[-76.9,72.7],[-75.3,72.5],[-75.1,72.2],[-75.9,71.7],[-75.1,72.1],[-74.3,72.0],[-74.3,71.8],[-75.2,71.7],[-74.7,71.7],[-75.0,71.2],[-73.9,71.8],[-73.7,71.7],[-74.2,71.4],[-73.7,71.6],[-73.2,71.3],[-73.3,71.5],[-72.9,71.7],[-71.6,71.5],[-71.2,71.3],[-72.6,70.8],[-70.7,71.1],[-70.6,70.9],[-71.9,70.4],[-71.4,70.6],[-71.4,70.1],[-71.0,70.6],[-69.3,70.8],[-68.4,70.5],[-70.1,70.0],[-68.8,70.2],[-68.7,70.1],[-69.0,70.0],[-68.7,69.9],[-68.1,70.3],[-67.3,70.0],[-67.2,69.8],[-69.3,69.5],[-67.4,69.5],[-66.7,69.3],[-66.8,69.2],[-69.0,69.1],[-68.4,69.2],[-67.8,69.0],[-67.9,68.8],[-69.3,68.9],[-67.9,68.5],[-66.7,68.4],[-67.0,68.3],[-66.7,68.0],[-66.6,68.2],[-66.2,68.3],[-66.5,67.9],[-66.4,67.8],[-65.9,68.1],[-65.9,67.9],[-65.5,68.0],[-65.4,67.7],[-65.4,67.9],[-64.8,68.0],[-65.0,67.8],[-63.9,67.6],[-64.1,67.5],[-64.0,67.3],[-64.6,67.3],[-63.6,67.4],[-63.0,67.2],[-63.7,66.8],[-62.1,67.0],[-61.3,66.6],[-61.9,66.7],[-62.1,66.6],[-61.6,66.4],[-61.9,66.3],[-62.6,66.4],[-62.0,66.0],[-62.6,66.0],[-62.4,65.8],[-62.7,65.6],[-63.5,65.9],[-63.4,65.7],[-63.7,65.7],[-63.3,65.6],[-63.6,64.9],[-64.2,65.1],[-64.3,65.4],[-64.6,65.1],[-65.4,65.8],[-64.4,66.3],[-65.8,66.0],[-65.9,66.1],[-65.7,66.2],[-66.1,66.1],[-67.3,66.6],[-67.2,66.3],[-67.9,66.5],[-67.2,66.0],[-67.3,65.9],[-68.7,66.2],[-68.2,66.1],[-67.9,65.6],[-67.1,65.4],[-67.3,65.3],[-66.8,65.1],[-66.7,64.8],[-66.6,65.0],[-66.2,64.9],[-66.2,64.7],[-65.9,64.9],[-65.4,64.7],[-65.3,64.6],[-65.5,64.5],[-65.1,64.4],[-65.6,64.3],[-65.2,64.0],[-64.7,64.0],[-64.8,63.9],[-64.4,63.7],[-64.6,63.7],[-64.5,63.3],[-64.7,63.2],[-65.2,63.8],[-65.1,63.3],[-64.7,62.9],[-65.2,62.9],[-65.0,62.7],[-65.1,62.6],[-66.2,63.1],[-66.4,63.0],[-66.7,63.3],[-66.6,63.1],[-67.3,63.3],[-67.9,63.7],[-67.7,63.4],[-68.9,63.7],[-66.0,62.2],[-66.1,61.9],[-66.3,61.9],[-69.1,62.4],[-69.6,62.8],[-71.1,63.0],[-70.9,63.1],[-71.3,63.0],[-72.0,63.4],[-71.6,63.4],[-71.4,63.6],[-72.3,63.7],[-72.2,63.9],[-72.5,63.8],[-73.5,64.4],[-73.3,64.6],[-73.9,64.6],[-74.1,64.4],[-74.1,64.6],[-74.9,64.8],[-74.6,64.6],[-74.7,64.5],[-75.7,64.5],[-76.9,64.2],[-78.2,64.6],[-78.1,65.0],[-77.4,65.2],[-77.5,65.4],[-77.3,65.5],[-75.5,65.1],[-75.5,64.8],[-75.4,65.0],[-75.8,65.3],[-73.6,65.5],[-73.7,65.8],[-74.3,66.0],[-74.4,66.2],[-73.0,66.7],[-72.8,67.0],[-72.2,67.3],[-73.3,68.4],[-73.6,68.3],[-73.9,68.4],[-73.9,68.7],[-74.1,68.7],[-74.0,68.5],[-74.9,68.8],[-74.7,68.9],[-75.0,69.0],[-74.7,69.0],[-74.9,69.1],[-75.2,68.9],[-75.5,69.0],[-76.6,68.7],[-76.6,69.0],[-75.6,69.2],[-76.5,69.5],[-76.2,69.7],[-77.1,69.6],[-76.9,69.8],[-77.6,69.8],[-77.8,70.2],[-78.3,70.2],[-79.1,70.6],[-79.4,70.4],[-78.8,70.2],[-78.8,70.0],[-79.1,69.9],[-81.7,70.1],[-80.9,69.9],[-80.9,69.7],[-83.2,70.0],[-85.8,70.0],[-86.3,70.1],[-86.5,70.3],[-86.4,70.5],[-87.9,70.3],[-88.8,70.5],[-89.5,71.1],[-87.8,70.9],[-87.1,71.0],[-89.7,71.4],[-90.0,71.9],[-89.7,72.2],[-89.9,72.2],[-89.8,72.5],[-89.2,73.1],[-87.7,73.7],[-85.0,73.8],[-86.7,72.8],[-86.3,72.5],[-86.2,71.9],[-85.0,71.4],[-86.6,71.0]],[[-69.5,83.0],[-66.4,82.9],[-68.5,82.7],[-64.9,82.9],[-63.5,82.8],[-63.6,82.7],[-63.1,82.6],[-63.2,82.5],[-61.7,82.5],[-61.2,82.3],[-64.4,81.7],[-68.7,81.3],[-64.8,81.5],[-69.6,80.4],[-70.7,80.5],[-70.2,80.3],[-70.3,80.2],[-72.1,80.1],[-70.6,80.1],[-71.4,79.9],[-71.1,79.8],[-72.4,79.7],[-74.4,79.9],[-74.7,79.8],[-73.5,79.8],[-73.2,79.6],[-73.5,79.5],[-76.9,79.5],[-74.5,79.1],[-78.6,79.1],[-77.9,78.9],[-76.3,79.0],[-74.4,78.7],[-74.9,78.5],[-76.4,78.5],[-75.2,78.3],[-76.0,78.0],[-78.0,77.9],[-78.1,77.5],[-78.5,77.4],[-80.6,77.3],[-81.7,77.5],[-81.3,77.4],[-82.1,77.3],[-81.8,77.2],[-79.3,77.2],[-79.2,76.9],[-78.0,76.9],[-78.3,76.6],[-80.7,76.2],[-81.0,76.2],[-80.8,76.4],[-81.0,76.5],[-82.5,76.7],[-82.2,76.5],[-83.9,76.5],[-84.2,76.7],[-84.3,76.4],[-85.3,76.3],[-86.5,76.6],[-86.7,76.4],[-87.4,76.4],[-87.5,76.6],[-87.5,76.4],[-88.4,76.4],[-88.5,76.8],[-88.5,76.4],[-89.6,76.5],[-89.5,76.8],[-88.6,77.1],[-86.8,77.2],[-87.7,77.4],[-88.1,77.7],[-88.0,77.8],[-86.8,77.9],[-85.6,77.5],[-83.6,77.4],[-82.6,78.0],[-83.8,77.5],[-84.9,77.5],[-85.3,77.6],[-85.5,77.9],[-84.2,78.2],[-84.9,78.2],[-84.8,78.5],[-85.6,78.1],[-86.2,78.1],[-85.9,78.3],[-86.9,78.1],[-87.6,78.2],[-86.8,78.8],[-83.3,78.8],[-81.8,79.0],[-84.4,79.0],[-84.6,79.1],[-83.6,79.1],[-85.3,79.7],[-86.4,79.8],[-86.6,80.1],[-86.5,80.3],[-83.7,80.2],[-81.7,79.7],[-80.5,79.6],[-80.1,79.7],[-81.0,79.7],[-83.0,80.3],[-76.9,80.9],[-78.7,81.0],[-76.9,81.4],[-79.2,81.1],[-79.8,80.8],[-82.9,80.6],[-82.2,80.8],[-85.1,80.5],[-86.6,80.6],[-86.3,80.8],[-83.3,81.1],[-85.8,81.0],[-87.7,80.7],[-89.3,80.9],[-86.5,81.0],[-84.9,81.3],[-89.6,81.0],[-90.0,81.1],[-89.2,81.2],[-89.7,81.3],[-89.4,81.4],[-87.6,81.5],[-90.6,81.4],[-89.8,81.6],[-91.7,81.6],[-88.1,82.1],[-85.0,82.0],[-86.6,82.2],[-84.9,82.4],[-79.4,81.9],[-82.4,82.4],[-81.7,82.5],[-82.1,82.6],[-80.8,82.6],[-81.2,82.7],[-81.0,82.8],[-78.7,82.7],[-80.2,82.9],[-77.5,82.9],[-76.0,82.5],[-75.6,82.6],[-77.1,83.0],[-74.4,83.0],[-72.7,82.7],[-73.4,82.9],[-72.8,83.1],[-70.9,82.9],[-71.4,83.0],[-69.5,83.0]],[[-94.3,71.8],[-93.8,71.8],[-93.8,71.6],[-93.0,71.3],[-93.0,70.9],[-91.6,70.2],[-92.3,70.2],[-92.5,70.1],[-92.0,70.0],[-92.9,69.7],[-90.4,69.5],[-91.2,69.3],[-90.7,69.1],[-90.5,68.9],[-90.6,68.5],[-90.2,68.3],[-89.3,69.3],[-88.0,68.8],[-87.8,68.3],[-88.3,68.3],[-88.3,68.0],[-87.4,67.2],[-86.6,67.5],[-86.0,68.1],[-85.7,68.7],[-84.9,68.8],[-85.1,68.8],[-84.9,69.1],[-85.4,69.2],[-85.5,69.8],[-82.4,69.6],[-82.8,69.5],[-82.3,69.4],[-82.2,69.2],[-81.3,69.1],[-82.0,68.9],[-81.3,68.7],[-82.6,68.4],[-82.2,68.1],[-82.0,68.2],[-82.1,67.9],[-81.3,67.5],[-81.5,67.1],[-82.3,66.7],[-83.6,66.4],[-84.5,67.0],[-84.8,67.0],[-85.1,66.9],[-84.2,66.7],[-83.8,66.3],[-83.9,66.2],[-84.6,66.2],[-85.6,66.6],[-86.7,66.5],[-86.0,66.1],[-87.5,65.3],[-88.0,65.3],[-88.7,65.7],[-89.7,65.9],[-91.4,65.9],[-89.9,65.8],[-89.0,65.3],[-87.0,65.2],[-88.1,64.2],[-88.8,64.0],[-89.6,64.0],[-89.8,64.2],[-90.0,64.1],[-89.9,64.0],[-90.2,64.0],[-90.0,63.8],[-90.8,63.6],[-93.7,64.1],[-93.7,63.9],[-92.2,63.7],[-92.5,63.6],[-91.8,63.7],[-90.7,63.3],[-90.8,63.0],[-91.4,62.8],[-92.4,62.8],[-91.9,62.6],[-92.8,62.4],[-92.5,62.2],[-93.2,62.4],[-92.9,62.2],[-93.6,61.9],[-93.3,61.8],[-93.9,61.5],[-94.5,60.6],[-94.8,60.5],[-94.6,60.4],[-94.8,60.0],[-94.8,59.3],[-95.0,59.1],[-94.3,58.7],[-94.3,58.3],[-94.1,58.7],[-93.2,58.7],[-92.4,57.3],[-92.8,56.9],[-90.6,57.2],[-88.8,56.8],[-87.5,56.0],[-85.7,55.6],[-85.2,55.3],[-85.4,55.1],[-85.1,55.3],[-82.4,55.1],[-82.2,54.8],[-82.4,54.2],[-82.1,53.8],[-82.3,53.0],[-81.6,52.4],[-81.8,52.2],[-80.7,51.8],[-80.4,51.4],[-80.9,51.1],[-80.1,51.3],[-79.3,50.8],[-79.7,51.1],[-79.7,51.3],[-79.3,51.6],[-79.0,51.5],[-78.9,51.2],[-78.7,51.5],[-79.0,51.8],[-78.4,52.3],[-78.9,53.0],[-79.1,53.7],[-78.9,53.8],[-79.1,53.9],[-79.1,54.2],[-79.7,54.7],[-77.8,55.3],[-76.8,56.0],[-76.5,56.5],[-76.9,57.8],[-78.5,58.6],[-77.7,59.7],[-77.3,59.6],[-77.5,59.7],[-77.3,60.0],[-77.6,60.1],[-77.7,60.4],[-77.5,60.5],[-77.8,60.6],[-77.6,60.8],[-78.2,60.8],[-77.5,61.6],[-78.0,61.8],[-78.1,62.3],[-77.4,62.6],[-74.6,62.1],[-73.7,62.5],[-72.7,62.1],[-72.6,62.0],[-72.8,61.8],[-72.5,61.9],[-72.0,61.7],[-72.2,61.6],[-71.6,61.6],[-71.9,61.4],[-71.6,61.4],[-71.7,61.3],[-70.3,61.1],[-70.0,60.9],[-69.5,61.0],[-69.4,60.8],[-69.8,60.5],[-69.6,60.2],[-69.7,60.1],[-70.7,60.0],[-69.7,59.9],[-69.7,59.3],[-69.3,59.3],[-69.5,58.9],[-69.7,58.8],[-69.8,59.0],[-70.2,58.8],[-69.8,58.7],[-68.7,58.9],[-68.2,58.5],[-69.0,57.9],[-68.4,58.1],[-68.0,58.5],[-67.9,58.3],[-68.1,58.1],[-67.8,58.4],[-67.7,58.0],[-66.4,58.8],[-66.1,58.7],[-66.0,58.4],[-66.0,58.8],[-65.4,59.1],[-65.7,59.2],[-65.5,59.4],[-65.4,59.3],[-65.5,59.5],[-65.0,59.4],[-65.4,59.5],[-65.4,59.8],[-65.0,59.8],[-65.2,59.9],[-64.8,60.3],[-64.5,60.3],[-64.4,60.2],[-64.8,60.0],[-64.3,60.1],[-64.2,59.7],[-64.1,59.8],[-63.8,59.3],[-63.4,59.2],[-64.0,59.1],[-63.2,59.1],[-63.3,58.9],[-63.0,58.9],[-62.9,58.7],[-63.5,58.3],[-63.2,58.5],[-62.6,58.5],[-62.8,58.2],[-63.3,58.0],[-62.5,58.2],[-61.9,57.9],[-62.0,57.6],[-62.5,57.5],[-61.9,57.4],[-62.0,57.2],[-61.3,57.0],[-61.4,56.7],[-62.5,56.8],[-61.7,56.5],[-62.0,56.5],[-61.9,56.4],[-61.4,56.4],[-61.7,56.2],[-61.4,56.2],[-61.3,56.0],[-61.5,56.0],[-60.7,55.9],[-60.6,55.7],[-60.3,55.8],[-60.4,55.6],[-60.2,55.5],[-60.6,55.1],[-59.8,55.3],[-59.4,55.2],[-59.8,54.8],[-59.3,55.2],[-58.8,54.8],[-58.0,54.9],[-57.4,54.6],[-58.6,54.0],[-60.1,53.6],[-60.4,53.7],[-60.1,53.5],[-60.3,53.3],[-58.7,54.0],[-57.9,54.1],[-58.3,54.2],[-57.4,54.2],[-57.1,53.8],[-57.5,53.6],[-57.3,53.5],[-56.5,53.8],[-56.0,53.5],[-55.8,53.2],[-55.8,52.6],[-56.3,52.5],[-55.7,52.5],[-56.0,52.4],[-55.7,52.2],[-57.0,51.5],[-58.5,51.3],[-60.1,50.3],[-61.7,50.1],[-62.7,50.3],[-66.5,50.2],[-66.9,50.0],[-67.4,49.3],[-68.3,49.2],[-68.2,49.1],[-69.7,48.2],[-71.0,48.5],[-69.8,48.1],[-70.0,47.7],[-71.3,46.8],[-72.2,46.6],[-73.0,46.2],[-73.5,45.7],[-74.3,45.5],[-74.0,45.3],[-74.7,45.0],[-73.6,45.4],[-73.2,46.0],[-72.1,46.6],[-70.5,47.0],[-69.5,48.0],[-68.8,48.4],[-65.5,49.3],[-64.2,48.9],[-64.5,48.8],[-64.2,48.7],[-64.3,48.4],[-65.3,48.0],[-65.9,48.2],[-66.7,48.0],[-66.4,48.1],[-65.6,47.7],[-64.7,47.7],[-65.3,47.1],[-64.8,47.1],[-64.9,46.9],[-64.5,46.2],[-63.8,46.1],[-64.1,46.0],[-62.7,45.7],[-62.8,45.6],[-62.0,45.9],[-61.5,45.7],[-61.3,45.4],[-61.5,45.4],[-61.0,45.3],[-63.3,44.6],[-63.6,44.7],[-63.5,44.5],[-64.2,44.6],[-64.3,44.3],[-65.5,43.5],[-66.1,43.8],[-66.2,44.1],[-65.9,44.6],[-66.1,44.5],[-64.4,45.3],[-64.4,45.1],[-64.1,45.0],[-64.1,45.2],[-63.4,45.4],[-64.9,45.4],[-64.3,45.8],[-64.6,45.9],[-64.8,45.6],[-65.9,45.2],[-66.1,45.3],[-66.0,45.4],[-66.4,45.1],[-67.1,45.2],[-67.0,44.8],[-68.1,44.4],[-68.5,44.5],[-68.5,44.3],[-68.8,44.3],[-68.8,44.6],[-69.2,44.0],[-70.2,43.8],[-70.7,43.1],[-70.8,42.8],[-70.6,42.6],[-70.8,42.6],[-71.0,42.3],[-70.4,41.8],[-70.0,41.8],[-70.1,42.1],[-69.9,41.7],[-70.7,41.5],[-70.7,41.7],[-71.2,41.5],[-71.1,41.7],[-71.4,41.8],[-71.5,41.4],[-72.9,41.3],[-74.0,40.8],[-74.0,41.2],[-73.9,40.9],[-74.3,40.5],[-74.0,40.4],[-74.1,39.8],[-74.1,40.0],[-74.9,38.9],[-74.9,39.1],[-75.5,39.5],[-75.1,40.0],[-75.5,39.8],[-75.6,39.5],[-75.0,38.4],[-75.9,37.2],[-76.0,37.4],[-75.7,38.0],[-75.9,38.0],[-75.9,38.4],[-76.3,38.4],[-76.3,38.6],[-76.0,38.6],[-76.2,38.8],[-76.3,38.7],[-76.3,39.0],[-75.9,39.5],[-76.1,39.6],[-76.1,39.4],[-76.4,39.2],[-76.6,39.3],[-76.4,39.1],[-76.6,39.1],[-76.4,38.4],[-76.7,38.5],[-76.3,38.1],[-77.2,38.4],[-77.0,38.9],[-77.3,38.4],[-77.0,38.4],[-76.3,37.9],[-76.3,37.7],[-76.5,37.7],[-77.1,38.2],[-76.3,37.6],[-76.5,37.3],[-76.8,37.5],[-76.3,37.1],[-77.3,37.3],[-76.7,37.2],[-76.5,36.9],[-76.0,36.9],[-75.5,35.8],[-75.9,36.7],[-76.0,36.5],[-75.8,36.1],[-76.1,36.3],[-76.2,36.1],[-76.3,36.2],[-76.2,36.1],[-76.6,36.0],[-76.7,36.2],[-76.7,36.0],[-76.1,36.0],[-76.1,35.7],[-75.9,36.0],[-75.8,35.8],[-75.8,35.6],[-76.2,35.4],[-77.0,35.5],[-76.5,35.3],[-76.8,35.0],[-77.1,35.2],[-77.0,35.0],[-76.5,35.0],[-76.4,34.8],[-77.4,34.7],[-77.4,34.5],[-77.8,34.3],[-77.9,33.9],[-78.0,34.2],[-78.0,33.9],[-78.8,33.7],[-79.9,32.7],[-80.6,32.5],[-80.6,32.3],[-80.8,32.4],[-80.7,32.2],[-81.4,31.4],[-81.5,30.8],[-81.2,29.8],[-80.5,28.5],[-80.5,27.9],[-80.6,28.5],[-80.7,28.3],[-80.7,28.6],[-80.0,26.8],[-80.1,25.8],[-80.5,25.2],[-81.1,25.1],[-81.1,25.3],[-80.9,25.3],[-81.7,26.0],[-82.0,26.5],[-81.8,26.7],[-82.0,26.6],[-82.0,27.0],[-82.2,26.8],[-82.7,27.5],[-82.4,27.8],[-82.6,28.0],[-82.7,27.7],[-82.8,27.8],[-82.7,28.9],[-84.0,30.1],[-85.3,29.7],[-85.7,30.1],[-85.6,30.3],[-85.8,30.2],[-86.5,30.4],[-86.1,30.4],[-86.3,30.5],[-87.2,30.3],[-87.0,30.6],[-87.3,30.3],[-88.0,30.2],[-87.8,30.3],[-88.0,30.7],[-88.1,30.4],[-89.6,30.2],[-90.1,30.4],[-90.4,30.1],[-90.2,30.0],[-89.7,30.2],[-89.8,30.0],[-89.4,30.0],[-89.7,29.6],[-89.0,29.2],[-89.2,29.0],[-90.2,29.5],[-90.1,29.1],[-90.5,29.3],[-90.8,29.1],[-91.3,29.3],[-91.2,29.6],[-91.9,29.8],[-92.1,29.6],[-93.2,29.8],[-93.8,29.7],[-93.8,30.0],[-93.9,29.7],[-94.8,29.4],[-94.5,29.5],[-94.8,29.5],[-94.7,29.8],[-95.0,29.7],[-94.9,29.4],[-95.9,28.6],[-96.2,28.5],[-96.0,28.6],[-96.6,28.7],[-96.4,28.5],[-97.2,28.1],[-97.0,28.1],[-97.4,27.8],[-97.4,27.3],[-97.8,27.5],[-97.5,27.2],[-97.6,27.0],[-97.1,26.0],[-97.7,24.4],[-97.7,22.9],[-97.9,22.6],[-97.8,22.1],[-97.3,21.6],[-97.4,21.3],[-97.4,21.6],[-97.8,22.0],[-97.1,20.6],[-95.9,18.8],[-95.2,18.7],[-94.5,18.2],[-92.4,18.7],[-91.5,18.5],[-91.3,18.6],[-91.3,18.9],[-91.5,18.8],[-90.7,19.4],[-90.4,21.0],[-88.5,21.6],[-87.3,21.4],[-87.2,21.5],[-87.4,21.6],[-87.0,21.6],[-86.8,21.4],[-86.8,21.0],[-87.7,19.6],[-87.4,19.6],[-87.7,19.4],[-87.5,19.3],[-87.9,18.3],[-88.1,18.5],[-88.0,18.8],[-88.2,18.7],[-88.3,18.4],[-88.1,18.4],[-88.1,18.2],[-88.3,17.6],[-88.3,16.6],[-88.9,15.9],[-88.1,15.7],[-87.7,15.9],[-86.4,15.8],[-86.0,16.0],[-85.0,16.0],[-84.3,15.8],[-83.8,15.4],[-84.1,15.4],[-83.8,15.2],[-83.5,15.2],[-83.6,15.4],[-83.2,15.0],[-83.4,14.8],[-83.2,14.3],[-83.6,13.3],[-83.5,12.4],[-83.6,12.7],[-83.8,12.5],[-83.7,11.6],[-83.9,11.3],[-82.1,8.9],[-81.8,9.0],[-81.9,9.1],[-81.5,8.8],[-81.1,8.8],[-79.6,9.6],[-78.5,9.4],[-77.8,9.1],[-76.8,7.9],[-76.9,8.6],[-76.0,9.4],[-75.6,9.4],[-75.7,9.7],[-75.5,10.2],[-75.7,10.1],[-75.2,10.8],[-74.8,11.1],[-74.3,11.0],[-74.5,10.9],[-74.4,10.8],[-74.1,11.3],[-73.3,11.3],[-71.6,12.4],[-71.1,12.0],[-72.0,11.6],[-71.6,11.0],[-71.6,10.7],[-72.1,9.8],[-71.6,9.0],[-71.1,9.3],[-71.5,11.0],[-69.8,11.5],[-69.8,11.7],[-70.2,11.6],[-70.3,11.9],[-70.0,12.2],[-69.6,11.5],[-68.4,11.2],[-68.1,10.5],[-66.2,10.6],[-65.9,10.3],[-64.8,10.1],[-64.2,10.5],[-63.7,10.5],[-64.3,10.6],[-61.9,10.7],[-62.9,10.5],[-62.3,9.8],[-62.1,10.0],[-61.7,9.6],[-61.8,9.8],[-61.6,9.9],[-60.8,9.4],[-61.2,8.6],[-61.6,8.6],[-61.3,8.4],[-60.2,8.6],[-59.2,8.1],[-58.5,7.3]],[[-78.2,7.5],[-78.4,8.1],[-78.1,8.4],[-77.8,8.1],[-78.1,8.5],[-78.4,8.4],[-78.5,8.6],[-79.4,9.0],[-80.5,8.2],[-80.0,7.5],[-80.8,7.2],[-81.1,7.9],[-81.3,7.6],[-81.7,8.1],[-82.2,8.3],[-82.7,8.3],[-82.9,8.1],[-83.2,8.6],[-83.5,8.7],[-83.3,8.4],[-83.6,8.5],[-83.7,9.2],[-84.6,9.6],[-84.7,9.9],[-85.2,10.2],[-84.9,9.8],[-85.1,9.6],[-85.6,9.9],[-85.8,10.3],[-85.7,10.7],[-85.9,10.9],[-85.7,11.1],[-87.7,12.9],[-87.3,12.9],[-87.5,13.4],[-88.0,13.2],[-88.7,13.3],[-88.5,13.2],[-90.5,13.9],[-91.4,14.0],[-93.9,16.1],[-94.4,16.3],[-94.0,16.0],[-94.9,16.4],[-95.0,16.3],[-94.8,16.2],[-96.5,15.7],[-97.8,16.0],[-100.8,17.2],[-101.9,18.0],[-103.4,18.3],[-103.9,18.8],[-104.9,19.3],[-105.7,20.4],[-105.3,20.6],[-105.3,20.8],[-105.5,20.8],[-105.2,21.1],[-105.2,21.5],[-105.4,21.6],[-105.8,22.6],[-106.9,23.9],[-107.8,24.5],[-107.5,24.5],[-108.0,24.6],[-108.3,25.1],[-108.1,25.1],[-109.0,25.5],[-109.1,25.6],[-108.9,25.7],[-109.4,25.7],[-109.4,26.0],[-109.1,26.3],[-109.5,26.7],[-109.8,26.7],[-109.9,27.1],[-110.5,27.3],[-110.5,27.9],[-111.1,28.0],[-112.2,29.0],[-112.2,29.3],[-112.4,29.3],[-113.1,30.7],[-113.0,31.2],[-114.9,31.9],[-114.9,31.2],[-114.5,30.0],[-113.5,28.9],[-113.2,28.8],[-112.7,27.8],[-112.0,27.1],[-111.9,26.7],[-111.7,26.6],[-111.8,26.9],[-111.6,26.7],[-111.3,25.8],[-110.7,24.9],[-110.7,24.3],[-110.4,24.1],[-110.3,24.3],[-109.4,23.5],[-109.5,23.2],[-110.0,22.9],[-110.4,23.6],[-111.7,24.6],[-111.8,24.5],[-112.1,24.8],[-112.1,25.6],[-112.4,26.2],[-113.2,26.9],[-113.6,26.7],[-113.8,27.0],[-114.4,27.2],[-115.0,27.7],[-114.3,27.9],[-114.1,27.7],[-114.3,27.9],[-114.0,28.4],[-114.9,29.4],[-115.7,29.8],[-115.8,30.3],[-116.7,31.6],[-116.6,31.9],[-117.1,32.3],[-117.5,33.3],[-118.1,33.7],[-118.4,33.7],[-118.5,34.0],[-120.6,34.6],[-120.9,35.4],[-121.9,36.3],[-121.8,36.9],[-122.2,37.0],[-122.5,37.5],[-122.5,37.8],[-122.1,37.5],[-122.4,38.0],[-121.5,38.1],[-122.5,38.1],[-122.5,37.8],[-122.9,38.1],[-123.0,38.0],[-122.9,38.2],[-123.7,38.9],[-123.8,39.8],[-124.4,40.4],[-124.1,41.0],[-124.1,41.5],[-124.5,42.8],[-124.1,43.7],[-123.9,45.6],[-124.0,46.2],[-123.2,46.2],[-124.1,46.3],[-124.0,46.6],[-123.9,46.4],[-124.1,46.9],[-123.8,47.0],[-124.1,47.0],[-124.7,48.0],[-124.7,48.4],[-122.8,48.1],[-122.7,47.9],[-123.1,47.6],[-123.1,47.4],[-122.9,47.4],[-123.1,47.4],[-122.5,47.9],[-122.7,47.6],[-122.6,47.3],[-123.0,47.1],[-122.6,47.1],[-122.2,48.0],[-122.7,48.4],[-122.5,48.5],[-122.5,48.8],[-123.2,49.1],[-123.2,49.3],[-122.9,49.3],[-123.3,49.3],[-123.2,49.7],[-123.5,49.4],[-123.9,49.5],[-124.1,49.7],[-123.6,49.7],[-123.9,49.7],[-123.9,50.2],[-124.1,49.8],[-124.7,50.0],[-125.1,50.4],[-124.9,50.9],[-125.1,50.5],[-126.1,50.5],[-126.4,50.6],[-125.9,50.7],[-126.5,50.7],[-126.5,51.1],[-126.6,50.9],[-127.1,50.9],[-127.7,51.2],[-127.4,51.6],[-126.7,51.7],[-127.3,51.7],[-127.6,51.5],[-127.9,51.7],[-127.7,52.0],[-127.9,52.0],[-127.8,52.2],[-127.4,52.4],[-126.7,52.1],[-127.2,52.5],[-127.0,52.8],[-127.8,52.3],[-128.1,51.8],[-128.4,52.2],[-128.0,52.3],[-128.1,52.5],[-127.9,52.5],[-128.3,52.4],[-128.1,52.9],[-128.4,52.8],[-128.5,53.1],[-129.2,53.5],[-128.9,53.7],[-128.5,53.4],[-127.9,53.3],[-128.7,53.6],[-128.8,53.7],[-128.5,53.9],[-129.0,53.8],[-129.6,53.3],[-130.3,53.7],[-130.0,54.1],[-129.6,54.2],[-130.1,54.2],[-130.4,54.4],[-129.6,55.5],[-129.7,55.4],[-129.8,55.6],[-130.0,55.1],[-130.0,55.9],[-130.0,55.3],[-130.5,54.7],[-130.8,54.8],[-131.0,55.2],[-130.7,55.3],[-130.9,55.4],[-131.0,56.1],[-131.8,55.9],[-131.9,55.6],[-132.1,55.6],[-132.2,55.8],[-131.6,56.2],[-131.9,56.2],[-132.5,56.6],[-132.8,57.1],[-133.5,57.2],[-133.6,57.7],[-133.1,57.6],[-133.5,57.8],[-133.2,57.9],[-133.7,57.8],[-134.0,58.1],[-133.9,58.5],[-134.2,58.2],[-134.7,58.4],[-135.4,59.4],[-135.5,59.2],[-135.1,58.2],[-135.9,58.4],[-136.0,58.8],[-135.8,58.9],[-136.2,59.0],[-136.1,58.8],[-137.1,58.9],[-136.1,58.5],[-136.6,58.2],[-138.5,59.2],[-139.8,59.5],[-139.5,59.7],[-139.5,60.0],[-139.3,59.9],[-139.3,59.6],[-139.0,59.8],[-139.4,60.0],[-140.4,59.7],[-141.4,59.9],[-141.4,60.1],[-144.1,60.0],[-144.2,60.2],[-144.9,60.3],[-144.7,60.7],[-145.2,60.4],[-145.9,60.5],[-145.7,60.7],[-146.6,60.7],[-146.4,60.8],[-146.6,61.1],[-146.3,61.1],[-148.0,60.9],[-147.8,61.2],[-148.3,61.1],[-148.4,61.0],[-148.2,61.0],[-148.6,60.8],[-148.3,60.7],[-148.6,60.5],[-148.0,60.5],[-148.4,60.0],[-149.4,60.1],[-149.8,59.7],[-150.0,59.8],[-150.2,59.6],[-150.6,59.6],[-150.9,59.2],[-151.6,59.2],[-151.9,59.3],[-151.0,59.8],[-151.4,59.6],[-151.9,59.8],[-151.4,60.3],[-151.3,60.7],[-150.4,61.0],[-149.1,60.9],[-150.1,61.2],[-149.3,61.5],[-149.6,61.5],[-151.6,61.0],[-152.3,60.4],[-153.0,60.3],[-152.7,60.0],[-154.1,59.4],[-154.2,59.2],[-153.4,59.0],[-153.4,58.8],[-154.3,58.3],[-154.2,58.2],[-156.4,57.4],[-156.6,57.0],[-157.6,56.6],[-158.1,56.6],[-157.9,56.5],[-158.6,56.3],[-158.3,56.2],[-159.7,55.6],[-159.7,55.8],[-161.2,55.4],[-161.5,55.4],[-161.2,55.5],[-161.5,55.6],[-162.1,55.1],[-163.1,55.1],[-163.3,54.8],[-163.3,55.1],[-161.7,55.9],[-160.9,56.0],[-161.0,55.9],[-160.8,55.8],[-160.3,55.8],[-160.5,56.0],[-160.3,56.3],[-158.9,56.9],[-158.7,56.8],[-158.7,57.0],[-158.3,57.3],[-157.5,57.5],[-157.7,57.7],[-157.6,58.1],[-157.2,58.2],[-157.5,58.4],[-157.0,58.7],[-156.8,59.1],[-158.2,58.6],[-158.5,58.9],[-158.1,59.0],[-158.8,59.0],[-158.8,58.4],[-160.4,59.1],[-162.1,58.6],[-161.7,58.8],[-161.8,59.0],[-161.6,59.1],[-162.0,59.1],[-161.8,59.6],[-162.4,60.3],[-161.9,60.7],[-162.7,60.3],[-162.5,60.2],[-162.6,60.0],[-163.9,59.8],[-165.1,60.4],[-165.0,60.5],[-165.4,60.5],[-164.8,60.9],[-164.3,60.8],[-164.4,60.6],[-164.0,60.8],[-163.7,60.6],[-163.4,60.8],[-163.9,60.9],[-163.6,60.9],[-163.7,61.0],[-165.1,60.9],[-165.2,61.0],[-164.9,61.1],[-165.3,61.3],[-165.6,61.1],[-165.9,61.3],[-165.8,61.5],[-166.1,61.5],[-166.2,61.7],[-165.8,61.7],[-166.1,61.8],[-165.6,61.9],[-165.7,62.1],[-165.2,62.5],[-164.8,62.5],[-164.6,62.7],[-164.8,62.6],[-164.8,62.9],[-164.4,63.0],[-164.4,63.2],[-163.3,63.0],[-162.3,63.5],[-160.9,63.7],[-161.0,64.3],[-161.5,64.4],[-160.8,64.7],[-161.1,64.9],[-161.8,64.8],[-162.8,64.4],[-163.2,64.7],[-163.3,64.6],[-163.1,64.4],[-163.7,64.6],[-166.1,64.6],[-166.5,64.7],[-166.4,64.9],[-166.9,65.2],[-166.2,65.3],[-167.4,65.4],[-168.1,65.7],[-166.4,66.1],[-165.6,66.1],[-165.8,66.3],[-164.5,66.6],[-163.6,66.6],[-163.9,66.6],[-163.8,66.5],[-164.0,66.2],[-163.7,66.1],[-161.9,66.0],[-161.5,66.3],[-161.0,66.2],[-161.9,66.4],[-162.6,66.9],[-162.0,66.8],[-162.1,66.7],[-161.6,66.5],[-160.2,66.4],[-160.9,66.7],[-161.9,66.7],[-161.6,67.0],[-163.5,67.1],[-164.1,67.6],[-166.8,68.4],[-166.4,68.4],[-166.2,68.9],[-164.3,68.9],[-163.5,69.2],[-163.0,69.8],[-161.9,70.3],[-161.0,70.3],[-160.1,70.6],[-160.1,70.3],[-159.9,70.3],[-159.8,70.5],[-159.4,70.5],[-160.1,70.6],[-159.7,70.8],[-159.2,70.9],[-159.3,70.7],[-157.9,70.9],[-156.5,71.4],[-156.6,71.3],[-155.6,71.1],[-156.1,70.9],[-156.0,70.8],[-155.2,71.1],[-154.2,70.8],[-152.2,70.8],[-152.5,70.7],[-151.8,70.6],[-151.9,70.5],[-149.3,70.5],[-147.7,70.2],[-145.8,70.2],[-144.6,70.0],[-143.2,70.1],[-135.3,68.7],[-135.9,68.9],[-135.6,69.0],[-135.9,69.1],[-135.1,69.5],[-134.5,69.5],[-134.4,69.7],[-133.9,69.5],[-134.2,69.3],[-133.2,69.4],[-132.8,69.7],[-131.1,69.9],[-130.7,70.1],[-129.5,70.1],[-132.8,69.2],[-133.4,68.8],[-133.2,68.7],[-133.3,68.8],[-132.7,68.8],[-132.5,68.9],[-132.7,68.9],[-132.7,69.1],[-131.8,69.4],[-131.1,69.5],[-131.0,69.2],[-130.5,69.6],[-128.9,70.0],[-129.2,69.8],[-129.1,69.7],[-127.7,70.3],[-128.2,70.4],[-128.0,70.6],[-127.2,70.3],[-126.6,69.7],[-125.4,69.3],[-125.2,69.4],[-125.3,69.7],[-124.6,70.2],[-124.4,70.1],[-124.4,69.8],[-124.1,69.7],[-124.5,69.5],[-124.4,69.4],[-123.5,69.4],[-123.0,69.8],[-121.7,69.8],[-117.2,68.9],[-115.4,68.9],[-114.0,68.4],[-114.8,68.3],[-115.4,67.9],[-115.1,67.8],[-112.5,67.7],[-110.1,68.0],[-109.6,67.7],[-109.0,67.7],[-108.9,67.4],[-108.6,67.6],[-108.0,67.3],[-108.0,67.1],[-108.5,67.1],[-107.3,66.4],[-107.7,66.7],[-107.7,67.0],[-107.2,66.9],[-108.0,67.8],[-107.8,68.0],[-106.4,68.2],[-105.8,68.6],[-107.7,68.2],[-108.7,68.3],[-108.3,68.6],[-106.2,68.9],[-105.7,68.8],[-105.4,68.4],[-104.7,68.1],[-103.5,68.1],[-102.3,67.7],[-99.0,67.7],[-98.4,67.8],[-98.7,68.0],[-98.6,68.1],[-97.6,67.6],[-97.2,67.7],[-97.2,67.9],[-98.2,67.9],[-98.7,68.4],[-97.3,68.5],[-97.0,68.3],[-96.4,68.3],[-96.7,68.0],[-96.0,68.2],[-96.4,67.5],[-95.4,67.2],[-95.4,67.0],[-96.4,67.1],[-95.8,66.6],[-95.7,66.7],[-96.0,66.9],[-95.4,66.9],[-95.3,67.3],[-95.7,67.7],[-95.5,68.0],[-94.7,68.1],[-93.4,68.6],[-93.6,68.6],[-93.9,69.0],[-94.1,68.8],[-94.6,68.8],[-94.1,69.1],[-94.3,69.3],[-93.6,69.4],[-93.8,69.3],[-93.7,69.2],[-93.4,69.4],[-96.0,69.8],[-96.5,70.1],[-96.5,70.3],[-95.9,70.5],[-95.9,70.7],[-96.4,70.7],[-96.5,71.1],[-96.1,71.4],[-95.6,71.3],[-95.4,71.5],[-95.9,71.6],[-95.2,71.9],[-94.6,72.0],[-94.3,71.8]],[[-83.5,12.4],[-83.6,12.7],[-83.8,12.5],[-83.7,11.6],[-83.9,11.3],[-82.1,8.9],[-81.8,9.0],[-81.9,9.1],[-81.5,8.8],[-81.1,8.8],[-79.6,9.6],[-78.5,9.4],[-77.8,9.1],[-76.9,8.1],[-76.9,7.9],[-76.9,8.6],[-76.0,9.4],[-75.6,9.4],[-75.7,9.7],[-75.5,10.2],[-75.7,10.1],[-75.2,10.8],[-74.8,11.1],[-74.3,11.0],[-74.5,10.9],[-74.4,10.8],[-74.1,11.3],[-73.3,11.3],[-71.6,12.4],[-71.1,12.0],[-72.0,11.6],[-71.6,11.0],[-71.6,10.7],[-72.1,9.8],[-71.6,9.0],[-71.1,9.3],[-71.5,11.0],[-69.8,11.5],[-69.8,11.7],[-70.2,11.6],[-70.3,11.9],[-70.0,12.2],[-69.6,11.5],[-68.4,11.2],[-68.1,10.5],[-66.2,10.6],[-65.9,10.3],[-64.8,10.1],[-64.2,10.5],[-63.7,10.5],[-64.3,10.6],[-61.9,10.7],[-62.9,10.5],[-62.3,9.8],[-62.1,10.0],[-61.7,9.6],[-61.8,9.8],[-61.6,9.9],[-60.8,9.4],[-61.2,8.6],[-61.6,8.6],[-61.3,8.4],[-60.2,8.6],[-59.2,8.1],[-58.5,7.3],[-58.7,6.4],[-58.4,6.9],[-58.0,6.8],[-57.2,6.2],[-57.2,5.5],[-57.0,6.0],[-55.9,5.7],[-55.8,6.0],[-54.8,6.0],[-54.1,5.8],[-54.2,5.4],[-53.8,5.8],[-52.9,5.4],[-52.3,4.8],[-52.2,4.9],[-52.0,4.4],[-51.8,4.6],[-51.7,4.1],[-51.5,4.3],[-51.2,4.1],[-50.7,2.1],[-50.5,1.8],[-50.0,1.7],[-49.9,1.2],[-50.8,0.2],[-51.3,-0.1],[-52.0,-1.4],[-52.7,-1.6],[-51.9,-1.6],[-50.9,-0.9],[-50.7,-1.8],[-50.4,-2.0],[-49.3,-1.7],[-49.6,-2.7],[-49.2,-1.9],[-48.7,-1.5],[-48.4,-1.5],[-48.5,-1.1],[-48.1,-0.7],[-47.4,-0.8],[-47.4,-0.6],[-45.6,-1.3],[-45.3,-1.7],[-45.1,-1.5],[-44.7,-1.7],[-44.8,-1.8],[-44.7,-1.7],[-44.5,-2.1],[-44.8,-2.3],[-44.7,-2.4],[-44.4,-2.2],[-44.7,-3.2],[-44.2,-2.5],[-44.2,-2.8],[-43.4,-2.4],[-42.2,-2.8],[-40.0,-2.9],[-38.5,-3.7],[-37.2,-4.9],[-35.5,-5.2],[-35.2,-5.6],[-34.8,-7.0],[-34.8,-8.0],[-35.3,-9.2],[-35.9,-9.7],[-36.4,-10.5],[-37.4,-11.3],[-38.2,-12.8],[-38.5,-13.0],[-38.7,-12.6],[-38.9,-12.8],[-38.8,-13.1],[-39.1,-13.6],[-39.0,-14.1],[-38.9,-14.0],[-39.1,-14.7],[-38.9,-15.9],[-39.2,-17.7],[-39.7,-18.3],[-39.8,-19.6],[-40.0,-19.7],[-40.4,-20.6],[-41.0,-21.2],[-41.0,-22.0],[-41.7,-22.3],[-42.0,-22.6],[-42.0,-22.9],[-43.0,-23.0],[-43.2,-22.7],[-43.2,-23.0],[-44.0,-23.1],[-43.7,-23.0],[-43.9,-22.9],[-44.6,-23.1],[-44.6,-23.3],[-45.5,-23.8],[-46.0,-23.8],[-46.9,-24.2],[-48.0,-25.0],[-47.9,-25.2],[-48.2,-25.4],[-48.7,-25.4],[-48.4,-25.6],[-48.7,-25.8],[-48.6,-28.1],[-48.8,-28.6],[-49.7,-29.4],[-50.9,-31.3],[-52.0,-32.1],[-52.1,-31.8],[-51.9,-31.9],[-51.3,-31.5],[-51.2,-31.1],[-51.0,-31.1],[-50.7,-30.7],[-50.6,-30.3],[-51.0,-30.4],[-51.3,-30.0],[-51.3,-30.8],[-51.4,-30.7],[-51.5,-31.1],[-52.0,-31.4],[-52.2,-31.9],[-52.1,-32.2],[-54.2,-34.7],[-54.9,-34.9],[-56.2,-34.9],[-57.2,-34.5],[-57.8,-34.5],[-58.4,-33.9],[-58.4,-33.2],[-58.1,-33.0],[-58.2,-32.5],[-58.5,-34.3],[-58.3,-34.7],[-57.5,-35.0],[-57.2,-35.4],[-57.4,-35.9],[-57.1,-36.3],[-56.7,-36.4],[-56.7,-37.0],[-57.4,-37.7],[-57.5,-38.1],[-58.2,-38.4],[-61.1,-39.0],[-62.3,-38.8],[-62.1,-39.8],[-62.4,-40.2],[-62.2,-40.7],[-62.4,-40.9],[-63.6,-41.2],[-64.9,-40.7],[-65.1,-40.8],[-65.2,-41.1],[-65.0,-42.1],[-64.5,-42.3],[-64.6,-42.4],[-64.1,-42.4],[-64.2,-42.2],[-63.8,-42.1],[-63.6,-42.3],[-63.6,-42.7],[-64.0,-42.9],[-64.5,-42.5],[-65.0,-42.7],[-64.3,-43.0],[-65.3,-43.6],[-65.3,-44.3],[-65.6,-45.0],[-66.2,-45.0],[-66.9,-45.3],[-67.6,-46.1],[-67.5,-46.4],[-66.8,-47.0],[-65.7,-47.3],[-65.8,-47.6],[-66.2,-47.8],[-65.8,-47.9],[-67.7,-49.2],[-67.9,-50.0],[-68.3,-50.1],[-68.7,-49.8],[-69.0,-50.0],[-68.6,-50.0],[-68.4,-50.2],[-68.9,-50.4],[-69.4,-51.0],[-69.2,-51.0],[-69.1,-51.5],[-69.5,-51.6],[-69.0,-51.7],[-68.4,-52.3],[-69.2,-52.2],[-69.6,-52.5],[-70.8,-52.8],[-71.0,-53.8],[-71.3,-53.9],[-72.4,-53.4],[-71.9,-53.2],[-71.8,-53.5],[-71.2,-52.8],[-72.3,-53.1],[-72.5,-53.5],[-73.1,-53.2],[-72.7,-52.8],[-71.5,-52.6],[-72.7,-52.5],[-73.1,-53.1],[-73.3,-53.1],[-73.6,-52.8],[-73.2,-52.7],[-73.1,-52.5],[-73.6,-52.7],[-74.0,-52.6],[-74.3,-52.1],[-73.3,-52.2],[-72.8,-52.0],[-72.6,-52.2],[-72.7,-52.4],[-72.5,-52.3],[-72.5,-51.7],[-73.2,-51.5],[-72.6,-51.8],[-73.4,-52.1],[-74.2,-51.7],[-73.9,-51.6],[-73.9,-51.3],[-74.8,-51.1],[-75.1,-50.7],[-74.7,-50.7],[-74.8,-50.5],[-74.6,-50.4],[-73.8,-50.9],[-73.6,-50.7],[-73.7,-50.5],[-74.0,-50.8],[-74.2,-50.6],[-74.0,-50.5],[-74.6,-50.2],[-74.0,-50.0],[-74.3,-49.6],[-73.8,-49.6],[-74.1,-49.4],[-73.9,-49.0],[-74.2,-49.5],[-74.4,-49.4],[-74.3,-48.6],[-74.0,-48.5],[-74.5,-48.5],[-74.6,-48.0],[-73.4,-48.1],[-73.7,-47.7],[-74.2,-48.0],[-74.7,-47.7],[-74.1,-47.6],[-74.5,-47.4],[-74.2,-47.2],[-74.3,-46.8],[-74.5,-46.9],[-75.0,-46.7],[-75.0,-46.5],[-75.5,-46.7],[-75.4,-46.9],[-75.7,-46.8],[-75.7,-46.6],[-74.9,-46.2],[-75.1,-45.9],[-74.2,-45.8],[-74.0,-45.4],[-73.8,-45.4],[-74.1,-45.9],[-74.0,-46.1],[-74.4,-46.2],[-74.0,-46.2],[-73.9,-45.8],[-73.7,-45.8],[-73.8,-46.6],[-73.6,-45.9],[-73.8,-45.7],[-73.7,-45.5],[-73.3,-45.3],[-72.9,-45.5],[-73.4,-45.2],[-73.4,-45.0],[-72.7,-44.7],[-72.7,-44.4],[-73.3,-44.2],[-73.0,-43.6],[-73.1,-43.3],[-72.8,-43.0],[-72.8,-42.5],[-72.6,-42.5],[-72.8,-42.3],[-72.6,-42.2],[-72.4,-42.4],[-72.5,-42.0],[-72.8,-41.9],[-72.3,-41.5],[-72.5,-41.7],[-73.0,-41.5],[-73.2,-41.8],[-73.7,-41.7],[-73.6,-41.6],[-73.9,-41.4],[-74.0,-41.0],[-73.7,-40.0],[-73.4,-39.8],[-73.2,-39.2],[-73.7,-37.3],[-73.2,-37.2],[-72.8,-36.0],[-72.2,-35.1],[-71.4,-32.4],[-71.7,-30.3],[-71.4,-30.1],[-71.3,-29.6],[-71.5,-28.9],[-70.6,-26.3],[-70.7,-25.8],[-70.5,-25.3],[-70.6,-24.6],[-70.4,-23.6],[-70.6,-23.1],[-70.3,-22.8],[-70.1,-21.5],[-70.1,-19.8],[-70.4,-18.4],[-71.3,-17.7],[-71.5,-17.3],[-75.1,-15.4],[-75.9,-14.6],[-76.4,-13.9],[-76.2,-13.4],[-76.8,-12.3],[-77.2,-12.1],[-77.2,-11.7],[-77.6,-11.3],[-78.8,-8.6],[-80.0,-6.8],[-81.2,-5.9],[-80.9,-5.8],[-81.3,-4.7],[-81.2,-4.2],[-80.8,-3.7],[-80.0,-3.2],[-79.7,-2.6],[-79.8,-2.1],[-79.9,-2.5],[-80.0,-2.6],[-80.0,-2.4],[-80.3,-2.7],[-81.0,-2.2],[-80.8,-2.1],[-80.9,-1.1],[-80.5,-0.6],[-80.3,-0.6],[-80.5,-0.4],[-80.0,0.2],[-80.1,0.8],[-78.9,1.2],[-79.0,1.6],[-78.6,1.8],[-78.6,2.4],[-77.8,2.7],[-77.1,3.9],[-77.3,3.9],[-77.3,4.1],[-77.4,3.9],[-77.5,4.2],[-77.3,4.7],[-77.5,5.5],[-77.2,5.8],[-77.5,6.2],[-77.4,6.6],[-78.2,7.5],[-78.4,8.1],[-78.1,8.4],[-77.8,8.1],[-78.1,8.5],[-78.4,8.4],[-78.5,8.6],[-79.4,9.0],[-80.5,8.2],[-80.0,7.5],[-80.8,7.2],[-81.1,7.9],[-81.3,7.6],[-81.7,8.1],[-82.2,8.3],[-82.7,8.3],[-82.9,8.1],[-83.2,8.6],[-83.5,8.7],[-83.3,8.4],[-83.6,8.5],[-83.7,9.2],[-84.6,9.6],[-84.7,9.9]],[[-82.0,63.0],[-82.1,62.7],[-83.0,62.2],[-83.7,62.2],[-83.9,62.4],[-83.4,62.9],[-82.0,63.0]],[[-104.6,77.1],[-105.2,77.2],[-106.1,77.7],[-105.6,77.7],[-104.5,77.3],[-104.6,77.1]],[[-95.5,77.8],[-93.1,77.7],[-93.5,77.5],[-96.0,77.5],[-96.3,77.6],[-95.5,77.8]],[[-93.5,75.0],[-93.6,74.7],[-94.5,74.6],[-96.6,75.0],[-96.0,75.4],[-94.9,75.6],[-93.9,75.4],[-93.5,75.0]],[[-109.8,78.7],[-109.4,78.4],[-113.3,78.3],[-110.9,78.7],[-109.8,78.7]],[[-105.3,72.9],[-107.0,73.5],[-106.6,73.7],[-105.1,73.7],[-104.6,73.4],[-105.3,72.9]],[[-100.0,73.9],[-99.2,73.7],[-97.7,73.9],[-97.1,73.8],[-97.0,73.7],[-97.6,73.5],[-97.3,73.4],[-98.4,73.0],[-97.6,73.0],[-97.1,72.8],[-97.1,72.6],[-96.5,72.7],[-96.5,72.4],[-96.8,72.3],[-96.6,72.2],[-96.8,72.0],[-96.6,72.0],[-96.6,71.8],[-97.6,71.6],[-98.2,71.7],[-98.3,71.9],[-98.5,71.8],[-98.2,71.4],[-98.7,71.3],[-99.2,71.4],[-100.6,72.2],[-101.7,72.3],[-102.7,72.8],[-102.6,73.0],[-102.2,73.1],[-101.9,73.1],[-101.3,72.7],[-100.5,72.8],[-100.4,73.0],[-100.1,72.9],[-100.5,73.2],[-99.8,73.2],[-101.5,73.5],[-101.0,73.6],[-100.5,73.4],[-101.0,73.8],[-100.0,73.9]],[[-84.9,65.3],[-84.5,65.5],[-84.1,65.2],[-82.0,64.6],[-81.7,64.2],[-81.9,64.0],[-80.8,64.1],[-80.7,63.9],[-80.3,63.8],[-81.0,63.5],[-82.4,63.7],[-83.1,64.2],[-83.6,64.1],[-83.7,63.8],[-84.6,63.3],[-85.4,63.1],[-85.8,63.7],[-87.2,63.6],[-86.3,64.1],[-86.4,64.6],[-86.1,65.5],[-85.8,65.8],[-85.2,65.8],[-85.2,65.5],[-84.9,65.3]],[[-75.7,68.3],[-75.1,68.2],[-75.2,67.5],[-76.7,67.2],[-77.3,67.7],[-76.7,68.2],[-75.7,68.3]],[[-79.5,73.7],[-77.2,73.5],[-76.1,72.9],[-79.5,72.8],[-80.2,73.2],[-80.8,73.3],[-80.7,73.5],[-80.9,73.7],[-79.5,73.7]],[[-97.7,76.5],[-97.5,76.1],[-97.9,75.8],[-97.4,75.7],[-97.3,75.4],[-97.9,75.4],[-97.7,75.2],[-98.1,75.2],[-98.0,75.0],[-100.2,75.0],[-100.5,75.2],[-100.1,75.2],[-100.7,75.3],[-99.2,75.7],[-102.8,75.6],[-102.1,75.9],[-101.0,75.8],[-101.9,76.1],[-101.6,76.2],[-102.1,76.3],[-101.8,76.5],[-99.9,75.9],[-99.7,76.0],[-100.1,76.1],[-99.5,76.1],[-100.4,76.2],[-100.0,76.3],[-100.9,76.5],[-98.9,76.5],[-99.0,76.6],[-98.7,76.7],[-97.7,76.5]],[[-103.4,79.3],[-102.9,79.2],[-102.6,78.9],[-101.7,79.1],[-101.0,78.9],[-101.1,78.8],[-99.6,78.6],[-99.8,78.3],[-99.0,78.0],[-100.0,77.8],[-101.1,78.2],[-102.6,78.2],[-102.8,78.3],[-102.7,78.4],[-104.5,78.3],[-105.0,78.5],[-103.6,78.5],[-103.5,78.6],[-104.0,78.6],[-103.4,78.7],[-104.2,78.8],[-103.9,78.9],[-104.2,79.0],[-104.9,78.8],[-105.0,78.9],[-104.7,79.0],[-105.5,79.0],[-105.6,79.1],[-105.4,79.3],[-103.4,79.3]],[[-91.9,81.1],[-90.6,80.6],[-89.2,80.5],[-89.2,80.3],[-88.9,80.2],[-88.2,80.1],[-88.6,80.4],[-87.7,80.4],[-87.6,80.2],[-87.9,80.1],[-87.0,79.9],[-87.3,79.6],[-85.6,79.6],[-85.0,79.3],[-87.0,79.0],[-87.6,78.7],[-88.0,78.9],[-87.8,79.0],[-88.0,79.0],[-88.3,78.7],[-88.0,78.5],[-88.7,78.6],[-88.6,78.4],[-88.8,78.2],[-90.0,78.6],[-90.1,78.5],[-89.5,78.2],[-91.4,78.2],[-92.8,78.5],[-91.9,78.5],[-93.3,78.6],[-93.6,78.8],[-93.2,78.8],[-94.2,79.0],[-91.3,79.4],[-92.8,79.5],[-95.1,79.3],[-95.7,79.5],[-94.4,79.7],[-95.9,79.7],[-96.5,79.8],[-96.8,80.1],[-94.6,80.0],[-94.3,80.2],[-95.4,80.1],[-96.4,80.3],[-95.5,80.4],[-96.2,80.6],[-96.1,80.7],[-93.9,80.6],[-95.5,80.8],[-95.3,81.0],[-93.2,81.1],[-94.2,81.3],[-91.9,81.1]],[[-94.3,76.9],[-93.2,76.8],[-93.5,76.4],[-93.0,76.6],[-91.3,76.7],[-90.5,76.5],[-91.4,76.5],[-89.2,76.3],[-91.4,76.2],[-89.2,75.8],[-89.6,75.6],[-88.9,75.5],[-88.6,75.7],[-88.2,75.5],[-87.3,75.6],[-85.9,75.4],[-86.1,75.5],[-83.9,75.8],[-81.3,75.8],[-81.0,75.6],[-79.7,75.5],[-79.5,75.3],[-80.4,75.0],[-79.4,74.9],[-80.3,74.9],[-80.1,74.8],[-80.3,74.6],[-81.9,74.5],[-82.9,74.6],[-83.5,74.9],[-83.3,74.8],[-83.5,74.6],[-84.4,74.5],[-88.4,74.5],[-88.6,74.6],[-88.3,74.8],[-88.9,74.8],[-89.2,74.6],[-90.6,74.6],[-91.0,74.7],[-90.9,74.8],[-91.5,74.7],[-92.0,74.8],[-92.4,75.3],[-92.1,75.7],[-93.1,76.4],[-95.3,76.3],[-96.0,76.5],[-95.7,76.6],[-96.9,76.8],[-96.4,76.8],[-96.8,77.0],[-95.8,77.1],[-94.3,76.9]],[[-96.2,78.5],[-94.9,78.4],[-95.3,78.2],[-94.9,78.1],[-97.0,77.8],[-97.7,78.1],[-96.9,78.2],[-98.0,78.3],[-98.3,78.5],[-98.1,78.6],[-98.3,78.8],[-96.5,78.7],[-96.2,78.5]],[[-110.5,78.1],[-109.6,78.1],[-110.9,77.8],[-110.2,77.8],[-110.2,77.5],[-112.0,77.3],[-113.2,77.5],[-113.1,77.6],[-113.3,77.8],[-110.5,78.1]],[[-115.6,77.4],[-115.5,77.3],[-116.3,77.1],[-115.8,76.9],[-116.3,76.9],[-115.9,76.7],[-117.0,76.5],[-117.2,76.3],[-118.0,76.4],[-117.9,76.8],[-118.8,76.5],[-118.6,76.4],[-119.0,76.1],[-119.6,76.3],[-119.7,76.1],[-119.5,76.0],[-120.4,75.8],[-120.8,76.2],[-121.0,76.0],[-122.4,75.9],[-122.6,76.2],[-122.9,76.1],[-122.4,76.4],[-119.1,77.3],[-116.8,77.3],[-116.7,77.4],[-117.0,77.5],[-115.6,77.4]],[[-108.3,76.1],[-107.7,76.0],[-108.0,75.8],[-107.2,75.9],[-106.9,75.7],[-106.7,76.0],[-105.6,75.9],[-105.5,75.7],[-106.1,75.1],[-107.2,74.9],[-108.5,74.9],[-108.8,75.1],[-112.5,74.4],[-113.5,74.4],[-114.4,74.7],[-111.0,75.2],[-113.8,75.1],[-113.9,75.3],[-113.5,75.4],[-114.0,75.4],[-114.2,75.2],[-114.5,75.3],[-114.5,75.1],[-115.7,75.0],[-117.6,75.3],[-117.3,75.5],[-115.1,75.7],[-117.2,75.6],[-116.8,75.8],[-115.0,75.9],[-116.7,76.0],[-116.2,76.2],[-114.8,76.2],[-115.8,76.3],[-115.0,76.5],[-114.2,76.5],[-113.8,76.2],[-112.7,76.2],[-111.9,75.9],[-112.1,75.8],[-111.5,75.8],[-111.1,75.5],[-108.9,75.6],[-109.9,75.9],[-109.4,76.1],[-110.3,76.4],[-109.3,76.8],[-108.5,76.7],[-108.6,76.6],[-108.1,76.2],[-108.3,76.1]],[[-93.2,74.2],[-90.4,73.9],[-92.1,72.8],[-94.2,72.8],[-93.6,72.6],[-93.5,72.4],[-94.1,72.0],[-95.2,72.0],[-95.6,72.9],[-95.6,73.7],[-94.7,73.7],[-95.1,74.0],[-93.2,74.2]],[[-97.4,69.6],[-97.2,69.7],[-95.8,68.9],[-95.3,68.8],[-96.6,68.5],[-97.5,68.5],[-99.6,69.0],[-98.5,69.3],[-98.5,69.6],[-98.0,69.5],[-98.3,69.7],[-98.1,69.8],[-97.4,69.6]],[[-114.5,72.6],[-113.6,72.7],[-113.5,72.9],[-113.1,73.0],[-111.3,72.7],[-111.9,72.4],[-111.7,72.3],[-110.2,72.7],[-110.7,73.0],[-110.0,73.0],[-108.8,72.6],[-108.2,71.7],[-107.8,71.6],[-107.3,71.9],[-107.7,72.1],[-108.2,73.2],[-106.5,73.2],[-105.4,72.8],[-104.9,72.0],[-104.4,71.6],[-104.6,71.1],[-103.6,70.6],[-103.0,70.5],[-103.0,70.7],[-101.6,70.3],[-101.6,70.1],[-101.1,70.1],[-100.9,69.8],[-102.2,69.8],[-102.6,69.7],[-102.5,69.6],[-103.4,69.7],[-103.0,69.5],[-103.1,69.2],[-102.4,69.5],[-101.8,69.2],[-101.9,69.0],[-102.9,68.8],[-105.1,68.9],[-105.2,69.0],[-105.0,69.1],[-106.3,69.2],[-106.4,69.4],[-106.7,69.4],[-107.4,69.0],[-113.0,68.5],[-113.6,68.8],[-113.7,69.2],[-116.5,69.4],[-117.1,69.8],[-117.2,70.1],[-111.6,70.3],[-113.8,70.7],[-117.6,70.6],[-118.4,71.0],[-115.3,71.5],[-117.9,71.4],[-118.2,71.5],[-117.7,71.7],[-118.6,71.6],[-119.0,71.8],[-118.2,72.3],[-118.5,72.4],[-118.4,72.5],[-116.6,73.1],[-114.6,73.4],[-114.2,73.3],[-114.1,73.1],[-114.1,72.9],[-114.5,72.6]],[[-119.7,74.1],[-119.2,74.2],[-119.1,74.0],[-118.5,74.2],[-117.5,74.2],[-115.6,73.7],[-115.4,73.5],[-119.0,72.7],[-119.5,72.3],[-120.2,72.2],[-120.4,71.6],[-120.6,71.5],[-122.8,71.1],[-123.3,71.2],[-124.0,71.7],[-125.8,72.0],[-125.0,72.6],[-125.0,72.8],[-124.6,72.9],[-124.8,73.1],[-123.8,73.8],[-124.7,74.3],[-121.5,74.5],[-119.7,74.1]],[[-102.2,76.0],[-102.0,75.9],[-103.3,75.8],[-103.0,75.9],[-104.0,75.9],[-103.8,76.0],[-104.4,76.1],[-102.6,76.3],[-102.2,76.0]],[[-55.5,51.5],[-56.0,51.3],[-55.8,51.0],[-56.7,50.0],[-56.8,49.6],[-56.2,50.1],[-56.2,49.9],[-55.5,50.0],[-56.1,49.5],[-55.2,49.5],[-55.4,49.1],[-54.5,49.5],[-54.4,49.3],[-53.6,49.3],[-53.6,49.1],[-54.2,48.8],[-53.7,48.7],[-54.1,48.4],[-53.0,48.6],[-53.9,48.0],[-53.6,48.0],[-53.9,47.8],[-53.7,47.6],[-53.3,48.0],[-52.9,48.1],[-53.2,47.5],[-52.8,47.8],[-52.7,47.5],[-53.1,46.7],[-53.6,46.6],[-53.6,47.1],[-54.0,46.8],[-54.2,46.9],[-53.9,47.4],[-54.0,47.8],[-54.2,47.9],[-54.5,47.4],[-54.9,47.4],[-55.3,46.9],[-56.0,46.9],[-54.8,47.7],[-55.4,47.7],[-55.4,47.5],[-56.1,47.5],[-55.9,47.8],[-56.8,47.6],[-59.3,47.6],[-59.3,47.9],[-58.3,48.5],[-59.2,48.6],[-58.7,48.6],[-58.4,49.1],[-58.0,49.0],[-58.2,49.4],[-57.8,49.5],[-57.9,49.7],[-57.2,50.6],[-57.3,50.7],[-56.7,51.3],[-56.0,51.6],[-55.5,51.5]],[[-50.4,62.8],[-51.5,63.6],[-51.5,64.0],[-50.3,64.2],[-51.7,64.2],[-51.2,64.6],[-50.7,64.7],[-50.0,64.4],[-50.1,64.7],[-51.0,65.2],[-50.7,64.8],[-51.2,64.6],[-51.1,64.8],[-51.3,64.8],[-51.9,64.2],[-52.3,65.2],[-52.5,65.3],[-51.1,65.8],[-52.6,65.5],[-53.2,65.6],[-53.1,66.0],[-53.4,66.0],[-51.2,66.9],[-53.0,66.2],[-53.6,66.2],[-53.4,66.6],[-52.4,66.9],[-53.9,67.1],[-53.8,67.4],[-52.5,67.8],[-50.6,67.5],[-51.2,67.7],[-50.9,67.8],[-52.3,67.8],[-53.7,67.5],[-53.2,68.2],[-51.6,68.1],[-51.2,68.4],[-52.2,68.2],[-53.4,68.3],[-52.6,68.7],[-51.6,68.5],[-51.1,68.6],[-50.8,68.8],[-51.2,68.7],[-51.1,69.1],[-50.3,69.2],[-51.1,69.2],[-50.8,69.7],[-50.3,69.8],[-50.5,69.9],[-50.3,70.0],[-52.3,70.1],[-54.0,70.4],[-54.5,70.7],[-52.8,70.8],[-51.5,70.4],[-50.7,70.4],[-51.3,70.6],[-51.3,70.9],[-51.8,71.0],[-51.0,71.0],[-53.1,71.3],[-51.8,71.7],[-53.5,71.6],[-53.1,71.8],[-53.3,71.8],[-53.8,72.3],[-53.7,72.4],[-53.9,72.3],[-53.5,71.9],[-54.0,71.7],[-53.9,71.5],[-55.3,71.4],[-55.7,71.7],[-54.8,72.4],[-55.6,72.2],[-55.3,72.4],[-55.6,72.5],[-54.9,72.6],[-54.7,72.9],[-55.7,73.0],[-55.3,73.3],[-55.4,73.5],[-55.7,73.4],[-56.1,73.6],[-55.8,73.8],[-56.2,74.1],[-57.2,74.1],[-56.3,74.5],[-58.6,75.4],[-58.2,75.5],[-58.5,75.7],[-63.3,76.4],[-63.8,76.2],[-64.3,76.3],[-65.4,76.1],[-67.1,76.2],[-66.7,76.0],[-68.3,76.1],[-69.5,76.4],[-68.1,76.7],[-69.9,76.8],[-69.7,77.0],[-70.6,76.8],[-71.2,77.1],[-68.1,77.4],[-66.4,77.3],[-66.5,77.4],[-66.3,77.5],[-66.8,77.7],[-67.7,77.5],[-69.4,77.5],[-70.6,77.7],[-70.1,77.8],[-71.3,77.8],[-72.8,78.2],[-72.5,78.5],[-65.8,79.2],[-65.3,79.4],[-64.8,80.0],[-64.2,80.1],[-65.8,80.0],[-67.2,80.3],[-64.5,81],[-63.7,81.1],[-63.1,80.9],[-63.2,81.1],[-63.0,81.2],[-61.4,81.1],[-61.1,81.4],[-61.2,81.7],[-60.4,81.9],[-59.3,81.9],[-56.6,81.4],[-59.3,82.0],[-58.7,82.1],[-54.5,82.4],[-53.7,82.2],[-53.6,81.7],[-53.0,81.9],[-53.0,82.3],[-50.9,81.9]]]},{"id":"australia","nameI18n":{"zh-CN":"澳大利亚大陆","en":"Australia"},"label":[134,-25],"lines":[[[143.2,-12.0],[143.1,-12.3],[143.4,-12.6],[143.6,-13.4],[143.5,-13.7],[143.8,-14.3],[144.0,-14.5],[144.5,-14.2],[144.6,-14.5],[145.3,-14.9],[145.4,-16.4],[145.9,-16.9],[146.1,-17.6],[146.0,-18.3],[146.4,-19.0],[147.4,-19.4],[147.7,-19.8],[148.8,-20.3],[148.9,-20.5],[148.7,-20.6],[149.5,-21.6],[149.7,-22.4],[150.0,-22.6],[150.0,-22.2],[150.5,-22.6],[150.6,-22.4],[150.8,-22.6],[150.8,-23.5],[151.8,-24.1],[152.1,-24.6],[152.5,-24.8],[153.2,-26.0],[153.1,-27.2],[153.6,-28.2],[153.6,-28.9],[153.3,-29.3],[152.9,-31.4],[152.5,-32.4],[152.1,-32.7],[152.2,-32.8],[151.8,-32.9],[151.3,-33.6],[150.8,-35.0],[150.2,-35.8],[149.9,-37.5],[149.5,-37.8],[147.9,-37.9],[146.9,-38.7],[146.2,-38.7],[146.3,-38.9],[146.5,-38.8],[146.5,-39.1],[145.4,-38.5],[145.5,-38.2],[145.0,-38.5],[144.7,-38.3],[145.1,-38.1],[144.9,-37.9],[144.4,-38.1],[144.7,-38.2],[143.5,-38.8],[142.5,-38.4],[141.4,-38.4],[140.4,-37.9],[139.7,-37.1],[139.9,-36.7],[139.5,-36.0],[139.0,-35.6],[139.3,-35.6],[139.3,-35.4],[138.2,-35.6],[138.5,-34.8],[138.1,-34.2],[137.7,-35.1],[136.9,-35.2],[137.0,-34.9],[137.4,-34.9],[137.5,-34.2],[137.9,-33.6],[138.0,-33.1],[137.8,-32.6],[137.2,-33.6],[136.4,-34.0],[135.9,-34.7],[136.0,-35.0],[135.1,-34.6],[135.4,-34.6],[135.2,-34.0],[134.7,-33.3],[134.3,-33.2],[134.1,-32.7],[134.2,-32.5],[133.7,-32.2],[132.2,-32.0],[131.1,-31.5],[128.9,-31.7],[127.3,-32.3],[125.9,-32.3],[124.8,-32.9],[124.2,-33.0],[123.9,-33.6],[123.5,-33.9],[122.2,-34.0],[121.4,-33.8],[119.9,-34.0],[119.6,-34.1],[119.5,-34.4],[118.9,-34.5],[117.9,-35.1],[116.5,-35.0],[115.6,-34.4],[115.0,-34.3],[115.0,-33.5],[115.4,-33.6],[115.7,-33.2],[115.7,-31.7],[115.1,-30.6],[114.9,-29.1],[114.2,-28.1],[114.0,-27.3],[113.2,-26.2],[113.4,-26.1],[113.6,-26.6],[113.8,-26.5],[113.9,-26.3],[113.6,-26.1],[113.5,-25.6],[113.7,-26.1],[113.9,-26.0],[114.0,-26.3],[114.2,-26.3],[114.2,-25.9],[113.4,-24.4],[113.8,-23.4],[113.7,-22.6],[114.1,-21.8],[114.1,-22.5],[114.7,-21.8],[115.5,-21.5],[116.0,-21.0],[116.7,-20.7],[117.4,-20.7],[118.8,-20.3],[119.1,-20.0],[121.0,-19.6],[122.3,-18.1],[122.1,-17.5],[122.3,-17.1],[123.0,-16.4],[123.6,-17.5],[123.6,-17.0],[123.8,-17.1],[123.9,-16.9],[123.5,-16.5],[123.6,-16.2],[123.9,-16.4],[124.8,-16.4],[124.4,-16.3],[124.4,-16.1],[124.6,-16.1],[124.4,-15.5],[124.7,-15.3],[125.1,-15.4],[124.8,-15.2],[125.0,-15.0],[125.4,-15.1],[125.2,-14.7],[125.6,-14.5],[125.6,-14.3],[125.9,-14.6],[126.1,-14.0],[126.6,-14.2],[126.9,-13.7],[127.5,-14.0],[128.2,-14.8],[128.1,-15.3],[128.3,-15.3],[128.2,-15.0],[128.6,-14.8],[129.1,-14.9],[129.2,-15.2],[129.3,-14.9],[129.6,-15.1],[129.8,-14.8],[129.4,-14.4],[129.8,-13.6],[130.3,-13.3],[130.1,-13.1],[130.6,-12.4],[130.9,-12.6],[131.0,-12.2],[131.3,-12.1],[131.4,-12.3],[132.4,-12.3],[132.7,-12.1],[132.7,-11.6],[132.1,-11.5],[131.8,-11.3],[132.0,-11.2],[132.7,-11.5],[133.0,-11.4],[133.2,-11.7],[133.9,-11.8],[134.4,-12.1],[134.7,-12.0],[135.2,-12.2],[135.9,-11.8],[135.7,-12.2],[136.0,-12.2],[136.1,-12.4],[136.3,-12.4],[136.3,-12.1],[136.5,-12.0],[136.9,-12.2],[136.5,-12.8],[136.5,-13.2],[136.3,-13.1],[135.9,-13.3],[136.0,-13.9],[135.4,-14.8],[136.8,-15.9],[137.7,-16.2],[138.2,-16.7],[139.0,-16.9],[139.2,-17.3],[140.0,-17.7],[140.5,-17.6],[140.8,-17.4],[141.4,-16.1],[141.6,-15.1],[141.6,-12.9],[141.9,-12.7],[141.7,-12.4],[141.9,-12.0],[142.0,-12.1],[142.2,-10.9],[142.6,-10.7],[142.9,-11.8],[143.2,-12.0]],[[122.8,-8.6],[121.7,-8.9],[119.9,-8.9],[119.8,-8.7],[119.9,-8.4],[120.6,-8.2],[121.4,-8.6],[122.3,-8.6],[122.9,-8.1],[123.0,-8.3],[122.8,-8.6]],[[120.0,-9.4],[120.6,-9.7],[120.8,-10.1],[120.4,-10.3],[119.1,-9.7],[119.0,-9.5],[120.0,-9.4]],[[118.2,-8.3],[118.9,-8.3],[119.1,-8.7],[118.7,-8.7],[118.8,-8.8],[118.5,-8.9],[118.4,-8.7],[117.1,-9.1],[116.8,-9.0],[116.8,-8.5],[117.6,-8.4],[117.8,-8.7],[118.0,-8.7],[118.2,-8.6],[117.8,-8.2],[118.1,-8.1],[118.2,-8.3]],[[115.4,-8.2],[115.7,-8.4],[115.1,-8.8],[115.1,-8.6],[114.5,-8.2],[115.4,-8.2]],[[127.3,-8.4],[125.4,-9.3],[124.4,-10.1],[123.6,-10.3],[123.7,-9.6],[124.9,-9.0],[125.2,-8.6],[126.6,-8.5],[127.0,-8.3],[127.3,-8.4]],[[145.0,-40.8],[146.3,-41.2],[147.5,-41.0],[147.6,-40.8],[148.3,-40.9],[148.3,-42.3],[148.2,-42.0],[148.0,-42.3],[148.0,-43.2],[147.6,-43.0],[147.8,-42.9],[147.6,-42.8],[147.5,-43.0],[147.3,-42.8],[146.9,-43.6],[146.0,-43.5],[146.2,-43.3],[145.9,-43.3],[145.5,-42.9],[145.2,-42.2],[145.5,-42.4],[145.3,-42.1],[145.2,-42.2],[144.6,-41.0],[144.7,-40.7],[145.0,-40.8]],[[148.1,-8.1],[148.2,-8.6],[148.5,-8.7],[148.6,-9.1],[149.2,-9.0],[149.3,-9.5],[150.0,-9.7],[149.8,-9.8],[149.9,-10.0],[150.8,-10.2],[150.4,-10.3],[150.6,-10.5],[150.3,-10.7],[149.8,-10.4],[147.8,-10.1],[147.0,-9.4],[147.0,-9.1],[146.6,-9.0],[146.0,-8.1]],[[143.8,-8.0],[143.5,-8.0],[143.6,-8.2],[142.2,-8.2],[142.5,-8.4],[142.8,-8.3],[143.4,-8.8],[143.4,-9.0],[142.6,-9.3],[141.1,-9.2],[140.0,-8.2]]]},{"id":"antarctica","nameI18n":{"zh-CN":"南极大陆","en":"Antarctica"},"label":[20,-78],"lines":[[[-120.6,-73.8],[-120.3,-74.0],[-121.0,-74.3],[-122.3,-74.4],[-122.9,-74.3],[-123.0,-74.2],[-122.6,-74.0],[-123.3,-73.8],[-120.6,-73.8]],[[-126.3,-73.3],[-125.7,-73.4],[-125.3,-73.7],[-125.8,-73.8],[-124.5,-73.7],[-124.0,-73.9],[-124.2,-73.9],[-123.8,-74.2],[-125.1,-74.2],[-126.6,-73.7],[-127.2,-73.7],[-127.4,-73.4],[-127.3,-73.3],[-126.3,-73.3]],[[-66.2,-80.1],[-67.8,-79.5],[-66.0,-79.6],[-65.5,-80.0],[-66.2,-80.1]],[[-73.7,-70.6],[-73.5,-70.7],[-74.8,-71.0],[-76.5,-71.0],[-75.1,-70.8],[-75.0,-70.6],[-74.6,-70.8],[-74.4,-70.6],[-73.7,-70.6]],[[-98.1,-71.9],[-98.2,-72.1],[-97.6,-71.9],[-97.6,-72.1],[-97.3,-72.2],[-96.9,-71.9],[-96.1,-71.9],[-97.0,-72.2],[-96.7,-72.3],[-95.7,-72.1],[-95.5,-72.2],[-95.6,-72.4],[-96.1,-72.6],[-98.2,-72.6],[-102.3,-72.1],[-100.2,-71.8],[-99.8,-72.0],[-98.6,-71.8],[-98.1,-71.9]],[[-74.4,-73.1],[-74.7,-73.3],[-74.4,-73.5],[-74.6,-73.6],[-76.1,-73.2],[-75.3,-73.0],[-75.7,-72.9],[-75.4,-72.8],[-74.3,-72.9],[-74.2,-73.0],[-74.4,-73.1]],[[-68.0,-67.5],[-68.8,-67.8],[-69.1,-67.5],[-68.3,-66.8],[-67.7,-66.6],[-68.0,-67.0],[-67.7,-67.1],[-68.2,-67.4],[-68.0,-67.5]],[[-159.1,-79.8],[-161.9,-79.7],[-164.3,-79.2],[-163.3,-78.7],[-162.4,-78.8],[-159.7,-79.4],[-159.1,-79.8]],[[-70.3,-79.7],[-71.5,-79.6],[-71.8,-79.4],[-71.5,-79.1],[-66.7,-78.4],[-69.3,-79.2],[-69.7,-79.4],[-69.7,-79.6],[-70.3,-79.7]],[[-45.2,-78.8],[-43.6,-78.8],[-43.0,-79.5],[-43.0,-79.8],[-43.3,-80.0],[-43.8,-80.0],[-43.5,-80.2],[-49.2,-80.6],[-49.8,-80.8],[-54.4,-80.8],[-53.4,-80.1],[-52.3,-80.1],[-50.4,-79.5],[-50.4,-79.3],[-50.7,-79.3],[-50.2,-78.8],[-50.4,-78.8],[-49.1,-78.0],[-47.5,-77.8],[-44.6,-78.0],[-43.8,-78.3],[-43.9,-78.6],[-45.2,-78.8]],[[-59.7,-80.3],[-59.8,-80.7],[-60.6,-80.9],[-62.9,-80.8],[-63.1,-80.6],[-64.3,-80.7],[-66.8,-80.3],[-61.2,-80.3],[-61.6,-80.2],[-61.7,-80.0],[-60.6,-79.7],[-59.7,-79.9],[-59.8,-80.1],[-59.3,-80.2],[-59.7,-80.3]],[[-70.1,-69.2],[-69.7,-69.3],[-68.3,-70.9],[-68.2,-71.8],[-68.5,-72.2],[-69.2,-72.5],[-70.5,-72.7],[-72.4,-72.7],[-73.1,-72.4],[-70.9,-72.4],[-70.2,-72.2],[-71.9,-72.1],[-70.8,-71.9],[-72.3,-71.6],[-72.9,-71.9],[-73.8,-71.8],[-73.5,-72.0],[-74.0,-72.2],[-74.8,-72.1],[-75.4,-71.8],[-75.3,-71.6],[-74.4,-71.6],[-74.2,-71.4],[-73.5,-71.6],[-73.4,-71.5],[-73.6,-71.4],[-72.2,-71.3],[-73.1,-71.1],[-70.4,-70.9],[-69.9,-71.1],[-69.9,-70.9],[-71.2,-70.7],[-71.1,-70.5],[-69.6,-70.4],[-71.7,-70.1],[-71.9,-69.9],[-71.7,-69.4],[-72.1,-69.3],[-71.9,-68.9],[-70.4,-68.8],[-70.1,-69.2]],[[167.1,-77.3],[169.4,-77.5],[168.5,-77.7],[167.4,-77.6],[166.7,-77.9],[166.2,-77.5],[166.6,-77.4],[166.4,-77.3],[166.5,-77.2],[167.1,-77.3]],[[-20.6,-73.9],[-20.6,-74.2],[-20.4,-74.3],[-20.5,-74.5],[-20.8,-74.5],[-21.2,-74.1],[-22.0,-74.1],[-21.1,-73.9],[-20.7,-73.6],[-20.5,-73.7],[-20.6,-73.9]],[[-57.0,-63.4],[-56.8,-63.6],[-57.5,-63.5],[-59.0,-64.2],[-58.8,-64.5],[-59.5,-64.3],[-59.6,-64.6],[-60.0,-64.4],[-61.1,-65.0],[-61.7,-65.0],[-61.6,-65.2],[-62.1,-65.3],[-61.8,-65.6],[-62.3,-65.8],[-62.0,-66.1],[-60.9,-65.9],[-60.6,-66.0],[-61.0,-66.1],[-61.0,-66.3],[-61.4,-66.1],[-61.8,-66.4],[-62.1,-66.2],[-62.7,-66.2],[-62.8,-66.3],[-62.5,-66.7],[-63.3,-66.3],[-63.8,-66.3],[-63.7,-66.4],[-64.1,-66.7],[-63.8,-66.9],[-64.7,-66.8],[-65.0,-67.2],[-64.8,-67.3],[-65.5,-67.4],[-65.4,-67.7],[-65.6,-68.1],[-64.8,-68.1],[-65.5,-68.3],[-65.0,-68.4],[-65.2,-68.6],[-64.1,-68.8],[-64.2,-68.6],[-62.9,-68.4],[-63.8,-68.6],[-63.3,-68.8],[-63.5,-69.0],[-62.6,-69.5],[-62.0,-70.1],[-62.0,-70.3],[-62.2,-70.2],[-62.4,-70.4],[-61.5,-70.5],[-62.0,-70.7],[-62.0,-70.9],[-61.3,-70.9],[-61.0,-71.2],[-62.0,-71.7],[-61.2,-71.6],[-60.9,-71.7],[-61.0,-71.8],[-62.3,-72.0],[-60.7,-72.1],[-60.7,-72.4],[-61.3,-72.6],[-60.5,-72.7],[-60.4,-73.0],[-60.0,-72.9],[-60.1,-73.3],[-62.0,-73.1],[-61.6,-73.5],[-61.1,-73.5],[-60.8,-73.7],[-61.2,-74.0],[-61.8,-74.0],[-61.0,-74.1],[-61.8,-74.3],[-60.8,-74.2],[-60.7,-74.3],[-61.0,-74.5],[-62.2,-74.4],[-61.9,-74.8],[-62.4,-75.0],[-62.7,-74.7],[-63.2,-74.7],[-63.2,-74.9],[-63.9,-75.0],[-63.3,-75.0],[-63.2,-75.2],[-64.3,-75.3],[-63.4,-75.5],[-69.3,-76.4],[-70.2,-76.7],[-71.8,-76.8],[-77.2,-76.6],[-77.3,-76.7],[-76.2,-77.3],[-72.9,-77.7],[-74.0,-78.1],[-75.4,-78.2],[-81.6,-77.8],[-77.4,-78.4],[-77.5,-78.6],[-77.9,-78.7],[-80.3,-78.8],[-82.6,-78.4],[-83.8,-78.0],[-83.2,-78.4],[-83.8,-78.5],[-83.3,-78.8],[-81.7,-79.1],[-80.9,-79.5],[-80.5,-79.5],[-80.5,-79.3],[-76.2,-79.4],[-76.0,-79.6],[-76.6,-79.9],[-79.7,-80.0],[-78.2,-80.2],[-76.4,-80.1],[-75.1,-80.9],[-73.0,-80.9],[-70.7,-80.6],[-69.8,-81.0],[-68.6,-81.0],[-65.6,-81.5],[-62.2,-81.6],[-65.6,-81.7],[-64.1,-81.9],[-66.1,-82.0],[-65.8,-82.0],[-65.9,-82.2],[-65.7,-82.3],[-64.9,-82.4],[-60.5,-82.2],[-62.7,-82.5],[-61.9,-83.0],[-61.2,-83.0],[-61.6,-83.3],[-61.4,-83.4],[-59.5,-83.5],[-55.8,-82.5],[-54.0,-82.2],[-46.3,-81.9],[-46.0,-82.2],[-46.4,-82.3],[-46.5,-82.5],[-45.8,-82.5],[-43.7,-82.3],[-41.4,-81.3],[-38.8,-80.9],[-37.2,-81.1],[-35.3,-80.7],[-31.3,-80.5],[-31.0,-80.3],[-23.6,-80.0],[-29.9,-79.6],[-30.2,-79.5],[-30.3,-79.2],[-33.0,-79.2],[-36.2,-78.8],[-36.3,-78.6],[-35.5,-78.0],[-34.1,-77.4],[-32.6,-77.1],[-32.1,-77.2],[-28.9,-76.4],[-24.3,-75.8],[-18.3,-75.4],[-18.7,-75.2],[-17.4,-74.4],[-15.7,-74.4],[-14.6,-73.9],[-16.3,-73.9],[-15.9,-73.8],[-16.5,-73.6],[-16.4,-73.4],[-15.0,-73.0],[-14.3,-73.1],[-14.0,-73.0],[-14.3,-72.7],[-13.2,-72.8],[-11.5,-72.4],[-11.0,-71.8],[-12.4,-71.4],[-11.9,-71.3],[-10.8,-71.6],[-10.0,-71.1],[-10.3,-70.9],[-9.2,-71.2],[-8.6,-71.7],[-7.7,-71.5],[-7.6,-71.2],[-7.9,-70.9],[-7.8,-70.8],[-5.9,-70.7],[-5.6,-70.9],[-6.1,-71.3],[-0.9,-71.3],[-0.8,-71.6],[-0.5,-71.7],[1.9,-71.0],[7.7,-70.4],[8.5,-70.5],[9.1,-70.2],[11.7,-70.8],[12.9,-70.2],[12.6,-70.1],[13.8,-70.3],[15.8,-70.3],[16.4,-70.1],[16.7,-70.4],[18.1,-70.5],[19.0,-70.2],[19.2,-70.3],[19.0,-70.7],[19.3,-70.9],[21.1,-70.8],[21.7,-70.3],[22.4,-70.5],[22.2,-70.6],[22.3,-70.7],[23.0,-70.8],[24.0,-70.4],[24.4,-70.5],[24.4,-70.7],[24.8,-70.9],[26.5,-71.0],[30.0,-70.3],[32.6,-70.0],[33.0,-69.6],[32.6,-68.9],[33.1,-68.7],[34.2,-68.7],[33.8,-69.1],[34.6,-69.1],[35.4,-69.7],[37.8,-69.7],[38.9,-70.2],[38.9,-70.0],[40.2,-68.8],[42.4,-68.4],[43.0,-68.1],[46.4,-67.6],[46.3,-67.4],[46.6,-67.3],[47.4,-67.4],[47.1,-67.6],[48.2,-67.7],[48.4,-68.0],[48.6,-67.5],[49.2,-67.2],[48.7,-67.2],[48.5,-67.0],[49.2,-66.9],[50.0,-67.2],[50.6,-67.2],[50.5,-66.8],[50.2,-66.6],[50.3,-66.4],[51.9,-66.0],[53.7,-65.9],[55.3,-66.0],[56.4,-66.4],[56.9,-66.4],[57.2,-66.6],[56.1,-66.6],[56.5,-66.9],[55.8,-67.2],[56.2,-67.3],[57.6,-67.0],[59.3,-67.5],[63.7,-67.5],[68.3,-67.9],[69.6,-67.8],[70.0,-68.5],[69.5,-68.7],[69.6,-69.2],[68.9,-69.4],[69.2,-69.7],[69.1,-69.9],[68.2,-69.8],[67.3,-70.3],[69.2,-70.4],[69.2,-70.7],[68.0,-71.4],[67.4,-72.0],[66.9,-72.9],[66.5,-73.1],[67.3,-73.3],[68.0,-73.1],[68.0,-72.8],[68.4,-72.5],[69.6,-72.4],[71.3,-71.6],[71.8,-70.8],[72.8,-70.4],[72.8,-70.1],[73.3,-69.8],[75.6,-69.8],[76.1,-69.5],[77.8,-69.1],[79.0,-68.2],[83.3,-67.6],[84.5,-67.1],[85.7,-67.2],[88.0,-66.8],[89.7,-66.8],[92.1,-66.5],[94.0,-66.7],[94.8,-66.5],[98.3,-66.5],[98.9,-66.7],[100.9,-66.4],[101.4,-66.0],[102.7,-65.9],[109.5,-66.9],[110.6,-66.5],[110.6,-66.3],[110.9,-66.1],[113.1,-65.8],[113.7,-65.9],[114.3,-66.4],[115.6,-66.8],[115.3,-67.0],[114.0,-67.2],[113.9,-67.4],[116.7,-67.0],[118.7,-67.2],[120.4,-67.0],[118.9,-67.3],[119.1,-67.4],[124.0,-66.6],[124.8,-66.7],[125.4,-66.4],[126.7,-66.5],[126.9,-66.8],[127.5,-67.1],[128.4,-67.1],[129.2,-67.0],[129.7,-66.5],[130.6,-66.2],[133.4,-66.1],[134.4,-66.5],[135.4,-66.1],[136.6,-66.4],[137.3,-66.3],[138.3,-66.6],[142.0,-66.8],[142.7,-67.0],[143.9,-66.9],[143.9,-67.1],[144.6,-67.0],[143.9,-67.8],[144.0,-67.9],[145.1,-67.6],[146.0,-67.6],[146.8,-68.0],[146.8,-68.3],[147.1,-68.4],[151.1,-68.4],[151.1,-68.8],[152.5,-68.7],[153.1,-68.9],[153.7,-68.7],[153.9,-68.3],[155.5,-69.0],[159.8,-69.5],[160.2,-70.0],[161.0,-70.3],[161.4,-70.8],[162.2,-71.0],[162.0,-70.4],[162.7,-70.3],[163.3,-70.6],[164.4,-70.5],[167.6,-70.8],[168.2,-71.2],[170.2,-71.6],[170.4,-71.4],[170.9,-71.9],[170.2,-71.9],[170.0,-72.1],[170.0,-72.4],[170.3,-72.4],[170.2,-72.6],[168.4,-72.4],[169.8,-72.7],[169.5,-73.0],[169.0,-73.2],[166.5,-72.9],[166.8,-73.2],[167.7,-73.4],[165.9,-73.6],[166.1,-73.7],[165.7,-73.9],[165.3,-73.9],[165.1,-73.4],[164.8,-73.4],[165.0,-73.9],[164.8,-74.0],[165.4,-74.6],[163.7,-74.6],[163.4,-74.4],[162.6,-74.8],[162.5,-75.2],[160.9,-75.3],[162.2,-75.5],[162.8,-75.8],[162.4,-76.2],[162.7,-76.2],[162.8,-76.7],[162.4,-77.0],[163.1,-77.0],[163.6,-77.4],[163.6,-77.6],[164.5,-78.0],[164.0,-78.2],[164.6,-78.3],[165.4,-78.0],[166.2,-78.5],[167.1,-78.5],[167.0,-78.7],[164.6,-78.6],[162.6,-78.9],[161.7,-78.5],[161.5,-78.7],[162.0,-79.0],[160.9,-79.0],[160.5,-79.2],[160.6,-79.4],[160.0,-79.6],[160.3,-79.7],[159.9,-79.9],[160.6,-80.0],[158.6,-80.4],[160.6,-80.5],[160.5,-80.6],[160.8,-80.7],[160.3,-80.8],[160.7,-80.9],[160.7,-81.2],[160.5,-81.3],[163.7,-82.2],[161.3,-82.5],[164.7,-82.4],[167.1,-82.8],[167.3,-83.0],[168.6,-83.1],[167.7,-83.3],[168.1,-83.4],[171.0,-83.4],[179.4,-84.2],[180,-84.4],[180,-90.0]],[[-180,-90.0],[-180,-84.4],[-171.7,-84.5],[-156.5,-85.2],[-157.5,-84.9],[-156.6,-84.8],[-165.2,-84.4],[-163.8,-84.3],[-164.7,-84.2],[-164.0,-84.0],[-165.0,-83.8],[-167.8,-83.8],[-174.2,-82.8],[-171.8,-82.8],[-168.4,-83.2],[-165.6,-83.2],[-164.4,-83.5],[-163.1,-83.3],[-162.2,-83.5],[-159.4,-83.5],[-157.4,-83.3],[-157.0,-83.2],[-157.7,-83.1],[-155.5,-83.0],[-153.0,-82.5],[-154.7,-81.9],[-154.0,-81.7],[-157.0,-81.3],[-148.1,-80.9],[-150.6,-80.4],[-150.2,-80.2],[-148.3,-80.1],[-148.4,-79.9],[-148.1,-79.9],[-148.2,-79.8],[-151.0,-79.5],[-152.1,-79.1],[-154.5,-79.0],[-156.5,-78.6],[-154.3,-78.3],[-157.3,-78.2],[-158.3,-78.0],[-158.5,-77.8],[-158.0,-77.1],[-154.8,-77.1],[-153.5,-77.4],[-151.7,-77.4],[-149.7,-77.8],[-148.2,-77.5],[-148.8,-77.3],[-148.8,-77.1],[-145.6,-77.5],[-145.8,-77.3],[-145.5,-77.2],[-146.0,-77.1],[-145.6,-77.0],[-145.8,-76.7],[-147.3,-76.4],[-149.7,-76.4],[-148.3,-76.1],[-145.4,-76.4],[-146.4,-76.1],[-146.0,-75.9],[-142.3,-75.5],[-140.9,-75.7],[-141.2,-75.5],[-139.1,-75.2],[-136.7,-75.2],[-136.2,-74.8],[-135.4,-74.7],[-133.8,-74.9],[-129.8,-74.9],[-127.0,-74.7],[-121.5,-74.8],[-119.7,-74.7],[-118.3,-74.4],[-115.2,-74.5],[-114.6,-73.9],[-113.5,-74.1],[-113.8,-74.4],[-113.3,-74.5],[-113.9,-74.6],[-114.1,-75.0],[-111.6,-74.8],[-111.8,-74.6],[-111.8,-74.3],[-111.6,-74.2],[-110.2,-74.5],[-110.3,-74.7],[-111.5,-75.1],[-111.4,-75.2],[-106.6,-75.3],[-104.9,-75.1],[-101.7,-75.1],[-101.0,-75.4],[-98.8,-75.3],[-98.6,-75.2],[-100.5,-74.9],[-100.0,-74.7],[-100.2,-74.5],[-101.3,-74.5],[-101.7,-74.0],[-102.9,-73.8],[-102.8,-73.6],[-100.7,-73.8],[-98.9,-73.6],[-102.9,-73.3],[-103.4,-72.8],[-103.1,-72.7],[-102.3,-72.8],[-102.5,-73.0],[-98.2,-73.0],[-96.4,-73.3],[-90.9,-73.3],[-90.4,-73.2],[-90.3,-73.0],[-88.8,-72.7],[-88.2,-72.8],[-88.6,-73.1],[-88.4,-73.2],[-87.4,-73.2],[-86.8,-73.4],[-85.8,-73.2],[-85.0,-73.5],[-82.2,-73.9],[-81.3,-73.7],[-81.2,-73.2],[-80.3,-73.4],[-80.6,-73.1],[-80.4,-72.9],[-79.5,-73.1],[-78.8,-73.5],[-76.8,-73.5],[-77.1,-73.8],[-75.3,-73.6],[-74.0,-73.7],[-72.9,-73.4],[-69.3,-73.2],[-67.7,-72.8],[-66.8,-72.1],[-67.5,-71.5],[-67.7,-70.7],[-68.4,-70.0],[-68.7,-69.4],[-67.4,-69.4],[-67.0,-69.2],[-67.0,-69.0],[-67.4,-68.9],[-67.1,-68.8],[-66.8,-68.2],[-67.2,-68.0],[-66.7,-67.6],[-67.5,-67.5],[-67.5,-67.1],[-67.0,-66.9],[-66.9,-67.3],[-66.5,-67.3],[-66.5,-66.7],[-65.8,-66.6],[-65.6,-66.1],[-64.5,-66.0],[-64.7,-65.9],[-64.6,-65.7],[-64.5,-65.8],[-64.4,-65.6],[-63.8,-65.5],[-64.1,-65.4],[-63.8,-65.0],[-63.1,-65.1],[-63.1,-64.9],[-61.6,-64.6],[-60.9,-64.1],[-57.4,-63.2],[-57.0,-63.4]]]}]} \ No newline at end of file diff --git a/Java/model/earth-geography/earth-geography.model/help.json b/Java/model/earth-geography/earth-geography.model/help.json new file mode 100644 index 0000000..e8fa6b3 --- /dev/null +++ b/Java/model/earth-geography/earth-geography.model/help.json @@ -0,0 +1,124 @@ +{ + "zh-CN": { + "title": "如何使用 · 地球地理", + "sections": [ + { + "h": "开始使用(跟着做)", + "lines": [ + "第 1 步:点右上「平面」,先看完整的世界地图,确认七大洲四大洋的位置。", + "第 2 步:点「五带」,看回归线与极圈怎么把地球分成五个温度带。", + "第 3 步:关掉「五带」,打开「六大板块」,记住六块板块的名字和范围。", + "第 4 步:再打开「五大陆」,对比金色实线(大陆)与彩色虚线(板块)的差别。", + "第 5 步:切回「3D 球面」,拖动转动地球,看背面会自动隐藏。", + "看不清?滚轮放大;想重来点「复位」。每个图层都能单独开关,互不干扰。" + ] + }, + { + "h": "一、这个模型包含什么", + "lines": [ + "五带:热带、南北温带、南北寒带(按回归线 23.5° 与极圈 66.5° 划分)。", + "七大洲四大洋轮廓,以及洲与洲之间的分界线(苏伊士运河、巴拿马运河、白令海峡等)。", + "六大板块:亚欧、非洲、美洲、太平洋、印度洋、南极洲板块。", + "五块大陆:亚欧大陆、非洲大陆、美洲大陆、澳大利亚大陆、南极大陆。" + ] + }, + { + "h": "二、两种视图", + "lines": [ + "「3D 球面」:正交投影球体,拖动旋转、滚轮缩放,背面自动裁掉。", + "「平面」:等经纬矩形地图,课本地图样式,一次看全整幅。", + "「复位」回到初始视角与缩放。" + ] + }, + { + "h": "三、图层开关(各自独立)", + "lines": [ + "「五带」:叠加五带分界线与回归线、极圈。", + "「大洲轮廓」:白色海岸线。", + "「六大板块」:彩色虚线,是板块边界(不是大陆边界)。", + "「五大陆」:金色实线,是大陆轮廓。", + "「洲界」:分界点与分界线标签(如德雷克海峡、乌拉尔山…)。" + ] + }, + { + "h": "四、颜色与图例", + "lines": [ + "右侧图例说明三种线型:海岸线 / 板块边界 / 分界线。", + "底部色块对应五个温度带。", + "六大板块各一种颜色,标签放在板块中心附近。" + ] + }, + { + "h": "五、教学要点与易错点", + "lines": [ + "「板块 ≠ 大陆」:美洲板块覆盖南北美大陆并向东到大西洋中脊;印度洋板块包含澳大利亚与印度次大陆。", + "六大板块是全球一级板块,纳斯卡、阿拉伯等属于次级小板块,教材不列入。", + "板块交界处多火山地震(环太平洋带、地中海—喜马拉雅带)。", + "洲界是人为约定:亚欧以乌拉尔山—乌拉尔河—里海—大高加索山—黑海—土耳其海峡为界;亚非以苏伊士运河为界;南北美以巴拿马运河为界;南美与南极以德雷克海峡为界。", + "Esc 关闭窗口,F11 全屏。" + ] + } + ] + }, + "en": { + "title": "How to use · Earth Geography", + "sections": [ + { + "h": "Getting started (follow along)", + "lines": [ + "Step 1: click Flat in the top right for the whole world map first.", + "Step 2: turn on Climate zones to see how the tropics and polar circles split five belts.", + "Step 3: switch zones off and turn on Six plates; learn the six names and extents.", + "Step 4: turn on Five mainlands and compare solid gold lines (mainlands) with dashed colored lines (plates).", + "Step 5: switch back to 3D globe, drag to rotate, and see back faces clip automatically.", + "Hard to read? Scroll to zoom; press Reset to start over. Each layer toggles independently." + ] + }, + { + "h": "1. What this model contains", + "lines": [ + "Five climate zones split by the tropics (23.5°) and polar circles (66.5°).", + "Seven continents, four oceans, and continental borders (Suez, Panama, Bering, etc.).", + "Six major plates: Eurasian, African, American, Pacific, Indian Ocean, Antarctic.", + "Five mainlands: Eurasia, Africa, America, Australia, Antarctica." + ] + }, + { + "h": "2. Two views", + "lines": [ + "3D globe: orthographic sphere; drag to rotate, scroll to zoom, back faces clipped.", + "Flat: equirectangular textbook map, whole world at once.", + "Reset restores the initial view and zoom." + ] + }, + { + "h": "3. Independent layer toggles", + "lines": [ + "Climate zones: tropics, polar circles and zone edges.", + "Coastlines: white continental outlines.", + "Six plates: dashed colored lines — plate BOUNDARIES, not continental edges.", + "Five mainlands: solid gold lines — continental outlines.", + "Borders: boundary dots and labels (Drake Passage, Ural Mts., ...)." + ] + }, + { + "h": "4. Colors & legend", + "lines": [ + "The right legend explains the three line styles.", + "The bottom strip maps the five climate zones.", + "Each of the six plates has its own color, labelled near its center." + ] + }, + { + "h": "5. Teaching notes & pitfalls", + "lines": [ + "Plates are NOT mainlands: the American Plate spans both Americas to the Mid-Atlantic Ridge; the Indian Ocean Plate includes Australia and the Indian subcontinent.", + "These six are the first-order plates; Nazca, Arabian, etc. are secondary and are not listed in textbooks.", + "Volcanoes and earthquakes concentrate along plate boundaries (Pacific Ring, Mediterranean–Himalayan belt).", + "Borders are conventions: Asia/Europe along the Urals–Ural River–Caspian–Caucasus–Black Sea–Turkish Straits; Asia/Africa at Suez; N/S America at Panama; S. America/Antarctica at Drake Passage.", + "Esc closes, F11 toggles fullscreen." + ] + } + ] + } +} diff --git a/Java/model/earth-geography/earth-geography.model/i18n/en.json b/Java/model/earth-geography/earth-geography.model/i18n/en.json new file mode 100644 index 0000000..4ae817e --- /dev/null +++ b/Java/model/earth-geography/earth-geography.model/i18n/en.json @@ -0,0 +1,7 @@ +{ + "zones": "Zones", + "coast": "Continents", + "plates": "Plates", + "borders": "Borders", + "reset": "Reset" +} \ No newline at end of file diff --git a/Java/model/earth-geography/earth-geography.model/i18n/zh-CN.json b/Java/model/earth-geography/earth-geography.model/i18n/zh-CN.json new file mode 100644 index 0000000..0218a48 --- /dev/null +++ b/Java/model/earth-geography/earth-geography.model/i18n/zh-CN.json @@ -0,0 +1,7 @@ +{ + "zones": "五带", + "coast": "大洲轮廓", + "plates": "板块", + "borders": "洲界", + "reset": "复位" +} \ No newline at end of file diff --git a/Java/model/earth-geography/earth-geography.model/labels.json b/Java/model/earth-geography/earth-geography.model/labels.json new file mode 100644 index 0000000..eef2d7b --- /dev/null +++ b/Java/model/earth-geography/earth-geography.model/labels.json @@ -0,0 +1,103 @@ +{ + "labels": [ + { + "lat": 34, + "lon": 90, + "kind": "continent", + "nameI18n": { + "zh-CN": "亚洲", + "en": "Asia" + } + }, + { + "lat": 2, + "lon": 20, + "kind": "continent", + "nameI18n": { + "zh-CN": "非洲", + "en": "Africa" + } + }, + { + "lat": 48, + "lon": -100, + "kind": "continent", + "nameI18n": { + "zh-CN": "北美洲", + "en": "North America" + } + }, + { + "lat": -15, + "lon": -60, + "kind": "continent", + "nameI18n": { + "zh-CN": "南美洲", + "en": "South America" + } + }, + { + "lat": -78, + "lon": 20, + "kind": "continent", + "nameI18n": { + "zh-CN": "南极洲", + "en": "Antarctica" + } + }, + { + "lat": 52, + "lon": 18, + "kind": "continent", + "nameI18n": { + "zh-CN": "欧洲", + "en": "Europe" + } + }, + { + "lat": -24, + "lon": 134, + "kind": "continent", + "nameI18n": { + "zh-CN": "大洋洲", + "en": "Oceania" + } + }, + { + "lat": 0, + "lon": -155, + "kind": "ocean", + "nameI18n": { + "zh-CN": "太平洋", + "en": "Pacific Ocean" + } + }, + { + "lat": 12, + "lon": -30, + "kind": "ocean", + "nameI18n": { + "zh-CN": "大西洋", + "en": "Atlantic Ocean" + } + }, + { + "lat": -22, + "lon": 78, + "kind": "ocean", + "nameI18n": { + "zh-CN": "印度洋", + "en": "Indian Ocean" + } + }, + { + "lat": 85, + "lon": 0, + "kind": "ocean", + "nameI18n": { + "zh-CN": "北冰洋", + "en": "Arctic Ocean" + } + } + ] +} \ No newline at end of file diff --git a/Java/model/earth-geography/earth-geography.model/plates.json b/Java/model/earth-geography/earth-geography.model/plates.json new file mode 100644 index 0000000..a3d6546 --- /dev/null +++ b/Java/model/earth-geography/earth-geography.model/plates.json @@ -0,0 +1,53 @@ +{ + "plates": [ + { + "id": "eurasian", + "nameI18n": { "zh-CN": "亚欧板块", "en": "Eurasian Plate" }, + "label": [85, 55], + "lines": [ + [[-10,36],[0,45],[15,55],[30,68],[60,72],[100,76],[140,70],[160,60],[140,42],[125,32],[110,28],[95,28],[80,30],[72,28],[60,25],[45,30],[32,32],[10,37],[-10,36]] + ] + }, + { + "id": "african", + "nameI18n": { "zh-CN": "非洲板块", "en": "African Plate" }, + "label": [12, 2], + "lines": [ + [[-20,35],[10,37],[32,32],[43,12],[51,10],[42,-8],[40,-25],[25,-35],[15,-30],[8,-5],[-8,5],[-17,15],[-20,35]] + ] + }, + { + "id": "american", + "nameI18n": { "zh-CN": "美洲板块", "en": "American Plate" }, + "label": [-100, 12], + "lines": [ + [[-168,72],[-140,70],[-115,70],[-90,72],[-60,60],[-52,45],[-60,30],[-80,25],[-82,8],[-78,0],[-70,-15],[-72,-40],[-75,-52],[-80,-55],[-95,-45],[-105,-25],[-95,-5],[-90,10],[-105,20],[-120,35],[-135,50],[-155,60],[-168,72]] + ] + }, + { + "id": "pacific", + "nameI18n": { "zh-CN": "太平洋板块", "en": "Pacific Plate" }, + "label": [-150, 0], + "lines": [ + [[-180,60],[-150,55],[-130,45],[-110,25],[-95,10],[-80,0],[-75,-15],[-90,-30],[-110,-45],[-130,-55],[-160,-60],[-180,-58],[-180,60]], + [[145,55],[158,45],[152,30],[145,15],[140,0],[148,-15],[158,-30],[168,-45],[180,-55],[180,60],[165,60],[145,55]] + ] + }, + { + "id": "indian-ocean", + "nameI18n": { "zh-CN": "印度洋板块", "en": "Indian Ocean Plate" }, + "label": [95, -8], + "lines": [ + [[35,32],[50,30],[60,22],[68,24],[75,8],[88,5],[95,5],[115,10],[130,5],[145,-5],[150,-20],[145,-35],[130,-42],[115,-38],[105,-25],[95,-10],[80,-10],[65,-5],[55,10],[42,10],[35,20],[35,32]] + ] + }, + { + "id": "antarctic", + "nameI18n": { "zh-CN": "南极洲板块", "en": "Antarctic Plate" }, + "label": [0, -76], + "lines": [ + [[-180,-60],[-120,-62],[-60,-60],[0,-62],[60,-60],[120,-62],[180,-60],[180,-90],[-180,-90],[-180,-60]] + ] + } + ] +} diff --git a/Java/model/earth-geography/earth-geography.model/preview.png b/Java/model/earth-geography/earth-geography.model/preview.png new file mode 100644 index 0000000..024d7b8 Binary files /dev/null and b/Java/model/earth-geography/earth-geography.model/preview.png differ diff --git a/Java/model/earth-geography/earth-geography.model/scene.json b/Java/model/earth-geography/earth-geography.model/scene.json new file mode 100644 index 0000000..73f2ca4 --- /dev/null +++ b/Java/model/earth-geography/earth-geography.model/scene.json @@ -0,0 +1,88 @@ +{ + "schemaVersion": 1, + "type": "geography", + "defaultView": "zones", + "views": [ + "zones", + "coast", + "plates" + ], + "nameI18n": { + "zh-CN": "地球地理", + "en": "Earth Geography" + }, + "descriptionI18n": { + "zh-CN": "五带划分 · 七大洲四大洋 · 六大板块 · 五大陆与洲界", + "en": "Climate zones · continents & oceans · six plates · five mainlands & borders" + }, + "tropicDeg": 23.5, + "axialTiltDeg": 23.5, + "oceanColor": "#0E2A4A", + "zones": [ + { + "id": "torrid", + "latMin": -23.5, + "latMax": 23.5, + "nameI18n": { + "zh-CN": "热带", + "en": "Torrid zone" + }, + "descI18n": { + "zh-CN": "南北回归线之间,有太阳直射,终年高温。", + "en": "Between the tropics; the Sun is overhead at some time each year." + } + }, + { + "id": "north-temperate", + "latMin": 23.5, + "latMax": 66.5, + "nameI18n": { + "zh-CN": "北温带", + "en": "North temperate" + }, + "descI18n": { + "zh-CN": "北回归线与北极圈之间,四季分明,无直射也无极昼极夜。", + "en": "Between Tropic of Cancer and Arctic Circle; four distinct seasons." + } + }, + { + "id": "south-temperate", + "latMin": -66.5, + "latMax": -23.5, + "nameI18n": { + "zh-CN": "南温带", + "en": "South temperate" + }, + "descI18n": { + "zh-CN": "南回归线与南极圈之间,四季分明。", + "en": "Between Tropic of Capricorn and Antarctic Circle; four seasons." + } + }, + { + "id": "north-frigid", + "latMin": 66.5, + "latMax": 90, + "nameI18n": { + "zh-CN": "北寒带", + "en": "North frigid zone" + }, + "descI18n": { + "zh-CN": "北极圈以北,有极昼极夜,终年寒冷。", + "en": "North of the Arctic Circle; polar day/night, always cold." + } + }, + { + "id": "south-frigid", + "latMin": -90, + "latMax": -66.5, + "nameI18n": { + "zh-CN": "南寒带", + "en": "South frigid zone" + }, + "descI18n": { + "zh-CN": "南极圈以南,有极昼极夜,终年寒冷。", + "en": "South of the Antarctic Circle; polar day/night, always cold." + } + } + ] +} \ No newline at end of file diff --git a/Java/model/earth-revolution/earth-revolution.json b/Java/model/earth-revolution/earth-revolution.json new file mode 100644 index 0000000..bd14a29 --- /dev/null +++ b/Java/model/earth-revolution/earth-revolution.json @@ -0,0 +1,36 @@ +{ + "schemaVersion": 1, + "id": "earth-revolution", + "name": "Earth Revolution", + "nameI18n": { + "zh-CN": "地球公转", + "en": "Earth Revolution" + }, + "author": "Morris", + "description": "四季更替、黄赤交角与二分二至", + "descriptionI18n": { + "zh-CN": "地球绕太阳公转一年:地轴指向不变,太阳直射点南北往返,形成四季。", + "en": "One year around the Sun: the fixed axial direction moves the subsolar point and creates the seasons." + }, + "tags": [ + "astronomy", + "geography", + "revolution" + ], + "entry": "scene.json", + "license": "MIT", + "assembly": "EarthRevolutionModel.dll", + "type": "GC.EarthModels.RevolutionModelFactory", + "preview": "preview.png", + "apiVersion": 1, + "version": "1.7", + "chrome": { + "titleBar": "#0C1828", + "titleBorder": "#1B2740", + "titleText": "#EAF2FF", + "button": "#9FB4D4", + "frame": "#0A1524" + }, + "build": "53b7a0fbc3", + "updatedAt": "2026-11-21T10:55:36Z" +} diff --git a/Java/model/earth-revolution/earth-revolution.model/help.json b/Java/model/earth-revolution/earth-revolution.model/help.json new file mode 100644 index 0000000..02a4b3a --- /dev/null +++ b/Java/model/earth-revolution/earth-revolution.model/help.json @@ -0,0 +1,124 @@ +{ + "zh-CN": { + "title": "如何使用 · 地球公转", + "sections": [ + { + "h": "开始使用(跟着做)", + "lines": [ + "第 1 步:先按「1」定格到春分,看读数区「太阳直射」是多少度。", + "第 2 步:再按「2」,直射纬度变成 23.5°N —— 这就是北半球夏至。", + "第 3 步:依次按「3」「4」,对比四个节气的直射点位置。", + "第 4 步:按「空格」播放,看地球绕太阳走完一圈要多久(有速度调节)。", + "第 5 步:拖动鼠标换到「俯视」,能看到轨道是个椭圆,地轴始终指向同一方向。", + "看不到变化?确认顶部「节气定位」已打开,且没有停在暂停状态。" + ] + }, + { + "h": "一、这个模型讲什么", + "lines": [ + "地球绕太阳公转,周期约 365.25 天,轨道近似椭圆,地轴始终指向北极星附近。", + "地轴与公转轨道面成 66.5° 夹角(赤道面与轨道面夹角 23.5°,即黄赤交角)。", + "由于地轴倾斜方向不变,太阳直射点在南北回归线之间往返,形成四季更替。", + "二分二至:春分 3/21、夏至 6/22、秋分 9/23、冬至 12/22(教材值)。" + ] + }, + { + "h": "二、基本操作", + "lines": [ + "「播放 / 暂停」控制公转动画;「速度」调节一年走完的快慢。", + "「步进」让地球沿轨道前进一小格,便于逐段观察。", + "拖动或滚轮改变观察角度与缩放;「俯视 / 侧视」切换视角。", + "「重置」回到春分起点。" + ] + }, + { + "h": "三、节气定位(重点)", + "lines": [ + "按 1–4 直接定格到春分、夏至、秋分、冬至。", + "春分 / 秋分:太阳直射赤道(0°),全球昼夜平分。", + "夏至:直射北回归线 23.5°N,北半球昼最长、北极圈内极昼。", + "冬至:直射南回归线 23.5°S,北半球昼最短、北极圈内极夜。", + "定格后读数区显示:公转角度、太阳直射纬度、教材日期、节气名称。" + ] + }, + { + "h": "四、读数与课堂卡", + "lines": [ + "「太阳直射」读数来自模型数据里的 declinationDeg,不是近似公式。", + "「节气定位」面板列出四个节气的日期与现象说明(中英双语)。", + "「教学要点」解释:直射点移动 → 正午太阳高度与昼长变化 → 四季。" + ] + }, + { + "h": "五、易错点", + "lines": [ + "四季成因是「地轴倾斜且方向不变」,不是「地球离太阳忽远忽近」。", + "近日点在 1 月初(北半球冬天),远日点在 7 月初(北半球夏天)。", + "南北半球季节相反:北半球夏至时南半球是冬至。", + "Esc 关闭窗口,F11 全屏。" + ] + } + ] + }, + "en": { + "title": "How to use · Earth Revolution", + "sections": [ + { + "h": "Getting started (follow along)", + "lines": [ + "Step 1: press 1 to freeze at the spring equinox and read the subsolar latitude.", + "Step 2: press 2 — the subsolar point jumps to 23.5°N, the June solstice.", + "Step 3: press 3 and 4 to compare all four key positions.", + "Step 4: press Space to animate one full orbit; adjust Speed as needed.", + "Step 5: drag to Top view to see the elliptical orbit and the fixed axis direction.", + "Nothing changing? Make sure Seasons is on in the top bar and the model isn't paused." + ] + }, + { + "h": "1. What this model shows", + "lines": [ + "Earth orbits the Sun in ~365.25 days; the axis keeps pointing near Polaris.", + "The axis is tilted 66.5° to the orbital plane (obliquity 23.5°).", + "Because the tilt direction is fixed, the subsolar point migrates between the tropics, making seasons.", + "Key dates: spring equinox 3/21, summer solstice 6/22, autumn equinox 9/23, winter solstice 12/22." + ] + }, + { + "h": "2. Basic controls", + "lines": [ + "Play/Pause runs the orbit; Speed sets how fast a year passes.", + "Step advances one increment for close observation.", + "Drag or scroll to change view/zoom; Top view / Side view switch perspective.", + "Reset returns to the spring equinox." + ] + }, + { + "h": "3. Solstices & equinoxes", + "lines": [ + "Keys 1–4 freeze at spring equinox, summer solstice, autumn equinox, winter solstice.", + "Equinoxes: subsolar at the equator (0°), equal day and night worldwide.", + "June solstice: subsolar at 23.5°N; longest day in the north, polar day inside the Arctic Circle.", + "December solstice: subsolar at 23.5°S; shortest day in the north, polar night.", + "The readout shows orbit angle, subsolar latitude, textbook date and season name." + ] + }, + { + "h": "4. Readouts & classroom cards", + "lines": [ + "Subsolar latitude comes from declinationDeg in the model data, not an approximation.", + "The seasons panel lists dates and phenomena for all four (bilingual).", + "Teaching notes: migrating subsolar point → changing noon altitude and day length → seasons." + ] + }, + { + "h": "5. Common mistakes", + "lines": [ + "Seasons come from the fixed axial tilt, NOT from Earth being closer/farther to the Sun.", + "Perihelion is early January (northern winter); aphelion is early July (northern summer).", + "Seasons are opposite in the two hemispheres.", + "Esc closes, F11 toggles fullscreen." + ] + } + ] + } +} diff --git a/Java/model/earth-revolution/earth-revolution.model/i18n/en.json b/Java/model/earth-revolution/earth-revolution.model/i18n/en.json new file mode 100644 index 0000000..145bcb0 --- /dev/null +++ b/Java/model/earth-revolution/earth-revolution.model/i18n/en.json @@ -0,0 +1,33 @@ +{ + "title": "Earth Revolution", + "view.rotation": "Rotation", + "view.revolution": "Revolution", + "play": "Play", + "pause": "Pause", + "speed": "Speed", + "reset": "Reset", + "labels": "Labels", + "orbit": "Orbit", + "grid": "Graticule", + "tilt": "Exaggerate tilt", + "lessons": "Teaching notes", + "seasons": "Solstices & equinoxes", + "close": "Close window", + "loading": "Preparing scene…", + "subsolar": "Subsolar point", + "north": "North pole", + "south": "South pole", + "northShort": "N", + "southShort": "S", + "sun": "Sun", + "earth": "Earth", + "spinInfo": "Rotation {0}° · period {1} h", + "orbitInfo": "Orbit {0}°", + "declinationInfo": "Subsolar {0}", + "dateInfo": "Date {0}", + "season.springEquinox": "Spring equinox", + "season.summerSolstice": "Summer solstice", + "season.autumnEquinox": "Autumn equinox", + "season.winterSolstice": "Winter solstice", + "hint": "Pinch or scroll to zoom · drag to turn the Earth" +} \ No newline at end of file diff --git a/Java/model/earth-revolution/earth-revolution.model/i18n/zh-CN.json b/Java/model/earth-revolution/earth-revolution.model/i18n/zh-CN.json new file mode 100644 index 0000000..b6817af --- /dev/null +++ b/Java/model/earth-revolution/earth-revolution.model/i18n/zh-CN.json @@ -0,0 +1,33 @@ +{ + "title": "地球自转", + "view.rotation": "自转", + "view.revolution": "公转", + "play": "播放", + "pause": "暂停", + "speed": "速度", + "reset": "重置", + "labels": "标注", + "orbit": "轨道", + "grid": "经纬网", + "tilt": "夸张倾角", + "lessons": "教学要点", + "seasons": "节气定位", + "close": "关闭窗口", + "loading": "正在准备场景…", + "subsolar": "太阳直射点", + "north": "北极", + "south": "南极", + "northShort": "N", + "southShort": "S", + "sun": "太阳", + "earth": "地球", + "spinInfo": "自转 {0}° · 周期 {1} 小时", + "orbitInfo": "公转 {0}°", + "declinationInfo": "太阳直射 {0}", + "dateInfo": "日期 {0}", + "season.springEquinox": "春分", + "season.summerSolstice": "夏至", + "season.autumnEquinox": "秋分", + "season.winterSolstice": "冬至", + "hint": "双指捏合或滚轮缩放 · 拖动可转动地球" +} \ No newline at end of file diff --git a/Java/model/earth-revolution/earth-revolution.model/land.json b/Java/model/earth-revolution/earth-revolution.model/land.json new file mode 100644 index 0000000..972210e --- /dev/null +++ b/Java/model/earth-revolution/earth-revolution.model/land.json @@ -0,0 +1,98 @@ +{ + "schema": 1, + "note": "简化大陆轮廓(经度,纬度),用于教学演示,非测绘精度", + "polygons": [ + { + "name": "north-america", + "points": [[-168,66],[-164,70],[-155,71],[-145,70],[-133,69],[-120,69],[-110,68],[-100,69],[-92,68],[-85,70],[-80,73],[-72,71],[-64,66],[-60,60],[-56,52],[-60,47],[-66,45],[-70,42],[-74,40],[-76,35],[-81,31],[-80,25],[-83,29],[-88,30],[-94,29],[-97,26],[-97,21],[-92,19],[-87,21],[-88,16],[-83,9],[-78,9],[-84,14],[-90,14],[-96,16],[-105,20],[-112,25],[-117,32],[-122,37],[-124,42],[-125,48],[-131,54],[-140,59],[-150,59],[-158,56],[-165,60],[-166,64]] + }, + { + "name": "greenland", + "points": [[-45,60],[-52,64],[-55,68],[-60,72],[-63,76],[-56,80],[-42,82],[-28,80],[-21,74],[-23,70],[-31,66],[-38,62]] + }, + { + "name": "south-america", + "points": [[-78,8],[-72,11],[-64,10],[-60,8],[-52,5],[-50,0],[-44,-2],[-38,-5],[-35,-8],[-39,-13],[-41,-22],[-48,-25],[-53,-34],[-57,-38],[-62,-40],[-65,-45],[-68,-50],[-70,-55],[-75,-52],[-74,-45],[-73,-37],[-71,-30],[-70,-23],[-70,-18],[-76,-14],[-81,-6],[-80,-2],[-79,2],[-77,6]] + }, + { + "name": "africa", + "points": [[-17,15],[-16,20],[-13,28],[-9,32],[-5,36],[10,37],[20,32],[32,31],[35,28],[39,15],[43,11],[51,12],[48,2],[41,-2],[40,-10],[35,-18],[32,-25],[27,-33],[20,-35],[15,-28],[12,-17],[9,-1],[5,4],[-4,5],[-8,4],[-13,8],[-16,12]] + }, + { + "name": "europe", + "points": [[-9,38],[-9,43],[-2,44],[0,48],[2,51],[5,53],[8,54],[9,57],[12,56],[13,54],[20,54],[21,57],[24,58],[28,60],[30,60],[29,64],[25,66],[22,69],[30,70],[40,68],[46,66],[55,68],[60,70],[68,68],[62,62],[58,56],[52,50],[48,46],[40,45],[36,44],[30,45],[28,41],[24,40],[23,37],[19,40],[16,41],[12,44],[7,44],[3,42],[-2,37]] + }, + { + "name": "asia", + "points": [[60,70],[75,73],[90,75],[105,77],[115,74],[130,73],[145,72],[160,70],[170,68],[180,65],[172,62],[163,58],[155,52],[143,54],[137,50],[130,43],[126,40],[122,40],[120,36],[122,31],[118,25],[110,21],[105,10],[100,13],[98,8],[95,17],[90,22],[88,21],[80,16],[77,8],[73,18],[68,23],[62,25],[57,24],[52,28],[48,30],[44,13],[43,17],[39,21],[35,28],[34,31],[36,36],[30,41],[28,41],[30,45],[34,45],[40,45],[48,46],[52,50],[58,56],[62,62],[68,68]] + }, + { + "name": "australia", + "points": [[113,-22],[114,-27],[116,-35],[129,-32],[138,-35],[146,-39],[150,-37],[153,-28],[146,-19],[142,-11],[132,-11],[126,-14],[122,-18]] + }, + { + "name": "antarctica", + "points": [[-180,-72],[-150,-76],[-120,-74],[-90,-73],[-60,-64],[-30,-70],[0,-70],[30,-69],[60,-67],[90,-66],[120,-66],[150,-70],[180,-72],[180,-90],[-180,-90]] + }, + { + "name": "madagascar", + "points": [[43,-12],[50,-15],[50,-25],[45,-25],[43,-20]] + }, + { + "name": "japan", + "points": [[130,32],[136,35],[141,40],[145,44],[142,39],[137,34],[133,33]] + }, + { + "name": "britain", + "points": [[-6,50],[-2,53],[-2,58],[-5,58],[-6,54]] + }, + { + "name": "ireland", + "points": [[-10,52],[-6,53],[-6,55],[-10,55]] + }, + { + "name": "iceland", + "points": [[-24,65],[-14,66],[-14,64],[-22,63]] + }, + { + "name": "new-zealand", + "points": [[166,-46],[170,-44],[174,-41],[177,-38],[174,-35],[170,-38],[167,-42]] + }, + { + "name": "sumatra", + "points": [[95,5],[100,1],[105,-6],[100,-4],[96,2]] + }, + { + "name": "java", + "points": [[105,-6],[114,-8],[114,-9],[106,-7]] + }, + { + "name": "borneo", + "points": [[109,2],[117,4],[119,-2],[115,-4],[110,-2]] + }, + { + "name": "sulawesi", + "points": [[119,1],[125,1],[123,-5],[120,-3]] + }, + { + "name": "new-guinea", + "points": [[131,-1],[141,-3],[150,-6],[147,-9],[140,-9],[134,-5]] + }, + { + "name": "sri-lanka", + "points": [[80,9],[82,7],[81,6],[79,7]] + }, + { + "name": "philippines", + "points": [[120,18],[124,13],[126,8],[122,6],[120,12]] + }, + { + "name": "cuba", + "points": [[-85,22],[-77,20],[-74,20],[-80,23]] + }, + { + "name": "taiwan", + "points": [[120,25],[122,24],[121,22],[120,23]] + } + ] +} diff --git a/Java/model/earth-revolution/earth-revolution.model/preview.png b/Java/model/earth-revolution/earth-revolution.model/preview.png new file mode 100644 index 0000000..75b6967 Binary files /dev/null and b/Java/model/earth-revolution/earth-revolution.model/preview.png differ diff --git a/Java/model/earth-revolution/earth-revolution.model/scene.json b/Java/model/earth-revolution/earth-revolution.model/scene.json new file mode 100644 index 0000000..792dcd7 --- /dev/null +++ b/Java/model/earth-revolution/earth-revolution.model/scene.json @@ -0,0 +1,139 @@ +{ + "schemaVersion": 1, + "type": "planet", + "defaultView": "revolution", + "views": [ + "revolution" + ], + "nameI18n": { + "zh-CN": "地球公转", + "en": "Earth Revolution" + }, + "descriptionI18n": { + "zh-CN": "地球绕太阳公转一年:地轴指向不变,太阳直射点南北往返,形成四季。", + "en": "One year around the Sun: the fixed axial direction moves the subsolar point and creates the seasons." + }, + "star": { + "name": "Sun", + "nameI18n": { + "zh-CN": "太阳", + "en": "Sun" + }, + "color": "#FFC24B", + "radiusScale": 0.5 + }, + "planet": { + "name": "Earth", + "nameI18n": { + "zh-CN": "地球", + "en": "Earth" + }, + "axialTiltDeg": 23.5, + "tropicDeg": 23.5, + "rotationHours": 23.93, + "orbitDays": 365.26, + "oceanColor": "#1C5FA8", + "landColor": "#4E8C4C", + "iceColor": "#E9EFF6", + "landFile": "land.json", + "showGraticule": false + }, + "orbit": { + "semiMajorAxis": 4.0, + "eccentricity": 0.0167, + "show": true, + "seasonLayout": "springTopSummerLeft", + "seasons": [ + { + "angleDeg": 0, + "key": "season.springEquinox", + "date": "3/21", + "declinationDeg": 0, + "teachingI18n": { + "zh-CN": "太阳直射赤道,全球昼夜平分。此后直射点由赤道向北移动。", + "en": "The Sun is overhead at the equator and day equals night everywhere. The subsolar point now moves north." + } + }, + { + "angleDeg": 90, + "key": "season.summerSolstice", + "date": "6/22", + "declinationDeg": 23.5, + "teachingI18n": { + "zh-CN": "太阳直射北回归线 23.5°N。北半球昼最长、夜最短,北极圈内出现极昼。", + "en": "The Sun is overhead at the Tropic of Cancer (23.5°N). The northern hemisphere has its longest day." + } + }, + { + "angleDeg": 180, + "key": "season.autumnEquinox", + "date": "9/23", + "declinationDeg": 0, + "teachingI18n": { + "zh-CN": "太阳再次直射赤道,全球昼夜平分。此后直射点向南移动。", + "en": "The Sun is overhead at the equator again. The subsolar point now moves south." + } + }, + { + "angleDeg": 270, + "key": "season.winterSolstice", + "date": "12/22", + "declinationDeg": -23.5, + "teachingI18n": { + "zh-CN": "太阳直射南回归线 23.5°S。北半球昼最短、夜最长,北极圈内出现极夜。", + "en": "The Sun is overhead at the Tropic of Capricorn (23.5°S). The northern hemisphere has its shortest day." + } + } + ] + }, + "lessons": [ + { + "titleI18n": { + "zh-CN": "一年绕太阳一圈", + "en": "One lap per year" + }, + "bodyI18n": { + "zh-CN": "公转方向与自转相同,周期约 365.26 天;轨道接近圆形。", + "en": "The orbit takes about 365.26 days and runs the same direction as the spin." + }, + "view": "revolution", + "angleDeg": 0 + }, + { + "titleI18n": { + "zh-CN": "地轴指向不变", + "en": "The axis keeps its direction" + }, + "bodyI18n": { + "zh-CN": "公转过程中地轴始终指向北极星附近,黄赤交角 23.5° 保持不变。", + "en": "During the whole orbit the axis keeps pointing near Polaris, so the 23.5° tilt stays fixed in space." + }, + "view": "revolution", + "angleDeg": 90 + }, + { + "titleI18n": { + "zh-CN": "夏至与冬至", + "en": "Solstices" + }, + "bodyI18n": { + "zh-CN": "夏至太阳直射北回归线 23.5°N,北半球昼最长;冬至直射南回归线 23.5°S。", + "en": "At the June solstice the Sun is overhead at 23.5°N; at the December solstice at 23.5°S." + }, + "view": "revolution", + "angleDeg": 90 + }, + { + "titleI18n": { + "zh-CN": "春分与秋分", + "en": "Equinoxes" + }, + "bodyI18n": { + "zh-CN": "春分、秋分太阳直射赤道,全球昼夜平分,是四季的转折点。", + "en": "At the equinoxes the Sun is overhead at the equator and day equals night everywhere." + }, + "view": "revolution", + "angleDeg": 180 + } + ] +} diff --git a/Java/model/earth-rotation/earth-rotation.json b/Java/model/earth-rotation/earth-rotation.json new file mode 100644 index 0000000..fbed4db --- /dev/null +++ b/Java/model/earth-rotation/earth-rotation.json @@ -0,0 +1,36 @@ +{ + "schemaVersion": 1, + "id": "earth-rotation", + "name": "Earth Rotation", + "nameI18n": { + "zh-CN": "地球自转", + "en": "Earth Rotation" + }, + "author": "Morris", + "description": "昼夜交替、晨昏线与太阳直射点", + "descriptionI18n": { + "zh-CN": "观察自转中的地球:昼夜半球、晨昏线与太阳直射点位置。", + "en": "Watch a rotating Earth: day/night hemispheres, terminator and the subsolar point." + }, + "tags": [ + "astronomy", + "geography", + "rotation" + ], + "entry": "scene.json", + "license": "MIT", + "assembly": "EarthRotationModel.dll", + "type": "GC.EarthModels.RotationModelFactory", + "preview": "preview.png", + "apiVersion": 1, + "version": "1.7", + "chrome": { + "titleBar": "#0C1828", + "titleBorder": "#1B2740", + "titleText": "#EAF2FF", + "button": "#9FB4D4", + "frame": "#0A1524" + }, + "build": "ecd52665f9", + "updatedAt": "2026-11-21T10:55:36Z" +} diff --git a/Java/model/earth-rotation/earth-rotation.model/help.json b/Java/model/earth-rotation/earth-rotation.model/help.json new file mode 100644 index 0000000..f5ac50b --- /dev/null +++ b/Java/model/earth-rotation/earth-rotation.model/help.json @@ -0,0 +1,121 @@ +{ + "zh-CN": { + "title": "如何使用 · 地球自转", + "sections": [ + { + "h": "开始使用(跟着做)", + "lines": [ + "第 1 步:窗口打开后先按「空格」暂停,动画停住才好观察。", + "第 2 步:按住鼠标左键拖动地球,把晨昏线转到正对你。", + "第 3 步:点顶部「经纬网」打开网格,能看清哪一段是夜半球。", + "第 4 步:再按「空格」播放,盯住一个点,看它从黑夜转进白天。", + "第 5 步:按住「←」「→」可以一格一格慢慢看昼夜交界线怎么移动。", + "找不到按钮?所有开关都在窗口顶部那一排;转不动地球就点「复位」重来。" + ] + }, + { + "h": "一、这个模型讲什么", + "lines": [ + "地球绕地轴自西向东自转,周期约 24 小时(一个太阳日)。", + "自转产生三个可观察现象:昼夜交替、地方时差、地转偏向力。", + "晨昏线( terminator )是把地球分成昼半球与夜半球的大圆,它随自转不断西移。", + "太阳直射点是地表太阳高度为 90° 的点,正午太阳高度由它向南北两侧递减。" + ] + }, + { + "h": "二、基本操作", + "lines": [ + "拖动地球:改变观察角度(经度/纬度),可从极地或赤道上空看。", + "滚轮或双指捏合:缩放;右上角「放大」可切到地球特写。", + "「播放 / 暂停」开始或停止自转动画;「速度」调节快慢。", + "「重置」把角度、速度、缩放恢复到初始状态。" + ] + }, + { + "h": "三、图层开关", + "lines": [ + "「经纬网」叠加经线与纬线,便于读出赤道、回归线、极圈。", + "「标注」显示北极、南极、太阳直射点、赤道等关键标签。", + "「轨道」显示自转轴与赤道面;「夸张倾角」把 23.5° 放大便于观察。", + "「教学要点」展开课堂讲解文字,适合投屏授课。" + ] + }, + { + "h": "四、键盘快捷键", + "lines": [ + "空格:播放 / 暂停。", + "← →:逐帧步进(暂停时最有用)。", + "Esc:关闭窗口;F11:全屏 / 退出全屏。" + ] + }, + { + "h": "五、课堂上怎么用", + "lines": [ + "先暂停,把晨昏线转到与经线重合,说明「昼夜平分」只在二分日出现。", + "再播放,让学生观察同一地点如何由夜入昼(晨线)与由昼入夜(昏线)。", + "对比不同经度:东边地点先见到日出,引出「东早西晚」的地方时差。", + "易错提醒:昼夜现象本身由「地球不发光、不透明」造成,自转只造成「交替」。" + ] + } + ] + }, + "en": { + "title": "How to use · Earth Rotation", + "sections": [ + { + "h": "Getting started (follow along)", + "lines": [ + "Step 1: press Space to pause first — a still globe is easier to read.", + "Step 2: hold the left mouse button and drag until the terminator faces you.", + "Step 3: switch on Graticule in the top bar to see which side is night.", + "Step 4: press Space to play and watch one point rotate from night into day.", + "Step 5: use ← / → to step frame by frame and follow the day/night boundary.", + "Can't find a control? Every toggle is in the top bar; if the globe gets twisted, press Reset." + ] + }, + { + "h": "1. What this model shows", + "lines": [ + "Earth spins west-to-east on its axis in about 24 hours (a solar day).", + "Rotation causes the day/night cycle, local time differences and the Coriolis effect.", + "The terminator is the great circle splitting day and night; it moves west as Earth turns.", + "The subsolar point is where the Sun is overhead; noon altitude decreases away from it." + ] + }, + { + "h": "2. Basic controls", + "lines": [ + "Drag the globe to change the viewing angle (from pole or equator).", + "Scroll or pinch to zoom; the close-up button gives an Earth detail view.", + "Play/Pause starts or stops the spin; Speed changes the rate.", + "Reset restores the initial angle, speed and zoom." + ] + }, + { + "h": "3. Layer toggles", + "lines": [ + "Graticule overlays meridians and parallels (equator, tropics, polar circles).", + "Labels shows poles, subsolar point and the equator.", + "Orbit shows the axis and equatorial plane; Exaggerate tilt magnifies the 23.5° tilt.", + "Teaching notes expands classroom text, useful on a projector." + ] + }, + { + "h": "4. Keyboard shortcuts", + "lines": [ + "Space: play / pause. ← →: step one frame (best while paused).", + "Esc: close window. F11: toggle fullscreen." + ] + }, + { + "h": "5. In the classroom", + "lines": [ + "Pause with the terminator along a meridian to show equal day/night at equinoxes.", + "Play again and watch a site cross the dawn line and the dusk line.", + "Compare longitudes: eastern places see sunrise earlier — local time runs ahead.", + "Common mistake: day/night exists because Earth is opaque; rotation only makes it alternate." + ] + } + ] + } +} diff --git a/Java/model/earth-rotation/earth-rotation.model/i18n/en.json b/Java/model/earth-rotation/earth-rotation.model/i18n/en.json new file mode 100644 index 0000000..536b37a --- /dev/null +++ b/Java/model/earth-rotation/earth-rotation.model/i18n/en.json @@ -0,0 +1,33 @@ +{ + "title": "Earth Rotation", + "view.rotation": "Rotation", + "view.revolution": "Revolution", + "play": "Play", + "pause": "Pause", + "speed": "Speed", + "reset": "Reset", + "labels": "Labels", + "orbit": "Orbit", + "grid": "Graticule", + "tilt": "Exaggerate tilt", + "lessons": "Teaching notes", + "seasons": "Solstices & equinoxes", + "close": "Close window", + "loading": "Preparing scene…", + "subsolar": "Subsolar point", + "north": "North pole", + "south": "South pole", + "northShort": "N", + "southShort": "S", + "sun": "Sun", + "earth": "Earth", + "spinInfo": "Rotation {0}° · period {1} h", + "orbitInfo": "Orbit {0}°", + "declinationInfo": "Subsolar {0}", + "dateInfo": "Date {0}", + "season.springEquinox": "Spring equinox", + "season.summerSolstice": "Summer solstice", + "season.autumnEquinox": "Autumn equinox", + "season.winterSolstice": "Winter solstice", + "hint": "Pinch or scroll to zoom · drag to turn the Earth" +} \ No newline at end of file diff --git a/Java/model/earth-rotation/earth-rotation.model/i18n/zh-CN.json b/Java/model/earth-rotation/earth-rotation.model/i18n/zh-CN.json new file mode 100644 index 0000000..b6817af --- /dev/null +++ b/Java/model/earth-rotation/earth-rotation.model/i18n/zh-CN.json @@ -0,0 +1,33 @@ +{ + "title": "地球自转", + "view.rotation": "自转", + "view.revolution": "公转", + "play": "播放", + "pause": "暂停", + "speed": "速度", + "reset": "重置", + "labels": "标注", + "orbit": "轨道", + "grid": "经纬网", + "tilt": "夸张倾角", + "lessons": "教学要点", + "seasons": "节气定位", + "close": "关闭窗口", + "loading": "正在准备场景…", + "subsolar": "太阳直射点", + "north": "北极", + "south": "南极", + "northShort": "N", + "southShort": "S", + "sun": "太阳", + "earth": "地球", + "spinInfo": "自转 {0}° · 周期 {1} 小时", + "orbitInfo": "公转 {0}°", + "declinationInfo": "太阳直射 {0}", + "dateInfo": "日期 {0}", + "season.springEquinox": "春分", + "season.summerSolstice": "夏至", + "season.autumnEquinox": "秋分", + "season.winterSolstice": "冬至", + "hint": "双指捏合或滚轮缩放 · 拖动可转动地球" +} \ No newline at end of file diff --git a/Java/model/earth-rotation/earth-rotation.model/land.json b/Java/model/earth-rotation/earth-rotation.model/land.json new file mode 100644 index 0000000..972210e --- /dev/null +++ b/Java/model/earth-rotation/earth-rotation.model/land.json @@ -0,0 +1,98 @@ +{ + "schema": 1, + "note": "简化大陆轮廓(经度,纬度),用于教学演示,非测绘精度", + "polygons": [ + { + "name": "north-america", + "points": [[-168,66],[-164,70],[-155,71],[-145,70],[-133,69],[-120,69],[-110,68],[-100,69],[-92,68],[-85,70],[-80,73],[-72,71],[-64,66],[-60,60],[-56,52],[-60,47],[-66,45],[-70,42],[-74,40],[-76,35],[-81,31],[-80,25],[-83,29],[-88,30],[-94,29],[-97,26],[-97,21],[-92,19],[-87,21],[-88,16],[-83,9],[-78,9],[-84,14],[-90,14],[-96,16],[-105,20],[-112,25],[-117,32],[-122,37],[-124,42],[-125,48],[-131,54],[-140,59],[-150,59],[-158,56],[-165,60],[-166,64]] + }, + { + "name": "greenland", + "points": [[-45,60],[-52,64],[-55,68],[-60,72],[-63,76],[-56,80],[-42,82],[-28,80],[-21,74],[-23,70],[-31,66],[-38,62]] + }, + { + "name": "south-america", + "points": [[-78,8],[-72,11],[-64,10],[-60,8],[-52,5],[-50,0],[-44,-2],[-38,-5],[-35,-8],[-39,-13],[-41,-22],[-48,-25],[-53,-34],[-57,-38],[-62,-40],[-65,-45],[-68,-50],[-70,-55],[-75,-52],[-74,-45],[-73,-37],[-71,-30],[-70,-23],[-70,-18],[-76,-14],[-81,-6],[-80,-2],[-79,2],[-77,6]] + }, + { + "name": "africa", + "points": [[-17,15],[-16,20],[-13,28],[-9,32],[-5,36],[10,37],[20,32],[32,31],[35,28],[39,15],[43,11],[51,12],[48,2],[41,-2],[40,-10],[35,-18],[32,-25],[27,-33],[20,-35],[15,-28],[12,-17],[9,-1],[5,4],[-4,5],[-8,4],[-13,8],[-16,12]] + }, + { + "name": "europe", + "points": [[-9,38],[-9,43],[-2,44],[0,48],[2,51],[5,53],[8,54],[9,57],[12,56],[13,54],[20,54],[21,57],[24,58],[28,60],[30,60],[29,64],[25,66],[22,69],[30,70],[40,68],[46,66],[55,68],[60,70],[68,68],[62,62],[58,56],[52,50],[48,46],[40,45],[36,44],[30,45],[28,41],[24,40],[23,37],[19,40],[16,41],[12,44],[7,44],[3,42],[-2,37]] + }, + { + "name": "asia", + "points": [[60,70],[75,73],[90,75],[105,77],[115,74],[130,73],[145,72],[160,70],[170,68],[180,65],[172,62],[163,58],[155,52],[143,54],[137,50],[130,43],[126,40],[122,40],[120,36],[122,31],[118,25],[110,21],[105,10],[100,13],[98,8],[95,17],[90,22],[88,21],[80,16],[77,8],[73,18],[68,23],[62,25],[57,24],[52,28],[48,30],[44,13],[43,17],[39,21],[35,28],[34,31],[36,36],[30,41],[28,41],[30,45],[34,45],[40,45],[48,46],[52,50],[58,56],[62,62],[68,68]] + }, + { + "name": "australia", + "points": [[113,-22],[114,-27],[116,-35],[129,-32],[138,-35],[146,-39],[150,-37],[153,-28],[146,-19],[142,-11],[132,-11],[126,-14],[122,-18]] + }, + { + "name": "antarctica", + "points": [[-180,-72],[-150,-76],[-120,-74],[-90,-73],[-60,-64],[-30,-70],[0,-70],[30,-69],[60,-67],[90,-66],[120,-66],[150,-70],[180,-72],[180,-90],[-180,-90]] + }, + { + "name": "madagascar", + "points": [[43,-12],[50,-15],[50,-25],[45,-25],[43,-20]] + }, + { + "name": "japan", + "points": [[130,32],[136,35],[141,40],[145,44],[142,39],[137,34],[133,33]] + }, + { + "name": "britain", + "points": [[-6,50],[-2,53],[-2,58],[-5,58],[-6,54]] + }, + { + "name": "ireland", + "points": [[-10,52],[-6,53],[-6,55],[-10,55]] + }, + { + "name": "iceland", + "points": [[-24,65],[-14,66],[-14,64],[-22,63]] + }, + { + "name": "new-zealand", + "points": [[166,-46],[170,-44],[174,-41],[177,-38],[174,-35],[170,-38],[167,-42]] + }, + { + "name": "sumatra", + "points": [[95,5],[100,1],[105,-6],[100,-4],[96,2]] + }, + { + "name": "java", + "points": [[105,-6],[114,-8],[114,-9],[106,-7]] + }, + { + "name": "borneo", + "points": [[109,2],[117,4],[119,-2],[115,-4],[110,-2]] + }, + { + "name": "sulawesi", + "points": [[119,1],[125,1],[123,-5],[120,-3]] + }, + { + "name": "new-guinea", + "points": [[131,-1],[141,-3],[150,-6],[147,-9],[140,-9],[134,-5]] + }, + { + "name": "sri-lanka", + "points": [[80,9],[82,7],[81,6],[79,7]] + }, + { + "name": "philippines", + "points": [[120,18],[124,13],[126,8],[122,6],[120,12]] + }, + { + "name": "cuba", + "points": [[-85,22],[-77,20],[-74,20],[-80,23]] + }, + { + "name": "taiwan", + "points": [[120,25],[122,24],[121,22],[120,23]] + } + ] +} diff --git a/Java/model/earth-rotation/earth-rotation.model/preview.png b/Java/model/earth-rotation/earth-rotation.model/preview.png new file mode 100644 index 0000000..b95d846 Binary files /dev/null and b/Java/model/earth-rotation/earth-rotation.model/preview.png differ diff --git a/Java/model/earth-rotation/earth-rotation.model/scene.json b/Java/model/earth-rotation/earth-rotation.model/scene.json new file mode 100644 index 0000000..fdb7a89 --- /dev/null +++ b/Java/model/earth-rotation/earth-rotation.model/scene.json @@ -0,0 +1,138 @@ +{ + "schemaVersion": 1, + "type": "planet", + "defaultView": "rotation", + "views": [ + "rotation" + ], + "nameI18n": { + "zh-CN": "地球自转", + "en": "Earth Rotation" + }, + "descriptionI18n": { + "zh-CN": "观察自转中的地球:昼夜半球、晨昏线与太阳直射点位置。", + "en": "Watch a rotating Earth: day/night hemispheres, terminator and the subsolar point." + }, + "star": { + "name": "Sun", + "nameI18n": { + "zh-CN": "太阳", + "en": "Sun" + }, + "color": "#FFC24B", + "radiusScale": 0.5 + }, + "planet": { + "name": "Earth", + "nameI18n": { + "zh-CN": "地球", + "en": "Earth" + }, + "axialTiltDeg": 23.5, + "tropicDeg": 23.5, + "rotationHours": 23.93, + "orbitDays": 365.26, + "oceanColor": "#1C5FA8", + "landColor": "#4E8C4C", + "iceColor": "#E9EFF6", + "landFile": "land.json", + "showGraticule": true + }, + "orbit": { + "semiMajorAxis": 4.0, + "eccentricity": 0.0167, + "show": true, + "seasons": [ + { + "angleDeg": 0, + "key": "season.springEquinox", + "date": "3/21", + "declinationDeg": 0, + "teachingI18n": { + "zh-CN": "太阳直射赤道,全球昼夜平分。", + "en": "The Sun is overhead at the equator and day equals night everywhere." + } + }, + { + "angleDeg": 90, + "key": "season.summerSolstice", + "date": "6/22", + "declinationDeg": 23.5, + "teachingI18n": { + "zh-CN": "太阳直射北回归线 23.5°N,北半球昼最长。", + "en": "The Sun is overhead at 23.5°N; the northern hemisphere has its longest day." + } + }, + { + "angleDeg": 180, + "key": "season.autumnEquinox", + "date": "9/23", + "declinationDeg": 0, + "teachingI18n": { + "zh-CN": "太阳直射赤道,全球昼夜平分。", + "en": "The Sun is overhead at the equator and day equals night everywhere." + } + }, + { + "angleDeg": 270, + "key": "season.winterSolstice", + "date": "12/22", + "declinationDeg": -23.5, + "teachingI18n": { + "zh-CN": "太阳直射南回归线 23.5°S,北半球昼最短。", + "en": "The Sun is overhead at 23.5°S; the northern hemisphere has its shortest day." + } + } + ] + }, + "lessons": [ + { + "titleI18n": { + "zh-CN": "自西向东的自转", + "en": "Rotation from west to east" + }, + "bodyI18n": { + "zh-CN": "从北极上空看,地球逆时针转动;转一圈用 23 小时 56 分 4 秒。", + "en": "Seen from above the north pole the Earth turns counter-clockwise, once every 23 h 56 min." + }, + "view": "rotation", + "angleDeg": 0 + }, + { + "titleI18n": { + "zh-CN": "昼夜交替", + "en": "Day and night" + }, + "bodyI18n": { + "zh-CN": "晨昏线(白色虚线)把地球分成昼半球与夜半球,交替周期 24 小时。", + "en": "The terminator (white dashes) splits the lit and dark hemispheres; one cycle takes 24 h." + }, + "view": "rotation", + "angleDeg": 60 + }, + { + "titleI18n": { + "zh-CN": "太阳直射点", + "en": "Subsolar point" + }, + "bodyI18n": { + "zh-CN": "黄色圆环标出太阳光垂直照射的位置,它随季节在南北回归线之间往返。", + "en": "The yellow ring marks where sunlight strikes vertically — it drifts between the tropics over a year." + }, + "view": "rotation", + "angleDeg": 120 + }, + { + "titleI18n": { + "zh-CN": "地轴倾斜 23.5°", + "en": "Axial tilt 23.5°" + }, + "bodyI18n": { + "zh-CN": "地轴与黄道面法线成 23.5°,倾斜方向不变,这是四季与五带划分的根本原因。", + "en": "The axis is tilted 23.5° from the ecliptic normal and keeps its direction — the root cause of seasons." + }, + "view": "rotation", + "angleDeg": 200 + } + ] +} diff --git a/Java/model/scale-calculator/scale-calculator.json b/Java/model/scale-calculator/scale-calculator.json new file mode 100644 index 0000000..b8172de --- /dev/null +++ b/Java/model/scale-calculator/scale-calculator.json @@ -0,0 +1,37 @@ +{ + "schemaVersion": 1, + "id": "scale-calculator", + "name": "Scale Calculator", + "nameI18n": { + "zh-CN": "比例尺计算器", + "en": "Scale Calculator" + }, + "author": "Morris GC", + "description": "把比例尺变成可以拖、可以量的可视化标尺", + "descriptionI18n": { + "zh-CN": "三种求解模式、图上/实地双条对比、线段式比例尺自动换挡、比例尺光谱、真实地标实地尺与练习闯关。", + "en": "Three solve modes, dual map/real bars, auto-ranging graphic scale, scale spectrum, real-world landmarks and practice quizzes." + }, + "tags": [ + "geography", + "map", + "scale", + "calculator" + ], + "entry": "scales.json", + "license": "MIT", + "assembly": "ScaleCalculatorModel.dll", + "type": "GC.ScaleCalculator.ScaleCalculatorFactory", + "preview": "preview.png", + "apiVersion": 1, + "version": "1.6", + "chrome": { + "titleBar": "#FFFFFF", + "titleBorder": "#E3E8F3", + "titleText": "#111A2E", + "button": "#5B6A86", + "frame": "#F4F6FB" + }, + "build": "105653737d", + "updatedAt": "2026-11-21T10:55:36Z" +} diff --git a/Java/model/scale-calculator/scale-calculator.model/help.json b/Java/model/scale-calculator/scale-calculator.model/help.json new file mode 100644 index 0000000..3351d94 --- /dev/null +++ b/Java/model/scale-calculator/scale-calculator.model/help.json @@ -0,0 +1,146 @@ +{ + "zh-CN": { + "title": "如何使用 · 比例尺计算器", + "sections": [ + { + "h": "开始使用(跟着做)", + "lines": [ + "第 1 步:顶部选「求实地距离」,此时蓝色卡是答案,另外两个是输入。", + "第 2 步:在「图上距离」里填 3,在「比例尺分母」里填 100000。", + "第 3 步:看蓝色卡算出 3 千米 —— 再点「解题步骤」核对每一步。", + "第 4 步:改成「求比例尺」,把实地距离填成 6 千米,看分母怎么翻倍。", + "第 5 步:拖动中间标尺的滑块,观察蓝色条(图上)与绿色条(实地)的长度关系。", + "第 6 步:滚到底部「练习闯关」,自己做一道,答错会自动展开步骤。", + "算不出来?先检查单位:填了 km 就不要再按 cm 算,模型会自动换算。" + ] + }, + { + "h": "一、核心公式(先记住这一条)", + "lines": [ + "比例尺 = 图上距离 ÷ 实地距离,写作 1 : N。", + "N 是分母,含义是「实地距离是图上距离的 N 倍」,两句都必须统一成同一单位。", + "三个变形:实地 = 图上 × N;图上 = 实地 ÷ N;N = 实地 ÷ 图上。", + "单位换算:1 m = 100 cm,1 km = 1000 m = 100000 cm(km 化 cm 加 5 个 0)。" + ] + }, + { + "h": "二、三种求解模式", + "lines": [ + "顶部三个按钮选「求实地距离 / 求图上距离 / 求比例尺」。", + "选中的那一项会变成蓝色结果卡(只读),另外两项留作输入。", + "拖动滑块或直接输入数字,三栏读数与中栏标尺实时联动。", + "「重置」回到 3 cm / 1:100000 / 3 km 的初始例子。" + ] + }, + { + "h": "三、中栏可视化标尺", + "lines": [ + "上条(蓝)是图上距离,按真实厘米画刻度。", + "下条(绿)是同一段实地距离按当前比例尺压缩后的长度,与上方同宽。", + "线段式比例尺会按 1/2/5×10ⁿ 自动换挡,任何比例尺都画得下。", + "比例尺光谱把 1:1千 到 1:10亿 排在对数轴上,当前值用指针标出。", + "若超出图幅,会提示「需要更小的比例尺」——这正是选图幅的教学点。" + ] + }, + { + "h": "四、三种写法与解题步骤", + "lines": [ + "数字式 1 : N;文字式「图上 1 厘米代表实地 …」;线段式(图形刻度)。", + "右栏三者实时联动,可直接抄到作业里。", + "「解题步骤」可展开:① 统一单位 → ② 列公式 → ③ 代入 → ④ 得数 → ⑤ 换算合适单位。", + "「大小判读」卡:大 / 中 / 小比例尺 +「分母越大 → 比例尺越小 → 范围越大 → 越简略」。" + ] + }, + { + "h": "五、实地尺与练习", + "lines": [ + "「实地尺」内置教室 10 m、操场 400 m、马拉松 42.195 km、京沪 1080 km、赤道 4 万 km。", + "改变比例尺,看这段真实距离画到图上是多长(或画不下 / 几乎看不见)。", + "「练习闯关」随机出三类题,填数字后回车或点「检查」,答错展开完整解题步骤。", + "连对计数会一直累计,答错清零。" + ] + }, + { + "h": "六、易错点", + "lines": [ + "忘记统一单位:km 必须 ×100000 变成 cm 才能代入。", + "「放大 2 倍」是分母 ÷ 2(比例尺变大),不是 × 2。", + "图上距离与实地距离别代反了;N 是「实地是图上的几倍」。", + "比例尺是比值,没有单位;说「比例尺越大」指的是比值越大、分母越小。" + ] + } + ] + }, + "en": { + "title": "How to use · Scale Calculator", + "sections": [ + { + "h": "Getting started (follow along)", + "lines": [ + "Step 1: choose Find real distance at the top — the blue card is the answer, the other two are inputs.", + "Step 2: enter 3 as the map distance and 100000 as the scale denominator.", + "Step 3: the blue card shows 3 km — open Worked steps and check each line.", + "Step 4: switch to Find scale, set the real distance to 6 km, and watch the denominator change.", + "Step 5: drag the ruler slider and compare the blue bar (map) with the green bar (real).", + "Step 6: scroll to Practice and try one; a wrong answer expands the full solution.", + "Stuck? Check your units first — the model converts automatically, so don't mix km and cm." + ] + }, + { + "h": "1. The core formula", + "lines": [ + "Scale = map distance ÷ real distance, written 1 : N.", + "N is the denominator: the real distance is N times the map distance — both must share one unit.", + "Three forms: real = map × N; map = real ÷ N; N = real ÷ map.", + "Unit conversions: 1 m = 100 cm, 1 km = 1000 m = 100000 cm (add five zeros)." + ] + }, + { + "h": "2. Three solve modes", + "lines": [ + "Pick Find real distance / Find map distance / Find scale at the top.", + "The chosen one becomes the blue read-only result card; the other two stay as inputs.", + "Drag a slider or type a number — all three columns and the ruler update live.", + "Reset returns to the default 3 cm / 1:100000 / 3 km example." + ] + }, + { + "h": "3. The visual ruler", + "lines": [ + "The blue bar is the map distance in real centimetres.", + "The green bar is the same real distance compressed by the current scale — same width.", + "The graphic scale auto-ranges over 1/2/5×10ⁿ so it always fits.", + "The spectrum places 1:1k … 1:1B on a log axis with a pointer at the current value.", + "Overflow warns “use a smaller scale” — that IS the lesson on choosing a sheet size." + ] + }, + { + "h": "4. Three notations & worked steps", + "lines": [ + "Numeric 1:N; verbal “1 cm on the map = … on the ground”; graphic bar scale.", + "All three stay in sync and can be copied straight into homework.", + "Expand Worked steps: unify units → formula → substitute → result → convert unit.", + "The grade card: large / medium / small scale and “bigger denominator → smaller scale → larger area → less detail”." + ] + }, + { + "h": "5. Real-world ruler & practice", + "lines": [ + "Built-in distances: classroom 10 m, track 400 m, marathon 42.195 km, Beijing–Shanghai 1080 km, equator 40,000 km.", + "Change the scale to see how long each becomes on paper (or that it won't fit / is invisible).", + "Practice generates three question types; type a number and press Enter or Check; wrong answers reveal full steps.", + "The streak counter accumulates and resets on a wrong answer." + ] + }, + { + "h": "6. Common mistakes", + "lines": [ + "Forgetting to unify units: km ×100000 → cm before substituting.", + "“Zoom 2×” means denominator ÷ 2 (a larger scale), not × 2.", + "Don't swap map and real distance; N means “how many times the map length the real length is”.", + "A scale is a ratio with no unit; “larger scale” means a larger ratio, i.e. a SMALLER denominator." + ] + } + ] + } +} diff --git a/Java/model/scale-calculator/scale-calculator.model/i18n/en.json b/Java/model/scale-calculator/scale-calculator.model/i18n/en.json new file mode 100644 index 0000000..ed7d13d --- /dev/null +++ b/Java/model/scale-calculator/scale-calculator.model/i18n/en.json @@ -0,0 +1,106 @@ +{ + "app.title": "Scale Calculator", + "app.subtitle": "Turn map-distance ÷ real-distance into a ruler you can drag and measure", + "mode.real": "Find real distance", + "mode.map": "Find map distance", + "mode.scale": "Find scale", + "mode.hint": "Pick what to solve; the blue card is the answer", + "input.title": "Given", + "input.map": "Map distance", + "input.real": "Real distance", + "input.scale": "Scale denominator N", + "input.nPrefix": "1 :", + "input.unit": "Unit", + "input.reset": "Reset", + "input.presets": "Common scales", + "input.dragHint": "Drag the slider or type a number — everything updates live", + "result.title": "Result", + "result.real": "Real distance", + "result.map": "Map distance", + "result.scale": "Scale", + "result.formula": "Formula", + "forms.title": "Three ways to write a scale", + "forms.digital": "Numeric", + "forms.verbal": "Verbal", + "forms.segment": "Graphic (bar)", + "forms.verbalTpl": "1 cm on the map = {0} on the ground", + "forms.segmentDesc": "Each division {0}, {1} divisions", + "steps.title": "Worked solution", + "steps.show": "Show steps", + "steps.hide": "Hide steps", + "steps.1.unify": "① Unify units: convert the real distance to cm (1 km = 100000 cm)", + "steps.2.formulaReal": "② Real distance = map distance × scale denominator", + "steps.2.formulaMap": "② Map distance = real distance ÷ scale denominator", + "steps.2.formulaScale": "② Scale denominator = real distance ÷ map distance", + "steps.3.substitute": "③ Substitute: {0}", + "steps.4.result": "④ Result: {0}", + "steps.5.convert": "⑤ Convert to a sensible unit (cm → m → km)", + "grade.title": "Large / small scale", + "grade.large": "Large scale", + "grade.medium": "Medium scale", + "grade.small": "Small scale", + "grade.largeNote": "Small area · detailed · e.g. campus plan", + "grade.mediumNote": "Medium area · e.g. city map", + "grade.smallNote": "Large area · simplified · e.g. world map", + "grade.rule": "Bigger denominator → smaller scale → larger area → less detail", + "pit.title": "Common mistakes", + "pit.1": "① Forgetting to unify units: km ×100000 = cm", + "pit.2": "② \"Zoom 2×\" means denominator ÷ 2, not × 2", + "pit.3": "③ Don't swap map distance and real distance", + "field.title": "Real-world ruler · how long on the map", + "field.hint": "Pick a real distance and change the scale to see its map length", + "field.mapLength": "On map {0}", + "field.tooLong": "too long", + "field.tooShort": "barely visible", + "quiz.title": "Practice", + "quiz.promptReal": "Scale 1:{0}, map distance {1} cm — what is the real distance? (enter the number in the shown unit)", + "quiz.promptMap": "Scale 1:{0}, real distance {1} — what is the map distance in cm?", + "quiz.promptScale": "{0} cm on the map = {1} on the ground — what is the scale denominator?", + "quiz.answer": "Your answer", + "quiz.check": "Check", + "quiz.next": "Next", + "quiz.correct": "✓ Correct!", + "quiz.wrong": "✗ Try again — read the steps", + "quiz.streak": "{0} in a row", + "quiz.showSteps": "Show solution", + "quiz.unit": "Unit: {0}", + "ruler.title": "Visual ruler", + "ruler.mapBar": "Map distance (real cm)", + "ruler.realBar": "Real distance (compressed by the same scale)", + "ruler.sameWidth": "same width as above", + "ruler.equals": "equals", + "ruler.segment": "Graphic scale", + "ruler.segmentHint": "auto-ranging ticks", + "ruler.spectrum": "Scale spectrum", + "ruler.scopeUp": "◀ larger area", + "ruler.detailDown": "more detail ▶", + "ruler.hint": "Blue is the real map length; green is the same real distance compressed by the scale", + "ruler.overflowMap": "This map distance overflows the sheet — use a smaller scale", + "ruler.overflowReal": "This real distance won't fit at this scale — use a smaller scale", + "unit.cm": "cm", + "unit.m": "m", + "unit.km": "km", + "unit.none": "(unitless)", + "spec.campus": "Campus", + "spec.city": "City", + "spec.china": "China", + "spec.world": "World", + "preset.campus": "Campus 1:10k", + "preset.campusNote": "Buildings clearly drawn", + "preset.town": "Town 1:50k", + "preset.townNote": "Villages and roads", + "preset.city": "City 1:250k", + "preset.cityNote": "Urban area and arterials", + "preset.province": "Province 1:1M", + "preset.provinceNote": "Cities and rivers", + "preset.china": "China 1:10M", + "preset.chinaNote": "Province outlines", + "preset.world": "World 1:100M", + "preset.worldNote": "Continents & oceans", + "lm.classroom": "Classroom 10 m", + "lm.track": "Running track 400 m", + "lm.marathon": "Marathon 42.195 km", + "lm.beijingShanghai": "Beijing–Shanghai 1080 km", + "lm.equator": "Equator 40,000 km", + "common.footer": "Scale = map distance ÷ real distance · unify units first · bigger denominator = smaller scale" +} diff --git a/Java/model/scale-calculator/scale-calculator.model/i18n/zh-CN.json b/Java/model/scale-calculator/scale-calculator.model/i18n/zh-CN.json new file mode 100644 index 0000000..f12a9d7 --- /dev/null +++ b/Java/model/scale-calculator/scale-calculator.model/i18n/zh-CN.json @@ -0,0 +1,106 @@ +{ + "app.title": "比例尺计算器", + "app.subtitle": "把「图上距离 ÷ 实地距离」变成可以拖、可以量的可视化标尺", + "mode.real": "求实地距离", + "mode.map": "求图上距离", + "mode.scale": "求比例尺", + "mode.hint": "选择要求什么,蓝色结果卡就是答案", + "input.title": "已知量", + "input.map": "图上距离", + "input.real": "实地距离", + "input.scale": "比例尺分母 N", + "input.nPrefix": "1 :", + "input.unit": "单位", + "input.reset": "重置", + "input.presets": "常用比例尺", + "input.dragHint": "拖动滑块或直接输入数字,读数实时联动", + "result.title": "计算结果", + "result.real": "实地距离", + "result.map": "图上距离", + "result.scale": "比例尺", + "result.formula": "计算公式", + "forms.title": "比例尺的三种写法", + "forms.digital": "数字式", + "forms.verbal": "文字式", + "forms.segment": "线段式", + "forms.verbalTpl": "图上 1 厘米代表实地 {0}", + "forms.segmentDesc": "每格 {0},共 {1} 格", + "steps.title": "解题步骤", + "steps.show": "展开步骤", + "steps.hide": "收起步骤", + "steps.1.unify": "① 统一单位:把实地距离化成厘米(1 km = 100000 cm,去掉 5 个 0)", + "steps.2.formulaReal": "② 实地距离 = 图上距离 × 比例尺分母", + "steps.2.formulaMap": "② 图上距离 = 实地距离 ÷ 比例尺分母", + "steps.2.formulaScale": "② 比例尺分母 = 实地距离 ÷ 图上距离", + "steps.3.substitute": "③ 代入数值:{0}", + "steps.4.result": "④ 算出结果:{0}", + "steps.5.convert": "⑤ 换算成合适单位(cm → m → km)", + "grade.title": "大小判读", + "grade.large": "大比例尺", + "grade.medium": "中比例尺", + "grade.small": "小比例尺", + "grade.largeNote": "范围小 · 内容详细 · 如校园平面图", + "grade.mediumNote": "范围中等 · 如城市交通图", + "grade.smallNote": "范围大 · 内容简略 · 如世界地图", + "grade.rule": "分母越大 → 比例尺越小 → 范围越大 → 越简略", + "pit.title": "易错点", + "pit.1": "① 忘记统一单位:km 要 ×100000 才成 cm", + "pit.2": "② 「放大 2 倍」是分母 ÷ 2,不是 × 2", + "pit.3": "③ 图上距离与实地距离别代反了", + "field.title": "实地尺 · 这段距离画到图上多长", + "field.hint": "选一个真实距离,改变比例尺看它在图上的长度", + "field.mapLength": "图上 {0}", + "field.tooLong": "画不下", + "field.tooShort": "几乎看不见", + "quiz.title": "练习闯关", + "quiz.promptReal": "比例尺 1:{0},图上 {1} 厘米,实地距离是多少?(按提示单位填数字)", + "quiz.promptMap": "比例尺 1:{0},实地 {1},图上距离是多少厘米?", + "quiz.promptScale": "图上 {0} 厘米代表实地 {1},比例尺分母是多少?", + "quiz.answer": "输入答案", + "quiz.check": "检查", + "quiz.next": "下一题", + "quiz.correct": "✓ 答对了!", + "quiz.wrong": "✗ 再想想,看看解题步骤", + "quiz.streak": "连对 {0} 题", + "quiz.showSteps": "查看解题步骤", + "quiz.unit": "单位:{0}", + "ruler.title": "可视化标尺", + "ruler.mapBar": "图上距离(真实厘米)", + "ruler.realBar": "实地距离(按同一比例尺压缩)", + "ruler.sameWidth": "与上方同宽", + "ruler.equals": "等于", + "ruler.segment": "线段式比例尺", + "ruler.segmentHint": "刻度自动换挡", + "ruler.spectrum": "比例尺光谱", + "ruler.scopeUp": "◀ 范围越大", + "ruler.detailDown": "内容越详细 ▶", + "ruler.hint": "蓝色是图上真实长度;绿色是同一段实地按比例尺压缩后的长度", + "ruler.overflowMap": "这段图上距离超出图幅,需要更小的比例尺", + "ruler.overflowReal": "这段实地距离在该比例尺下画不下,需要更小的比例尺", + "unit.cm": "厘米", + "unit.m": "米", + "unit.km": "千米", + "unit.none": "(无单位)", + "spec.campus": "校园", + "spec.city": "城市", + "spec.china": "中国", + "spec.world": "世界", + "preset.campus": "校园 1:1万", + "preset.campusNote": "操场、教学楼都画得清", + "preset.town": "乡镇 1:5万", + "preset.townNote": "村镇与道路", + "preset.city": "城市 1:25万", + "preset.cityNote": "城区与主干道", + "preset.province": "省区 1:100万", + "preset.provinceNote": "地级市与河流", + "preset.china": "中国 1:1000万", + "preset.chinaNote": "省级轮廓", + "preset.world": "世界 1:1亿", + "preset.worldNote": "大洲大洋", + "lm.classroom": "教室 10 m", + "lm.track": "操场一圈 400 m", + "lm.marathon": "马拉松 42.195 km", + "lm.beijingShanghai": "北京—上海 1080 km", + "lm.equator": "赤道 4 万 km", + "common.footer": "比例尺 = 图上距离 ÷ 实地距离 · 单位统一是第一步 · 分母越大,比例尺越小" +} diff --git a/Java/model/scale-calculator/scale-calculator.model/preview.png b/Java/model/scale-calculator/scale-calculator.model/preview.png new file mode 100644 index 0000000..b4075bb Binary files /dev/null and b/Java/model/scale-calculator/scale-calculator.model/preview.png differ diff --git a/Java/model/scale-calculator/scale-calculator.model/scales.json b/Java/model/scale-calculator/scale-calculator.model/scales.json new file mode 100644 index 0000000..aa23424 --- /dev/null +++ b/Java/model/scale-calculator/scale-calculator.model/scales.json @@ -0,0 +1,23 @@ +{ + "presets": [ + { "n": 10000, "nameKey": "preset.campus", "noteKey": "preset.campusNote" }, + { "n": 50000, "nameKey": "preset.town", "noteKey": "preset.townNote" }, + { "n": 250000, "nameKey": "preset.city", "noteKey": "preset.cityNote" }, + { "n": 1000000, "nameKey": "preset.province", "noteKey": "preset.provinceNote" }, + { "n": 10000000, "nameKey": "preset.china", "noteKey": "preset.chinaNote" }, + { "n": 100000000, "nameKey": "preset.world", "noteKey": "preset.worldNote" } + ], + "spectrum": [ + { "n": 10000, "labelKey": "spec.campus", "scopeKey": "spec.campusScope" }, + { "n": 250000, "labelKey": "spec.city", "scopeKey": "spec.cityScope" }, + { "n": 10000000, "labelKey": "spec.china", "scopeKey": "spec.chinaScope" }, + { "n": 100000000, "labelKey": "spec.world", "scopeKey": "spec.worldScope" } + ], + "landmarks": [ + { "nameKey": "lm.classroom", "meters": 10 }, + { "nameKey": "lm.track", "meters": 400 }, + { "nameKey": "lm.marathon", "meters": 42195 }, + { "nameKey": "lm.beijingShanghai", "meters": 1080000 }, + { "nameKey": "lm.equator", "meters": 40000000 } + ] +} diff --git a/Java/model/version.json b/Java/model/version.json new file mode 100644 index 0000000..c037f31 --- /dev/null +++ b/Java/model/version.json @@ -0,0 +1,101 @@ +{ + "schema": 1, + "generated": "2026-11-19T10:20:00Z", + "repository": "https://git.xhmcl.com/Morris/GC", + "branch": "main", + "modelDir": "model", + "launcher": { + "version": "1.1.1", + "revision": "", + "packages": { + "win-x64": { + "path": "dist/win-amd64/GCL-1.1.1-win-amd64.zip", + "dir": "dist/win-amd64", + "name": "GCL-1.1.1-win-amd64.zip", + "url": "https://git.xhmcl.com/Morris/GC/releases/download/1.1.1/GCL-1.1.1-win-amd64.zip", + "sha256": "a03532606121280a1553ea73e56d6f9e8cc6cd9eefaf49f8c62857733199c10f", + "size": 74993562 + }, + "win-arm64": { + "path": "dist/win-arm64/GCL-1.1.1-win-arm64.zip", + "dir": "dist/win-arm64", + "name": "GCL-1.1.1-win-arm64.zip", + "url": "https://git.xhmcl.com/Morris/GC/releases/download/1.1.1/GCL-1.1.1-win-arm64.zip", + "sha256": "0cd3e045fbc2415bb170e545bb720841eb4c5ebc01a98e03105618a2b7bace46", + "size": 72535103 + }, + "osx-arm64": { + "path": "dist/mac-arm64/GCL-1.1.1-mac-arm64.zip", + "dir": "dist/mac-arm64", + "name": "GCL-1.1.1-mac-arm64.zip", + "url": "https://git.xhmcl.com/Morris/GC/releases/download/1.1.1/GCL-1.1.1-mac-arm64.zip" + }, + "osx-x64": { + "path": "dist/mac-x64/GCL-1.1.1-mac-x64.zip", + "dir": "dist/mac-x64", + "name": "GCL-1.1.1-mac-x64.zip", + "url": "https://git.xhmcl.com/Morris/GC/releases/download/1.1.1/GCL-1.1.1-mac-x64.zip" + }, + "linux-arm64": { + "path": "dist/linux-arm64/GCL-1.1.1-linux-arm64.zip", + "dir": "dist/linux-arm64", + "name": "GCL-1.1.1-linux-arm64.zip", + "url": "https://git.xhmcl.com/Morris/GC/releases/download/1.1.1/GCL-1.1.1-linux-arm64.zip" + } + } + }, + "models": [ + { + "id": "contour-map", + "version": "1.1", + "build": "773ab2161d", + "manifestSha256": "ac3231d55175757b4c477ad6a3c398c041db9511061f0c650d2c10efca881103", + "filesSha256": "a6bdf9b4273aabee50c3c94ceab4d0abee15f0df1af90c58bdbb796e0d2d5699", + "files": 5, + "dir": "model/contour-map" + }, + { + "id": "earth-geography", + "version": "1.9", + "build": "cc68b8863b", + "manifestSha256": "f69ceb758c643701480af441da26dfa64e190c9e583073deba211bac3e2a6e1a", + "filesSha256": "c018ba481831e23d3183a38ac47251f19754c7464baa5d85b47cea7a49fcfa95", + "files": 11, + "dir": "model/earth-geography" + }, + { + "id": "earth-revolution", + "version": "1.7", + "build": "53b7a0fbc3", + "manifestSha256": "ab257669cd2bc57289d7e86b361064034d6040e85603b65069a93aec8d457b0b", + "filesSha256": "4cd45b0324a77574a0da3a939c2a6faebc785c5a24cb50136d62a78a6ea2e9b1", + "files": 7, + "dir": "model/earth-revolution" + }, + { + "id": "earth-rotation", + "version": "1.7", + "build": "ecd52665f9", + "manifestSha256": "d463d85e08fd7f0525f8e08a5e9ec49c0005b3d8ca97a7f9497e95bdbb0697cb", + "filesSha256": "594b005a6a9f36cd0b5d4e4a7a0b1ab42d53c8032832545b71c3915493d56c8e", + "files": 7, + "dir": "model/earth-rotation" + }, + { + "id": "scale-calculator", + "version": "1.6", + "build": "105653737d", + "manifestSha256": "2ac714eafb9acb4e4f11567b61848441de0f65ac41eb4260bc2d868c9500f56d", + "filesSha256": "732dd26406e0f1e836970499d7ea644def332ce909d7f8aa0a403bbe7337e604", + "files": 6, + "dir": "model/scale-calculator" + } + ], + "signature": { + "alg": "ECDSA-P256-SHA256", + "keyId": "gc-2026-12", + "value": "U6j86/9PIUe5ZIqLRUlSIFf6EhODc7Dar1KvL7MecYujzNJ+ZnRrUg7aUT1rvktVwz4nyRacf9RYM2JQFb+qKw==", + "contentSha256": "585f22236fa1a50d4e99581c676b8ad694c5e352b12fe1bfed30c342b1f38690", + "signedAt": "2026-11-19T10:21:32Z" + } +} diff --git a/Java/run.bat b/Java/run.bat new file mode 100644 index 0000000..68c097a --- /dev/null +++ b/Java/run.bat @@ -0,0 +1,16 @@ +@echo off +setlocal +cd /d "%~dp0" +if exist "build\install\gc-java\bin\gc-java.bat" ( + call "build\install\gc-java\bin\gc-java.bat" %* + exit /b %errorlevel% +) +if exist "lib\gc-java-2.0.0.jar" ( + java -cp "lib\gc-java-2.0.0.jar" com.gc.Main %* + exit /b %errorlevel% +) +if exist "build\libs\gc-java-2.0.0.jar" ( + java -cp "build\libs\gc-java-2.0.0.jar" com.gc.Main %* + exit /b %errorlevel% +) +call gradlew.bat run --args="%*" diff --git a/Java/run.sh b/Java/run.sh new file mode 100755 index 0000000..f6de21e --- /dev/null +++ b/Java/run.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# GC Java Launcher 启动脚本:优先使用已构建的发行目录,否则用 Gradle 直接运行。 +set -e +DIR=$(cd "$(dirname "$0")" && pwd) +cd "$DIR" +if [ -x "$DIR/build/install/gc-java/bin/gc-java" ]; then + exec "$DIR/build/install/gc-java/bin/gc-java" "$@" +fi +if [ -f "$DIR/lib/gc-java-2.0.0.jar" ]; then + exec java ${JAVA_OPTS:-} -cp "$DIR/lib/gc-java-2.0.0.jar" com.gc.Main "$@" +fi +if [ -f "$DIR/build/libs/gc-java-2.0.0.jar" ]; then + exec java ${JAVA_OPTS:-} -cp "$DIR/build/libs/gc-java-2.0.0.jar" com.gc.Main "$@" +fi +exec ./gradlew run --args="$*" diff --git a/Java/settings.gradle.kts b/Java/settings.gradle.kts new file mode 100644 index 0000000..1db15a5 --- /dev/null +++ b/Java/settings.gradle.kts @@ -0,0 +1 @@ +rootProject.name = "gc-java" diff --git a/Java/src/main/java/com/gc/Main.java b/Java/src/main/java/com/gc/Main.java new file mode 100644 index 0000000..f1139f7 --- /dev/null +++ b/Java/src/main/java/com/gc/Main.java @@ -0,0 +1,38 @@ +package com.gc; + +import com.gc.core.*; + +import java.awt.GraphicsEnvironment; + +/** 单进程入口:无参数启动 GUI,其余走统一 CLI。 */ +public final class Main { + public static void main(String[] args) { + AppPaths paths = AppPaths.discover(); + paths.ensureCreated(); + Settings settings = Settings.load(paths.settingsFile()); + Log.init(paths.logsRoot()); + I18n.load(settings.language); + Security.writeHealth(paths.updateRoot(), settings.launcherVersion); + + // 环境变量可注入受信任公钥(测试 / 私有构建) + String trusted = System.getenv("GC_TRUSTED_KEYS"); + if (trusted != null && !trusted.isBlank()) { + for (String part : trusted.split(";")) { + int idx = part.indexOf(':'); + if (idx > 0 && idx < part.length() - 1) + Security.addKey(part.substring(0, idx).trim(), part.substring(idx + 1).trim()); + } + } + + if (args.length == 0) { + if (GraphicsEnvironment.isHeadless()) { + Cli.help(); + return; + } + com.gc.ui.MainWindow.launch(paths, settings); + return; + } + int code = Cli.run(args, paths, settings); + if (code != 0) System.exit(code); + } +} diff --git a/Java/src/main/java/com/gc/core/AppPaths.java b/Java/src/main/java/com/gc/core/AppPaths.java new file mode 100644 index 0000000..c29e8e4 --- /dev/null +++ b/Java/src/main/java/com/gc/core/AppPaths.java @@ -0,0 +1,256 @@ +package com.gc.core; + +import java.io.IOException; +import java.net.URISyntaxException; +import java.nio.file.*; +import java.util.Comparator; + +/** + * 运行目录:安装目录旁 .GC/{bin,config,model,cache,update,safedog,logs}。 + * 开发态自动使用项目根 model/ 并同步到 .GC/model。 + */ +public final class AppPaths { + public final Path appRoot; + public final Path installDir; + public final Path homeRoot; + public final Path modelRoot; + public final boolean development; + public final boolean portableModelRoot; + private volatile Thread syncThread; + + private AppPaths(Path appRoot, Path installDir, Path homeRoot, Path modelRoot, + boolean development, boolean portableModelRoot) { + this.appRoot = appRoot; + this.installDir = installDir; + this.homeRoot = homeRoot; + this.modelRoot = modelRoot; + this.development = development; + this.portableModelRoot = portableModelRoot; + } + + public static AppPaths discover() { + Path cwd = Paths.get(System.getProperty("user.dir")).toAbsolutePath().normalize(); + Path explicitHome = envPath("EMS_HOME"); + Path repo = explicitHome != null && Files.isDirectory(explicitHome) ? explicitHome : findRepoRoot(cwd); + boolean dev = repo != null; + + Path install; + if (dev) install = repo; + else if (explicitHome != null && Files.isDirectory(explicitHome)) install = explicitHome; + else { + install = cwd; + // 发行目录:/{bin,lib,model,run.sh},从 bin 脚本启动时 cwd 就是根目录 + if (Files.isDirectory(cwd.resolve("lib")) && Files.isDirectory(cwd.resolve("bin"))) { + install = cwd; + } else { + try { + Path code = Paths.get(AppPaths.class.getProtectionDomain().getCodeSource().getLocation().toURI()); + if (Files.isRegularFile(code)) code = code.getParent(); + if (code != null) { + String s = code.toString().replace('\\', '/'); + if (s.contains(".app/Contents/")) { + Path p = code; + while (p != null && !p.getFileName().toString().endsWith(".app")) p = p.getParent(); + if (p != null && p.getParent() != null) install = p.getParent(); + } else if (code.getFileName() != null && code.getFileName().toString().equals("lib") + && code.getParent() != null) { + install = code.getParent(); + } else install = code; + } + } catch (URISyntaxException | RuntimeException ignored) { } + } + } + + Path explicitData = envPath("EMS_DATA"); + Path home; + if (explicitData != null) home = explicitData; + else { + Path portable = install.resolve(".GC"); + home = canWrite(portable) ? portable + : Paths.get(System.getProperty("user.home"), "Library", "Application Support", "GC", ".GC"); + } + + Path envModels = envPath("EMS_MODELS"); + Path modelRoot = envModels != null ? envModels : home.resolve("model"); + return new AppPaths(install, install, home, modelRoot, dev, envModels == null); + } + + private static Path envPath(String key) { + String v = System.getenv(key); + return v == null || v.isBlank() ? null : Paths.get(v).toAbsolutePath().normalize(); + } + + private static Path findRepoRoot(Path start) { + Path dir = start; + for (int i = 0; i < 10 && dir != null; i++, dir = dir.getParent()) { + if (dir.getFileName() != null && dir.getFileName().toString().equalsIgnoreCase("dist")) return null; + if (Files.exists(dir.resolve("settings.gradle.kts")) && Files.isDirectory(dir.resolve("src/main/java/com/gc"))) + return dir; + // 兼容从仓库根启动 + if (Files.exists(dir.resolve("Java/settings.gradle.kts")) && Files.isDirectory(dir.resolve("Java/src/main/java/com/gc"))) + return dir.resolve("Java"); + } + return null; + } + + public static boolean canWrite(Path dir) { + try { + Files.createDirectories(dir); + Path probe = dir.resolve(".write-test"); + Files.writeString(probe, "ok"); + Files.deleteIfExists(probe); + return true; + } catch (Exception e) { return false; } + } + + public Path configRoot() { return homeRoot.resolve("config"); } + public Path cacheRoot() { return homeRoot.resolve("cache"); } + public Path updateRoot() { return homeRoot.resolve("update"); } + public Path logsRoot() { return homeRoot.resolve("logs"); } + public Path safedogRoot() { return homeRoot.resolve("safedog"); } + public Path binRoot() { return homeRoot.resolve("bin"); } + public Path settingsFile() { return configRoot().resolve("settings.json"); } + + /** 查找原始 HTML 课件目录(开发态、发行目录与仓库内 C# 前端均可)。 */ + public Path coursewareRoot() { + String override = System.getProperty("gc.courseware", ""); + java.util.List candidates = new java.util.ArrayList<>(); + if (!override.isBlank()) candidates.add(Path.of(override)); + candidates.add(appRoot.resolve("courseware")); + candidates.add(installDir.resolve("courseware")); + candidates.add(java.nio.file.Paths.get(System.getProperty("user.dir", ".")).resolve("courseware")); + candidates.add(appRoot.resolve("../C#/GC-UI/frontend/courseware").normalize()); + candidates.add(appRoot.resolve("../../C#/GC-UI/frontend/courseware").normalize()); + for (Path p : candidates) { + try { + if (p != null && Files.isRegularFile(p.resolve("index.html"))) return p.toAbsolutePath().normalize(); + } catch (Exception ignored) { } + } + return null; + } + + public void ensureCreated() { + try { + for (Path p : new Path[]{homeRoot, configRoot(), cacheRoot(), modelRoot, updateRoot(), logsRoot(), safedogRoot(), binRoot()}) + Files.createDirectories(p); + Path legacy = homeRoot.resolve("settings.json"); + if (Files.exists(legacy) && !Files.exists(settingsFile())) { + Files.createDirectories(configRoot()); + Files.move(legacy, settingsFile(), StandardCopyOption.REPLACE_EXISTING); + } + } catch (IOException e) { + System.err.println("[paths] 初始化目录失败: " + e.getMessage()); + } + seedBundledModels(); + if (development && portableModelRoot && envPath("EMS_MODELS") == null) { + Path source = appRoot.resolve("model"); + if (Files.isDirectory(source)) { + syncThread = new Thread(() -> syncDevelopmentModels(modelRoot, source), "gc-model-sync"); + syncThread.setDaemon(true); + syncThread.start(); + } + } + } + + /** 发行版把 model/ 放在主程序旁:首次启动时复制到 .GC/model,开箱即用。 */ + private void seedBundledModels() { + try { + Path source = appRoot.resolve("model"); + if (!Files.isDirectory(source)) return; + try (DirectoryStream ds = Files.newDirectoryStream(source)) { + for (Path dir : ds) { + if (!Files.isDirectory(dir)) continue; + String id = dir.getFileName().toString(); + if (id.startsWith("_") || id.startsWith(".")) continue; + Path manifest = dir.resolve(id + ".json"); + if (!Files.isRegularFile(manifest)) continue; + Path dest = modelRoot.resolve(id); + if (Files.isRegularFile(dest.resolve(id + ".json"))) continue; + Files.createDirectories(dest); + Files.copy(manifest, dest.resolve(id + ".json")); + Path data = dir.resolve(id + ".model"); + if (Files.isDirectory(data)) copyTree(data, dest.resolve(id + ".model")); + } + } + } catch (Exception e) { + System.err.println("[paths] 初始化内置模型失败: " + e.getMessage()); + } + } + + public void waitForDevelopmentModels() { + Thread t = syncThread; + if (t != null) try { t.join(15000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } + } + + private static void syncDevelopmentModels(Path modelRoot, Path source) { + try (DirectoryStream ds = Files.newDirectoryStream(source)) { + for (Path dir : ds) { + String id = dir.getFileName().toString(); + if (id.startsWith("_")) continue; + Path manifest = dir.resolve(id + ".json"); + Path data = dir.resolve(id + ".model"); + if (!Files.isRegularFile(manifest) || !Files.isDirectory(data)) continue; + Path dest = modelRoot.resolve(id); + Files.createDirectories(dest); + Files.copy(manifest, dest.resolve(id + ".json"), StandardCopyOption.REPLACE_EXISTING); + copyTree(data, dest.resolve(id + ".model")); + } + } catch (Exception e) { + System.err.println("[paths] 同步开发模型失败: " + e.getMessage()); + } + } + + public static void copyTree(Path src, Path dst) throws IOException { + Files.createDirectories(dst); + try (var walk = Files.walk(src)) { + for (Path p : walk.toList()) { + if (p.equals(src)) continue; + String name = p.getFileName().toString(); + if (name.startsWith(".")) continue; + Path target = dst.resolve(src.relativize(p).toString()); + if (Files.isDirectory(p)) Files.createDirectories(target); + else { + Files.createDirectories(target.getParent()); + Files.copy(p, target, StandardCopyOption.REPLACE_EXISTING); + } + } + } + } + + public static void deleteTree(Path root) { + if (!Files.exists(root)) return; + try (var walk = Files.walk(root)) { + walk.sorted(Comparator.reverseOrder()).forEach(p -> { + try { Files.deleteIfExists(p); } catch (IOException ignored) { } + }); + } catch (IOException ignored) { } + } + + public enum Platform { WIN_X64, WIN_ARM64, OSX_X64, OSX_ARM64, LINUX_X64, LINUX_ARM64 } + + public static Platform platform() { + String os = System.getProperty("os.name").toLowerCase(); + String arch = System.getProperty("os.arch").toLowerCase(); + boolean arm = arch.contains("aarch64") || arch.contains("arm64"); + if (os.contains("win")) return arm ? Platform.WIN_ARM64 : Platform.WIN_X64; + if (os.contains("mac")) return arm ? Platform.OSX_ARM64 : Platform.OSX_X64; + return arm ? Platform.LINUX_ARM64 : Platform.LINUX_X64; + } + + public static String rid() { + return switch (platform()) { + case WIN_X64 -> "win-x64"; + case WIN_ARM64 -> "win-arm64"; + case OSX_X64 -> "osx-x64"; + case OSX_ARM64 -> "osx-arm64"; + case LINUX_X64 -> "linux-x64"; + case LINUX_ARM64 -> "linux-arm64"; + }; + } + + public static String displayPlatform() { + String os = System.getProperty("os.name"); + String arch = System.getProperty("os.arch"); + return os + " / " + arch + " (" + rid() + ")"; + } +} diff --git a/Java/src/main/java/com/gc/core/BuiltinModels.java b/Java/src/main/java/com/gc/core/BuiltinModels.java new file mode 100644 index 0000000..0653d42 --- /dev/null +++ b/Java/src/main/java/com/gc/core/BuiltinModels.java @@ -0,0 +1,21 @@ +package com.gc.core; + +import java.util.List; +import java.util.Map; + +/** Java 版内置的 5 个模型渲染器(原 C# dll 无法在 JVM 中加载)。 */ +public final class BuiltinModels { + private BuiltinModels() {} + + public static final List IDS = List.of( + "earth-rotation", "earth-revolution", "earth-geography", "contour-map", "scale-calculator"); + + public static final Map FACTORY = Map.of( + "earth-rotation", "com.gc.model.earth.RotationModel", + "earth-revolution", "com.gc.model.earth.RevolutionModel", + "earth-geography", "com.gc.model.earth.GeographyModel", + "contour-map", "com.gc.model.contour.ContourModel", + "scale-calculator", "com.gc.model.scale.ScaleCalculatorModel"); + + public static boolean supports(String id) { return IDS.contains(id); } +} diff --git a/Java/src/main/java/com/gc/core/Cli.java b/Java/src/main/java/com/gc/core/Cli.java new file mode 100644 index 0000000..738e275 --- /dev/null +++ b/Java/src/main/java/com/gc/core/Cli.java @@ -0,0 +1,141 @@ +package com.gc.core; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import java.util.Locale; + +/** 统一 CLI:核心工具 + 模型算法 + 更新守护。 */ +public final class Cli { + private Cli() {} + + public static int run(String[] args, AppPaths paths, Settings settings) { + if (args.length == 0) { help(); return 0; } + try { + switch (args[0]) { + case "help", "--help", "-h" -> { help(); return 0; } + case "version", "--version" -> { System.out.println("GC Java 2.0.0"); return 0; } + case "hash-file" -> { + System.out.println(Hash.file(Path.of(args[1]))); + return 0; + } + case "hash-dir" -> { + System.out.println(Hash.dir(Path.of(args[1]))); + return 0; + } + case "canonical" -> { + String text = args.length > 1 && !args[1].equals("-") + ? Files.readString(Path.of(args[1]), StandardCharsets.UTF_8) : readStdin(); + String c = Json.canonical(text); + if (c == null) { System.out.println("ERROR 无法解析 JSON"); return 2; } + System.out.println(c); + return 0; + } + case "version-normalize" -> { System.out.println(VersionUtil.normalize(args[1])); return 0; } + case "version-compare" -> { System.out.println(VersionUtil.compare(args[1], args[2])); return 0; } + case "paths" -> { + Path root = args.length > 1 ? Path.of(args[1]).toAbsolutePath() : paths.homeRoot; + printPaths(root); + return 0; + } + case "settings-default" -> { System.out.println(Settings.defaultJson()); return 0; } + case "model-scan" -> { + Path root = args.length > 1 ? Path.of(args[1]) : paths.modelRoot; + for (ModelManifest.Package p : ModelManifest.scan(root).models) + System.out.printf(Locale.ROOT, "%s\t%s\t%s\t%d\t%s%n", + p.id(), p.manifest.version, p.manifest.localizedName(), p.sizeBytes, p.directory); + return 0; + } + case "safezip-name" -> { System.out.println(Security.safeZipName(args[1])); return 0; } + case "human-size" -> { System.out.println(Hash.humanSize(Long.parseLong(args[1]))); return 0; } + case "selftest" -> { return Selftest.run(); } + case "model" -> { + return ModelCommands.run(java.util.Arrays.copyOfRange(args, 1, args.length)); + } + case "update-check" -> { + UpdateService.Result r = new UpdateService(paths, settings).run(true, + p -> System.out.println("[" + Math.round(p.value() * 100) + "%] " + p.message() + " " + p.detail())); + System.out.println("outcome=" + r.outcome() + " message=" + r.message()); + if (r.error() != null) System.out.println("error=" + r.error()); + return r.outcome() == UpdateService.Outcome.UNAVAILABLE ? 2 : 0; + } + case "savedog" -> { return savedog(args, paths); } + case "gui" -> { + com.gc.ui.MainWindow.launch(paths, settings); + return 0; + } + case "gui-selftest" -> { + return com.gc.ui.UiSmoke.run(paths, Path.of("build/screenshots")); + } + default -> { help(); return 1; } + } + } catch (ArrayIndexOutOfBoundsException e) { + System.out.println("缺少参数,使用 help 查看用法"); + return 1; + } catch (Exception e) { + System.out.println("ERROR " + e.getMessage()); + return 2; + } + } + + private static int savedog(String[] a, AppPaths paths) { + Updater u = new Updater(paths); + if (a.length < 2) { + System.out.println("savedog verify | apply | status | keygen [dir] [keyId] | sign "); + return 1; + } + try { + return switch (a[1]) { + case "verify" -> u.verify(a[2]); + case "apply" -> u.apply(); + case "status" -> { u.status(); yield 0; } + case "keygen" -> u.keygen(Path.of(a.length > 2 ? a[2] : ".signing"), + a.length > 3 ? a[3] : "gc-2026-12"); + case "sign" -> u.sign(Path.of(a[2]), Path.of(a[3]), a[4]); + default -> { System.out.println("未知 savedog 命令"); yield 1; } + }; + } catch (Exception e) { + System.out.println("savedog 失败: " + e.getMessage()); + return 2; + } + } + + private static void printPaths(Path root) { + for (String p : new String[]{"bin", "config", "model", "cache", "update", "safedog", "logs"}) + System.out.println(root.resolve(p)); + System.out.println(root.resolve("config/settings.json")); + } + + private static String readStdin() throws Exception { + StringBuilder sb = new StringBuilder(); + try (BufferedReader r = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8))) { + String line; + while ((line = r.readLine()) != null) sb.append(line).append('\n'); + } + return sb.toString(); + } + + public static void help() { + System.out.println(""" + GC 天文教学模型启动器 · Java 版 2.0.0 + 用法: + gc 启动 HMCL 风格图形界面 + gc gui 显式启动图形界面 + gc selftest 运行全部内置断言 + gc hash-file SHA-256 + gc hash-dir 目录指纹 + gc canonical 规范化 JSON + gc version-normalize + gc version-compare + gc paths [root] 目录布局 + gc settings-default 默认设置 + gc model-scan [root] 扫描模型库 + gc safezip-name 安全路径检查 + gc human-size 人类可读体积 + gc update-check 检查模型 / 启动器更新 + gc savedog 更新守护(verify/apply/status/keygen/sign) + gc model <...> 5 个教学模型的算法命令(gc model 查看) + """); + } +} diff --git a/Java/src/main/java/com/gc/core/GiteaRemote.java b/Java/src/main/java/com/gc/core/GiteaRemote.java new file mode 100644 index 0000000..d7d5ff4 --- /dev/null +++ b/Java/src/main/java/com/gc/core/GiteaRemote.java @@ -0,0 +1,95 @@ +package com.gc.core; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** Gitea / GitHub 兼容的模型源。 */ +public final class GiteaRemote implements Remote { + private final SourcePreset preset; + private String rawText; + + public GiteaRemote(SourcePreset preset) { this.preset = preset; } + + @Override public String displayName() { return preset.name(); } + @Override public String sourceId() { return preset.id(); } + @Override public String rawManifestText() { return rawText; } + @Override public java.nio.file.Path localRoot() { return null; } + + @Override + public String rawUrl(String path) { return preset.rawUrl(path); } + + @Override + public RepoVersion manifest() throws Exception { + Exception last = null; + for (String path : new String[]{"version.json", "model/version.json"}) { + String url = preset.rawUrl(path); + try { + String text = Http.getString(url); + if (!text.trim().startsWith("{")) continue; + Security.Verification v = Security.verifyManifest(text, true); + RepoVersion ver = RepoVersion.parse(text); + ver.trust = v.trust().name(); + ver.keyId = v.keyId(); + ver.error = v.error(); + ver.trusted = v.trusted(); + rawText = text; + if (v.trust() == Security.Trust.INVALID) { + Log.warn("清单验签失败,已拒绝: " + v.error(), "Manifest signature verification failed: " + v.error()); + return null; + } + return ver; + } catch (Exception e) { last = e; } + } + if (last != null) throw last; + return null; + } + + private String contentsUrl(String path) { + String p = path.replaceAll("^/+|/+$", ""); + String head = p.isEmpty() ? preset.apiBase() + "/repos/" + preset.owner() + "/" + preset.repo() + "/contents" + : preset.apiBase() + "/repos/" + preset.owner() + "/" + preset.repo() + "/contents/" + p; + return preset.kind().equals("github") ? head + "?ref=" + preset.branch() : head; + } + + @Override + public List listTree(String rootPath) throws Exception { + List out = new ArrayList<>(); + walk(rootPath.replaceAll("^/+|/+$", ""), "", out, 0); + return out; + } + + private void walk(String apiPath, String relPrefix, List out, int depth) throws Exception { + if (depth > 8) return; + String json; + try { json = Http.getString(contentsUrl(apiPath)); } + catch (Exception e) { Log.warn("读取目录失败 " + apiPath + ": " + e.getMessage()); return; } + Object parsed; + try { parsed = Json.parse(json); } catch (Exception e) { return; } + List entries = parsed instanceof List ? Json.arr(parsed) : Json.list(parsed); + for (Object o : entries) { + Map e = Json.obj(o); + String name = Json.str(e, "name", ""); + String path = Json.str(e, "path", ""); + String type = Json.str(e, "type", "file"); + String rel = relPrefix.isEmpty() ? name : relPrefix + "/" + name; + boolean dir = type.equals("dir") || type.equals("directory"); + String download = Json.str(e, "download_url", ""); + if (download == null || download.isBlank() || download.equals("null")) + download = dir ? "" : preset.rawUrl(path); + long size = Json.l(e, "size", 0); + out.add(new RepoEntry(name, path, rel, dir, download, size)); + if (dir) walk(path, rel, out, depth + 1); + } + } + + @Override + public byte[] download(RepoEntry entry) throws Exception { + String url = entry.downloadUrl(); + if (url == null || url.isBlank()) url = preset.rawUrl(entry.path()); + return Http.getBytes(url); + } + + @Override + public byte[] downloadPackage(String url) throws Exception { return Http.getBytes(url); } +} diff --git a/Java/src/main/java/com/gc/core/Hash.java b/Java/src/main/java/com/gc/core/Hash.java new file mode 100644 index 0000000..9f16f4f --- /dev/null +++ b/Java/src/main/java/com/gc/core/Hash.java @@ -0,0 +1,86 @@ +package com.gc.core; + +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.HexFormat; +import java.util.List; +import java.util.Locale; +import java.util.stream.Stream; + +/** SHA-256 文件 / 目录指纹,算法与 C# ContentHash 完全一致。 */ +public final class Hash { + private Hash() {} + + public static String sha256(byte[] data) { + try { + MessageDigest md = MessageDigest.getInstance("SHA-256"); + return HexFormat.of().formatHex(md.digest(data)); + } catch (NoSuchAlgorithmException e) { throw new IllegalStateException(e); } + } + + public static String sha256(String text) { return sha256(text.getBytes(StandardCharsets.UTF_8)); } + + public static String file(Path path) throws IOException { + try (InputStream in = Files.newInputStream(path)) { + MessageDigest md = MessageDigest.getInstance("SHA-256"); + byte[] buf = new byte[16384]; + int n; + while ((n = in.read(buf)) > 0) md.update(buf, 0, n); + return HexFormat.of().formatHex(md.digest()); + } catch (NoSuchAlgorithmException e) { throw new IllegalStateException(e); } + } + + /** dirHash = SHA256(按相对路径 ordinal 升序 "\0\n")。 */ + public static String dir(Path root) throws IOException { + List entries = new ArrayList<>(); + try (Stream walk = Files.walk(root)) { + walk.filter(Files::isRegularFile).forEach(p -> { + String rel = root.relativize(p).toString().replace('\\', '/'); + if (skip(rel)) return; + try { + entries.add(rel + "\0" + file(p) + "\n"); + } catch (IOException e) { throw new RuntimeException(e); } + }); + } + entries.sort(String::compareTo); + StringBuilder sb = new StringBuilder(); + for (String e : entries) sb.append(e); + return sha256(sb.toString().getBytes(StandardCharsets.UTF_8)); + } + + /** 与 C# 一致:跳过 . 开头、bin/、obj/、*.user。 */ + public static boolean skip(String rel) { + for (String seg : rel.split("/")) { + if (seg.startsWith(".") || seg.equals("bin") || seg.equals("obj")) return true; + } + return rel.toLowerCase(Locale.ROOT).endsWith(".user"); + } + + /** 人类可读体积:1536 -> 1.5 KB。 */ + public static String humanSize(long bytes) { + String[] units = {"B", "KB", "MB", "GB", "TB"}; + double value = bytes; + int u = 0; + while (value >= 1024 && u < units.length - 1) { value /= 1024; u++; } + if (u == 0) return bytes + " B"; + String s = String.format(Locale.ROOT, "%.1f", value); + if (s.endsWith(".0")) s = s.substring(0, s.length() - 2); + return s + " " + units[u]; + } + + /** 目录体积(忽略异常)。 */ + public static long dirSize(Path root) { + if (!Files.isDirectory(root)) return 0; + try (Stream walk = Files.walk(root)) { + return walk.filter(Files::isRegularFile).mapToLong(p -> { + try { return Files.size(p); } catch (IOException e) { return 0; } + }).sum(); + } catch (IOException e) { return 0; } + } +} diff --git a/Java/src/main/java/com/gc/core/Http.java b/Java/src/main/java/com/gc/core/Http.java new file mode 100644 index 0000000..6fcbefa --- /dev/null +++ b/Java/src/main/java/com/gc/core/Http.java @@ -0,0 +1,54 @@ +package com.gc.core; + +import java.io.IOException; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.Map; + +/** 轻量 HTTP 客户端(跟随重定向、超时、UA)。 */ +public final class Http { + private static final HttpClient CLIENT = HttpClient.newBuilder() + .followRedirects(HttpClient.Redirect.ALWAYS) + .connectTimeout(Duration.ofSeconds(8)) + .build(); + + private Http() {} + + public static String getString(String url) throws IOException, InterruptedException { + HttpResponse r = CLIENT.send(request(url).GET().build(), + HttpResponse.BodyHandlers.ofString(StandardCharsets.UTF_8)); + if (r.statusCode() >= 400) throw new IOException("HTTP " + r.statusCode() + " " + url); + return r.body(); + } + + public static byte[] getBytes(String url) throws IOException, InterruptedException { + HttpResponse r = CLIENT.send(request(url).GET().build(), + HttpResponse.BodyHandlers.ofByteArray()); + if (r.statusCode() >= 400) throw new IOException("HTTP " + r.statusCode() + " " + url); + return r.body(); + } + + public static java.io.InputStream open(String url) throws IOException, InterruptedException { + HttpResponse r = CLIENT.send(request(url).GET().build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (r.statusCode() >= 400) throw new IOException("HTTP " + r.statusCode() + " " + url); + return r.body(); + } + + private static HttpRequest.Builder request(String url) { + return HttpRequest.newBuilder(URI.create(url)) + .timeout(Duration.ofSeconds(30)) + .header("User-Agent", "GC-Java/2.0 (Astronomy Model Launcher)") + .header("Accept", "application/json, application/octet-stream, */*"); + } + + public static String encode(String s) { + return java.net.URLEncoder.encode(s, StandardCharsets.UTF_8).replace("+", "%20"); + } + + public static Map noHeaders() { return Map.of(); } +} diff --git a/Java/src/main/java/com/gc/core/I18n.java b/Java/src/main/java/com/gc/core/I18n.java new file mode 100644 index 0000000..13863b5 --- /dev/null +++ b/Java/src/main/java/com/gc/core/I18n.java @@ -0,0 +1,58 @@ +package com.gc.core; + +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.util.LinkedHashMap; +import java.util.Locale; +import java.util.Map; + +/** 界面语言:auto / zh-CN / en,资源来自 resources/i18n。 */ +public final class I18n { + private static Map texts = new LinkedHashMap<>(); + private static Map fallback = new LinkedHashMap<>(); + private static String language = "zh-CN"; + + private I18n() {} + + public static void load(String setting) { + String resolved = resolve(setting); + fallback = read("/i18n/zh-CN.json"); + language = resolved; + if (resolved.equals("zh-CN")) texts = fallback; + else texts = read("/i18n/en.json"); + if (texts.isEmpty()) texts = fallback; + } + + public static String resolve(String setting) { + if (setting != null && !setting.equals("auto") && !setting.isBlank()) return setting; + String l = Locale.getDefault().getLanguage().toLowerCase(); + return l.startsWith("zh") ? "zh-CN" : "en"; + } + + public static String language() { return language; } + + public static String t(String key) { + String v = texts.get(key); + if (v != null) return v; + v = fallback.get(key); + return v != null ? v : key; + } + + public static String f(String key, Object... args) { + String s = t(key); + for (int i = 0; i < args.length; i++) s = s.replace("{" + i + "}", String.valueOf(args[i])); + return s; + } + + private static Map read(String resource) { + Map m = new LinkedHashMap<>(); + try (InputStream in = I18n.class.getResourceAsStream(resource)) { + if (in == null) return m; + String text = new String(in.readAllBytes(), StandardCharsets.UTF_8); + for (var e : Json.obj(Json.parse(text)).entrySet()) m.put(e.getKey(), String.valueOf(e.getValue())); + } catch (Exception e) { + System.err.println("[i18n] 读取 " + resource + " 失败: " + e.getMessage()); + } + return m; + } +} diff --git a/Java/src/main/java/com/gc/core/Json.java b/Java/src/main/java/com/gc/core/Json.java new file mode 100644 index 0000000..25fb52f --- /dev/null +++ b/Java/src/main/java/com/gc/core/Json.java @@ -0,0 +1,310 @@ +package com.gc.core; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +/** + * 零依赖 JSON 解析 / 序列化,并保留数字原始文本。 + * 规范化规则与 C# 原版一致:对象键按 Unicode 码点升序、无空白、非 ASCII 不转义、 + * 数字沿用源文本、签名时移除根级 signature。 + */ +public final class Json { + private Json() {} + + /** 保留原始字面量的数字。 */ + public record Num(String raw) { + public double asDouble() { return Double.parseDouble(raw); } + public long asLong() { return (long) asDouble(); } + public int asInt() { return (int) asDouble(); } + @Override public String toString() { return raw; } + } + + public static Object parse(String text) { + Parser p = new Parser(text); + p.skipWs(); + Object v = p.value(); + p.skipWs(); + if (!p.eof()) throw new IllegalArgumentException("JSON 末尾有多余内容: " + p.pos); + return v; + } + + public static Object parse(Path path) throws IOException { + return parse(Files.readString(path, StandardCharsets.UTF_8)); + } + + @SuppressWarnings("unchecked") + public static Map obj(Object o) { + return o instanceof Map ? (Map) o : new LinkedHashMap<>(); + } + + @SuppressWarnings("unchecked") + public static List arr(Object o) { + return o instanceof List ? (List) o : new ArrayList<>(); + } + + public static String str(Object o, String fallback) { + return o == null ? fallback : String.valueOf(o); + } + + public static String str(Map m, String key, String fallback) { + Object v = m.get(key); + return v == null ? fallback : String.valueOf(v); + } + + public static int i(Map m, String key, int fallback) { + Object v = m.get(key); + if (v instanceof Num n) return n.asInt(); + if (v instanceof Number n) return n.intValue(); + return fallback; + } + + public static long l(Map m, String key, long fallback) { + Object v = m.get(key); + if (v instanceof Num n) return n.asLong(); + if (v instanceof Number n) return n.longValue(); + return fallback; + } + + public static double d(Map m, String key, double fallback) { + Object v = m.get(key); + if (v instanceof Num n) return n.asDouble(); + if (v instanceof Number n) return n.doubleValue(); + return fallback; + } + + public static boolean b(Map m, String key, boolean fallback) { + Object v = m.get(key); + return v instanceof Boolean bool ? bool : fallback; + } + + public static Map map(Object... kv) { + Map m = new LinkedHashMap<>(); + for (int i = 0; i + 1 < kv.length; i += 2) m.put(String.valueOf(kv[i]), kv[i + 1]); + return m; + } + + public static List list(Object... values) { + List l = new ArrayList<>(); + for (Object v : values) l.add(v); + return l; + } + + public static String write(Object value) { return write(value, false, false); } + + public static String writePretty(Object value) { return write(value, true, false); } + + /** 规范化 JSON(移除根级 signature)。 */ + public static String canonical(String text) { + Object v = parse(text); + if (!(v instanceof Map)) return null; + return write(v, false, true); + } + + @SuppressWarnings("unchecked") + public static String write(Object value, boolean pretty, boolean sortKeys) { + StringBuilder sb = new StringBuilder(); + writeValue(sb, value, pretty, sortKeys, 0); + return sb.toString(); + } + + @SuppressWarnings("unchecked") + private static void writeValue(StringBuilder sb, Object value, boolean pretty, boolean sortKeys, int depth) { + if (value == null) { sb.append("null"); return; } + if (value instanceof String s) { quote(sb, s); return; } + if (value instanceof Boolean bo) { sb.append(bo); return; } + if (value instanceof Num n) { sb.append(n.raw()); return; } + if (value instanceof Number n) { + if (value instanceof Double || value instanceof Float) { + double d = n.doubleValue(); + if (Double.isNaN(d) || Double.isInfinite(d)) sb.append("null"); + else if (d == Math.rint(d) && Math.abs(d) < 1e15) sb.append((long) d); + else sb.append(n); + } else sb.append(n); + return; + } + if (value instanceof Map raw) { + Map map = new LinkedHashMap<>(); + for (Map.Entry e : raw.entrySet()) map.put(String.valueOf(e.getKey()), e.getValue()); + if (depth == 0 && sortKeys) map.remove("signature"); + Map ordered = map; + if (sortKeys) { + ordered = new TreeMap<>((a, b) -> compareCodePoints(a, b)); + ordered.putAll(map); + } + sb.append('{'); + boolean first = true; + for (Map.Entry e : ordered.entrySet()) { + if (!first) sb.append(','); + first = false; + if (pretty) { sb.append('\n'); indent(sb, depth + 1); } + quote(sb, e.getKey()); + sb.append(pretty ? ": " : ":"); + writeValue(sb, e.getValue(), pretty, sortKeys, depth + 1); + } + if (pretty && !ordered.isEmpty()) { sb.append('\n'); indent(sb, depth); } + sb.append('}'); + return; + } + if (value instanceof List list) { + sb.append('['); + boolean first = true; + for (Object item : list) { + if (!first) sb.append(','); + first = false; + if (pretty) { sb.append('\n'); indent(sb, depth + 1); } + writeValue(sb, item, pretty, sortKeys, depth + 1); + } + if (pretty && !list.isEmpty()) { sb.append('\n'); indent(sb, depth); } + sb.append(']'); + return; + } + quote(sb, String.valueOf(value)); + } + + private static void indent(StringBuilder sb, int depth) { sb.append(" ".repeat(Math.max(0, depth))); } + + private static int compareCodePoints(String a, String b) { + int i = 0, j = 0; + while (i < a.length() && j < b.length()) { + int ca = a.codePointAt(i), cb = b.codePointAt(j); + if (ca != cb) return Integer.compare(ca, cb); + i += Character.charCount(ca); j += Character.charCount(cb); + } + return Integer.compare(a.length(), b.length()); + } + + private static void quote(StringBuilder sb, String s) { + sb.append('"'); + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + switch (c) { + case '"' -> sb.append("\\\""); + case '\\' -> sb.append("\\\\"); + case '\n' -> sb.append("\\n"); + case '\r' -> sb.append("\\r"); + case '\t' -> sb.append("\\t"); + case '\b' -> sb.append("\\b"); + case '\f' -> sb.append("\\f"); + default -> { + if (c < 0x20) sb.append(String.format("\\u%04x", (int) c)); + else sb.append(c); + } + } + } + sb.append('"'); + } + + private static final class Parser { + final String s; int pos; + Parser(String s) { this.s = s; } + boolean eof() { return pos >= s.length(); } + void skipWs() { while (!eof() && Character.isWhitespace(s.charAt(pos))) pos++; } + char peek() { return s.charAt(pos); } + char next() { return s.charAt(pos++); } + void expect(char c) { + if (eof() || s.charAt(pos) != c) throw new IllegalArgumentException("JSON 位置 " + pos + " 期望 '" + c + "'"); + pos++; + } + Object value() { + skipWs(); + if (eof()) throw new IllegalArgumentException("JSON 意外结束"); + char c = peek(); + return switch (c) { + case '{' -> object(); + case '[' -> array(); + case '"' -> string(); + case 't' -> { literal("true"); yield Boolean.TRUE; } + case 'f' -> { literal("false"); yield Boolean.FALSE; } + case 'n' -> { literal("null"); yield null; } + default -> number(); + }; + } + void literal(String lit) { + if (!s.startsWith(lit, pos)) throw new IllegalArgumentException("JSON 位置 " + pos + " 无效字面量"); + pos += lit.length(); + } + Map object() { + expect('{'); + Map m = new LinkedHashMap<>(); + skipWs(); + if (!eof() && peek() == '}') { pos++; return m; } + while (true) { + skipWs(); + String key = string(); + skipWs(); expect(':'); + Object v = value(); + m.put(key, v); + skipWs(); + if (eof()) throw new IllegalArgumentException("JSON 对象未闭合"); + char c = next(); + if (c == '}') break; + if (c != ',') throw new IllegalArgumentException("JSON 位置 " + (pos - 1) + " 期望 ',' 或 '}'"); + } + return m; + } + List array() { + expect('['); + List list = new ArrayList<>(); + skipWs(); + if (!eof() && peek() == ']') { pos++; return list; } + while (true) { + list.add(value()); + skipWs(); + if (eof()) throw new IllegalArgumentException("JSON 数组未闭合"); + char c = next(); + if (c == ']') break; + if (c != ',') throw new IllegalArgumentException("JSON 位置 " + (pos - 1) + " 期望 ',' 或 ']'"); + } + return list; + } + String string() { + expect('"'); + StringBuilder sb = new StringBuilder(); + while (true) { + if (eof()) throw new IllegalArgumentException("JSON 字符串未闭合"); + char c = next(); + if (c == '"') break; + if (c == '\\') { + char e = next(); + switch (e) { + case '"' -> sb.append('"'); + case '\\' -> sb.append('\\'); + case '/' -> sb.append('/'); + case 'b' -> sb.append('\b'); + case 'f' -> sb.append('\f'); + case 'n' -> sb.append('\n'); + case 'r' -> sb.append('\r'); + case 't' -> sb.append('\t'); + case 'u' -> { + if (pos + 4 > s.length()) throw new IllegalArgumentException("JSON unicode 转义不完整"); + sb.append((char) Integer.parseInt(s.substring(pos, pos + 4), 16)); + pos += 4; + } + default -> throw new IllegalArgumentException("JSON 非法转义 \\" + e); + } + } else sb.append(c); + } + return sb.toString(); + } + Num number() { + int start = pos; + if (!eof() && peek() == '-') pos++; + while (!eof() && Character.isDigit(peek())) pos++; + if (!eof() && peek() == '.') { pos++; while (!eof() && Character.isDigit(peek())) pos++; } + if (!eof() && (peek() == 'e' || peek() == 'E')) { + pos++; + if (!eof() && (peek() == '+' || peek() == '-')) pos++; + while (!eof() && Character.isDigit(peek())) pos++; + } + if (start == pos) throw new IllegalArgumentException("JSON 位置 " + start + " 不是数字"); + return new Num(s.substring(start, pos)); + } + } +} diff --git a/Java/src/main/java/com/gc/core/LocalRemote.java b/Java/src/main/java/com/gc/core/LocalRemote.java new file mode 100644 index 0000000..ef48de8 --- /dev/null +++ b/Java/src/main/java/com/gc/core/LocalRemote.java @@ -0,0 +1,84 @@ +package com.gc.core; + +import java.nio.file.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; + +/** 本地目录模型源(离线教室 / U 盘)。 */ +public final class LocalRemote implements Remote { + private final Path root; + + public LocalRemote(Path root) { this.root = root.toAbsolutePath().normalize(); } + + @Override public String displayName() { return "本地目录 " + root; } + @Override public String sourceId() { return "local"; } + @Override public Path localRoot() { return root; } + @Override public String rawManifestText() { return null; } + @Override public String rawUrl(String path) { return root.resolve(path).toString(); } + + @Override + public RepoVersion manifest() throws Exception { + for (String p : new String[]{"version.json", "model/version.json"}) { + Path f = root.resolve(p); + if (!Files.isRegularFile(f)) continue; + String text = Files.readString(f); + Security.Verification v = Security.verifyManifest(text, true); + RepoVersion ver = RepoVersion.parse(text); + ver.trust = v.trust().name(); + ver.keyId = v.keyId(); + ver.error = v.error(); + ver.trusted = v.trusted(); + if (v.trust() == Security.Trust.INVALID) return null; + return ver; + } + // 没有 version.json:按目录扫描生成临时清单 + RepoVersion ver = new RepoVersion(); + ver.repository = root.toString(); + ver.trust = "SKIPPED"; + ver.trusted = true; + Path modelRoot = Files.isDirectory(root.resolve("model")) ? root.resolve("model") : root; + try (DirectoryStream ds = Files.newDirectoryStream(modelRoot)) { + for (Path d : ds) { + if (!Files.isDirectory(d)) continue; + String id = d.getFileName().toString(); + Path mf = d.resolve(id + ".json"); + if (!Files.isRegularFile(mf)) continue; + var mm = ModelManifest.parse(Json.obj(Json.parse(mf))); + ver.models.add(new RepoModel(id, mm.version, modelRoot.relativize(d).toString(), + "", Hash.file(mf), Hash.dir(d.resolve(id + ".model")), 0)); + } + } + return ver; + } + + @Override + public List listTree(String rootPath) throws Exception { + List out = new ArrayList<>(); + Path base = root.resolve(rootPath.replaceAll("^/+|/+$", "")); + if (!Files.isDirectory(base)) return out; + try (var walk = Files.walk(base)) { + for (Path p : walk.toList()) { + if (p.equals(base)) continue; + String rel = base.relativize(p).toString().replace('\\', '/'); + out.add(new RepoEntry(p.getFileName().toString(), + Path.of(rootPath).resolve(rel).toString().replace('\\', '/'), rel, + Files.isDirectory(p), p.toUri().toString(), Files.size(p))); + } + } + return out; + } + + @Override + public byte[] download(RepoEntry entry) throws Exception { + Path p = root.resolve(entry.path()); + if (!Files.isRegularFile(p)) throw new java.io.IOException("文件不存在: " + p); + return Files.readAllBytes(p); + } + + @Override + public byte[] downloadPackage(String url) throws Exception { + Path p = url.startsWith("file:") ? Path.of(java.net.URI.create(url)) : Path.of(url); + return Files.readAllBytes(p); + } +} diff --git a/Java/src/main/java/com/gc/core/LocalWebServer.java b/Java/src/main/java/com/gc/core/LocalWebServer.java new file mode 100644 index 0000000..6fb9fe6 --- /dev/null +++ b/Java/src/main/java/com/gc/core/LocalWebServer.java @@ -0,0 +1,121 @@ +package com.gc.core; + +import com.sun.net.httpserver.Headers; +import com.sun.net.httpserver.HttpExchange; +import com.sun.net.httpserver.HttpServer; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Locale; +import java.util.concurrent.Executors; + +/** 仅监听 127.0.0.1 的静态文件服务,用于把离线 HTML 课件加载到 WebView。 */ +public final class LocalWebServer implements AutoCloseable { + private final HttpServer server; + private final Path root; + private final int port; + + public LocalWebServer(Path root) throws IOException { + this.root = root.toAbsolutePath().normalize(); + server = HttpServer.create(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0), 0); + port = server.getAddress().getPort(); + server.createContext("/", this::handle); + server.setExecutor(Executors.newCachedThreadPool(r -> { + Thread t = new Thread(r, "gc-courseware-http"); + t.setDaemon(true); + return t; + })); + server.start(); + } + + public int port() { return port; } + public String url() { return "http://127.0.0.1:" + port + "/index.html"; } + + private void handle(HttpExchange ex) throws IOException { + try { + String raw = ex.getRequestURI().getPath(); + if (raw == null || raw.isEmpty() || raw.equals("/")) raw = "/index.html"; + Path file = root.resolve(raw.substring(1)).normalize(); + if (!file.startsWith(root) || !Files.isRegularFile(file)) { + byte[] msg = "404 Not Found".getBytes(); + ex.sendResponseHeaders(404, msg.length); + try (OutputStream os = ex.getResponseBody()) { os.write(msg); } + return; + } + long length = Files.size(file); + Headers h = ex.getResponseHeaders(); + h.set("Content-Type", mime(file)); + h.set("Accept-Ranges", "bytes"); + h.set("Cache-Control", "no-cache"); + h.set("X-Content-Type-Options", "nosniff"); + String range = ex.getRequestHeaders().getFirst("Range"); + if (range != null && range.startsWith("bytes=")) { + String[] parts = range.substring(6).split("-", -1); + long start = parse(parts.length > 0 ? parts[0] : "", 0); + long end = parts.length > 1 ? parse(parts[1], -1) : -1; + if (start < 0) start = 0; + if (end < 0 || end >= length) end = length - 1; + if (start >= length || start > end) { + ex.sendResponseHeaders(416, -1); + return; + } + long len = end - start + 1; + h.set("Content-Range", "bytes " + start + "-" + end + "/" + length); + ex.sendResponseHeaders(206, len); + try (InputStream in = Files.newInputStream(file); OutputStream os = ex.getResponseBody()) { + in.skipNBytes(start); + byte[] buf = new byte[64 * 1024]; + long remaining = len; + while (remaining > 0) { + int n = in.read(buf, 0, (int) Math.min(buf.length, remaining)); + if (n < 0) break; + os.write(buf, 0, n); + remaining -= n; + } + } + return; + } + ex.sendResponseHeaders(200, length); + try (OutputStream os = ex.getResponseBody()) { + Files.copy(file, os); + } + } catch (Exception e) { + try { ex.sendResponseHeaders(500, -1); } catch (Exception ignored) { } + } finally { + ex.close(); + } + } + + private static long parse(String s, long fallback) { + try { return s == null || s.isBlank() ? fallback : Long.parseLong(s.trim()); } + catch (Exception e) { return fallback; } + } + + private static String mime(Path p) { + String n = p.getFileName().toString().toLowerCase(Locale.ROOT); + if (n.endsWith(".html") || n.endsWith(".htm")) return "text/html; charset=utf-8"; + if (n.endsWith(".css")) return "text/css; charset=utf-8"; + if (n.endsWith(".js")) return "text/javascript; charset=utf-8"; + if (n.endsWith(".json")) return "application/json; charset=utf-8"; + if (n.endsWith(".png")) return "image/png"; + if (n.endsWith(".jpg") || n.endsWith(".jpeg")) return "image/jpeg"; + if (n.endsWith(".gif")) return "image/gif"; + if (n.endsWith(".webp")) return "image/webp"; + if (n.endsWith(".svg")) return "image/svg+xml"; + if (n.endsWith(".mp4")) return "video/mp4"; + if (n.endsWith(".webm")) return "video/webm"; + if (n.endsWith(".woff2")) return "font/woff2"; + if (n.endsWith(".woff")) return "font/woff"; + if (n.endsWith(".ttf")) return "font/ttf"; + return "application/octet-stream"; + } + + @Override public void close() { + try { server.stop(0); } catch (Exception ignored) { } + } +} diff --git a/Java/src/main/java/com/gc/core/Log.java b/Java/src/main/java/com/gc/core/Log.java new file mode 100644 index 0000000..b377799 --- /dev/null +++ b/Java/src/main/java/com/gc/core/Log.java @@ -0,0 +1,48 @@ +package com.gc.core; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + +/** 按天分中英两份日志:.GC/logs/gc-YYYYMMDD.log 与 .en.log。 */ +public final class Log { + private static final DateTimeFormatter TS = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + private static Path dir; + private static boolean enabled = true; + + private Log() {} + + public static void init(Path logsRoot) { + dir = logsRoot; + try { Files.createDirectories(dir); } catch (IOException ignored) { } + } + + public static synchronized void info(String zh) { write("INFO", zh, null); } + public static synchronized void info(String zh, String en) { write("INFO", zh, en); } + public static synchronized void warn(String zh) { write("WARN", zh, null); } + public static synchronized void warn(String zh, String en) { write("WARN", zh, en); } + public static synchronized void error(String zh) { write("ERROR", zh, null); } + public static synchronized void error(String zh, String en) { write("ERROR", zh, en); } + + private static void write(String level, String zh, String en) { + String line = "[" + LocalDateTime.now().format(TS) + "] [" + level + "] " + zh; + System.out.println(line); + if (!enabled || dir == null) return; + String day = LocalDate.now().format(DateTimeFormatter.BASIC_ISO_DATE); + try { + Files.createDirectories(dir); + Files.writeString(dir.resolve("gc-" + day + ".log"), line + System.lineSeparator(), + StandardCharsets.UTF_8, StandardOpenOption.CREATE, StandardOpenOption.APPEND); + if (en != null) { + String eline = "[" + LocalDateTime.now().format(TS) + "] [" + level + "] " + en; + Files.writeString(dir.resolve("gc-" + day + ".en.log"), eline + System.lineSeparator(), + StandardCharsets.UTF_8, StandardOpenOption.CREATE, StandardOpenOption.APPEND); + } + } catch (IOException ignored) { } + } + + public static Path logsDir() { return dir; } +} diff --git a/Java/src/main/java/com/gc/core/ModelCommands.java b/Java/src/main/java/com/gc/core/ModelCommands.java new file mode 100644 index 0000000..56fb57e --- /dev/null +++ b/Java/src/main/java/com/gc/core/ModelCommands.java @@ -0,0 +1,242 @@ +package com.gc.core; + +import com.gc.model.contour.*; +import com.gc.model.earth.EarthMath; +import com.gc.model.scale.ScaleMath; + +import java.util.*; + +/** 5 个模型的命令行入口,GUI 与 CLI 共用同一套算法。 */ +public final class ModelCommands { + private static final Map CACHE = new HashMap<>(); + + private ModelCommands() {} + + public static int run(String[] a) { + if (a.length == 0) { help(); return 1; } + try { + return switch (a[0]) { + case "scale" -> scale(a); + case "contour" -> contour(a); + case "rotation" -> rotation(a); + case "revolution" -> revolution(a); + case "geo" -> geo(a); + default -> { help(); yield 1; } + }; + } catch (Exception e) { + System.out.println("error=" + e.getMessage()); + return 2; + } + } + + private static void help() { + System.out.println(""" + model scale solve + model scale human + model scale segment + model scale grade | spectrum | quiz | check + model contour build [size] + model contour sample | levels + model contour extract | classify + model contour color | slope + model rotation subsolar | date | angle + model revolution subsolar | season | step
+ model geo zones | declination | latlon + """); + } + + private static int scale(String[] a) { + if (a.length < 2) { help(); return 1; } + switch (a[1]) { + case "solve" -> { + ScaleMath.State s = new ScaleMath.State(); + s.mode = switch (a[2].toLowerCase()) { + case "real" -> ScaleMath.SolveMode.REAL; + case "map" -> ScaleMath.SolveMode.MAP; + case "scale" -> ScaleMath.SolveMode.SCALE; + default -> throw new IllegalArgumentException("mode 必须是 real/map/scale"); + }; + s.mapCm = Double.parseDouble(a[3]); + s.realCm = Double.parseDouble(a[4]); + s.n = Double.parseDouble(a[5]); + ScaleMath.solve(s); + System.out.println("mapCm=" + plain(s.mapCm)); + System.out.println("realCm=" + plain(s.realCm)); + System.out.println("N=" + plain(s.n)); + return 0; + } + case "human" -> { + ScaleMath.Human h = ScaleMath.humanReal(Double.parseDouble(a[2])); + System.out.println(ScaleMath.num(h.value()) + " " + h.unitKey().replace("unit.", "")); + return 0; + } + case "segment" -> { + ScaleMath.Segment seg = ScaleMath.pickSegment(Double.parseDouble(a[2]), + Double.parseDouble(a[3]), Double.parseDouble(a[4])); + System.out.printf(Locale.ROOT, "metersPerDiv=%s divPx=%s divCount=%d%n", + ScaleMath.num(seg.metersPerDiv()), ScaleMath.num(seg.divPx()), seg.divCount()); + return 0; + } + case "grade" -> { + double n = Double.parseDouble(a[2]); + System.out.println(ScaleMath.grade(n).name().toLowerCase()); + return 0; + } + case "spectrum" -> { + System.out.printf(Locale.ROOT, "%.6f%n", ScaleMath.spectrumPosition(Double.parseDouble(a[2]))); + return 0; + } + case "quiz" -> { + ScaleMath.Quiz q = ScaleMath.generateQuiz(new Random(Long.parseLong(a[2]))); + System.out.println("mode=" + q.mode.name().toLowerCase()); + System.out.println("answer=" + ScaleMath.num(q.answer)); + System.out.println("unit=" + q.answerUnitKey); + return 0; + } + case "check" -> { + double ans = Double.parseDouble(a[2]), expect = Double.parseDouble(a[3]); + ScaleMath.Quiz q = new ScaleMath.Quiz(); + q.answer = expect; + System.out.println(ScaleMath.checkAnswer(q, ans)); + return 0; + } + default -> { help(); return 1; } + } + } + + private static String plain(double v) { + String s = String.format(Locale.ROOT, "%.6f", v); + s = s.replaceAll("0+$", ""); + if (s.endsWith(".")) s = s.substring(0, s.length() - 1); + return s; + } + + private static TerrainField field(String kind, int size) { + String key = kind + ":" + size; + TerrainField f = CACHE.get(key); + if (f != null) return f; + String k = kind.toLowerCase(); + f = switch (k) { + case "mountain", "basin", "hill", "plateau", "plain" -> + new TerrainField(TerrainField.TerrainKind.valueOf(k.toUpperCase()), size); + case "peak", "ridge", "valley", "saddle", "cliff" -> + new TerrainField(TerrainField.LandformKind.valueOf(k.toUpperCase()), size); + default -> throw new IllegalArgumentException("未知地形: " + kind); + }; + CACHE.put(key, f); + return f; + } + + private static int contour(String[] a) { + if (a.length < 3) { help(); return 1; } + switch (a[1]) { + case "build" -> { + int size = a.length > 3 ? Integer.parseInt(a[3]) : 192; + TerrainField f = field(a[2], size); + System.out.printf(Locale.ROOT, "kind=%s size=%d min=%.2f max=%.2f interval=%.1f%n", + a[2], f.size, f.minHeight, f.maxHeight, f.effectiveInterval()); + return 0; + } + case "sample" -> { + TerrainField f = field(a[2], 192); + System.out.printf(Locale.ROOT, "%.2f%n", f.sampleSmooth(Double.parseDouble(a[3]), Double.parseDouble(a[4]))); + return 0; + } + case "levels" -> { + TerrainField f = field(a[2], 192); + StringJoiner sj = new StringJoiner(","); + for (float l : f.contourLevels()) sj.add(ScaleMath.num(l)); + System.out.println(sj); + return 0; + } + case "extract" -> { + TerrainField f = field(a[2], 192); + List> lines = f.extractContour(Float.parseFloat(a[3])); + int points = lines.stream().mapToInt(List::size).sum(); + System.out.println("polylines=" + lines.size() + " points=" + points); + return 0; + } + case "classify" -> { + TerrainField f = field(a[2], 192); + System.out.println(TerrainAnalyzer.classify(f, Double.parseDouble(a[3]), Double.parseDouble(a[4])) + .name().toLowerCase()); + return 0; + } + case "color" -> { + java.awt.Color c = TerrainAnalyzer.colorForHeight(Float.parseFloat(a[2])); + System.out.printf("%02x%02x%02x%n", c.getRed(), c.getGreen(), c.getBlue()); + return 0; + } + case "slope" -> { + TerrainField f = field(a[2], 192); + System.out.printf(Locale.ROOT, "%.4f%n", f.slopeAt(Double.parseDouble(a[3]), Double.parseDouble(a[4]))); + return 0; + } + default -> { help(); return 1; } + } + } + + private static int rotation(String[] a) { + if (a.length < 3) { help(); return 1; } + switch (a[1]) { + case "subsolar" -> { + double tilt = a.length > 3 ? Double.parseDouble(a[3]) : 23.5; + System.out.println(ScaleMath.num(EarthMath.subsolarLatitude(Double.parseDouble(a[2]), tilt))); + return 0; + } + case "date" -> { + System.out.println(EarthMath.dateForAngle(Double.parseDouble(a[2]))); + return 0; + } + case "angle" -> { + double spin = Double.parseDouble(a[2]), orbit = Double.parseDouble(a[3]); + System.out.printf(Locale.ROOT, "spin=%.3f orbit=%.3f%n", spin, orbit); + return 0; + } + default -> { help(); return 1; } + } + } + + private static int revolution(String[] a) { + if (a.length < 3) { help(); return 1; } + switch (a[1]) { + case "subsolar" -> { + System.out.println(ScaleMath.num(EarthMath.subsolarLatitude(Double.parseDouble(a[2])))); + return 0; + } + case "season" -> { + String key = EarthMath.nearestSeason(Double.parseDouble(a[2])).key(); + System.out.println(key.substring(key.indexOf('.') + 1)); + return 0; + } + case "step" -> { + double[] r = EarthMath.stepAngles(Double.parseDouble(a[2]), Double.parseDouble(a[3]), + Double.parseDouble(a[4]), Double.parseDouble(a[5])); + System.out.printf(Locale.ROOT, "spin=%.3f orbit=%.3f%n", r[0], r[1]); + return 0; + } + default -> { help(); return 1; } + } + } + + private static int geo(String[] a) { + if (a.length < 2) { help(); return 1; } + switch (a[1]) { + case "zones" -> { + for (EarthMath.Zone z : EarthMath.ZONES) + System.out.printf(Locale.ROOT, "%s\t%.1f\t%.1f%n", z.id(), z.latMin(), z.latMax()); + return 0; + } + case "declination" -> { + System.out.println(EarthMath.declination(Double.parseDouble(a[2]))); + return 0; + } + case "latlon" -> { + double[] v = EarthMath.latLonToUnit(Double.parseDouble(a[2]), Double.parseDouble(a[3])); + System.out.printf(Locale.ROOT, "%.6f,%.6f,%.6f%n", v[0], v[1], v[2]); + return 0; + } + default -> { help(); return 1; } + } + } +} diff --git a/Java/src/main/java/com/gc/core/ModelInstaller.java b/Java/src/main/java/com/gc/core/ModelInstaller.java new file mode 100644 index 0000000..e16ae78 --- /dev/null +++ b/Java/src/main/java/com/gc/core/ModelInstaller.java @@ -0,0 +1,54 @@ +package com.gc.core; + +import java.io.IOException; +import java.nio.file.*; +import java.util.List; + +/** 把源里的模型目录复制进本地模型库(临时目录 + 原子替换)。 */ +public final class ModelInstaller { + private ModelInstaller() {} + + public static Path install(Path sourceDir, String id, Path modelRoot) throws IOException { + String safe = Security.safeId(id); + if (safe == null) throw new IOException("非法的模型标识: " + id); + Path target = modelRoot.resolve(safe); + Path staging = modelRoot.resolve(safe + ".installing"); + Path backup = modelRoot.resolve(safe + ".old"); + AppPaths.deleteTree(staging); + AppPaths.deleteTree(backup); + Files.createDirectories(staging); + try { + Path manifest = sourceDir.resolve(safe + ".json"); + if (!Files.isRegularFile(manifest)) throw new IOException("缺少模型清单 " + safe + ".json"); + Files.copy(manifest, staging.resolve(safe + ".json"), StandardCopyOption.REPLACE_EXISTING); + Path data = sourceDir.resolve(safe + ".model"); + if (!Files.isDirectory(data)) throw new IOException("缺少模型数据 " + safe + ".model/"); + AppPaths.copyTree(data, staging.resolve(safe + ".model")); + if (Files.exists(target)) Files.move(target, backup, StandardCopyOption.REPLACE_EXISTING); + Files.move(staging, target); + AppPaths.deleteTree(backup); + return target; + } catch (IOException e) { + AppPaths.deleteTree(staging); + if (!Files.exists(target) && Files.exists(backup)) Files.move(backup, target); + throw e; + } + } + + /** 从包含 model/ 的本地根目录导入所有模型。 */ + public static int importLocal(Path root, Path modelRoot) throws IOException { + Path sourceRoot = Files.isDirectory(root.resolve("model")) ? root.resolve("model") : root; + int n = 0; + try (DirectoryStream ds = Files.newDirectoryStream(sourceRoot)) { + for (Path dir : ds) { + if (!Files.isDirectory(dir)) continue; + String id = dir.getFileName().toString(); + if (id.startsWith("_") || id.startsWith(".")) continue; + if (!Files.isRegularFile(dir.resolve(id + ".json"))) continue; + install(dir, id, modelRoot); + n++; + } + } + return n; + } +} diff --git a/Java/src/main/java/com/gc/core/ModelManifest.java b/Java/src/main/java/com/gc/core/ModelManifest.java new file mode 100644 index 0000000..8b8b37e --- /dev/null +++ b/Java/src/main/java/com/gc/core/ModelManifest.java @@ -0,0 +1,125 @@ +package com.gc.core; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.*; + +/** model/<id>/<id>.json 的运行时模型。 */ +public final class ModelManifest { + public int schemaVersion = 1; + public String id = ""; + public String name = ""; + public Map nameI18n = new LinkedHashMap<>(); + public String version = "1.0.0"; + public String author = ""; + public String description = ""; + public Map descriptionI18n = new LinkedHashMap<>(); + public List tags = new ArrayList<>(); + public String entry = "scene.json"; + public String assembly = ""; + public String type = ""; + public String preview = "preview.png"; + public int apiVersion = 1; + public String license = ""; + public String updatedAt = ""; + public String minAppVersion = ""; + public Map chrome = new LinkedHashMap<>(); + + public static ModelManifest parse(Map m) { + ModelManifest x = new ModelManifest(); + x.schemaVersion = Json.i(m, "schemaVersion", 1); + x.id = Json.str(m, "id", ""); + x.name = Json.str(m, "name", ""); + x.version = Json.str(m, "version", "1.0.0"); + x.author = Json.str(m, "author", ""); + x.description = Json.str(m, "description", ""); + x.entry = Json.str(m, "entry", "scene.json"); + x.assembly = Json.str(m, "assembly", ""); + x.type = Json.str(m, "type", ""); + x.preview = Json.str(m, "preview", "preview.png"); + x.apiVersion = Json.i(m, "apiVersion", 1); + x.license = Json.str(m, "license", ""); + x.updatedAt = Json.str(m, "updatedAt", ""); + x.minAppVersion = Json.str(m, "minAppVersion", ""); + for (var e : Json.obj(m.get("nameI18n")).entrySet()) x.nameI18n.put(e.getKey(), String.valueOf(e.getValue())); + for (var e : Json.obj(m.get("descriptionI18n")).entrySet()) x.descriptionI18n.put(e.getKey(), String.valueOf(e.getValue())); + for (var e : Json.obj(m.get("chrome")).entrySet()) x.chrome.put(e.getKey(), String.valueOf(e.getValue())); + for (Object o : Json.arr(m.get("tags"))) x.tags.add(String.valueOf(o)); + return x; + } + + public String localizedName() { + String v = nameI18n.get(I18n.language()); + if (v == null) v = nameI18n.get("zh-CN"); + return v == null || v.isBlank() ? (name.isBlank() ? id : name) : v; + } + + public String localizedDescription() { + String v = descriptionI18n.get(I18n.language()); + if (v == null) v = descriptionI18n.get("zh-CN"); + return v == null ? description : v; + } + + public static final class Package { + public final ModelManifest manifest; + public final Path directory; + public long sizeBytes; + public Package(ModelManifest manifest, Path directory) { this.manifest = manifest; this.directory = directory; } + public String id() { return manifest.id; } + public Path dataDir() { return directory.resolve(manifest.id + ".model"); } + public Path previewPath() { return dataDir().resolve(manifest.preview.isBlank() ? "preview.png" : manifest.preview); } + public Path scenePath() { + Path p = Path.of(manifest.entry.isBlank() ? "scene.json" : manifest.entry); + return p.isAbsolute() ? p : (manifest.entry.startsWith(manifest.id + ".model") ? directory.resolve(p) : dataDir().resolve(p)); + } + public Path assemblyPath() { + String f = manifest.assembly.isBlank() ? manifest.id + ".dll" : manifest.assembly; + return dataDir().resolve(f); + } + public boolean hasBuiltinRenderer() { + return BuiltinModels.supports(manifest.id); + } + } + + public static final class Discovery { + public final Path root; + public final List models; + public final List errors; + public Discovery(Path root, List models, List errors) { + this.root = root; this.models = models; this.errors = errors; + } + } + + public static Discovery scan(Path root) { + List list = new ArrayList<>(); + List errors = new ArrayList<>(); + if (!Files.isDirectory(root)) return new Discovery(root, list, errors); + try (var ds = Files.newDirectoryStream(root)) { + for (Path dir : ds) { + if (!Files.isDirectory(dir)) continue; + String folder = dir.getFileName().toString(); + if (folder.startsWith(".") || folder.startsWith("_")) continue; + Path manifestPath = dir.resolve(folder + ".json"); + if (!Files.isRegularFile(manifestPath)) { + try (var fs = Files.list(dir)) { + manifestPath = fs.filter(p -> p.getFileName().toString().endsWith(".json")).findFirst().orElse(null); + } + } + if (manifestPath == null) continue; + try { + ModelManifest m = parse(Json.obj(Json.parse(manifestPath))); + if (m.id == null || m.id.isBlank()) m.id = folder; + Package pkg = new Package(m, dir); + pkg.sizeBytes = Hash.dirSize(dir); + list.add(pkg); + } catch (Exception e) { + errors.add(manifestPath + ": " + e.getMessage()); + } + } + } catch (Exception e) { + errors.add(root + ": " + e.getMessage()); + } + list.sort(Comparator.comparing(p -> p.id().toLowerCase(Locale.ROOT))); + return new Discovery(root, list, errors); + } +} diff --git a/Java/src/main/java/com/gc/core/Remote.java b/Java/src/main/java/com/gc/core/Remote.java new file mode 100644 index 0000000..50da7df --- /dev/null +++ b/Java/src/main/java/com/gc/core/Remote.java @@ -0,0 +1,63 @@ +package com.gc.core; + +import java.io.IOException; +import java.nio.file.Path; +import java.util.List; + +/** 模型源抽象:Gitea/GitHub 仓库或本地目录。 */ +public interface Remote { + String displayName(); + String sourceId(); + String rawManifestText() throws Exception; + RepoVersion manifest() throws Exception; + List listTree(String rootPath) throws Exception; + byte[] download(RepoEntry entry) throws Exception; + byte[] downloadPackage(String url) throws Exception; + String rawUrl(String path); + Path localRoot(); + + record RepoEntry(String name, String path, String relativePath, boolean directory, + String downloadUrl, long size) {} + + final class RepoVersion { + public String repository = ""; + public String branch = "main"; + public String launcherVersion = ""; + public java.util.Map packages = new java.util.LinkedHashMap<>(); + public java.util.List models = new java.util.ArrayList<>(); + public String trust = ""; + public String keyId = ""; + public String error = ""; + public String rawText = ""; + public boolean trusted; + + public static RepoVersion parse(String text) { + RepoVersion v = new RepoVersion(); + v.rawText = text; + java.util.Map m = Json.obj(Json.parse(text)); + v.repository = Json.str(m, "repository", ""); + v.branch = Json.str(m, "branch", "main"); + java.util.Map launcher = Json.obj(m.get("launcher")); + v.launcherVersion = Json.str(launcher, "version", ""); + for (var e : Json.obj(launcher.get("packages")).entrySet()) { + java.util.Map p = Json.obj(e.getValue()); + v.packages.put(e.getKey(), new RepoPackage( + Json.str(p, "url", ""), Json.str(p, "path", ""), + Json.str(p, "sha256", ""), Json.l(p, "size", 0), + Json.str(p, "dir", ""), Json.str(p, "name", ""), e.getKey())); + } + for (Object o : Json.arr(m.get("models"))) { + java.util.Map x = Json.obj(o); + v.models.add(new RepoModel(Json.str(x, "id", ""), Json.str(x, "version", ""), + Json.str(x, "dir", ""), Json.str(x, "build", ""), + Json.str(x, "manifestSha256", ""), Json.str(x, "filesSha256", ""), + Json.i(x, "files", 0))); + } + return v; + } + } + + record RepoPackage(String url, String path, String sha256, long size, String dir, String name, String rid) {} + record RepoModel(String id, String version, String dir, String build, + String manifestSha256, String filesSha256, int files) {} +} diff --git a/Java/src/main/java/com/gc/core/Security.java b/Java/src/main/java/com/gc/core/Security.java new file mode 100644 index 0000000..0487c2f --- /dev/null +++ b/Java/src/main/java/com/gc/core/Security.java @@ -0,0 +1,239 @@ +package com.gc.core; + +import javax.crypto.KeyGenerator; +import javax.crypto.SecretKey; +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import java.security.*; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; +import java.time.Instant; +import java.util.*; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; +import java.util.zip.ZipInputStream; + +/** 清单签名、公钥环、安全解压、模型完整性、启动健康标记。 */ +public final class Security { + private Security() {} + + public static final String ALGORITHM = "ECDSA-P256-SHA256"; + + public enum Trust { VERIFIED, SKIPPED, UNSIGNED, INVALID } + + public record Verification(Trust trust, String keyId, String error) { + public boolean trusted() { return trust == Trust.VERIFIED || trust == Trust.SKIPPED; } + } + + public record KeyEntry(String keyId, String publicKeyBase64, String note) {} + + private static final List KEYS = new ArrayList<>(List.of( + new KeyEntry("gc-2026-12", + "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE4R+R2Pvinsu/xdaUu5mATPyYoEpL6cyugSVKAVMz6yY15SjkgEvdosfWuQJBbrPOOgGulE6Jht6v7FZx1dQguQ==", + "GC 主发布密钥"), + new KeyEntry("gc-2026-11", + "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEny5YKVBZUzOyRcSiuutlGmBb4+xmPrNDGshilBlpmFyWu5Atq+FGP2tn+8Or8V7OH+/7lhCmXu8jZuC5/5CWSw==", + "已停用:私钥遗失") + )); + + public static List keys() { return List.copyOf(KEYS); } + + public static KeyEntry findKey(String keyId) { + if (keyId == null || keyId.isBlank()) return KEYS.size() == 1 ? KEYS.get(0) : null; + for (KeyEntry k : KEYS) if (k.keyId().equals(keyId)) return k; + return null; + } + + public static void addKey(String id, String b64) { + if (id == null || id.isBlank() || b64 == null || b64.isBlank()) return; + if (findKey(id) == null) KEYS.add(new KeyEntry(id, b64, "来自 GC_TRUSTED_KEYS")); + } + + public static Verification verifyManifest(String text, boolean requireSignature) { + if (KEYS.isEmpty()) return new Verification(Trust.SKIPPED, null, "未配置受信任公钥,已跳过验签"); + if (text == null || text.isBlank()) return new Verification(Trust.INVALID, null, "清单内容为空"); + Map root; + try { root = Json.obj(Json.parse(text)); } + catch (Exception e) { return new Verification(Trust.INVALID, null, "清单不是合法 JSON: " + e.getMessage()); } + Object sigObj = root.get("signature"); + if (!(sigObj instanceof Map)) { + return new Verification(Trust.UNSIGNED, null, requireSignature ? "清单缺少签名" : "清单未签名"); + } + Map sig = Json.obj(sigObj); + String keyId = Json.str(sig, "keyId", ""); + String value = Json.str(sig, "value", ""); + String alg = Json.str(sig, "alg", ALGORITHM); + if (!alg.equalsIgnoreCase(ALGORITHM)) return new Verification(Trust.INVALID, keyId, "不支持的签名算法: " + alg); + if (value.isEmpty()) return new Verification(Trust.INVALID, keyId, "签名为空"); + KeyEntry key = findKey(keyId); + if (key == null) return new Verification(Trust.INVALID, keyId, "未知签名密钥: " + keyId); + String payload = Json.canonical(text); + if (payload == null) return new Verification(Trust.INVALID, keyId, "无法规范化清单"); + try { + byte[] sigBytes = Base64.getDecoder().decode(value); + PublicKey pub = KeyFactory.getInstance("EC") + .generatePublic(new X509EncodedKeySpec(Base64.getDecoder().decode(key.publicKeyBase64()))); + Signature s = Signature.getInstance("SHA256withECDSAinP1363Format"); + s.initVerify(pub); + s.update(payload.getBytes(StandardCharsets.UTF_8)); + return s.verify(sigBytes) + ? new Verification(Trust.VERIFIED, key.keyId(), null) + : new Verification(Trust.INVALID, keyId, "签名与内容不符"); + } catch (Exception e) { + return new Verification(Trust.INVALID, keyId, "验签异常: " + e.getMessage()); + } + } + + public static String signManifest(String text, PrivateKey key, String keyId) throws Exception { + String payload = Json.canonical(text); + if (payload == null) throw new IllegalArgumentException("清单不是合法 JSON,无法签名"); + Signature s = Signature.getInstance("SHA256withECDSAinP1363Format"); + s.initSign(key); + s.update(payload.getBytes(StandardCharsets.UTF_8)); + byte[] sig = s.sign(); + Map root = Json.obj(Json.parse(text)); + Map sigObj = new LinkedHashMap<>(); + sigObj.put("alg", ALGORITHM); + sigObj.put("keyId", keyId); + sigObj.put("value", Base64.getEncoder().encodeToString(sig)); + sigObj.put("contentSha256", Hash.sha256(payload.getBytes(StandardCharsets.UTF_8))); + sigObj.put("signedAt", Instant.now().toString().substring(0, 19) + "Z"); + root.put("signature", sigObj); + return Json.write(root, true, false) + "\n"; + } + + public static PrivateKey loadPrivateKey(Path pem) throws Exception { + String text = Files.readString(pem, StandardCharsets.UTF_8); + String b64 = text.replaceAll("-----BEGIN [^-]+-----", "") + .replaceAll("-----END [^-]+-----", "").replaceAll("\\s", ""); + byte[] der = Base64.getDecoder().decode(b64); + return KeyFactory.getInstance("EC").generatePrivate(new PKCS8EncodedKeySpec(der)); + } + + public static String publicKeyBase64(PublicKey key) { return Base64.getEncoder().encodeToString(key.getEncoded()); } + + public static String fingerprint(String publicKeyBase64) { + return Hash.sha256(Base64.getDecoder().decode(publicKeyBase64)).substring(0, 16); + } + + /** 生成签名密钥对,写到目录;返回 keyId。 */ + public static String keygen(Path dir, String keyId) throws Exception { + KeyPairGenerator gen = KeyPairGenerator.getInstance("EC"); + gen.initialize(new java.security.spec.ECGenParameterSpec("secp256r1")); + KeyPair kp = gen.generateKeyPair(); + Files.createDirectories(dir); + String priv = "-----BEGIN PRIVATE KEY-----\n" + wrap(Base64.getEncoder().encodeToString(kp.getPrivate().getEncoded())) + + "-----END PRIVATE KEY-----\n"; + String pub = "-----BEGIN PUBLIC KEY-----\n" + wrap(Base64.getEncoder().encodeToString(kp.getPublic().getEncoded())) + + "-----END PUBLIC KEY-----\n"; + Files.writeString(dir.resolve("gc-signing.pem"), priv, StandardCharsets.UTF_8); + Files.writeString(dir.resolve("gc-signing.pub.pem"), pub, StandardCharsets.UTF_8); + Files.writeString(dir.resolve("keyring.txt"), + keyId + ":" + publicKeyBase64(kp.getPublic()) + " # fingerprint " + fingerprint(publicKeyBase64(kp.getPublic())) + "\n", + StandardCharsets.UTF_8); + return keyId; + } + + private static String wrap(String s) { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < s.length(); i += 64) sb.append(s, i, Math.min(s.length(), i + 64)).append('\n'); + return sb.toString(); + } + + // ------------------------------------------------------------------ 安全 zip + + public static final long MAX_UNCOMPRESSED = 2L * 1024 * 1024 * 1024; + public static final int MAX_ENTRIES = 20000; + + public static String safeZipName(String name) { + if (name == null) return "REJECT"; + String n = name.replace('\\', '/').trim(); + if (n.isEmpty()) return "REJECT"; + if (n.startsWith("/") || n.startsWith("//") || n.matches("^[A-Za-z]:.*") || n.startsWith("\\\\")) return "REJECT"; + for (String seg : n.split("/")) if (seg.equals("..")) return "REJECT"; + return "OK"; + } + + public static boolean isSafeZipName(String name) { return safeZipName(name).equals("OK"); } + + /** 解压不可信 zip 到目录,拒绝穿越 / 炸弹 / 链接。 */ + public static void extractZipSafe(Path zip, Path dest) throws IOException { + Files.createDirectories(dest); + Path destFull = dest.toAbsolutePath().normalize(); + int count = 0; + long total = 0; + try (ZipFile zf = new ZipFile(zip.toFile())) { + Enumeration en = zf.entries(); + while (en.hasMoreElements()) { + ZipEntry e = en.nextElement(); + count++; + if (count > MAX_ENTRIES) throw new IOException("zip 条目数超过限制"); + if (e.isDirectory()) continue; + if (!isSafeZipName(e.getName())) throw new IOException("不安全的 zip 条目: " + e.getName()); + long size = e.getSize(); + if (size > 0 && total + size > MAX_UNCOMPRESSED) throw new IOException("zip 解压体积超过 2 GiB"); + long csize = Math.max(1, e.getCompressedSize()); + if (csize > 0 && size / csize > 200 && size > 10 * 1024 * 1024) + throw new IOException("疑似 zip 炸弹: " + e.getName()); + Path out = destFull.resolve(e.getName()).normalize(); + if (!out.startsWith(destFull)) throw new IOException("zip 路径越界: " + e.getName()); + Files.createDirectories(out.getParent()); + long written = 0; + try (InputStream in = zf.getInputStream(e); + java.io.OutputStream os = Files.newOutputStream(out, StandardOpenOption.CREATE, + StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.WRITE)) { + byte[] buf = new byte[16384]; + int n; + while ((n = in.read(buf)) > 0) { + written += n; + total += n; + if (total > MAX_UNCOMPRESSED) throw new IOException("zip 解压体积超过 2 GiB"); + os.write(buf, 0, n); + } + } + } + } + } + + /** 校验模型目录完整性,并写 .integrity.json。 */ + public static void writeIntegrity(Path modelDir, String id, String manifestSha, String filesSha) throws IOException { + Map m = new LinkedHashMap<>(); + m.put("schema", 1); + m.put("id", id); + m.put("manifestSha256", manifestSha); + m.put("filesSha256", filesSha); + m.put("installedAt", Instant.now().toString()); + Files.writeString(modelDir.resolve(id + ".integrity.json"), Json.write(m, true, false) + "\n"); + } + + public static boolean verifyModel(Path modelDir, String id, String expectedManifestSha, String expectedFilesSha) { + try { + Path manifest = modelDir.resolve(id + ".json"); + if (!Files.isRegularFile(manifest)) return false; + if (expectedManifestSha != null && !expectedManifestSha.isBlank() + && !Hash.file(manifest).equalsIgnoreCase(expectedManifestSha)) return false; + if (expectedFilesSha != null && !expectedFilesSha.isBlank() + && !Hash.dir(modelDir.resolve(id + ".model")).equalsIgnoreCase(expectedFilesSha)) return false; + return true; + } catch (Exception e) { return false; } + } + + /** 启动健康标记。 */ + public static void writeHealth(Path updateRoot, String version) { + try { + Files.createDirectories(updateRoot); + Map m = new LinkedHashMap<>(); + m.put("status", "ok"); + m.put("version", version); + m.put("pid", ProcessHandle.current().pid()); + m.put("time", Instant.now().toString()); + Files.writeString(updateRoot.resolve("health.json"), Json.write(m, true, false) + "\n"); + } catch (IOException ignored) { } + } + + public static String safeId(String id) { + if (id == null || !id.matches("^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$")) return null; + return id; + } +} diff --git a/Java/src/main/java/com/gc/core/Selftest.java b/Java/src/main/java/com/gc/core/Selftest.java new file mode 100644 index 0000000..d8850d0 --- /dev/null +++ b/Java/src/main/java/com/gc/core/Selftest.java @@ -0,0 +1,127 @@ +package com.gc.core; + +import com.gc.model.contour.*; +import com.gc.model.earth.EarthMath; +import com.gc.model.scale.ScaleMath; + +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import java.util.*; + +/** 内置断言,全部 PASS 时退出码 0。 */ +public final class Selftest { + private static int pass, fail; + + private Selftest() {} + + public static int run() { + pass = fail = 0; + try { + Path tmp = Files.createTempDirectory("gc-selftest-"); + Path hello = tmp.resolve("hello.txt"); + Files.writeString(hello, "hello"); + check("hash-file", Hash.file(hello), "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"); + + Path dir = tmp.resolve("d"); + Files.createDirectories(dir); + Files.writeString(dir.resolve("a.txt"), "hello"); + check("hash-dir", Hash.dir(dir), "ed54360a4d7244bfcde6dca611fd00dbfbdf508c47ad104b711f8429a6d2604d"); + + check("version-normalize", VersionUtil.normalize("GCL-v1.0.6-beta"), "1.0.6"); + check("version-compare", String.valueOf(VersionUtil.compare("v1.0.6", "1.0.7")), "-1"); + check("canonical", Json.canonical("{\"b\":1,\"a\":\"中文\"}"), "{\"a\":\"中文\",\"b\":1}"); + check("safezip-name", Security.safeZipName("../x"), "REJECT"); + check("safezip-name", Security.safeZipName("a/b.txt"), "OK"); + check("human-size", Hash.humanSize(1536), "1.5 KB"); + + ScaleMath.State s = new ScaleMath.State(); + s.mode = ScaleMath.SolveMode.REAL; + s.mapCm = 3; s.realCm = 0; s.n = 100000; + ScaleMath.solve(s); + check("scale-real", String.format(Locale.ROOT,"%.0f",s.realCm), "300000"); + check("scale-human", ScaleMath.num(ScaleMath.humanReal(300000).value()) + " " + + ScaleMath.humanReal(300000).unitKey().replace("unit.", ""), "3 km"); + check("scale-grade", ScaleMath.grade(100000).name().toLowerCase(), "large"); + check("scale-grade", ScaleMath.grade(500000).name().toLowerCase(), "medium"); + check("scale-grade", ScaleMath.grade(10000000).name().toLowerCase(), "small"); + + TerrainField f = new TerrainField(TerrainField.TerrainKind.MOUNTAIN, 192); + boolean has100 = false; + for (float l : f.contourLevels()) if (Math.abs(l % 100) < 0.001) has100 = true; + check("contour-levels", String.valueOf(has100), "true"); + int lines = f.extractContour(600).size(); + check("contour-extract", String.valueOf(lines > 0), "true"); + check("contour-color", rgb(TerrainAnalyzer.colorForHeight(450)), "a8c666"); + check("contour-classify-peak", TerrainAnalyzer.classify(f, 0.34, 0.34).name().toLowerCase(), "peak"); + + check("rotation-subsolar-90", ScaleMath.num(EarthMath.subsolarLatitude(90)), "23.5"); + check("rotation-subsolar-0", ScaleMath.num(EarthMath.subsolarLatitude(0)), "0"); + check("rotation-date", EarthMath.dateForAngle(0).toString(), "2025-03-21"); + check("revolution-season-90", EarthMath.nearestSeason(90).key().replace("season.", ""), "summerSolstice"); + check("revolution-season-270", EarthMath.nearestSeason(270).key().replace("season.", ""), "winterSolstice"); + check("revolution-step", String.format(Locale.ROOT, "%.3f", EarthMath.stepAngles(0, 0, 1, 1)[0]), "60.000"); + + check("geo-declination-40", EarthMath.declination(40), "northTemperate"); + check("geo-declination-0", EarthMath.declination(0), "tropics"); + double[] v = EarthMath.latLonToUnit(0, 90); + check("geo-latlon", String.format(Locale.ROOT, "%.3f,%.3f,%.3f", v[0], v[1], v[2]), "1.000,0.000,0.000"); + + // 本地用户系统 + Path home = tmp.resolve("home"); + UserService us = new UserService(home); + check("user-register", String.valueOf(us.register("student", "secret123").ok()), "true"); + check("user-login", String.valueOf(us.login("student", "secret123").ok()), "true"); + check("user-signin", String.valueOf(us.signIn().ok()), "true"); + check("user-points", String.valueOf(us.profile() != null + && us.profile().points() >= UserService.signInReward(1)), "true"); + // 主题色需要积分:把「昨天」写回存档,模拟连续签到累积积分 + for (int i = 0; i < 5; i++) backdateSignIn(home, "student", "secret123"); + UserService buyer = new UserService(home); + buyer.login("student", "secret123"); + check("user-theme", String.valueOf(buyer.buyTheme("E74C3C", false).ok()), "true"); + buyer.logout(); + check("user-logout", String.valueOf(!buyer.loggedIn()), "true"); + + // 模型清单 + Path modelRoot = Path.of("model"); + if (Files.isDirectory(modelRoot)) { + ModelManifest.Discovery d = ModelManifest.scan(modelRoot); + check("model-scan", String.valueOf(d.models.size()), "5"); + } + // 安全 zip + check("safezip-abs", Security.safeZipName("/etc/passwd"), "REJECT"); + check("safezip-drive", Security.safeZipName("C:\\x"), "REJECT"); + AppPaths.deleteTree(tmp); + } catch (Exception e) { + fail++; + System.out.println("FAIL exception: " + e); + } + System.out.println("\nSELFTEST " + (fail == 0 ? "PASS" : "FAIL") + " " + pass + " passed, " + fail + " failed"); + return fail == 0 ? 0 : 1; + } + + /** 测试辅助:把最后签到日改成昨天,使下一次签到按连续天数发奖。 */ + private static void backdateSignIn(Path home, String username, String password) { + try { + Path file = home.resolve("user").resolve("users.json"); + Map all = Json.obj(Json.parse(file)); + Map u = Json.obj(all.get(username.toLowerCase(Locale.ROOT))); + u.put("lastSignIn", java.time.LocalDate.now().minusDays(1).toString()); + Files.writeString(file, Json.write(all, true, false)); + UserService day = new UserService(home); + day.login(username, password); + day.signIn(); + } catch (Exception e) { + throw new IllegalStateException("模拟签到失败", e); + } + } + + private static String rgb(java.awt.Color c) { + return String.format("%02x%02x%02x", c.getRed(), c.getGreen(), c.getBlue()); + } + + private static void check(String name, String actual, String expected) { + if (Objects.equals(actual, expected)) { pass++; System.out.println("PASS " + name + " = " + actual); } + else { fail++; System.out.println("FAIL " + name + " expected=" + expected + " actual=" + actual); } + } +} diff --git a/Java/src/main/java/com/gc/core/Settings.java b/Java/src/main/java/com/gc/core/Settings.java new file mode 100644 index 0000000..2f29efc --- /dev/null +++ b/Java/src/main/java/com/gc/core/Settings.java @@ -0,0 +1,138 @@ +package com.gc.core; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.*; + +/** 用户设置,持久化到 .GC/config/settings.json。 */ +public final class Settings { + public String language = "auto"; + public String theme = "light"; + public String accentColor = "#8FB6FF"; + public int renderFps = 120; + public int memoryMb = 2048; + public boolean memoryAuto = true; + public boolean checkSourceOnStartup = false; + public String modelRootOverride = ""; + public List> sources = new ArrayList<>(); + public List recentModels = new ArrayList<>(); + + public boolean autoUpdateOnStartup = true; + public String updateRepository = "https://git.xhmcl.com/Morris/GC"; + public String updateManifestUrl = ""; + public String updateLocalRoot = ""; + public boolean requireSignedManifest = true; + public Map installedModelVersions = new LinkedHashMap<>(); + public String launcherVersion = "2.0.0"; + public String pendingLauncherVersion = ""; + public String lastUpdateCheck = ""; + + private transient Path file; + private transient boolean loading; + + public static Settings load(Path file) { + Settings s = new Settings(); + s.file = file; + if (file != null && Files.isRegularFile(file)) { + try { + Map m = Json.obj(Json.parse(Files.readString(file, StandardCharsets.UTF_8))); + s.apply(m); + } catch (Exception e) { + System.err.println("[settings] 读取设置失败,使用默认值: " + e.getMessage()); + } + } + s.loading = false; + return s; + } + + public static Settings defaults() { + Settings s = new Settings(); + return s; + } + + @SuppressWarnings("unchecked") + private void apply(Map m) { + language = Json.str(m, "language", language); + theme = Json.str(m, "theme", theme); + accentColor = Json.str(m, "accentColor", accentColor); + renderFps = Json.i(m, "renderFps", renderFps); + memoryMb = Json.i(m, "memoryMb", memoryMb); + memoryAuto = Json.b(m, "memoryAuto", memoryAuto); + checkSourceOnStartup = Json.b(m, "checkSourceOnStartup", checkSourceOnStartup); + modelRootOverride = Json.str(m, "modelRootOverride", modelRootOverride); + autoUpdateOnStartup = Json.b(m, "autoUpdateOnStartup", autoUpdateOnStartup); + updateRepository = Json.str(m, "updateRepository", updateRepository); + updateManifestUrl = Json.str(m, "updateManifestUrl", updateManifestUrl); + updateLocalRoot = Json.str(m, "updateLocalRoot", updateLocalRoot); + requireSignedManifest = Json.b(m, "requireSignedManifest", requireSignedManifest); + launcherVersion = Json.str(m, "launcherVersion", launcherVersion); + pendingLauncherVersion = Json.str(m, "pendingLauncherVersion", pendingLauncherVersion); + lastUpdateCheck = Json.str(m, "lastUpdateCheck", lastUpdateCheck); + sources = new ArrayList<>(); + for (Object o : Json.arr(m.get("sources"))) sources.add(new LinkedHashMap<>(Json.obj(o))); + recentModels = new ArrayList<>(); + for (Object o : Json.arr(m.get("recentModels"))) recentModels.add(String.valueOf(o)); + installedModelVersions = new LinkedHashMap<>(); + Map im = Json.obj(m.get("installedModelVersions")); + for (var e : im.entrySet()) installedModelVersions.put(e.getKey(), String.valueOf(e.getValue())); + } + + public synchronized void save() { + if (loading || file == null) return; + try { + Files.createDirectories(file.getParent()); + Files.writeString(file, Json.write(toMap(), true, false) + "\n", StandardCharsets.UTF_8); + } catch (IOException e) { + System.err.println("[settings] 保存失败: " + e.getMessage()); + } + } + + public Map toMap() { + Map m = new LinkedHashMap<>(); + m.put("language", language); + m.put("theme", theme); + m.put("accentColor", accentColor); + m.put("renderFps", renderFps); + m.put("memoryMb", memoryMb); + m.put("memoryAuto", memoryAuto); + m.put("checkSourceOnStartup", checkSourceOnStartup); + m.put("modelRootOverride", modelRootOverride); + m.put("sources", sources); + m.put("recentModels", recentModels); + m.put("autoUpdateOnStartup", autoUpdateOnStartup); + m.put("updateRepository", updateRepository); + m.put("updateManifestUrl", updateManifestUrl); + m.put("updateLocalRoot", updateLocalRoot); + m.put("requireSignedManifest", requireSignedManifest); + m.put("installedModelVersions", installedModelVersions); + m.put("launcherVersion", launcherVersion); + m.put("pendingLauncherVersion", pendingLauncherVersion); + m.put("lastUpdateCheck", lastUpdateCheck); + return m; + } + + /** 有效内存预算:自动按物理内存 40% 取整到 256 MB。 */ + public int effectiveMemoryMb() { + if (!memoryAuto) return Math.max(256, memoryMb); + long total; + try { total = ((com.sun.management.OperatingSystemMXBean) java.lang.management.ManagementFactory.getOperatingSystemMXBean()).getTotalMemorySize(); } + catch (Throwable t) { total = 8L * 1024 * 1024 * 1024; } + long mb = (long) ((total / 1048576.0) * 0.4); + mb = Math.max(1024, Math.min(8192, mb / 256 * 256)); + return (int) mb; + } + + public static String defaultJson() { + return Json.write(Json.parse(""" + {"language":"auto","theme":"light","accentColor":"#8FB6FF","renderFps":120, + "memoryMb":2048,"memoryAuto":true,"checkSourceOnStartup":false, + "modelRootOverride":"","sources":[],"recentModels":[], + "autoUpdateOnStartup":true,"updateRepository":"https://git.xhmcl.com/Morris/GC", + "updateManifestUrl":"","updateLocalRoot":"","requireSignedManifest":true, + "installedModelVersions":{},"launcherVersion":"2.0.0", + "pendingLauncherVersion":"","lastUpdateCheck":""} + """), true, false); + } +} diff --git a/Java/src/main/java/com/gc/core/SourcePreset.java b/Java/src/main/java/com/gc/core/SourcePreset.java new file mode 100644 index 0000000..fb97217 --- /dev/null +++ b/Java/src/main/java/com/gc/core/SourcePreset.java @@ -0,0 +1,34 @@ +package com.gc.core; + +import java.util.List; + +/** 内置模型源,与原版一致:Xhmcl(Gitea)与 GitHub 镜像。 */ +public record SourcePreset(String id, String name, String homeUrl, String apiBase, + String rawBase, String kind, String owner, String repo, + String branch, String rawStyle) { + public static final SourcePreset XHMCL = new SourcePreset( + "xhmcl", "Xhmcl", "https://git.xhmcl.com/Morris/GC", "https://git.xhmcl.com/api/v1", + "https://git.xhmcl.com", "gitea", "Morris", "GC", "main", "branch"); + public static final SourcePreset GITHUB = new SourcePreset( + "github", "GitHub", "https://github.com/Morris-morris-cloud/GC", "https://api.github.com", + "https://raw.githubusercontent.com", "github", "Morris-morris-cloud", "GC", "main", "raw"); + + public static final List ALL = List.of(XHMCL, GITHUB); + + public static SourcePreset detect(String url) { + if (url != null) { + String u = url.toLowerCase(); + if (u.contains("github.com") || u.equals("github")) return GITHUB; + if (u.contains("xhmcl.com") || u.equals("xhmcl")) return XHMCL; + } + return XHMCL; + } + + public String rawUrl(String path) { + String p = path.startsWith("/") ? path.substring(1) : path; + return switch (rawStyle) { + case "raw" -> rawBase + "/" + owner + "/" + repo + "/" + branch + "/" + p; + default -> rawBase + "/" + owner + "/" + repo + "/raw/branch/" + branch + "/" + p; + }; + } +} diff --git a/Java/src/main/java/com/gc/core/SystemInfo.java b/Java/src/main/java/com/gc/core/SystemInfo.java new file mode 100644 index 0000000..68c35c7 --- /dev/null +++ b/Java/src/main/java/com/gc/core/SystemInfo.java @@ -0,0 +1,223 @@ +package com.gc.core; + +import java.awt.*; +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.lang.management.ManagementFactory; +import java.lang.management.MemoryMXBean; +import java.lang.management.MemoryPoolMXBean; +import java.lang.management.MemoryUsage; +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.nio.charset.StandardCharsets; +import java.nio.file.FileStore; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Locale; +import java.util.concurrent.TimeUnit; + +/** 百宝箱使用的系统信息采集(CPU / 内存 / GPU / 磁盘 / 网络 / OpenGL)。 */ +public final class SystemInfo { + private SystemInfo() {} + + public record Cpu(String model, int cores, double systemLoad, double processLoad) {} + public record Memory(long total, long free, long used, long heapUsed, long heapMax) {} + public record Gpu(String model, String driver, String vram, String opengl) {} + public record Disk(long total, long free) {} + public record Network(List localIps, String publicIp, String location, String isp, long latencyMs) {} + public record Snapshot(String os, String arch, String java, long uptimeMs, String screen, Cpu cpu, + Memory memory, Gpu gpu, Disk disk) {} + + public static Snapshot snapshot() { + MemoryMXBean mm = ManagementFactory.getMemoryMXBean(); + MemoryUsage heap = mm.getHeapMemoryUsage(); + long total = 0, free = 0; + try { + com.sun.management.OperatingSystemMXBean os = + (com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean(); + total = os.getTotalMemorySize(); + free = os.getFreeMemorySize(); + } catch (Throwable ignored) { + total = Runtime.getRuntime().maxMemory(); + free = Runtime.getRuntime().freeMemory(); + } + Memory mem = new Memory(total, free, total - free, heap.getUsed(), heap.getMax()); + + double sysLoad = -1, procLoad = -1; + try { + com.sun.management.OperatingSystemMXBean os = + (com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean(); + sysLoad = os.getCpuLoad(); + procLoad = os.getProcessCpuLoad(); + } catch (Throwable ignored) { } + Cpu cpu = new Cpu(cpuModel(), Runtime.getRuntime().availableProcessors(), sysLoad, procLoad); + + String screen = "—"; + try { + GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); + DisplayMode dm = gd.getDisplayMode(); + screen = dm.getWidth() + " × " + dm.getHeight() + " @ " + dm.getRefreshRate() + " Hz"; + } catch (Throwable ignored) { } + + return new Snapshot(System.getProperty("os.name", "?") + " " + System.getProperty("os.version", ""), + System.getProperty("os.arch", "?"), System.getProperty("java.version", "?") + " / " + + System.getProperty("java.vendor", ""), ManagementFactory.getRuntimeMXBean().getUptime(), + screen + " · " + availableProcessorsText(), cpu, mem, gpu(), disk()); + } + + private static String availableProcessorsText() { + return Runtime.getRuntime().availableProcessors() + " 线程"; + } + + public static String cpuModel() { + String os = System.getProperty("os.name", "").toLowerCase(Locale.ROOT); + try { + if (os.contains("mac")) { + String s = run(900, "sysctl", "-n", "machdep.cpu.brand_string"); + if (s != null && !s.isBlank()) return s.trim(); + } else if (os.contains("linux")) { + Path p = Path.of("/proc/cpuinfo"); + if (Files.isRegularFile(p)) { + for (String line : Files.readAllLines(p, StandardCharsets.UTF_8)) { + if (line.toLowerCase(Locale.ROOT).startsWith("model name")) { + return line.substring(line.indexOf(':') + 1).trim(); + } + } + } + } else if (os.contains("win")) { + String s = run(1200, "powershell", "-NoProfile", "-Command", + "(Get-CimInstance Win32_Processor | Select-Object -First 1 -ExpandProperty Name)"); + if (s != null && !s.isBlank()) return s.trim(); + s = System.getenv("PROCESSOR_IDENTIFIER"); + if (s != null && !s.isBlank()) return s; + } + } catch (Throwable ignored) { } + return System.getProperty("os.arch", "Unknown CPU"); + } + + public static Gpu gpu() { + String os = System.getProperty("os.name", "").toLowerCase(Locale.ROOT); + String model = "—", driver = "—", vram = "—", opengl = "—"; + try { + if (os.contains("mac")) { + String s = run(2500, "system_profiler", "SPDisplaysDataType"); + if (s != null) { + for (String line : s.split("\n")) { + String t = line.trim(); + if (t.startsWith("Chipset Model:")) model = t.substring(t.indexOf(':') + 1).trim(); + else if (t.startsWith("Metal Support:")) driver = t.substring(t.indexOf(':') + 1).trim(); + else if (t.startsWith("Total Number of Cores:")) vram = t.substring(t.indexOf(':') + 1).trim() + " 核心"; + else if (t.startsWith("Resolution:") || t.startsWith("分辨率:")) { + String v = t.substring(t.indexOf(':') + 1).trim(); + if (v.length() < 80) vram = v; + } + } + } + } else if (os.contains("win")) { + String s = run(1800, "powershell", "-NoProfile", "-Command", + "Get-CimInstance Win32_VideoController | Select-Object -First 1 Name,DriverVersion,AdapterRAM | Format-List"); + if (s != null) { + for (String line : s.split("\n")) { + String t = line.trim(); + if (t.startsWith("Name")) model = afterColon(t); + else if (t.startsWith("DriverVersion")) driver = afterColon(t); + else if (t.startsWith("AdapterRAM")) vram = Hash.humanSize(parseLong(afterColon(t))); + } + } + } else { + String s = run(1500, "sh", "-c", "lspci 2>/dev/null | grep -i -E 'vga|3d|display' | head -1"); + if (s != null && !s.isBlank()) model = s.trim(); + } + } catch (Throwable ignored) { } + try { + Class gp = Class.forName("com.jogamp.opengl.GLProfile"); + Object prof = gp.getMethod("getDefault").invoke(null); + opengl = String.valueOf(prof); + if (opengl.contains("GLProfile[")) opengl = opengl.substring(opengl.indexOf('[') + 1, opengl.length() - 1); + } catch (Throwable t) { + opengl = "JOGL 未加载"; + } + return new Gpu(model.isBlank() ? "—" : model, driver, vram, opengl); + } + + private static String afterColon(String t) { + int i = t.indexOf(':'); + return i < 0 ? t : t.substring(i + 1).trim(); + } + + private static long parseLong(String s) { + try { return Long.parseLong(s.replaceAll("[^0-9]", "")); } catch (Exception e) { return 0; } + } + + public static Disk disk() { + try { + Path home = Path.of(System.getProperty("user.home")); + FileStore fs = Files.getFileStore(home); + return new Disk(fs.getTotalSpace(), fs.getUsableSpace()); + } catch (Exception e) { + return new Disk(0, 0); + } + } + + public static Network network() { + List ips = new ArrayList<>(); + try { + for (NetworkInterface ni : Collections.list(NetworkInterface.getNetworkInterfaces())) { + if (!ni.isUp() || ni.isLoopback()) continue; + for (InetAddress a : Collections.list(ni.getInetAddresses())) { + if (a.getHostAddress().contains(":")) continue; + ips.add(a.getHostAddress() + " (" + ni.getDisplayName() + ")"); + } + } + } catch (Exception ignored) { } + if (ips.isEmpty()) ips.add("未检测到局域网地址"); + String pub = "—", loc = "—", isp = "—"; + long latency = -1; + try { + long start = System.nanoTime(); + String ip = Http.getString("https://api.ipify.org?format=json"); + latency = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start); + pub = Json.str(Json.obj(Json.parse(ip)), "ip", "—"); + try { + String detail = Http.getString("https://ipapi.co/" + pub + "/json/"); + var m = Json.obj(Json.parse(detail)); + String city = Json.str(m, "city", ""); + String region = Json.str(m, "region", ""); + String country = Json.str(m, "country_name", ""); + loc = (country + " " + region + " " + city).trim(); + isp = Json.str(m, "org", "—"); + } catch (Exception ignored) { } + } catch (Exception e) { + pub = "离线 / 无法访问"; + } + return new Network(ips, pub, loc.isBlank() ? "—" : loc, isp, latency); + } + + public static long optimizeMemory() { + MemoryUsage before = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage(); + for (MemoryPoolMXBean pool : ManagementFactory.getMemoryPoolMXBeans()) { + try { pool.resetPeakUsage(); } catch (Throwable ignored) { } + } + System.gc(); + System.runFinalization(); + System.gc(); + MemoryUsage after = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage(); + return Math.max(0, before.getUsed() - after.getUsed()); + } + + private static String run(long timeoutMs, String... cmd) { + try { + Process p = new ProcessBuilder(cmd).redirectErrorStream(true).start(); + if (!p.waitFor(timeoutMs, TimeUnit.MILLISECONDS)) { p.destroyForcibly(); return null; } + StringBuilder sb = new StringBuilder(); + try (BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream(), StandardCharsets.UTF_8))) { + String line; + while ((line = r.readLine()) != null) sb.append(line).append('\n'); + } + return sb.toString(); + } catch (Exception e) { return null; } + } +} diff --git a/Java/src/main/java/com/gc/core/UpdateService.java b/Java/src/main/java/com/gc/core/UpdateService.java new file mode 100644 index 0000000..7816127 --- /dev/null +++ b/Java/src/main/java/com/gc/core/UpdateService.java @@ -0,0 +1,208 @@ +package com.gc.core; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import java.time.Instant; +import java.util.*; +import java.util.function.Consumer; + +/** 读远端版本清单、验签、下载模型并原子安装;启动器包只下载待下次应用。 */ +public final class UpdateService { + public enum Outcome { NO_CHANGE, APPLIED, PARTIAL, UNAVAILABLE, DISABLED } + public record Progress(double value, String message, String detail) {} + public record Result(Outcome outcome, String message, int updatedModels, + List modelNames, String error, String launcherPending, + Remote.RepoVersion manifest) {} + + private final AppPaths paths; + private final Settings settings; + + public UpdateService(AppPaths paths, Settings settings) { + this.paths = paths; + this.settings = settings; + } + + public Remote createRemote() { + if (settings.updateLocalRoot != null && !settings.updateLocalRoot.isBlank() + && Files.isDirectory(Path.of(settings.updateLocalRoot))) + return new LocalRemote(Path.of(settings.updateLocalRoot)); + return new GiteaRemote(SourcePreset.detect(settings.updateRepository)); + } + + public Result run(boolean force, Consumer progress) { + if (!force && !settings.autoUpdateOnStartup) + return new Result(Outcome.DISABLED, I18n.t("update.disabled"), 0, List.of(), null, null, null); + Remote remote = createRemote(); + progress.accept(new Progress(0.02, I18n.t("update.checking"), remote.displayName())); + + Remote.RepoVersion rv; + try { + rv = remote.manifest(); + if (rv == null) + return new Result(Outcome.UNAVAILABLE, I18n.t("update.noManifest"), 0, List.of(), null, null, null); + } catch (Exception e) { + Log.warn("更新检查失败: " + e.getMessage(), "Update check failed: " + e.getMessage()); + return new Result(Outcome.UNAVAILABLE, I18n.t("update.offline"), 0, List.of(), e.getMessage(), null, null); + } + + boolean allowUnsigned = paths.development || !settings.requireSignedManifest + || "1".equals(System.getenv("GC_ALLOW_UNSIGNED_MANIFEST")); + if (!rv.trusted && !allowUnsigned) { + String reason = rv.trust.equals("UNSIGNED") ? "清单未签名" : "清单签名无效(内容可能被篡改)"; + Log.warn(reason + ",已拒绝本次更新", reason + " — update rejected"); + return new Result(Outcome.UNAVAILABLE, reason + ",已拒绝更新", 0, List.of(), rv.error, null, rv); + } + settings.lastUpdateCheck = Instant.now().toString(); + settings.save(); + + List needed = new ArrayList<>(); + for (Remote.RepoModel m : rv.models) if (needsModel(m)) needed.add(m); + + List updated = new ArrayList<>(); + List errors = new ArrayList<>(); + for (int i = 0; i < needed.size(); i++) { + Remote.RepoModel m = needed.get(i); + progress.accept(new Progress(0.05 + 0.65 * i / Math.max(1, needed.size()), + I18n.f("update.downloadingModel", m.id()), m.version())); + try { + installModel(remote, m, pk -> {}); + settings.installedModelVersions.put(m.id(), m.version()); + settings.save(); + updated.add(m.id()); + Log.info("模型已更新: " + m.id() + " " + m.version(), "Model updated: " + m.id() + " " + m.version()); + } catch (Exception e) { + errors.add(m.id() + ": " + e.getMessage()); + Log.error("模型更新失败 " + m.id() + ": " + e.getMessage(), "Model update failed " + m.id() + ": " + e.getMessage()); + } + } + + String launcherPending = null; + try { + launcherPending = downloadLauncher(remote, rv, progress); + } catch (Exception e) { + Log.warn("启动器更新下载失败: " + e.getMessage(), "Launcher update download failed: " + e.getMessage()); + } + + progress.accept(new Progress(1, I18n.t("update.done"), "")); + Outcome outcome = !errors.isEmpty() ? Outcome.PARTIAL + : (!updated.isEmpty() || launcherPending != null) ? Outcome.APPLIED : Outcome.NO_CHANGE; + String msg = updated.isEmpty() + ? (launcherPending != null ? I18n.t("update.modelsLatest") : I18n.t("update.noChange")) + : I18n.f("update.applied", updated.size()); + if (!errors.isEmpty()) msg += I18n.f("update.partial", errors.size()); + return new Result(outcome, msg, updated.size(), updated, + errors.isEmpty() ? null : String.join("; ", errors), launcherPending, rv); + } + + private boolean needsModel(Remote.RepoModel m) { + if (m.id() == null || m.id().isBlank() || m.version() == null || m.version().isBlank()) return false; + Path dir = paths.modelRoot.resolve(m.id()); + Path mf = dir.resolve(m.id() + ".json"); + if (!Files.isRegularFile(mf) || !Files.isDirectory(dir.resolve(m.id() + ".model"))) return true; + try { + ModelManifest local = ModelManifest.parse(Json.obj(Json.parse(mf))); + // 只在远端版本更高时更新;本地更高(离线改过的 Java 数据)绝不被旧版覆盖 + return VersionUtil.compare(m.version(), local.version) > 0; + } catch (Exception e) { return true; } + } + + private void installModel(Remote remote, Remote.RepoModel model, Consumer progress) throws Exception { + String rootPath = model.dir() == null || model.dir().isBlank() ? "model/" + model.id() : model.dir(); + List tree = remote.listTree(rootPath); + List files = new ArrayList<>(); + for (Remote.RepoEntry e : tree) { + if (e.directory()) continue; + if (isPayload(model.id(), e.relativePath())) files.add(e); + } + boolean hasManifest = files.stream().anyMatch(e -> e.relativePath().equalsIgnoreCase(model.id() + ".json")); + if (!hasManifest) throw new IOException("远端缺少模型清单 " + model.id() + ".json"); + if (files.stream().noneMatch(e -> e.relativePath().toLowerCase().startsWith(model.id().toLowerCase() + ".model/"))) + throw new IOException("远端缺少模型数据 " + model.id() + ".model/"); + + Path staging = paths.cacheRoot().resolve("models").resolve(model.id() + "-" + safe(model.version())); + AppPaths.deleteTree(staging); + Files.createDirectories(staging); + try { + long total = Math.max(1, files.stream().mapToLong(f -> Math.max(1, f.size())).sum()); + long done = 0; + for (Remote.RepoEntry f : files) { + Path dest = staging.resolve(f.relativePath()).normalize(); + if (!dest.startsWith(staging)) throw new IOException("路径越界: " + f.relativePath()); + Files.createDirectories(dest.getParent()); + byte[] bytes = remote.download(f); + Files.write(dest, bytes); + done += Math.max(1, bytes.length); + progress.accept(new Progress(0.05 + 0.6 * done / total, model.id(), f.relativePath())); + } + if (model.manifestSha256() != null && !model.manifestSha256().isBlank()) { + String actual = Hash.file(staging.resolve(model.id() + ".json")); + if (!actual.equalsIgnoreCase(model.manifestSha256())) + throw new IOException("模型清单哈希不匹配"); + } + if (model.filesSha256() != null && !model.filesSha256().isBlank()) { + String actual = Hash.dir(staging.resolve(model.id() + ".model")); + if (!actual.equalsIgnoreCase(model.filesSha256())) + throw new IOException("模型文件哈希不匹配"); + } + Path target = paths.modelRoot.resolve(model.id()); + Path backup = paths.modelRoot.resolve(model.id() + ".old"); + AppPaths.deleteTree(backup); + if (Files.exists(target)) Files.move(target, backup, StandardCopyOption.REPLACE_EXISTING); + try { Files.move(staging, target); } + catch (IOException e) { + if (!Files.exists(target) && Files.exists(backup)) Files.move(backup, target); + throw e; + } + AppPaths.deleteTree(backup); + Security.writeIntegrity(target, model.id(), model.manifestSha256(), model.filesSha256()); + } catch (Exception e) { + AppPaths.deleteTree(staging); + throw e; + } + } + + private static boolean isPayload(String id, String rel) { + String r = rel.replace('\\', '/'); + if (r.startsWith("/") || r.contains("..")) return false; + return r.equalsIgnoreCase(id + ".json") || r.toLowerCase().startsWith(id.toLowerCase() + ".model/"); + } + + private String safe(String s) { return s.replaceAll("[^A-Za-z0-9._-]", "_"); } + + private String downloadLauncher(Remote remote, Remote.RepoVersion rv, Consumer progress) throws Exception { + if (rv.launcherVersion == null || rv.launcherVersion.isBlank()) return null; + if (VersionUtil.compare(rv.launcherVersion, settings.launcherVersion) <= 0) return null; + String rid = AppPaths.rid(); + Remote.RepoPackage pkg = rv.packages.get(rid); + if (pkg == null) { + Log.warn(I18n.f("update.noRidPackage", rv.launcherVersion, rid)); + return null; + } + String url = pkg.url(); + if (url == null || url.isBlank()) { + if (pkg.path() == null || pkg.path().isBlank()) return null; + url = remote.rawUrl(pkg.path()); + } + progress.accept(new Progress(0.8, I18n.f("update.downloadingLauncher", rv.launcherVersion), url)); + byte[] bytes = remote.downloadPackage(url); + if (pkg.sha256() != null && !pkg.sha256().isBlank() + && !Hash.sha256(bytes).equalsIgnoreCase(pkg.sha256())) + throw new IOException("启动器包 sha256 不匹配"); + Files.createDirectories(paths.updateRoot()); + String name = pkg.name() == null || pkg.name().isBlank() + ? "GCL-" + rv.launcherVersion + "-" + rid + ".zip" : pkg.name(); + Path zip = paths.updateRoot().resolve(name); + Files.write(zip, bytes); + Map req = new LinkedHashMap<>(); + req.put("package", zip.toAbsolutePath().toString()); + req.put("version", rv.launcherVersion); + req.put("installDir", paths.installDir.toAbsolutePath().toString()); + req.put("sha256", Hash.sha256(bytes)); + req.put("createdAt", Instant.now().toString()); + Files.writeString(paths.updateRoot().resolve("apply-request.json"), Json.write(req, true, false) + "\n"); + settings.pendingLauncherVersion = rv.launcherVersion; + settings.save(); + return rv.launcherVersion; + } +} diff --git a/Java/src/main/java/com/gc/core/Updater.java b/Java/src/main/java/com/gc/core/Updater.java new file mode 100644 index 0000000..2c68b05 --- /dev/null +++ b/Java/src/main/java/com/gc/core/Updater.java @@ -0,0 +1,158 @@ +package com.gc.core; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import java.time.Instant; +import java.util.*; + +/** + * 更新守护进程(对应 C# GC-SAVEDOG):验签 / 验哈希 / 安全解压 / 备份替换 / 回滚。 + * 用法:gc savedog verify | apply | status | keygen | sign。 + */ +public final class Updater { + private final AppPaths paths; + + public Updater(AppPaths paths) { this.paths = paths; } + + public int verify(String manifest) { + try { + String text = Files.readString(Path.of(manifest), StandardCharsets.UTF_8); + Security.Verification v = Security.verifyManifest(text, true); + System.out.println("trust=" + v.trust() + " keyId=" + (v.keyId() == null ? "" : v.keyId()) + + (v.error() == null ? "" : " error=" + v.error())); + return v.trust() == Security.Trust.VERIFIED || v.trust() == Security.Trust.SKIPPED ? 0 : 2; + } catch (Exception e) { + System.out.println("trust=INVALID error=" + e.getMessage()); + return 2; + } + } + + public int apply() { + Path request = paths.updateRoot().resolve("apply-request.json"); + if (!Files.isRegularFile(request)) { System.out.println("没有待应用的更新"); return 1; } + try { + Map req = Json.obj(Json.parse(request)); + Path zip = Path.of(Json.str(req, "package", "")); + Path installDir = Path.of(Json.str(req, "installDir", paths.installDir.toString())); + String expectedSha = Json.str(req, "sha256", ""); + String version = Json.str(req, "version", ""); + if (!Files.isRegularFile(zip)) throw new IOException("更新包不存在: " + zip); + if (!expectedSha.isBlank() && !Hash.file(zip).equalsIgnoreCase(expectedSha)) + throw new IOException("更新包哈希不匹配"); + + Path stage = paths.updateRoot().resolve("stage"); + Path backup = paths.updateRoot().resolve("backup"); + AppPaths.deleteTree(stage); + AppPaths.deleteTree(backup); + Security.extractZipSafe(zip, stage); + Path source = stage; + // 如果压缩包只有一个顶层目录,替换目录内容 + try (DirectoryStream ds = Files.newDirectoryStream(stage)) { + List top = new ArrayList<>(); + for (Path p : ds) top.add(p); + if (top.size() == 1 && Files.isDirectory(top.get(0))) source = top.get(0); + } + List replaced = new ArrayList<>(); + try { + try (var walk = Files.walk(source)) { + for (Path p : walk.toList()) { + if (p.equals(source)) continue; + String rel = source.relativize(p).toString().replace('\\', '/'); + if (rel.isEmpty()) continue; + String first = rel.split("/")[0]; + if (first.equals(".GC") || first.equals("config") || first.equals("model") + || first.equals("cache") || first.equals("logs") || first.equals("update") + || first.equals("safedog") || first.equals("user")) continue; + Path target = installDir.resolve(rel).normalize(); + if (!target.startsWith(installDir)) throw new IOException("路径越界: " + rel); + if (Files.isDirectory(p)) { Files.createDirectories(target); continue; } + if (Files.exists(target)) { + Path bak = backup.resolve(rel); + Files.createDirectories(bak.getParent()); + Files.copy(target, bak, StandardCopyOption.REPLACE_EXISTING); + } + Files.createDirectories(target.getParent()); + Files.copy(p, target, StandardCopyOption.REPLACE_EXISTING); + replaced.add(target); + } + } + writeState("applied", version, null); + writeLastGood(version); + System.out.println("更新已应用: " + version + "(替换 " + replaced.size() + " 个文件)"); + Files.deleteIfExists(request); + return 0; + } catch (Exception e) { + // 回滚 + try (var walk = Files.walk(backup)) { + for (Path p : walk.toList()) { + if (Files.isDirectory(p)) continue; + Path target = installDir.resolve(backup.relativize(p).toString()); + Files.createDirectories(target.getParent()); + Files.copy(p, target, StandardCopyOption.REPLACE_EXISTING); + } + } catch (Exception ignored) { } + writeState("rolledback", version, e.getMessage()); + System.err.println("更新失败,已回滚: " + e.getMessage()); + return 3; + } + } catch (Exception e) { + System.err.println("应用更新失败: " + e.getMessage()); + writeState("failed", "", e.getMessage()); + return 3; + } + } + + private void writeState(String state, String version, String error) { + try { + Map m = new LinkedHashMap<>(); + m.put("state", state); + m.put("version", version); + m.put("error", error); + m.put("time", Instant.now().toString()); + Files.createDirectories(paths.updateRoot()); + Files.writeString(paths.updateRoot().resolve("state.json"), Json.write(m, true, false) + "\n"); + } catch (IOException ignored) { } + } + + private void writeLastGood(String version) throws IOException { + Map m = new LinkedHashMap<>(); + m.put("version", version); + m.put("time", Instant.now().toString()); + Files.writeString(paths.updateRoot().resolve("last-good.json"), Json.write(m, true, false) + "\n"); + } + + public void status() { + for (String f : new String[]{"apply-request.json", "state.json", "last-good.json", "health.json"}) { + Path p = paths.updateRoot().resolve(f); + System.out.println("== " + f + (Files.isRegularFile(p) ? "" : " (无)")); + if (Files.isRegularFile(p)) { + try { System.out.println(Files.readString(p).trim()); } catch (IOException ignored) { } + } + } + } + + public int keygen(Path dir, String keyId) { + try { + Security.keygen(dir, keyId); + System.out.println("已生成密钥: " + dir + " keyId=" + keyId); + return 0; + } catch (Exception e) { + System.err.println("生成密钥失败: " + e.getMessage()); + return 2; + } + } + + public int sign(Path manifest, Path key, String keyId) { + try { + String text = Files.readString(manifest, StandardCharsets.UTF_8); + String signed = Security.signManifest(text, Security.loadPrivateKey(key), keyId); + Files.writeString(manifest, signed, StandardCharsets.UTF_8); + System.out.println("已签名: " + manifest); + return 0; + } catch (Exception e) { + System.err.println("签名失败: " + e.getMessage()); + return 2; + } + } +} diff --git a/Java/src/main/java/com/gc/core/UserService.java b/Java/src/main/java/com/gc/core/UserService.java new file mode 100644 index 0000000..8bc305a --- /dev/null +++ b/Java/src/main/java/com/gc/core/UserService.java @@ -0,0 +1,381 @@ +package com.gc.core; + +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.security.MessageDigest; +import java.security.SecureRandom; +import java.time.Duration; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; + +/** + * 本地用户系统,完整复刻原 GC.UI.Server.UserService 的业务规则: + * 注册 / 登录 / 30 天周期签到 / 积分 / 每日人品值(阶梯计费)/ + * 二选一(自定义选项、阶梯计费)/ 主题色购买与 1 小时 80% 退款。 + * + *

密码只保存 SHA-512(salt + ":" + password),不保存明文;数据位于 + * {@code .GC/user/users.json},会话位于 {@code .GC/user/session.json}。

+ */ +public final class UserService { + public static final String DEFAULT_THEME_COLOR = "4A90D9"; + public static final int PRESET_COLOR_COST = 50; + public static final int CUSTOM_COLOR_COST = 150; + public static final int SIGN_IN_CYCLE = 30; + public static final double REFUND_RATE = 0.8; + + public static final String[] PRESET_COLORS = { + "4A90D9", "E74C3C", "27AE60", "9B59B6", "F39C12", "1ABC9C", "E91E63", "2C3E50" + }; + public static final String[] PRESET_NAMES = { + "蓝色", "红色", "绿色", "紫色", "橙色", "青色", "粉色", "深蓝" + }; + + public record Result(boolean ok, String message) {} + public record FortuneResult(boolean ok, String message, int value, String comment, double cost) {} + public record PickResult(boolean ok, String message, String choice, double cost) {} + public record Profile(String username, double points, int consecutiveDays, int cycleDay, int cycleDays, + int nextReward, String themeColor, boolean signedToday, boolean fortuneToday, + boolean pickToday, int refundSeconds, double fortuneCost, double pickCost, + int fortuneCount, int pickCount) {} + + private final Path dir; + private final Path usersFile; + private final Path sessionFile; + private final Map> users = new LinkedHashMap<>(); + private String current; + private final SecureRandom random = new SecureRandom(); + + public UserService(Path homeRoot) { + dir = homeRoot.resolve("user"); + usersFile = dir.resolve("users.json"); + sessionFile = dir.resolve("session.json"); + try { Files.createDirectories(dir); } catch (Exception ignored) { } + load(); + } + + // ---------------------------------------------------------------- 持久化 + + private synchronized void load() { + try { + if (Files.isRegularFile(usersFile)) { + Map m = Json.obj(Json.parse(usersFile)); + for (var e : m.entrySet()) users.put(e.getKey(), new LinkedHashMap<>(Json.obj(e.getValue()))); + } + } catch (Exception e) { System.err.println("[user] 读取用户失败: " + e.getMessage()); } + try { + if (Files.isRegularFile(sessionFile)) + current = Json.str(Json.obj(Json.parse(sessionFile)), "user", ""); + } catch (Exception ignored) { } + if (current != null && !users.containsKey(current)) current = null; + } + + private synchronized void save() { + try { + Files.createDirectories(dir); + Files.writeString(usersFile, Json.write(new LinkedHashMap<>(users), true, false) + "\n", StandardCharsets.UTF_8); + Map s = new LinkedHashMap<>(); + s.put("user", current == null ? "" : current); + Files.writeString(sessionFile, Json.write(s, true, false) + "\n", StandardCharsets.UTF_8); + } catch (Exception e) { System.err.println("[user] 保存用户失败: " + e.getMessage()); } + } + + // ---------------------------------------------------------------- 会话 + + public synchronized boolean loggedIn() { return current != null; } + public synchronized String currentUser() { return current; } + + public synchronized Profile profile() { + Map u = me(); + if (u == null) return null; + LocalDate today = LocalDate.now(); + int streak = Json.i(u, "consecutiveDays", 0); + boolean signed = today.toString().equals(Json.str(u, "lastSignIn", "")); + int nextConsecutive = signed ? streak + 1 : nextStreak(u, today); + int fortuneCount = countToday(u, "fortuneDate", "fortuneCount"); + int pickCount = countToday(u, "pickDate", "pickCount"); + return new Profile(Json.str(u, "username", current), round2(Json.d(u, "points", 0)), streak, + cycleDay(streak), SIGN_IN_CYCLE, signInReward(cycleDay(nextConsecutive)), + normalizeHex(Json.str(u, "themeColor", DEFAULT_THEME_COLOR)).isEmpty() + ? DEFAULT_THEME_COLOR : normalizeHex(Json.str(u, "themeColor", DEFAULT_THEME_COLOR)), + signed, fortuneCount > 0, pickCount > 0, refundSeconds(u), + fortuneCost(fortuneCount), pickCost(pickCount), fortuneCount, pickCount); + } + + private int nextStreak(Map u, LocalDate today) { + LocalDate last = date(Json.str(u, "lastSignIn", "")); + return last != null && last.plusDays(1).equals(today) + ? Json.i(u, "consecutiveDays", 0) + 1 : 1; + } + + // ---------------------------------------------------------------- 账号 + + public synchronized Result register(String username, String password) { + String name = username == null ? "" : username.trim(); + if (name.length() < 1 || name.length() > 20) return new Result(false, "用户名需为 1–20 个字符"); + if (name.matches(".*\\s.*")) return new Result(false, "用户名不能包含空格"); + if (!name.matches("^[A-Za-z0-9_\\u4e00-\\u9fa5]+$")) return new Result(false, "用户名只能包含字母、数字、下划线或汉字"); + if (password == null || password.length() < 6) return new Result(false, "密码至少 6 位"); + String key = name.toLowerCase(Locale.ROOT); + if (users.containsKey(key)) return new Result(false, "用户名已存在,请换一个"); + String salt = newSalt(); + Map u = new LinkedHashMap<>(); + u.put("username", name); + u.put("salt", salt); + u.put("hash", hash(salt, password)); + u.put("points", 0); + u.put("consecutiveDays", 0); + u.put("lastSignIn", ""); + u.put("themeColor", DEFAULT_THEME_COLOR); + u.put("themePaid", 0); + u.put("themePaidAt", ""); + u.put("fortuneDate", ""); + u.put("fortuneCount", 0); + u.put("pickDate", ""); + u.put("pickCount", 0); + users.put(key, u); + current = key; + save(); + return new Result(true, "注册成功,已自动登录"); + } + + public synchronized Result login(String username, String password) { + String key = username == null ? "" : username.trim().toLowerCase(Locale.ROOT); + Map u = users.get(key); + if (u == null) return new Result(false, "用户名或密码错误"); + if (!hash(Json.str(u, "salt", ""), password == null ? "" : password).equals(Json.str(u, "hash", ""))) + return new Result(false, "用户名或密码错误"); + current = key; + save(); + return new Result(true, "欢迎回来," + Json.str(u, "username", key)); + } + + public synchronized void logout() { current = null; save(); } + + // ---------------------------------------------------------------- 签到 + + public static int cycleDay(int consecutiveDays) { + if (consecutiveDays < 1) return 1; + return ((consecutiveDays - 1) % SIGN_IN_CYCLE) + 1; + } + + public static int signInReward(int cycleDay) { + int d = Math.max(1, Math.min(SIGN_IN_CYCLE, cycleDay)); + return switch (d) { + case 7 -> 30; + case 14 -> 40; + case 21 -> 50; + case 28 -> 60; + case 30 -> 100; + default -> d <= 6 ? 10 : d <= 13 ? 15 : d <= 20 ? 20 : d <= 27 ? 25 : 40; + }; + } + + public synchronized Result signIn() { + Map u = me(); + if (u == null) return new Result(false, "请先登录"); + LocalDate today = LocalDate.now(); + LocalDate last = date(Json.str(u, "lastSignIn", "")); + if (last != null && last.equals(today)) return new Result(false, "今日已签到"); + int streak; + if (last != null) { + long diff = Duration.between(last.atStartOfDay(), today.atStartOfDay()).toDays(); + streak = diff == 1 ? Json.i(u, "consecutiveDays", 0) + 1 : 1; + } else streak = 1; + int reward = signInReward(cycleDay(streak)); + u.put("consecutiveDays", streak); + u.put("lastSignIn", today.toString()); + u.put("points", round2(Json.d(u, "points", 0) + reward)); + save(); + return new Result(true, "签到成功 +" + reward + " 积分(连续 " + streak + " 天)"); + } + + // ---------------------------------------------------------------- 人品值 / 二选一 + + public static double fortuneCost(int paidIndexToday) { + if (paidIndexToday <= 0) return 0; + if (paidIndexToday <= 5) return 0.1; + if (paidIndexToday <= 10) return 0.2; + if (paidIndexToday <= 25) return 0.5; + return 1; + } + + public static double pickCost(int paidIndexToday) { + return paidIndexToday <= 0 ? 0 : 0.5; + } + + public synchronized FortuneResult fortune() { + Map u = me(); + if (u == null) return new FortuneResult(false, "请先登录", 0, "", 0); + int count = countToday(u, "fortuneDate", "fortuneCount"); + double cost = fortuneCost(count); + double points = Json.d(u, "points", 0); + if (points < cost) return new FortuneResult(false, "积分不足,本次需要 " + fmt(cost) + " 积分", 0, "", cost); + points = round2(points - cost); + int value = random.nextInt(101); + u.put("points", points); + u.put("fortuneDate", LocalDate.now().toString()); + u.put("fortuneCount", count + 1); + save(); + return new FortuneResult(true, cost > 0 ? "本次消耗 " + fmt(cost) + " 积分" : "今日首次免费", + value, fortuneComment(value), cost); + } + + public static String fortuneComment(int value) { + if (value >= 96) return "欧皇附体,今天买彩票吧"; + if (value >= 90) return "运气爆棚,适合干大事"; + if (value >= 80) return "手气不错,稳"; + if (value >= 65) return "中上水平,稍微努一下"; + if (value >= 50) return "普普通通,够用"; + if (value >= 35) return "有点背,低调点"; + if (value >= 20) return "今天别赌任何东西"; + if (value >= 8) return "极差,建议躺平"; + return "非酋之王,明天再来"; + } + + public synchronized PickResult pick(String optionA, String optionB) { + Map u = me(); + if (u == null) return new PickResult(false, "请先登录", "", 0); + String a = optionA == null ? "" : optionA.trim(); + String b = optionB == null ? "" : optionB.trim(); + if (a.isEmpty() || b.isEmpty()) return new PickResult(false, "两个选项都不能为空", "", 0); + int count = countToday(u, "pickDate", "pickCount"); + double cost = pickCost(count); + double points = Json.d(u, "points", 0); + if (points < cost) return new PickResult(false, "积分不足,本次需要 " + fmt(cost) + " 积分", "", cost); + points = round2(points - cost); + String choice = random.nextBoolean() ? a : b; + u.put("points", points); + u.put("pickDate", LocalDate.now().toString()); + u.put("pickCount", count + 1); + save(); + return new PickResult(true, cost > 0 ? "本次消耗 " + fmt(cost) + " 积分" : "今日首次免费", choice, cost); + } + + // ---------------------------------------------------------------- 主题色 + + public static String normalizeHex(String hex) { + if (hex == null) return ""; + String h = hex.trim(); + if (h.startsWith("#")) h = h.substring(1); + if (h.startsWith("0x") || h.startsWith("0X")) h = h.substring(2); + if (h.length() != 6) return ""; + for (char c : h.toCharArray()) if (!isHex(c)) return ""; + return h.toUpperCase(Locale.ROOT); + } + + private static boolean isHex(char c) { + return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); + } + + public static int themeCost(String hex) { + String h = normalizeHex(hex); + if (h.isEmpty()) return -1; + if (h.equals(DEFAULT_THEME_COLOR)) return 0; + for (String c : PRESET_COLORS) if (c.equalsIgnoreCase(h)) return PRESET_COLOR_COST; + return CUSTOM_COLOR_COST; + } + + public synchronized Result buyTheme(String color) { + return buyTheme(color, false); + } + + public synchronized Result buyTheme(String color, boolean ignoredCustom) { + Map u = me(); + if (u == null) return new Result(false, "请先登录"); + String hex = normalizeHex(color); + if (hex.isEmpty()) return new Result(false, "颜色格式应为 #RRGGBB"); + int cost = themeCost(hex); + String old = normalizeHex(Json.str(u, "themeColor", DEFAULT_THEME_COLOR)); + if (hex.equals(old)) return new Result(false, "当前已经是这个颜色"); + double points = Json.d(u, "points", 0); + double refunded = 0; + double paid = Json.d(u, "themePaid", 0); + String paidAt = Json.str(u, "themePaidAt", ""); + if (paid > 0 && !paidAt.isBlank()) { + try { + LocalDateTime t = LocalDateTime.parse(paidAt); + if (Duration.between(t, LocalDateTime.now()).compareTo(Duration.ofHours(1)) <= 0) { + refunded = round2(paid * REFUND_RATE); + points += refunded; + } + } catch (Exception ignored) { } + } + if (points < cost) { + return new Result(false, refunded > 0 + ? "积分不足(含可退 " + fmt(refunded) + ",需 " + cost + ")" + : "积分不足,需要 " + cost + " 积分"); + } + points = round2(points - cost); + u.put("points", points); + u.put("themeColor", hex); + u.put("themePaid", cost); + u.put("themePaidAt", cost > 0 ? LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME) : ""); + save(); + String msg = "已购买并应用主题色 #" + hex; + if (refunded > 0) msg = "旧主题退款 +" + fmt(refunded) + " 积分;" + msg; + return new Result(true, msg); + } + + public synchronized void applySavedTheme(Settings settings) { + Map u = me(); + if (u == null) return; + String c = normalizeHex(Json.str(u, "themeColor", DEFAULT_THEME_COLOR)); + if (!c.isEmpty()) { + settings.accentColor = "#" + c; + settings.save(); + } + } + + // ---------------------------------------------------------------- 工具 + + public static String formatPoints(double v) { + String s = String.format(Locale.ROOT, "%.2f", v); + if (s.endsWith(".00")) return s.substring(0, s.length() - 3); + if (s.endsWith("0")) return s.substring(0, s.length() - 1); + return s; + } + + private static String fmt(double v) { return formatPoints(v); } + + private static double round2(double v) { return Math.round(v * 100.0) / 100.0; } + + private Map me() { return current == null ? null : users.get(current); } + + private int countToday(Map u, String dateKey, String countKey) { + return LocalDate.now().toString().equals(Json.str(u, dateKey, "")) ? Json.i(u, countKey, 0) : 0; + } + + private int refundSeconds(Map u) { + double paid = Json.d(u, "themePaid", 0); + if (paid <= 0) return 0; + try { + LocalDateTime t = LocalDateTime.parse(Json.str(u, "themePaidAt", "")); + long left = Duration.ofHours(1).getSeconds() + - Duration.between(t, LocalDateTime.now()).getSeconds(); + return (int) Math.max(0, left); + } catch (Exception e) { + return 0; + } + } + + private LocalDate date(String s) { + try { return s == null || s.isBlank() ? null : LocalDate.parse(s); } + catch (Exception e) { return null; } + } + + private String newSalt() { + byte[] bytes = new byte[16]; + random.nextBytes(bytes); + return Base64.getEncoder().encodeToString(bytes); + } + + private static String hash(String salt, String password) { + try { + MessageDigest md = MessageDigest.getInstance("SHA-512"); + return HexFormat.of().formatHex(md.digest((password + ":" + salt).getBytes(StandardCharsets.UTF_8))); + } catch (Exception e) { throw new IllegalStateException(e); } + } +} diff --git a/Java/src/main/java/com/gc/core/VersionUtil.java b/Java/src/main/java/com/gc/core/VersionUtil.java new file mode 100644 index 0000000..6f451b1 --- /dev/null +++ b/Java/src/main/java/com/gc/core/VersionUtil.java @@ -0,0 +1,46 @@ +package com.gc.core; + +/** 版本规整与比较,等价于原 GC.Services.VersionUtil。 */ +public final class VersionUtil { + private VersionUtil() {} + + public static String normalize(String tag) { + if (tag == null) return ""; + String s = tag.trim(); + String lower = s.toLowerCase(); + if (lower.startsWith("gcl-")) s = s.substring(4); + else if (lower.startsWith("gc-")) s = s.substring(3); + else if (lower.startsWith("release-")) s = s.substring(8); + int i = 0; + while (i < s.length() && (s.charAt(i) == 'v' || s.charAt(i) == 'V')) i++; + s = s.substring(i); + int end = 0; + while (end < s.length() && (Character.isDigit(s.charAt(end)) || s.charAt(end) == '.')) end++; + s = s.substring(0, end); + while (s.endsWith(".")) s = s.substring(0, s.length() - 1); + return s; + } + + /** 返回 -1 / 0 / 1。 */ + public static int compare(String a, String b) { + int[] aa = parts(normalize(a)); + int[] bb = parts(normalize(b)); + int n = Math.max(aa.length, bb.length); + for (int i = 0; i < n; i++) { + int x = i < aa.length ? aa[i] : 0; + int y = i < bb.length ? bb[i] : 0; + if (x != y) return Integer.compare(x, y); + } + return 0; + } + + private static int[] parts(String v) { + if (v == null || v.isEmpty()) return new int[]{0}; + String[] p = v.split("\\."); + int[] out = new int[p.length]; + for (int i = 0; i < p.length; i++) { + try { out[i] = Integer.parseInt(p[i]); } catch (NumberFormatException e) { out[i] = 0; } + } + return out; + } +} diff --git a/Java/src/main/java/com/gc/model/contour/TerrainAnalyzer.java b/Java/src/main/java/com/gc/model/contour/TerrainAnalyzer.java new file mode 100644 index 0000000..8e581a6 --- /dev/null +++ b/Java/src/main/java/com/gc/model/contour/TerrainAnalyzer.java @@ -0,0 +1,118 @@ +package com.gc.model.contour; + +import java.awt.Color; + +/** 等高线判读:坡度、局部最高、鞍部、曲率与分层设色。 */ +public final class TerrainAnalyzer { + private TerrainAnalyzer() {} + + public static TerrainField.Feature classify(TerrainField f, double u, double v) { + TerrainField.Feature tagged = f.tagAt(u, v); + if (tagged != TerrainField.Feature.NONE) return tagged; + double[] grad = gradient(f, u, v); + double slope = Math.sqrt(grad[0] * grad[0] + grad[1] * grad[1]); + if (slope > 8.5) return TerrainField.Feature.CLIFF; + if (isLocalMax(f, u, v)) return TerrainField.Feature.PEAK; + if (isSaddle(f, u, v)) return TerrainField.Feature.SADDLE; + double curvature = crossCurvature(f, u, v, grad); + if (curvature < -0.55) return TerrainField.Feature.RIDGE; + if (curvature > 0.55) return TerrainField.Feature.VALLEY; + return TerrainField.Feature.SLOPE; + } + + private static double[] gradient(TerrainField f, double u, double v) { + final double h = 0.004; + double du = (f.sampleSmooth(u + h, v) - f.sampleSmooth(u - h, v)) / (2 * h) / 1000.0; + double dv = (f.sampleSmooth(u, v + h) - f.sampleSmooth(u, v - h)) / (2 * h) / 1000.0; + return new double[]{du, dv}; + } + + private static boolean isLocalMax(TerrainField f, double u, double v) { + double c = f.sampleSmooth(u, v); + final double r = 0.035; + double[][] pts = {{r, 0}, {-r, 0}, {0, r}, {0, -r}}; + for (double[] d : pts) { + if (u + d[0] < 0 || u + d[0] > 1 || v + d[1] < 0 || v + d[1] > 1) return false; + if (f.sampleSmooth(u + d[0], v + d[1]) >= c - 4) return false; + } + return true; + } + + private static boolean isSaddle(TerrainField f, double u, double v) { + final double r = 0.05; + if (u - r < 0 || u + r > 1 || v - r < 0 || v + r > 1) return false; + double c = f.sampleSmooth(u, v); + double l = f.sampleSmooth(u - r, v), rt = f.sampleSmooth(u + r, v); + double t = f.sampleSmooth(u, v - r), b = f.sampleSmooth(u, v + r); + boolean horizHigh = l > c + 8 && rt > c + 8; + boolean vertLow = t < c - 8 && b < c - 8; + boolean vertHigh = t > c + 8 && b > c + 8; + boolean horizLow = l < c - 8 && rt < c - 8; + return (horizHigh && vertLow) || (vertHigh && horizLow); + } + + private static double crossCurvature(TerrainField f, double u, double v, double[] grad) { + double len = Math.sqrt(grad[0] * grad[0] + grad[1] * grad[1]); + if (len < 1e-6) return 0; + double nU = -grad[1] / len, nV = grad[0] / len; + final double r = 0.045; + double c = f.sampleSmooth(u, v); + if (u + nU * r < 0 || u + nU * r > 1 || v + nV * r < 0 || v + nV * r > 1) return 0; + if (u - nU * r < 0 || u - nU * r > 1 || v - nV * r < 0 || v - nV * r > 1) return 0; + double a = f.sampleSmooth(u + nU * r, v + nV * r); + double b = f.sampleSmooth(u - nU * r, v - nV * r); + return (a + b - 2 * c) / 1000.0 * 6.0; + } + + public static Color colorForHeight(float h) { + if (h < 200) return new Color(0x1E, 0x6B, 0x3A); + if (h < 400) return new Color(0x4E, 0x9E, 0x4E); + if (h < 600) return new Color(0xA8, 0xC6, 0x66); + if (h < 800) return new Color(0xE8, 0xE2, 0x9A); + if (h < 1000) return new Color(0xE0, 0xC0, 0x5A); + if (h < 1200) return new Color(0xC8, 0x9A, 0x63); + if (h < 1400) return new Color(0xA8, 0x74, 0x4C); + if (h < 1600) return new Color(0xC8, 0xA8, 0x8C); + return new Color(0xF5, 0xF5, 0xF0); + } + + public static Color colorSmooth(float h) { + Color[] stops = { + new Color(0x1E, 0x6B, 0x3A), new Color(0x4E, 0x9E, 0x4E), new Color(0xA8, 0xC6, 0x66), + new Color(0xE8, 0xE2, 0x9A), new Color(0xE0, 0xC0, 0x5A), new Color(0xC8, 0x9A, 0x63), + new Color(0xA8, 0x74, 0x4C), new Color(0xC8, 0xA8, 0x8C), new Color(0xF5, 0xF5, 0xF0)}; + double p = Math.max(0, Math.min(stops.length - 1, h / 200.0 - 0.5)); + int i = (int) Math.floor(p), j = Math.min(i + 1, stops.length - 1); + double t = p - i; + t = t * t * (3 - 2 * t); + return new Color(lerp(stops[i].getRed(), stops[j].getRed(), t), + lerp(stops[i].getGreen(), stops[j].getGreen(), t), + lerp(stops[i].getBlue(), stops[j].getBlue(), t)); + } + + private static int lerp(int a, int b, double k) { return (int) Math.max(0, Math.min(255, a + (b - a) * k)); } + + public static String bandName(float h) { + if (h < 200) return "200 米以下"; + if (h < 400) return "200–400 米"; + if (h < 600) return "400–600 米"; + if (h < 800) return "600–800 米"; + if (h < 1000) return "800–1000 米"; + if (h < 1200) return "1000–1200 米"; + if (h < 1400) return "1200–1400 米"; + if (h < 1600) return "1400–1600 米"; + return "1600 米以上"; + } + + public static String featureLabel(TerrainField.Feature f) { + return switch (f) { + case PEAK -> "山峰"; + case RIDGE -> "山脊"; + case VALLEY -> "山谷"; + case SADDLE -> "鞍部"; + case CLIFF -> "陡崖"; + case SLOPE -> "坡面"; + case NONE -> "—"; + }; + } +} diff --git a/Java/src/main/java/com/gc/model/contour/TerrainField.java b/Java/src/main/java/com/gc/model/contour/TerrainField.java new file mode 100644 index 0000000..6552260 --- /dev/null +++ b/Java/src/main/java/com/gc/model/contour/TerrainField.java @@ -0,0 +1,446 @@ +package com.gc.model.contour; + +import java.util.*; + +/** + * 地形高度场:5 种基本地形 + 5 种典型地貌部位,算法与 C# TerrainField 等价。 + * 高度单位米,网格正方形,u 向东、v 向南,均为 [0,1]。 + */ +public final class TerrainField { + public enum TerrainKind { MOUNTAIN, BASIN, HILL, PLATEAU, PLAIN } + public enum LandformKind { PEAK, RIDGE, VALLEY, SADDLE, CLIFF } + public enum Feature { NONE, PEAK, RIDGE, VALLEY, SADDLE, CLIFF, SLOPE } + + public record Tag(double u, double v, double radius, Feature feature) {} + public record Point(double u, double v) {} + public record PeakPoint(double u, double v, float height) {} + + public final int size; + public final float[][] heights; + public final TerrainKind kind; + public final LandformKind landform; + public float minHeight, maxHeight; + public final List tags = new ArrayList<>(); + public final List river = new ArrayList<>(); + public final List peaks = new ArrayList<>(); + public final List cliffs = new ArrayList<>(); + + public TerrainField(TerrainKind kind, int size) { + this.size = size; + this.kind = kind; + this.landform = null; + heights = new float[size][size]; + build(kind); + } + + public TerrainField(LandformKind landform, int size) { + this.size = size; + this.kind = TerrainKind.MOUNTAIN; + this.landform = landform; + heights = new float[size][size]; + buildLandform(landform); + } + + public float effectiveInterval() { + return switch (kind) { + case PLAIN -> 5f; + case HILL -> 10f; + default -> 100f; + }; + } + + public float heightAt(double u, double v) { + int x = clamp((int) Math.round(u * (size - 1)), 0, size - 1); + int y = clamp((int) Math.round(v * (size - 1)), 0, size - 1); + return heights[y][x]; + } + + public float sampleSmooth(double u, double v) { + double fx = clamp(u, 0, 1) * (size - 1); + double fy = clamp(v, 0, 1) * (size - 1); + int x0 = (int) Math.floor(fx), y0 = (int) Math.floor(fy); + int x1 = Math.min(x0 + 1, size - 1), y1 = Math.min(y0 + 1, size - 1); + double tx = fx - x0, ty = fy - y0; + float h00 = heights[y0][x0], h10 = heights[y0][x1], h01 = heights[y1][x0], h11 = heights[y1][x1]; + double a = h00 * (1 - tx) + h10 * tx; + double b = h01 * (1 - tx) + h11 * tx; + return (float) (a * (1 - ty) + b * ty); + } + + private void build(TerrainKind k) { + switch (k) { + case MOUNTAIN -> buildMountain(); + case BASIN -> buildBasin(); + case HILL -> buildHill(); + case PLATEAU -> buildPlateau(); + case PLAIN -> buildPlain(); + } + buildFeatures(); + } + + private void buildMountain() { + double[][] peaks = { + {0.34, 0.34, 1180, 0.26, 0.24}, {0.66, 0.52, 860, 0.20, 0.20}, + {0.22, 0.70, 520, 0.18, 0.16}, {0.78, 0.22, 430, 0.16, 0.15}}; + float min = Float.MAX_VALUE, max = -Float.MAX_VALUE; + for (int y = 0; y < size; y++) for (int x = 0; x < size; x++) { + double u = (double) x / (size - 1), v = (double) y / (size - 1); + double h = 120; + for (double[] p : peaks) { + double du = (u - p[0]) / p[3], dv = (v - p[1]) / p[4]; + h += p[2] * Math.exp(-(du * du + dv * dv) * 1.15); + } + double valley = Math.abs((u - 0.5) * 0.8 + (v - 0.44) * 0.6); + h -= 210 * Math.exp(-valley * valley / 0.0016); + if (u > 0.86 && v > 0.18 && v < 0.72) h += 260 * smoothStep(0.86, 0.895, u); + if (u < 0.3 && v > 0.6) h += 90 * (1 - u / 0.3) * ((v - 0.6) / 0.4); + h += 18 * Math.sin(u * 9.1) * Math.cos(v * 7.7); + float hf = (float) Math.max(0, h); + heights[y][x] = hf; min = Math.min(min, hf); max = Math.max(max, hf); + } + minHeight = min; maxHeight = max; + tags.clear(); + tags.add(new Tag(0.34, 0.34, 0.045, Feature.PEAK)); + tags.add(new Tag(0.66, 0.52, 0.042, Feature.PEAK)); + tags.add(new Tag(0.50, 0.44, 0.055, Feature.SADDLE)); + tags.add(new Tag(0.90, 0.45, 0.035, Feature.CLIFF)); + tags.add(new Tag(0.22, 0.70, 0.045, Feature.RIDGE)); + tags.add(new Tag(0.50, 0.22, 0.040, Feature.VALLEY)); + } + + private void buildBasin() { + float min = Float.MAX_VALUE, max = -Float.MAX_VALUE; + for (int y = 0; y < size; y++) for (int x = 0; x < size; x++) { + double u = (double) x / (size - 1), v = (double) y / (size - 1); + double du = u - 0.5, dv = v - 0.5, r = Math.sqrt(du * du + dv * dv) * 2.0; + double h = 160 + 900 * Math.pow(clamp(r, 0, 1.15), 2.2); + double gap = Math.abs(Math.atan2(dv, du) - 0.5); + if (gap < 0.35) h -= 320 * (1 - gap / 0.35) * (1 - clamp(r, 0, 1)); + h += 14 * Math.sin(u * 7.3) * Math.cos(v * 6.1); + float hf = (float) Math.max(0, h); + heights[y][x] = hf; min = Math.min(min, hf); max = Math.max(max, hf); + } + minHeight = min; maxHeight = max; + tags.clear(); + tags.add(new Tag(0.50, 0.50, 0.10, Feature.SLOPE)); + } + + private void buildHill() { + double[][] bumps = {{0.30, 0.32, 120, 0.20}, {0.66, 0.28, 95, 0.17}, {0.52, 0.62, 140, 0.22}, + {0.22, 0.72, 88, 0.16}, {0.78, 0.70, 110, 0.18}}; + float min = Float.MAX_VALUE, max = -Float.MAX_VALUE; + for (int y = 0; y < size; y++) for (int x = 0; x < size; x++) { + double u = (double) x / (size - 1), v = (double) y / (size - 1); + double h = 60; + for (double[] b : bumps) { + double du = (u - b[0]) / b[3], dv = (v - b[1]) / b[3]; + h += b[2] * Math.exp(-(du * du + dv * dv) * 1.3); + } + h += 10 * Math.sin(u * 11.0) * Math.cos(v * 9.0); + float hf = (float) Math.max(0, h); + heights[y][x] = hf; min = Math.min(min, hf); max = Math.max(max, hf); + } + minHeight = min; maxHeight = max; + } + + private void buildPlateau() { + float min = Float.MAX_VALUE, max = -Float.MAX_VALUE; + for (int y = 0; y < size; y++) for (int x = 0; x < size; x++) { + double u = (double) x / (size - 1), v = (double) y / (size - 1); + double du = u - 0.5, dv = v - 0.5, r = Math.sqrt(du * du + dv * dv) * 2.0; + double h = r < 0.55 ? 1250 : 1250 - 1000 * smoothStep(0.55, 0.78, r); + if (r < 0.55) h += 25 * Math.sin(u * 6.0) * Math.cos(v * 5.0); + h += 30 * (1 - clamp(r, 0, 1)); + float hf = (float) Math.max(0, h); + heights[y][x] = hf; min = Math.min(min, hf); max = Math.max(max, hf); + } + minHeight = min; maxHeight = max; + tags.clear(); + tags.add(new Tag(0.50, 0.50, 0.15, Feature.SLOPE)); + } + + private void buildPlain() { + float min = Float.MAX_VALUE, max = -Float.MAX_VALUE; + for (int y = 0; y < size; y++) for (int x = 0; x < size; x++) { + double u = (double) x / (size - 1), v = (double) y / (size - 1); + double h = 40 + 22 * u + 8 * Math.sin(u * 4.2) * Math.cos(v * 3.6); + float hf = (float) Math.max(0, h); + heights[y][x] = hf; min = Math.min(min, hf); max = Math.max(max, hf); + } + minHeight = min; maxHeight = max; + } + + private void buildLandform(LandformKind landform) { + switch (landform) { + case PEAK -> buildPeak(); + case RIDGE -> buildRidge(); + case VALLEY -> buildValley(); + case SADDLE -> buildSaddle(); + case CLIFF -> buildCliff(); + } + buildFeatures(); + } + + private void buildPeak() { + float min = Float.MAX_VALUE; + for (int y = 0; y < size; y++) for (int x = 0; x < size; x++) { + double u = (double) x / (size - 1), v = (double) y / (size - 1); + double du = u - 0.5, dv = (v - 0.5) / 0.94; + double r = Math.sqrt(du * du + dv * dv); + double core = Math.exp(-Math.pow(r / 0.36, 1.85)); + double rim = 1 - smoothStep(0.36, 0.50, r); + double h = 65 + 1230 * core * rim; + h += 120 * Math.exp(-(Math.pow(u - 0.72, 2) + Math.pow(v - 0.66, 2)) / 0.016) * rim; + h += 22 * Math.sin(u * 7.3 + 0.6) * Math.cos(v * 6.1) * rim; + setAndTrack((float) Math.max(0, h), x, y); + } + tags.clear(); + tags.add(new Tag(0.5, 0.5, 0.09, Feature.PEAK)); + } + + private void buildRidge() { + for (int y = 0; y < size; y++) for (int x = 0; x < size; x++) { + double u = (double) x / (size - 1), v = (double) y / (size - 1); + double crestV = 0.5 + 0.10 * Math.sin(u * 3.1); + double across = v - crestV; + double crest = 1150 - 380 * u; + double lateral = Math.exp(-Math.pow(Math.abs(across) / 0.27, 1.55)); + double h = 85 + (crest - 85) * lateral; + h += 60 * Math.exp(-Math.pow(Math.abs(across) - 0.30, 2) / 0.010) * (0.4 + 0.6 * (1 - u)); + h += 24 * Math.sin(u * 8.0) * Math.cos(v * 5.6); + setAndTrack((float) Math.max(0, h), x, y); + } + tags.clear(); + tags.add(new Tag(0.30, 0.50, 0.09, Feature.RIDGE)); + tags.add(new Tag(0.70, 0.50, 0.09, Feature.RIDGE)); + } + + private void buildValley() { + for (int y = 0; y < size; y++) for (int x = 0; x < size; x++) { + double u = (double) x / (size - 1), v = (double) y / (size - 1); + double side = Math.pow(Math.abs(u - 0.5) / 0.5, 1.5); + double downhill = 1 - v; + double h = 90 + 760 * downhill + 585 * side * (0.30 + 0.70 * downhill); + h -= 70 * Math.exp(-Math.pow(u - 0.5, 2) / 0.0022); + h += 18 * Math.sin(u * 6.5) * Math.cos(v * 7.2); + setAndTrack((float) Math.max(0, h), x, y); + } + tags.clear(); + tags.add(new Tag(0.50, 0.40, 0.075, Feature.VALLEY)); + tags.add(new Tag(0.50, 0.68, 0.075, Feature.VALLEY)); + } + + private void buildSaddle() { + for (int y = 0; y < size; y++) for (int x = 0; x < size; x++) { + double u = (double) x / (size - 1), v = (double) y / (size - 1); + double d1 = Math.sqrt(Math.pow((u - 0.27) / 0.30, 2) + Math.pow((v - 0.52) / 0.28, 2)); + double d2 = Math.sqrt(Math.pow((u - 0.73) / 0.30, 2) + Math.pow((v - 0.48) / 0.28, 2)); + double p1 = 1140 * Math.exp(-Math.pow(d1, 2.2)); + double p2 = 1060 * Math.exp(-Math.pow(d2, 2.2)); + double bench = 330 * Math.exp(-Math.pow((v - 0.5) / 0.34, 2)); + double h = 65 + bench + Math.max(p1, p2); + h += 20 * Math.sin(u * 8.0) * Math.cos(v * 7.0); + setAndTrack((float) Math.max(0, h), x, y); + } + tags.clear(); + tags.add(new Tag(0.28, 0.50, 0.05, Feature.PEAK)); + tags.add(new Tag(0.72, 0.50, 0.05, Feature.PEAK)); + tags.add(new Tag(0.50, 0.50, 0.045, Feature.SADDLE)); + } + + private void buildCliff() { + for (int y = 0; y < size; y++) for (int x = 0; x < size; x++) { + double u = (double) x / (size - 1), v = (double) y / (size - 1); + double edge = smoothStep(0.50, 0.62, u + 0.045 * Math.sin(v * 5.2) + 0.02 * Math.sin(v * 11.0)); + double h = 210 + 940 * edge; + h += 170 * (1 - v) * edge; + h += 55 * Math.sin(v * 5.4) * Math.cos(u * 4.2) * (0.4 + 0.6 * edge); + h += 26 * Math.sin(u * 9.0); + setAndTrack((float) Math.max(0, h), x, y); + } + tags.clear(); + tags.add(new Tag(0.50, 0.50, 0.035, Feature.CLIFF)); + } + + private void setAndTrack(float h, int x, int y) { + heights[y][x] = h; + if (h < minHeight) minHeight = h; + if (h > maxHeight) maxHeight = h; + } + + public Feature tagAt(double u, double v) { + for (Tag t : tags) { + double du = u - t.u(), dv = v - t.v(); + if (du * du + dv * dv <= t.radius() * t.radius()) return t.feature(); + } + return Feature.NONE; + } + + private void buildFeatures() { + heights[0][0] = heights[0][0]; // ensure arrays initialized + computeMinMax(); + final int step = 4; + for (int y = step; y < size - step; y += step) for (int x = step; x < size - step; x += step) { + float h = heights[y][x]; + if (h < maxHeight * 0.55f) continue; + boolean isMax = true; + for (int dy = -step; dy <= step && isMax; dy += step) + for (int dx = -step; dx <= step; dx += step) { + if (dx == 0 && dy == 0) continue; + if (heights[y + dy][x + dx] > h) { isMax = false; break; } + } + if (isMax) peaks.add(new PeakPoint((double) x / (size - 1), (double) y / (size - 1), h)); + } + peaks.sort((a, b) -> Float.compare(b.height(), a.height())); + final int cstep = 3; + double h = 0.004; + for (int y = cstep; y < size - cstep; y += cstep) for (int x = cstep; x < size - cstep; x += cstep) { + double du = (heights[y][x + 2] - heights[y][x - 2]) / (2 * h * (size - 1)) / 1000; + double dv = (heights[y + 2][x] - heights[y - 2][x]) / (2 * h * (size - 1)) / 1000; + if (Math.sqrt(du * du + dv * dv) > 0.11) + cliffs.add(new Point((double) x / (size - 1), (double) y / (size - 1))); + } + if (!peaks.isEmpty()) { + PeakPoint start = peaks.get(0); + double cu = start.u(), cv = start.v(); + river.add(new Point(cu, cv)); + for (int i = 0; i < 400; i++) { + double h0 = sampleSmooth(cu, cv), bestU = 0, bestV = 0, bestH = h0; + boolean found = false; + for (int a = 0; a < 16; a++) { + double ang = a * Math.PI * 2 / 16; + double nu = cu + Math.cos(ang) * 0.012, nv = cv + Math.sin(ang) * 0.012; + if (nu < 0 || nu > 1 || nv < 0 || nv > 1) continue; + double nh = sampleSmooth(nu, nv); + if (nh < bestH) { bestH = nh; bestU = nu; bestV = nv; found = true; } + } + if (!found) break; + cu = bestU; cv = bestV; + river.add(new Point(cu, cv)); + if (cu <= 0.001 || cu >= 0.999 || cv <= 0.001 || cv >= 0.999 || bestH < minHeight + 20) break; + } + } + } + + private void computeMinMax() { + float min = Float.MAX_VALUE, max = -Float.MAX_VALUE; + for (float[] row : heights) for (float v : row) { min = Math.min(min, v); max = Math.max(max, v); } + minHeight = min; maxHeight = max; + } + + public List contourLevels() { + List levels = new ArrayList<>(); + float iv = effectiveInterval(); + float top = (float) (Math.floor(maxHeight / iv) * iv); + float bottom = (float) (Math.ceil(minHeight / iv) * iv); + for (float h = bottom; h <= top + 0.01f; h += iv) levels.add(h); + return levels; + } + + public List> extractContour(float level) { + List segs = new ArrayList<>(); + for (int y = 0; y < size - 1; y++) for (int x = 0; x < size - 1; x++) { + float h00 = heights[y][x], h10 = heights[y][x + 1], h11 = heights[y + 1][x + 1], h01 = heights[y + 1][x]; + int idx = 0; + if (h00 >= level) idx |= 1; + if (h10 >= level) idx |= 2; + if (h11 >= level) idx |= 4; + if (h01 >= level) idx |= 8; + if (idx == 0 || idx == 15) continue; + double u0 = (double) x / (size - 1), u1 = (double) (x + 1) / (size - 1); + double v0 = (double) y / (size - 1), v1 = (double) (y + 1) / (size - 1); + double[] top = {lerp(u0, u1, (level - h00) / (h10 - h00)), v0}; + double[] bottom = {lerp(u0, u1, (level - h01) / (h11 - h01)), v1}; + double[] left = {u0, lerp(v0, v1, (level - h00) / (h01 - h00))}; + double[] right = {u1, lerp(v0, v1, (level - h10) / (h11 - h10))}; + switch (idx) { + case 1, 14 -> addSeg(segs, left, top); + case 2, 13 -> addSeg(segs, top, right); + case 3, 12 -> addSeg(segs, left, right); + case 4, 11 -> addSeg(segs, right, bottom); + case 6, 9 -> addSeg(segs, top, bottom); + case 7, 8 -> addSeg(segs, left, bottom); + case 5 -> { addSeg(segs, left, top); addSeg(segs, right, bottom); } + case 10 -> { addSeg(segs, top, right); addSeg(segs, left, bottom); } + } + } + return chain(segs); + } + + private static void addSeg(List segs, double[] a, double[] b) { + segs.add(new double[]{a[0], a[1], b[0], b[1]}); + } + + private static List> chain(List segments) { + final double Q = 1e4; + Map> index = new HashMap<>(); + for (int i = 0; i < segments.size(); i++) { + double[] s = segments.get(i); + register(index, s[0], s[1], i, Q); + register(index, s[2], s[3], i, Q); + } + boolean[] used = new boolean[segments.size()]; + List> result = new ArrayList<>(); + for (int i = 0; i < segments.size(); i++) { + if (used[i]) continue; + used[i] = true; + double[] s = segments.get(i); + LinkedList line = new LinkedList<>(); + line.add(new Point(s[0], s[1])); line.add(new Point(s[2], s[3])); + while (true) { + Point tail = line.getLast(); + int j = next(index, used, tail.u(), tail.v(), Q); + if (j < 0) break; + used[j] = true; + double[] n = segments.get(j); + line.add(key(n[0], n[1], Q) == key(tail.u(), tail.v(), Q) + ? new Point(n[2], n[3]) : new Point(n[0], n[1])); + } + while (true) { + Point head = line.getFirst(); + int j = next(index, used, head.u(), head.v(), Q); + if (j < 0) break; + used[j] = true; + double[] n = segments.get(j); + line.addFirst(key(n[0], n[1], Q) == key(head.u(), head.v(), Q) + ? new Point(n[2], n[3]) : new Point(n[0], n[1])); + } + if (line.size() >= 3) result.add(new ArrayList<>(line)); + } + return result; + } + + private static void register(Map> index, double u, double v, int seg, double q) { + index.computeIfAbsent(key(u, v, q), k -> new ArrayList<>()).add(seg); + } + private static long key(double u, double v, double q) { + long a = Math.round(u * q), b = Math.round(v * q); + return (a << 32) ^ (b & 0xffffffffL); + } + private static int next(Map> index, boolean[] used, double u, double v, double q) { + List list = index.get(key(u, v, q)); + if (list == null) return -1; + for (int j : list) if (!used[j]) return j; + return -1; + } + + public double slopeAt(double u, double v) { + double h = 0.006; + double du = (sampleSmooth(u + h, v) - sampleSmooth(u - h, v)) / (2 * h); + double dv = (sampleSmooth(u, v + h) - sampleSmooth(u, v - h)) / (2 * h); + double grad = Math.sqrt(du * du + dv * dv); + double span = Math.max(60, maxHeight - minHeight); + return clamp(grad / (span * 2.6), 0, 1); + } + + private static double smoothStep(double a, double b, double x) { + double t = clamp((x - a) / (b - a), 0, 1); + return t * t * (3 - 2 * t); + } + private static double lerp(double a, double b, double t) { + if (Double.isNaN(t)) t = 0.5; + return a + (b - a) * clamp(t, 0, 1); + } + private static double clamp(double v, double lo, double hi) { return Math.max(lo, Math.min(hi, v)); } + private static int clamp(int v, int lo, int hi) { return Math.max(lo, Math.min(hi, v)); } +} diff --git a/Java/src/main/java/com/gc/model/earth/EarthMath.java b/Java/src/main/java/com/gc/model/earth/EarthMath.java new file mode 100644 index 0000000..5007ddf --- /dev/null +++ b/Java/src/main/java/com/gc/model/earth/EarthMath.java @@ -0,0 +1,111 @@ +package com.gc.model.earth; + +import java.time.LocalDate; +import java.util.List; + +/** 地球自转 / 公转 / 地理的共享公式,与 C# CelestialView、GeoModels 一致。 */ +public final class EarthMath { + public static final double TILT = 23.5; + public static final double TROPIC = 23.5; + public static final double POLAR = 90 - 23.5; + + public record Season(double angleDeg, String key, String date, double declinationDeg, String zh, String en) {} + public record Zone(String id, double latMin, double latMax, String nameZh, String nameEn) {} + + public static final List SEASONS = List.of( + new Season(0, "season.springEquinox", "3/21", 0, + "太阳直射赤道,全球昼夜平分。", "The Sun is overhead at the equator; day equals night everywhere."), + new Season(90, "season.summerSolstice", "6/22", 23.5, + "太阳直射北回归线 23.5°N,北半球昼最长。", "The Sun is overhead at 23.5°N; the northern hemisphere has its longest day."), + new Season(180, "season.autumnEquinox", "9/23", 0, + "太阳直射赤道,全球昼夜平分。", "The Sun is overhead at the equator; day equals night everywhere."), + new Season(270, "season.winterSolstice", "12/22", -23.5, + "太阳直射南回归线 23.5°S,北半球昼最短。", "The Sun is overhead at 23.5°S; the northern hemisphere has its shortest day.") + ); + + public static final List ZONES = List.of( + new Zone("torrid", -23.5, 23.5, "热带", "Torrid zone"), + new Zone("northTemperate", 23.5, 66.5, "北温带", "North temperate zone"), + new Zone("southTemperate", -66.5, -23.5, "南温带", "South temperate zone"), + new Zone("northFrigid", 66.5, 90, "北寒带", "North frigid zone"), + new Zone("southFrigid", -90, -66.5, "南寒带", "South frigid zone") + ); + + private EarthMath() {} + + public static double subsolarLatitude(double orbitDeg) { return subsolarLatitude(orbitDeg, TILT); } + + public static double subsolarLatitude(double orbitDeg, double tiltDeg) { + double o = Math.toRadians(orbitDeg); + double t = Math.toRadians(tiltDeg); + return Math.toDegrees(Math.asin(Math.sin(t) * Math.sin(o))); + } + + public static LocalDate dateForAngle(double deg) { + double days = 79 + deg / 360.0 * 365.2422; + return LocalDate.of(2025, 1, 1).plusDays(Math.round(days)); + } + + public static String dateText(double deg) { + LocalDate d = dateForAngle(deg); + return d.getMonthValue() + "/" + d.getDayOfMonth(); + } + + public static Season nearestSeason(double orbitDeg) { + double o = ((orbitDeg % 360) + 360) % 360; + Season best = SEASONS.get(0); + double bestDiff = 360; + for (Season s : SEASONS) { + double diff = Math.abs(o - s.angleDeg()); + diff = Math.min(diff, 360 - diff); + if (diff < bestDiff) { bestDiff = diff; best = s; } + } + return best; + } + + /** 返回 {spin, orbit}。 */ + public static double[] stepAngles(double spinDeg, double orbitDeg, double dtSeconds, double speed) { + double spin = (spinDeg + dtSeconds * speed * 60) % 360; + double orbit = (orbitDeg + dtSeconds * speed * 12) % 360; + if (spin < 0) spin += 360; + if (orbit < 0) orbit += 360; + return new double[]{spin, orbit}; + } + + public static double[] latLonToUnit(double latDeg, double lonDeg) { + double lat = Math.toRadians(latDeg), lon = Math.toRadians(lonDeg); + return new double[]{Math.cos(lat) * Math.sin(lon), Math.sin(lat), Math.cos(lat) * Math.cos(lon)}; + } + + public static String zoneId(double lat) { + double a = Math.abs(lat); + if (a < 23.5) return "torrid"; + if (a < 66.5) return lat >= 0 ? "northTemperate" : "southTemperate"; + return lat >= 0 ? "northFrigid" : "southFrigid"; + } + + public static Zone zone(double lat) { + String id = zoneId(lat); + for (Zone z : ZONES) if (z.id().equals(id)) return z; + return ZONES.get(0); + } + + public static String zoneName(double lat) { + Zone z = zone(lat); + return "zh".equals(com.gc.core.I18n.language().substring(0, 2)) ? z.nameZh() : z.nameEn(); + } + + public static String declination(double lat) { + String id = zoneId(lat); + if (id.equals("torrid")) return "tropics"; + String[] p = id.split("-"); + StringBuilder sb = new StringBuilder(p[0]); + for (int i = 1; i < p.length; i++) sb.append(Character.toUpperCase(p[i].charAt(0))).append(p[i].substring(1)); + return sb.toString(); + } + + /** 地理模型:把某纬度投影到画布 y。 */ + public static double latToY(double lat, double height) { + return (90 - lat) / 180.0 * height; + } +} diff --git a/Java/src/main/java/com/gc/model/scale/ScaleData.java b/Java/src/main/java/com/gc/model/scale/ScaleData.java new file mode 100644 index 0000000..e47b251 --- /dev/null +++ b/Java/src/main/java/com/gc/model/scale/ScaleData.java @@ -0,0 +1,69 @@ +package com.gc.model.scale; + +import com.gc.core.Json; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** scales.json 预设 / 光谱 / 地标;文件缺失时用与 C# 相同的兜底数据。 */ +public final class ScaleData { + public record Preset(double n, String nameKey, String noteKey) {} + public record Spectrum(double n, String labelKey, String scopeKey) {} + public record Landmark(String nameKey, double meters) {} + + public final List presets = new ArrayList<>(); + public final List spectrum = new ArrayList<>(); + public final List landmarks = new ArrayList<>(); + + public static ScaleData load(Path dataDir) { + ScaleData d = fallback(); + Path p = dataDir.resolve("scales.json"); + if (!Files.isRegularFile(p)) return d; + try { + Map m = Json.obj(Json.parse(p)); + List ps = new ArrayList<>(); + for (Object o : Json.arr(m.get("presets"))) { + Map x = Json.obj(o); + ps.add(new Preset(Json.d(x, "n", 0), Json.str(x, "nameKey", ""), Json.str(x, "noteKey", ""))); + } + if (ps.isEmpty()) return d; + d.presets.clear(); d.presets.addAll(ps); + d.spectrum.clear(); + for (Object o : Json.arr(m.get("spectrum"))) { + Map x = Json.obj(o); + d.spectrum.add(new Spectrum(Json.d(x, "n", 0), Json.str(x, "labelKey", ""), Json.str(x, "scopeKey", ""))); + } + d.landmarks.clear(); + for (Object o : Json.arr(m.get("landmarks"))) { + Map x = Json.obj(o); + d.landmarks.add(new Landmark(Json.str(x, "nameKey", ""), Json.d(x, "meters", 0))); + } + } catch (Exception e) { + System.err.println("[scale] 读取 scales.json 失败: " + e.getMessage()); + } + return d; + } + + public static ScaleData fallback() { + ScaleData d = new ScaleData(); + d.presets.add(new Preset(10000, "preset.campus", "preset.campusNote")); + d.presets.add(new Preset(50000, "preset.town", "preset.townNote")); + d.presets.add(new Preset(250000, "preset.city", "preset.cityNote")); + d.presets.add(new Preset(1000000, "preset.province", "preset.provinceNote")); + d.presets.add(new Preset(10000000, "preset.china", "preset.chinaNote")); + d.presets.add(new Preset(100000000, "preset.world", "preset.worldNote")); + d.spectrum.add(new Spectrum(10000, "spec.campus", "spec.campusScope")); + d.spectrum.add(new Spectrum(250000, "spec.city", "spec.cityScope")); + d.spectrum.add(new Spectrum(10000000, "spec.china", "spec.chinaScope")); + d.spectrum.add(new Spectrum(100000000, "spec.world", "spec.worldScope")); + d.landmarks.add(new Landmark("lm.classroom", 10)); + d.landmarks.add(new Landmark("lm.track", 400)); + d.landmarks.add(new Landmark("lm.marathon", 42195)); + d.landmarks.add(new Landmark("lm.beijingShanghai", 1080000)); + d.landmarks.add(new Landmark("lm.equator", 40000000)); + return d; + } +} diff --git a/Java/src/main/java/com/gc/model/scale/ScaleMath.java b/Java/src/main/java/com/gc/model/scale/ScaleMath.java new file mode 100644 index 0000000..508ddf9 --- /dev/null +++ b/Java/src/main/java/com/gc/model/scale/ScaleMath.java @@ -0,0 +1,210 @@ +package com.gc.model.scale; + +import java.util.Locale; +import java.util.Random; + +/** 比例尺算法,逐字对应 C# GC.ScaleCalculator.ScaleMath。 */ +public final class ScaleMath { + public static final double CM_PER_M = 100.0; + public static final double CM_PER_KM = 100000.0; + + public enum SolveMode { REAL, MAP, SCALE } + public enum Grade { LARGE, MEDIUM, SMALL } + + public static final class State { + public double mapCm = 3.0; + public double realCm = 300000.0; + public double n = 100000.0; + public SolveMode mode = SolveMode.REAL; + public State copy() { + State s = new State(); s.mapCm = mapCm; s.realCm = realCm; s.n = n; s.mode = mode; return s; + } + } + + public record Segment(double metersPerDiv, double divPx, int divCount) {} + public record Human(double value, String unitKey) {} + public static final class Quiz { + public SolveMode mode; + public String promptKey = ""; + public Object[] promptArgs = new Object[0]; + public double answer; + public double tolerance = 0.02; + public String answerUnitKey = "unit.cm"; + public String[] stepKeys = new String[0]; + } + + private ScaleMath() {} + + public static void solve(State s) { + if (s.mapCm < 0) s.mapCm = 0; + if (s.realCm < 0) s.realCm = 0; + if (s.n < 1) s.n = 1; + switch (s.mode) { + case REAL -> s.realCm = s.mapCm * s.n; + case MAP -> s.mapCm = s.n > 0 ? s.realCm / s.n : 0; + case SCALE -> { + s.n = s.mapCm > 1e-9 ? s.realCm / s.mapCm : 1; + if (s.n < 1) s.n = 1; + } + } + } + + public static Human humanReal(double cm) { + if (cm < CM_PER_M) return new Human(cm, "unit.cm"); + if (cm < CM_PER_KM) return new Human(cm / CM_PER_M, "unit.m"); + return new Human(cm / CM_PER_KM, "unit.km"); + } + + public static String num(double v) { + if (Double.isNaN(v) || Double.isInfinite(v)) return "—"; + double a = Math.abs(v); + if (a >= 1000) return String.format(Locale.ROOT, "%,.0f", v); + if (a >= 10) return trim(v, "%.1f"); + if (a >= 1) return trim(v, "%.2f"); + if (a >= 0.01) return trim(v, "%.3f"); + if (a == 0) return "0"; + return trim(v, "%.4f"); + } + + private static String trim(double v, String fmt) { + String s = String.format(Locale.ROOT, fmt, v); + if (s.contains(".")) { + s = s.replaceAll("0+$", ""); + if (s.endsWith(".")) s = s.substring(0, s.length() - 1); + } + return s; + } + + public static String formatRealCm(double cm) { + Human h = humanReal(cm); + return num(h.value()) + " " + h.unitKey(); + } + + public static String formatN(double n) { return num(Math.round(n)); } + + public static String digital(double n) { return "1 : " + formatN(n); } + + public static String verbalDistance(double n) { + Human h = humanReal(n); + return num(h.value()) + " " + h.unitKey(); + } + + public static double realToMapCm(double realCm, double n) { return n > 0 ? realCm / n : 0; } + public static double cmToPx(double cm, double pxPerCm) { return cm * pxPerCm; } + public static double realToMapPx(double realCm, double n, double pxPerCm) { + return realToMapCm(realCm, n) * pxPerCm; + } + + public static Segment pickSegment(double n, double pxPerCm, double targetPx) { + if (n < 1) n = 1; + if (pxPerCm < 1) pxPerCm = 1; + double idealMeters = targetPx * n / (100.0 * pxPerCm); + if (idealMeters <= 0) idealMeters = 1; + double best = 1, bestErr = Double.MAX_VALUE; + double logIdeal = Math.log10(idealMeters); + for (int k = -3; k <= 9; k++) { + for (double m : new double[]{1, 2, 5}) { + double cand = m * Math.pow(10, k); + double err = Math.abs(Math.log10(cand) - logIdeal); + if (err < bestErr) { bestErr = err; best = cand; } + } + } + double divPx = best * 100.0 / n * pxPerCm; + int count = 5; + double total = divPx * count; + if (total > targetPx * 9) count = 4; + else if (total < targetPx * 2.5) count = 6; + return new Segment(best, divPx, count); + } + + public static String segmentLabel(double meters) { + if (meters < 1) return num(meters * 100) + " cm"; + if (meters < 1000) return num(meters) + " m"; + return num(meters / 1000) + " km"; + } + + public static Grade grade(double n) { + if (n <= 100000) return Grade.LARGE; + if (n <= 1000000) return Grade.MEDIUM; + return Grade.SMALL; + } + + public static String gradeKey(double n) { + return switch (grade(n)) { + case LARGE -> "grade.large"; + case MEDIUM -> "grade.medium"; + default -> "grade.small"; + }; + } + + public static double spectrumPosition(double n) { + if (n < 1) n = 1; + double p = (Math.log10(n) - 3.0) / 6.0; + return p < 0 ? 0 : Math.min(p, 1); + } + + public static Double tryParseReal(String text, String unitKey) { + try { + double v = Double.parseDouble(text.replace(",", "").trim()); + if (v < 0 || Double.isNaN(v) || Double.isInfinite(v)) return null; + return switch (unitKey) { + case "unit.m" -> v * CM_PER_M; + case "unit.km" -> v * CM_PER_KM; + default -> v; + }; + } catch (Exception e) { return null; } + } + + public static double toUnit(double cm, String unitKey) { + return switch (unitKey) { + case "unit.m" -> cm / CM_PER_M; + case "unit.km" -> cm / CM_PER_KM; + default -> cm; + }; + } + + public static Quiz generateQuiz(Random rnd) { + SolveMode mode = SolveMode.values()[rnd.nextInt(3)]; + double[] maps = {1, 2, 2.5, 3, 4, 5, 6, 8, 10, 12}; + double[] ns = {1000, 5000, 10000, 25000, 50000, 100000, 500000, 1000000, 5000000, 10000000}; + double mapCm = maps[rnd.nextInt(maps.length)]; + double n = ns[rnd.nextInt(ns.length)]; + Quiz q = new Quiz(); + q.mode = mode; + switch (mode) { + case REAL -> { + double realCm = mapCm * n; + Human h = humanReal(realCm); + q.promptKey = "quiz.promptReal"; + q.promptArgs = new Object[]{formatN(n), num(mapCm)}; + q.answer = h.value(); + q.answerUnitKey = h.unitKey(); + q.stepKeys = new String[]{"steps.2.formulaReal", "steps.4.result"}; + } + case MAP -> { + double realCm = mapCm * n; + Human h = humanReal(realCm); + q.promptKey = "quiz.promptMap"; + q.promptArgs = new Object[]{formatN(n), num(h.value())}; + q.answer = mapCm; + q.answerUnitKey = "unit.cm"; + q.stepKeys = new String[]{"steps.2.formulaMap", "steps.4.result"}; + } + case SCALE -> { + double realCm = mapCm * n; + Human h = humanReal(realCm); + q.promptKey = "quiz.promptScale"; + q.promptArgs = new Object[]{num(mapCm), num(h.value())}; + q.answer = n; + q.answerUnitKey = "unit.none"; + q.stepKeys = new String[]{"steps.1.unify", "steps.2.formulaScale", "steps.4.result"}; + } + } + return q; + } + + public static boolean checkAnswer(Quiz q, double input) { + if (q.answer <= 0) return false; + return Math.abs(input - q.answer) / q.answer <= q.tolerance; + } +} diff --git a/Java/src/main/java/com/gc/ui/AboutPage.java b/Java/src/main/java/com/gc/ui/AboutPage.java new file mode 100644 index 0000000..3e91a4c --- /dev/null +++ b/Java/src/main/java/com/gc/ui/AboutPage.java @@ -0,0 +1,119 @@ +package com.gc.ui; + +import com.gc.core.*; + +import javax.swing.*; +import javax.swing.border.EmptyBorder; +import java.awt.*; +import java.net.URI; +import java.nio.file.Files; + +/** 关于页:版本、运行环境、源码语言、构建工具、内置模型与许可。 */ +public final class AboutPage extends JPanel { + private final MainWindow app; + + public AboutPage(MainWindow app) { + this.app = app; + setLayout(new BorderLayout()); + setOpaque(false); + JPanel page = UI.page(); + page.add(UI.pageHeader(I18n.t("about.title"), I18n.t("about.desc"), null), BorderLayout.NORTH); + JPanel body = new JPanel(); + body.setOpaque(false); + body.setLayout(new UI.VStackLayout()); + + UI.Card hero = new UI.Card(new BorderLayout(18, 0)); + hero.setBorder(new EmptyBorder(22, 24, 22, 24)); + hero.setAlignmentX(Component.LEFT_ALIGNMENT); + hero.setMaximumSize(new Dimension(Integer.MAX_VALUE, 120)); + JLabel logo = new JLabel("G") { + @Override protected void paintComponent(Graphics g) { + Graphics2D g2 = (Graphics2D) g.create(); + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + GradientPaint gp = new GradientPaint(0, 0, Theme.ACCENT, getWidth(), getHeight(), new Color(0x8B5CF6)); + g2.setPaint(gp); + g2.fillRoundRect(0, 0, getWidth(), getHeight(), 20, 20); + g2.setColor(Color.WHITE); + g2.setFont(Theme.bold(38)); + FontMetrics fm = g2.getFontMetrics(); + g2.drawString("G", (getWidth() - fm.stringWidth("G")) / 2, (getHeight() + fm.getAscent() - fm.getDescent()) / 2); + g2.dispose(); + } + }; + logo.setPreferredSize(new Dimension(82, 82)); + hero.add(logo, BorderLayout.WEST); + JPanel info = new JPanel(); + info.setOpaque(false); + info.setLayout(new UI.VStackLayout()); + info.add(Theme.boldLabel("GC · Astronomy Model Launcher", 21, Theme.INK)); + info.add(Box.createVerticalStrut(4)); + info.add(Theme.label("Java 2.0.0 · " + I18n.t("about.ui.value"), 13, Theme.DIM)); + info.add(Box.createVerticalStrut(4)); + info.add(Theme.label("Copyright © 2026 Morris GC · MIT", 11, Theme.FAINT)); + hero.add(info, BorderLayout.CENTER); + body.add(hero); + body.add(Box.createVerticalStrut(16)); + + UI.Card env = new UI.Card(); + env.setLayout(new UI.VStackLayout()); + env.setBorder(new EmptyBorder(18, 20, 18, 20)); + env.setAlignmentX(Component.LEFT_ALIGNMENT); + JLabel envTitle = Theme.boldLabel(I18n.t("set.general"), 15, Theme.INK); + envTitle.setAlignmentX(Component.LEFT_ALIGNMENT); + env.add(envTitle); + env.add(Box.createVerticalStrut(12)); + env.add(row(I18n.t("about.language"), "Java 17+ / Swing")); + env.add(row(I18n.t("about.ui"), I18n.t("about.ui.value"))); + env.add(row(I18n.t("about.build"), I18n.t("about.build.value"))); + env.add(row(I18n.t("app.version"), "2.0.0")); + env.add(row(I18n.t("app.platform"), AppPaths.displayPlatform())); + env.add(row(I18n.t("about.license"), "MIT")); + env.add(row(I18n.t("about.thanks"), "https://git.xhmcl.com/Morris/GC")); + body.add(env); + body.add(Box.createVerticalStrut(16)); + + UI.Card models = new UI.Card(); + models.setLayout(new UI.VStackLayout()); + models.setBorder(new EmptyBorder(18, 20, 18, 20)); + models.setAlignmentX(Component.LEFT_ALIGNMENT); + JLabel mt = Theme.boldLabel(I18n.t("about.models"), 15, Theme.INK); + mt.setAlignmentX(Component.LEFT_ALIGNMENT); + models.add(mt); + models.add(Box.createVerticalStrut(10)); + for (String id : BuiltinModels.IDS) models.add(row(id, BuiltinModels.FACTORY.get(id))); + body.add(models); + body.add(Box.createVerticalStrut(16)); + + JPanel actions = new JPanel(new FlowLayout(FlowLayout.LEFT, 8, 0)); + actions.setOpaque(false); + UI.RoundButton repo = UI.primary(I18n.t("dl.openRepo")); + repo.addActionListener(e -> { + try { Desktop.getDesktop().browse(URI.create("https://git.xhmcl.com/Morris/GC")); } + catch (Exception ex) { UI.error(this, ex.getMessage()); } + }); + UI.RoundButton data = UI.button(I18n.t("set.openData")); + data.addActionListener(e -> MainWindow.openFolder(this, app.paths.homeRoot)); + UI.RoundButton logs = UI.button(I18n.t("nav.logs")); + logs.addActionListener(e -> MainWindow.openFolder(this, app.paths.logsRoot())); + actions.add(repo); + actions.add(data); + actions.add(logs); + body.add(actions); + body.add(Box.createVerticalStrut(20)); + page.add(UI.scroll(body), BorderLayout.CENTER); + add(page, BorderLayout.CENTER); + } + + public void onShow() { } + + private JComponent row(String k, String v) { + JPanel p = new JPanel(new BorderLayout(20, 0)); + p.setOpaque(false); + p.setMaximumSize(new Dimension(Integer.MAX_VALUE, 30)); + p.add(Theme.label(k, 12, Theme.DIM), BorderLayout.WEST); + JLabel val = Theme.label(v, 12, Theme.INK); + val.setHorizontalAlignment(SwingConstants.RIGHT); + p.add(val, BorderLayout.EAST); + return p; + } +} diff --git a/Java/src/main/java/com/gc/ui/ContourPanel.java b/Java/src/main/java/com/gc/ui/ContourPanel.java new file mode 100644 index 0000000..e04f0ec --- /dev/null +++ b/Java/src/main/java/com/gc/ui/ContourPanel.java @@ -0,0 +1,501 @@ +package com.gc.ui; + +import com.gc.core.I18n; +import com.gc.core.ModelManifest; +import com.gc.model.contour.TerrainAnalyzer; +import com.gc.model.contour.TerrainField; + +import javax.swing.*; +import javax.swing.border.EmptyBorder; +import java.awt.*; +import java.awt.event.*; +import java.awt.geom.*; +import java.awt.image.BufferedImage; +import java.util.*; +import java.util.List; + +/** 等高线地形图:5 种地形 / 5 种地貌、分层设色、Marching Squares 等高线、悬停判读、3D 旋转。 */ +public final class ContourPanel extends JPanel { + private final TerrainCanvas canvas = new ContourCanvas(); + private final JLabel stats = Theme.label("", 11, new Color(0x9FB4D4)); + private final JLabel hover = Theme.label("", 12.5f, new Color(0xEAF2FF)); + private final JLabel modeTitle = Theme.boldLabel("", 15, new Color(0xEAF2FF)); + private final JPanel kindRow = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0)); + private final JPanel landRow = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0)); + private final JPanel legend = new JPanel(); + private final JLabel loading = Theme.label("", 12, new Color(0x9FB4D4)); + private final UI.Switch contours = new UI.Switch("等高线", true); + private final UI.Switch labels = new UI.Switch("标注", true); + private final UI.Switch threeD = new UI.Switch("3D", false); + private TerrainField.TerrainKind kind = TerrainField.TerrainKind.MOUNTAIN; + private TerrainField.LandformKind landform = null; + private final Map chips = new LinkedHashMap<>(); + private javax.swing.Timer anim; + private double contourReveal = 1; + + public ContourPanel(ModelManifest.Package pkg) { + setLayout(new BorderLayout()); + setBackground(new Color(0x0A1524)); + add(header(), BorderLayout.NORTH); + JPanel main = new JPanel(new BorderLayout(12, 0)); + main.setOpaque(false); + main.setBorder(new EmptyBorder(0, 14, 12, 14)); + main.add(canvas, BorderLayout.CENTER); + main.add(sidebar(), BorderLayout.EAST); + add(main, BorderLayout.CENTER); + add(footer(), BorderLayout.SOUTH); + load(new TerrainField(kind, 160)); + selectChips(); + } + + private JComponent header() { + kindRow.setOpaque(false); + landRow.setOpaque(false); + JPanel h = new JPanel(); + h.setBackground(new Color(0x0C1828)); + h.setLayout(new UI.VStackLayout()); + h.setBorder(BorderFactory.createCompoundBorder( + BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(0x1B2740)), + new EmptyBorder(12, 18, 10, 18))); + JPanel top = new JPanel(new BorderLayout()); + top.setOpaque(false); + JPanel t = new JPanel(); + t.setOpaque(false); + t.setLayout(new UI.VStackLayout()); + t.add(Theme.boldLabel("等高线地形 · 五大典型地貌判读", 20, new Color(0xEAF2FF))); + t.add(Theme.label("等高线、等高距、山峰/山脊/山谷/鞍部/陡崖 · 拖动 3D 可旋转", 11, new Color(0x9FB4D4))); + top.add(t, BorderLayout.WEST); + top.add(modeTitle, BorderLayout.EAST); + h.add(top); + h.add(Box.createVerticalStrut(10)); + h.add(kindRow); + h.add(Box.createVerticalStrut(5)); + h.add(landRow); + return h; + } + + private JComponent sidebar() { + JPanel p = new JPanel(); + p.setOpaque(false); + p.setLayout(new UI.VStackLayout()); + p.setPreferredSize(new Dimension(300, 0)); + + UI.Card info = darkCard(); + info.setLayout(new UI.VStackLayout()); + info.add(Theme.boldLabel("实时读数", 13, new Color(0xEAF2FF))); + info.add(Box.createVerticalStrut(6)); + info.add(stats); + info.add(Box.createVerticalStrut(8)); + hover.setAlignmentX(Component.LEFT_ALIGNMENT); + info.add(hover); + info.add(Box.createVerticalStrut(8)); + JPanel opts = new JPanel(new GridLayout(1, 3, 6, 0)); + opts.setOpaque(false); + opts.setMaximumSize(new Dimension(Integer.MAX_VALUE, 28)); + for (UI.Switch s : new UI.Switch[]{contours, labels, threeD}) { + s.addActionListener(e -> canvas.repaint()); + opts.add(s); + } + info.add(opts); + p.add(info); + p.add(Box.createVerticalStrut(10)); + + UI.Card leg = darkCard(); + leg.setLayout(new UI.VStackLayout()); + leg.add(Theme.boldLabel("分层设色 / 海拔", 13, new Color(0xEAF2FF))); + leg.add(Box.createVerticalStrut(8)); + legend.setOpaque(false); + legend.setLayout(new UI.VStackLayout()); + for (int i = 0; i < 9; i++) { + int low = i * 200; + Color c = TerrainAnalyzer.colorForHeight(low + 10); + JPanel row = new JPanel(new FlowLayout(FlowLayout.LEFT, 8, 2)); + row.setOpaque(false); + JLabel chip = new JLabel(); + chip.setOpaque(true); + chip.setBackground(c); + chip.setPreferredSize(new Dimension(26, 14)); + row.add(chip); + row.add(Theme.label(i == 8 ? "1600 m 以上" : low + "–" + (low + 200) + " m", 10.5f, new Color(0xC6D5EC))); + legend.add(row); + } + leg.add(legend); + p.add(leg); + p.add(Box.createVerticalStrut(10)); + + UI.Card read = darkCard(); + read.setLayout(new UI.VStackLayout()); + read.add(Theme.boldLabel("判读口诀", 13, new Color(0xEAF2FF))); + read.add(Box.createVerticalStrut(6)); + for (String s : new String[]{ + "山峰:闭合等高线,数值向内升高", + "山脊:等高线凸向低处,凸低为脊", + "山谷:等高线凸向高处,凸高为谷", + "鞍部:两峰之间,俯视收腰", + "陡崖:等高线密集甚至重合", + "坡陡:等高线密;坡缓:等高线疏"}) { + JLabel l = Theme.label("· " + s, 10.5f, new Color(0xA9BBD8)); + read.add(l); + } + p.add(read); + p.add(Box.createVerticalGlue()); + return p; + } + + private UI.Card darkCard() { + UI.Card c = new UI.Card(); + c.setBorder(new EmptyBorder(12, 14, 12, 14)); + c.setAlignmentX(Component.LEFT_ALIGNMENT); + c.setMaximumSize(new Dimension(Integer.MAX_VALUE, 1000)); + c.alt = true; + c.bgOverride = new Color(0x121D2E); + c.borderOverride = new Color(0x24324A); + return c; + } + + private JComponent footer() { + JPanel f = new JPanel(new BorderLayout()); + f.setBackground(new Color(0x0C1828)); + f.setBorder(BorderFactory.createCompoundBorder( + BorderFactory.createMatteBorder(1, 0, 0, 0, new Color(0x1B2740)), + new EmptyBorder(8, 18, 8, 18))); + loading.setText("就绪 · 移动鼠标查看海拔与地形判读"); + loading.setForeground(new Color(0x9FB4D4)); + f.add(loading, BorderLayout.WEST); + JPanel r = new JPanel(new FlowLayout(FlowLayout.RIGHT, 8, 0)); + r.setOpaque(false); + UI.RoundButton anim = UI.primary("演示等高线"); + anim.addActionListener(e -> animateContours()); + UI.RoundButton reset = UI.button("重置视角"); + reset.addActionListener(e -> { canvas.resetView(); }); + r.add(anim); + r.add(reset); + f.add(r, BorderLayout.EAST); + return f; + } + + private void animateContours() { + if (anim != null) anim.stop(); + contourReveal = 0; + contours.setSelected(true); + anim = new javax.swing.Timer(30, e -> { + contourReveal += 0.025; + if (contourReveal >= 1) { contourReveal = 1; ((javax.swing.Timer) e.getSource()).stop(); } + canvas.repaint(); + }); + anim.start(); + } + + private void selectChips() { + kindRow.removeAll(); + landRow.removeAll(); + String[] kinds = {"mountain", "basin", "hill", "plateau", "plain"}; + String[] lands = {"peak", "ridge", "valley", "saddle", "cliff"}; + JLabel kl = Theme.label("基本地形", 10.5f, new Color(0x9FB4D4)); + kindRow.add(kl); + for (int i = 0; i < kinds.length; i++) { + final TerrainField.TerrainKind k = TerrainField.TerrainKind.valueOf(kinds[i].toUpperCase()); + UI.RoundButton b = chip(I18n.t("contour.kind." + kinds[i]), landform == null && kind == k); + b.addActionListener(e -> { + landform = null; kind = k; selectChips(); load(new TerrainField(kind, 160)); + }); + kindRow.add(b); + } + JLabel ll = Theme.label("典型地貌", 10.5f, new Color(0x9FB4D4)); + landRow.add(ll); + for (String s : lands) { + final TerrainField.LandformKind lf = TerrainField.LandformKind.valueOf(s.toUpperCase()); + UI.RoundButton b = chip(I18n.t("contour.landform." + s), landform == lf); + b.addActionListener(e -> { + landform = lf; selectChips(); load(new TerrainField(lf, 160)); + }); + landRow.add(b); + } + kindRow.revalidate(); kindRow.repaint(); + landRow.revalidate(); landRow.repaint(); + modeTitle.setText(landform != null ? I18n.t("contour.landform." + landform.name().toLowerCase()) + : I18n.t("contour.kind." + kind.name().toLowerCase())); + } + + private UI.RoundButton chip(String text, boolean active) { + UI.RoundButton b = UI.button(text); + b.setFont(Theme.font(10.5f)); + b.setBorder(new EmptyBorder(4, 10, 4, 10)); + b.primary = active; + b.ghost = !active; + return b; + } + + private void load(TerrainField field) { + loading.setText("正在生成地形高度场与等高线…"); + loading.setForeground(new Color(0xE9B25B)); + canvas.setLoading(true); + new SwingWorker() { + @Override protected Data doInBackground() { + return prepare(field); + } + @Override protected void done() { + try { + Data d = get(); + canvas.setData(d); + stats.setText(String.format(Locale.ROOT, "海拔 %.0f – %.0f m · 等高距 %.0f m · %d 格", + field.minHeight, field.maxHeight, field.effectiveInterval(), field.size)); + loading.setText("就绪 · 移动鼠标查看海拔与地形判读"); + loading.setForeground(new Color(0x9FB4D4)); + canvas.setLoading(false); + } catch (Exception e) { + loading.setText("生成失败: " + e.getMessage()); + } + } + }.execute(); + } + + private final class ContourCanvas extends TerrainCanvas { + ContourCanvas() { + addMouseMotionListener(new MouseMotionAdapter() { + @Override public void mouseMoved(MouseEvent e) { updateHover(e.getX(), e.getY()); } + @Override public void mouseDragged(MouseEvent e) { + if (threeD.isSelected()) { yaw += (e.getX() - lastX) * 0.01; lastX = e.getX(); repaint(); } + } + }); + addMouseListener(new MouseAdapter() { + @Override public void mousePressed(MouseEvent e) { lastX = e.getX(); } + @Override public void mouseExited(MouseEvent e) { hoverU = -1; repaint(); } + }); + } + } + + private void updateHover(int mx, int my) { + ContourCanvas c = (ContourCanvas) canvas; + c.hoverX = mx; c.hoverY = my; + Rectangle r = c.mapRect(); + if (r == null || !r.contains(mx, my) || c.data == null) { hover.setText(" "); c.repaint(); return; } + double u = (mx - r.x) / (double) r.width, v = (my - r.y) / (double) r.height; + TerrainField f = c.data.field; + float h = f.sampleSmooth(u, v); + TerrainField.Feature feat = TerrainAnalyzer.classify(f, u, v); + double slope = f.slopeAt(u, v); + c.hoverU = u; c.hoverV = v; + hover.setText(String.format(Locale.ROOT, "海拔 %.0f m · %s · 坡度 %.0f%%", + h, TerrainAnalyzer.featureLabel(feat), slope * 100)); + hover.setForeground(new Color(0xEAF2FF)); + c.repaint(); + } + + private static final class Data { + final TerrainField field; + final List levels; + final Map>> contours = new LinkedHashMap<>(); + final BufferedImage relief; + Data(TerrainField f, List levels, List>> lines, BufferedImage relief) { + this.field = f; this.levels = levels; this.relief = relief; + for (int i = 0; i < levels.size(); i++) contours.put(levels.get(i), lines.get(i)); + } + } + + private static Data prepare(TerrainField f) { + List levels = f.contourLevels(); + List>> lines = new ArrayList<>(); + for (float l : levels) lines.add(f.extractContour(l)); + BufferedImage img = new BufferedImage(f.size, f.size, BufferedImage.TYPE_INT_RGB); + for (int y = 0; y < f.size; y++) for (int x = 0; x < f.size; x++) { + float h = f.heights[y][x]; + Color c = TerrainAnalyzer.colorForHeight(h); + int x1 = Math.min(f.size - 1, x + 1), y1 = Math.min(f.size - 1, y + 1); + double dz = (f.heights[y1][x] - h) * 0.6 + (f.heights[y][x1] - h) * 0.4; + double shade = Math.max(-0.35, Math.min(0.35, dz / 80.0)); + int r = clampColor((int) (c.getRed() * (1 + shade))); + int g = clampColor((int) (c.getGreen() * (1 + shade))); + int b = clampColor((int) (c.getBlue() * (1 + shade))); + img.setRGB(x, y, (r << 16) | (g << 8) | b); + } + return new Data(f, levels, lines, img); + } + + private static int clampColor(int v) { return Math.max(0, Math.min(255, v)); } + + /** 地形画布:俯视分层设色 + 等高线;3D 轴测 + 拖动旋转。 */ + private class TerrainCanvas extends JPanel { + Data data; + boolean loading; + double yaw = 0.7; + double hoverU = -1, hoverV = -1; + int hoverX, hoverY, lastX; + + TerrainCanvas() { setOpaque(false); } + + void setData(Data d) { data = d; repaint(); } + void setLoading(boolean b) { loading = b; repaint(); } + void resetView() { yaw = 0.7; hoverU = -1; repaint(); } + + Rectangle mapRect() { + if (data == null) return null; + int pad = 26; + int avail = Math.min(getWidth() - pad * 2, getHeight() - pad * 2); + if (avail <= 10) return null; + return new Rectangle(pad + (getWidth() - pad * 2 - avail) / 2, + pad + (getHeight() - pad * 2 - avail) / 2, avail, avail); + } + + @Override protected void paintComponent(Graphics g) { + Graphics2D g2 = (Graphics2D) g.create(); + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2.setColor(new Color(0x0F1E33)); + g2.fillRoundRect(0, 0, getWidth(), getHeight(), 14, 14); + g2.setColor(new Color(0x1B2740)); + g2.drawRoundRect(0, 0, getWidth() - 1, getHeight() - 1, 14, 14); + if (loading || data == null) { + g2.setColor(new Color(0x9FB4D4)); + g2.setFont(Theme.font(13)); + String s = "正在生成地形与等高线…"; + g2.drawString(s, (getWidth() - g2.getFontMetrics().stringWidth(s)) / 2, getHeight() / 2); + g2.dispose(); + return; + } + if (threeDSelected()) paint3D(g2); else paintTop(g2); + g2.dispose(); + } + + private boolean threeDSelected() { return threeD.isSelected(); } + private boolean contoursSelected() { return contours.isSelected(); } + private boolean labelsSelected() { return labels.isSelected(); } + + private void paintTop(Graphics2D g2) { + Rectangle r = mapRect(); + if (r == null) return; + g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); + Shape clip = new RoundRectangle2D.Float(r.x, r.y, r.width, r.height, 10, 10); + g2.clip(clip); + g2.drawImage(data.relief, r.x, r.y, r.width, r.height, null); + g2.setClip(null); + g2.setColor(new Color(0x1B2740)); + g2.drawRoundRect(r.x, r.y, r.width, r.height, 10, 10); + + // contours + if (contoursSelected()) { + g2.setStroke(new BasicStroke(1f)); + for (float level : data.levels) { + float t = (level - data.levels.get(0)) / Math.max(1, data.levels.get(data.levels.size() - 1) - data.levels.get(0)); + if (t > contourReveal) continue; + boolean major = Math.abs(level % 500) < 1; + g2.setColor(major ? new Color(255, 255, 255, 210) : new Color(255, 255, 255, 120)); + g2.setStroke(new BasicStroke(major ? 1.5f : 0.9f)); + for (List line : data.contours.get(level)) { + Path2D p = new Path2D.Double(); + boolean first = true; + for (TerrainField.Point pt : line) { + double x = r.x + pt.u() * r.width, y = r.y + pt.v() * r.height; + if (first) { p.moveTo(x, y); first = false; } else p.lineTo(x, y); + } + g2.draw(p); + } + } + } + // river + if (data.field.river.size() > 2) { + Path2D p = new Path2D.Double(); + boolean first = true; + for (TerrainField.Point pt : data.field.river) { + double x = r.x + pt.u() * r.width, y = r.y + pt.v() * r.height; + if (first) { p.moveTo(x, y); first = false; } else p.lineTo(x, y); + } + g2.setColor(new Color(0x6FD3FF)); + g2.setStroke(new BasicStroke(1.8f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); + g2.draw(p); + } + // peaks + for (TerrainField.PeakPoint pk : data.field.peaks.subList(0, Math.min(6, data.field.peaks.size()))) { + double x = r.x + pk.u() * r.width, y = r.y + pk.v() * r.height; + g2.setColor(new Color(0x111A2E)); + Path2D tri = new Path2D.Double(); + tri.moveTo(x, y - 7); tri.lineTo(x - 6, y + 4); tri.lineTo(x + 6, y + 4); tri.closePath(); + g2.fill(tri); + if (labelsSelected()) { + g2.setFont(Theme.bold(9)); + g2.setColor(new Color(0x111A2E)); + g2.drawString(String.format(Locale.ROOT, "%.0f", pk.height()), (float) x + 7, (float) y + 2); + } + } + // cliff hatching + g2.setColor(new Color(0x5A2D1A)); + for (TerrainField.Point c : data.field.cliffs) { + double x = r.x + c.u() * r.width, y = r.y + c.v() * r.height; + g2.drawLine((int) x, (int) y, (int) x + 4, (int) y + 4); + } + // hover crosshair + if (hoverU >= 0) { + double x = r.x + hoverU * r.width, y = r.y + hoverV * r.height; + g2.setColor(new Color(255, 255, 255, 200)); + g2.setStroke(new BasicStroke(1f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, new float[]{3, 4}, 0)); + g2.drawLine((int) x - 10, (int) y, (int) x + 10, (int) y); + g2.drawLine((int) x, (int) y - 10, (int) x, (int) y + 10); + g2.setColor(new Color(0xFFD166)); + g2.fillOval((int) x - 3, (int) y - 3, 6, 6); + } + // labels (features) + if (labelsSelected()) { + g2.setFont(Theme.bold(10)); + for (TerrainField.Tag tag : data.field.tags) { + double x = r.x + tag.u() * r.width, y = r.y + tag.v() * r.height; + String label = TerrainAnalyzer.featureLabel(tag.feature()); + g2.setColor(new Color(10, 20, 36, 190)); + int tw = g2.getFontMetrics().stringWidth(label); + g2.fillRoundRect((int) x + 8, (int) y - 20, tw + 10, 16, 8, 8); + g2.setColor(Color.WHITE); + g2.drawString(label, (int) x + 13, (int) y - 8); + } + } + } + + private void paint3D(Graphics2D g2) { + int n = Math.min(76, data.field.size - 1); + int step = Math.max(1, data.field.size / n); + List cells = new ArrayList<>(); + double scale = Math.min(getWidth(), getHeight()) * 0.58; + double cx = getWidth() / 2.0, cy = getHeight() * 0.56; + double range = Math.max(1, data.field.maxHeight - data.field.minHeight); + for (int y = 0; y < data.field.size - step; y += step) + for (int x = 0; x < data.field.size - step; x += step) { + double u0 = (double) x / (data.field.size - 1), v0 = (double) y / (data.field.size - 1); + double u1 = (double) (x + step) / (data.field.size - 1), v1 = (double) (y + step) / (data.field.size - 1); + double h = data.field.heightAt((u0 + u1) / 2, (v0 + v1) / 2); + double[] p = project((u0 + u1) / 2 - 0.5, (v0 + v1) / 2 - 0.5, h / range, scale, cx, cy); + cells.add(new int[]{x, y, (int) Math.round(p[2] * 1000)}); + } + cells.sort(Comparator.comparingInt(a -> a[2])); + for (int[] cell : cells) { + int x = cell[0], y = cell[1]; + double u0 = (double) x / (data.field.size - 1), v0 = (double) y / (data.field.size - 1); + double u1 = (double) (x + step) / (data.field.size - 1), v1 = (double) (y + step) / (data.field.size - 1); + float h = data.field.heightAt((u0 + u1) / 2, (v0 + v1) / 2); + Color c = TerrainAnalyzer.colorSmooth(h); + Polygon poly = new Polygon(); + addProj(poly, u0, v0, h / range, scale, cx, cy); + addProj(poly, u1, v0, data.field.heightAt(u1, v0) / range, scale, cx, cy); + addProj(poly, u1, v1, data.field.heightAt(u1, v1) / range, scale, cx, cy); + addProj(poly, u0, v1, data.field.heightAt(u0, v1) / range, scale, cx, cy); + g2.setColor(c); + g2.fillPolygon(poly); + g2.setColor(new Color(0, 0, 0, 22)); + g2.drawPolygon(poly); + } + g2.setColor(new Color(0x9FB4D4)); + g2.setFont(Theme.font(11)); + g2.drawString("3D 轴测视图 · 拖动旋转", 20, getHeight() - 18); + } + + private double[] project(double x, double y, double z, double scale, double cx, double cy) { + double cos = Math.cos(yaw), sin = Math.sin(yaw); + double xr = x * cos - y * sin, yr = x * sin + y * cos; + double sx = (xr - yr) * 0.86; + double sy = (xr + yr) * 0.48 - z * 0.72; + return new double[]{cx + sx * scale * 0.5, cy + sy * scale * 0.5, yr}; + } + + private void addProj(Polygon p, double x, double y, double z, double scale, double cx, double cy) { + double[] q = project(x - 0.5, y - 0.5, z, scale, cx, cy); + p.addPoint((int) q[0], (int) q[1]); + } + + } +} diff --git a/Java/src/main/java/com/gc/ui/CoursewarePage.java b/Java/src/main/java/com/gc/ui/CoursewarePage.java new file mode 100644 index 0000000..5de74c5 --- /dev/null +++ b/Java/src/main/java/com/gc/ui/CoursewarePage.java @@ -0,0 +1,208 @@ +package com.gc.ui; + +import com.gc.core.AppPaths; +import com.gc.core.LocalWebServer; +import javafx.application.Platform; +import javafx.concurrent.Worker; +import javafx.embed.swing.JFXPanel; +import javafx.scene.Scene; +import javafx.scene.paint.Color; +import javafx.scene.web.WebEngine; +import javafx.scene.web.WebView; + +import javax.swing.*; +import javax.swing.border.EmptyBorder; +import java.awt.*; +import java.awt.Desktop; +import java.io.File; +import java.net.URI; +import java.nio.file.Path; + +/** + * 原始 HTML 课件页:用 JavaFX WebView 加载 C# 版本内置的离线课件。 + * + *

课件目录通过 127.0.0.1 的临时静态服务器提供,从而保留相对路径、 + * 视频 HTTP Range 拖动与 Three.js 资源加载;不联网、不暴露到局域网。

+ */ +public final class CoursewarePage extends JPanel { + private final MainWindow app; + private final JLabel status = Theme.label("正在准备课件…", 11, Theme.FAINT); + private final JPanel stage = new JPanel(new BorderLayout()); + private JFXPanel fxPanel; + private WebView webView; + private LocalWebServer server; + private Path root; + + public CoursewarePage(MainWindow app) { + this.app = app; + setLayout(new BorderLayout()); + setOpaque(false); + JPanel page = UI.page(); + page.add(header(), BorderLayout.NORTH); + stage.setOpaque(false); + stage.setBorder(BorderFactory.createCompoundBorder( + BorderFactory.createLineBorder(Theme.LINE, 1, true), + new EmptyBorder(1, 1, 1, 1))); + page.add(stage, BorderLayout.CENTER); + page.add(footer(), BorderLayout.SOUTH); + add(page, BorderLayout.CENTER); + root = app.paths.coursewareRoot(); + if (root == null) { + showFallback("未找到原始 HTML 课件目录(courseware/index.html)。\n" + + "开发态请确认 Java/courseware 存在;发行版请确认 courseware/ 与程序同级。"); + } else if (GraphicsEnvironment.isHeadless()) { + showFallback("当前为无头环境,课件不会创建 WebView。\n课件目录:" + root); + } else { + initFx(); + } + } + + private JComponent header() { + JPanel wrap = new JPanel(new BorderLayout()); + wrap.setOpaque(false); + JPanel left = new JPanel(); + left.setOpaque(false); + left.setLayout(new UI.VStackLayout()); + left.add(Theme.boldLabel("等高线地形 · 五大典型地貌判读", 25, Theme.INK)); + left.add(Theme.label("原始离线 HTML 课件 · JavaFX WebView · 视频 / Three.js / 交互式实验", 12.5f, Theme.DIM)); + wrap.add(left, BorderLayout.WEST); + JPanel right = new JPanel(new FlowLayout(FlowLayout.RIGHT, 8, 0)); + right.setOpaque(false); + UI.RoundButton reload = UI.button("刷新"); + reload.addActionListener(e -> reload()); + UI.RoundButton browser = UI.button("用浏览器打开"); + browser.addActionListener(e -> openBrowser()); + UI.RoundButton full = UI.primary("全屏"); + full.addActionListener(e -> toggleFullScreen()); + right.add(reload); + right.add(browser); + right.add(full); + wrap.add(right, BorderLayout.EAST); + wrap.setBorder(new EmptyBorder(0, 0, 16, 0)); + return wrap; + } + + private JComponent footer() { + JPanel p = new JPanel(new BorderLayout()); + p.setOpaque(false); + p.setBorder(new EmptyBorder(10, 2, 0, 2)); + status.setForeground(Theme.DIM); + p.add(status, BorderLayout.WEST); + JLabel hint = Theme.label("课件完全离线运行 · 数据来源:C#/GC-UI/frontend/courseware", 10.5f, Theme.FAINT); + p.add(hint, BorderLayout.EAST); + return p; + } + + private void initFx() { + try { + fxPanel = new JFXPanel(); + stage.add(fxPanel, BorderLayout.CENTER); + server = new LocalWebServer(root); + String url = server.url(); + Platform.setImplicitExit(false); + Platform.runLater(() -> { + try { + webView = new WebView(); + webView.setContextMenuEnabled(true); + webView.setStyle("-fx-font-smoothing-type: gray;"); + WebEngine engine = webView.getEngine(); + engine.setJavaScriptEnabled(true); + try { + Path userData = app.paths.cacheRoot().resolve("webview"); + java.nio.file.Files.createDirectories(userData); + engine.setUserDataDirectory(userData.toFile()); + // 用用户样式表设置中文字体,避免在 LoadWorker 回调里执行 JS + //(JavaFX 21 WebKit 在 JDK 26 上executeScript 会触发 JNI 崩溃)。 + Path css = userData.resolve("gc-courseware.css"); + java.nio.file.Files.writeString(css, + "html,body,input,button,div,span,p,h1,h2,h3,h4,text { " + + "font-family: 'PingFang SC','Microsoft YaHei','Noto Sans CJK SC','Segoe UI',sans-serif !important; }", + java.nio.charset.StandardCharsets.UTF_8); + engine.setUserStyleSheetLocation(css.toUri().toString()); + } catch (Exception ignored) { } + engine.getLoadWorker().stateProperty().addListener((obs, old, now) -> { + if (now == Worker.State.RUNNING) setStatus("正在加载课件 " + url); + else if (now == Worker.State.SUCCEEDED) { + setStatus("课件加载完成 · 可直接操作"); + } else if (now == Worker.State.FAILED) { + setStatus("课件加载失败:" + engine.getLoadWorker().getException()); + } + }); + engine.setOnError(e -> setStatus("WebView 错误:" + e.getMessage())); + engine.load(url); + fxPanel.setScene(new Scene(webView, Color.web("#eef4fc"))); + } catch (Throwable t) { + showFallback("JavaFX WebView 初始化失败:" + t.getMessage()); + } + }); + } catch (Throwable t) { + showFallback("JavaFX WebView 不可用:" + t.getMessage() + "\n可以点击「用浏览器打开」查看原始 HTML。"); + } + } + + private void reload() { + if (webView != null) { + Platform.runLater(() -> webView.getEngine().reload()); + setStatus("正在重新加载…"); + } else if (root != null) { + openBrowser(); + } + } + + private void openBrowser() { + try { + if (root == null) return; + File f = root.resolve("index.html").toFile(); + Desktop.getDesktop().browse(f.toURI()); + setStatus("已在系统浏览器打开原始 HTML"); + } catch (Exception e) { + UI.error(this, "无法打开浏览器:" + e.getMessage()); + } + } + + private void toggleFullScreen() { + Window w = SwingUtilities.getWindowAncestor(this); + if (!(w instanceof JFrame f)) return; + GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); + if (gd.getFullScreenWindow() == f) gd.setFullScreenWindow(null); + else gd.setFullScreenWindow(f); + } + + private void setStatus(String s) { + SwingUtilities.invokeLater(() -> status.setText(s)); + } + + private void showFallback(String message) { + stage.removeAll(); + JPanel box = new JPanel(new GridBagLayout()); + box.setOpaque(false); + UI.Card card = new UI.Card(); + card.setLayout(new UI.VStackLayout()); + card.setBorder(new EmptyBorder(30, 34, 30, 34)); + card.add(Theme.boldLabel("原始 HTML 课件", 19, Theme.INK)); + card.add(Box.createVerticalStrut(8)); + JLabel l = Theme.label("" + message.replace("\n", "
") + "", 12.5f, Theme.DIM); + card.add(l); + card.add(Box.createVerticalStrut(16)); + JPanel actions = new JPanel(new FlowLayout(FlowLayout.LEFT, 8, 0)); + actions.setOpaque(false); + UI.RoundButton b = UI.primary("用系统浏览器打开"); + b.addActionListener(e -> openBrowser()); + actions.add(b); + card.add(actions); + box.add(card); + stage.add(box, BorderLayout.CENTER); + status.setText(message.replace("\n", " · ")); + stage.revalidate(); + stage.repaint(); + } + + public void disposePanel() { + try { if (server != null) server.close(); } catch (Exception ignored) { } + try { + if (webView != null) Platform.runLater(() -> { + try { webView.getEngine().load(null); } catch (Exception ignored) { } + }); + } catch (Throwable ignored) { } + } +} diff --git a/Java/src/main/java/com/gc/ui/DownloadPage.java b/Java/src/main/java/com/gc/ui/DownloadPage.java new file mode 100644 index 0000000..550518c --- /dev/null +++ b/Java/src/main/java/com/gc/ui/DownloadPage.java @@ -0,0 +1,208 @@ +package com.gc.ui; + +import com.gc.core.*; + +import javax.swing.*; +import javax.swing.border.EmptyBorder; +import java.awt.*; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; + +/** 下载 / 更新页:更新源、检查更新、进度、远端模型列表、本地导入。 */ +public final class DownloadPage extends JPanel { + private final MainWindow app; + private final UI.TextField repo = new UI.TextField(); + private final UI.TextField local = new UI.TextField(); + private final UI.Switch auto = new UI.Switch(I18n.t("update.auto"), true); + private final UI.Switch signed = new UI.Switch(I18n.t("set.requireSigned"), true); + private final UI.Progress progress = new UI.Progress(); + private final JLabel status = Theme.label("", 12, Theme.DIM); + private final JPanel remoteList = new JPanel(); + private final JLabel remoteTitle = Theme.boldLabel("", 14, Theme.INK); + private UI.RoundButton checkBtn; + + public DownloadPage(MainWindow app) { + this.app = app; + setLayout(new BorderLayout()); + setOpaque(false); + JPanel page = UI.page(); + page.add(UI.pageHeader(I18n.t("dl.title"), I18n.t("dl.subtitle"), null), BorderLayout.NORTH); + + JPanel cols = new JPanel(new GridLayout(1, 2, 16, 0)); + cols.setOpaque(false); + cols.add(left()); + cols.add(right()); + page.add(cols, BorderLayout.CENTER); + add(page, BorderLayout.CENTER); + } + + private JComponent left() { + JPanel col = new JPanel(); + col.setOpaque(false); + col.setLayout(new UI.VStackLayout()); + + UI.Card src = new UI.Card(); + src.setLayout(new UI.VStackLayout()); + src.setBorder(new EmptyBorder(18, 20, 18, 20)); + src.setAlignmentX(Component.LEFT_ALIGNMENT); + src.setMaximumSize(new Dimension(Integer.MAX_VALUE, 340)); + JLabel srcTitle = Theme.boldLabel(I18n.t("dl.source"), 15, Theme.INK); + srcTitle.setAlignmentX(Component.LEFT_ALIGNMENT); + src.add(srcTitle); + src.add(Box.createVerticalStrut(12)); + src.add(UI.labeled(I18n.t("set.updateRepo"), repo)); + src.add(Box.createVerticalStrut(10)); + JPanel localRow = new JPanel(new BorderLayout(6, 0)); + localRow.setOpaque(false); + localRow.add(local, BorderLayout.CENTER); + UI.RoundButton browse = UI.button(I18n.t("common.browse")); + browse.addActionListener(e -> { + JFileChooser fc = new JFileChooser(); + fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) local.setText(fc.getSelectedFile().getAbsolutePath()); + }); + localRow.add(browse, BorderLayout.EAST); + src.add(UI.labeled(I18n.t("set.updateLocal"), localRow)); + src.add(Box.createVerticalStrut(12)); + auto.setAlignmentX(Component.LEFT_ALIGNMENT); + signed.setAlignmentX(Component.LEFT_ALIGNMENT); + src.add(auto); + src.add(signed); + src.add(Box.createVerticalStrut(12)); + checkBtn = UI.primary(I18n.t("dl.check")); + checkBtn.setAlignmentX(Component.LEFT_ALIGNMENT); + checkBtn.addActionListener(e -> check()); + src.add(checkBtn); + src.add(Box.createVerticalStrut(12)); + progress.setAlignmentX(Component.LEFT_ALIGNMENT); + progress.setMaximumSize(new Dimension(Integer.MAX_VALUE, 8)); + src.add(progress); + src.add(Box.createVerticalStrut(6)); + status.setAlignmentX(Component.LEFT_ALIGNMENT); + src.add(status); + col.add(src); + col.add(Box.createVerticalStrut(16)); + + UI.Card imp = new UI.Card(); + imp.setLayout(new UI.VStackLayout()); + imp.setBorder(new EmptyBorder(18, 20, 18, 20)); + imp.setAlignmentX(Component.LEFT_ALIGNMENT); + imp.setMaximumSize(new Dimension(Integer.MAX_VALUE, 160)); + JLabel impTitle = Theme.boldLabel(I18n.t("dl.import"), 15, Theme.INK); + impTitle.setAlignmentX(Component.LEFT_ALIGNMENT); + imp.add(impTitle); + imp.add(Box.createVerticalStrut(5)); + imp.add(Theme.label(I18n.t("dl.hint"), 11.5f, Theme.DIM)); + imp.add(Box.createVerticalStrut(12)); + UI.RoundButton doImport = UI.button(I18n.t("dl.import")); + doImport.setAlignmentX(Component.LEFT_ALIGNMENT); + doImport.addActionListener(e -> { + JFileChooser fc = new JFileChooser(); + fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + if (fc.showOpenDialog(this) != JFileChooser.APPROVE_OPTION) return; + Path root = fc.getSelectedFile().toPath(); + try { + int n = ModelInstaller.importLocal(root, app.modelRoot()); + app.refreshModels(); + UI.toast(this, I18n.f("dl.imported", n)); + } catch (Exception ex) { + UI.error(this, I18n.f("dl.importFailed", ex.getMessage())); + } + }); + imp.add(doImport); + col.add(imp); + col.add(Box.createVerticalGlue()); + return col; + } + + private JComponent right() { + UI.Card card = new UI.Card(new BorderLayout(0, 10)); + card.setBorder(new EmptyBorder(18, 20, 18, 20)); + card.add(remoteTitle, BorderLayout.NORTH); + remoteList.setOpaque(false); + remoteList.setLayout(new UI.VStackLayout()); + card.add(UI.scroll(remoteList), BorderLayout.CENTER); + return card; + } + + public void onShow() { + repo.setText(app.settings.updateRepository); + local.setText(app.settings.updateLocalRoot); + auto.setSelected(app.settings.autoUpdateOnStartup); + signed.setSelected(app.settings.requireSignedManifest); + remoteTitle.setText(I18n.t("dl.available")); + if (remoteList.getComponentCount() == 0) refreshLocalList(); + } + + private void refreshLocalList() { + remoteList.removeAll(); + for (ModelManifest.Package p : app.models()) { + remoteList.add(row(p.id(), "v" + p.manifest.version, + p.manifest.localizedName(), Theme.SUCCESS, I18n.t("dl.installed"))); + remoteList.add(Box.createVerticalStrut(6)); + } + if (app.models().isEmpty()) remoteList.add(Theme.label(I18n.t("dl.empty"), 12, Theme.DIM)); + remoteList.revalidate(); + remoteList.repaint(); + } + + private JComponent row(String id, String ver, String name, Color color, String tag) { + JPanel p = new JPanel(new BorderLayout(8, 0)); + p.setOpaque(false); + p.setMaximumSize(new Dimension(Integer.MAX_VALUE, 46)); + JPanel l = new JPanel(); + l.setOpaque(false); + l.setLayout(new UI.VStackLayout()); + l.add(Theme.boldLabel(name, 12.5f, Theme.INK)); + l.add(Theme.label(id + " · " + ver, 10, Theme.FAINT)); + p.add(l, BorderLayout.CENTER); + p.add(Theme.label(tag, 10.5f, color), BorderLayout.EAST); + return p; + } + + private void check() { + app.settings.updateRepository = repo.getText().trim(); + app.settings.updateLocalRoot = local.getText().trim(); + app.settings.autoUpdateOnStartup = auto.isSelected(); + app.settings.requireSignedManifest = signed.isSelected(); + app.settings.save(); + checkBtn.setEnabled(false); + progress.setValue(0.02); + status.setForeground(Theme.DIM); + status.setText(I18n.t("dl.checking")); + remoteList.removeAll(); + remoteTitle.setText(I18n.t("dl.checking")); + remoteList.revalidate(); + + new Thread(() -> { + UpdateService.Result r = new UpdateService(app.paths, app.settings).run(true, p -> SwingUtilities.invokeLater(() -> { + progress.setValue(p.value()); + status.setText(p.message() + (p.detail() == null || p.detail().isBlank() ? "" : " " + p.detail())); + })); + SwingUtilities.invokeLater(() -> { + checkBtn.setEnabled(true); + progress.setValue(1); + status.setText(r.message()); + status.setForeground(r.outcome() == UpdateService.Outcome.UNAVAILABLE ? Theme.WARN : Theme.SUCCESS); + remoteTitle.setText(I18n.t("dl.available")); + remoteList.removeAll(); + if (r.manifest() != null && !r.manifest().models.isEmpty()) { + for (Remote.RepoModel m : r.manifest().models) { + ModelManifest.Package localPkg = app.findModel(m.id()); + boolean installed = localPkg != null && localPkg.manifest.version.equals(m.version()); + remoteList.add(row(m.id(), "v" + m.version(), m.id(), installed ? Theme.SUCCESS : Theme.ACCENT, + installed ? I18n.t("dl.installed") : m.version())); + remoteList.add(Box.createVerticalStrut(6)); + } + } else refreshLocalList(); + if (r.error() != null) { + remoteList.add(Theme.label(r.error(), 10.5f, Theme.DANGER)); + } + app.refreshModels(); + remoteList.revalidate(); + remoteList.repaint(); + }); + }, "gc-download-check").start(); + } +} diff --git a/Java/src/main/java/com/gc/ui/EarthPanel.java b/Java/src/main/java/com/gc/ui/EarthPanel.java new file mode 100644 index 0000000..85467cd --- /dev/null +++ b/Java/src/main/java/com/gc/ui/EarthPanel.java @@ -0,0 +1,583 @@ +package com.gc.ui; + +import com.gc.core.I18n; +import com.gc.core.Json; +import com.gc.core.ModelManifest; +import com.gc.model.earth.EarthMath; + +import javax.swing.*; +import javax.swing.border.EmptyBorder; +import java.awt.*; +import java.awt.event.*; +import java.awt.geom.*; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.*; +import java.util.List; + +/** 地球自转 / 公转:球体、晨昏线、直射点、轨道与四季;播放、拖动、缩放、节气定位。 */ +public final class EarthPanel extends JPanel { + private final boolean revolution; + private final EarthData data; + private final JComponent canvas; + private final javax.swing.Timer timer; + private double spin = 0, orbit = 0, speed = 1; + private boolean playing = true; + private boolean labels = true, grid; + private double viewYaw = 18, viewPitch = 22, zoom = 1; + private final JLabel spinInfo = Theme.label("", 11.5f, new Color(0xC6D5EC)); + private final JLabel orbitInfo = Theme.label("", 11.5f, new Color(0xC6D5EC)); + private final JLabel declInfo = Theme.boldLabel("", 17, new Color(0xEAF2FF)); + private final JLabel dateInfo = Theme.label("", 11.5f, new Color(0x9FB4D4)); + private final JLabel seasonInfo = Theme.label("", 11.5f, new Color(0xE9B25B)); + private final JLabel speedLabel = Theme.label("1.0×", 11, new Color(0x9FB4D4)); + private final JLabel lessonTitle = Theme.boldLabel("", 12.5f, new Color(0xEAF2FF)); + private final JLabel lessonBody = Theme.label("", 11, new Color(0xA9BBD8)); + + public EarthPanel(ModelManifest.Package pkg, boolean revolution) { + this.revolution = revolution; + this.data = EarthData.load(pkg.dataDir()); + setLayout(new BorderLayout()); + setBackground(new Color(0x080F1C)); + canvas = createCanvas(); + installViewControls(); + add(header(), BorderLayout.NORTH); + JPanel main = new JPanel(new BorderLayout(12, 0)); + main.setOpaque(false); + main.setBorder(new EmptyBorder(0, 12, 10, 14)); + main.add(canvas, BorderLayout.CENTER); + main.add(sidebar(), BorderLayout.EAST); + add(main, BorderLayout.CENTER); + JComponent footer = footer(); + add(footer, BorderLayout.SOUTH); + timer = new javax.swing.Timer(16, e -> tick()); + timer.start(); + updateHud(); + updateLesson(0); + } + + /** 优先使用 JOGL OpenGL 场景;无显示环境或驱动不可用时回退 Java2D。 */ + private JComponent createCanvas() { + try { + if (GlEarthView.available()) { + return new GlEarthView(new GlEarthView.Scene() { + @Override public boolean revolution() { return revolution; } + @Override public double spin() { return spin; } + @Override public double orbit() { return orbit; } + @Override public boolean labels() { return labels; } + @Override public boolean grid() { return grid; } + @Override public List> land() { return data.land; } + }); + } + } catch (Throwable t) { + System.err.println("[earth] OpenGL 初始化失败,回退 Java2D: " + t.getMessage()); + } + return new EarthCanvas(); + } + + /** Java2D 回退画布的拖动控制;OpenGL 画布自身已实现同样的交互。 */ + private void installViewControls() { + if (!(canvas instanceof EarthCanvas)) return; + java.awt.event.MouseAdapter ma = new java.awt.event.MouseAdapter() { + private int x, y; + @Override public void mousePressed(MouseEvent e) { x = e.getX(); y = e.getY(); } + @Override public void mouseDragged(MouseEvent e) { + viewYaw += (e.getX() - x) * 0.45; + viewPitch = Math.max(-78, Math.min(78, viewPitch - (e.getY() - y) * 0.35)); + x = e.getX(); y = e.getY(); + canvas.repaint(); + } + }; + canvas.addMouseListener(ma); + canvas.addMouseMotionListener(ma); + canvas.addMouseWheelListener(e -> { + zoom = Math.max(0.55, Math.min(2.2, zoom * (e.getWheelRotation() < 0 ? 1.12 : 0.89))); + canvas.repaint(); + }); + } + + private JComponent header() { + JPanel h = new JPanel(new BorderLayout()); + h.setBackground(new Color(0x0C1828)); + h.setBorder(BorderFactory.createCompoundBorder( + BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(0x1B2740)), + new EmptyBorder(12, 18, 10, 18))); + JPanel t = new JPanel(); + t.setOpaque(false); + t.setLayout(new UI.VStackLayout()); + t.add(Theme.boldLabel(revolution ? "地球公转 · 四季成因" : "地球自转 · 昼夜交替", 20, new Color(0xEAF2FF))); + t.add(Theme.label(revolution ? "地轴指向不变,太阳直射点在南北回归线之间往返" + : "自西向东转动 · 晨昏线分割昼夜 · 太阳直射点随季节移动", 11, new Color(0x9FB4D4))); + h.add(t, BorderLayout.WEST); + return h; + } + + private JComponent footer() { + JPanel f = new JPanel(new BorderLayout()); + f.setBackground(new Color(0x0C1828)); + f.setBorder(BorderFactory.createCompoundBorder( + BorderFactory.createMatteBorder(1, 0, 0, 0, new Color(0x1B2740)), + new EmptyBorder(8, 16, 8, 16))); + JPanel l = new JPanel(new FlowLayout(FlowLayout.LEFT, 8, 0)); + l.setOpaque(false); + UI.RoundButton play = UI.primary("⏸ 暂停"); + play.addActionListener(e -> { playing = !playing; play.setText(playing ? "⏸ 暂停" : "▶ 播放"); }); + l.add(play); + UI.RoundButton reset = UI.button("重置"); + reset.addActionListener(e -> { + spin = 0; orbit = 0; playing = true; + zoom = 1; viewYaw = 18; viewPitch = 22; + if (canvas instanceof GlEarthView gl) gl.resetView(); + updateHud(); canvas.repaint(); + }); + l.add(reset); + l.add(Theme.label("速度", 11, new Color(0x9FB4D4))); + UI.Slider sp = new UI.Slider(1, 50, 10, false); + sp.setPreferredSize(new Dimension(150, 28)); + sp.addChangeListener(e -> { + speed = sp.getValue() / 10.0; + speedLabel.setText(String.format(Locale.ROOT, "%.1f×", speed)); + }); + l.add(sp); + l.add(speedLabel); + UI.Switch lab = new UI.Switch("标注", true); + lab.addActionListener(e -> { labels = lab.isSelected(); canvas.repaint(); }); + UI.Switch gr = new UI.Switch("经纬网", !revolution); + gr.addActionListener(e -> { grid = gr.isSelected(); canvas.repaint(); }); + grid = gr.isSelected(); + l.add(lab); l.add(gr); + f.add(l, BorderLayout.WEST); + JLabel hint = Theme.label("拖动旋转视角(上下/左右) · 滚轮缩放", 10.5f, new Color(0x71819A)); + f.add(hint, BorderLayout.EAST); + return f; + } + + private JComponent sidebar() { + JPanel p = new JPanel(); + p.setOpaque(false); + p.setLayout(new UI.VStackLayout()); + p.setPreferredSize(new Dimension(320, 0)); + + UI.Card hud = card(); + hud.setLayout(new UI.VStackLayout()); + hud.add(Theme.label(I18n.t("player.subsolar"), 11, new Color(0x9FB4D4))); + hud.add(Box.createVerticalStrut(3)); + declInfo.setAlignmentX(Component.LEFT_ALIGNMENT); + hud.add(declInfo); + hud.add(Box.createVerticalStrut(4)); + dateInfo.setAlignmentX(Component.LEFT_ALIGNMENT); + hud.add(dateInfo); + hud.add(Box.createVerticalStrut(2)); + seasonInfo.setAlignmentX(Component.LEFT_ALIGNMENT); + hud.add(seasonInfo); + hud.add(Box.createVerticalStrut(10)); + spinInfo.setAlignmentX(Component.LEFT_ALIGNMENT); + orbitInfo.setAlignmentX(Component.LEFT_ALIGNMENT); + hud.add(spinInfo); + hud.add(Box.createVerticalStrut(3)); + hud.add(orbitInfo); + p.add(hud); + p.add(Box.createVerticalStrut(10)); + + UI.Card seasons = card(); + seasons.setLayout(new UI.VStackLayout()); + seasons.add(Theme.boldLabel(I18n.t("player.seasons"), 12.5f, new Color(0xEAF2FF))); + seasons.add(Box.createVerticalStrut(6)); + JPanel sg = new JPanel(new GridLayout(2, 2, 6, 6)); + sg.setOpaque(false); + for (EarthMath.Season s : EarthMath.SEASONS) { + UI.RoundButton b = UI.button(I18n.t(s.key())); + b.setFont(Theme.font(11)); + b.setBorder(new EmptyBorder(5, 8, 5, 8)); + b.addActionListener(e -> { orbit = s.angleDeg(); playing = false; updateHud(); updateSeason(s); canvas.repaint(); }); + sg.add(b); + } + seasons.add(sg); + p.add(seasons); + p.add(Box.createVerticalStrut(10)); + + UI.Card lesson = card(); + lesson.setLayout(new UI.VStackLayout()); + lesson.add(Theme.boldLabel(I18n.t("player.lessons"), 12.5f, new Color(0xEAF2FF))); + lesson.add(Box.createVerticalStrut(8)); + JPanel list = new JPanel(); + list.setOpaque(false); + list.setLayout(new UI.VStackLayout()); + for (int i = 0; i < data.lessons.size(); i++) { + final int idx = i; + UI.RoundButton b = UI.button(data.lessons.get(i).title()); + b.setFont(Theme.font(10.5f)); + b.setBorder(new EmptyBorder(4, 8, 4, 8)); + b.setAlignmentX(Component.LEFT_ALIGNMENT); + b.addActionListener(e -> { + EarthData.Lesson l = data.lessons.get(idx); + orbit = l.angleDeg; + playing = false; + updateLesson(idx); + updateHud(); + canvas.repaint(); + }); + list.add(b); + list.add(Box.createVerticalStrut(3)); + } + lesson.add(list); + p.add(lesson); + p.add(Box.createVerticalGlue()); + return p; + } + + private UI.Card card() { + UI.Card c = new UI.Card(); + c.setBorder(new EmptyBorder(12, 14, 12, 14)); + c.setAlignmentX(Component.LEFT_ALIGNMENT); + c.setMaximumSize(new Dimension(Integer.MAX_VALUE, 900)); + c.alt = true; + c.bgOverride = new Color(0x121D2E); + c.borderOverride = new Color(0x24324A); + return c; + } + + private void updateLesson(int i) { + if (data.lessons.isEmpty()) return; + EarthData.Lesson l = data.lessons.get(i); + lessonTitle.setText(l.title()); + lessonBody.setText("" + l.body() + ""); + } + + private void updateSeason(EarthMath.Season s) { + seasonInfo.setText(I18n.t(s.key()) + " · " + s.date()); + } + + private void updatePlayText() { } + + public void disposePanel() { + if (timer != null) timer.stop(); + } + + private void tick() { + if (!playing) return; + double dt = 1.0 / 60; + double[] r = EarthMath.stepAngles(spin, orbit, dt, speed); + spin = r[0]; orbit = r[1]; + updateHud(); + canvas.repaint(); + } + + private void updateHud() { + double decl = EarthMath.subsolarLatitude(orbit); + declInfo.setText(String.format(Locale.ROOT, "%+.1f° %s", decl, decl >= 0 ? "N" : "S")); + dateInfo.setText(I18n.f("player.dateInfo", EarthMath.dateText(orbit))); + EarthMath.Season season = EarthMath.nearestSeason(orbit); + seasonInfo.setText(I18n.t(season.key()) + " · " + season.date()); + spinInfo.setText(I18n.f("player.spinInfo", String.format(Locale.ROOT, "%.0f", spin), "23.93")); + orbitInfo.setText(I18n.f("player.orbitInfo", String.format(Locale.ROOT, "%.0f", orbit))); + } + + private final class EarthCanvas extends JComponent { + EarthCanvas() { setOpaque(false); } + + @Override protected void paintComponent(Graphics g) { + Graphics2D g2 = (Graphics2D) g.create(); + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + paintSpace(g2); + Graphics2D scene = (Graphics2D) g2.create(); + int w = getWidth(), h = getHeight(); + double squash = Math.max(0.35, Math.cos(Math.toRadians(viewPitch)) / Math.cos(Math.toRadians(22))); + scene.translate(w / 2.0, h / 2.0); + scene.scale(1, squash); + scene.translate(-w / 2.0, -h / 2.0); + if (revolution) paintOrbit(scene); else paintGlobeScene(scene); + scene.dispose(); + g2.dispose(); + } + + private void paintSpace(Graphics2D g2) { + g2.setColor(new Color(0x080F1C)); + g2.fillRoundRect(0, 0, getWidth(), getHeight(), 14, 14); + Random rnd = new Random(42); + for (int i = 0; i < 130; i++) { + int x = rnd.nextInt(Math.max(1, getWidth())), y = rnd.nextInt(Math.max(1, getHeight())); + g2.setColor(new Color(255, 255, 255, 25 + rnd.nextInt(100))); + g2.fillOval(x, y, 1 + rnd.nextInt(2), 1 + rnd.nextInt(2)); + } + } + + private void paintGlobeScene(Graphics2D g2) { + int w = getWidth(), h = getHeight(); + double r = Math.min(w, h) * 0.34 * zoom; + double cx = w * 0.46, cy = h * 0.50; + drawGlobe(g2, cx, cy, r, spin + viewYaw, EarthMath.TILT, labels); + // mini orbit + drawOrbitInset(g2, w - 190, h - 150, 150, 120); + // caption + g2.setColor(new Color(0x9FB4D4)); + g2.setFont(Theme.font(11)); + g2.drawString("自西向东 · 从北极上空看逆时针", 20, h - 20); + } + + private void paintOrbit(Graphics2D g2) { + int w = getWidth(), h = getHeight(); + double cx = w * 0.47, cy = h * 0.52; + double rx = Math.min(w * 0.33, 380), ry = Math.min(h * 0.32, 250); + // orbit ellipse + g2.setColor(new Color(0x2B3E60)); + g2.setStroke(new BasicStroke(2f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, new float[]{6, 8}, 0)); + g2.draw(new Ellipse2D.Double(cx - rx, cy - ry, rx * 2, ry * 2)); + g2.setStroke(new BasicStroke(1)); + // sun + RadialGradientPaint sun = new RadialGradientPaint(new Point2D.Double(cx, cy), 70, + new float[]{0, 1}, new Color[]{new Color(0xFFE3A3), new Color(255, 194, 75, 40)}); + g2.setPaint(sun); + g2.fillOval((int) (cx - 70), (int) (cy - 70), 140, 140); + g2.setColor(new Color(0xFFC24B)); + g2.fillOval((int) (cx - 26), (int) (cy - 26), 52, 52); + if (labels) { + g2.setColor(new Color(0xEAF2FF)); + g2.setFont(Theme.bold(12)); + g2.drawString(I18n.t("star.sun"), (int) cx - 12, (int) cy + 5); + } + // seasons labels + String[] order = {"season.springEquinox", "season.summerSolstice", "season.autumnEquinox", "season.winterSolstice"}; + double[] angles = {0, 90, 180, 270}; + for (int i = 0; i < 4; i++) { + double a = Math.toRadians(angles[i]); + double x = cx - rx * Math.sin(a), y = cy - ry * Math.cos(a); + boolean near = Math.abs(((orbit - angles[i] + 540) % 360) - 180) > 160; + g2.setColor(near ? new Color(0xFFD166) : new Color(0x71819A)); + g2.setFont(near ? Theme.bold(11) : Theme.font(11)); + String s = I18n.t(order[i]); + g2.drawString(s, (float) x - g2.getFontMetrics().stringWidth(s) / 2f, (float) (y - 12)); + if (near) { + g2.setColor(new Color(0xFFD166)); + g2.fillOval((int) x - 3, (int) y - 3, 6, 6); + } + } + // earth on orbit + double a = Math.toRadians(orbit); + double ex = cx - rx * Math.sin(a), ey = cy - ry * Math.cos(a); + drawGlobe(g2, ex, ey, 34 * zoom, spin + viewYaw, EarthMath.TILT, labels); + // axis line + g2.setColor(new Color(255, 255, 255, 130)); + g2.setStroke(new BasicStroke(1.2f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, new float[]{3, 4}, 0)); + g2.drawLine((int) (ex + 12), (int) (ey - 58), (int) (ex - 12), (int) (ey + 58)); + // sun->earth line + g2.setColor(new Color(255, 200, 90, 70)); + g2.setStroke(new BasicStroke(1f)); + g2.drawLine((int) cx, (int) cy, (int) ex, (int) ey); + if (labels) { + g2.setColor(new Color(0xEAF2FF)); + g2.setFont(Theme.bold(10.5f)); + String s = EarthMath.dateText(orbit); + g2.drawString(s, (float) ex + 42, (float) ey + 4); + g2.setColor(new Color(0xFFD166)); + g2.drawString(String.format(Locale.ROOT, "%.1f°%s", Math.abs(EarthMath.subsolarLatitude(orbit)), + EarthMath.subsolarLatitude(orbit) >= 0 ? "N" : "S"), (float) ex + 42, (float) ey + 20); + } + } + + private void drawOrbitInset(Graphics2D g2, double x, double y, double w, double h) { + g2.setColor(new Color(0x0F1E33)); + g2.fillRoundRect((int) x, (int) y, (int) w, (int) h, 10, 10); + g2.setColor(new Color(0x1B2740)); + g2.drawRoundRect((int) x, (int) y, (int) w - 1, (int) h - 1, 10, 10); + double cx = x + w / 2, cy = y + h / 2 + 6, rx = w * 0.35, ry = h * 0.30; + g2.setColor(new Color(0x2B3E60)); + g2.draw(new Ellipse2D.Double(cx - rx, cy - ry, rx * 2, ry * 2)); + g2.setColor(new Color(0xFFC24B)); + g2.fillOval((int) cx - 8, (int) cy - 8, 16, 16); + double a = Math.toRadians(orbit); + double ex = cx - rx * Math.sin(a), ey = cy - ry * Math.cos(a); + g2.setColor(new Color(0x3D7BD9)); + g2.fillOval((int) ex - 6, (int) ey - 6, 12, 12); + g2.setColor(new Color(0x9FB4D4)); + g2.setFont(Theme.font(9)); + g2.drawString("轨道", (int) x + 10, (int) y + 16); + } + + private void drawGlobe(Graphics2D g2, double cx, double cy, double r, double spinDeg, double tilt, boolean showLabels) { + Shape clip = new Ellipse2D.Double(cx - r, cy - r, r * 2, r * 2); + RadialGradientPaint ocean = new RadialGradientPaint(new Point2D.Double(cx - r * 0.25, cy - r * 0.25), (float) (r * 1.5), + new float[]{0, 1}, new Color[]{new Color(0x3D7BD9), new Color(0x10264D)}); + g2.setPaint(ocean); + g2.fill(clip); + g2.setClip(clip); + // graticule + if (grid && r > 50) { + g2.setColor(new Color(255, 255, 255, 36)); + g2.setStroke(new BasicStroke(0.7f)); + for (int lat = -60; lat <= 60; lat += 30) drawLatLine(g2, cx, cy, r, lat, spinDeg, tilt); + for (int lon = -180; lon < 180; lon += 30) drawLonLine(g2, cx, cy, r, lon, spinDeg, tilt); + } + // land + for (List poly : data.land) drawLand(g2, cx, cy, r, poly, spinDeg, tilt); + // terminator / night + double sunLat = EarthMath.subsolarLatitude(orbit); + double sunLon = orbit; + double[] sv = unitView(sunLon, sunLat, tilt); + double antx = cx - sv[0] * r * 1.05, anty = cy + sv[1] * r * 1.05; + RadialGradientPaint night = new RadialGradientPaint(new Point2D.Double(antx, anty), (float) (r * 2.2), + new float[]{0f, 0.45f, 1f}, + new Color[]{new Color(0, 0, 10, 175), new Color(0, 0, 10, 120), new Color(0, 0, 10, 0)}); + g2.setPaint(night); + g2.fill(clip); + g2.setClip(null); + g2.setColor(new Color(255, 255, 255, 90)); + g2.setStroke(new BasicStroke(1f)); + g2.draw(clip); + // axis + double[] np = unit(0, 90, tilt), sp = unit(0, -90, tilt); + g2.setColor(new Color(255, 255, 255, 120)); + g2.setStroke(new BasicStroke(1.2f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, new float[]{4, 5}, 0)); + g2.draw(new Line2D.Double(cx - np[0] * r * 0.0, cy + np[1] * r * 1.12, cx - sp[0] * r, cy + sp[1] * r * 1.12)); + if (showLabels && r > 50) { + g2.setFont(Theme.bold(10)); + g2.setColor(new Color(0xEAF2FF)); + g2.drawString(I18n.t("player.north"), (float) (cx + np[0] * r * 0.0 - 12), (float) (cy - r * 1.05)); + g2.drawString(I18n.t("player.south"), (float) (cx - 12), (float) (cy + r * 1.08)); + // subsolar marker + double[] p = projectView(sunLon, sunLat, tilt); + if (p[2] > 0) { + double x = cx + p[0] * r, y = cy - p[1] * r; + g2.setColor(new Color(0xFFD166)); + g2.setStroke(new BasicStroke(1.5f)); + g2.drawOval((int) x - 6, (int) y - 6, 12, 12); + g2.drawLine((int) x - 10, (int) y, (int) x + 10, (int) y); + g2.drawLine((int) x, (int) y - 10, (int) x, (int) y + 10); + } + } + } + + private void drawLand(Graphics2D g2, double cx, double cy, double r, List poly, + double spinDeg, double tilt) { + Path2D path = new Path2D.Double(); + boolean first = true; + boolean allVisible = true; + int visible = 0; + for (double[] p : poly) { + double[] q = projectPoint(p[0], p[1], spinDeg, tilt); + if (q[2] <= 0) { allVisible = false; continue; } + visible++; + double x = cx + q[0] * r, y = cy - q[1] * r; + if (first) { path.moveTo(x, y); first = false; } else path.lineTo(x, y); + } + if (visible < 3) return; + if (allVisible) { + path.closePath(); + g2.setColor(new Color(0x4E8C4C)); + g2.fill(path); + g2.setColor(new Color(0xBFE3B0)); + g2.setStroke(new BasicStroke(0.6f)); + g2.draw(path); + } else { + g2.setColor(new Color(0x4E8C4C)); + g2.setStroke(new BasicStroke(0.9f)); + g2.draw(path); + } + } + + private void drawLatLine(Graphics2D g2, double cx, double cy, double r, double lat, double spinDeg, double tilt) { + Path2D p = new Path2D.Double(); + boolean first = true; + for (int lon = -180; lon <= 180; lon += 4) { + double[] q = projectPoint(lon, lat, spinDeg, tilt); + if (q[2] <= 0) { first = true; continue; } + double x = cx + q[0] * r, y = cy - q[1] * r; + if (first) { p.moveTo(x, y); first = false; } else p.lineTo(x, y); + } + g2.draw(p); + } + + private void drawLonLine(Graphics2D g2, double cx, double cy, double r, double lon, double spinDeg, double tilt) { + Path2D p = new Path2D.Double(); + boolean first = true; + for (int lat = -90; lat <= 90; lat += 4) { + double[] q = projectPoint(lon, lat, spinDeg, tilt); + if (q[2] <= 0) { first = true; continue; } + double x = cx + q[0] * r, y = cy - q[1] * r; + if (first) { p.moveTo(x, y); first = false; } else p.lineTo(x, y); + } + g2.draw(p); + } + + private double[] unit(double lon, double lat, double tilt) { + double la = Math.toRadians(lat), lo = Math.toRadians(lon); + double x = Math.cos(la) * Math.sin(lo), y = Math.sin(la), z = Math.cos(la) * Math.cos(lo); + double t = Math.toRadians(tilt); + return new double[]{x, y * Math.cos(t) - z * Math.sin(t), y * Math.sin(t) + z * Math.cos(t)}; + } + + private double[] unitView(double lon, double lat, double tilt) { return unit(lon, lat, tilt); } + + private double[] projectPoint(double lon, double lat, double spinDeg, double tilt) { + double la = Math.toRadians(lat), lo = Math.toRadians(lon + spinDeg); + double x = Math.cos(la) * Math.sin(lo), y = Math.sin(la), z = Math.cos(la) * Math.cos(lo); + double t = Math.toRadians(tilt); + double yy = y * Math.cos(t) - z * Math.sin(t); + double zz = y * Math.sin(t) + z * Math.cos(t); + return new double[]{x, yy, zz}; + } + + private double[] projectView(double lon, double lat, double tilt) { + return projectPoint(lon, lat, 0, tilt); + } + } + + // ------------------------------------------------------------------ 数据 + + private static final class EarthData { + final List> land = new ArrayList<>(); + final List lessons = new ArrayList<>(); + + record Lesson(String title, String body, String view, double angleDeg) {} + + static EarthData load(Path dir) { + EarthData d = new EarthData(); + try { + Path landFile = dir.resolve("land.json"); + if (Files.isRegularFile(landFile)) { + Map m = Json.obj(Json.parse(landFile)); + for (Object po : Json.arr(m.get("polygons"))) { + Map p = Json.obj(po); + List pts = new ArrayList<>(); + for (Object pt : Json.arr(p.get("points"))) { + List pair = Json.arr(pt); + if (pair.size() >= 2) pts.add(new double[]{num(pair.get(0)), num(pair.get(1))}); + } + if (pts.size() > 2) d.land.add(pts); + } + } + Path sceneFile = dir.resolve("scene.json"); + if (Files.isRegularFile(sceneFile)) { + Map scene = Json.obj(Json.parse(sceneFile)); + String lang = I18n.language(); + for (Object lo : Json.arr(scene.get("lessons"))) { + Map l = Json.obj(lo); + String title = pick(Json.obj(l.get("titleI18n")), lang); + String body = pick(Json.obj(l.get("bodyI18n")), lang); + d.lessons.add(new Lesson(title, body, Json.str(l, "view", ""), Json.d(l, "angleDeg", 0))); + } + } + } catch (Exception e) { + System.err.println("[earth] 读取场景失败: " + e.getMessage()); + } + if (d.land.isEmpty()) { + d.land.add(List.of(new double[]{-100, 40}, new double[]{-80, 10}, new double[]{-40, -20}, + new double[]{-70, -50}, new double[]{-120, 20})); + d.land.add(List.of(new double[]{10, 60}, new double[]{40, 60}, new double[]{120, 30}, + new double[]{100, -10}, new double[]{20, -30}, new double[]{-10, 10})); + } + return d; + } + + static String pick(Map m, String lang) { + Object v = m.get(lang); + if (v == null) v = m.get("zh-CN"); + if (v == null) v = m.values().stream().findFirst().orElse(""); + return String.valueOf(v); + } + + static double num(Object o) { + return o instanceof Json.Num n ? n.asDouble() : Double.parseDouble(String.valueOf(o)); + } + } +} diff --git a/Java/src/main/java/com/gc/ui/GeographyPanel.java b/Java/src/main/java/com/gc/ui/GeographyPanel.java new file mode 100644 index 0000000..ee7d340 --- /dev/null +++ b/Java/src/main/java/com/gc/ui/GeographyPanel.java @@ -0,0 +1,463 @@ +package com.gc.ui; + +import com.gc.core.I18n; +import com.gc.core.Json; +import com.gc.core.ModelManifest; +import com.gc.model.earth.EarthMath; + +import javax.swing.*; +import javax.swing.border.EmptyBorder; +import java.awt.*; +import java.awt.event.*; +import java.awt.geom.*; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.*; +import java.util.List; + +/** 地球地理:五带划分、海陆轮廓、大洲大洋、六大板块与洲界,悬停判读温度带。 */ +public final class GeographyPanel extends JPanel { + private final GeoData data; + private final MapCanvas canvas = new MapCanvas(); + private final JLabel hover = Theme.label("", 12.5f, new Color(0xEAF2FF)); + private final JLabel zoneInfo = Theme.boldLabel("", 16, new Color(0xEAF2FF)); + private final JLabel coord = Theme.label("", 11, new Color(0x9FB4D4)); + private final JPanel zoneList = new JPanel(); + private final JLabel modeTitle = Theme.boldLabel("", 14, new Color(0xEAF2FF)); + private final Map tabButtons = new LinkedHashMap<>(); + private String view = "zones"; + private double hoverLat = 0, hoverLon = 0; + private boolean hovering; + + public GeographyPanel(ModelManifest.Package pkg) { + this.data = GeoData.load(pkg.dataDir()); + setLayout(new BorderLayout()); + setBackground(new Color(0x080F1C)); + add(header(), BorderLayout.NORTH); + JPanel main = new JPanel(new BorderLayout(12, 0)); + main.setOpaque(false); + main.setBorder(new EmptyBorder(0, 12, 12, 14)); + main.add(canvas, BorderLayout.CENTER); + main.add(sidebar(), BorderLayout.EAST); + add(main, BorderLayout.CENTER); + add(footer(), BorderLayout.SOUTH); + } + + private JComponent header() { + JPanel h = new JPanel(new BorderLayout()); + h.setBackground(new Color(0x0C1828)); + h.setBorder(BorderFactory.createCompoundBorder( + BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(0x1B2740)), + new EmptyBorder(12, 18, 10, 18))); + JPanel t = new JPanel(); + t.setOpaque(false); + t.setLayout(new UI.VStackLayout()); + t.add(Theme.boldLabel("地球地理 · 五带与海陆", 20, new Color(0xEAF2FF))); + t.add(Theme.label("五带划分 · 七大洲四大洋 · 六大板块 · 洲界(纯线稿)", 11, new Color(0x9FB4D4))); + h.add(t, BorderLayout.WEST); + JPanel tabRow = new JPanel(new FlowLayout(FlowLayout.RIGHT, 6, 0)); + tabRow.setOpaque(false); + for (String[] v : new String[][]{{"zones", "五带划分"}, {"coast", "海陆轮廓"}, {"plates", "六大板块"}}) { + UI.RoundButton b = UI.button(v[1]); + b.setFont(Theme.font(11)); + b.setBorder(new EmptyBorder(5, 12, 5, 12)); + b.primary = v[0].equals(view); + b.ghost = !b.primary; + b.addActionListener(e -> { view = v[0]; refreshTabs(); canvas.repaint(); modeTitle.setText(v[1]); }); + tabButtons.put(v[0], b); + tabRow.add(b); + } + h.add(tabRow, BorderLayout.EAST); + return h; + } + + private void refreshTabs() { + tabButtons.forEach((k, b) -> { + b.primary = k.equals(view); + b.ghost = !b.primary; + b.repaint(); + }); + } + + private JComponent sidebar() { + JPanel p = new JPanel(); + p.setOpaque(false); + p.setLayout(new UI.VStackLayout()); + p.setPreferredSize(new Dimension(310, 0)); + + UI.Card read = card(); + read.setLayout(new UI.VStackLayout()); + read.add(Theme.boldLabel("实时判读", 12.5f, new Color(0xEAF2FF))); + read.add(Box.createVerticalStrut(6)); + zoneInfo.setAlignmentX(Component.LEFT_ALIGNMENT); + read.add(zoneInfo); + coord.setAlignmentX(Component.LEFT_ALIGNMENT); + read.add(Box.createVerticalStrut(3)); + read.add(coord); + hover.setAlignmentX(Component.LEFT_ALIGNMENT); + read.add(Box.createVerticalStrut(6)); + read.add(hover); + p.add(read); + p.add(Box.createVerticalStrut(10)); + + UI.Card zones = card(); + zones.setLayout(new UI.VStackLayout()); + zones.add(Theme.boldLabel("五带", 12.5f, new Color(0xEAF2FF))); + zones.add(Box.createVerticalStrut(6)); + zoneList.setOpaque(false); + zoneList.setLayout(new UI.VStackLayout()); + for (EarthMath.Zone z : EarthMath.ZONES) { + JPanel row = new JPanel(new BorderLayout(8, 0)); + row.setOpaque(false); + row.setMaximumSize(new Dimension(Integer.MAX_VALUE, 30)); + JLabel chip = new JLabel(); + chip.setOpaque(true); + chip.setBackground(zoneColor(z.id())); + chip.setPreferredSize(new Dimension(12, 12)); + row.add(chip, BorderLayout.WEST); + row.add(Theme.label(z.nameZh() + " / " + z.nameEn(), 10.5f, new Color(0xC6D5EC)), BorderLayout.CENTER); + row.add(Theme.label(String.format(Locale.ROOT, "%.1f°~%.1f°", z.latMin(), z.latMax()), 9.5f, new Color(0x71819A)), BorderLayout.EAST); + zoneList.add(row); + zoneList.add(Box.createVerticalStrut(4)); + } + zones.add(zoneList); + p.add(zones); + p.add(Box.createVerticalStrut(10)); + + UI.Card facts = card(); + facts.setLayout(new UI.VStackLayout()); + facts.add(Theme.boldLabel("判读要点", 12.5f, new Color(0xEAF2FF))); + facts.add(Box.createVerticalStrut(6)); + for (String s : new String[]{ + "热带:有太阳直射,终年炎热", + "温带:四季分明,无直射无极昼", + "寒带:有极昼极夜,终年寒冷", + "回归线 23.5°;极圈 66.5°", + "大陆:亚欧、非洲、北美、南美、南极、大洋洲", + "四大洋:太平洋、大西洋、印度洋、北冰洋", + "六大板块:亚欧、非洲、印度洋、太平洋、美洲、南极洲"}) { + JLabel l = Theme.label("· " + s, 10.5f, new Color(0xA9BBD8)); + l.setToolTipText(s); + facts.add(l); + } + p.add(facts); + p.add(Box.createVerticalGlue()); + return p; + } + + private UI.Card card() { + UI.Card c = new UI.Card(); + c.setBorder(new EmptyBorder(12, 14, 12, 14)); + c.setAlignmentX(Component.LEFT_ALIGNMENT); + c.setMaximumSize(new Dimension(Integer.MAX_VALUE, 900)); + c.alt = true; + c.bgOverride = new Color(0x121D2E); + c.borderOverride = new Color(0x24324A); + return c; + } + + private JComponent footer() { + JPanel f = new JPanel(new BorderLayout()); + f.setBackground(new Color(0x0C1828)); + f.setBorder(BorderFactory.createCompoundBorder( + BorderFactory.createMatteBorder(1, 0, 0, 0, new Color(0x1B2740)), + new EmptyBorder(8, 16, 8, 16))); + modeTitle.setText("五带划分"); + f.add(modeTitle, BorderLayout.WEST); + f.add(Theme.label("移动鼠标读取经纬度与所属温度带", 10.5f, new Color(0x71819A)), BorderLayout.EAST); + return f; + } + + private static Color zoneColor(String id) { + return switch (id) { + case "torrid" -> new Color(0xE08A4B); + case "northTemperate", "southTemperate" -> new Color(0x5FAF6A); + default -> new Color(0x6FA8D8); + }; + } + + private final class MapCanvas extends JComponent { + MapCanvas() { + addMouseMotionListener(new MouseMotionAdapter() { + @Override public void mouseMoved(MouseEvent e) { + Rectangle r = mapRect(); + if (r == null || !r.contains(e.getX(), e.getY())) { hovering = false; repaint(); return; } + hovering = true; + hoverLon = (e.getX() - r.x) / (double) r.width * 360 - 180; + hoverLat = 90 - (e.getY() - r.y) / (double) r.height * 180; + EarthMath.Zone z = EarthMath.zone(hoverLat); + zoneInfo.setText(String.format(Locale.ROOT, "%s %s", z.nameZh(), z.nameEn())); + zoneInfo.setForeground(zoneColor(z.id())); + coord.setText(String.format(Locale.ROOT, "纬度 %+.1f° 经度 %+.1f°", hoverLat, hoverLon)); + hover.setText("直射/极昼: " + (Math.abs(hoverLat) < 23.5 ? "有太阳直射" + : Math.abs(hoverLat) >= 66.5 ? "有极昼极夜" : "四季分明")); + repaint(); + } + }); + addMouseListener(new MouseAdapter() { + @Override public void mouseExited(MouseEvent e) { hovering = false; repaint(); } + }); + } + + Rectangle mapRect() { + int pad = 22; + int availW = Math.max(10, getWidth() - pad * 2); + int availH = Math.max(10, getHeight() - pad * 2); + double ratio = 2.0; + int w = (int) Math.min(availW, availH * ratio); + int h = (int) (w / ratio); + return new Rectangle(pad + (availW - w) / 2, pad + (availH - h) / 2, w, h); + } + + @Override protected void paintComponent(Graphics g) { + Graphics2D g2 = (Graphics2D) g.create(); + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2.setColor(new Color(0x080F1C)); + g2.fillRoundRect(0, 0, getWidth(), getHeight(), 14, 14); + Rectangle r = mapRect(); + if (r == null) { g2.dispose(); return; } + Shape clip = new RoundRectangle2D.Float(r.x, r.y, r.width, r.height, 12, 12); + g2.setClip(clip); + g2.setColor(new Color(0x0E2A4A)); + g2.fillRect(r.x, r.y, r.width, r.height); + if (view.equals("zones")) paintZones(g2, r); + if (view.equals("coast") || view.equals("zones")) paintCoast(g2, r); + if (view.equals("plates")) paintPlates(g2, r); + paintGraticule(g2, r); + if (hovering) { + int x = (int) (r.x + (hoverLon + 180) / 360 * r.width); + int y = (int) (r.y + (90 - hoverLat) / 180 * r.height); + g2.setColor(new Color(255, 209, 102)); + g2.setStroke(new BasicStroke(1f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, new float[]{4, 4}, 0)); + g2.drawLine(x, r.y, x, r.y + r.height); + g2.drawLine(r.x, y, r.x + r.width, y); + g2.fillOval(x - 3, y - 3, 6, 6); + EarthMath.Zone z = EarthMath.zone(hoverLat); + if (view.equals("zones")) { + int y1 = (int) (r.y + (90 - z.latMax()) / 180 * r.height); + int y2 = (int) (r.y + (90 - z.latMin()) / 180 * r.height); + g2.setColor(new Color(zoneColor(z.id()).getRed(), zoneColor(z.id()).getGreen(), zoneColor(z.id()).getBlue(), 46)); + g2.fillRect(r.x, y1, r.width, y2 - y1); + } + } + g2.setClip(null); + g2.setColor(new Color(0x1B2740)); + g2.drawRoundRect(r.x, r.y, r.width, r.height, 12, 12); + g2.dispose(); + } + + private void paintZones(Graphics2D g2, Rectangle r) { + for (EarthMath.Zone z : EarthMath.ZONES) { + int y1 = (int) (r.y + (90 - z.latMax()) / 180 * r.height); + int y2 = (int) (r.y + (90 - z.latMin()) / 180 * r.height); + Color c = zoneColor(z.id()); + g2.setColor(new Color(c.getRed(), c.getGreen(), c.getBlue(), 52)); + g2.fillRect(r.x, y1, r.width, y2 - y1); + g2.setColor(new Color(c.getRed(), c.getGreen(), c.getBlue(), 120)); + g2.setStroke(new BasicStroke(0.8f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, new float[]{5, 4}, 0)); + g2.drawLine(r.x, y1, r.x + r.width, y1); + g2.setStroke(new BasicStroke(1)); + g2.setFont(Theme.bold(9.5f)); + g2.setColor(new Color(c.getRed(), c.getGreen(), c.getBlue(), 230)); + g2.drawString(z.nameZh(), r.x + 8, (y1 + y2) / 2 + 3); + } + // tropics/polar labels + g2.setFont(Theme.font(9)); + g2.setColor(new Color(0x9FB4D4)); + g2.drawString("北回归线 23.5°N", r.x + 8, (int) (r.y + (90 - 23.5) / 180 * r.height) - 3); + g2.drawString("南回归线 23.5°S", r.x + 8, (int) (r.y + (90 + 23.5) / 180 * r.height) - 3); + g2.drawString("北极圈 66.5°N", r.x + 8, (int) (r.y + (90 - 66.5) / 180 * r.height) - 3); + g2.drawString("南极圈 66.5°S", r.x + 8, (int) (r.y + (90 + 66.5) / 180 * r.height) - 3); + } + + private void paintCoast(Graphics2D g2, Rectangle r) { + g2.setColor(new Color(0xB8D8F0, true)); + g2.setStroke(new BasicStroke(0.85f)); + for (List line : data.coastline) drawLine(g2, r, line, new Color(0xB8D8F0)); + if (!data.continents.isEmpty()) { + g2.setStroke(new BasicStroke(1.2f)); + for (GeoData.Shape s : data.continents) { + for (List line : s.lines) drawLine(g2, r, line, new Color(0x7FC4A0)); + } + } + g2.setFont(Theme.bold(9.5f)); + for (GeoData.Label l : data.labels) { + int x = (int) (r.x + (l.lon + 180) / 360 * r.width); + int y = (int) (r.y + (90 - l.lat) / 180 * r.height); + g2.setColor(l.kind.equals("ocean") ? new Color(0x7FB6E8) : new Color(0xB8E0C0)); + g2.drawString(l.name, x - g2.getFontMetrics().stringWidth(l.name) / 2, y); + } + for (GeoData.Border b : data.borders) { + for (List line : b.lines) drawLine(g2, r, line, new Color(0xE9B25B)); + } + } + + private void paintPlates(Graphics2D g2, Rectangle r) { + g2.setStroke(new BasicStroke(1.4f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, new float[]{6, 5}, 0)); + Color[] colors = {new Color(0xE08A4B), new Color(0x6FA8D8), new Color(0x7FC4A0), + new Color(0xD97C9A), new Color(0xC9B06A), new Color(0xA88CE0)}; + int i = 0; + for (GeoData.Shape p : data.plates) { + Color c = colors[i++ % colors.length]; + g2.setColor(c); + for (List line : p.lines) drawLine(g2, r, line, c); + if (p.label != null) { + int x = (int) (r.x + (p.label[0] + 180) / 360 * r.width); + int y = (int) (r.y + (90 - p.label[1]) / 180 * r.height); + g2.setFont(Theme.bold(9.5f)); + String name = p.name; + g2.drawString(name, x - g2.getFontMetrics().stringWidth(name) / 2, y); + } + } + } + + private void drawLine(Graphics2D g2, Rectangle r, List line, Color c) { + g2.setColor(c); + Path2D p = new Path2D.Double(); + boolean first = true; + double lastLon = 0; + for (double[] pt : line) { + double lon = pt[0], lat = pt[1]; + if (first) { p.moveTo(r.x + (lon + 180) / 360 * r.width, r.y + (90 - lat) / 180 * r.height); first = false; } + else if (Math.abs(lon - lastLon) > 180) { + p.moveTo(r.x + (lon + 180) / 360 * r.width, r.y + (90 - lat) / 180 * r.height); + } else p.lineTo(r.x + (lon + 180) / 360 * r.width, r.y + (90 - lat) / 180 * r.height); + lastLon = lon; + } + g2.draw(p); + } + + private void paintGraticule(Graphics2D g2, Rectangle r) { + g2.setColor(new Color(255, 255, 255, 22)); + g2.setStroke(new BasicStroke(0.6f)); + for (int lon = -180; lon <= 180; lon += 30) { + int x = (int) (r.x + (lon + 180) / 360 * r.width); + g2.drawLine(x, r.y, x, r.y + r.height); + } + for (int lat = -60; lat <= 60; lat += 30) { + int y = (int) (r.y + (90 - lat) / 180 * r.height); + g2.drawLine(r.x, y, r.x + r.width, y); + } + } + } + + // ------------------------------------------------------------------ 数据 + + private static final class GeoData { + record Shape(String id, String name, double[] label, List> lines) {} + record Label(double lat, double lon, String kind, String name) {} + record Border(String name, List> lines) {} + + List> coastline = new ArrayList<>(); + List continents = new ArrayList<>(); + List plates = new ArrayList<>(); + List borders = new ArrayList<>(); + List