修复: .GC 不应入库(曾覆盖远程仓库)+ 模型读取优化
This commit is contained in:
1 parent
f69a8fbb7f
commit
936aec8185
279 files changed
+182
-9991
No files matched your search
-156
@@ -1,156 +0,0 @@
|
|||||||
# 模型库(model/)
|
|
||||||
|
|
||||||
这个目录是**模型**,包含模型自己的**源码 + 数据 + 功能程序集 + 封面 + 语言包**。
|
|
||||||
`src/`(启动器)只做四件事:扫描模型、下载模型、开窗口加载模型、检查更新。**启动器没有任何渲染逻辑,发布包也不内置模型**。
|
|
||||||
|
|
||||||
> 模型相关的一切都在 `model/` 里:共享引擎源码 `model/_engine/`、契约源码 `model/_sdk/`、
|
|
||||||
> 每个模型自己的源码 `model/<id>/src/`,编译产物与数据 `model/<id>/<id>.model/`。
|
|
||||||
> 仓库根目录只有 `src/`(启动器)和 `model/`,没有任何旁路目录。
|
|
||||||
|
|
||||||
- 发布态模型库在 **`<可执行文件>/.GC/model/`**;开发态直接用仓库根 `model/`
|
|
||||||
- 优先级:`EMS_MODELS` 环境变量 → 开发态仓库根 `model/` → 发布态 `.GC/model/`
|
|
||||||
- 一个模型 = 一个文件夹,文件夹名即模型 id;`_sdk/`、`_engine/` 是下划线开头的共享目录,不会被当成模型
|
|
||||||
- 模型可以单独打包、单独分发,也可以放进 git 仓库当模型源
|
|
||||||
|
|
||||||
## 目录结构
|
|
||||||
|
|
||||||
```
|
|
||||||
model/
|
|
||||||
version.json # 版本清单(与仓库根 version.json 相同,自动生成)
|
|
||||||
_sdk/EarthModelStudio.ModelSdk/ # 模型契约(启动器与模型唯一的共享代码)
|
|
||||||
_engine/ # 共享引擎源码
|
|
||||||
src/ # CelestialView / PlanetTexture / EarthModelView / SphereRaster…
|
|
||||||
PreviewGen/ # 用模型渲染器生成封面的小工具
|
|
||||||
VersionStamp/ # 按内容指纹自动打版本、生成 version.json
|
|
||||||
<模型 id>/
|
|
||||||
<模型 id>.json # 清单:名称、i18n、版本、程序集入口、封面
|
|
||||||
src/ # 模型自己的源码(csproj + IModelFactory 实现)
|
|
||||||
<模型 id>.model/ # 模型包(可分发的部分)
|
|
||||||
EarthRotationModel.dll # 功能程序集(实现 IModelFactory)
|
|
||||||
scene.json # 场景数据(内容由模型定义)
|
|
||||||
land.json # 贴图/轮廓数据(可选)
|
|
||||||
preview.png # 封面图(启动器只显示,不渲染)
|
|
||||||
i18n/zh-CN.json # 界面文案(模型自己读)
|
|
||||||
i18n/en.json
|
|
||||||
```
|
|
||||||
|
|
||||||
## 版本是自动改的
|
|
||||||
|
|
||||||
`./build.sh models`(或 `./build.sh stamp`)会调用 `model/_engine/VersionStamp`:
|
|
||||||
|
|
||||||
1. 对每个模型,把 `<id>.json`(去掉 `version` / `updatedAt`)与 `<id>.model/` 下所有文件
|
|
||||||
按路径排序做 SHA-256 指纹,得到版本号 `1.0-<10位指纹>`;
|
|
||||||
2. 把这个版本写回 `<id>.json` 的 `version` 与 `updatedAt`;
|
|
||||||
3. 生成仓库根 `version.json` 和 `model/version.json`(内容相同),里面记录
|
|
||||||
启动器版本、各平台更新包地址、每个模型的 id / 版本 / 仓库目录。
|
|
||||||
|
|
||||||
**所以只要改了模型文件,版本号就自动变**,不需要手工维护;内容没变时重复构建版本号保持不变。
|
|
||||||
客户端启动时读 `version.json`,和 `.GC/settings.json` 里记录的版本一比对就知道要不要下载。
|
|
||||||
|
|
||||||
> 改了 `scene.json` 或引擎源码后,跑 `./build.sh models`,再把 `version.json` 和 `model/`
|
|
||||||
> 推送到 gitcode;客户端下次启动会下载新模型并**本次启动立即生效**。
|
|
||||||
> 启动器自身更新包由 `./build.sh publish` 生成(`dist/GC-<rid>.zip`),下载后**下次启动才应用**。
|
|
||||||
|
|
||||||
## `<id>.json`(模型清单,启动器只读它)
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"id": "earth-rotation",
|
|
||||||
"name": "Earth Rotation",
|
|
||||||
"nameI18n": { "zh-CN": "地球自转", "en": "Earth Rotation" },
|
|
||||||
"description": "……",
|
|
||||||
"descriptionI18n": { "zh-CN": "……", "en": "……" },
|
|
||||||
"version": "1.0-3f9a2c1b7d",
|
|
||||||
"updatedAt": "2026-11-07T08:00:00Z",
|
|
||||||
"author": "NeoRF",
|
|
||||||
"tags": ["astronomy", "geography"],
|
|
||||||
"assembly": "EarthRotationModel.dll",
|
|
||||||
"type": "NeoRF.EarthModels.RotationModelFactory",
|
|
||||||
"preview": "preview.png",
|
|
||||||
"apiVersion": 1
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
| 字段 | 作用 |
|
|
||||||
| --- | --- |
|
|
||||||
| `version` | **自动生成**,模型包内容指纹;客户端靠它判断是否需要更新 |
|
|
||||||
| `assembly` | 功能程序集文件名,相对 `<id>.model`;留空按 `<id>.dll` 找 |
|
|
||||||
| `type` | 实现 `IModelFactory` 的完整类型名;留空则自动找第一个实现 |
|
|
||||||
| `preview` | 封面图,默认 `preview.png` |
|
|
||||||
| `apiVersion` | 模型契约版本,目前为 1 |
|
|
||||||
|
|
||||||
## 模型契约(model/_sdk)
|
|
||||||
|
|
||||||
模型只依赖一个极小的契约程序集 `EarthModelStudio.ModelSdk`(源码在 `model/_sdk/`):
|
|
||||||
|
|
||||||
```csharp
|
|
||||||
public interface IModelFactory
|
|
||||||
{
|
|
||||||
int ApiVersion { get; }
|
|
||||||
IModelRuntime Create();
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IModelRuntime : IDisposable
|
|
||||||
{
|
|
||||||
void Prepare(IModelContext context); // 后台线程:读数据、算纹理,可汇报进度
|
|
||||||
Control CreateView(IModelContext context); // UI 线程:构建界面
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IModelContext
|
|
||||||
{
|
|
||||||
string ModelId { get; }
|
|
||||||
string ModelDirectory { get; }
|
|
||||||
string DataDirectory { get; }
|
|
||||||
string Language { get; }
|
|
||||||
int MemoryBudgetMb { get; }
|
|
||||||
void RequestClose();
|
|
||||||
void ReportProgress(double value, string? message = null);
|
|
||||||
void Log(string message);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
模型 `CreateView` 返回的控件会铺满窗口客户区 —— **工具栏、动画、文字、交互全由模型自己实现**。
|
|
||||||
启动器只提供窗口、语言、内存预算和关闭能力。
|
|
||||||
|
|
||||||
## `scene.json` / `land.json`
|
|
||||||
|
|
||||||
这两个文件的内容完全由模型自己定义(启动器不解析)。地球模型用的是:
|
|
||||||
|
|
||||||
- `scene.json`:`defaultView`、`views`、行星参数、颜色、轨道、`lessons` 教学要点
|
|
||||||
- `orbit.seasonLayout`:`springTopSummerLeft` = **上春分、左夏至**(下秋分、右冬至),季节角度与直射纬度读数不变
|
|
||||||
- `planet.axialTiltDeg` / `planet.tropicDeg`:教材值 **23.5°**(极圈自动算 90 − 23.5 = 66.5°)
|
|
||||||
- `orbit.seasons[].declinationDeg`:二分二至的太阳直射纬度(0 / +23.5 / 0 / −23.5),
|
|
||||||
定格时读数直接取这个值,不用近似公式
|
|
||||||
- `orbit.seasons[].teachingI18n`:该节气的课堂现象说明(中英双语,写在模型数据里)
|
|
||||||
- `orbit.seasons[].date`:教材日期(3/21、6/22、9/23、12/22),定格时 HUD 与课堂卡都用它
|
|
||||||
- `land.json`:大陆轮廓,`{ "polygons": [ { "name": "...", "points": [[lon,lat], ...] } ] }`
|
|
||||||
|
|
||||||
## 语言包
|
|
||||||
|
|
||||||
`<id>.model/i18n/<language>.json` 是扁平的 `键: 文案` 映射,模型自己读取。
|
|
||||||
地球模型用到的键:`title`、`view.rotation`、`play`、`pause`、`speed`、`reset`、`labels`、`orbit`、`grid`、`tilt`、
|
|
||||||
`lessons`、`seasons`、`close`、`sun`、`earth`、`north`、`south`、`subsolar`、`spinInfo`、`orbitInfo`、
|
|
||||||
`declinationInfo`、`dateInfo`、`season.*`。
|
|
||||||
|
|
||||||
## 封面
|
|
||||||
|
|
||||||
封面是 `preview.png`,由 `model/_engine/PreviewGen` 用**模型自己的渲染器**生成:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./build.sh models # 编译模型 dll + 生成所有模型封面 + 自动打版本
|
|
||||||
```
|
|
||||||
|
|
||||||
## 做一个新模型
|
|
||||||
|
|
||||||
1. 在 `model/<id>/src/` 里新建类库项目(可引用 `model/_engine/src` 的共享代码,也可完全自己写)
|
|
||||||
2. 写一个 `IModelFactory` 实现:`Prepare` 里读数据算纹理并 `ReportProgress`,`CreateView` 里返回控件
|
|
||||||
3. 在 `model/<id>/` 放清单和 `<id>.model/` 数据目录,用 `assembly` / `type` 指向你的 dll
|
|
||||||
4. `./build.sh models` 会自动编译每个模型、把 dll 复制进对应 `<id>.model/`、生成封面、打版本并写进 `version.json`
|
|
||||||
5. 推送仓库,客户端下次启动自动下载 —— 不用改启动器、不用重新发布程序
|
|
||||||
|
|
||||||
## 作为模型源分发
|
|
||||||
|
|
||||||
- **自动更新(推荐)**:把 `version.json` 和 `model/` 推到 gitcode 仓库,启动器开机自检并下载到 `.GC/model/`
|
|
||||||
- **离线源**:把整个仓库目录(含 `version.json` + `model/`)拷到 U 盘 / 共享盘,
|
|
||||||
在 `.GC/settings.json` 填 `updateLocalRoot` 指向它
|
|
||||||
- **手动导入**:在「下载」页粘贴任意 git 仓库 / zip / 本地目录,读取其中的 `model/` 文件夹
|
|
||||||
-27
@@ -1,27 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<ImplicitUsings>disable</ImplicitUsings>
|
|
||||||
<RootNamespace>NeoRF.EarthModels</RootNamespace>
|
|
||||||
<AssemblyName>EarthModelPreview</AssemblyName>
|
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<!-- 直接编译共享引擎源码:封面必须由模型自己的渲染器画 -->
|
|
||||||
<Compile Include="../src/**/*.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Avalonia.Headless" Version="$(AvaloniaVersion)" />
|
|
||||||
<PackageReference Include="Avalonia.Skia" Version="$(AvaloniaVersion)" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\..\_sdk\EarthModelStudio.ModelSdk\EarthModelStudio.ModelSdk.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@@ -1,113 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
|
||||||
using Avalonia.Headless;
|
|
||||||
using Avalonia.Media.Imaging;
|
|
||||||
using NeoRF.EarthModels;
|
|
||||||
|
|
||||||
namespace NeoRF.EarthModels.Preview;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 封面生成工具:用模型自己的渲染器给每个模型画一张封面 preview.png。
|
|
||||||
/// 封面在模型包里,启动器只负责显示 —— 所以公转模型的封面一定就是公转场景。
|
|
||||||
/// 用法:dotnet run --project model-src/tools/PreviewGen -- <仓库根>
|
|
||||||
/// </summary>
|
|
||||||
internal static class Program
|
|
||||||
{
|
|
||||||
private const int Width = 768;
|
|
||||||
private const int Height = 316;
|
|
||||||
|
|
||||||
[STAThread]
|
|
||||||
public static int Main(string[] args)
|
|
||||||
{
|
|
||||||
var root = args.Length > 0 ? args[0] : Directory.GetCurrentDirectory();
|
|
||||||
var modelRoot = Path.Combine(root, "model");
|
|
||||||
if (!Directory.Exists(modelRoot))
|
|
||||||
{
|
|
||||||
Console.Error.WriteLine($"找不到模型库: {modelRoot}");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
var bench = args.Contains("--bench");
|
|
||||||
|
|
||||||
AppBuilder.Configure<Application>()
|
|
||||||
.UseSkia()
|
|
||||||
.UseHeadless(new AvaloniaHeadlessPlatformOptions { UseHeadlessDrawing = false })
|
|
||||||
.SetupWithoutStarting();
|
|
||||||
|
|
||||||
foreach (var modelDir in Directory.GetDirectories(modelRoot))
|
|
||||||
{
|
|
||||||
var id = Path.GetFileName(modelDir);
|
|
||||||
if (id.StartsWith(".")) continue;
|
|
||||||
var dataDir = Path.Combine(modelDir, id + ".model");
|
|
||||||
var sceneFile = Path.Combine(dataDir, "scene.json");
|
|
||||||
if (!File.Exists(sceneFile)) continue;
|
|
||||||
|
|
||||||
var runtime = SceneRuntime.Load(dataDir, 2048);
|
|
||||||
var texts = ModelStrings.Load(dataDir, "zh-CN");
|
|
||||||
var revolution = string.Equals(runtime.Scene.DefaultView, "revolution", StringComparison.OrdinalIgnoreCase);
|
|
||||||
|
|
||||||
var view = new CelestialView
|
|
||||||
{
|
|
||||||
Scene = runtime,
|
|
||||||
Texts = texts,
|
|
||||||
View = revolution ? SceneView.Revolution : SceneView.Rotation,
|
|
||||||
IsPlaying = false,
|
|
||||||
ShowHud = false,
|
|
||||||
ShowLabels = false,
|
|
||||||
ShowOrbit = true,
|
|
||||||
ShowGraticule = true,
|
|
||||||
Width = Width,
|
|
||||||
Height = Height
|
|
||||||
};
|
|
||||||
view.Measure(new Size(Width, Height));
|
|
||||||
view.Arrange(new Rect(0, 0, Width, Height));
|
|
||||||
view.JumpToOrbit(revolution ? 45 : 0);
|
|
||||||
view.JumpToSpin(20);
|
|
||||||
|
|
||||||
if (bench)
|
|
||||||
{
|
|
||||||
// 真实窗口尺寸下的帧耗时
|
|
||||||
view.Width = 1240;
|
|
||||||
view.Height = 820;
|
|
||||||
view.Measure(new Size(1240, 820));
|
|
||||||
view.Arrange(new Rect(0, 0, 1240, 820));
|
|
||||||
// 模拟播放态(运动时降分辨率),分别测静止高清帧与运动帧
|
|
||||||
var animField = typeof(NeoRF.EarthModels.CelestialView)
|
|
||||||
.GetField("_animating", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
|
|
||||||
var sw = System.Diagnostics.Stopwatch.StartNew();
|
|
||||||
for (var frame = 0; frame < 20; frame++)
|
|
||||||
{
|
|
||||||
view.JumpToSpin(20 + frame * 3);
|
|
||||||
using var tmp = new RenderTargetBitmap(new PixelSize(1240, 820), new Vector(96, 96));
|
|
||||||
tmp.Render(view);
|
|
||||||
}
|
|
||||||
sw.Stop();
|
|
||||||
var still = sw.Elapsed.TotalMilliseconds / 20;
|
|
||||||
animField?.SetValue(view, true);
|
|
||||||
sw.Restart();
|
|
||||||
for (var frame = 0; frame < 20; frame++)
|
|
||||||
{
|
|
||||||
view.JumpToSpin(20 + frame * 3);
|
|
||||||
using var tmp = new RenderTargetBitmap(new PixelSize(1240, 820), new Vector(96, 96));
|
|
||||||
tmp.Render(view);
|
|
||||||
}
|
|
||||||
sw.Stop();
|
|
||||||
Console.WriteLine($"{id}: 静止 {still:0.0} ms/frame · 播放 {sw.Elapsed.TotalMilliseconds / 20:0.0} ms/frame");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
var outFile = Path.Combine(dataDir, "preview.png");
|
|
||||||
using (var bitmap = new RenderTargetBitmap(new PixelSize(Width, Height), new Vector(96, 96)))
|
|
||||||
{
|
|
||||||
bitmap.Render(view);
|
|
||||||
bitmap.Save(outFile);
|
|
||||||
}
|
|
||||||
Console.WriteLine($"preview -> {outFile}");
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,164 +0,0 @@
|
|||||||
using System.Security.Cryptography;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.Encodings.Web;
|
|
||||||
using System.Text.Json;
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
// VersionStamp:构建时自动给模型打版本。
|
|
||||||
// 用法:dotnet run --project model/_engine/VersionStamp -- <仓库根> <启动器版本>
|
|
||||||
// 输出:更新 model/<id>/<id>.json 的 version / updatedAt,并生成
|
|
||||||
// 仓库根 version.json 与 model/version.json(内容相同,便于两种源地址读取)。
|
|
||||||
|
|
||||||
// 仓库地址(编译产物的 Release 也发在这里):与启动器默认 updateRepository 保持一致。
|
|
||||||
const string Repository = "https://gitcode.com/2509_92447106/GC";
|
|
||||||
|
|
||||||
var root = args.Length > 0 ? Path.GetFullPath(args[0]) : Directory.GetCurrentDirectory();
|
|
||||||
var launcherVersion = args.Length > 1 && !string.IsNullOrWhiteSpace(args[1]) ? args[1] : "1.0.0";
|
|
||||||
var modelRoot = Path.Combine(root, "model");
|
|
||||||
|
|
||||||
if (!Directory.Exists(modelRoot))
|
|
||||||
{
|
|
||||||
Console.Error.WriteLine($"找不到模型库: {modelRoot}");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
var relaxed = new JsonSerializerOptions
|
|
||||||
{
|
|
||||||
WriteIndented = true,
|
|
||||||
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
|
|
||||||
};
|
|
||||||
|
|
||||||
static string Rel(string baseDir, string file) =>
|
|
||||||
Path.GetRelativePath(baseDir, file).Replace('\\', '/');
|
|
||||||
|
|
||||||
static bool Distributable(string file)
|
|
||||||
{
|
|
||||||
var name = Path.GetFileName(file);
|
|
||||||
if (name.StartsWith('.')) return false;
|
|
||||||
if (name.EndsWith(".user", StringComparison.OrdinalIgnoreCase)) return false;
|
|
||||||
var rel = file.Replace('\\', '/');
|
|
||||||
return !rel.Contains("/bin/", StringComparison.OrdinalIgnoreCase) &&
|
|
||||||
!rel.Contains("/obj/", StringComparison.OrdinalIgnoreCase) &&
|
|
||||||
!rel.EndsWith(".installing", StringComparison.OrdinalIgnoreCase);
|
|
||||||
}
|
|
||||||
|
|
||||||
static string Fingerprint(IEnumerable<byte[]> chunks)
|
|
||||||
{
|
|
||||||
using var hash = IncrementalHash.CreateHash(HashAlgorithmName.SHA256);
|
|
||||||
foreach (var chunk in chunks) hash.AppendData(chunk);
|
|
||||||
return Convert.ToHexString(hash.GetHashAndReset()).ToLowerInvariant();
|
|
||||||
}
|
|
||||||
|
|
||||||
Console.WriteLine("==> 自动计算模型版本(按模型包内容指纹)");
|
|
||||||
var models = new List<Dictionary<string, string>>();
|
|
||||||
|
|
||||||
foreach (var dir in Directory.GetDirectories(modelRoot)
|
|
||||||
.OrderBy(p => Path.GetFileName(p), StringComparer.Ordinal))
|
|
||||||
{
|
|
||||||
var id = Path.GetFileName(dir);
|
|
||||||
if (id.StartsWith('_')) continue; // _sdk / _engine 是共享源码,不是模型
|
|
||||||
|
|
||||||
var manifestPath = Path.Combine(dir, id + ".json");
|
|
||||||
var dataDir = Path.Combine(dir, id + ".model");
|
|
||||||
if (!File.Exists(manifestPath) || !Directory.Exists(dataDir)) continue;
|
|
||||||
|
|
||||||
var manifest = JsonNode.Parse(File.ReadAllText(manifestPath))?.AsObject();
|
|
||||||
if (manifest == null) continue;
|
|
||||||
|
|
||||||
// 版本号由模型清单里手写的 version 决定(作者手动升到 1.0 / 1.1 …),
|
|
||||||
// 不再用内容指纹覆盖:指纹形式(1.0-393cb2b7d4)对用户不可读、也没有语义。
|
|
||||||
var declared = manifest["version"]?.GetValue<string>();
|
|
||||||
var version = string.IsNullOrWhiteSpace(declared) ? "1.0" : declared!.Trim();
|
|
||||||
|
|
||||||
// 内容指纹保留在 build 字段,仅用于构建溯源,不参与版本比较
|
|
||||||
manifest.Remove("build");
|
|
||||||
var canonical = manifest.ToJsonString(new JsonSerializerOptions { WriteIndented = false });
|
|
||||||
var chunks = new List<byte[]> { Encoding.UTF8.GetBytes(canonical) };
|
|
||||||
foreach (var file in Directory.GetFiles(dataDir, "*", SearchOption.AllDirectories)
|
|
||||||
.Where(Distributable)
|
|
||||||
.OrderBy(f => Rel(dataDir, f), StringComparer.Ordinal))
|
|
||||||
{
|
|
||||||
chunks.Add(Encoding.UTF8.GetBytes("\n" + Rel(dataDir, file) + "\n"));
|
|
||||||
chunks.Add(File.ReadAllBytes(file));
|
|
||||||
}
|
|
||||||
var fingerprint = Fingerprint(chunks)[..10];
|
|
||||||
|
|
||||||
manifest["version"] = version;
|
|
||||||
manifest["build"] = fingerprint;
|
|
||||||
manifest["updatedAt"] = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ssZ");
|
|
||||||
File.WriteAllText(manifestPath, manifest.ToJsonString(relaxed) + "\n");
|
|
||||||
|
|
||||||
models.Add(new Dictionary<string, string>
|
|
||||||
{
|
|
||||||
["id"] = id,
|
|
||||||
["version"] = version,
|
|
||||||
["build"] = fingerprint,
|
|
||||||
["dir"] = "model/" + id
|
|
||||||
});
|
|
||||||
Console.WriteLine($" {id,-20} {version,-8} (build {fingerprint})");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 启动器源码指纹(只展示,不触发升级;升级看 launcher.version)
|
|
||||||
var srcRoot = Path.Combine(root, "src");
|
|
||||||
var srcChunks = new List<byte[]>();
|
|
||||||
if (Directory.Exists(srcRoot))
|
|
||||||
{
|
|
||||||
foreach (var file in Directory.GetFiles(srcRoot, "*", SearchOption.AllDirectories)
|
|
||||||
.Where(Distributable)
|
|
||||||
.Where(f => f.EndsWith(".cs", StringComparison.OrdinalIgnoreCase) ||
|
|
||||||
f.EndsWith(".axaml", StringComparison.OrdinalIgnoreCase) ||
|
|
||||||
f.EndsWith(".csproj", StringComparison.OrdinalIgnoreCase) ||
|
|
||||||
f.EndsWith(".json", StringComparison.OrdinalIgnoreCase) ||
|
|
||||||
f.EndsWith(".props", StringComparison.OrdinalIgnoreCase))
|
|
||||||
.OrderBy(f => Rel(srcRoot, f), StringComparer.Ordinal))
|
|
||||||
{
|
|
||||||
srcChunks.Add(Encoding.UTF8.GetBytes(Rel(srcRoot, file) + "\n"));
|
|
||||||
srcChunks.Add(File.ReadAllBytes(file));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var launcherRevision = srcChunks.Count > 0 ? Fingerprint(srcChunks)[..10] : "";
|
|
||||||
|
|
||||||
var packages = new Dictionary<string, Dictionary<string, object>>();
|
|
||||||
// 启动器更新只访问「编译的产物」:gitcode Release 里发布的 dist/GC-<rid>.zip 附件。
|
|
||||||
// 运行时若存在同名 Release,GitCodeReleaseRemote 会用附件真实直链覆盖下面的 url;
|
|
||||||
// 下面的地址是兜底(编译产物尚未发 Release 时也能指向正确的编译产物位置)。
|
|
||||||
var releaseBase = $"{Repository}/releases/download/v{launcherVersion}";
|
|
||||||
foreach (var rid in new[] { "win-x64", "win-arm64", "osx-arm64", "osx-x64", "linux-x64" })
|
|
||||||
{
|
|
||||||
var entry = new Dictionary<string, object>
|
|
||||||
{
|
|
||||||
["path"] = $"dist/GC-{rid}.zip",
|
|
||||||
["url"] = $"{releaseBase}/GC-{rid}.zip"
|
|
||||||
};
|
|
||||||
// 已生成的启动器更新包:把校验值和体积写进清单,供下载端校验
|
|
||||||
var zipPath = Path.Combine(root, "dist", $"GC-{rid}.zip");
|
|
||||||
if (File.Exists(zipPath))
|
|
||||||
{
|
|
||||||
var bytes = File.ReadAllBytes(zipPath);
|
|
||||||
entry["sha256"] = Convert.ToHexString(SHA256.HashData(bytes)).ToLowerInvariant();
|
|
||||||
entry["size"] = bytes.LongLength;
|
|
||||||
}
|
|
||||||
packages[rid] = entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
var versionDoc = new Dictionary<string, object>
|
|
||||||
{
|
|
||||||
["schema"] = 1,
|
|
||||||
["generated"] = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ssZ"),
|
|
||||||
["repository"] = Repository,
|
|
||||||
["branch"] = "main",
|
|
||||||
["modelDir"] = "model",
|
|
||||||
["launcher"] = new Dictionary<string, object>
|
|
||||||
{
|
|
||||||
["version"] = launcherVersion,
|
|
||||||
["revision"] = launcherRevision,
|
|
||||||
["packages"] = packages
|
|
||||||
},
|
|
||||||
["models"] = models
|
|
||||||
};
|
|
||||||
|
|
||||||
var json = JsonSerializer.Serialize(versionDoc, relaxed) + "\n";
|
|
||||||
File.WriteAllText(Path.Combine(root, "version.json"), json);
|
|
||||||
File.WriteAllText(Path.Combine(modelRoot, "version.json"), json);
|
|
||||||
Console.WriteLine($"==> version.json 已生成(启动器 {launcherVersion},模型 {models.Count} 个)");
|
|
||||||
return 0;
|
|
||||||
-12
@@ -1,12 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<AssemblyName>VersionStamp</AssemblyName>
|
|
||||||
<RootNamespace>VersionStamp</RootNamespace>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
Vendored
BIN
Binary file not shown.
-23
@@ -1,23 +0,0 @@
|
|||||||
{
|
|
||||||
"runtimeTarget": {
|
|
||||||
"name": ".NETCoreApp,Version=v8.0",
|
|
||||||
"signature": ""
|
|
||||||
},
|
|
||||||
"compilationOptions": {},
|
|
||||||
"targets": {
|
|
||||||
".NETCoreApp,Version=v8.0": {
|
|
||||||
"VersionStamp/1.0.3": {
|
|
||||||
"runtime": {
|
|
||||||
"VersionStamp.dll": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"libraries": {
|
|
||||||
"VersionStamp/1.0.3": {
|
|
||||||
"type": "project",
|
|
||||||
"serviceable": false,
|
|
||||||
"sha512": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
-13
@@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"runtimeOptions": {
|
|
||||||
"tfm": "net8.0",
|
|
||||||
"framework": {
|
|
||||||
"name": "Microsoft.NETCore.App",
|
|
||||||
"version": "8.0.0"
|
|
||||||
},
|
|
||||||
"configProperties": {
|
|
||||||
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
|
|
||||||
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-4
@@ -1,4 +0,0 @@
|
|||||||
// <autogenerated />
|
|
||||||
using System;
|
|
||||||
using System.Reflection;
|
|
||||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
|
|
||||||
-23
@@ -1,23 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// This code was generated by a tool.
|
|
||||||
//
|
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
|
||||||
// the code is regenerated.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Reflection;
|
|
||||||
|
|
||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("NeoRF")]
|
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
|
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.3.0")]
|
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.3")]
|
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("Earth Model Studio")]
|
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("VersionStamp")]
|
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.3.0")]
|
|
||||||
[assembly: System.Resources.NeutralResourcesLanguageAttribute("zh-Hans")]
|
|
||||||
|
|
||||||
// Generated by the MSBuild WriteCodeFragment class.
|
|
||||||
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
74f99e4d9cbf91b981ea8bb9ca826e7a8f5f09eeb43c6922e054b3d03a9b8acf
|
|
||||||
-18
@@ -1,18 +0,0 @@
|
|||||||
is_global = true
|
|
||||||
build_property.TargetFramework = net8.0
|
|
||||||
build_property.TargetFrameworkIdentifier = .NETCoreApp
|
|
||||||
build_property.TargetFrameworkVersion = v8.0
|
|
||||||
build_property.TargetPlatformMinVersion =
|
|
||||||
build_property.UsingMicrosoftNETSdkWeb =
|
|
||||||
build_property.ProjectTypeGuids =
|
|
||||||
build_property.InvariantGlobalization =
|
|
||||||
build_property.PlatformNeutralAssembly =
|
|
||||||
build_property.EnforceExtendedAnalyzerRules =
|
|
||||||
build_property.EntryPointFilePath =
|
|
||||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
|
||||||
build_property.RootNamespace = VersionStamp
|
|
||||||
build_property.ProjectDir = /Users/morris/Downloads/GC#/model/_engine/VersionStamp/
|
|
||||||
build_property.EnableComHosting =
|
|
||||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
|
||||||
build_property.EffectiveAnalysisLevelStyle = 8.0
|
|
||||||
build_property.EnableCodeStyleSeverity =
|
|
||||||
-8
@@ -1,8 +0,0 @@
|
|||||||
// <auto-generated/>
|
|
||||||
global using System;
|
|
||||||
global using System.Collections.Generic;
|
|
||||||
global using System.IO;
|
|
||||||
global using System.Linq;
|
|
||||||
global using System.Net.Http;
|
|
||||||
global using System.Threading;
|
|
||||||
global using System.Threading.Tasks;
|
|
||||||
BIN
Binary file not shown.
-1
@@ -1 +0,0 @@
|
|||||||
85742ef80cf2152cf4a4430f83d458331bf993698b5083cd8b3b2fcfbf3691ce
|
|
||||||
-14
@@ -1,14 +0,0 @@
|
|||||||
/Users/morris/Downloads/GC#/model/_engine/VersionStamp/bin/Release/net8.0/VersionStamp
|
|
||||||
/Users/morris/Downloads/GC#/model/_engine/VersionStamp/bin/Release/net8.0/VersionStamp.deps.json
|
|
||||||
/Users/morris/Downloads/GC#/model/_engine/VersionStamp/bin/Release/net8.0/VersionStamp.runtimeconfig.json
|
|
||||||
/Users/morris/Downloads/GC#/model/_engine/VersionStamp/bin/Release/net8.0/VersionStamp.dll
|
|
||||||
/Users/morris/Downloads/GC#/model/_engine/VersionStamp/bin/Release/net8.0/VersionStamp.pdb
|
|
||||||
/Users/morris/Downloads/GC#/model/_engine/VersionStamp/obj/Release/net8.0/VersionStamp.GeneratedMSBuildEditorConfig.editorconfig
|
|
||||||
/Users/morris/Downloads/GC#/model/_engine/VersionStamp/obj/Release/net8.0/VersionStamp.AssemblyInfoInputs.cache
|
|
||||||
/Users/morris/Downloads/GC#/model/_engine/VersionStamp/obj/Release/net8.0/VersionStamp.AssemblyInfo.cs
|
|
||||||
/Users/morris/Downloads/GC#/model/_engine/VersionStamp/obj/Release/net8.0/VersionStamp.csproj.CoreCompileInputs.cache
|
|
||||||
/Users/morris/Downloads/GC#/model/_engine/VersionStamp/obj/Release/net8.0/VersionStamp.dll
|
|
||||||
/Users/morris/Downloads/GC#/model/_engine/VersionStamp/obj/Release/net8.0/refint/VersionStamp.dll
|
|
||||||
/Users/morris/Downloads/GC#/model/_engine/VersionStamp/obj/Release/net8.0/VersionStamp.pdb
|
|
||||||
/Users/morris/Downloads/GC#/model/_engine/VersionStamp/obj/Release/net8.0/VersionStamp.genruntimeconfig.cache
|
|
||||||
/Users/morris/Downloads/GC#/model/_engine/VersionStamp/obj/Release/net8.0/ref/VersionStamp.dll
|
|
||||||
Vendored
BIN
Binary file not shown.
-1
@@ -1 +0,0 @@
|
|||||||
d0976149c15255acc8dcb9e033721a42927c784807f5fd87fba864a81ecce360
|
|
||||||
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
-69
@@ -1,69 +0,0 @@
|
|||||||
{
|
|
||||||
"format": 1,
|
|
||||||
"restore": {
|
|
||||||
"/Users/morris/Downloads/GC#/model/_engine/VersionStamp/VersionStamp.csproj": {}
|
|
||||||
},
|
|
||||||
"projects": {
|
|
||||||
"/Users/morris/Downloads/GC#/model/_engine/VersionStamp/VersionStamp.csproj": {
|
|
||||||
"version": "1.0.3",
|
|
||||||
"restore": {
|
|
||||||
"projectUniqueName": "/Users/morris/Downloads/GC#/model/_engine/VersionStamp/VersionStamp.csproj",
|
|
||||||
"projectName": "VersionStamp",
|
|
||||||
"projectPath": "/Users/morris/Downloads/GC#/model/_engine/VersionStamp/VersionStamp.csproj",
|
|
||||||
"packagesPath": "/Users/morris/.nuget/packages/",
|
|
||||||
"outputPath": "/Users/morris/Downloads/GC#/model/_engine/VersionStamp/obj/",
|
|
||||||
"projectStyle": "PackageReference",
|
|
||||||
"configFilePaths": [
|
|
||||||
"/Users/morris/.nuget/NuGet/NuGet.Config"
|
|
||||||
],
|
|
||||||
"originalTargetFrameworks": [
|
|
||||||
"net8.0"
|
|
||||||
],
|
|
||||||
"sources": {
|
|
||||||
"https://api.nuget.org/v3/index.json": {}
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net8.0": {
|
|
||||||
"framework": "net8.0",
|
|
||||||
"targetAlias": "net8.0",
|
|
||||||
"projectReferences": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"warningProperties": {
|
|
||||||
"warnAsError": [
|
|
||||||
"NU1605"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"restoreAuditProperties": {
|
|
||||||
"enableAudit": "true",
|
|
||||||
"auditLevel": "low",
|
|
||||||
"auditMode": "direct"
|
|
||||||
},
|
|
||||||
"SdkAnalysisLevel": "10.0.400"
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net8.0": {
|
|
||||||
"framework": "net8.0",
|
|
||||||
"targetAlias": "net8.0",
|
|
||||||
"imports": [
|
|
||||||
"net461",
|
|
||||||
"net462",
|
|
||||||
"net47",
|
|
||||||
"net471",
|
|
||||||
"net472",
|
|
||||||
"net48",
|
|
||||||
"net481"
|
|
||||||
],
|
|
||||||
"assetTargetFallback": true,
|
|
||||||
"warn": true,
|
|
||||||
"frameworkReferences": {
|
|
||||||
"Microsoft.NETCore.App": {
|
|
||||||
"privateAssets": "all"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/10.0.401/PortableRuntimeIdentifierGraph.json"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vendored
-15
@@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
|
||||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
|
||||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
|
||||||
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
|
||||||
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
|
||||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/Users/morris/.nuget/packages/</NuGetPackageRoot>
|
|
||||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/Users/morris/.nuget/packages/</NuGetPackageFolders>
|
|
||||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
|
||||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">7.0.0</NuGetToolVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
|
||||||
<SourceRoot Include="/Users/morris/.nuget/packages/" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
||||||
-2
@@ -1,2 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
|
||||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
|
||||||
-74
@@ -1,74 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 4,
|
|
||||||
"targets": {
|
|
||||||
"net8.0": {}
|
|
||||||
},
|
|
||||||
"libraries": {},
|
|
||||||
"projectFileDependencyGroups": {
|
|
||||||
"net8.0": []
|
|
||||||
},
|
|
||||||
"packageFolders": {
|
|
||||||
"/Users/morris/.nuget/packages/": {}
|
|
||||||
},
|
|
||||||
"project": {
|
|
||||||
"version": "1.0.3",
|
|
||||||
"restore": {
|
|
||||||
"projectUniqueName": "/Users/morris/Downloads/GC#/model/_engine/VersionStamp/VersionStamp.csproj",
|
|
||||||
"projectName": "VersionStamp",
|
|
||||||
"projectPath": "/Users/morris/Downloads/GC#/model/_engine/VersionStamp/VersionStamp.csproj",
|
|
||||||
"packagesPath": "/Users/morris/.nuget/packages/",
|
|
||||||
"outputPath": "/Users/morris/Downloads/GC#/model/_engine/VersionStamp/obj/",
|
|
||||||
"projectStyle": "PackageReference",
|
|
||||||
"configFilePaths": [
|
|
||||||
"/Users/morris/.nuget/NuGet/NuGet.Config"
|
|
||||||
],
|
|
||||||
"originalTargetFrameworks": [
|
|
||||||
"net8.0"
|
|
||||||
],
|
|
||||||
"sources": {
|
|
||||||
"https://api.nuget.org/v3/index.json": {}
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net8.0": {
|
|
||||||
"framework": "net8.0",
|
|
||||||
"targetAlias": "net8.0",
|
|
||||||
"projectReferences": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"warningProperties": {
|
|
||||||
"warnAsError": [
|
|
||||||
"NU1605"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"restoreAuditProperties": {
|
|
||||||
"enableAudit": "true",
|
|
||||||
"auditLevel": "low",
|
|
||||||
"auditMode": "direct"
|
|
||||||
},
|
|
||||||
"SdkAnalysisLevel": "10.0.400"
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net8.0": {
|
|
||||||
"framework": "net8.0",
|
|
||||||
"targetAlias": "net8.0",
|
|
||||||
"imports": [
|
|
||||||
"net461",
|
|
||||||
"net462",
|
|
||||||
"net47",
|
|
||||||
"net471",
|
|
||||||
"net472",
|
|
||||||
"net48",
|
|
||||||
"net481"
|
|
||||||
],
|
|
||||||
"assetTargetFallback": true,
|
|
||||||
"warn": true,
|
|
||||||
"frameworkReferences": {
|
|
||||||
"Microsoft.NETCore.App": {
|
|
||||||
"privateAssets": "all"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/10.0.401/PortableRuntimeIdentifierGraph.json"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-8
@@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 2,
|
|
||||||
"dgSpecHash": "tJZIToOhfvc=",
|
|
||||||
"success": true,
|
|
||||||
"projectFilePath": "/Users/morris/Downloads/GC#/model/_engine/VersionStamp/VersionStamp.csproj",
|
|
||||||
"expectedPackageFiles": [],
|
|
||||||
"logs": []
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -1,904 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using Avalonia;
|
|
||||||
using Avalonia.Animation;
|
|
||||||
using Avalonia.Animation.Easings;
|
|
||||||
using Avalonia.Controls;
|
|
||||||
using Avalonia.Controls.Primitives;
|
|
||||||
using Avalonia.Input;
|
|
||||||
using Avalonia.Layout;
|
|
||||||
using Avalonia.Media;
|
|
||||||
using Avalonia.Threading;
|
|
||||||
using EarthModelStudio.ModelSdk;
|
|
||||||
|
|
||||||
namespace NeoRF.EarthModels;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 模型自己的界面:画布 + 触控友好工具栏 + 课堂演示卡 + 节气定格与步进。
|
|
||||||
/// 启动器只负责下载、开窗口和进度条,不参与任何模型渲染或教学交互。
|
|
||||||
/// </summary>
|
|
||||||
public sealed class EarthModelView : UserControl, IDisposable
|
|
||||||
{
|
|
||||||
private static readonly IBrush PanelBg = new SolidColorBrush(Color.Parse("#C40A1020"));
|
|
||||||
private static readonly IBrush ControlBg = new SolidColorBrush(Color.Parse("#16233C"));
|
|
||||||
private static readonly IBrush Accent = new SolidColorBrush(Color.Parse("#2E6BE6"));
|
|
||||||
private static readonly IBrush TitleBrush = new SolidColorBrush(Color.Parse("#F2F6FF"));
|
|
||||||
private static readonly IBrush TextBrush = new SolidColorBrush(Color.Parse("#DCE7FA"));
|
|
||||||
private static readonly IBrush MutedBrush = new SolidColorBrush(Color.Parse("#7E93B8"));
|
|
||||||
private static readonly IBrush FaintBrush = new SolidColorBrush(Color.Parse("#61779C"));
|
|
||||||
private static readonly IBrush BodyBrush = new SolidColorBrush(Color.Parse("#8CA0C4"));
|
|
||||||
private static readonly IBrush WarmBrush = new SolidColorBrush(Color.Parse("#FFC46B"));
|
|
||||||
|
|
||||||
private static readonly TimeSpan HoverDuration = TimeSpan.FromMilliseconds(120);
|
|
||||||
private static readonly TimeSpan PanelDuration = TimeSpan.FromMilliseconds(190);
|
|
||||||
|
|
||||||
private readonly IModelContext _context;
|
|
||||||
private readonly ModelStrings _texts;
|
|
||||||
private readonly SceneRuntime _runtime;
|
|
||||||
private readonly List<string> _views;
|
|
||||||
private readonly List<ModelButton> _viewButtons = new();
|
|
||||||
private readonly CelestialView _canvas;
|
|
||||||
private readonly CelestialView _closeup;
|
|
||||||
private readonly DispatcherTimer _uiTimer;
|
|
||||||
|
|
||||||
private Border? _viewSwitch;
|
|
||||||
private StackPanel? _seasonPanel;
|
|
||||||
private Border? _lessons;
|
|
||||||
private Border? _closeupHost;
|
|
||||||
private TextBlock? _closeupLabel;
|
|
||||||
private ModelButton? _playButton;
|
|
||||||
private ModelButton? _overheadButton;
|
|
||||||
private ModelButton? _closeupButton;
|
|
||||||
private TextBlock? _zoomText;
|
|
||||||
private TextBlock? _cardState;
|
|
||||||
private TextBlock? _cardTitle;
|
|
||||||
private TextBlock? _cardDate;
|
|
||||||
private TextBlock? _cardDirect;
|
|
||||||
private TextBlock? _cardNote;
|
|
||||||
|
|
||||||
private bool _playing = true;
|
|
||||||
private bool _labels = true;
|
|
||||||
private bool _orbit = true;
|
|
||||||
private bool _grid = true;
|
|
||||||
private bool _tilt;
|
|
||||||
private bool _showLessons = true;
|
|
||||||
private bool _showCloseup = true;
|
|
||||||
private bool _overhead;
|
|
||||||
private double _lastDeclination = double.NaN;
|
|
||||||
|
|
||||||
public EarthModelView(IModelContext context, SceneRuntime runtime)
|
|
||||||
{
|
|
||||||
_context = context;
|
|
||||||
_runtime = runtime;
|
|
||||||
_texts = ModelStrings.Load(context.DataDirectory, context.Language);
|
|
||||||
_views = ResolveViews(runtime.Scene);
|
|
||||||
// 自转模型主画布本身就是放大的地球,不需要再来一份特写
|
|
||||||
_showCloseup = IsRevolution;
|
|
||||||
|
|
||||||
Background = new SolidColorBrush(Color.Parse("#05070F"));
|
|
||||||
|
|
||||||
_canvas = new CelestialView
|
|
||||||
{
|
|
||||||
Scene = runtime,
|
|
||||||
Texts = _texts,
|
|
||||||
ShowLabels = true,
|
|
||||||
ShowOrbit = true,
|
|
||||||
ShowGraticule = true,
|
|
||||||
ShowKeyLatitudes = true,
|
|
||||||
FrameRate = 120,
|
|
||||||
View = IsRevolution ? SceneView.Revolution : SceneView.Rotation
|
|
||||||
};
|
|
||||||
_canvas.JumpToOrbit(StartAngle);
|
|
||||||
_canvas.JumpToSpin(20);
|
|
||||||
_canvas.ZoomChanged += zoom =>
|
|
||||||
{
|
|
||||||
if (_zoomText != null) _zoomText.Text = $"{zoom * 100:0}%";
|
|
||||||
};
|
|
||||||
|
|
||||||
// 课堂特写:同一套渲染器,把当前直射纬度放大给全班看
|
|
||||||
_closeup = new CelestialView
|
|
||||||
{
|
|
||||||
Scene = runtime,
|
|
||||||
Texts = _texts,
|
|
||||||
View = SceneView.Rotation,
|
|
||||||
IsPlaying = false,
|
|
||||||
ShowHud = false,
|
|
||||||
ShowLabels = true,
|
|
||||||
ShowGraticule = false,
|
|
||||||
ShowKeyLatitudes = true,
|
|
||||||
InsetMode = true,
|
|
||||||
Width = 240,
|
|
||||||
Height = 240
|
|
||||||
};
|
|
||||||
_closeup.JumpToSpin(20);
|
|
||||||
|
|
||||||
_uiTimer = new DispatcherTimer(TimeSpan.FromMilliseconds(140),
|
|
||||||
DispatcherPriority.Render, (_, _) => RefreshTeaching());
|
|
||||||
|
|
||||||
var root = new Grid { RowDefinitions = new RowDefinitions("Auto,Auto,*,Auto") };
|
|
||||||
|
|
||||||
var top = BuildTopBar();
|
|
||||||
root.Children.Add(top);
|
|
||||||
|
|
||||||
var options = BuildOptionsBar();
|
|
||||||
Grid.SetRow(options, 1);
|
|
||||||
root.Children.Add(options);
|
|
||||||
|
|
||||||
var stage = new Grid();
|
|
||||||
stage.Children.Add(_canvas);
|
|
||||||
stage.Children.Add(BuildZoomPad());
|
|
||||||
_lessons = BuildClassroomCard();
|
|
||||||
stage.Children.Add(_lessons);
|
|
||||||
Grid.SetRow(stage, 2);
|
|
||||||
root.Children.Add(stage);
|
|
||||||
|
|
||||||
var bottom = BuildBottomBar();
|
|
||||||
Grid.SetRow(bottom, 3);
|
|
||||||
root.Children.Add(bottom);
|
|
||||||
|
|
||||||
Content = root;
|
|
||||||
ApplyVisibility();
|
|
||||||
RefreshTeaching();
|
|
||||||
|
|
||||||
// 打开时整窗淡入,避免「啪」地出现
|
|
||||||
Opacity = 0;
|
|
||||||
Transitions = new Transitions
|
|
||||||
{
|
|
||||||
new DoubleTransition
|
|
||||||
{
|
|
||||||
Property = OpacityProperty,
|
|
||||||
Duration = TimeSpan.FromMilliseconds(260),
|
|
||||||
Easing = new CubicEaseOut()
|
|
||||||
}
|
|
||||||
};
|
|
||||||
AttachedToVisualTree += (_, _) =>
|
|
||||||
{
|
|
||||||
Opacity = 1;
|
|
||||||
_uiTimer.Start();
|
|
||||||
if (TopLevel.GetTopLevel(this) is Window window)
|
|
||||||
{
|
|
||||||
_hostWindow = window;
|
|
||||||
window.KeyDown += OnKeyDown;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
DetachedFromVisualTree += (_, _) =>
|
|
||||||
{
|
|
||||||
_uiTimer.Stop();
|
|
||||||
if (_hostWindow != null)
|
|
||||||
{
|
|
||||||
_hostWindow.KeyDown -= OnKeyDown;
|
|
||||||
_hostWindow = null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private Window? _hostWindow;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 窗口关闭时释放计时器、解绑窗口事件并释放两块球面位图,
|
|
||||||
/// 否则 DispatcherTimer / KeyDown 会持有控件,使 collectible ALC 无法卸载。
|
|
||||||
/// </summary>
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
_uiTimer.Stop();
|
|
||||||
if (_hostWindow != null)
|
|
||||||
{
|
|
||||||
_hostWindow.KeyDown -= OnKeyDown;
|
|
||||||
_hostWindow = null;
|
|
||||||
}
|
|
||||||
_canvas.Dispose();
|
|
||||||
_closeup.Dispose();
|
|
||||||
GC.SuppressFinalize(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
private string CurrentView { get; set; } = "rotation";
|
|
||||||
private double StartAngle => IsRevolution ? 60 : 0;
|
|
||||||
private bool IsRevolution => string.Equals(CurrentView, "revolution", StringComparison.OrdinalIgnoreCase);
|
|
||||||
private bool HasViewSwitch => _views.Count > 1;
|
|
||||||
private List<SeasonPoint> Seasons => _runtime.Scene.Orbit.Seasons;
|
|
||||||
|
|
||||||
private static string NormalizeView(string? view)
|
|
||||||
=> string.Equals(view, "revolution", StringComparison.OrdinalIgnoreCase) ? "revolution" : "rotation";
|
|
||||||
|
|
||||||
private List<string> ResolveViews(SceneDefinition scene)
|
|
||||||
{
|
|
||||||
var list = new List<string>();
|
|
||||||
foreach (var v in scene.Views)
|
|
||||||
{
|
|
||||||
var normalized = NormalizeView(v);
|
|
||||||
if (!list.Contains(normalized)) list.Add(normalized);
|
|
||||||
}
|
|
||||||
if (list.Count == 0) list.Add(NormalizeView(scene.DefaultView));
|
|
||||||
CurrentView = list[0];
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------- 顶部主工具栏
|
|
||||||
private Control BuildTopBar()
|
|
||||||
{
|
|
||||||
// 关闭按钮统一放在窗口右上角的自建标题栏,这里不再重复放左上角
|
|
||||||
var title = new StackPanel { Spacing = 1, VerticalAlignment = VerticalAlignment.Center };
|
|
||||||
title.Children.Add(new TextBlock
|
|
||||||
{
|
|
||||||
Text = _texts.Pick(_runtime.Scene.NameI18n, _texts["title"]),
|
|
||||||
Foreground = TitleBrush,
|
|
||||||
FontSize = 14,
|
|
||||||
FontWeight = FontWeight.SemiBold
|
|
||||||
});
|
|
||||||
title.Children.Add(new TextBlock
|
|
||||||
{
|
|
||||||
Text = _texts.Pick(_runtime.Scene.DescriptionI18n, ""),
|
|
||||||
Foreground = MutedBrush,
|
|
||||||
FontSize = 10.5,
|
|
||||||
MaxWidth = 330,
|
|
||||||
TextTrimming = TextTrimming.CharacterEllipsis
|
|
||||||
});
|
|
||||||
|
|
||||||
var switchPanel = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 3 };
|
|
||||||
switchPanel.Children.Add(MakeViewButton("rotation", _texts["view.rotation"]));
|
|
||||||
switchPanel.Children.Add(MakeViewButton("revolution", _texts["view.revolution"]));
|
|
||||||
_viewSwitch = new Border
|
|
||||||
{
|
|
||||||
Background = ControlBg,
|
|
||||||
CornerRadius = new CornerRadius(10),
|
|
||||||
Padding = new Thickness(3),
|
|
||||||
Margin = new Thickness(16, 0, 0, 0),
|
|
||||||
VerticalAlignment = VerticalAlignment.Center,
|
|
||||||
Child = switchPanel
|
|
||||||
};
|
|
||||||
|
|
||||||
var actions = new StackPanel
|
|
||||||
{
|
|
||||||
Orientation = Orientation.Horizontal,
|
|
||||||
Spacing = 8,
|
|
||||||
VerticalAlignment = VerticalAlignment.Center
|
|
||||||
};
|
|
||||||
_playButton = MakeButton(_texts["pause"], TogglePlay);
|
|
||||||
_playButton.MinWidth = 74;
|
|
||||||
actions.Children.Add(_playButton);
|
|
||||||
actions.Children.Add(MakeButton(_texts["reset"], () =>
|
|
||||||
{
|
|
||||||
_canvas.ResetAnimation();
|
|
||||||
_canvas.JumpToOrbit(StartAngle);
|
|
||||||
RefreshTeaching();
|
|
||||||
}));
|
|
||||||
actions.Children.Add(MakeButton("◀", () => Step(-5), large: true));
|
|
||||||
actions.Children.Add(MakeButton("▶", () => Step(5), large: true));
|
|
||||||
actions.Children.Add(MakeButton(_texts["classroom"], () => SetLessonsVisible(!_showLessons)));
|
|
||||||
actions.Children.Add(MakeButton("⛶", ToggleFullScreen, large: true));
|
|
||||||
|
|
||||||
var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,Auto,*,Auto") };
|
|
||||||
Grid.SetColumn(title, 0);
|
|
||||||
title.Margin = new Thickness(14, 0, 0, 0);
|
|
||||||
grid.Children.Add(title);
|
|
||||||
Grid.SetColumn(_viewSwitch, 1);
|
|
||||||
grid.Children.Add(_viewSwitch);
|
|
||||||
Grid.SetColumn(actions, 3);
|
|
||||||
grid.Children.Add(actions);
|
|
||||||
|
|
||||||
return new Border { Background = PanelBg, Padding = new Thickness(16, 9), Child = grid };
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------- 显示选项行
|
|
||||||
private Control BuildOptionsBar()
|
|
||||||
{
|
|
||||||
var row = new StackPanel
|
|
||||||
{
|
|
||||||
Orientation = Orientation.Horizontal,
|
|
||||||
Spacing = 7,
|
|
||||||
VerticalAlignment = VerticalAlignment.Center
|
|
||||||
};
|
|
||||||
row.Children.Add(MakeToggle(_texts["labels"], _labels, on => { _labels = on; _canvas.ShowLabels = on; }));
|
|
||||||
row.Children.Add(MakeToggle(_texts["orbit"], _orbit, on => { _orbit = on; _canvas.ShowOrbit = on; }));
|
|
||||||
row.Children.Add(MakeToggle(_texts["grid"], _grid, on => { _grid = on; _canvas.ShowGraticule = on; }));
|
|
||||||
row.Children.Add(MakeToggle(_texts["tilt"], _tilt, on => { _tilt = on; _canvas.ExaggerateTilt = on; }));
|
|
||||||
_closeupButton = MakeToggle(_texts["closeup"], _showCloseup, on =>
|
|
||||||
{
|
|
||||||
_showCloseup = on;
|
|
||||||
ApplyVisibility();
|
|
||||||
});
|
|
||||||
row.Children.Add(_closeupButton);
|
|
||||||
_overheadButton = MakeToggle(_texts["overhead"], _overhead, on =>
|
|
||||||
{
|
|
||||||
_overhead = on;
|
|
||||||
// 视角只由这个显式控件改变;拖动永远不会碰它
|
|
||||||
_canvas.CameraElevation = on ? (IsRevolution ? 74 : 62) : double.NaN;
|
|
||||||
});
|
|
||||||
row.Children.Add(_overheadButton);
|
|
||||||
|
|
||||||
var shortcut = new TextBlock
|
|
||||||
{
|
|
||||||
Text = _texts["shortcutHint"],
|
|
||||||
Foreground = FaintBrush,
|
|
||||||
FontSize = 10.5,
|
|
||||||
VerticalAlignment = VerticalAlignment.Center,
|
|
||||||
Margin = new Thickness(12, 0, 0, 0)
|
|
||||||
};
|
|
||||||
|
|
||||||
var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*") };
|
|
||||||
grid.Children.Add(row);
|
|
||||||
Grid.SetColumn(shortcut, 1);
|
|
||||||
grid.Children.Add(shortcut);
|
|
||||||
return new Border
|
|
||||||
{
|
|
||||||
Background = new SolidColorBrush(Color.Parse("#A00A1020")),
|
|
||||||
Padding = new Thickness(16, 7),
|
|
||||||
Child = grid
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private ModelButton MakeViewButton(string view, string label)
|
|
||||||
{
|
|
||||||
var button = MakeButton(label, () => SwitchView(view));
|
|
||||||
button.SetBase(string.Equals(CurrentView, view, StringComparison.OrdinalIgnoreCase) ? Accent : ControlBg);
|
|
||||||
button.Tag = view;
|
|
||||||
button.IsVisible = _views.Contains(view);
|
|
||||||
_viewButtons.Add(button);
|
|
||||||
return button;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ModelButton MakeToggle(string label, bool initial, Action<bool> changed)
|
|
||||||
{
|
|
||||||
var state = initial;
|
|
||||||
ModelButton? button = null;
|
|
||||||
button = MakeButton(label, () =>
|
|
||||||
{
|
|
||||||
state = !state;
|
|
||||||
changed(state);
|
|
||||||
button?.SetBase(state ? Accent : ControlBg);
|
|
||||||
});
|
|
||||||
button.SetBase(initial ? Accent : ControlBg);
|
|
||||||
return button;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SwitchView(string view)
|
|
||||||
{
|
|
||||||
CurrentView = NormalizeView(view);
|
|
||||||
_canvas.View = IsRevolution ? SceneView.Revolution : SceneView.Rotation;
|
|
||||||
_canvas.JumpToOrbit(StartAngle);
|
|
||||||
_canvas.CameraElevation = _overhead ? (IsRevolution ? 74 : 62) : double.NaN;
|
|
||||||
foreach (var button in _viewButtons)
|
|
||||||
button.SetBase(string.Equals(button.Tag as string, CurrentView, StringComparison.OrdinalIgnoreCase)
|
|
||||||
? Accent
|
|
||||||
: ControlBg);
|
|
||||||
ApplyVisibility();
|
|
||||||
RefreshTeaching();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------- 画布浮动缩放板(触控大按钮)
|
|
||||||
private Control BuildZoomPad()
|
|
||||||
{
|
|
||||||
var plus = MakeButton("+", () => _canvas.ZoomBy(1.25), large: true);
|
|
||||||
var minus = MakeButton("-", () => _canvas.ZoomBy(1 / 1.25), large: true);
|
|
||||||
var reset = MakeButton("⟲", () => _canvas.ResetView(), large: true);
|
|
||||||
foreach (var b in new[] { plus, minus, reset })
|
|
||||||
{
|
|
||||||
b.MinWidth = 62;
|
|
||||||
b.MinHeight = 48;
|
|
||||||
b.HorizontalAlignment = HorizontalAlignment.Stretch;
|
|
||||||
}
|
|
||||||
|
|
||||||
_zoomText = new TextBlock
|
|
||||||
{
|
|
||||||
Text = "100%",
|
|
||||||
Foreground = TextBrush,
|
|
||||||
FontSize = 13,
|
|
||||||
FontWeight = FontWeight.SemiBold,
|
|
||||||
TextAlignment = TextAlignment.Center,
|
|
||||||
Margin = new Thickness(0, 2, 0, 2)
|
|
||||||
};
|
|
||||||
|
|
||||||
var stack = new StackPanel { Spacing = 6, Width = 62 };
|
|
||||||
stack.Children.Add(new TextBlock
|
|
||||||
{
|
|
||||||
Text = _texts["zoom"],
|
|
||||||
Foreground = MutedBrush,
|
|
||||||
FontSize = 10.5,
|
|
||||||
TextAlignment = TextAlignment.Center
|
|
||||||
});
|
|
||||||
stack.Children.Add(plus);
|
|
||||||
stack.Children.Add(_zoomText);
|
|
||||||
stack.Children.Add(minus);
|
|
||||||
stack.Children.Add(reset);
|
|
||||||
|
|
||||||
return new Border
|
|
||||||
{
|
|
||||||
HorizontalAlignment = HorizontalAlignment.Left,
|
|
||||||
VerticalAlignment = VerticalAlignment.Bottom,
|
|
||||||
Margin = new Thickness(16, 0, 0, 16),
|
|
||||||
Background = new SolidColorBrush(Color.Parse("#C00B1226")),
|
|
||||||
BorderBrush = new SolidColorBrush(Color.Parse("#26374F")),
|
|
||||||
BorderThickness = new Thickness(1),
|
|
||||||
CornerRadius = new CornerRadius(14),
|
|
||||||
Padding = new Thickness(10),
|
|
||||||
Child = stack
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------- 底部
|
|
||||||
private Control BuildBottomBar()
|
|
||||||
{
|
|
||||||
var speedLabel = new TextBlock
|
|
||||||
{
|
|
||||||
Text = _texts["speed"],
|
|
||||||
Foreground = new SolidColorBrush(Color.Parse("#9DB0D0")),
|
|
||||||
VerticalAlignment = VerticalAlignment.Center
|
|
||||||
};
|
|
||||||
|
|
||||||
var slider = new Slider
|
|
||||||
{
|
|
||||||
Minimum = 0.25,
|
|
||||||
Maximum = 4,
|
|
||||||
Value = 1,
|
|
||||||
Margin = new Thickness(12, 0, 0, 0),
|
|
||||||
Width = 180,
|
|
||||||
Height = 38
|
|
||||||
};
|
|
||||||
var speedText = new TextBlock
|
|
||||||
{
|
|
||||||
Text = "1×",
|
|
||||||
Foreground = TextBrush,
|
|
||||||
VerticalAlignment = VerticalAlignment.Center,
|
|
||||||
Width = 46,
|
|
||||||
Margin = new Thickness(6, 0, 0, 0)
|
|
||||||
};
|
|
||||||
slider.ValueChanged += (_, e) =>
|
|
||||||
{
|
|
||||||
_canvas.Speed = e.NewValue;
|
|
||||||
speedText.Text = $"{e.NewValue:0.##}×";
|
|
||||||
};
|
|
||||||
|
|
||||||
var hint = new TextBlock
|
|
||||||
{
|
|
||||||
Text = _texts["hint"],
|
|
||||||
Foreground = FaintBrush,
|
|
||||||
FontSize = 10.5,
|
|
||||||
VerticalAlignment = VerticalAlignment.Center,
|
|
||||||
Margin = new Thickness(20, 0, 0, 0),
|
|
||||||
TextTrimming = TextTrimming.CharacterEllipsis
|
|
||||||
};
|
|
||||||
|
|
||||||
_seasonPanel = new StackPanel
|
|
||||||
{
|
|
||||||
Orientation = Orientation.Horizontal,
|
|
||||||
Spacing = 7,
|
|
||||||
VerticalAlignment = VerticalAlignment.Center
|
|
||||||
};
|
|
||||||
_seasonPanel.Children.Add(new TextBlock
|
|
||||||
{
|
|
||||||
Text = _texts["seasons"],
|
|
||||||
Foreground = MutedBrush,
|
|
||||||
VerticalAlignment = VerticalAlignment.Center,
|
|
||||||
Margin = new Thickness(0, 0, 6, 0)
|
|
||||||
});
|
|
||||||
foreach (var season in Seasons) _seasonPanel.Children.Add(MakeSeasonButton(season));
|
|
||||||
|
|
||||||
var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,Auto,Auto,*,Auto") };
|
|
||||||
grid.Children.Add(speedLabel);
|
|
||||||
Grid.SetColumn(slider, 1);
|
|
||||||
grid.Children.Add(slider);
|
|
||||||
Grid.SetColumn(speedText, 2);
|
|
||||||
grid.Children.Add(speedText);
|
|
||||||
Grid.SetColumn(hint, 3);
|
|
||||||
grid.Children.Add(hint);
|
|
||||||
Grid.SetColumn(_seasonPanel, 4);
|
|
||||||
grid.Children.Add(_seasonPanel);
|
|
||||||
|
|
||||||
return new Border { Background = PanelBg, Padding = new Thickness(16, 8), Child = grid };
|
|
||||||
}
|
|
||||||
|
|
||||||
private ModelButton MakeSeasonButton(SeasonPoint season)
|
|
||||||
{
|
|
||||||
var captured = season;
|
|
||||||
var button = MakeButton(_texts[season.Key], () => JumpToSeason(captured));
|
|
||||||
button.MinHeight = 44;
|
|
||||||
return button;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------- 课堂演示卡
|
|
||||||
private Border BuildClassroomCard()
|
|
||||||
{
|
|
||||||
var header = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto") };
|
|
||||||
header.Children.Add(new TextBlock
|
|
||||||
{
|
|
||||||
Text = _texts["classroom"],
|
|
||||||
Foreground = TitleBrush,
|
|
||||||
FontWeight = FontWeight.SemiBold,
|
|
||||||
FontSize = 13,
|
|
||||||
VerticalAlignment = VerticalAlignment.Center
|
|
||||||
});
|
|
||||||
var close = MakeButton("✕", () => SetLessonsVisible(false));
|
|
||||||
close.SetBase(Brushes.Transparent);
|
|
||||||
Grid.SetColumn(close, 1);
|
|
||||||
header.Children.Add(close);
|
|
||||||
|
|
||||||
_cardState = new TextBlock
|
|
||||||
{
|
|
||||||
Text = _texts["running"],
|
|
||||||
Foreground = MutedBrush,
|
|
||||||
FontSize = 11,
|
|
||||||
Margin = new Thickness(0, 6, 0, 0)
|
|
||||||
};
|
|
||||||
_cardTitle = new TextBlock
|
|
||||||
{
|
|
||||||
Foreground = TitleBrush,
|
|
||||||
FontSize = 20,
|
|
||||||
FontWeight = FontWeight.Bold
|
|
||||||
};
|
|
||||||
_cardDate = new TextBlock { Foreground = MutedBrush, FontSize = 12 };
|
|
||||||
_cardDirect = new TextBlock
|
|
||||||
{
|
|
||||||
Foreground = WarmBrush,
|
|
||||||
FontSize = 27,
|
|
||||||
FontWeight = FontWeight.Bold
|
|
||||||
};
|
|
||||||
_cardNote = new TextBlock
|
|
||||||
{
|
|
||||||
Foreground = BodyBrush,
|
|
||||||
FontSize = 12,
|
|
||||||
TextWrapping = TextWrapping.Wrap,
|
|
||||||
LineHeight = 18
|
|
||||||
};
|
|
||||||
|
|
||||||
_closeupHost = new Border
|
|
||||||
{
|
|
||||||
CornerRadius = new CornerRadius(10),
|
|
||||||
BorderBrush = new SolidColorBrush(Color.Parse("#26374F")),
|
|
||||||
BorderThickness = new Thickness(1),
|
|
||||||
HorizontalAlignment = HorizontalAlignment.Center,
|
|
||||||
Margin = new Thickness(0, 4, 0, 2),
|
|
||||||
Child = _closeup
|
|
||||||
};
|
|
||||||
|
|
||||||
var readouts = new StackPanel { Spacing = 2 };
|
|
||||||
readouts.Children.Add(_cardState);
|
|
||||||
readouts.Children.Add(_cardTitle);
|
|
||||||
readouts.Children.Add(_cardDate);
|
|
||||||
readouts.Children.Add(new TextBlock
|
|
||||||
{
|
|
||||||
Text = _texts["directPoint"],
|
|
||||||
Foreground = MutedBrush,
|
|
||||||
FontSize = 11,
|
|
||||||
Margin = new Thickness(0, 8, 0, 0)
|
|
||||||
});
|
|
||||||
readouts.Children.Add(_cardDirect);
|
|
||||||
readouts.Children.Add(_cardNote);
|
|
||||||
_closeupLabel = new TextBlock
|
|
||||||
{
|
|
||||||
Text = _texts["closeup"],
|
|
||||||
Foreground = MutedBrush,
|
|
||||||
FontSize = 11,
|
|
||||||
Margin = new Thickness(0, 6, 0, 0)
|
|
||||||
};
|
|
||||||
readouts.Children.Add(_closeupLabel);
|
|
||||||
readouts.Children.Add(_closeupHost);
|
|
||||||
|
|
||||||
var list = new StackPanel { Spacing = 2 };
|
|
||||||
foreach (var lesson in _runtime.Scene.Lessons)
|
|
||||||
{
|
|
||||||
var title = new TextBlock
|
|
||||||
{
|
|
||||||
Text = _texts.Pick(lesson.TitleI18n, ""),
|
|
||||||
Foreground = new SolidColorBrush(Color.Parse("#CFE0FF")),
|
|
||||||
FontSize = 12,
|
|
||||||
FontWeight = FontWeight.SemiBold,
|
|
||||||
TextWrapping = TextWrapping.Wrap
|
|
||||||
};
|
|
||||||
var body = new TextBlock
|
|
||||||
{
|
|
||||||
Text = _texts.Pick(lesson.BodyI18n, ""),
|
|
||||||
Foreground = BodyBrush,
|
|
||||||
FontSize = 11,
|
|
||||||
TextWrapping = TextWrapping.Wrap
|
|
||||||
};
|
|
||||||
var stack = new StackPanel { Spacing = 3 };
|
|
||||||
stack.Children.Add(title);
|
|
||||||
stack.Children.Add(body);
|
|
||||||
|
|
||||||
var button = new Button
|
|
||||||
{
|
|
||||||
Content = stack,
|
|
||||||
Background = Brushes.Transparent,
|
|
||||||
BorderThickness = new Thickness(0),
|
|
||||||
HorizontalAlignment = HorizontalAlignment.Stretch,
|
|
||||||
HorizontalContentAlignment = HorizontalAlignment.Left,
|
|
||||||
Padding = new Thickness(8, 9),
|
|
||||||
Margin = new Thickness(0, 1),
|
|
||||||
MinHeight = 44,
|
|
||||||
Cursor = new Cursor(StandardCursorType.Hand),
|
|
||||||
Transitions = new Transitions
|
|
||||||
{
|
|
||||||
new BrushTransition { Property = BackgroundProperty, Duration = HoverDuration }
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var captured = lesson;
|
|
||||||
button.Click += (_, _) => ApplyLesson(captured);
|
|
||||||
button.PointerEntered += (_, _) => button.Background = new SolidColorBrush(Color.Parse("#1B2A47"));
|
|
||||||
button.PointerExited += (_, _) => button.Background = Brushes.Transparent;
|
|
||||||
list.Children.Add(button);
|
|
||||||
}
|
|
||||||
|
|
||||||
var content = new StackPanel { Spacing = 8 };
|
|
||||||
content.Children.Add(readouts);
|
|
||||||
content.Children.Add(new TextBlock
|
|
||||||
{
|
|
||||||
Text = _texts["lessons"],
|
|
||||||
Foreground = TitleBrush,
|
|
||||||
FontWeight = FontWeight.SemiBold,
|
|
||||||
FontSize = 12.5
|
|
||||||
});
|
|
||||||
content.Children.Add(list);
|
|
||||||
|
|
||||||
var bodyGrid = new Grid { RowDefinitions = new RowDefinitions("Auto,*") };
|
|
||||||
bodyGrid.Children.Add(header);
|
|
||||||
var scroller = new ScrollViewer
|
|
||||||
{
|
|
||||||
Content = content,
|
|
||||||
VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
|
|
||||||
Margin = new Thickness(0, 8, 0, 0)
|
|
||||||
};
|
|
||||||
Grid.SetRow(scroller, 1);
|
|
||||||
bodyGrid.Children.Add(scroller);
|
|
||||||
|
|
||||||
var panel = new Border
|
|
||||||
{
|
|
||||||
HorizontalAlignment = HorizontalAlignment.Right,
|
|
||||||
VerticalAlignment = VerticalAlignment.Stretch,
|
|
||||||
Width = 296,
|
|
||||||
Margin = new Thickness(0, 12, 16, 12),
|
|
||||||
Background = new SolidColorBrush(Color.Parse("#D00B1226")),
|
|
||||||
CornerRadius = new CornerRadius(14),
|
|
||||||
Padding = new Thickness(13),
|
|
||||||
BorderBrush = new SolidColorBrush(Color.Parse("#26374F")),
|
|
||||||
BorderThickness = new Thickness(1),
|
|
||||||
Child = bodyGrid,
|
|
||||||
RenderTransform = new TranslateTransform(0, 0)
|
|
||||||
};
|
|
||||||
panel.Transitions = new Transitions
|
|
||||||
{
|
|
||||||
new DoubleTransition { Property = OpacityProperty, Duration = PanelDuration, Easing = new CubicEaseOut() },
|
|
||||||
new DoubleTransition
|
|
||||||
{
|
|
||||||
Property = TranslateTransform.XProperty,
|
|
||||||
Duration = PanelDuration,
|
|
||||||
Easing = new CubicEaseOut()
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return panel;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetLessonsVisible(bool visible)
|
|
||||||
{
|
|
||||||
_showLessons = visible;
|
|
||||||
if (_lessons == null) return;
|
|
||||||
|
|
||||||
if (visible)
|
|
||||||
{
|
|
||||||
_lessons.IsVisible = true;
|
|
||||||
_lessons.Opacity = 1;
|
|
||||||
if (_lessons.RenderTransform is TranslateTransform transform) transform.X = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_lessons.Opacity = 0;
|
|
||||||
if (_lessons.RenderTransform is TranslateTransform hidden) hidden.X = 26;
|
|
||||||
|
|
||||||
var timer = new DispatcherTimer { Interval = PanelDuration };
|
|
||||||
timer.Tick += (_, _) =>
|
|
||||||
{
|
|
||||||
timer.Stop();
|
|
||||||
if (!_showLessons && _lessons != null) _lessons.IsVisible = false;
|
|
||||||
};
|
|
||||||
timer.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>课堂卡与地球特写跟随当前轨道位置刷新(播放时每 140ms 更新一次)。</summary>
|
|
||||||
private void RefreshTeaching()
|
|
||||||
{
|
|
||||||
if (_cardTitle == null) return;
|
|
||||||
var season = IsRevolution ? _canvas.NearestSeason(6) : null;
|
|
||||||
var decl = _canvas.SubsolarLatitude;
|
|
||||||
|
|
||||||
_cardState!.Text = _playing ? _texts["running"] : _texts["frozen"];
|
|
||||||
_cardState.Foreground = _playing ? MutedBrush : WarmBrush;
|
|
||||||
_cardTitle.Text = season != null
|
|
||||||
? _texts[season.Key]
|
|
||||||
: (IsRevolution ? _texts["seasons"] : _texts.Pick(_runtime.Scene.NameI18n, _texts["title"]));
|
|
||||||
_cardDate!.Text = IsRevolution ? _canvas.CurrentDate : _texts["dayNight"];
|
|
||||||
_cardDirect!.Text = season?.DeclinationDeg.HasValue == true
|
|
||||||
? FormatDeclination(season.DeclinationDeg.Value)
|
|
||||||
: _canvas.DeclinationLabel;
|
|
||||||
_cardNote!.Text = !IsRevolution
|
|
||||||
? _texts["rotationTeach"]
|
|
||||||
: season != null
|
|
||||||
? _texts.Pick(season.TeachingI18n, _texts["orbitTeach"])
|
|
||||||
: _texts["orbitTeach"];
|
|
||||||
|
|
||||||
// 特写的直射纬度用缓动逼近目标,而不是瞬间跳变:
|
|
||||||
// 公转时拖动/改变轨道角,晨昏线会平滑地移过去(每次 timer 步进一帧)。
|
|
||||||
if (_showCloseup)
|
|
||||||
{
|
|
||||||
var target = decl;
|
|
||||||
var current = _closeup.DeclinationDeg;
|
|
||||||
var diff = target - current;
|
|
||||||
if (Math.Abs(diff) < 0.02)
|
|
||||||
{
|
|
||||||
_closeup.DeclinationDeg = target;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// 每 140ms 走剩余距离的 ~18%,形成自然的 ease-out 动画
|
|
||||||
_closeup.DeclinationDeg = current + diff * 0.18;
|
|
||||||
}
|
|
||||||
_lastDeclination = target;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private string FormatDeclination(double d)
|
|
||||||
=> Math.Abs(d) < 0.05
|
|
||||||
? "0° " + _texts["lat.equator"]
|
|
||||||
: $"{Math.Abs(d):0.0}°" + (d > 0 ? _texts["northShort"] : _texts["southShort"]);
|
|
||||||
|
|
||||||
private void ApplyLesson(Lesson lesson)
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrWhiteSpace(lesson.View))
|
|
||||||
{
|
|
||||||
var view = NormalizeView(lesson.View);
|
|
||||||
if (!string.Equals(view, CurrentView, StringComparison.OrdinalIgnoreCase)) SwitchView(view);
|
|
||||||
}
|
|
||||||
// 讲要点时自动定格,读数不再跳动,方便指读板书
|
|
||||||
SetPlaying(false);
|
|
||||||
if (lesson.AngleDeg.HasValue) _canvas.JumpToOrbit(lesson.AngleDeg.Value);
|
|
||||||
RefreshTeaching();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------- 教学操作
|
|
||||||
private void SetPlaying(bool play)
|
|
||||||
{
|
|
||||||
_playing = play;
|
|
||||||
_canvas.IsPlaying = play;
|
|
||||||
if (_playButton?.Content is TextBlock block)
|
|
||||||
block.Text = play ? _texts["pause"] : _texts["play"];
|
|
||||||
RefreshTeaching();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void TogglePlay() => SetPlaying(!_playing);
|
|
||||||
|
|
||||||
private void Step(double deltaDeg)
|
|
||||||
{
|
|
||||||
SetPlaying(false);
|
|
||||||
if (IsRevolution) _canvas.StepOrbit(deltaDeg);
|
|
||||||
else _canvas.StepSpin(deltaDeg);
|
|
||||||
RefreshTeaching();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void JumpToSeason(SeasonPoint season)
|
|
||||||
{
|
|
||||||
if (!IsRevolution) SwitchView("revolution");
|
|
||||||
SetPlaying(false);
|
|
||||||
_canvas.JumpToOrbit(season.AngleDeg);
|
|
||||||
RefreshTeaching();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void JumpToSeasonIndex(int index)
|
|
||||||
{
|
|
||||||
if (index < 0 || index >= Seasons.Count) return;
|
|
||||||
JumpToSeason(Seasons[index]);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ToggleFullScreen()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (TopLevel.GetTopLevel(this) is Window window)
|
|
||||||
window.WindowState = window.WindowState == WindowState.FullScreen
|
|
||||||
? WindowState.Normal
|
|
||||||
: WindowState.FullScreen;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_context.Log("全屏切换失败: " + ex.Message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnKeyDown(object? sender, KeyEventArgs e)
|
|
||||||
{
|
|
||||||
switch (e.Key)
|
|
||||||
{
|
|
||||||
case Key.Space:
|
|
||||||
TogglePlay();
|
|
||||||
e.Handled = true;
|
|
||||||
break;
|
|
||||||
case Key.Left:
|
|
||||||
Step(-5);
|
|
||||||
e.Handled = true;
|
|
||||||
break;
|
|
||||||
case Key.Right:
|
|
||||||
Step(5);
|
|
||||||
e.Handled = true;
|
|
||||||
break;
|
|
||||||
case Key.D1: JumpToSeasonIndex(0); e.Handled = true; break;
|
|
||||||
case Key.D2: JumpToSeasonIndex(1); e.Handled = true; break;
|
|
||||||
case Key.D3: JumpToSeasonIndex(2); e.Handled = true; break;
|
|
||||||
case Key.D4: JumpToSeasonIndex(3); e.Handled = true; break;
|
|
||||||
case Key.F: ToggleFullScreen(); e.Handled = true; break;
|
|
||||||
case Key.Add: _canvas.ZoomBy(1.25); e.Handled = true; break;
|
|
||||||
case Key.Subtract: _canvas.ZoomBy(1 / 1.25); e.Handled = true; break;
|
|
||||||
case Key.D0: _canvas.ResetView(); e.Handled = true; break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------- 工具
|
|
||||||
private ModelButton MakeButton(string text, Action onClick, bool large = false)
|
|
||||||
{
|
|
||||||
var button = new ModelButton
|
|
||||||
{
|
|
||||||
Content = new TextBlock { Text = text, FontSize = large ? 20 : 12.5 },
|
|
||||||
Foreground = TextBrush,
|
|
||||||
BorderThickness = new Thickness(0),
|
|
||||||
CornerRadius = new CornerRadius(9),
|
|
||||||
Padding = large ? new Thickness(10, 8) : new Thickness(13, 9),
|
|
||||||
MinWidth = large ? 46 : 44,
|
|
||||||
MinHeight = 40,
|
|
||||||
HorizontalContentAlignment = HorizontalAlignment.Center,
|
|
||||||
VerticalAlignment = VerticalAlignment.Center,
|
|
||||||
Cursor = new Cursor(StandardCursorType.Hand)
|
|
||||||
};
|
|
||||||
button.SetBase(ControlBg);
|
|
||||||
button.Click += (_, _) => onClick();
|
|
||||||
return button;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ApplyVisibility()
|
|
||||||
{
|
|
||||||
if (_viewSwitch != null) _viewSwitch.IsVisible = HasViewSwitch;
|
|
||||||
if (_lessons != null) _lessons.IsVisible = _showLessons;
|
|
||||||
if (_seasonPanel != null) _seasonPanel.IsVisible = IsRevolution;
|
|
||||||
if (_closeupHost != null) _closeupHost.IsVisible = _showCloseup;
|
|
||||||
if (_closeupLabel != null) _closeupLabel.IsVisible = _showCloseup;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>带悬停过渡的按钮:本地基础色 + 悬停提亮。</summary>
|
|
||||||
private sealed class ModelButton : Button
|
|
||||||
{
|
|
||||||
private IBrush _base = ControlBg;
|
|
||||||
private IBrush _hover = ControlBg;
|
|
||||||
|
|
||||||
public ModelButton()
|
|
||||||
{
|
|
||||||
Transitions = new Transitions
|
|
||||||
{
|
|
||||||
new BrushTransition { Property = BackgroundProperty, Duration = HoverDuration }
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetBase(IBrush brush)
|
|
||||||
{
|
|
||||||
_base = brush;
|
|
||||||
_hover = Lighten(brush);
|
|
||||||
Background = brush;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnPointerEntered(PointerEventArgs e)
|
|
||||||
{
|
|
||||||
base.OnPointerEntered(e);
|
|
||||||
Background = _hover;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnPointerExited(PointerEventArgs e)
|
|
||||||
{
|
|
||||||
base.OnPointerExited(e);
|
|
||||||
Background = _base;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IBrush Lighten(IBrush brush)
|
|
||||||
{
|
|
||||||
if (brush is not SolidColorBrush solid) return brush;
|
|
||||||
var c = solid.Color;
|
|
||||||
return new SolidColorBrush(Color.FromArgb(c.A,
|
|
||||||
(byte)Math.Min(255, c.R + 26),
|
|
||||||
(byte)Math.Min(255, c.G + 26),
|
|
||||||
(byte)Math.Min(255, c.B + 30)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Avalonia.Controls;
|
|
||||||
using EarthModelStudio.ModelSdk;
|
|
||||||
|
|
||||||
namespace NeoRF.EarthModels;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 地球模型共享运行时:读自己目录下的 scene.json / land.json / i18n,
|
|
||||||
/// 然后把自带界面交给启动器。启动器完全不知道“地球”“节气”这些东西。
|
|
||||||
/// </summary>
|
|
||||||
public sealed class EarthModelRuntime : IModelRuntime
|
|
||||||
{
|
|
||||||
public const int SupportedApiVersion = 1;
|
|
||||||
|
|
||||||
private SceneRuntime? _scene;
|
|
||||||
|
|
||||||
/// <summary>后台准备:读场景、生成地表纹理(耗时都花在这里,进度条能实时走)。</summary>
|
|
||||||
public void Prepare(IModelContext context)
|
|
||||||
{
|
|
||||||
context.ReportProgress(0.03, "读取场景数据");
|
|
||||||
_scene = SceneRuntime.Load(context.DataDirectory, context.MemoryBudgetMb, context.ReportProgress);
|
|
||||||
context.Log($"[{context.ModelId}] 场景已加载:{_scene.Scene.DefaultView}," +
|
|
||||||
$"地表纹理 {(_scene.Texture == null ? "无" : _scene.Texture.Width + "×" + _scene.Texture.Height)}");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>UI 线程构建界面(很快)。</summary>
|
|
||||||
public Control CreateView(IModelContext context)
|
|
||||||
{
|
|
||||||
context.ReportProgress(0.78, "构建界面");
|
|
||||||
_scene ??= SceneRuntime.Load(context.DataDirectory, context.MemoryBudgetMb, context.ReportProgress);
|
|
||||||
var view = new EarthModelView(context, _scene);
|
|
||||||
context.ReportProgress(1.0, "准备就绪");
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 释放预烘焙纹理(约 3MB 托管数组)与场景引用。窗口关闭时由启动器调用,
|
|
||||||
/// 避免 collectible ALC 里的类型被长生命周期引用拖住而无法卸载。
|
|
||||||
/// </summary>
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
_scene = null;
|
|
||||||
GC.SuppressFinalize(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,110 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Numerics;
|
|
||||||
|
|
||||||
namespace NeoRF.EarthModels;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 地理模型的球面几何工具:经纬度 ↔ 单位球坐标、正交投影到屏幕、
|
|
||||||
/// 以及把一条经纬度折线投影成「可见弧段」(背面自动裁掉)。
|
|
||||||
/// 纯 CPU、无依赖,供 GeographyView 画线稿用。
|
|
||||||
/// </summary>
|
|
||||||
public static class Geometry
|
|
||||||
{
|
|
||||||
public const float DegToRad = (float)(Math.PI / 180.0);
|
|
||||||
public const float RadToDeg = (float)(180.0 / Math.PI);
|
|
||||||
|
|
||||||
/// <summary>经纬度 → 单位球坐标(y 轴为地轴,lon 向东为正)。</summary>
|
|
||||||
public static Vector3 LatLonToUnit(double latDeg, double lonDeg)
|
|
||||||
{
|
|
||||||
var lat = (float)(latDeg * Math.PI / 180.0);
|
|
||||||
var lon = (float)(lonDeg * Math.PI / 180.0);
|
|
||||||
var cosLat = (float)Math.Cos(lat);
|
|
||||||
return new Vector3(cosLat * (float)Math.Sin(lon), (float)Math.Sin(lat), cosLat * (float)Math.Cos(lon));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>把世界坐标旋转到相机空间(先用 planet 旋转地球,再用 cam 转到屏幕)。</summary>
|
|
||||||
public static Vector3 ToCamera(Vector3 world, Matrix4x4 planet, Matrix4x4 cam)
|
|
||||||
=> Vector3.Transform(Vector3.Transform(world, planet), cam);
|
|
||||||
|
|
||||||
/// <summary>相机空间的正交投影:球心在原点,半径 radius。</summary>
|
|
||||||
public static Vector2 Project(Vector3 camPos, float radius, float centerX, float centerY)
|
|
||||||
=> new(centerX + camPos.X * radius, centerY - camPos.Y * radius);
|
|
||||||
|
|
||||||
/// <summary>相机空间里该点是否朝向观察者(z>0 为正面)。</summary>
|
|
||||||
public static bool IsVisible(Vector3 camPos, float threshold = 0f) => camPos.Z > threshold;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 把一条经纬度折线拆成若干段「可见」的屏幕折线。
|
|
||||||
/// 跨越地平线的相邻两点用线性插值求出交点作为端点,保证线不会穿过球体背面。
|
|
||||||
/// </summary>
|
|
||||||
public static List<List<Vector2>> ProjectPolyline(
|
|
||||||
IReadOnlyList<double[]> latLonPoints,
|
|
||||||
Matrix4x4 planet, Matrix4x4 cam,
|
|
||||||
float radius, float centerX, float centerY,
|
|
||||||
bool closed = false)
|
|
||||||
{
|
|
||||||
var result = new List<List<Vector2>>();
|
|
||||||
if (latLonPoints.Count < 2) return result;
|
|
||||||
|
|
||||||
var count = latLonPoints.Count;
|
|
||||||
var total = closed ? count + 1 : count;
|
|
||||||
List<Vector2>? current = null;
|
|
||||||
|
|
||||||
Vector3 prevCam = default;
|
|
||||||
var havePrev = false;
|
|
||||||
|
|
||||||
for (var i = 0; i < total; i++)
|
|
||||||
{
|
|
||||||
var p = latLonPoints[i % count];
|
|
||||||
if (p.Length < 2) { havePrev = false; continue; }
|
|
||||||
|
|
||||||
var camPos = ToCamera(LatLonToUnit(p[1], p[0]), planet, cam);
|
|
||||||
var visible = camPos.Z > 0f;
|
|
||||||
|
|
||||||
if (!havePrev)
|
|
||||||
{
|
|
||||||
if (visible)
|
|
||||||
{
|
|
||||||
current = new List<Vector2>();
|
|
||||||
current.Add(Project(camPos, radius, centerX, centerY));
|
|
||||||
}
|
|
||||||
prevCam = camPos;
|
|
||||||
havePrev = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
var prevVisible = prevCam.Z > 0f;
|
|
||||||
if (visible && prevVisible)
|
|
||||||
{
|
|
||||||
current ??= new List<Vector2>();
|
|
||||||
current.Add(Project(camPos, radius, centerX, centerY));
|
|
||||||
}
|
|
||||||
else if (visible != prevVisible)
|
|
||||||
{
|
|
||||||
// 求出与地平线(z=0)的交点
|
|
||||||
var t = prevCam.Z / (prevCam.Z - camPos.Z);
|
|
||||||
var hit = Vector3.Lerp(prevCam, camPos, t);
|
|
||||||
hit.Z = 0f;
|
|
||||||
var hitScreen = Project(hit, radius, centerX, centerY);
|
|
||||||
|
|
||||||
if (visible)
|
|
||||||
{
|
|
||||||
current = new List<Vector2> { hitScreen };
|
|
||||||
current.Add(Project(camPos, radius, centerX, centerY));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
current?.Add(hitScreen);
|
|
||||||
if (current is { Count: > 1 }) result.Add(current);
|
|
||||||
current = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
prevCam = camPos;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (current is { Count: > 1 }) result.Add(current);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,159 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Text.Json;
|
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
|
|
||||||
namespace NeoRF.EarthModels;
|
|
||||||
|
|
||||||
/// <summary><id>.model/land.json —— 简化的大陆轮廓(经纬度多边形)。</summary>
|
|
||||||
public sealed class LandData
|
|
||||||
{
|
|
||||||
[JsonPropertyName("polygons")] public List<LandPolygon> Polygons { get; set; } = new();
|
|
||||||
|
|
||||||
public static LandData? Load(string path)
|
|
||||||
{
|
|
||||||
if (!File.Exists(path)) return null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return JsonSerializer.Deserialize<LandData>(File.ReadAllText(path), ModelJson.Options);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.Error.WriteLine($"解析地表数据失败 {path}: {ex.Message}");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class LandPolygon
|
|
||||||
{
|
|
||||||
[JsonPropertyName("name")] public string? Name { get; set; }
|
|
||||||
/// <summary>[[lon, lat], ...]</summary>
|
|
||||||
[JsonPropertyName("points")] public List<double[]> Points { get; set; } = new();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 等经纬度栅格地表掩膜(0=海洋 255=陆地),双线性采样。
|
|
||||||
/// 每个模型只生成一次,受内存预算约束。
|
|
||||||
/// </summary>
|
|
||||||
public sealed class LandMask
|
|
||||||
{
|
|
||||||
public int Width { get; init; }
|
|
||||||
public int Height { get; init; }
|
|
||||||
public byte[] Bits { get; init; } = Array.Empty<byte>();
|
|
||||||
|
|
||||||
public long ByteSize => Bits.LongLength;
|
|
||||||
|
|
||||||
public static LandMask Build(LandData data, int width = 1440, int height = 720)
|
|
||||||
{
|
|
||||||
var bits = new byte[width * height];
|
|
||||||
foreach (var poly in data.Polygons)
|
|
||||||
{
|
|
||||||
if (poly.Points.Count < 3) continue;
|
|
||||||
var pts = Unwrap(poly.Points);
|
|
||||||
if (pts.Count < 3) continue;
|
|
||||||
for (var shift = -1; shift <= 1; shift++)
|
|
||||||
Rasterize(bits, width, height, pts, shift * 360.0);
|
|
||||||
}
|
|
||||||
return new LandMask { Width = width, Height = height, Bits = bits };
|
|
||||||
}
|
|
||||||
|
|
||||||
private static List<(double Lon, double Lat)> Unwrap(List<double[]> points)
|
|
||||||
{
|
|
||||||
var result = new List<(double, double)>(points.Count);
|
|
||||||
if (points.Count == 0 || points[0].Length < 2) return result;
|
|
||||||
var prev = points[0][0];
|
|
||||||
result.Add((prev, points[0][1]));
|
|
||||||
for (var i = 1; i < points.Count; i++)
|
|
||||||
{
|
|
||||||
if (points[i].Length < 2) continue;
|
|
||||||
var lon = points[i][0];
|
|
||||||
while (lon - prev > 180) lon -= 360;
|
|
||||||
while (prev - lon > 180) lon += 360;
|
|
||||||
result.Add((lon, points[i][1]));
|
|
||||||
prev = lon;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Rasterize(byte[] bits, int w, int h, List<(double Lon, double Lat)> pts, double lonShift)
|
|
||||||
{
|
|
||||||
var n = pts.Count;
|
|
||||||
var xs = new double[n];
|
|
||||||
var ys = new double[n];
|
|
||||||
double minY = double.MaxValue, maxY = double.MinValue;
|
|
||||||
for (var i = 0; i < n; i++)
|
|
||||||
{
|
|
||||||
xs[i] = (pts[i].Lon + lonShift + 180.0) / 360.0 * w;
|
|
||||||
ys[i] = (90.0 - pts[i].Lat) / 180.0 * h;
|
|
||||||
if (ys[i] < minY) minY = ys[i];
|
|
||||||
if (ys[i] > maxY) maxY = ys[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
var y0 = Math.Max(0, (int)Math.Floor(minY));
|
|
||||||
var y1 = Math.Min(h - 1, (int)Math.Ceiling(maxY));
|
|
||||||
var crossings = new List<double>(16);
|
|
||||||
|
|
||||||
for (var y = y0; y <= y1; y++)
|
|
||||||
{
|
|
||||||
var sy = y + 0.5;
|
|
||||||
crossings.Clear();
|
|
||||||
for (var i = 0; i < n; i++)
|
|
||||||
{
|
|
||||||
var j = (i + 1) % n;
|
|
||||||
double ya = ys[i], yb = ys[j];
|
|
||||||
if (!((ya <= sy && yb > sy) || (yb <= sy && ya > sy))) continue;
|
|
||||||
var t = (sy - ya) / (yb - ya);
|
|
||||||
crossings.Add(xs[i] + t * (xs[j] - xs[i]));
|
|
||||||
}
|
|
||||||
if (crossings.Count < 2) continue;
|
|
||||||
crossings.Sort();
|
|
||||||
for (var k = 0; k + 1 < crossings.Count; k += 2)
|
|
||||||
{
|
|
||||||
var xa = (int)Math.Ceiling(crossings[k] - 0.5);
|
|
||||||
var xb = (int)Math.Floor(crossings[k + 1] - 0.5);
|
|
||||||
if (xb < xa) continue;
|
|
||||||
if (xb - xa >= w - 1)
|
|
||||||
{
|
|
||||||
for (var x = 0; x < w; x++) bits[y * w + x] = 255;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
for (var x = xa; x <= xb; x++)
|
|
||||||
{
|
|
||||||
var mx = x % w;
|
|
||||||
if (mx < 0) mx += w;
|
|
||||||
bits[y * w + mx] = 255;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>返回 0..1 的陆地覆盖度。</summary>
|
|
||||||
public double Sample(double lonDeg, double latDeg)
|
|
||||||
{
|
|
||||||
var u = (lonDeg + 180.0) / 360.0 * Width - 0.5;
|
|
||||||
var v = (90.0 - latDeg) / 180.0 * Height - 0.5;
|
|
||||||
var x0 = (int)Math.Floor(u);
|
|
||||||
var y0 = (int)Math.Floor(v);
|
|
||||||
var fx = u - x0;
|
|
||||||
var fy = v - y0;
|
|
||||||
double sum = 0;
|
|
||||||
for (var dy = 0; dy < 2; dy++)
|
|
||||||
{
|
|
||||||
var y = y0 + dy;
|
|
||||||
if (y < 0) y = 0;
|
|
||||||
if (y >= Height) y = Height - 1;
|
|
||||||
var wy = dy == 0 ? 1 - fy : fy;
|
|
||||||
for (var dx = 0; dx < 2; dx++)
|
|
||||||
{
|
|
||||||
var x = x0 + dx;
|
|
||||||
var mx = x % Width;
|
|
||||||
if (mx < 0) mx += Width;
|
|
||||||
var wx = dx == 0 ? 1 - fx : fx;
|
|
||||||
sum += Bits[y * Width + mx] * wx * wy;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return sum / 255.0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
using System.IO;
|
|
||||||
using System.Text.Encodings.Web;
|
|
||||||
using System.Text.Json;
|
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
|
|
||||||
namespace NeoRF.EarthModels;
|
|
||||||
|
|
||||||
/// <summary>模型自己的 JSON 读写(不依赖启动器)。</summary>
|
|
||||||
public static class ModelJson
|
|
||||||
{
|
|
||||||
public static readonly JsonSerializerOptions Options = new()
|
|
||||||
{
|
|
||||||
PropertyNameCaseInsensitive = true,
|
|
||||||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
|
|
||||||
WriteIndented = true,
|
|
||||||
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
|
|
||||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
|
||||||
AllowTrailingCommas = true,
|
|
||||||
ReadCommentHandling = JsonCommentHandling.Skip
|
|
||||||
};
|
|
||||||
|
|
||||||
public static T? Read<T>(string path)
|
|
||||||
{
|
|
||||||
if (!File.Exists(path)) return default;
|
|
||||||
return JsonSerializer.Deserialize<T>(File.ReadAllText(path), Options);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,186 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
|
||||||
using System.IO;
|
|
||||||
using System.Text.Json;
|
|
||||||
|
|
||||||
namespace NeoRF.EarthModels;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 模型自己的一份文案。优先读模型数据目录里的 <c>i18n/<language>.json</c>,
|
|
||||||
/// 缺失时回退到代码内的默认文案,保证模型在没有语言包时也能完整显示。
|
|
||||||
/// 启动器不再持有任何模型相关文案。
|
|
||||||
/// </summary>
|
|
||||||
public sealed class ModelStrings
|
|
||||||
{
|
|
||||||
private readonly Dictionary<string, string> _texts;
|
|
||||||
|
|
||||||
public string Language { get; }
|
|
||||||
|
|
||||||
private ModelStrings(string language, Dictionary<string, string> texts)
|
|
||||||
{
|
|
||||||
Language = language;
|
|
||||||
_texts = texts;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ModelStrings Default { get; } = new("zh-CN", DefaultTexts.Zh);
|
|
||||||
|
|
||||||
public string this[string key]
|
|
||||||
=> _texts.TryGetValue(key, out var value) ? value
|
|
||||||
: DefaultTexts.Zh.TryGetValue(key, out var fallback) ? fallback
|
|
||||||
: key;
|
|
||||||
|
|
||||||
public string F(string key, params object[] args)
|
|
||||||
=> string.Format(CultureInfo.InvariantCulture, this[key], args);
|
|
||||||
|
|
||||||
public string Pick(Dictionary<string, string>? i18n, string fallback)
|
|
||||||
{
|
|
||||||
if (i18n == null) return fallback;
|
|
||||||
if (i18n.TryGetValue(Language, out var exact) && !string.IsNullOrWhiteSpace(exact)) return exact;
|
|
||||||
foreach (var pair in i18n)
|
|
||||||
{
|
|
||||||
if (Language.StartsWith(pair.Key, StringComparison.OrdinalIgnoreCase) && !string.IsNullOrWhiteSpace(pair.Value))
|
|
||||||
return pair.Value;
|
|
||||||
}
|
|
||||||
if (i18n.TryGetValue("zh-CN", out var zh) && !string.IsNullOrWhiteSpace(zh)) return zh;
|
|
||||||
return fallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ModelStrings Load(string dataDirectory, string language)
|
|
||||||
{
|
|
||||||
var zh = new Dictionary<string, string>(DefaultTexts.Zh);
|
|
||||||
var isEnglish = language.StartsWith("en", StringComparison.OrdinalIgnoreCase);
|
|
||||||
var chosen = isEnglish ? new Dictionary<string, string>(DefaultTexts.En) : new Dictionary<string, string>(zh);
|
|
||||||
|
|
||||||
// 语言包可以覆盖任意键:i18n/<language>.json
|
|
||||||
var dir = Path.Combine(dataDirectory, "i18n");
|
|
||||||
Overlay(Path.Combine(dir, language + ".json"), chosen);
|
|
||||||
if (!isEnglish) Overlay(Path.Combine(dir, "zh-CN.json"), chosen);
|
|
||||||
|
|
||||||
return new ModelStrings(isEnglish ? "en" : "zh-CN", chosen);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Overlay(string path, Dictionary<string, string> target)
|
|
||||||
{
|
|
||||||
if (!File.Exists(path)) return;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var map = JsonSerializer.Deserialize<Dictionary<string, string>>(File.ReadAllText(path), ModelJson.Options);
|
|
||||||
if (map == null) return;
|
|
||||||
foreach (var pair in map) target[pair.Key] = pair.Value;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.Error.WriteLine($"读取模型语言包失败 {path}: {ex.Message}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static class DefaultTexts
|
|
||||||
{
|
|
||||||
public static readonly Dictionary<string, string> Zh = new()
|
|
||||||
{
|
|
||||||
["title"] = "地球模型",
|
|
||||||
["view.rotation"] = "自转",
|
|
||||||
["view.revolution"] = "公转",
|
|
||||||
["play"] = "播放",
|
|
||||||
["pause"] = "暂停",
|
|
||||||
["speed"] = "速度",
|
|
||||||
["reset"] = "重置",
|
|
||||||
["labels"] = "标注",
|
|
||||||
["orbit"] = "轨道",
|
|
||||||
["grid"] = "经纬网",
|
|
||||||
["tilt"] = "夸张倾角",
|
|
||||||
["lessons"] = "教学要点",
|
|
||||||
["seasons"] = "节气定位",
|
|
||||||
["close"] = "关闭窗口",
|
|
||||||
["hint"] = "双指捏合或滚轮缩放 · 拖动可转动地球",
|
|
||||||
["shortcutHint"] = "空格 播放/暂停 · ←→ 步进 · 1–4 二分二至 · F 全屏",
|
|
||||||
["classroom"] = "课堂演示",
|
|
||||||
["directPoint"] = "太阳直射",
|
|
||||||
["frozen"] = "已定格",
|
|
||||||
["running"] = "播放中",
|
|
||||||
["step"] = "步进",
|
|
||||||
["closeup"] = "地球特写",
|
|
||||||
["overhead"] = "俯视",
|
|
||||||
["sideview"] = "侧视",
|
|
||||||
["zoom"] = "缩放",
|
|
||||||
["orbitTeach"] = "太阳直射点在南北回归线之间往返,形成四季更替。",
|
|
||||||
["rotationTeach"] = "晨昏线把地球分成昼半球与夜半球;自转产生昼夜交替与地方时差。",
|
|
||||||
["dayNight"] = "昼夜交替周期 24 小时",
|
|
||||||
["lat.equator"] = "赤道",
|
|
||||||
["lat.tropicN"] = "北回归线 23.5°N",
|
|
||||||
["lat.tropicS"] = "南回归线 23.5°S",
|
|
||||||
["lat.polarN"] = "北极圈 66.5°N",
|
|
||||||
["lat.polarS"] = "南极圈 66.5°S",
|
|
||||||
["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"] = "冬至"
|
|
||||||
};
|
|
||||||
|
|
||||||
public static readonly Dictionary<string, string> En = new()
|
|
||||||
{
|
|
||||||
["title"] = "Earth model",
|
|
||||||
["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",
|
|
||||||
["hint"] = "Pinch or scroll to zoom · drag to turn the Earth",
|
|
||||||
["shortcutHint"] = "Space play/pause · ←→ step · 1–4 solstices & equinoxes · F fullscreen",
|
|
||||||
["classroom"] = "Classroom",
|
|
||||||
["directPoint"] = "Subsolar",
|
|
||||||
["frozen"] = "Frozen",
|
|
||||||
["running"] = "Playing",
|
|
||||||
["step"] = "Step",
|
|
||||||
["closeup"] = "Earth close-up",
|
|
||||||
["overhead"] = "Top view",
|
|
||||||
["sideview"] = "Side view",
|
|
||||||
["zoom"] = "Zoom",
|
|
||||||
["orbitTeach"] = "The subsolar point travels between the tropics, producing the seasons.",
|
|
||||||
["rotationTeach"] = "The terminator splits day and night; rotation drives the day–night cycle and local time.",
|
|
||||||
["dayNight"] = "Day–night cycle: 24 h",
|
|
||||||
["lat.equator"] = "Equator",
|
|
||||||
["lat.tropicN"] = "Tropic of Cancer 23.5°N",
|
|
||||||
["lat.tropicS"] = "Tropic of Capricorn 23.5°S",
|
|
||||||
["lat.polarN"] = "Arctic Circle 66.5°N",
|
|
||||||
["lat.polarS"] = "Antarctic Circle 66.5°S",
|
|
||||||
["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"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace NeoRF.EarthModels;
|
|
||||||
|
|
||||||
/// <summary><id>.model/scene.json —— 模型数据(可视化场景描述)。</summary>
|
|
||||||
public sealed class SceneDefinition
|
|
||||||
{
|
|
||||||
public int SchemaVersion { get; set; } = 1;
|
|
||||||
public string Type { get; set; } = "planet";
|
|
||||||
/// <summary>rotation | revolution</summary>
|
|
||||||
public string DefaultView { get; set; } = "rotation";
|
|
||||||
/// <summary>模型支持的视图;为空表示只有 defaultView。</summary>
|
|
||||||
public List<string> Views { get; set; } = new();
|
|
||||||
public Dictionary<string, string>? NameI18n { get; set; }
|
|
||||||
public Dictionary<string, string>? DescriptionI18n { get; set; }
|
|
||||||
public StarDefinition Star { get; set; } = new();
|
|
||||||
public PlanetDefinition Planet { get; set; } = new();
|
|
||||||
public OrbitDefinition Orbit { get; set; } = new();
|
|
||||||
public List<Lesson> Lessons { get; set; } = new();
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class StarDefinition
|
|
||||||
{
|
|
||||||
public string Name { get; set; } = "Sun";
|
|
||||||
public Dictionary<string, string>? NameI18n { get; set; }
|
|
||||||
public string Color { get; set; } = "#FFC24B";
|
|
||||||
/// <summary>相对行星半径的视觉倍率</summary>
|
|
||||||
public double RadiusScale { get; set; } = 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class PlanetDefinition
|
|
||||||
{
|
|
||||||
public string Name { get; set; } = "Earth";
|
|
||||||
public Dictionary<string, string>? NameI18n { get; set; }
|
|
||||||
/// <summary>黄赤交角:教材值 23.5°(23°26′),决定南北回归线纬度。</summary>
|
|
||||||
public double AxialTiltDeg { get; set; } = 23.5;
|
|
||||||
/// <summary>回归线纬度,默认与黄赤交角一致;极圈 = 90 − 回归线。</summary>
|
|
||||||
public double TropicDeg { get; set; } = 23.5;
|
|
||||||
public double RotationHours { get; set; } = 23.93;
|
|
||||||
public double OrbitDays { get; set; } = 365.26;
|
|
||||||
public string OceanColor { get; set; } = "#1B5FA8";
|
|
||||||
public string LandColor { get; set; } = "#4F8C4C";
|
|
||||||
public string? IceColor { get; set; } = "#E8EEF4";
|
|
||||||
public string? LandFile { get; set; } = "land.json";
|
|
||||||
public bool ShowGraticule { get; set; } = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class OrbitDefinition
|
|
||||||
{
|
|
||||||
public double SemiMajorAxis { get; set; } = 4.0;
|
|
||||||
public double Eccentricity { get; set; } = 0.0167;
|
|
||||||
public bool Show { get; set; } = true;
|
|
||||||
/// <summary>节气方位声明:springTopSummerLeft = 上春分 / 左夏至(引擎按此布局绘制轨道)。</summary>
|
|
||||||
public string SeasonLayout { get; set; } = "springTopSummerLeft";
|
|
||||||
public List<SeasonPoint> Seasons { get; set; } = new();
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class SeasonPoint
|
|
||||||
{
|
|
||||||
/// <summary>0=春分 90=夏至 180=秋分 270=冬至</summary>
|
|
||||||
public double AngleDeg { get; set; }
|
|
||||||
public string Key { get; set; } = "";
|
|
||||||
public string? Date { get; set; }
|
|
||||||
/// <summary>该节气的太阳直射纬度:春分/秋分 0,夏至 +23.5,冬至 −23.5。</summary>
|
|
||||||
public double? DeclinationDeg { get; set; }
|
|
||||||
/// <summary>课堂现象说明(写在模型数据里,启动器不参与)。</summary>
|
|
||||||
public Dictionary<string, string>? TeachingI18n { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class Lesson
|
|
||||||
{
|
|
||||||
public Dictionary<string, string>? TitleI18n { get; set; }
|
|
||||||
public Dictionary<string, string>? BodyI18n { get; set; }
|
|
||||||
public string? View { get; set; }
|
|
||||||
public double? AngleDeg { get; set; }
|
|
||||||
}
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using Avalonia.Media;
|
|
||||||
|
|
||||||
namespace NeoRF.EarthModels;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 模型自己的场景运行时:场景描述 + 预烘焙地表纹理 + 调色板。
|
|
||||||
/// 数据来自模型数据目录,不依赖启动器。
|
|
||||||
/// </summary>
|
|
||||||
public sealed class SceneRuntime
|
|
||||||
{
|
|
||||||
public SceneDefinition Scene { get; init; } = new();
|
|
||||||
public PlanetTexture? Texture { get; init; }
|
|
||||||
public Color Ocean { get; init; } = Color.Parse("#1B5FA8");
|
|
||||||
public Color Land { get; init; } = Color.Parse("#4F8C4C");
|
|
||||||
public Color Ice { get; init; } = Color.Parse("#E6EDF4");
|
|
||||||
public Color Star { get; init; } = Color.Parse("#FFC24B");
|
|
||||||
|
|
||||||
public long MemoryBytes => Texture?.ByteSize ?? 0;
|
|
||||||
|
|
||||||
public static SceneRuntime Load(string dataDirectory, int memoryBudgetMb,
|
|
||||||
Action<double, string?>? progress = null)
|
|
||||||
{
|
|
||||||
progress?.Invoke(0.06, "读取场景数据");
|
|
||||||
var scenePath = Path.Combine(dataDirectory, "scene.json");
|
|
||||||
var scene = ModelJson.Read<SceneDefinition>(scenePath) ?? new SceneDefinition();
|
|
||||||
|
|
||||||
var ocean = Parse(scene.Planet.OceanColor, "#1B5FA8");
|
|
||||||
var land = Parse(scene.Planet.LandColor, "#4F8C4C");
|
|
||||||
var ice = Parse(scene.Planet.IceColor, "#E6EDF4");
|
|
||||||
|
|
||||||
LandData? landData = null;
|
|
||||||
var landFile = scene.Planet.LandFile;
|
|
||||||
if (!string.IsNullOrWhiteSpace(landFile))
|
|
||||||
{
|
|
||||||
var path = Path.IsPathRooted(landFile!) ? landFile! : Path.Combine(dataDirectory, landFile!);
|
|
||||||
progress?.Invoke(0.12, "读取地表轮廓");
|
|
||||||
landData = LandData.Load(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 内存预算决定纹理分辨率(1024 宽约 3 MB)
|
|
||||||
var width = memoryBudgetMb >= 1024 ? PlanetTexture.DefaultWidth
|
|
||||||
: memoryBudgetMb >= 512 ? 768
|
|
||||||
: 512;
|
|
||||||
|
|
||||||
progress?.Invoke(0.16, "生成地表纹理");
|
|
||||||
var texture = PlanetTexture.Build(landData, width, ocean, land, ice,
|
|
||||||
t => progress?.Invoke(0.16 + t * 0.48, "生成地表纹理"));
|
|
||||||
|
|
||||||
progress?.Invoke(0.68, "场景就绪");
|
|
||||||
return new SceneRuntime
|
|
||||||
{
|
|
||||||
Scene = scene,
|
|
||||||
Texture = texture,
|
|
||||||
Ocean = ocean,
|
|
||||||
Land = land,
|
|
||||||
Ice = ice,
|
|
||||||
Star = Parse(scene.Star.Color, "#FFC24B")
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Color Parse(string? value, string fallback)
|
|
||||||
=> Color.TryParse(string.IsNullOrWhiteSpace(value) ? fallback : value, out var c) ? c : Color.Parse(fallback);
|
|
||||||
}
|
|
||||||
@@ -1,476 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Avalonia.Media;
|
|
||||||
|
|
||||||
namespace NeoRF.EarthModels;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 预烘焙的等经纬度地表贴图:反照率 + 高度 + 冰盖 + 云层 + 夜间灯光。
|
|
||||||
/// 只在模型加载时算一次,之后每帧只做采样 —— 比逐像素跑噪声快一个数量级,
|
|
||||||
/// 而且能画出「真实一点」的地表:海洋深度、沙漠/雨林/针叶林带、山脉阴影、极地冰盖。
|
|
||||||
/// </summary>
|
|
||||||
public sealed class PlanetTexture
|
|
||||||
{
|
|
||||||
public const int DefaultWidth = 1024;
|
|
||||||
|
|
||||||
public int Width { get; }
|
|
||||||
public int Height { get; }
|
|
||||||
|
|
||||||
/// <summary>打包的反照率(0xRRGGBB),每像素一次双线性即可拿三通道。</summary>
|
|
||||||
public uint[] Albedo { get; }
|
|
||||||
/// <summary>地形高度(0=海平面,255=高山)</summary>
|
|
||||||
public byte[] Elevation { get; }
|
|
||||||
/// <summary>云量</summary>
|
|
||||||
public byte[] Cloud { get; }
|
|
||||||
/// <summary>夜间灯光</summary>
|
|
||||||
public byte[] Lights { get; }
|
|
||||||
/// <summary>预烘焙的地形坡度:东向 / 北向高度梯度(加载时算一次,每帧直接采样)。</summary>
|
|
||||||
public float[] SlopeEast { get; }
|
|
||||||
public float[] SlopeNorth { get; }
|
|
||||||
|
|
||||||
public long ByteSize => (long)(Albedo.Length * 4 + Elevation.Length + Cloud.Length + Lights.Length
|
|
||||||
+ SlopeEast.Length * 4 + SlopeNorth.Length * 4);
|
|
||||||
|
|
||||||
private PlanetTexture(int width, int height)
|
|
||||||
{
|
|
||||||
Width = width;
|
|
||||||
Height = height;
|
|
||||||
var count = width * height;
|
|
||||||
Albedo = new uint[count];
|
|
||||||
Elevation = new byte[count];
|
|
||||||
Cloud = new byte[count];
|
|
||||||
Lights = new byte[count];
|
|
||||||
SlopeEast = new float[count];
|
|
||||||
SlopeNorth = new float[count];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static PlanetTexture Build(LandData? landData, int width, Color ocean, Color land, Color ice,
|
|
||||||
Action<double>? progress = null)
|
|
||||||
{
|
|
||||||
width = Math.Clamp(width, 256, 2048);
|
|
||||||
var height = width / 2;
|
|
||||||
var texture = new PlanetTexture(width, height);
|
|
||||||
|
|
||||||
progress?.Invoke(0.08);
|
|
||||||
var mask = landData == null ? null : LandMask.Build(landData, width, height);
|
|
||||||
progress?.Invoke(0.28);
|
|
||||||
|
|
||||||
// 到海岸的距离:海里用来做深度,陆地上用来做大陆性(内陆更干)
|
|
||||||
var landDistance = new float[width * height];
|
|
||||||
var oceanDistance = new float[width * height];
|
|
||||||
ComputeDistances(mask, width, height, landDistance, oceanDistance);
|
|
||||||
progress?.Invoke(0.42);
|
|
||||||
|
|
||||||
Parallel.For(0, height, y =>
|
|
||||||
{
|
|
||||||
var lat = 90.0 - (y + 0.5) * 180.0 / height;
|
|
||||||
var latAbs = MathF.Abs((float)lat);
|
|
||||||
var rowBase = y * width;
|
|
||||||
for (var x = 0; x < width; x++)
|
|
||||||
{
|
|
||||||
var lon = (x + 0.5) * 360.0 / width - 180.0;
|
|
||||||
var index = rowBase + x;
|
|
||||||
var isLand = mask == null || mask.Bits[index] > 127;
|
|
||||||
|
|
||||||
var elevation = Fbm(lon * 2.1, lat * 2.1, 4, 0x51A3);
|
|
||||||
var moisture = Fbm(lon * 1.35 + 40, lat * 1.35 - 20, 3, 0x9E2B);
|
|
||||||
var detail = Fbm(lon * 0.85, lat * 0.85, 3, 0x2C77);
|
|
||||||
|
|
||||||
if (isLand)
|
|
||||||
{
|
|
||||||
// 内陆更干,靠海更湿
|
|
||||||
var inland = Math.Clamp(landDistance[index] / (width * 0.06f), 0f, 1f);
|
|
||||||
var wet = Math.Clamp(moisture * 0.78f + (1f - inland) * 0.16f
|
|
||||||
- MathF.Max(0f, latAbs - 45f) / 90f, 0f, 1f);
|
|
||||||
|
|
||||||
var (r, g, b) = LandPalette(latAbs, wet, inland, elevation, detail, land, ice);
|
|
||||||
texture.Albedo[index] = Pack(r, g, b);
|
|
||||||
texture.Elevation[index] = (byte)Math.Clamp(elevation * 235f + detail * 20f, 0, 255);
|
|
||||||
|
|
||||||
// 夜间灯光:沿海平原、中低纬,稀疏分布
|
|
||||||
// 夜间灯光:低频的城市群辉光(高频点会在小尺寸球面上变成噪点)
|
|
||||||
var cityGlow = Smooth(0.55f, 0.92f, Fbm(lon * 1.7, lat * 1.7, 3, 0x7A31));
|
|
||||||
if (latAbs < 60 && inland < 0.55f && elevation < 0.75f)
|
|
||||||
texture.Lights[index] = ToByte(cityGlow * 0.55f);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// 海洋:按离岸距离做深浅
|
|
||||||
var depth = Math.Clamp(oceanDistance[index] / (width * 0.09f), 0f, 1f);
|
|
||||||
depth = (float)Math.Pow(depth, 0.65);
|
|
||||||
var shallowR = Math.Min(1f, ocean.R / 255f + 0.16f);
|
|
||||||
var shallowG = Math.Min(1f, ocean.G / 255f + 0.22f);
|
|
||||||
var shallowB = Math.Min(1f, ocean.B / 255f + 0.16f);
|
|
||||||
var deepR = ocean.R / 255f * 0.32f;
|
|
||||||
var deepG = ocean.G / 255f * 0.40f;
|
|
||||||
var deepB = ocean.B / 255f * 0.52f;
|
|
||||||
var wave = (detail - 0.5f) * 0.035f;
|
|
||||||
|
|
||||||
texture.Albedo[index] = Pack(
|
|
||||||
ToByte(shallowR + (deepR - shallowR) * depth + wave),
|
|
||||||
ToByte(shallowG + (deepG - shallowG) * depth + wave),
|
|
||||||
ToByte(shallowB + (deepB - shallowB) * depth + wave));
|
|
||||||
texture.Elevation[index] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 极地冰盖:纬度 + 噪声边界,海洋也能结冰
|
|
||||||
var iceEdge = 62f + (detail - 0.5f) * 9f;
|
|
||||||
var iceAmt = Smooth(iceEdge - 7f, iceEdge + 6f, latAbs);
|
|
||||||
if (iceAmt > 0.001f)
|
|
||||||
{
|
|
||||||
var iceR = ice.R / 255f;
|
|
||||||
var iceG = ice.G / 255f;
|
|
||||||
var iceB = ice.B / 255f;
|
|
||||||
var packed = texture.Albedo[index];
|
|
||||||
texture.Albedo[index] = Pack(
|
|
||||||
ToByte(Lerp(((packed >> 16) & 0xFF) / 255f, iceR, iceAmt)),
|
|
||||||
ToByte(Lerp(((packed >> 8) & 0xFF) / 255f, iceG, iceAmt)),
|
|
||||||
ToByte(Lerp((packed & 0xFF) / 255f, iceB, iceAmt)));
|
|
||||||
}
|
|
||||||
|
|
||||||
// 云:多个尺度的 fbm,赤道与中纬多云
|
|
||||||
var cloudBase = Fbm(lon * 0.55, lat * 0.7, 3, 0x1144);
|
|
||||||
var band = 0.5f + 0.5f * MathF.Cos(latAbs / 90f * MathF.PI * 3.1f);
|
|
||||||
var cloud = Smooth(0.48f, 0.84f, cloudBase * 0.86f + band * 0.14f);
|
|
||||||
texture.Cloud[index] = ToByte(cloud * 0.72f);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 云层做一次模糊,避免小尺寸球面上采样出噪点
|
|
||||||
Blur(texture.Cloud, width, height, 2);
|
|
||||||
|
|
||||||
// 预烘焙地形坡度:渲染时不必每像素再取 4 次高度
|
|
||||||
BakeSlopes(texture, width, height);
|
|
||||||
progress?.Invoke(0.62);
|
|
||||||
return texture;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static (byte R, byte G, byte B) LandPalette(float latAbs, float wet, float inland, float elevation,
|
|
||||||
float detail, Color landBase, Color ice)
|
|
||||||
{
|
|
||||||
// 基色随纬度:赤道雨林 -> 温带 -> 针叶林 -> 苔原
|
|
||||||
float r, g, b;
|
|
||||||
var tropical = (1f - Smooth(8f, 24f, latAbs));
|
|
||||||
var temperate = Smooth(20f, 34f, latAbs) * (1f - Smooth(46f, 60f, latAbs));
|
|
||||||
var boreal = Smooth(46f, 60f, latAbs) * (1f - Smooth(62f, 70f, latAbs));
|
|
||||||
var tundra = Smooth(60f, 72f, latAbs);
|
|
||||||
|
|
||||||
r = 0.13f; g = 0.36f; b = 0.17f; // 温带草原绿
|
|
||||||
r = Lerp(r, 0.10f, tropical); g = Lerp(g, 0.42f, tropical); b = Lerp(b, 0.19f, tropical);
|
|
||||||
r = Lerp(r, 0.17f, boreal); g = Lerp(g, 0.28f, boreal); b = Lerp(b, 0.17f, boreal);
|
|
||||||
r = Lerp(r, 0.34f, tundra); g = Lerp(g, 0.36f, tundra); b = Lerp(b, 0.31f, tundra);
|
|
||||||
|
|
||||||
// 湿润度:干 -> 沙漠/草原
|
|
||||||
var dry = Math.Clamp(1f - wet * 0.95f, 0f, 1f);
|
|
||||||
var desertBand = Math.Clamp(1f - MathF.Abs(latAbs - 24f) / 13f, 0f, 1f);
|
|
||||||
var desert = Math.Clamp(dry * 0.72f + desertBand * 0.62f, 0f, 1f);
|
|
||||||
r = Lerp(r, 0.72f, desert * 0.85f);
|
|
||||||
g = Lerp(g, 0.60f, desert * 0.85f);
|
|
||||||
b = Lerp(b, 0.38f, desert * 0.85f);
|
|
||||||
|
|
||||||
// 高原/山地:岩石和雪
|
|
||||||
var rock = Smooth(0.62f, 0.86f, elevation);
|
|
||||||
r = Lerp(r, 0.44f, rock * 0.7f);
|
|
||||||
g = Lerp(g, 0.40f, rock * 0.7f);
|
|
||||||
b = Lerp(b, 0.34f, rock * 0.7f);
|
|
||||||
|
|
||||||
var snow = Smooth(0.86f, 0.97f, elevation + (latAbs - 40f) / 220f);
|
|
||||||
r = Lerp(r, ice.R / 255f, snow);
|
|
||||||
g = Lerp(g, ice.G / 255f, snow);
|
|
||||||
b = Lerp(b, ice.B / 255f, snow);
|
|
||||||
|
|
||||||
// 细节扰动,避免大面积纯色
|
|
||||||
var grain = (detail - 0.5f) * 0.07f;
|
|
||||||
var baseMix = 0.25f;
|
|
||||||
return (
|
|
||||||
ToByte(Math.Clamp(r + grain + (landBase.R / 255f - 0.3f) * baseMix * 0.2f, 0f, 1f)),
|
|
||||||
ToByte(Math.Clamp(g + grain + (landBase.G / 255f - 0.45f) * baseMix * 0.2f, 0f, 1f)),
|
|
||||||
ToByte(Math.Clamp(b + grain + (landBase.B / 255f - 0.3f) * baseMix * 0.2f, 0f, 1f)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>可分离盒式模糊(原地),用于软化云层。</summary>
|
|
||||||
private static void Blur(byte[] data, int width, int height, int radius)
|
|
||||||
{
|
|
||||||
var temp = new byte[data.Length];
|
|
||||||
for (var y = 0; y < height; y++)
|
|
||||||
{
|
|
||||||
var row = y * width;
|
|
||||||
for (var x = 0; x < width; x++)
|
|
||||||
{
|
|
||||||
var sum = 0;
|
|
||||||
var count = 0;
|
|
||||||
for (var k = -radius; k <= radius; k++)
|
|
||||||
{
|
|
||||||
var sx = (x + k + width) % width;
|
|
||||||
sum += data[row + sx];
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
temp[row + x] = (byte)(sum / count);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (var x = 0; x < width; x++)
|
|
||||||
{
|
|
||||||
for (var y = 0; y < height; y++)
|
|
||||||
{
|
|
||||||
var sum = 0;
|
|
||||||
var count = 0;
|
|
||||||
for (var k = -radius; k <= radius; k++)
|
|
||||||
{
|
|
||||||
var sy = Math.Clamp(y + k, 0, height - 1);
|
|
||||||
sum += temp[sy * width + x];
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
data[y * width + x] = (byte)(sum / count);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>由高度图算东西/南北梯度,供球面光照直接使用。</summary>
|
|
||||||
private static void BakeSlopes(PlanetTexture t, int width, int height)
|
|
||||||
{
|
|
||||||
const float relief = 0.055f * 90f;
|
|
||||||
for (var y = 0; y < height; y++)
|
|
||||||
{
|
|
||||||
var row = y * width;
|
|
||||||
var up = Math.Max(0, y - 1) * width;
|
|
||||||
var down = Math.Min(height - 1, y + 1) * width;
|
|
||||||
for (var x = 0; x < width; x++)
|
|
||||||
{
|
|
||||||
var left = (x - 1 + width) % width;
|
|
||||||
var right = (x + 1) % width;
|
|
||||||
t.SlopeEast[row + x] = (t.Elevation[row + right] - t.Elevation[row + left]) / 255f * relief;
|
|
||||||
t.SlopeNorth[row + x] = (t.Elevation[up + x] - t.Elevation[down + x]) / 255f * relief;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------- 距离场
|
|
||||||
private static void ComputeDistances(LandMask? mask, int width, int height, float[] landDistance, float[] oceanDistance)
|
|
||||||
{
|
|
||||||
var count = width * height;
|
|
||||||
const float big = 1e6f;
|
|
||||||
for (var i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
var isLand = mask != null && mask.Bits[i] > 127;
|
|
||||||
landDistance[i] = isLand ? big : -big;
|
|
||||||
oceanDistance[i] = isLand ? -big : big;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 两遍 chamfer:陆地到海洋的距离 / 海洋到陆地的距离
|
|
||||||
for (var y = 0; y < height; y++)
|
|
||||||
{
|
|
||||||
for (var x = 0; x < width; x++)
|
|
||||||
{
|
|
||||||
var i = y * width + x;
|
|
||||||
if (mask != null && mask.Bits[i] > 127)
|
|
||||||
{
|
|
||||||
var best = big;
|
|
||||||
if (x > 0 && mask.Bits[i - 1] <= 127) best = 0.5f;
|
|
||||||
if (x < width - 1 && mask.Bits[i + 1] <= 127) best = Math.Min(best, 0.5f);
|
|
||||||
if (y > 0 && mask.Bits[i - width] <= 127) best = Math.Min(best, 0.5f);
|
|
||||||
if (y < height - 1 && mask.Bits[i + width] <= 127) best = Math.Min(best, 0.5f);
|
|
||||||
if (best < big) landDistance[i] = best;
|
|
||||||
}
|
|
||||||
if (mask != null && mask.Bits[i] <= 127)
|
|
||||||
{
|
|
||||||
var best = big;
|
|
||||||
if (x > 0 && mask.Bits[i - 1] > 127) best = 0.5f;
|
|
||||||
if (x < width - 1 && mask.Bits[i + 1] > 127) best = Math.Min(best, 0.5f);
|
|
||||||
if (y > 0 && mask.Bits[i - width] > 127) best = Math.Min(best, 0.5f);
|
|
||||||
if (y < height - 1 && mask.Bits[i + width] > 127) best = Math.Min(best, 0.5f);
|
|
||||||
if (best < big) oceanDistance[i] = best;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 正向传递
|
|
||||||
for (var y = 0; y < height; y++)
|
|
||||||
{
|
|
||||||
for (var x = 0; x < width; x++)
|
|
||||||
{
|
|
||||||
var i = y * width + x;
|
|
||||||
Propagate(landDistance, i, width, height, x, y, -1, 0, 1.4142f);
|
|
||||||
Propagate(oceanDistance, i, width, height, x, y, -1, 0, 1.4142f);
|
|
||||||
if (x > 0)
|
|
||||||
{
|
|
||||||
landDistance[i] = Math.Min(landDistance[i], landDistance[i - 1] + 1f);
|
|
||||||
oceanDistance[i] = Math.Min(oceanDistance[i], oceanDistance[i - 1] + 1f);
|
|
||||||
}
|
|
||||||
if (y > 0)
|
|
||||||
{
|
|
||||||
landDistance[i] = Math.Min(landDistance[i], landDistance[i - width] + 1f);
|
|
||||||
oceanDistance[i] = Math.Min(oceanDistance[i], oceanDistance[i - width] + 1f);
|
|
||||||
if (x > 0)
|
|
||||||
{
|
|
||||||
landDistance[i] = Math.Min(landDistance[i], landDistance[i - width - 1] + 1.4142f);
|
|
||||||
oceanDistance[i] = Math.Min(oceanDistance[i], oceanDistance[i - width - 1] + 1.4142f);
|
|
||||||
}
|
|
||||||
if (x < width - 1)
|
|
||||||
{
|
|
||||||
landDistance[i] = Math.Min(landDistance[i], landDistance[i - width + 1] + 1.4142f);
|
|
||||||
oceanDistance[i] = Math.Min(oceanDistance[i], oceanDistance[i - width + 1] + 1.4142f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 反向传递
|
|
||||||
for (var y = height - 1; y >= 0; y--)
|
|
||||||
{
|
|
||||||
for (var x = width - 1; x >= 0; x--)
|
|
||||||
{
|
|
||||||
var i = y * width + x;
|
|
||||||
if (x < width - 1)
|
|
||||||
{
|
|
||||||
landDistance[i] = Math.Min(landDistance[i], landDistance[i + 1] + 1f);
|
|
||||||
oceanDistance[i] = Math.Min(oceanDistance[i], oceanDistance[i + 1] + 1f);
|
|
||||||
}
|
|
||||||
if (y < height - 1)
|
|
||||||
{
|
|
||||||
landDistance[i] = Math.Min(landDistance[i], landDistance[i + width] + 1f);
|
|
||||||
oceanDistance[i] = Math.Min(oceanDistance[i], oceanDistance[i + width] + 1f);
|
|
||||||
if (x < width - 1)
|
|
||||||
{
|
|
||||||
landDistance[i] = Math.Min(landDistance[i], landDistance[i + width + 1] + 1.4142f);
|
|
||||||
oceanDistance[i] = Math.Min(oceanDistance[i], oceanDistance[i + width + 1] + 1.4142f);
|
|
||||||
}
|
|
||||||
if (x > 0)
|
|
||||||
{
|
|
||||||
landDistance[i] = Math.Min(landDistance[i], landDistance[i + width - 1] + 1.4142f);
|
|
||||||
oceanDistance[i] = Math.Min(oceanDistance[i], oceanDistance[i + width - 1] + 1.4142f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
landDistance[i] = MathF.Max(0f, landDistance[i]);
|
|
||||||
oceanDistance[i] = MathF.Max(0f, oceanDistance[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Propagate(float[] map, int index, int width, int height, int x, int y, int dx, int dy, float w)
|
|
||||||
{
|
|
||||||
var nx = x + dx;
|
|
||||||
var ny = y + dy;
|
|
||||||
if (nx < 0 || nx >= width || ny < 0 || ny >= height) return;
|
|
||||||
var other = ny * width + nx;
|
|
||||||
map[index] = Math.Min(map[index], map[other] + w);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------- 噪声
|
|
||||||
/// <summary>值噪声 + 分形叠加(确定性,跨平台一致)。</summary>
|
|
||||||
public static float Fbm(double x, double y, int octaves, int seed)
|
|
||||||
{
|
|
||||||
var amplitude = 1.0;
|
|
||||||
var frequency = 1.0;
|
|
||||||
var sum = 0.0;
|
|
||||||
var norm = 0.0;
|
|
||||||
for (var i = 0; i < octaves; i++)
|
|
||||||
{
|
|
||||||
sum += amplitude * ValueNoise(x * frequency, y * frequency, seed + i * 101);
|
|
||||||
norm += amplitude;
|
|
||||||
amplitude *= 0.5;
|
|
||||||
frequency *= 2.07;
|
|
||||||
}
|
|
||||||
return (float)(sum / norm);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static double ValueNoise(double x, double y, int seed)
|
|
||||||
{
|
|
||||||
var xi = (int)Math.Floor(x);
|
|
||||||
var yi = (int)Math.Floor(y);
|
|
||||||
var xf = x - xi;
|
|
||||||
var yf = y - yi;
|
|
||||||
var u = xf * xf * (3 - 2 * xf);
|
|
||||||
var v = yf * yf * (3 - 2 * yf);
|
|
||||||
var a = Hash(xi, yi, seed);
|
|
||||||
var b = Hash(xi + 1, yi, seed);
|
|
||||||
var c = Hash(xi, yi + 1, seed);
|
|
||||||
var d = Hash(xi + 1, yi + 1, seed);
|
|
||||||
return (a + (b - a) * u) * (1 - v) + (c + (d - c) * u) * v;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static double Hash(int x, int y, int seed)
|
|
||||||
{
|
|
||||||
var h = (uint)(x * 374761393 + y * 668265263 + seed * 1442695041);
|
|
||||||
h = (h ^ (h >> 13)) * 1274126177u;
|
|
||||||
h ^= h >> 16;
|
|
||||||
return (h & 0xFFFFFF) / (double)0xFFFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------- 采样
|
|
||||||
public void Sample(double lon, double lat, out float r, out float g, out float b,
|
|
||||||
out float elevation, out float cloud, out float lights,
|
|
||||||
out float slopeEast, out float slopeNorth)
|
|
||||||
{
|
|
||||||
var u = (lon + 180.0) / 360.0 * Width - 0.5;
|
|
||||||
var v = (90.0 - lat) / 180.0 * Height - 0.5;
|
|
||||||
|
|
||||||
var x0 = (int)Math.Floor(u);
|
|
||||||
var y0 = (int)Math.Floor(v);
|
|
||||||
var fx = (float)(u - x0);
|
|
||||||
var fy = (float)(v - y0);
|
|
||||||
|
|
||||||
var x1 = x0 + 1;
|
|
||||||
var y1 = y0 + 1;
|
|
||||||
if (x0 < 0) x0 += Width; if (x1 < 0) x1 += Width;
|
|
||||||
if (x0 >= Width) x0 -= Width; if (x1 >= Width) x1 -= Width;
|
|
||||||
y0 = Math.Clamp(y0, 0, Height - 1);
|
|
||||||
y1 = Math.Clamp(y1, 0, Height - 1);
|
|
||||||
|
|
||||||
var i00 = y0 * Width + x0;
|
|
||||||
var i10 = y0 * Width + x1;
|
|
||||||
var i01 = y1 * Width + x0;
|
|
||||||
var i11 = y1 * Width + x1;
|
|
||||||
|
|
||||||
float w00 = (1 - fx) * (1 - fy), w10 = fx * (1 - fy), w01 = (1 - fx) * fy, w11 = fx * fy;
|
|
||||||
|
|
||||||
var p00 = Albedo[i00];
|
|
||||||
var p10 = Albedo[i10];
|
|
||||||
var p01 = Albedo[i01];
|
|
||||||
var p11 = Albedo[i11];
|
|
||||||
var rr = ((p00 >> 16) & 0xFF) * w00 + ((p10 >> 16) & 0xFF) * w10 + ((p01 >> 16) & 0xFF) * w01 + ((p11 >> 16) & 0xFF) * w11;
|
|
||||||
var gg = ((p00 >> 8) & 0xFF) * w00 + ((p10 >> 8) & 0xFF) * w10 + ((p01 >> 8) & 0xFF) * w01 + ((p11 >> 8) & 0xFF) * w11;
|
|
||||||
var bb = (p00 & 0xFF) * w00 + (p10 & 0xFF) * w10 + (p01 & 0xFF) * w01 + (p11 & 0xFF) * w11;
|
|
||||||
r = rr / 255f;
|
|
||||||
g = gg / 255f;
|
|
||||||
b = bb / 255f;
|
|
||||||
|
|
||||||
elevation = (Elevation[i00] * w00 + Elevation[i10] * w10 + Elevation[i01] * w01 + Elevation[i11] * w11) / 255f;
|
|
||||||
cloud = (Cloud[i00] * w00 + Cloud[i10] * w10 + Cloud[i01] * w01 + Cloud[i11] * w11) / 255f;
|
|
||||||
lights = Lights[i00] / 255f;
|
|
||||||
slopeEast = SlopeEast[i00] * w00 + SlopeEast[i10] * w10 + SlopeEast[i01] * w01 + SlopeEast[i11] * w11;
|
|
||||||
slopeNorth = SlopeNorth[i00] * w00 + SlopeNorth[i10] * w10 + SlopeNorth[i01] * w01 + SlopeNorth[i11] * w11;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>只采样高度(法线扰动用)。</summary>
|
|
||||||
public float SampleHeight(double lon, double lat)
|
|
||||||
{
|
|
||||||
var u = (lon + 180.0) / 360.0 * Width - 0.5;
|
|
||||||
var v = (90.0 - lat) / 180.0 * Height - 0.5;
|
|
||||||
var x = Math.Clamp((int)Math.Round(u), 0, Width - 1);
|
|
||||||
var y = Math.Clamp((int)Math.Round(v), 0, Height - 1);
|
|
||||||
return Elevation[y * Width + x] / 255f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float SampleCloud(double lon, double lat)
|
|
||||||
{
|
|
||||||
var u = (lon + 180.0) / 360.0 * Width - 0.5;
|
|
||||||
var v = (90.0 - lat) / 180.0 * Height - 0.5;
|
|
||||||
var x = Math.Clamp((int)Math.Round(u), 0, Width - 1);
|
|
||||||
var y = Math.Clamp((int)Math.Round(v), 0, Height - 1);
|
|
||||||
return Cloud[y * Width + x] / 255f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte ToByte(float v) => (byte)Math.Clamp((int)(v * 255f + 0.5f), 0, 255);
|
|
||||||
private static uint Pack(byte r, byte g, byte b) => ((uint)r << 16) | ((uint)g << 8) | b;
|
|
||||||
private static float Lerp(float a, float b, float t) => a + (b - a) * Math.Clamp(t, 0f, 1f);
|
|
||||||
private static float Smooth(float edge0, float edge1, float x)
|
|
||||||
{
|
|
||||||
if (edge1 <= edge0) return x >= edge1 ? 1f : 0f;
|
|
||||||
var t = Math.Clamp((x - edge0) / (edge1 - edge0), 0f, 1f);
|
|
||||||
return t * t * (3f - 2f * t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,172 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Numerics;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Avalonia.Media.Imaging;
|
|
||||||
|
|
||||||
namespace NeoRF.EarthModels;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 球体像素级渲染:正交投影 + 预烘焙地表纹理 + 地形光照 + 云层 + 夜灯 + 大气边缘光。
|
|
||||||
/// 纯 CPU 光栅、按行并行,不依赖 GPU,三平台效果一致。
|
|
||||||
/// </summary>
|
|
||||||
public static unsafe class SphereRaster
|
|
||||||
{
|
|
||||||
/// <summary>把球体画进 WriteableBitmap(整张位图会被覆盖)。</summary>
|
|
||||||
public static void Draw(WriteableBitmap bitmap, int size, Matrix4x4 cam, Matrix4x4 planet,
|
|
||||||
Vector3 light, PlanetTexture texture, double cloudShift, bool showClouds)
|
|
||||||
{
|
|
||||||
using var framebuffer = bitmap.Lock();
|
|
||||||
var stride = framebuffer.RowBytes / 4;
|
|
||||||
Render((uint*)framebuffer.Address, stride, size, cam, planet, light, texture, cloudShift, showClouds);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void Render(uint* dst, int stride, int size, Matrix4x4 cam, Matrix4x4 planet,
|
|
||||||
Vector3 light, PlanetTexture texture, double cloudShift, bool showClouds)
|
|
||||||
{
|
|
||||||
var radius = size * 0.5f - 1.0f;
|
|
||||||
var center = size * 0.5f;
|
|
||||||
var inv = 1f / radius;
|
|
||||||
|
|
||||||
// 相机空间法线 -> 行星本地法线
|
|
||||||
var combined = Matrix4x4.Multiply(planet, cam);
|
|
||||||
var mt = Matrix4x4.Transpose(combined);
|
|
||||||
float m11 = mt.M11, m12 = mt.M12, m13 = mt.M13;
|
|
||||||
float m21 = mt.M21, m22 = mt.M22, m23 = mt.M23;
|
|
||||||
float m31 = mt.M31, m32 = mt.M32, m33 = mt.M33;
|
|
||||||
|
|
||||||
var lx = light.X; var ly = light.Y; var lz = light.Z;
|
|
||||||
|
|
||||||
Parallel.For(0, size, y =>
|
|
||||||
{
|
|
||||||
var ny = (center - y - 0.5f) * inv;
|
|
||||||
var row = dst + (long)y * stride;
|
|
||||||
for (var x = 0; x < size; x++)
|
|
||||||
{
|
|
||||||
var nx = (x + 0.5f - center) * inv;
|
|
||||||
var r2 = nx * nx + ny * ny;
|
|
||||||
if (r2 >= 1f)
|
|
||||||
{
|
|
||||||
row[x] = 0;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
var nz = MathF.Sqrt(1f - r2);
|
|
||||||
|
|
||||||
// 本地法线(用于取经纬度)
|
|
||||||
var ux = nx * m11 + ny * m21 + nz * m31;
|
|
||||||
var uy = nx * m12 + ny * m22 + nz * m32;
|
|
||||||
var uz = nx * m13 + ny * m23 + nz * m33;
|
|
||||||
|
|
||||||
var lat = MathF.Asin(Math.Clamp(uy, -1f, 1f)) * 57.2957795f;
|
|
||||||
var lon = MathF.Atan2(ux, uz) * 57.2957795f;
|
|
||||||
|
|
||||||
var cloudLon = lon + cloudShift;
|
|
||||||
if (cloudLon > 180) cloudLon -= 360;
|
|
||||||
if (cloudLon < -180) cloudLon += 360;
|
|
||||||
|
|
||||||
texture.Sample(lon, lat, out var ar, out var ag, out var ab,
|
|
||||||
out var elevation, out var cloud, out var lights,
|
|
||||||
out var dEast, out var dNorth);
|
|
||||||
|
|
||||||
// ---- 地形法线:局部基向量可由球面法线直接推出,不必再算 6 次三角函数
|
|
||||||
// 点 P=(cosLat·sinLon, sinLat, cosLat·cosLon) = (ux,uy,uz)
|
|
||||||
// 东向 = (cosLon,0,-sinLon),北向 = (-sinLat·sinLon, cosLat, -sinLat·cosLon)
|
|
||||||
var cosLat = MathF.Sqrt(MathF.Max(ux * ux + uz * uz, 1e-6f));
|
|
||||||
var invCos = 1f / cosLat;
|
|
||||||
var eastX = uz * invCos;
|
|
||||||
var eastZ = -ux * invCos;
|
|
||||||
var northX = -uy * ux * invCos;
|
|
||||||
var northY = cosLat;
|
|
||||||
var northZ = -uy * uz * invCos;
|
|
||||||
|
|
||||||
var nLocalX = ux + eastX * dEast + northX * dNorth;
|
|
||||||
var nLocalY = uy + northY * dNorth;
|
|
||||||
var nLocalZ = uz + eastZ * dEast + northZ * dNorth;
|
|
||||||
var nLen = MathF.Sqrt(nLocalX * nLocalX + nLocalY * nLocalY + nLocalZ * nLocalZ);
|
|
||||||
if (nLen > 0.0001f) { nLocalX /= nLen; nLocalY /= nLen; nLocalZ /= nLen; }
|
|
||||||
|
|
||||||
var nCamX = nLocalX * combined.M11 + nLocalY * combined.M21 + nLocalZ * combined.M31;
|
|
||||||
var nCamY = nLocalX * combined.M12 + nLocalY * combined.M22 + nLocalZ * combined.M32;
|
|
||||||
var nCamZ = nLocalX * combined.M13 + nLocalY * combined.M23 + nLocalZ * combined.M33;
|
|
||||||
|
|
||||||
var lam = nx * lx + ny * ly + nz * lz; // 几何光照(晨昏线)
|
|
||||||
var bump = nCamX * lx + nCamY * ly + nCamZ * lz; // 地形光照
|
|
||||||
var day = Smooth(-0.18f, 0.22f, lam);
|
|
||||||
var terrainLight = 0.82f + 0.42f * MathF.Max(0f, bump - lam);
|
|
||||||
|
|
||||||
var shade = (0.055f + 0.945f * day) * terrainLight;
|
|
||||||
|
|
||||||
var br = ar * shade;
|
|
||||||
var bg = ag * shade;
|
|
||||||
var bb = ab * shade;
|
|
||||||
|
|
||||||
// 海面高光(高度为 0 视为水面)
|
|
||||||
if (elevation < 0.02f)
|
|
||||||
{
|
|
||||||
var t2 = MathF.Max(0f, lam);
|
|
||||||
var t4 = t2 * t2 * t2 * t2;
|
|
||||||
var t8 = t4 * t4;
|
|
||||||
var t16 = t8 * t8;
|
|
||||||
var spec = t16 * t8 * t4 * t2 * t2 * 0.62f;
|
|
||||||
br += spec * 0.95f;
|
|
||||||
bg += spec * 0.98f;
|
|
||||||
bb += spec;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 云层(随经度缓慢漂移)
|
|
||||||
if (showClouds && cloud > 0.02f)
|
|
||||||
{
|
|
||||||
var cloudLight = 0.10f + 0.90f * day;
|
|
||||||
var c = Math.Clamp(cloud * 0.92f, 0f, 1f);
|
|
||||||
var cloudR = 0.98f * cloudLight;
|
|
||||||
var cloudG = 0.985f * cloudLight;
|
|
||||||
var cloudB = 1.0f * cloudLight;
|
|
||||||
br += (cloudR - br) * c;
|
|
||||||
bg += (cloudG - bg) * c;
|
|
||||||
bb += (cloudB - bb) * c;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 夜间灯光
|
|
||||||
if (lights > 0.01f)
|
|
||||||
{
|
|
||||||
var night = 1f - day;
|
|
||||||
var glow = lights * night * 0.35f;
|
|
||||||
br += glow * 0.95f;
|
|
||||||
bg += glow * 0.72f;
|
|
||||||
bb += glow * 0.38f;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 大气边缘散射
|
|
||||||
var rim = 1f - nz;
|
|
||||||
rim *= rim;
|
|
||||||
var litRim = rim * MathF.Max(0f, lam) * 0.98f;
|
|
||||||
br += 0.30f * litRim;
|
|
||||||
bg += 0.55f * litRim;
|
|
||||||
bb += 1.00f * litRim;
|
|
||||||
|
|
||||||
// 夜面极淡反照
|
|
||||||
var nightSide = 1f - day;
|
|
||||||
br += 0.008f * nightSide;
|
|
||||||
bg += 0.013f * nightSide;
|
|
||||||
bb += 0.028f * nightSide;
|
|
||||||
|
|
||||||
var coverage = 1f;
|
|
||||||
var edge = (1f - MathF.Sqrt(r2)) * radius;
|
|
||||||
if (edge < 1f) coverage = MathF.Max(0f, edge);
|
|
||||||
|
|
||||||
var a = (uint)(coverage * 255f);
|
|
||||||
var r8 = (uint)(Math.Clamp(br, 0f, 1f) * 255f * coverage);
|
|
||||||
var g8 = (uint)(Math.Clamp(bg, 0f, 1f) * 255f * coverage);
|
|
||||||
var b8 = (uint)(Math.Clamp(bb, 0f, 1f) * 255f * coverage);
|
|
||||||
row[x] = (a << 24) | (r8 << 16) | (g8 << 8) | b8;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private static float Smooth(float edge0, float edge1, float x)
|
|
||||||
{
|
|
||||||
if (edge1 <= edge0) return x >= edge1 ? 1f : 0f;
|
|
||||||
var t = Math.Clamp((x - edge0) / (edge1 - edge0), 0f, 1f);
|
|
||||||
return t * t * (3f - 2f * t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-17
@@ -1,17 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<ImplicitUsings>disable</ImplicitUsings>
|
|
||||||
<RootNamespace>EarthModelStudio.ModelSdk</RootNamespace>
|
|
||||||
<AssemblyName>EarthModelStudio.ModelSdk</AssemblyName>
|
|
||||||
<IsPackable>false</IsPackable>
|
|
||||||
<Description>Earth Model 模型契约:启动器与模型之间唯一的编译期依赖。</Description>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
-68
@@ -1,68 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Avalonia.Controls;
|
|
||||||
|
|
||||||
namespace EarthModelStudio.ModelSdk;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 模型入口契约。模型程序集里必须有一个公开、无参构造的 <see cref="IModelFactory"/> 实现,
|
|
||||||
/// 启动器按模型清单里的 <c>assembly</c> + <c>type</c> 定位并创建它。
|
|
||||||
/// </summary>
|
|
||||||
public interface IModelFactory
|
|
||||||
{
|
|
||||||
/// <summary>契约版本。启动器目前支持 1。</summary>
|
|
||||||
int ApiVersion { get; }
|
|
||||||
|
|
||||||
/// <summary>创建一个模型运行时实例(每个窗口一个实例)。</summary>
|
|
||||||
IModelRuntime Create();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 模型运行时:负责把模型自己的界面交给启动器。
|
|
||||||
/// 启动器只负责开窗口,**不参与任何渲染**。
|
|
||||||
/// </summary>
|
|
||||||
public interface IModelRuntime : IDisposable
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 在**后台线程**准备数据(读文件、算纹理等),期间禁止创建或操作任何 UI 控件。
|
|
||||||
/// 启动器的进度窗会显示 <see cref="IModelContext.ReportProgress"/> 汇报的进度。
|
|
||||||
/// 默认空实现:模型也可以把准备工作留到 CreateView 里(那样会占用 UI 线程)。
|
|
||||||
/// </summary>
|
|
||||||
void Prepare(IModelContext context) { }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 在 UI 线程创建模型窗口的内容。模型可以自由组合控件、自己画图、自己管动画。
|
|
||||||
/// 返回的控件会被直接放进窗口,铺满客户区。
|
|
||||||
/// </summary>
|
|
||||||
Control CreateView(IModelContext context);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>启动器提供给模型的环境信息与能力。</summary>
|
|
||||||
public interface IModelContext
|
|
||||||
{
|
|
||||||
/// <summary>模型 id(即模型目录名)。</summary>
|
|
||||||
string ModelId { get; }
|
|
||||||
|
|
||||||
/// <summary>模型目录:<c>model/<id></c>。</summary>
|
|
||||||
string ModelDirectory { get; }
|
|
||||||
|
|
||||||
/// <summary>模型数据目录:<c>model/<id>/<id>.model</c>,模型自己的场景数据、贴图、语言包都放这里。</summary>
|
|
||||||
string DataDirectory { get; }
|
|
||||||
|
|
||||||
/// <summary>界面语言(zh-CN / en)。模型应按它选择自己的文案。</summary>
|
|
||||||
string Language { get; }
|
|
||||||
|
|
||||||
/// <summary>用户在设置里分配的运行内存预算(MB),模型可据此控制缓存规模。</summary>
|
|
||||||
int MemoryBudgetMb { get; }
|
|
||||||
|
|
||||||
/// <summary>请求关闭承载此模型的窗口。</summary>
|
|
||||||
void RequestClose();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 汇报加载进度(0–1)与当前阶段文案。启动器的加载进度条会实时显示,
|
|
||||||
/// 也可以在任何时候调用(例如切换数据集时)。
|
|
||||||
/// </summary>
|
|
||||||
void ReportProgress(double value, string? message = null);
|
|
||||||
|
|
||||||
/// <summary>输出日志(启动器会写到控制台)。</summary>
|
|
||||||
void Log(string message);
|
|
||||||
}
|
|
||||||
-115
@@ -1,115 +0,0 @@
|
|||||||
{
|
|
||||||
"runtimeTarget": {
|
|
||||||
"name": ".NETCoreApp,Version=v8.0",
|
|
||||||
"signature": ""
|
|
||||||
},
|
|
||||||
"compilationOptions": {},
|
|
||||||
"targets": {
|
|
||||||
".NETCoreApp,Version=v8.0": {
|
|
||||||
"EarthModelStudio.ModelSdk/1.0.3": {
|
|
||||||
"dependencies": {
|
|
||||||
"Avalonia": "11.3.9"
|
|
||||||
},
|
|
||||||
"runtime": {
|
|
||||||
"EarthModelStudio.ModelSdk.dll": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Avalonia/11.3.9": {
|
|
||||||
"dependencies": {
|
|
||||||
"Avalonia.Remote.Protocol": "11.3.9",
|
|
||||||
"MicroCom.Runtime": "0.11.0"
|
|
||||||
},
|
|
||||||
"runtime": {
|
|
||||||
"lib/net8.0/Avalonia.Base.dll": {
|
|
||||||
"assemblyVersion": "11.3.9.0",
|
|
||||||
"fileVersion": "11.3.9.0"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.Controls.dll": {
|
|
||||||
"assemblyVersion": "11.3.9.0",
|
|
||||||
"fileVersion": "11.3.9.0"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.DesignerSupport.dll": {
|
|
||||||
"assemblyVersion": "0.7.0.0",
|
|
||||||
"fileVersion": "0.7.0.0"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.Dialogs.dll": {
|
|
||||||
"assemblyVersion": "11.3.9.0",
|
|
||||||
"fileVersion": "11.3.9.0"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.Markup.Xaml.dll": {
|
|
||||||
"assemblyVersion": "11.3.9.0",
|
|
||||||
"fileVersion": "11.3.9.0"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.Markup.dll": {
|
|
||||||
"assemblyVersion": "11.3.9.0",
|
|
||||||
"fileVersion": "11.3.9.0"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.Metal.dll": {
|
|
||||||
"assemblyVersion": "11.3.9.0",
|
|
||||||
"fileVersion": "11.3.9.0"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.MicroCom.dll": {
|
|
||||||
"assemblyVersion": "11.3.9.0",
|
|
||||||
"fileVersion": "11.3.9.0"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.OpenGL.dll": {
|
|
||||||
"assemblyVersion": "11.3.9.0",
|
|
||||||
"fileVersion": "11.3.9.0"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.Vulkan.dll": {
|
|
||||||
"assemblyVersion": "11.3.9.0",
|
|
||||||
"fileVersion": "11.3.9.0"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.dll": {
|
|
||||||
"assemblyVersion": "11.3.9.0",
|
|
||||||
"fileVersion": "11.3.9.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Avalonia.Remote.Protocol/11.3.9": {
|
|
||||||
"runtime": {
|
|
||||||
"lib/net8.0/Avalonia.Remote.Protocol.dll": {
|
|
||||||
"assemblyVersion": "11.3.9.0",
|
|
||||||
"fileVersion": "11.3.9.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"MicroCom.Runtime/0.11.0": {
|
|
||||||
"runtime": {
|
|
||||||
"lib/net5.0/MicroCom.Runtime.dll": {
|
|
||||||
"assemblyVersion": "0.11.0.0",
|
|
||||||
"fileVersion": "0.11.0.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"libraries": {
|
|
||||||
"EarthModelStudio.ModelSdk/1.0.3": {
|
|
||||||
"type": "project",
|
|
||||||
"serviceable": false,
|
|
||||||
"sha512": ""
|
|
||||||
},
|
|
||||||
"Avalonia/11.3.9": {
|
|
||||||
"type": "package",
|
|
||||||
"serviceable": true,
|
|
||||||
"sha512": "sha512-YfaTrUxcmVTsGOw2YqdZyunHqZArK16m1pYfNIBvyvAgX89Pzd3A1PgoMkf64u7scL23IN6HkfqhZeFcbYWLoA==",
|
|
||||||
"path": "avalonia/11.3.9",
|
|
||||||
"hashPath": "avalonia.11.3.9.nupkg.sha512"
|
|
||||||
},
|
|
||||||
"Avalonia.Remote.Protocol/11.3.9": {
|
|
||||||
"type": "package",
|
|
||||||
"serviceable": true,
|
|
||||||
"sha512": "sha512-2XVLTSNa+Nvwu4D8NqqdudhllTaCRA9ZKlLZZvYLZeuLlzg7OcAV+df/biHQc6AqOv7iMFR9K5Zt3wG0EF4KfQ==",
|
|
||||||
"path": "avalonia.remote.protocol/11.3.9",
|
|
||||||
"hashPath": "avalonia.remote.protocol.11.3.9.nupkg.sha512"
|
|
||||||
},
|
|
||||||
"MicroCom.Runtime/0.11.0": {
|
|
||||||
"type": "package",
|
|
||||||
"serviceable": true,
|
|
||||||
"sha512": "sha512-MEnrZ3UIiH40hjzMDsxrTyi8dtqB5ziv3iBeeU4bXsL/7NLSal9F1lZKpK+tfBRnUoDSdtcW3KufE4yhATOMCA==",
|
|
||||||
"path": "microcom.runtime/0.11.0",
|
|
||||||
"hashPath": "microcom.runtime.0.11.0.nupkg.sha512"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
-115
@@ -1,115 +0,0 @@
|
|||||||
{
|
|
||||||
"runtimeTarget": {
|
|
||||||
"name": ".NETCoreApp,Version=v8.0",
|
|
||||||
"signature": ""
|
|
||||||
},
|
|
||||||
"compilationOptions": {},
|
|
||||||
"targets": {
|
|
||||||
".NETCoreApp,Version=v8.0": {
|
|
||||||
"EarthModelStudio.ModelSdk/1.0.3": {
|
|
||||||
"dependencies": {
|
|
||||||
"Avalonia": "11.3.9"
|
|
||||||
},
|
|
||||||
"runtime": {
|
|
||||||
"EarthModelStudio.ModelSdk.dll": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Avalonia/11.3.9": {
|
|
||||||
"dependencies": {
|
|
||||||
"Avalonia.Remote.Protocol": "11.3.9",
|
|
||||||
"MicroCom.Runtime": "0.11.0"
|
|
||||||
},
|
|
||||||
"runtime": {
|
|
||||||
"lib/net8.0/Avalonia.Base.dll": {
|
|
||||||
"assemblyVersion": "11.3.9.0",
|
|
||||||
"fileVersion": "11.3.9.0"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.Controls.dll": {
|
|
||||||
"assemblyVersion": "11.3.9.0",
|
|
||||||
"fileVersion": "11.3.9.0"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.DesignerSupport.dll": {
|
|
||||||
"assemblyVersion": "0.7.0.0",
|
|
||||||
"fileVersion": "0.7.0.0"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.Dialogs.dll": {
|
|
||||||
"assemblyVersion": "11.3.9.0",
|
|
||||||
"fileVersion": "11.3.9.0"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.Markup.Xaml.dll": {
|
|
||||||
"assemblyVersion": "11.3.9.0",
|
|
||||||
"fileVersion": "11.3.9.0"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.Markup.dll": {
|
|
||||||
"assemblyVersion": "11.3.9.0",
|
|
||||||
"fileVersion": "11.3.9.0"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.Metal.dll": {
|
|
||||||
"assemblyVersion": "11.3.9.0",
|
|
||||||
"fileVersion": "11.3.9.0"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.MicroCom.dll": {
|
|
||||||
"assemblyVersion": "11.3.9.0",
|
|
||||||
"fileVersion": "11.3.9.0"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.OpenGL.dll": {
|
|
||||||
"assemblyVersion": "11.3.9.0",
|
|
||||||
"fileVersion": "11.3.9.0"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.Vulkan.dll": {
|
|
||||||
"assemblyVersion": "11.3.9.0",
|
|
||||||
"fileVersion": "11.3.9.0"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.dll": {
|
|
||||||
"assemblyVersion": "11.3.9.0",
|
|
||||||
"fileVersion": "11.3.9.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Avalonia.Remote.Protocol/11.3.9": {
|
|
||||||
"runtime": {
|
|
||||||
"lib/net8.0/Avalonia.Remote.Protocol.dll": {
|
|
||||||
"assemblyVersion": "11.3.9.0",
|
|
||||||
"fileVersion": "11.3.9.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"MicroCom.Runtime/0.11.0": {
|
|
||||||
"runtime": {
|
|
||||||
"lib/net5.0/MicroCom.Runtime.dll": {
|
|
||||||
"assemblyVersion": "0.11.0.0",
|
|
||||||
"fileVersion": "0.11.0.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"libraries": {
|
|
||||||
"EarthModelStudio.ModelSdk/1.0.3": {
|
|
||||||
"type": "project",
|
|
||||||
"serviceable": false,
|
|
||||||
"sha512": ""
|
|
||||||
},
|
|
||||||
"Avalonia/11.3.9": {
|
|
||||||
"type": "package",
|
|
||||||
"serviceable": true,
|
|
||||||
"sha512": "sha512-YfaTrUxcmVTsGOw2YqdZyunHqZArK16m1pYfNIBvyvAgX89Pzd3A1PgoMkf64u7scL23IN6HkfqhZeFcbYWLoA==",
|
|
||||||
"path": "avalonia/11.3.9",
|
|
||||||
"hashPath": "avalonia.11.3.9.nupkg.sha512"
|
|
||||||
},
|
|
||||||
"Avalonia.Remote.Protocol/11.3.9": {
|
|
||||||
"type": "package",
|
|
||||||
"serviceable": true,
|
|
||||||
"sha512": "sha512-2XVLTSNa+Nvwu4D8NqqdudhllTaCRA9ZKlLZZvYLZeuLlzg7OcAV+df/biHQc6AqOv7iMFR9K5Zt3wG0EF4KfQ==",
|
|
||||||
"path": "avalonia.remote.protocol/11.3.9",
|
|
||||||
"hashPath": "avalonia.remote.protocol.11.3.9.nupkg.sha512"
|
|
||||||
},
|
|
||||||
"MicroCom.Runtime/0.11.0": {
|
|
||||||
"type": "package",
|
|
||||||
"serviceable": true,
|
|
||||||
"sha512": "sha512-MEnrZ3UIiH40hjzMDsxrTyi8dtqB5ziv3iBeeU4bXsL/7NLSal9F1lZKpK+tfBRnUoDSdtcW3KufE4yhATOMCA==",
|
|
||||||
"path": "microcom.runtime/0.11.0",
|
|
||||||
"hashPath": "microcom.runtime.0.11.0.nupkg.sha512"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
BIN
Binary file not shown.
-4
@@ -1,4 +0,0 @@
|
|||||||
// <autogenerated />
|
|
||||||
using System;
|
|
||||||
using System.Reflection;
|
|
||||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
19347f0fd9099e96da933911861c08405b49d004b7b88b97423c17bee0eb100f
|
|
||||||
-24
@@ -1,24 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// This code was generated by a tool.
|
|
||||||
//
|
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
|
||||||
// the code is regenerated.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Reflection;
|
|
||||||
|
|
||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("NeoRF")]
|
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
|
||||||
[assembly: System.Reflection.AssemblyDescriptionAttribute("Earth Model 模型契约:启动器与模型之间唯一的编译期依赖。")]
|
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.3.0")]
|
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.3")]
|
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("Earth Model Studio")]
|
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("EarthModelStudio.ModelSdk")]
|
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.3.0")]
|
|
||||||
[assembly: System.Resources.NeutralResourcesLanguageAttribute("zh-Hans")]
|
|
||||||
|
|
||||||
// Generated by the MSBuild WriteCodeFragment class.
|
|
||||||
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
b335d297927ccf5a0daf4e3ae36efd34dab2da4d5a059ac53a2e5ec720bc9741
|
|
||||||
-25
@@ -1,25 +0,0 @@
|
|||||||
is_global = true
|
|
||||||
build_property.AvaloniaNameGeneratorIsEnabled = true
|
|
||||||
build_property.AvaloniaNameGeneratorBehavior = InitializeComponent
|
|
||||||
build_property.AvaloniaNameGeneratorDefaultFieldModifier = internal
|
|
||||||
build_property.AvaloniaNameGeneratorFilterByPath = *
|
|
||||||
build_property.AvaloniaNameGeneratorFilterByNamespace = *
|
|
||||||
build_property.AvaloniaNameGeneratorViewFileNamingStrategy = NamespaceAndClassName
|
|
||||||
build_property.AvaloniaNameGeneratorAttachDevTools = true
|
|
||||||
build_property.TargetFramework = net8.0
|
|
||||||
build_property.TargetFrameworkIdentifier = .NETCoreApp
|
|
||||||
build_property.TargetFrameworkVersion = v8.0
|
|
||||||
build_property.TargetPlatformMinVersion =
|
|
||||||
build_property.UsingMicrosoftNETSdkWeb =
|
|
||||||
build_property.ProjectTypeGuids =
|
|
||||||
build_property.InvariantGlobalization =
|
|
||||||
build_property.PlatformNeutralAssembly =
|
|
||||||
build_property.EnforceExtendedAnalyzerRules =
|
|
||||||
build_property.EntryPointFilePath =
|
|
||||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
|
||||||
build_property.RootNamespace = EarthModelStudio.ModelSdk
|
|
||||||
build_property.ProjectDir = /Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/
|
|
||||||
build_property.EnableComHosting =
|
|
||||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
|
||||||
build_property.EffectiveAnalysisLevelStyle = 8.0
|
|
||||||
build_property.EnableCodeStyleSeverity =
|
|
||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
-1
@@ -1 +0,0 @@
|
|||||||
700a4b41f184bc7a11bf82dedb3429528bb388b5fb0ec5c68baea6f472087bef
|
|
||||||
-13
@@ -1,13 +0,0 @@
|
|||||||
/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/bin/Debug/net8.0/EarthModelStudio.ModelSdk.deps.json
|
|
||||||
/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/bin/Debug/net8.0/EarthModelStudio.ModelSdk.dll
|
|
||||||
/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/bin/Debug/net8.0/EarthModelStudio.ModelSdk.pdb
|
|
||||||
/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/obj/Debug/net8.0/EarthModelStudio.ModelSdk.csproj.AssemblyReference.cache
|
|
||||||
/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/obj/Debug/net8.0/Avalonia/Resources.Inputs.cache
|
|
||||||
/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/obj/Debug/net8.0/EarthModelStudio.ModelSdk.GeneratedMSBuildEditorConfig.editorconfig
|
|
||||||
/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/obj/Debug/net8.0/EarthModelStudio.ModelSdk.AssemblyInfoInputs.cache
|
|
||||||
/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/obj/Debug/net8.0/EarthModelStudio.ModelSdk.AssemblyInfo.cs
|
|
||||||
/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/obj/Debug/net8.0/EarthModelStudio.ModelSdk.csproj.CoreCompileInputs.cache
|
|
||||||
/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/obj/Debug/net8.0/EarthModelStudio.ModelSdk.dll
|
|
||||||
/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/obj/Debug/net8.0/refint/EarthModelStudio.ModelSdk.dll
|
|
||||||
/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/obj/Debug/net8.0/EarthModelStudio.ModelSdk.pdb
|
|
||||||
/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/obj/Debug/net8.0/ref/EarthModelStudio.ModelSdk.dll
|
|
||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
-96
@@ -1,96 +0,0 @@
|
|||||||
{
|
|
||||||
"format": 1,
|
|
||||||
"restore": {
|
|
||||||
"/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/EarthModelStudio.ModelSdk.csproj": {}
|
|
||||||
},
|
|
||||||
"projects": {
|
|
||||||
"/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/EarthModelStudio.ModelSdk.csproj": {
|
|
||||||
"version": "1.0.3",
|
|
||||||
"restore": {
|
|
||||||
"projectUniqueName": "/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/EarthModelStudio.ModelSdk.csproj",
|
|
||||||
"projectName": "EarthModelStudio.ModelSdk",
|
|
||||||
"projectPath": "/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/EarthModelStudio.ModelSdk.csproj",
|
|
||||||
"packagesPath": "/Users/morris/.nuget/packages/",
|
|
||||||
"outputPath": "/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/obj/",
|
|
||||||
"projectStyle": "PackageReference",
|
|
||||||
"configFilePaths": [
|
|
||||||
"/Users/morris/.nuget/NuGet/NuGet.Config"
|
|
||||||
],
|
|
||||||
"originalTargetFrameworks": [
|
|
||||||
"net8.0"
|
|
||||||
],
|
|
||||||
"sources": {
|
|
||||||
"https://api.nuget.org/v3/index.json": {}
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net8.0": {
|
|
||||||
"framework": "net8.0",
|
|
||||||
"targetAlias": "net8.0",
|
|
||||||
"projectReferences": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"warningProperties": {
|
|
||||||
"warnAsError": [
|
|
||||||
"NU1605"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"restoreAuditProperties": {
|
|
||||||
"enableAudit": "true",
|
|
||||||
"auditLevel": "low",
|
|
||||||
"auditMode": "direct"
|
|
||||||
},
|
|
||||||
"SdkAnalysisLevel": "10.0.400"
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net8.0": {
|
|
||||||
"framework": "net8.0",
|
|
||||||
"targetAlias": "net8.0",
|
|
||||||
"dependencies": {
|
|
||||||
"Avalonia": {
|
|
||||||
"target": "Package",
|
|
||||||
"version": "[11.3.9, )"
|
|
||||||
},
|
|
||||||
"Microsoft.NET.ILLink.Tasks": {
|
|
||||||
"suppressParent": "All",
|
|
||||||
"target": "Package",
|
|
||||||
"version": "[8.0.31, )",
|
|
||||||
"autoReferenced": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"imports": [
|
|
||||||
"net461",
|
|
||||||
"net462",
|
|
||||||
"net47",
|
|
||||||
"net471",
|
|
||||||
"net472",
|
|
||||||
"net48",
|
|
||||||
"net481"
|
|
||||||
],
|
|
||||||
"assetTargetFallback": true,
|
|
||||||
"warn": true,
|
|
||||||
"downloadDependencies": [
|
|
||||||
{
|
|
||||||
"name": "Microsoft.AspNetCore.App.Runtime.win-arm64",
|
|
||||||
"version": "[8.0.31, 8.0.31]"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Microsoft.NETCore.App.Runtime.win-arm64",
|
|
||||||
"version": "[8.0.31, 8.0.31]"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"frameworkReferences": {
|
|
||||||
"Microsoft.NETCore.App": {
|
|
||||||
"privateAssets": "all"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/10.0.401/PortableRuntimeIdentifierGraph.json"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"runtimes": {
|
|
||||||
"win-arm64": {
|
|
||||||
"#import": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-24
@@ -1,24 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
|
||||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
|
||||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
|
||||||
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
|
||||||
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
|
||||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/Users/morris/.nuget/packages/</NuGetPackageRoot>
|
|
||||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/Users/morris/.nuget/packages/</NuGetPackageFolders>
|
|
||||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
|
||||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">7.0.0</NuGetToolVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
|
||||||
<SourceRoot Include="/Users/morris/.nuget/packages/" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
|
||||||
<Import Project="$(NuGetPackageRoot)microsoft.net.illink.tasks/8.0.31/build/Microsoft.NET.ILLink.Tasks.props" Condition="Exists('$(NuGetPackageRoot)microsoft.net.illink.tasks/8.0.31/build/Microsoft.NET.ILLink.Tasks.props')" />
|
|
||||||
<Import Project="$(NuGetPackageRoot)avalonia/11.3.9/buildTransitive/Avalonia.props" Condition="Exists('$(NuGetPackageRoot)avalonia/11.3.9/buildTransitive/Avalonia.props')" />
|
|
||||||
</ImportGroup>
|
|
||||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
|
||||||
<PkgMicrosoft_NET_ILLink_Tasks Condition=" '$(PkgMicrosoft_NET_ILLink_Tasks)' == '' ">/Users/morris/.nuget/packages/microsoft.net.illink.tasks/8.0.31</PkgMicrosoft_NET_ILLink_Tasks>
|
|
||||||
<PkgAvalonia_BuildServices Condition=" '$(PkgAvalonia_BuildServices)' == '' ">/Users/morris/.nuget/packages/avalonia.buildservices/11.3.2</PkgAvalonia_BuildServices>
|
|
||||||
<PkgAvalonia Condition=" '$(PkgAvalonia)' == '' ">/Users/morris/.nuget/packages/avalonia/11.3.9</PkgAvalonia>
|
|
||||||
</PropertyGroup>
|
|
||||||
</Project>
|
|
||||||
-7
@@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
|
||||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
|
||||||
<Import Project="$(NuGetPackageRoot)avalonia.buildservices/11.3.2/buildTransitive/Avalonia.BuildServices.targets" Condition="Exists('$(NuGetPackageRoot)avalonia.buildservices/11.3.2/buildTransitive/Avalonia.BuildServices.targets')" />
|
|
||||||
<Import Project="$(NuGetPackageRoot)avalonia/11.3.9/buildTransitive/Avalonia.targets" Condition="Exists('$(NuGetPackageRoot)avalonia/11.3.9/buildTransitive/Avalonia.targets')" />
|
|
||||||
</ImportGroup>
|
|
||||||
</Project>
|
|
||||||
-4
@@ -1,4 +0,0 @@
|
|||||||
// <autogenerated />
|
|
||||||
using System;
|
|
||||||
using System.Reflection;
|
|
||||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
19347f0fd9099e96da933911861c08405b49d004b7b88b97423c17bee0eb100f
|
|
||||||
-24
@@ -1,24 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// This code was generated by a tool.
|
|
||||||
//
|
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
|
||||||
// the code is regenerated.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Reflection;
|
|
||||||
|
|
||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("NeoRF")]
|
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
|
|
||||||
[assembly: System.Reflection.AssemblyDescriptionAttribute("Earth Model 模型契约:启动器与模型之间唯一的编译期依赖。")]
|
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.3.0")]
|
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.3")]
|
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("Earth Model Studio")]
|
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("EarthModelStudio.ModelSdk")]
|
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.3.0")]
|
|
||||||
[assembly: System.Resources.NeutralResourcesLanguageAttribute("zh-Hans")]
|
|
||||||
|
|
||||||
// Generated by the MSBuild WriteCodeFragment class.
|
|
||||||
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
336916da7664ce932095ba041eac38a72bfaee332d45c8339c55e418ea5f5a20
|
|
||||||
-29
@@ -1,29 +0,0 @@
|
|||||||
is_global = true
|
|
||||||
build_property.EnableAotAnalyzer =
|
|
||||||
build_property.EnableSingleFileAnalyzer = true
|
|
||||||
build_property.EnableTrimAnalyzer =
|
|
||||||
build_property.IncludeAllContentForSelfExtract =
|
|
||||||
build_property.AvaloniaNameGeneratorIsEnabled = true
|
|
||||||
build_property.AvaloniaNameGeneratorBehavior = InitializeComponent
|
|
||||||
build_property.AvaloniaNameGeneratorDefaultFieldModifier = internal
|
|
||||||
build_property.AvaloniaNameGeneratorFilterByPath = *
|
|
||||||
build_property.AvaloniaNameGeneratorFilterByNamespace = *
|
|
||||||
build_property.AvaloniaNameGeneratorViewFileNamingStrategy = NamespaceAndClassName
|
|
||||||
build_property.AvaloniaNameGeneratorAttachDevTools = true
|
|
||||||
build_property.TargetFramework = net8.0
|
|
||||||
build_property.TargetFrameworkIdentifier = .NETCoreApp
|
|
||||||
build_property.TargetFrameworkVersion = v8.0
|
|
||||||
build_property.TargetPlatformMinVersion =
|
|
||||||
build_property.UsingMicrosoftNETSdkWeb =
|
|
||||||
build_property.ProjectTypeGuids =
|
|
||||||
build_property.InvariantGlobalization =
|
|
||||||
build_property.PlatformNeutralAssembly =
|
|
||||||
build_property.EnforceExtendedAnalyzerRules =
|
|
||||||
build_property.EntryPointFilePath =
|
|
||||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
|
||||||
build_property.RootNamespace = EarthModelStudio.ModelSdk
|
|
||||||
build_property.ProjectDir = /Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/
|
|
||||||
build_property.EnableComHosting =
|
|
||||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
|
||||||
build_property.EffectiveAnalysisLevelStyle = 8.0
|
|
||||||
build_property.EnableCodeStyleSeverity =
|
|
||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
-1
@@ -1 +0,0 @@
|
|||||||
1ab491e560668f97a7c06bde5290baec8ff1947cd02855cf82f1f7a392fd58bf
|
|
||||||
-11
@@ -1,11 +0,0 @@
|
|||||||
/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/bin/Release/net8.0/EarthModelStudio.ModelSdk.deps.json
|
|
||||||
/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/bin/Release/net8.0/EarthModelStudio.ModelSdk.dll
|
|
||||||
/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/obj/Release/net8.0/EarthModelStudio.ModelSdk.csproj.AssemblyReference.cache
|
|
||||||
/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/obj/Release/net8.0/Avalonia/Resources.Inputs.cache
|
|
||||||
/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/obj/Release/net8.0/EarthModelStudio.ModelSdk.GeneratedMSBuildEditorConfig.editorconfig
|
|
||||||
/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/obj/Release/net8.0/EarthModelStudio.ModelSdk.AssemblyInfoInputs.cache
|
|
||||||
/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/obj/Release/net8.0/EarthModelStudio.ModelSdk.AssemblyInfo.cs
|
|
||||||
/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/obj/Release/net8.0/EarthModelStudio.ModelSdk.csproj.CoreCompileInputs.cache
|
|
||||||
/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/obj/Release/net8.0/EarthModelStudio.ModelSdk.dll
|
|
||||||
/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/obj/Release/net8.0/refint/EarthModelStudio.ModelSdk.dll
|
|
||||||
/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/obj/Release/net8.0/ref/EarthModelStudio.ModelSdk.dll
|
|
||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
-610
@@ -1,610 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 4,
|
|
||||||
"targets": {
|
|
||||||
"net8.0": {
|
|
||||||
"Avalonia/11.3.9": {
|
|
||||||
"type": "package",
|
|
||||||
"dependencies": {
|
|
||||||
"Avalonia.BuildServices": "11.3.2",
|
|
||||||
"Avalonia.Remote.Protocol": "11.3.9",
|
|
||||||
"MicroCom.Runtime": "0.11.0"
|
|
||||||
},
|
|
||||||
"compile": {
|
|
||||||
"ref/net8.0/Avalonia.Base.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"ref/net8.0/Avalonia.Controls.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"ref/net8.0/Avalonia.DesignerSupport.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"ref/net8.0/Avalonia.Dialogs.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"ref/net8.0/Avalonia.Markup.Xaml.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"ref/net8.0/Avalonia.Markup.dll": {
|
|
||||||
"related": ".Xaml.xml;.xml"
|
|
||||||
},
|
|
||||||
"ref/net8.0/Avalonia.Metal.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"ref/net8.0/Avalonia.MicroCom.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"ref/net8.0/Avalonia.OpenGL.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"ref/net8.0/Avalonia.Vulkan.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"ref/net8.0/Avalonia.dll": {
|
|
||||||
"related": ".Base.xml;.Controls.xml;.DesignerSupport.xml;.Dialogs.xml;.Markup.Xaml.xml;.Markup.xml;.Metal.xml;.MicroCom.xml;.OpenGL.xml;.Vulkan.xml;.xml"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"runtime": {
|
|
||||||
"lib/net8.0/Avalonia.Base.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.Controls.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.DesignerSupport.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.Dialogs.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.Markup.Xaml.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.Markup.dll": {
|
|
||||||
"related": ".Xaml.xml;.xml"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.Metal.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.MicroCom.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.OpenGL.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.Vulkan.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.dll": {
|
|
||||||
"related": ".Base.xml;.Controls.xml;.DesignerSupport.xml;.Dialogs.xml;.Markup.Xaml.xml;.Markup.xml;.Metal.xml;.MicroCom.xml;.OpenGL.xml;.Vulkan.xml;.xml"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"build": {
|
|
||||||
"buildTransitive/Avalonia.props": {},
|
|
||||||
"buildTransitive/Avalonia.targets": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Avalonia.BuildServices/11.3.2": {
|
|
||||||
"type": "package",
|
|
||||||
"build": {
|
|
||||||
"buildTransitive/Avalonia.BuildServices.targets": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Avalonia.Remote.Protocol/11.3.9": {
|
|
||||||
"type": "package",
|
|
||||||
"compile": {
|
|
||||||
"lib/net8.0/Avalonia.Remote.Protocol.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"runtime": {
|
|
||||||
"lib/net8.0/Avalonia.Remote.Protocol.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"MicroCom.Runtime/0.11.0": {
|
|
||||||
"type": "package",
|
|
||||||
"compile": {
|
|
||||||
"lib/net5.0/MicroCom.Runtime.dll": {}
|
|
||||||
},
|
|
||||||
"runtime": {
|
|
||||||
"lib/net5.0/MicroCom.Runtime.dll": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Microsoft.NET.ILLink.Tasks/8.0.31": {
|
|
||||||
"type": "package",
|
|
||||||
"build": {
|
|
||||||
"build/Microsoft.NET.ILLink.Tasks.props": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"net8.0/win-arm64": {
|
|
||||||
"Avalonia/11.3.9": {
|
|
||||||
"type": "package",
|
|
||||||
"dependencies": {
|
|
||||||
"Avalonia.BuildServices": "11.3.2",
|
|
||||||
"Avalonia.Remote.Protocol": "11.3.9",
|
|
||||||
"MicroCom.Runtime": "0.11.0"
|
|
||||||
},
|
|
||||||
"compile": {
|
|
||||||
"ref/net8.0/Avalonia.Base.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"ref/net8.0/Avalonia.Controls.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"ref/net8.0/Avalonia.DesignerSupport.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"ref/net8.0/Avalonia.Dialogs.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"ref/net8.0/Avalonia.Markup.Xaml.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"ref/net8.0/Avalonia.Markup.dll": {
|
|
||||||
"related": ".Xaml.xml;.xml"
|
|
||||||
},
|
|
||||||
"ref/net8.0/Avalonia.Metal.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"ref/net8.0/Avalonia.MicroCom.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"ref/net8.0/Avalonia.OpenGL.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"ref/net8.0/Avalonia.Vulkan.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"ref/net8.0/Avalonia.dll": {
|
|
||||||
"related": ".Base.xml;.Controls.xml;.DesignerSupport.xml;.Dialogs.xml;.Markup.Xaml.xml;.Markup.xml;.Metal.xml;.MicroCom.xml;.OpenGL.xml;.Vulkan.xml;.xml"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"runtime": {
|
|
||||||
"lib/net8.0/Avalonia.Base.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.Controls.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.DesignerSupport.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.Dialogs.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.Markup.Xaml.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.Markup.dll": {
|
|
||||||
"related": ".Xaml.xml;.xml"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.Metal.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.MicroCom.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.OpenGL.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.Vulkan.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
},
|
|
||||||
"lib/net8.0/Avalonia.dll": {
|
|
||||||
"related": ".Base.xml;.Controls.xml;.DesignerSupport.xml;.Dialogs.xml;.Markup.Xaml.xml;.Markup.xml;.Metal.xml;.MicroCom.xml;.OpenGL.xml;.Vulkan.xml;.xml"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"build": {
|
|
||||||
"buildTransitive/Avalonia.props": {},
|
|
||||||
"buildTransitive/Avalonia.targets": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Avalonia.BuildServices/11.3.2": {
|
|
||||||
"type": "package",
|
|
||||||
"build": {
|
|
||||||
"buildTransitive/Avalonia.BuildServices.targets": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Avalonia.Remote.Protocol/11.3.9": {
|
|
||||||
"type": "package",
|
|
||||||
"compile": {
|
|
||||||
"lib/net8.0/Avalonia.Remote.Protocol.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"runtime": {
|
|
||||||
"lib/net8.0/Avalonia.Remote.Protocol.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"MicroCom.Runtime/0.11.0": {
|
|
||||||
"type": "package",
|
|
||||||
"compile": {
|
|
||||||
"lib/net5.0/MicroCom.Runtime.dll": {}
|
|
||||||
},
|
|
||||||
"runtime": {
|
|
||||||
"lib/net5.0/MicroCom.Runtime.dll": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Microsoft.NET.ILLink.Tasks/8.0.31": {
|
|
||||||
"type": "package",
|
|
||||||
"build": {
|
|
||||||
"build/Microsoft.NET.ILLink.Tasks.props": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"libraries": {
|
|
||||||
"Avalonia/11.3.9": {
|
|
||||||
"sha512": "YfaTrUxcmVTsGOw2YqdZyunHqZArK16m1pYfNIBvyvAgX89Pzd3A1PgoMkf64u7scL23IN6HkfqhZeFcbYWLoA==",
|
|
||||||
"type": "package",
|
|
||||||
"path": "avalonia/11.3.9",
|
|
||||||
"hasTools": true,
|
|
||||||
"files": [
|
|
||||||
".nupkg.metadata",
|
|
||||||
".signature.p7s",
|
|
||||||
"Icon.png",
|
|
||||||
"analyzers/dotnet/cs/Avalonia.Analyzers.dll",
|
|
||||||
"analyzers/dotnet/cs/Avalonia.Generators.dll",
|
|
||||||
"avalonia.11.3.9.nupkg.sha512",
|
|
||||||
"avalonia.nuspec",
|
|
||||||
"build/Avalonia.Generators.props",
|
|
||||||
"build/Avalonia.props",
|
|
||||||
"build/Avalonia.targets",
|
|
||||||
"build/AvaloniaBuildTasks.props",
|
|
||||||
"build/AvaloniaBuildTasks.targets",
|
|
||||||
"build/AvaloniaItemSchema.xaml",
|
|
||||||
"build/AvaloniaPrivateApis.targets",
|
|
||||||
"build/AvaloniaRules.Project.xml",
|
|
||||||
"build/AvaloniaSingleProject.targets",
|
|
||||||
"build/AvaloniaVersion.props",
|
|
||||||
"buildTransitive/Avalonia.Generators.props",
|
|
||||||
"buildTransitive/Avalonia.props",
|
|
||||||
"buildTransitive/Avalonia.targets",
|
|
||||||
"buildTransitive/AvaloniaBuildTasks.props",
|
|
||||||
"buildTransitive/AvaloniaBuildTasks.targets",
|
|
||||||
"buildTransitive/AvaloniaItemSchema.xaml",
|
|
||||||
"buildTransitive/AvaloniaPrivateApis.targets",
|
|
||||||
"buildTransitive/AvaloniaRules.Project.xml",
|
|
||||||
"buildTransitive/AvaloniaSingleProject.targets",
|
|
||||||
"lib/net6.0/Avalonia.Base.dll",
|
|
||||||
"lib/net6.0/Avalonia.Base.xml",
|
|
||||||
"lib/net6.0/Avalonia.Controls.dll",
|
|
||||||
"lib/net6.0/Avalonia.Controls.xml",
|
|
||||||
"lib/net6.0/Avalonia.DesignerSupport.dll",
|
|
||||||
"lib/net6.0/Avalonia.DesignerSupport.xml",
|
|
||||||
"lib/net6.0/Avalonia.Dialogs.dll",
|
|
||||||
"lib/net6.0/Avalonia.Dialogs.xml",
|
|
||||||
"lib/net6.0/Avalonia.Markup.Xaml.dll",
|
|
||||||
"lib/net6.0/Avalonia.Markup.Xaml.xml",
|
|
||||||
"lib/net6.0/Avalonia.Markup.dll",
|
|
||||||
"lib/net6.0/Avalonia.Markup.xml",
|
|
||||||
"lib/net6.0/Avalonia.Metal.dll",
|
|
||||||
"lib/net6.0/Avalonia.Metal.xml",
|
|
||||||
"lib/net6.0/Avalonia.MicroCom.dll",
|
|
||||||
"lib/net6.0/Avalonia.MicroCom.xml",
|
|
||||||
"lib/net6.0/Avalonia.OpenGL.dll",
|
|
||||||
"lib/net6.0/Avalonia.OpenGL.xml",
|
|
||||||
"lib/net6.0/Avalonia.Vulkan.dll",
|
|
||||||
"lib/net6.0/Avalonia.Vulkan.xml",
|
|
||||||
"lib/net6.0/Avalonia.dll",
|
|
||||||
"lib/net6.0/Avalonia.xml",
|
|
||||||
"lib/net8.0/Avalonia.Base.dll",
|
|
||||||
"lib/net8.0/Avalonia.Base.xml",
|
|
||||||
"lib/net8.0/Avalonia.Controls.dll",
|
|
||||||
"lib/net8.0/Avalonia.Controls.xml",
|
|
||||||
"lib/net8.0/Avalonia.DesignerSupport.dll",
|
|
||||||
"lib/net8.0/Avalonia.DesignerSupport.xml",
|
|
||||||
"lib/net8.0/Avalonia.Dialogs.dll",
|
|
||||||
"lib/net8.0/Avalonia.Dialogs.xml",
|
|
||||||
"lib/net8.0/Avalonia.Markup.Xaml.dll",
|
|
||||||
"lib/net8.0/Avalonia.Markup.Xaml.xml",
|
|
||||||
"lib/net8.0/Avalonia.Markup.dll",
|
|
||||||
"lib/net8.0/Avalonia.Markup.xml",
|
|
||||||
"lib/net8.0/Avalonia.Metal.dll",
|
|
||||||
"lib/net8.0/Avalonia.Metal.xml",
|
|
||||||
"lib/net8.0/Avalonia.MicroCom.dll",
|
|
||||||
"lib/net8.0/Avalonia.MicroCom.xml",
|
|
||||||
"lib/net8.0/Avalonia.OpenGL.dll",
|
|
||||||
"lib/net8.0/Avalonia.OpenGL.xml",
|
|
||||||
"lib/net8.0/Avalonia.Vulkan.dll",
|
|
||||||
"lib/net8.0/Avalonia.Vulkan.xml",
|
|
||||||
"lib/net8.0/Avalonia.dll",
|
|
||||||
"lib/net8.0/Avalonia.xml",
|
|
||||||
"lib/netstandard2.0/Avalonia.Base.dll",
|
|
||||||
"lib/netstandard2.0/Avalonia.Base.xml",
|
|
||||||
"lib/netstandard2.0/Avalonia.Controls.dll",
|
|
||||||
"lib/netstandard2.0/Avalonia.Controls.xml",
|
|
||||||
"lib/netstandard2.0/Avalonia.DesignerSupport.dll",
|
|
||||||
"lib/netstandard2.0/Avalonia.DesignerSupport.xml",
|
|
||||||
"lib/netstandard2.0/Avalonia.Dialogs.dll",
|
|
||||||
"lib/netstandard2.0/Avalonia.Dialogs.xml",
|
|
||||||
"lib/netstandard2.0/Avalonia.Markup.Xaml.dll",
|
|
||||||
"lib/netstandard2.0/Avalonia.Markup.Xaml.xml",
|
|
||||||
"lib/netstandard2.0/Avalonia.Markup.dll",
|
|
||||||
"lib/netstandard2.0/Avalonia.Markup.xml",
|
|
||||||
"lib/netstandard2.0/Avalonia.Metal.dll",
|
|
||||||
"lib/netstandard2.0/Avalonia.Metal.xml",
|
|
||||||
"lib/netstandard2.0/Avalonia.MicroCom.dll",
|
|
||||||
"lib/netstandard2.0/Avalonia.MicroCom.xml",
|
|
||||||
"lib/netstandard2.0/Avalonia.OpenGL.dll",
|
|
||||||
"lib/netstandard2.0/Avalonia.OpenGL.xml",
|
|
||||||
"lib/netstandard2.0/Avalonia.Vulkan.dll",
|
|
||||||
"lib/netstandard2.0/Avalonia.Vulkan.xml",
|
|
||||||
"lib/netstandard2.0/Avalonia.dll",
|
|
||||||
"lib/netstandard2.0/Avalonia.xml",
|
|
||||||
"ref/net6.0/Avalonia.Base.dll",
|
|
||||||
"ref/net6.0/Avalonia.Base.xml",
|
|
||||||
"ref/net6.0/Avalonia.Controls.dll",
|
|
||||||
"ref/net6.0/Avalonia.Controls.xml",
|
|
||||||
"ref/net6.0/Avalonia.DesignerSupport.dll",
|
|
||||||
"ref/net6.0/Avalonia.DesignerSupport.xml",
|
|
||||||
"ref/net6.0/Avalonia.Dialogs.dll",
|
|
||||||
"ref/net6.0/Avalonia.Dialogs.xml",
|
|
||||||
"ref/net6.0/Avalonia.Markup.Xaml.dll",
|
|
||||||
"ref/net6.0/Avalonia.Markup.Xaml.xml",
|
|
||||||
"ref/net6.0/Avalonia.Markup.dll",
|
|
||||||
"ref/net6.0/Avalonia.Markup.xml",
|
|
||||||
"ref/net6.0/Avalonia.Metal.dll",
|
|
||||||
"ref/net6.0/Avalonia.Metal.xml",
|
|
||||||
"ref/net6.0/Avalonia.MicroCom.dll",
|
|
||||||
"ref/net6.0/Avalonia.MicroCom.xml",
|
|
||||||
"ref/net6.0/Avalonia.OpenGL.dll",
|
|
||||||
"ref/net6.0/Avalonia.OpenGL.xml",
|
|
||||||
"ref/net6.0/Avalonia.Vulkan.dll",
|
|
||||||
"ref/net6.0/Avalonia.Vulkan.xml",
|
|
||||||
"ref/net6.0/Avalonia.dll",
|
|
||||||
"ref/net6.0/Avalonia.xml",
|
|
||||||
"ref/net8.0/Avalonia.Base.dll",
|
|
||||||
"ref/net8.0/Avalonia.Base.xml",
|
|
||||||
"ref/net8.0/Avalonia.Controls.dll",
|
|
||||||
"ref/net8.0/Avalonia.Controls.xml",
|
|
||||||
"ref/net8.0/Avalonia.DesignerSupport.dll",
|
|
||||||
"ref/net8.0/Avalonia.DesignerSupport.xml",
|
|
||||||
"ref/net8.0/Avalonia.Dialogs.dll",
|
|
||||||
"ref/net8.0/Avalonia.Dialogs.xml",
|
|
||||||
"ref/net8.0/Avalonia.Markup.Xaml.dll",
|
|
||||||
"ref/net8.0/Avalonia.Markup.Xaml.xml",
|
|
||||||
"ref/net8.0/Avalonia.Markup.dll",
|
|
||||||
"ref/net8.0/Avalonia.Markup.xml",
|
|
||||||
"ref/net8.0/Avalonia.Metal.dll",
|
|
||||||
"ref/net8.0/Avalonia.Metal.xml",
|
|
||||||
"ref/net8.0/Avalonia.MicroCom.dll",
|
|
||||||
"ref/net8.0/Avalonia.MicroCom.xml",
|
|
||||||
"ref/net8.0/Avalonia.OpenGL.dll",
|
|
||||||
"ref/net8.0/Avalonia.OpenGL.xml",
|
|
||||||
"ref/net8.0/Avalonia.Vulkan.dll",
|
|
||||||
"ref/net8.0/Avalonia.Vulkan.xml",
|
|
||||||
"ref/net8.0/Avalonia.dll",
|
|
||||||
"ref/net8.0/Avalonia.xml",
|
|
||||||
"ref/netstandard2.0/Avalonia.Base.dll",
|
|
||||||
"ref/netstandard2.0/Avalonia.Base.xml",
|
|
||||||
"ref/netstandard2.0/Avalonia.Controls.dll",
|
|
||||||
"ref/netstandard2.0/Avalonia.Controls.xml",
|
|
||||||
"ref/netstandard2.0/Avalonia.DesignerSupport.dll",
|
|
||||||
"ref/netstandard2.0/Avalonia.DesignerSupport.xml",
|
|
||||||
"ref/netstandard2.0/Avalonia.Dialogs.dll",
|
|
||||||
"ref/netstandard2.0/Avalonia.Dialogs.xml",
|
|
||||||
"ref/netstandard2.0/Avalonia.Markup.Xaml.dll",
|
|
||||||
"ref/netstandard2.0/Avalonia.Markup.Xaml.xml",
|
|
||||||
"ref/netstandard2.0/Avalonia.Markup.dll",
|
|
||||||
"ref/netstandard2.0/Avalonia.Markup.xml",
|
|
||||||
"ref/netstandard2.0/Avalonia.Metal.dll",
|
|
||||||
"ref/netstandard2.0/Avalonia.Metal.xml",
|
|
||||||
"ref/netstandard2.0/Avalonia.MicroCom.dll",
|
|
||||||
"ref/netstandard2.0/Avalonia.MicroCom.xml",
|
|
||||||
"ref/netstandard2.0/Avalonia.OpenGL.dll",
|
|
||||||
"ref/netstandard2.0/Avalonia.OpenGL.xml",
|
|
||||||
"ref/netstandard2.0/Avalonia.Vulkan.dll",
|
|
||||||
"ref/netstandard2.0/Avalonia.Vulkan.xml",
|
|
||||||
"ref/netstandard2.0/Avalonia.dll",
|
|
||||||
"ref/netstandard2.0/Avalonia.xml",
|
|
||||||
"tools/net461/designer/Avalonia.Designer.HostApp.exe",
|
|
||||||
"tools/netstandard2.0/Avalonia.Build.Tasks.dll",
|
|
||||||
"tools/netstandard2.0/designer/Avalonia.Designer.HostApp.dll"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"Avalonia.BuildServices/11.3.2": {
|
|
||||||
"sha512": "qHDToxto1e3hci5YqbG9n0Ty8mlp3zBUN5wT66wKqaDVzXyQ0do3EnRILd4Ke9jpvsktaPpgE0YjEk7hornryQ==",
|
|
||||||
"type": "package",
|
|
||||||
"path": "avalonia.buildservices/11.3.2",
|
|
||||||
"hasTools": true,
|
|
||||||
"files": [
|
|
||||||
".nupkg.metadata",
|
|
||||||
".signature.p7s",
|
|
||||||
"Icon.png",
|
|
||||||
"README.md",
|
|
||||||
"avalonia.buildservices.11.3.2.nupkg.sha512",
|
|
||||||
"avalonia.buildservices.nuspec",
|
|
||||||
"build/Avalonia.BuildServices.targets",
|
|
||||||
"buildTransitive/Avalonia.BuildServices.targets",
|
|
||||||
"tools/netstandard2.0/Avalonia.BuildServices.Collector.dll",
|
|
||||||
"tools/netstandard2.0/Avalonia.BuildServices.dll",
|
|
||||||
"tools/netstandard2.0/runtimeconfig.json"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"Avalonia.Remote.Protocol/11.3.9": {
|
|
||||||
"sha512": "2XVLTSNa+Nvwu4D8NqqdudhllTaCRA9ZKlLZZvYLZeuLlzg7OcAV+df/biHQc6AqOv7iMFR9K5Zt3wG0EF4KfQ==",
|
|
||||||
"type": "package",
|
|
||||||
"path": "avalonia.remote.protocol/11.3.9",
|
|
||||||
"files": [
|
|
||||||
".nupkg.metadata",
|
|
||||||
".signature.p7s",
|
|
||||||
"Icon.png",
|
|
||||||
"avalonia.remote.protocol.11.3.9.nupkg.sha512",
|
|
||||||
"avalonia.remote.protocol.nuspec",
|
|
||||||
"lib/net6.0/Avalonia.Remote.Protocol.dll",
|
|
||||||
"lib/net6.0/Avalonia.Remote.Protocol.xml",
|
|
||||||
"lib/net8.0/Avalonia.Remote.Protocol.dll",
|
|
||||||
"lib/net8.0/Avalonia.Remote.Protocol.xml",
|
|
||||||
"lib/netstandard2.0/Avalonia.Remote.Protocol.dll",
|
|
||||||
"lib/netstandard2.0/Avalonia.Remote.Protocol.xml"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"MicroCom.Runtime/0.11.0": {
|
|
||||||
"sha512": "MEnrZ3UIiH40hjzMDsxrTyi8dtqB5ziv3iBeeU4bXsL/7NLSal9F1lZKpK+tfBRnUoDSdtcW3KufE4yhATOMCA==",
|
|
||||||
"type": "package",
|
|
||||||
"path": "microcom.runtime/0.11.0",
|
|
||||||
"files": [
|
|
||||||
".nupkg.metadata",
|
|
||||||
".signature.p7s",
|
|
||||||
"lib/net5.0/MicroCom.Runtime.dll",
|
|
||||||
"lib/netstandard2.0/MicroCom.Runtime.dll",
|
|
||||||
"microcom.runtime.0.11.0.nupkg.sha512",
|
|
||||||
"microcom.runtime.nuspec"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"Microsoft.NET.ILLink.Tasks/8.0.31": {
|
|
||||||
"sha512": "OJdAGATV2QoVWL11zlDLEluA06q8rK+cgZR47ohrO8V+Qj5z9dlvN7bG9/0e5t0IOe+yD8tREC0bpsEgDGrzIQ==",
|
|
||||||
"type": "package",
|
|
||||||
"path": "microsoft.net.illink.tasks/8.0.31",
|
|
||||||
"hasTools": true,
|
|
||||||
"files": [
|
|
||||||
".nupkg.metadata",
|
|
||||||
".signature.p7s",
|
|
||||||
"Icon.png",
|
|
||||||
"LICENSE.TXT",
|
|
||||||
"Sdk/Sdk.props",
|
|
||||||
"THIRD-PARTY-NOTICES.TXT",
|
|
||||||
"analyzers/dotnet/cs/ILLink.CodeFixProvider.dll",
|
|
||||||
"analyzers/dotnet/cs/ILLink.RoslynAnalyzer.dll",
|
|
||||||
"build/Microsoft.NET.ILLink.Analyzers.props",
|
|
||||||
"build/Microsoft.NET.ILLink.Tasks.props",
|
|
||||||
"build/Microsoft.NET.ILLink.targets",
|
|
||||||
"microsoft.net.illink.tasks.8.0.31.nupkg.sha512",
|
|
||||||
"microsoft.net.illink.tasks.nuspec",
|
|
||||||
"tools/net472/ILLink.Tasks.dll",
|
|
||||||
"tools/net472/ILLink.Tasks.dll.config",
|
|
||||||
"tools/net472/Mono.Cecil.Mdb.dll",
|
|
||||||
"tools/net472/Mono.Cecil.Pdb.dll",
|
|
||||||
"tools/net472/Mono.Cecil.Rocks.dll",
|
|
||||||
"tools/net472/Mono.Cecil.dll",
|
|
||||||
"tools/net472/Sdk/Sdk.props",
|
|
||||||
"tools/net472/System.Buffers.dll",
|
|
||||||
"tools/net472/System.Collections.Immutable.dll",
|
|
||||||
"tools/net472/System.Memory.dll",
|
|
||||||
"tools/net472/System.Numerics.Vectors.dll",
|
|
||||||
"tools/net472/System.Reflection.Metadata.dll",
|
|
||||||
"tools/net472/System.Runtime.CompilerServices.Unsafe.dll",
|
|
||||||
"tools/net472/build/Microsoft.NET.ILLink.Analyzers.props",
|
|
||||||
"tools/net472/build/Microsoft.NET.ILLink.Tasks.props",
|
|
||||||
"tools/net472/build/Microsoft.NET.ILLink.targets",
|
|
||||||
"tools/net8.0/ILLink.Tasks.deps.json",
|
|
||||||
"tools/net8.0/ILLink.Tasks.dll",
|
|
||||||
"tools/net8.0/Mono.Cecil.Mdb.dll",
|
|
||||||
"tools/net8.0/Mono.Cecil.Pdb.dll",
|
|
||||||
"tools/net8.0/Mono.Cecil.Rocks.dll",
|
|
||||||
"tools/net8.0/Mono.Cecil.dll",
|
|
||||||
"tools/net8.0/Sdk/Sdk.props",
|
|
||||||
"tools/net8.0/build/Microsoft.NET.ILLink.Analyzers.props",
|
|
||||||
"tools/net8.0/build/Microsoft.NET.ILLink.Tasks.props",
|
|
||||||
"tools/net8.0/build/Microsoft.NET.ILLink.targets",
|
|
||||||
"tools/net8.0/illink.deps.json",
|
|
||||||
"tools/net8.0/illink.dll",
|
|
||||||
"tools/net8.0/illink.runtimeconfig.json",
|
|
||||||
"useSharedDesignerContext.txt"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"projectFileDependencyGroups": {
|
|
||||||
"net8.0": [
|
|
||||||
"Avalonia >= 11.3.9",
|
|
||||||
"Microsoft.NET.ILLink.Tasks >= 8.0.31"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"packageFolders": {
|
|
||||||
"/Users/morris/.nuget/packages/": {}
|
|
||||||
},
|
|
||||||
"project": {
|
|
||||||
"version": "1.0.3",
|
|
||||||
"restore": {
|
|
||||||
"projectUniqueName": "/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/EarthModelStudio.ModelSdk.csproj",
|
|
||||||
"projectName": "EarthModelStudio.ModelSdk",
|
|
||||||
"projectPath": "/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/EarthModelStudio.ModelSdk.csproj",
|
|
||||||
"packagesPath": "/Users/morris/.nuget/packages/",
|
|
||||||
"outputPath": "/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/obj/",
|
|
||||||
"projectStyle": "PackageReference",
|
|
||||||
"configFilePaths": [
|
|
||||||
"/Users/morris/.nuget/NuGet/NuGet.Config"
|
|
||||||
],
|
|
||||||
"originalTargetFrameworks": [
|
|
||||||
"net8.0"
|
|
||||||
],
|
|
||||||
"sources": {
|
|
||||||
"https://api.nuget.org/v3/index.json": {}
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net8.0": {
|
|
||||||
"framework": "net8.0",
|
|
||||||
"targetAlias": "net8.0",
|
|
||||||
"projectReferences": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"warningProperties": {
|
|
||||||
"warnAsError": [
|
|
||||||
"NU1605"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"restoreAuditProperties": {
|
|
||||||
"enableAudit": "true",
|
|
||||||
"auditLevel": "low",
|
|
||||||
"auditMode": "direct"
|
|
||||||
},
|
|
||||||
"SdkAnalysisLevel": "10.0.400"
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net8.0": {
|
|
||||||
"framework": "net8.0",
|
|
||||||
"targetAlias": "net8.0",
|
|
||||||
"dependencies": {
|
|
||||||
"Avalonia": {
|
|
||||||
"target": "Package",
|
|
||||||
"version": "[11.3.9, )"
|
|
||||||
},
|
|
||||||
"Microsoft.NET.ILLink.Tasks": {
|
|
||||||
"suppressParent": "All",
|
|
||||||
"target": "Package",
|
|
||||||
"version": "[8.0.31, )",
|
|
||||||
"autoReferenced": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"imports": [
|
|
||||||
"net461",
|
|
||||||
"net462",
|
|
||||||
"net47",
|
|
||||||
"net471",
|
|
||||||
"net472",
|
|
||||||
"net48",
|
|
||||||
"net481"
|
|
||||||
],
|
|
||||||
"assetTargetFallback": true,
|
|
||||||
"warn": true,
|
|
||||||
"downloadDependencies": [
|
|
||||||
{
|
|
||||||
"name": "Microsoft.AspNetCore.App.Runtime.win-arm64",
|
|
||||||
"version": "[8.0.31, 8.0.31]"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Microsoft.NETCore.App.Runtime.win-arm64",
|
|
||||||
"version": "[8.0.31, 8.0.31]"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"frameworkReferences": {
|
|
||||||
"Microsoft.NETCore.App": {
|
|
||||||
"privateAssets": "all"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/10.0.401/PortableRuntimeIdentifierGraph.json"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"runtimes": {
|
|
||||||
"win-arm64": {
|
|
||||||
"#import": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vendored
-16
@@ -1,16 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 2,
|
|
||||||
"dgSpecHash": "2wEgD3WME1E=",
|
|
||||||
"success": true,
|
|
||||||
"projectFilePath": "/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/EarthModelStudio.ModelSdk.csproj",
|
|
||||||
"expectedPackageFiles": [
|
|
||||||
"/Users/morris/.nuget/packages/avalonia/11.3.9/avalonia.11.3.9.nupkg.sha512",
|
|
||||||
"/Users/morris/.nuget/packages/avalonia.buildservices/11.3.2/avalonia.buildservices.11.3.2.nupkg.sha512",
|
|
||||||
"/Users/morris/.nuget/packages/avalonia.remote.protocol/11.3.9/avalonia.remote.protocol.11.3.9.nupkg.sha512",
|
|
||||||
"/Users/morris/.nuget/packages/microcom.runtime/0.11.0/microcom.runtime.0.11.0.nupkg.sha512",
|
|
||||||
"/Users/morris/.nuget/packages/microsoft.net.illink.tasks/8.0.31/microsoft.net.illink.tasks.8.0.31.nupkg.sha512",
|
|
||||||
"/Users/morris/.nuget/packages/microsoft.netcore.app.runtime.win-arm64/8.0.31/microsoft.netcore.app.runtime.win-arm64.8.0.31.nupkg.sha512",
|
|
||||||
"/Users/morris/.nuget/packages/microsoft.aspnetcore.app.runtime.win-arm64/8.0.31/microsoft.aspnetcore.app.runtime.win-arm64.8.0.31.nupkg.sha512"
|
|
||||||
],
|
|
||||||
"logs": []
|
|
||||||
}
|
|
||||||
-23
@@ -1,23 +0,0 @@
|
|||||||
{
|
|
||||||
"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": "NeoRF.EarthModels.GeographyModelFactory",
|
|
||||||
"author": "Morris GC",
|
|
||||||
"tags": [
|
|
||||||
"geography",
|
|
||||||
"earth",
|
|
||||||
"atlas"
|
|
||||||
],
|
|
||||||
"dataDir": "earth-geography.model",
|
|
||||||
"version": "1.0",
|
|
||||||
"updatedAt": "2026-11-08T09:22:29Z",
|
|
||||||
"build": "883fdf6c57"
|
|
||||||
}
|
|
||||||
BIN
Binary file not shown.
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"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":[[[43.3,12.6],[40.0,18.0],[38.5,22.0],[35.0,27.0],[34.5,29.0]]]},{"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":"白令海峡","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]]]}]}
|
|
||||||
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"lines":[[[179.999,-16.169],[179.564,-16.637],[179.568,-16.747],[179.93,-16.519],[179.928,-16.744],[179.419,-16.807],[179.202,-16.713],[179.007,-16.9],[178.707,-16.976],[178.604,-16.801],[178.497,-16.788],[178.584,-16.622],[178.805,-16.631],[178.961,-16.483],[179.552,-16.25],[179.999,-16.169]],[[143.179,-11.954],[143.11,-12.304],[143.402,-12.64],[143.587,-13.444],[143.548,-13.741],[143.756,-14.349],[143.962,-14.463],[144.473,-14.232],[144.648,-14.492],[145.288,-14.943],[145.272,-15.477],[145.458,-16.056],[145.426,-16.406],[145.755,-16.879],[145.912,-16.913],[146.126,-17.635],[146.032,-18.273],[146.333,-18.554],[146.297,-18.841],[146.383,-18.977],[147.139,-19.393],[147.419,-19.378],[147.742,-19.77],[148.759,-20.29],[148.885,-20.481],[148.73,-20.468],[148.684,-20.58],[149.205,-21.125],[149.329,-21.476],[149.454,-21.579],[149.704,-22.441],[149.822,-22.39],[149.974,-22.551],[149.942,-22.308],[150.021,-22.168],[150.541,-22.559],[150.623,-22.367],[150.764,-22.576],[150.843,-23.458],[151.154,-23.784],[151.832,-24.123],[152.13,-24.598],[152.456,-24.802],[152.654,-25.202],[152.913,-25.432],[152.921,-25.689],[153.165,-25.964],[153.084,-26.304],[153.117,-27.194],[153.576,-28.241],[153.617,-28.673],[153.605,-28.854],[153.348,-29.29],[153.272,-29.892],[153.031,-30.563],[152.944,-31.435],[152.559,-32.046],[152.47,-32.439],[152.137,-32.678],[152.164,-32.757],[151.813,-32.901],[151.432,-33.522],[151.292,-33.581],[151.28,-33.927],[151.125,-34.005],[151.232,-34.03],[150.871,-34.499],[150.805,-35.013],[150.567,-35.214],[150.195,-35.834],[149.96,-36.846],[149.933,-37.529],[149.481,-37.771],[148.262,-37.831],[147.877,-37.934],[146.857,-38.663],[146.217,-38.727],[146.337,-38.894],[146.467,-38.84],[146.484,-39.065],[146.4,-39.146],[146.158,-38.866],[145.935,-38.902],[145.791,-38.667],[145.397,-38.535],[145.542,-38.394],[145.476,-38.244],[145.293,-38.238],[144.96,-38.501],[144.718,-38.34],[144.911,-38.344],[145.12,-38.091],[144.891,-37.9],[144.396,-38.137],[144.665,-38.21],[143.539,-38.821],[142.456,-38.386],[141.725,-38.271],[141.594,-38.388],[141.424,-38.363],[141.011,-38.077],[140.39,-37.897],[139.784,-37.246],[139.738,-37.06],[139.857,-36.662],[139.729,-36.371],[139.466,-36.01],[138.969,-35.581],[139.178,-35.523],[139.289,-35.611],[139.283,-35.375],[138.522,-35.642],[138.184,-35.613],[138.511,-35.024],[138.49,-34.764],[138.089,-34.17],[137.692,-35.143],[136.884,-35.24],[137.014,-34.916],[137.391,-34.913],[137.494,-34.161],[137.932,-33.579],[137.852,-33.201],[137.993,-33.094],[137.783,-32.578],[137.791,-32.823],[137.442,-33.194],[137.237,-33.629],[136.431,-34.03],[135.891,-34.661],[135.97,-34.982],[135.792,-34.863],[135.648,-34.94],[135.231,-34.58],[135.123,-34.586],[135.217,-34.487],[135.45,-34.581],[135.219,-33.96],[134.889,-33.626],[134.719,-33.255],[134.301,-33.165],[134.1,-32.749],[134.227,-32.731],[134.234,-32.549],[133.665,-32.207],[133.212,-32.184],[132.757,-31.956],[132.215,-32.007],[131.721,-31.696],[131.144,-31.496],[130.783,-31.604],[130.13,-31.579],[128.946,-31.703],[127.32,-32.264],[125.917,-32.297],[124.759,-32.883],[124.244,-33.015],[123.868,-33.596],[123.507,-33.916],[123.208,-33.988],[122.778,-33.891],[122.151,-33.992],[122.061,-33.874],[121.405,-33.827],[119.854,-33.975],[119.635,-34.101],[119.451,-34.368],[118.895,-34.48],[118.136,-34.987],[117.863,-35.055],[116.517,-34.988],[115.987,-34.795],[115.565,-34.426],[115.009,-34.256],[114.994,-33.515],[115.182,-33.643],[115.359,-33.64],[115.515,-33.531],[115.683,-33.193],[115.619,-32.667],[115.725,-32.401],[115.698,-31.695],[115.078,-30.56],[114.857,-29.143],[114.165,-28.081],[114.028,-27.347],[113.185,-26.182],[113.323,-26.244],[113.356,-26.08],[113.582,-26.558],[113.734,-26.595],[113.836,-26.501],[113.853,-26.332],[113.589,-26.099],[113.395,-25.713],[113.451,-25.599],[113.713,-25.831],[113.724,-26.13],[113.854,-26.014],[113.992,-26.321],[114.09,-26.394],[114.216,-26.289],[114.214,-25.852],[113.418,-24.436],[113.49,-23.87],[113.757,-23.418],[113.795,-22.915],[113.683,-22.638],[114.023,-21.881],[114.124,-21.829],[114.142,-22.483],[114.378,-22.342],[114.709,-21.823],[115.456,-21.492],[116.011,-21.03],[116.707,-20.654],[117.406,-20.721],[118.199,-20.375],[118.751,-20.262],[119.104,-19.995],[119.586,-20.038],[120.434,-19.842],[120.998,-19.604],[121.338,-19.32],[121.834,-18.477],[122.345,-18.112],[122.147,-17.549],[122.261,-17.136],[122.72,-16.788],[122.971,-16.437],[123.563,-17.521],[123.594,-17.03],[123.831,-17.121],[123.874,-16.919],[123.49,-16.491],[123.626,-16.416],[123.607,-16.224],[123.729,-16.192],[123.859,-16.382],[124.044,-16.265],[124.3,-16.388],[124.772,-16.403],[124.405,-16.299],[124.416,-16.133],[124.577,-16.114],[124.649,-15.87],[124.648,-15.805],[124.504,-15.972],[124.382,-15.758],[124.44,-15.494],[124.562,-15.496],[124.693,-15.274],[125.063,-15.442],[125.073,-15.307],[124.909,-15.31],[124.839,-15.161],[125.038,-15.004],[125.356,-15.12],[125.384,-15.016],[125.243,-14.945],[125.179,-14.715],[125.285,-14.584],[125.58,-14.483],[125.628,-14.257],[125.705Line truncated
|
|
||||||
Vendored
-7
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"zones": "Zones",
|
|
||||||
"coast": "Continents",
|
|
||||||
"plates": "Plates",
|
|
||||||
"borders": "Borders",
|
|
||||||
"reset": "Reset"
|
|
||||||
}
|
|
||||||
Vendored
-7
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"zones": "五带",
|
|
||||||
"coast": "大洲轮廓",
|
|
||||||
"plates": "板块",
|
|
||||||
"borders": "洲界",
|
|
||||||
"reset": "复位"
|
|
||||||
}
|
|
||||||
-103
@@ -1,103 +0,0 @@
|
|||||||
{
|
|
||||||
"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"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"plates":[{"id":"pacific","lines":[[[-180,60],[-150,55],[-130,45],[-110,25],[-95,10],[-80,0],[-75,-15],[-90,-30],[-110,-45],[-130,-55],[-160,-60],[-180,-55],[-180,60]]]},{"id":"north-american","lines":[[[-168,72],[-140,70],[-120,60],[-100,50],[-80,45],[-60,42],[-52,28],[-62,12],[-82,8],[-95,16],[-110,25],[-130,45],[-150,55],[-168,72]]]},{"id":"south-american","lines":[[[-82,12],[-62,10],[-45,-2],[-35,-8],[-30,-20],[-40,-35],[-55,-42],[-70,-52],[-78,-40],[-80,-20],[-82,12]]]},{"id":"african","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":"eurasian","lines":[[[-10,36],[0,45],[15,55],[30,68],[60,72],[100,76],[140,70],[160,60],[140,42],[120,30],[100,20],[75,8],[60,22],[45,30],[30,32],[10,37],[-10,36]]]},{"id":"indo-australian","lines":[[[95,5],[115,10],[130,5],[145,-5],[150,-20],[145,-35],[130,-42],[115,-38],[105,-25],[95,-10],[95,5]]]},{"id":"antarctic","lines":[[[-180,-60],[-120,-62],[-60,-60],[0,-62],[60,-60],[120,-62],[180,-60],[180,-90],[-180,-90],[-180,-60]]]},{"id":"nazca","lines":[[[-95,-5],[-85,-10],[-75,-25],[-78,-40],[-90,-42],[-100,-30],[-95,-5]]]},{"id":"cocos","lines":[[[-105,10],[-95,12],[-90,5],[-100,2],[-105,10]]]},{"id":"caribbean","lines":[[[-88,15],[-75,18],[-62,15],[-60,8],[-72,6],[-85,8],[-88,15]]]},{"id":"philippine","lines":[[[118,20],[128,18],[130,8],[125,2],[118,8],[118,20]]]},{"id":"arabian","lines":[[[35,32],[48,30],[58,22],[55,12],[42,10],[35,20],[35,32]]]}]}
|
|
||||||
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 83 KiB |
-88
@@ -1,88 +0,0 @@
|
|||||||
{
|
|
||||||
"schemaVersion": 1,
|
|
||||||
"type": "geography",
|
|
||||||
"defaultView": "zones",
|
|
||||||
"views": [
|
|
||||||
"zones",
|
|
||||||
"coast",
|
|
||||||
"plates"
|
|
||||||
],
|
|
||||||
"nameI18n": {
|
|
||||||
"zh-CN": "地球地理",
|
|
||||||
"en": "Earth Geography"
|
|
||||||
},
|
|
||||||
"descriptionI18n": {
|
|
||||||
"zh-CN": "五带划分 · 七大洲四大洋 · 六大板块与洲界",
|
|
||||||
"en": "Climate zones · continents & oceans · plates & 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."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
-29
@@ -1,29 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<ImplicitUsings>disable</ImplicitUsings>
|
|
||||||
<RootNamespace>NeoRF.EarthModels</RootNamespace>
|
|
||||||
<AssemblyName>EarthGeographyModel</AssemblyName>
|
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
|
||||||
<IsPackable>false</IsPackable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<!-- 共享引擎源码(模型目录内),只编译需要的部分 -->
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="../../_engine/src/ModelJson.cs" />
|
|
||||||
<Compile Include="../../_engine/src/Geometry.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\..\_sdk\EarthModelStudio.ModelSdk\EarthModelStudio.ModelSdk.csproj">
|
|
||||||
<Private>false</Private>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
|
|
||||||
namespace NeoRF.EarthModels;
|
|
||||||
|
|
||||||
/// <summary>地球地理模型的数据文件:全部是经纬度折线,只有轮廓没有填色。</summary>
|
|
||||||
public sealed class GeoData
|
|
||||||
{
|
|
||||||
[JsonPropertyName("lines")] public List<List<double[]>> Lines { get; set; } = new();
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class PlateEntry
|
|
||||||
{
|
|
||||||
[JsonPropertyName("id")] public string Id { get; set; } = "";
|
|
||||||
[JsonPropertyName("nameI18n")] public Dictionary<string, string>? NameI18n { get; set; }
|
|
||||||
[JsonPropertyName("lines")] public List<List<double[]>> Lines { get; set; } = new();
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class PlateData
|
|
||||||
{
|
|
||||||
[JsonPropertyName("plates")] public List<PlateEntry> Plates { get; set; } = new();
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class BorderEntry
|
|
||||||
{
|
|
||||||
/// <summary>分界的两个大洲,如「亚洲-非洲」。</summary>
|
|
||||||
[JsonPropertyName("between")] public string Between { get; set; } = "";
|
|
||||||
/// <summary>分界标志名称,如「苏伊士运河」。</summary>
|
|
||||||
[JsonPropertyName("name")] public string Name { get; set; } = "";
|
|
||||||
[JsonPropertyName("nameI18n")] public Dictionary<string, string>? NameI18n { get; set; }
|
|
||||||
[JsonPropertyName("lines")] public List<List<double[]>> Lines { get; set; } = new();
|
|
||||||
/// <summary>复合分界的逐段明细(如亚欧分界的六个地理标志)。</summary>
|
|
||||||
[JsonPropertyName("segments")] public List<BorderSegment>? Segments { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class BorderSegment
|
|
||||||
{
|
|
||||||
[JsonPropertyName("name")] public string Name { get; set; } = "";
|
|
||||||
[JsonPropertyName("nameI18n")] public Dictionary<string, string>? NameI18n { get; set; }
|
|
||||||
[JsonPropertyName("lines")] public List<List<double[]>> Lines { get; set; } = new();
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class BorderData
|
|
||||||
{
|
|
||||||
[JsonPropertyName("borders")] public List<BorderEntry> Borders { get; set; } = new();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>七大洲四大洋的标签位置(经纬度 + 名称)。</summary>
|
|
||||||
public sealed class ZoneLabel
|
|
||||||
{
|
|
||||||
[JsonPropertyName("lat")] public double Lat { get; set; }
|
|
||||||
[JsonPropertyName("lon")] public double Lon { get; set; }
|
|
||||||
[JsonPropertyName("kind")] public string Kind { get; set; } = "continent";
|
|
||||||
[JsonPropertyName("nameI18n")] public Dictionary<string, string>? NameI18n { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class LabelData
|
|
||||||
{
|
|
||||||
[JsonPropertyName("labels")] public List<ZoneLabel> Labels { get; set; } = new();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>五带:以纬度区间定义的五个温度带。</summary>
|
|
||||||
public sealed class ClimateZone
|
|
||||||
{
|
|
||||||
[JsonPropertyName("id")] public string Id { get; set; } = "";
|
|
||||||
/// <summary>南边界纬度(可为负)。</summary>
|
|
||||||
[JsonPropertyName("latMin")] public double LatMin { get; set; }
|
|
||||||
/// <summary>北边界纬度。</summary>
|
|
||||||
[JsonPropertyName("latMax")] public double LatMax { get; set; }
|
|
||||||
[JsonPropertyName("nameI18n")] public Dictionary<string, string>? NameI18n { get; set; }
|
|
||||||
[JsonPropertyName("descI18n")] public Dictionary<string, string>? DescI18n { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>地理模型场景清单。</summary>
|
|
||||||
public sealed class GeoScene
|
|
||||||
{
|
|
||||||
[JsonPropertyName("schemaVersion")] public int SchemaVersion { get; set; } = 1;
|
|
||||||
[JsonPropertyName("type")] public string Type { get; set; } = "geography";
|
|
||||||
[JsonPropertyName("defaultView")] public string DefaultView { get; set; } = "zones";
|
|
||||||
[JsonPropertyName("views")] public List<string> Views { get; set; } = new();
|
|
||||||
[JsonPropertyName("nameI18n")] public Dictionary<string, string>? NameI18n { get; set; }
|
|
||||||
[JsonPropertyName("descriptionI18n")] public Dictionary<string, string>? DescriptionI18n { get; set; }
|
|
||||||
/// <summary>黄赤交角 / 回归线纬度,教学里统一 23.5°。</summary>
|
|
||||||
[JsonPropertyName("tropicDeg")] public double TropicDeg { get; set; } = 23.5;
|
|
||||||
[JsonPropertyName("axialTiltDeg")] public double AxialTiltDeg { get; set; } = 23.5;
|
|
||||||
[JsonPropertyName("oceanColor")] public string OceanColor { get; set; } = "#0E2A4A";
|
|
||||||
[JsonPropertyName("zones")] public List<ClimateZone> Zones { get; set; } = new();
|
|
||||||
}
|
|
||||||
-263
@@ -1,263 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
|
||||||
using Avalonia.Layout;
|
|
||||||
using Avalonia.Media;
|
|
||||||
using EarthModelStudio.ModelSdk;
|
|
||||||
|
|
||||||
namespace NeoRF.EarthModels;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 地球地理模型:五带划分 + 七大洲四大洋轮廓 + 六大板块与洲界,纯线稿。
|
|
||||||
/// 数据全部来自模型数据目录,启动器不参与渲染。
|
|
||||||
/// </summary>
|
|
||||||
public sealed class GeographyRuntime : IModelRuntime
|
|
||||||
{
|
|
||||||
private readonly List<IDisposable> _disposables = new();
|
|
||||||
private GeoScene? _scene;
|
|
||||||
private GeoData? _coast;
|
|
||||||
private PlateData? _plates;
|
|
||||||
private BorderData? _borders;
|
|
||||||
private LabelData? _labels;
|
|
||||||
private GeographyView? _view;
|
|
||||||
|
|
||||||
public void Prepare(IModelContext context)
|
|
||||||
{
|
|
||||||
var dir = context.DataDirectory;
|
|
||||||
context.ReportProgress(0.10, "读取地理数据");
|
|
||||||
_scene = ModelJson.Read<GeoScene>(Path.Combine(dir, "scene.json")) ?? new GeoScene();
|
|
||||||
_coast = ModelJson.Read<GeoData>(Path.Combine(dir, "coastline.json")) ?? new GeoData();
|
|
||||||
_plates = ModelJson.Read<PlateData>(Path.Combine(dir, "plates.json")) ?? new PlateData();
|
|
||||||
_borders = ModelJson.Read<BorderData>(Path.Combine(dir, "borders.json")) ?? new BorderData();
|
|
||||||
|
|
||||||
context.ReportProgress(0.45, "加载名称标注");
|
|
||||||
_labels = ModelJson.Read<LabelData>(Path.Combine(dir, "labels.json")) ?? new LabelData();
|
|
||||||
|
|
||||||
context.ReportProgress(0.72, "构建轮廓");
|
|
||||||
context.Log($"[{context.ModelId}] 海岸线 {_coast.Lines.Count} 条,板块 {_plates.Plates.Count} 个,洲界 {_borders.Borders.Count} 条");
|
|
||||||
}
|
|
||||||
|
|
||||||
public Control CreateView(IModelContext context)
|
|
||||||
{
|
|
||||||
_scene ??= new GeoScene();
|
|
||||||
_coast ??= new GeoData();
|
|
||||||
_plates ??= new PlateData();
|
|
||||||
_borders ??= new BorderData();
|
|
||||||
_labels ??= new LabelData();
|
|
||||||
|
|
||||||
_view = new GeographyView(context, _scene, _coast, _plates, _borders, _labels);
|
|
||||||
context.ReportProgress(1.0, "准备就绪");
|
|
||||||
return BuildLayout(_scene, _view, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Control BuildLayout(GeoScene scene, GeographyView view, IModelContext context)
|
|
||||||
{
|
|
||||||
var root = new Grid { RowDefinitions = new RowDefinitions("Auto,*,Auto") };
|
|
||||||
|
|
||||||
// 顶栏:模型名 + 图层开关
|
|
||||||
var top = new Border
|
|
||||||
{
|
|
||||||
Background = new SolidColorBrush(Color.Parse("#0C1828")),
|
|
||||||
Padding = new Thickness(16, 10),
|
|
||||||
Child = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*,Auto") }
|
|
||||||
};
|
|
||||||
var topGrid = (Grid)top.Child!;
|
|
||||||
|
|
||||||
var titlePanel = new StackPanel { Spacing = 2, VerticalAlignment = VerticalAlignment.Center };
|
|
||||||
titlePanel.Children.Add(new TextBlock
|
|
||||||
{
|
|
||||||
Text = Pick(scene.NameI18n, "地球地理"),
|
|
||||||
Foreground = new SolidColorBrush(Color.Parse("#EAF2FF")),
|
|
||||||
FontSize = 15,
|
|
||||||
FontWeight = FontWeight.SemiBold
|
|
||||||
});
|
|
||||||
titlePanel.Children.Add(new TextBlock
|
|
||||||
{
|
|
||||||
Text = Pick(scene.DescriptionI18n, "五带划分 · 七大洲四大洋 · 六大板块与洲界"),
|
|
||||||
Foreground = new SolidColorBrush(Color.Parse("#7C93B5")),
|
|
||||||
FontSize = 10.5
|
|
||||||
});
|
|
||||||
topGrid.Children.Add(titlePanel);
|
|
||||||
|
|
||||||
var actions = new StackPanel
|
|
||||||
{
|
|
||||||
Orientation = Orientation.Horizontal,
|
|
||||||
Spacing = 8,
|
|
||||||
VerticalAlignment = VerticalAlignment.Center
|
|
||||||
};
|
|
||||||
actions.Children.Add(MakeModeSwitch(view));
|
|
||||||
actions.Children.Add(MakeToggle("五带", view.ShowZones, on => view.ShowZones = on));
|
|
||||||
actions.Children.Add(MakeToggle("大洲轮廓", view.ShowCoast, on => view.ShowCoast = on));
|
|
||||||
actions.Children.Add(MakeToggle("板块", view.ShowPlates, on => view.ShowPlates = on));
|
|
||||||
actions.Children.Add(MakeToggle("洲界", view.ShowBorders, on => view.ShowBorders = on));
|
|
||||||
actions.Children.Add(MakeButton("复位", () => view.ResetView()));
|
|
||||||
Grid.SetColumn(actions, 2);
|
|
||||||
topGrid.Children.Add(actions);
|
|
||||||
|
|
||||||
root.Children.Add(top);
|
|
||||||
|
|
||||||
var stage = new Grid();
|
|
||||||
stage.Children.Add(view);
|
|
||||||
stage.Children.Add(BuildLegend(scene));
|
|
||||||
Grid.SetRow(stage, 1);
|
|
||||||
root.Children.Add(stage);
|
|
||||||
|
|
||||||
// 底部:五带说明
|
|
||||||
var bottom = new Border
|
|
||||||
{
|
|
||||||
Background = new SolidColorBrush(Color.Parse("#0A1524")),
|
|
||||||
Padding = new Thickness(16, 8),
|
|
||||||
Child = BuildZoneLegend(scene)
|
|
||||||
};
|
|
||||||
Grid.SetRow(bottom, 2);
|
|
||||||
root.Children.Add(bottom);
|
|
||||||
|
|
||||||
return root;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>右上角图例:说明三种线型分别代表什么。</summary>
|
|
||||||
private static Control BuildLegend(GeoScene scene)
|
|
||||||
{
|
|
||||||
var panel = new StackPanel { Spacing = 6 };
|
|
||||||
panel.Children.Add(LegendRow(new SolidColorBrush(Color.Parse("#DEEEFF")), "大洲海岸线"));
|
|
||||||
panel.Children.Add(LegendRow(new SolidColorBrush(Color.Parse("#FF8A5C")), "板块边界"));
|
|
||||||
panel.Children.Add(LegendRow(new SolidColorBrush(Color.Parse("#FFDC70")), "洲界 / 分界线"));
|
|
||||||
return new Border
|
|
||||||
{
|
|
||||||
Background = new SolidColorBrush(Color.FromArgb(190, 8, 18, 32)),
|
|
||||||
CornerRadius = new CornerRadius(10),
|
|
||||||
Padding = new Thickness(12, 10),
|
|
||||||
HorizontalAlignment = HorizontalAlignment.Right,
|
|
||||||
VerticalAlignment = VerticalAlignment.Top,
|
|
||||||
Margin = new Thickness(0, 14, 16, 0),
|
|
||||||
Child = panel
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Control LegendRow(IBrush brush, string text)
|
|
||||||
{
|
|
||||||
var row = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 6 };
|
|
||||||
row.Children.Add(new Border { Width = 14, Height = 2, Background = brush, VerticalAlignment = VerticalAlignment.Center });
|
|
||||||
row.Children.Add(new TextBlock { Text = text, Foreground = new SolidColorBrush(Color.Parse("#9FB4D4")), FontSize = 10.5 });
|
|
||||||
return row;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Control BuildZoneLegend(GeoScene scene)
|
|
||||||
{
|
|
||||||
var panel = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 18 };
|
|
||||||
foreach (var zone in scene.Zones)
|
|
||||||
{
|
|
||||||
var row = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 6 };
|
|
||||||
row.Children.Add(new Border
|
|
||||||
{
|
|
||||||
Width = 10, Height = 10, CornerRadius = new CornerRadius(2),
|
|
||||||
Background = ZoneBrush(zone.Id), VerticalAlignment = VerticalAlignment.Center
|
|
||||||
});
|
|
||||||
row.Children.Add(new TextBlock
|
|
||||||
{
|
|
||||||
Text = Pick(zone.NameI18n, zone.Id),
|
|
||||||
Foreground = new SolidColorBrush(Color.Parse("#C2D4EC")),
|
|
||||||
FontSize = 11
|
|
||||||
});
|
|
||||||
panel.Children.Add(row);
|
|
||||||
}
|
|
||||||
return panel;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IBrush ZoneBrush(string id) => id switch
|
|
||||||
{
|
|
||||||
"torrid-north" or "torrid-south" => new SolidColorBrush(Color.Parse("#FFA84C")),
|
|
||||||
"north-temperate" or "south-temperate" => new SolidColorBrush(Color.Parse("#6ED28C")),
|
|
||||||
_ => new SolidColorBrush(Color.Parse("#96C8FF"))
|
|
||||||
};
|
|
||||||
|
|
||||||
/// <summary>3D 球面 / 平面等经纬 两态切换。</summary>
|
|
||||||
private static Control MakeModeSwitch(GeographyView view)
|
|
||||||
{
|
|
||||||
var sphere = MakeButton("3D 球面", () => { });
|
|
||||||
var flat = MakeButton("平面", () => { });
|
|
||||||
void Apply()
|
|
||||||
{
|
|
||||||
var isFlat = view.Mode == GeoMode.Flat2D;
|
|
||||||
sphere.Background = new SolidColorBrush(Color.Parse(isFlat ? "#16263C" : "#1F5BD6"));
|
|
||||||
sphere.BorderBrush = new SolidColorBrush(Color.Parse(isFlat ? "#263A56" : "#3B7BFF"));
|
|
||||||
sphere.Foreground = new SolidColorBrush(Color.Parse(isFlat ? "#9FB4D4" : "#FFFFFF"));
|
|
||||||
flat.Background = new SolidColorBrush(Color.Parse(isFlat ? "#1F5BD6" : "#16263C"));
|
|
||||||
flat.BorderBrush = new SolidColorBrush(Color.Parse(isFlat ? "#3B7BFF" : "#263A56"));
|
|
||||||
flat.Foreground = new SolidColorBrush(Color.Parse(isFlat ? "#FFFFFF" : "#9FB4D4"));
|
|
||||||
}
|
|
||||||
sphere.Click += (_, _) => { view.Mode = GeoMode.Sphere3D; Apply(); };
|
|
||||||
flat.Click += (_, _) => { view.Mode = GeoMode.Flat2D; Apply(); };
|
|
||||||
Apply();
|
|
||||||
var row = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 4 };
|
|
||||||
row.Children.Add(sphere);
|
|
||||||
row.Children.Add(flat);
|
|
||||||
return row;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Button MakeButton(string text, Action onClick)
|
|
||||||
{
|
|
||||||
var b = new Button
|
|
||||||
{
|
|
||||||
Content = text,
|
|
||||||
FontSize = 12,
|
|
||||||
Padding = new Thickness(11, 5),
|
|
||||||
CornerRadius = new CornerRadius(8),
|
|
||||||
Background = new SolidColorBrush(Color.Parse("#16263C")),
|
|
||||||
Foreground = new SolidColorBrush(Color.Parse("#D6E4F8")),
|
|
||||||
BorderBrush = new SolidColorBrush(Color.Parse("#263A56")),
|
|
||||||
BorderThickness = new Thickness(1),
|
|
||||||
MinHeight = 30
|
|
||||||
};
|
|
||||||
b.Click += (_, _) => onClick();
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Button MakeToggle(string text, bool initial, Action<bool> onChanged)
|
|
||||||
{
|
|
||||||
var state = initial;
|
|
||||||
var b = new Button
|
|
||||||
{
|
|
||||||
Content = text,
|
|
||||||
FontSize = 12,
|
|
||||||
Padding = new Thickness(11, 5),
|
|
||||||
CornerRadius = new CornerRadius(8),
|
|
||||||
BorderThickness = new Thickness(1),
|
|
||||||
MinHeight = 30
|
|
||||||
};
|
|
||||||
void Apply()
|
|
||||||
{
|
|
||||||
b.Background = new SolidColorBrush(Color.Parse(state ? "#1F5BD6" : "#16263C"));
|
|
||||||
b.BorderBrush = new SolidColorBrush(Color.Parse(state ? "#3B7BFF" : "#263A56"));
|
|
||||||
b.Foreground = new SolidColorBrush(Color.Parse(state ? "#FFFFFF" : "#9FB4D4"));
|
|
||||||
}
|
|
||||||
Apply();
|
|
||||||
b.Click += (_, _) => { state = !state; Apply(); onChanged(state); };
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string Pick(Dictionary<string, string>? dict, string fallback)
|
|
||||||
{
|
|
||||||
if (dict == null || dict.Count == 0) return fallback;
|
|
||||||
foreach (var key in new[] { "zh-CN", "en" })
|
|
||||||
if (dict.TryGetValue(key, out var v) && !string.IsNullOrWhiteSpace(v)) return v;
|
|
||||||
return fallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
foreach (var d in _disposables) d.Dispose();
|
|
||||||
_disposables.Clear();
|
|
||||||
_view = null;
|
|
||||||
GC.SuppressFinalize(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>模型入口。</summary>
|
|
||||||
public sealed class GeographyModelFactory : IModelFactory
|
|
||||||
{
|
|
||||||
public int ApiVersion => 1;
|
|
||||||
public IModelRuntime Create() => new GeographyRuntime();
|
|
||||||
}
|
|
||||||
-654
@@ -1,654 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
|
||||||
using System.Numerics;
|
|
||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
|
||||||
using Avalonia.Input;
|
|
||||||
using Avalonia.Media;
|
|
||||||
using EarthModelStudio.ModelSdk;
|
|
||||||
|
|
||||||
namespace NeoRF.EarthModels;
|
|
||||||
|
|
||||||
public enum GeoMode { Sphere3D, Flat2D }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 地球地理画布。两种模式:
|
|
||||||
/// · 3D 正交球面 —— 拖拽转动、背面自动裁掉;
|
|
||||||
/// · 平面等经纬矩形 —— 课本地图样式,整幅一次看全。
|
|
||||||
/// 所有要素都是线稿;五带/板块/洲界各自独立配色,便于区分。
|
|
||||||
/// </summary>
|
|
||||||
public sealed class GeographyView : Control
|
|
||||||
{
|
|
||||||
private readonly GeoScene _scene;
|
|
||||||
private readonly GeoData _coast;
|
|
||||||
private readonly PlateData _plates;
|
|
||||||
private readonly BorderData _borders;
|
|
||||||
private readonly LabelData _labels;
|
|
||||||
|
|
||||||
private double _yawDeg = 10;
|
|
||||||
private double _pitchDeg = 15;
|
|
||||||
private double _zoom = 1.0;
|
|
||||||
private Point _lastPointer;
|
|
||||||
private bool _dragging;
|
|
||||||
|
|
||||||
private bool _showZones = true;
|
|
||||||
private bool _showCoast = true;
|
|
||||||
private bool _showPlates;
|
|
||||||
private bool _showBorders = true;
|
|
||||||
private bool _showLabels = true;
|
|
||||||
private GeoMode _mode = GeoMode.Sphere3D;
|
|
||||||
|
|
||||||
public event Action? StateChanged;
|
|
||||||
|
|
||||||
public GeographyView(IModelContext context, GeoScene scene, GeoData coast,
|
|
||||||
PlateData plates, BorderData borders, LabelData labels)
|
|
||||||
{
|
|
||||||
_scene = scene;
|
|
||||||
_coast = coast;
|
|
||||||
_plates = plates;
|
|
||||||
_borders = borders;
|
|
||||||
_labels = labels;
|
|
||||||
ClipToBounds = true;
|
|
||||||
Focusable = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool ShowZones { get => _showZones; set { _showZones = value; Redraw(); } }
|
|
||||||
public bool ShowCoast { get => _showCoast; set { _showCoast = value; Redraw(); } }
|
|
||||||
public bool ShowPlates { get => _showPlates; set { _showPlates = value; Redraw(); } }
|
|
||||||
public bool ShowBorders { get => _showBorders; set { _showBorders = value; Redraw(); } }
|
|
||||||
public bool ShowLabels { get => _showLabels; set { _showLabels = value; Redraw(); } }
|
|
||||||
public GeoMode Mode { get => _mode; set { _mode = value; InvalidateVisual(); StateChanged?.Invoke(); } }
|
|
||||||
|
|
||||||
/// <summary>缩放倍数(0.55–4.0)。文字大小跟随缩放变化。</summary>
|
|
||||||
public double Zoom
|
|
||||||
{
|
|
||||||
get => _zoom;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_zoom = Math.Clamp(value, 0.55, 4.0);
|
|
||||||
Redraw();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Redraw() { InvalidateVisual(); StateChanged?.Invoke(); }
|
|
||||||
|
|
||||||
/// <summary>文字缩放系数:跟随缩放一起放大/缩小,放大地球时标签也变大。</summary>
|
|
||||||
private double TextScale => Math.Clamp(_zoom, 0.85, 2.4);
|
|
||||||
|
|
||||||
public void ResetView()
|
|
||||||
{
|
|
||||||
_yawDeg = 10;
|
|
||||||
_pitchDeg = 15;
|
|
||||||
_zoom = 1.0;
|
|
||||||
Redraw();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------- 交互
|
|
||||||
protected override void OnPointerPressed(PointerPressedEventArgs e)
|
|
||||||
{
|
|
||||||
base.OnPointerPressed(e);
|
|
||||||
if (!e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) return;
|
|
||||||
_lastPointer = e.GetPosition(this);
|
|
||||||
_dragging = true;
|
|
||||||
e.Pointer.Capture(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnPointerMoved(PointerEventArgs e)
|
|
||||||
{
|
|
||||||
base.OnPointerMoved(e);
|
|
||||||
if (!_dragging || _mode == GeoMode.Flat2D) return;
|
|
||||||
var p = e.GetPosition(this);
|
|
||||||
var dx = p.X - _lastPointer.X;
|
|
||||||
var dy = p.Y - _lastPointer.Y;
|
|
||||||
_lastPointer = p;
|
|
||||||
|
|
||||||
// 跟手方向:向右拖动 => 地表向右移 => 经度增大(原来是 -= 导致方向相反)
|
|
||||||
_yawDeg += dx * 0.42;
|
|
||||||
_pitchDeg = Math.Clamp(_pitchDeg - dy * 0.42, -85, 85);
|
|
||||||
InvalidateVisual();
|
|
||||||
StateChanged?.Invoke();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnPointerReleased(PointerReleasedEventArgs e)
|
|
||||||
{
|
|
||||||
base.OnPointerReleased(e);
|
|
||||||
_dragging = false;
|
|
||||||
e.Pointer.Capture(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnPointerWheelChanged(PointerWheelEventArgs e)
|
|
||||||
{
|
|
||||||
base.OnPointerWheelChanged(e);
|
|
||||||
_zoom = Math.Clamp(_zoom * (1 + e.Delta.Y * 0.12), 0.55, 4.0);
|
|
||||||
Redraw();
|
|
||||||
e.Handled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------- 渲染入口
|
|
||||||
public override void Render(DrawingContext ctx)
|
|
||||||
{
|
|
||||||
var size = Bounds.Size;
|
|
||||||
if (size.Width < 40 || size.Height < 40) return;
|
|
||||||
ctx.FillRectangle(BgBrush, new Rect(size));
|
|
||||||
|
|
||||||
if (_mode == GeoMode.Flat2D) RenderFlat(ctx, size);
|
|
||||||
else RenderSphere(ctx, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static readonly IBrush BgBrush = new LinearGradientBrush
|
|
||||||
{
|
|
||||||
StartPoint = new RelativePoint(0, 0, RelativeUnit.Relative),
|
|
||||||
EndPoint = new RelativePoint(0, 1, RelativeUnit.Relative),
|
|
||||||
GradientStops =
|
|
||||||
{
|
|
||||||
new GradientStop(Color.Parse("#0B1726"), 0),
|
|
||||||
new GradientStop(Color.Parse("#060D18"), 1)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// ================================================================ 3D 球面
|
|
||||||
private void RenderSphere(DrawingContext ctx, Size size)
|
|
||||||
{
|
|
||||||
var cx = (float)(size.Width * 0.5);
|
|
||||||
var cy = (float)(size.Height * 0.52);
|
|
||||||
var r = (float)(Math.Min(size.Width, size.Height) * 0.40 * Math.Min(_zoom, 1.6));
|
|
||||||
if (r < 12) return;
|
|
||||||
|
|
||||||
var cam = Matrix4x4.CreateRotationX((float)(-_pitchDeg * Math.PI / 180.0));
|
|
||||||
var planet = Matrix4x4.CreateRotationY((float)(_yawDeg * Math.PI / 180.0));
|
|
||||||
var m = Matrix4x4.Multiply(planet, cam);
|
|
||||||
|
|
||||||
DrawOceanDisc(ctx, cx, cy, r);
|
|
||||||
|
|
||||||
if (_showZones) DrawZones3D(ctx, m, cx, cy, r);
|
|
||||||
if (_showCoast) DrawCoast3D(ctx, m, cx, cy, r);
|
|
||||||
if (_showPlates) DrawPlates3D(ctx, m, cx, cy, r);
|
|
||||||
if (_showBorders) DrawBorders3D(ctx, m, cx, cy, r);
|
|
||||||
if (_showLabels) DrawLabels3D(ctx, m, cx, cy, r);
|
|
||||||
|
|
||||||
ctx.DrawEllipse(null, new Pen(new SolidColorBrush(Color.FromArgb(200, 150, 200, 255)), 1.4),
|
|
||||||
new Point(cx, cy), r, r);
|
|
||||||
DrawReadout(ctx, size, $"球面 · {Norm(_yawDeg):0}°E {_pitchDeg:0}°");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void DrawOceanDisc(DrawingContext ctx, float cx, float cy, float r)
|
|
||||||
{
|
|
||||||
var disc = new RadialGradientBrush
|
|
||||||
{
|
|
||||||
Center = new RelativePoint(0.36, 0.32, RelativeUnit.Relative),
|
|
||||||
GradientOrigin = new RelativePoint(0.36, 0.32, RelativeUnit.Relative),
|
|
||||||
RadiusX = new RelativeScalar(0.85, RelativeUnit.Relative),
|
|
||||||
RadiusY = new RelativeScalar(0.85, RelativeUnit.Relative),
|
|
||||||
GradientStops =
|
|
||||||
{
|
|
||||||
new GradientStop(Color.Parse("#12314F"), 0),
|
|
||||||
new GradientStop(Color.Parse("#0A1E33"), 0.62),
|
|
||||||
new GradientStop(Color.Parse("#061120"), 1)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
ctx.DrawEllipse(disc, null, new Point(cx, cy), r, r);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---- 五带:按纬度带填色(用四边形条带逐格填充,避免整环多边形跨地平线破面)----
|
|
||||||
private void DrawZones3D(DrawingContext ctx, Matrix4x4 m, float cx, float cy, float r)
|
|
||||||
{
|
|
||||||
foreach (var zone in _scene.Zones)
|
|
||||||
{
|
|
||||||
var fill = ZoneFill(zone.Id);
|
|
||||||
FillBand3D(ctx, m, cx, cy, r, zone.LatMin, zone.LatMax, fill);
|
|
||||||
}
|
|
||||||
// 边界线:赤道 / 回归线 / 极圈
|
|
||||||
foreach (var zone in _scene.Zones)
|
|
||||||
{
|
|
||||||
DrawParallel3D(ctx, m, cx, cy, r, zone.LatMin, ZoneEdgePen);
|
|
||||||
DrawParallel3D(ctx, m, cx, cy, r, zone.LatMax, ZoneEdgePen);
|
|
||||||
}
|
|
||||||
DrawParallel3D(ctx, m, cx, cy, r, 0, EquatorPen);
|
|
||||||
DrawParallel3D(ctx, m, cx, cy, r, _scene.TropicDeg, TropicPen);
|
|
||||||
DrawParallel3D(ctx, m, cx, cy, r, -_scene.TropicDeg, TropicPen);
|
|
||||||
DrawParallel3D(ctx, m, cx, cy, r, 90 - _scene.TropicDeg, PolarPen);
|
|
||||||
DrawParallel3D(ctx, m, cx, cy, r, -(90 - _scene.TropicDeg), PolarPen);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 纬度带填充:沿经度切成小四边形逐格画。
|
|
||||||
/// 每个格子独立判断可见性——这样跨地平线的格子会被跳过,
|
|
||||||
/// 而不是像整环多边形那样把背面点也连进去导致形状撕裂。
|
|
||||||
/// </summary>
|
|
||||||
private static void FillBand3D(DrawingContext ctx, Matrix4x4 m, float cx, float cy, float r,
|
|
||||||
double latMin, double latMax, IBrush fill)
|
|
||||||
{
|
|
||||||
const int steps = 180;
|
|
||||||
const double lonStep = 360.0 / steps;
|
|
||||||
|
|
||||||
for (var i = 0; i < steps; i++)
|
|
||||||
{
|
|
||||||
var lon0 = -180.0 + lonStep * i;
|
|
||||||
var lon1 = lon0 + lonStep;
|
|
||||||
|
|
||||||
var a = Geometry.ToCamera(Geometry.LatLonToUnit(latMin, lon0), Matrix4x4.Identity, m);
|
|
||||||
var b = Geometry.ToCamera(Geometry.LatLonToUnit(latMin, lon1), Matrix4x4.Identity, m);
|
|
||||||
var c = Geometry.ToCamera(Geometry.LatLonToUnit(latMax, lon1), Matrix4x4.Identity, m);
|
|
||||||
var d = Geometry.ToCamera(Geometry.LatLonToUnit(latMax, lon0), Matrix4x4.Identity, m);
|
|
||||||
|
|
||||||
// 四角都在正面才填这一格
|
|
||||||
if (a.Z <= 0 || b.Z <= 0 || c.Z <= 0 || d.Z <= 0) continue;
|
|
||||||
|
|
||||||
var geo = new StreamGeometry();
|
|
||||||
using (var g = geo.Open())
|
|
||||||
{
|
|
||||||
g.BeginFigure(Pt(Geometry.Project(a, r, cx, cy)), true);
|
|
||||||
g.LineTo(Pt(Geometry.Project(b, r, cx, cy)));
|
|
||||||
g.LineTo(Pt(Geometry.Project(c, r, cx, cy)));
|
|
||||||
g.LineTo(Pt(Geometry.Project(d, r, cx, cy)));
|
|
||||||
g.EndFigure(true);
|
|
||||||
}
|
|
||||||
ctx.DrawGeometry(fill, null, geo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void DrawParallel3D(DrawingContext ctx, Matrix4x4 m, float cx, float cy, float r,
|
|
||||||
double lat, IPen pen)
|
|
||||||
{
|
|
||||||
var pts = new List<double[]>(145);
|
|
||||||
for (var i = 0; i < 145; i++) pts.Add(new[] { -180.0 + 360.0 * i / 144.0, lat });
|
|
||||||
DrawGeo3D(ctx, pts, m, cx, cy, r, pen, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DrawCoast3D(DrawingContext ctx, Matrix4x4 m, float cx, float cy, float r)
|
|
||||||
{
|
|
||||||
foreach (var line in _coast.Lines)
|
|
||||||
DrawGeo3D(ctx, line, m, cx, cy, r, CoastPen, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DrawPlates3D(DrawingContext ctx, Matrix4x4 m, float cx, float cy, float r)
|
|
||||||
{
|
|
||||||
foreach (var p in _plates.Plates)
|
|
||||||
{
|
|
||||||
var pen = PlatePenFor(p.Id);
|
|
||||||
foreach (var line in p.Lines) DrawGeo3D(ctx, line, m, cx, cy, r, pen, true);
|
|
||||||
}
|
|
||||||
if (!_showLabels) return;
|
|
||||||
|
|
||||||
foreach (var p in _plates.Plates)
|
|
||||||
{
|
|
||||||
var center = Centroid(p.Lines);
|
|
||||||
if (center == null) continue;
|
|
||||||
var cam = Geometry.ToCamera(Geometry.LatLonToUnit(center[1], center[0]), Matrix4x4.Identity, m);
|
|
||||||
if (cam.Z <= 0.2f) continue;
|
|
||||||
var pos = Geometry.Project(cam, r, cx, cy);
|
|
||||||
DrawText(ctx, Pick(p.NameI18n, p.Id), pos.X, pos.Y, 10.5 * TextScale,
|
|
||||||
PlateBrushFor(p.Id), TextAlignment.Center);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DrawBorders3D(DrawingContext ctx, Matrix4x4 m, float cx, float cy, float r)
|
|
||||||
{
|
|
||||||
foreach (var b in _borders.Borders)
|
|
||||||
{
|
|
||||||
var pen = BorderPenFor(b.Between);
|
|
||||||
|
|
||||||
// 复合分界(如亚欧六段)按段分别画,每段标注自己的名称
|
|
||||||
if (b.Segments is { Count: > 0 })
|
|
||||||
{
|
|
||||||
for (var i = 0; i < b.Segments.Count; i++)
|
|
||||||
{
|
|
||||||
var seg = b.Segments[i];
|
|
||||||
if (seg.Lines.Count == 0) continue;
|
|
||||||
// 同一条分界内相邻段做明度交替,视觉上能数清是几段
|
|
||||||
var segPen = BorderSegmentPen(pen, i);
|
|
||||||
foreach (var line in seg.Lines) DrawGeo3D(ctx, line, m, cx, cy, r, segPen.Glow, false);
|
|
||||||
foreach (var line in seg.Lines) DrawGeo3D(ctx, line, m, cx, cy, r, segPen.Main, false);
|
|
||||||
|
|
||||||
var mid = MidPoint(seg.Lines[0]);
|
|
||||||
if (mid == null) continue;
|
|
||||||
var cam = Geometry.ToCamera(Geometry.LatLonToUnit(mid[1], mid[0]), Matrix4x4.Identity, m);
|
|
||||||
if (cam.Z <= 0.05f) continue;
|
|
||||||
var pos = Geometry.Project(cam, r, cx, cy);
|
|
||||||
ctx.DrawEllipse(segPen.DotBrush, null, Pt(pos), 3.0, 3.0);
|
|
||||||
if (_showLabels)
|
|
||||||
DrawText(ctx, Pick(seg.NameI18n, seg.Name), pos.X + 8, pos.Y - 5, 10 * TextScale,
|
|
||||||
segPen.DotBrush, TextAlignment.Left);
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (b.Lines.Count == 0 || b.Lines[0].Count < 2) continue;
|
|
||||||
foreach (var line in b.Lines) DrawGeo3D(ctx, line, m, cx, cy, r, pen.Glow, false);
|
|
||||||
foreach (var line in b.Lines) DrawGeo3D(ctx, line, m, cx, cy, r, pen.Main, false);
|
|
||||||
|
|
||||||
var mid2 = MidPoint(b.Lines[0]);
|
|
||||||
if (mid2 == null) continue;
|
|
||||||
var cam2 = Geometry.ToCamera(Geometry.LatLonToUnit(mid2[1], mid2[0]), Matrix4x4.Identity, m);
|
|
||||||
if (cam2.Z <= 0.05f) continue;
|
|
||||||
var pos2 = Geometry.Project(cam2, r, cx, cy);
|
|
||||||
|
|
||||||
ctx.DrawEllipse(pen.DotBrush, null, Pt(pos2), 3.4, 3.4);
|
|
||||||
if (_showLabels)
|
|
||||||
{
|
|
||||||
var text = $"{Pick(b.NameI18n, b.Name)}({b.Between})";
|
|
||||||
DrawText(ctx, text, pos2.X + 9, pos2.Y - 6, 10.5 * TextScale, pen.DotBrush, TextAlignment.Left);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>同一分界的各段用不同明度区分(如亚欧分界六段)。</summary>
|
|
||||||
private static (IPen Glow, IPen Main, IBrush DotBrush) BorderSegmentPen(
|
|
||||||
(IPen Glow, IPen Main, IBrush DotBrush) basePen, int index)
|
|
||||||
=> basePen;
|
|
||||||
|
|
||||||
private void DrawLabels3D(DrawingContext ctx, Matrix4x4 m, float cx, float cy, float r)
|
|
||||||
{
|
|
||||||
foreach (var lb in _labels.Labels)
|
|
||||||
{
|
|
||||||
var cam = Geometry.ToCamera(Geometry.LatLonToUnit(lb.Lat, lb.Lon), Matrix4x4.Identity, m);
|
|
||||||
if (cam.Z <= 0.12f) continue;
|
|
||||||
var pos = Geometry.Project(cam, r, cx, cy);
|
|
||||||
var ocean = lb.Kind == "ocean";
|
|
||||||
DrawText(ctx, Pick(lb.NameI18n, ""), pos.X, pos.Y, (ocean ? 11 : 12.5) * TextScale,
|
|
||||||
ocean ? OceanBrush : ContinentBrush, TextAlignment.Center,
|
|
||||||
ocean ? FontStyle.Italic : FontStyle.Normal);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>把经纬度折线投影成可见弧段(背面自动裁掉)。</summary>
|
|
||||||
private static void DrawGeo3D(DrawingContext ctx, IReadOnlyList<double[]> latLon,
|
|
||||||
Matrix4x4 m, float cx, float cy, float r, IPen pen, bool closed)
|
|
||||||
{
|
|
||||||
foreach (var seg in Geometry.ProjectPolyline(latLon, Matrix4x4.Identity, m, r, cx, cy, closed))
|
|
||||||
{
|
|
||||||
if (seg.Count < 2) continue;
|
|
||||||
var geo = new StreamGeometry();
|
|
||||||
using (var g = geo.Open())
|
|
||||||
{
|
|
||||||
g.BeginFigure(Pt(seg[0]), false);
|
|
||||||
for (var i = 1; i < seg.Count; i++) g.LineTo(Pt(seg[i]));
|
|
||||||
g.EndFigure(false);
|
|
||||||
}
|
|
||||||
ctx.DrawGeometry(null, pen, geo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ================================================================ 平面等经纬
|
|
||||||
private void RenderFlat(DrawingContext ctx, Size size)
|
|
||||||
{
|
|
||||||
var pad = 26.0;
|
|
||||||
var w = size.Width - pad * 2;
|
|
||||||
var h = size.Height - pad * 2 - 18;
|
|
||||||
if (w < 40 || h < 40) return;
|
|
||||||
|
|
||||||
// 等经纬投影固定 2:1
|
|
||||||
if (w / h > 2.0) w = h * 2.0;
|
|
||||||
else h = w / 2.0;
|
|
||||||
var x0 = (size.Width - w) / 2;
|
|
||||||
var y0 = (size.Height - h) / 2 - 6;
|
|
||||||
|
|
||||||
var frame = new Rect(x0, y0, w, h);
|
|
||||||
|
|
||||||
// 海面
|
|
||||||
ctx.FillRectangle(new SolidColorBrush(Color.Parse("#0A1E33")), frame);
|
|
||||||
|
|
||||||
Point P(double lon, double lat) => new(
|
|
||||||
x0 + (lon + 180.0) / 360.0 * w,
|
|
||||||
y0 + (90.0 - lat) / 180.0 * h);
|
|
||||||
|
|
||||||
// 五带填充
|
|
||||||
if (_showZones)
|
|
||||||
{
|
|
||||||
foreach (var zone in _scene.Zones)
|
|
||||||
{
|
|
||||||
var top = P(-180, zone.LatMax);
|
|
||||||
var bot = P(180, zone.LatMin);
|
|
||||||
ctx.FillRectangle(ZoneFill(zone.Id), new Rect(x0, top.Y, w, bot.Y - top.Y));
|
|
||||||
|
|
||||||
foreach (var lat in new[] { zone.LatMin, zone.LatMax })
|
|
||||||
ctx.DrawLine(ZoneEdgePen, P(-180, lat), P(180, lat));
|
|
||||||
}
|
|
||||||
ctx.DrawLine(EquatorPen, P(-180, 0), P(180, 0));
|
|
||||||
foreach (var lat in new[] { _scene.TropicDeg, -_scene.TropicDeg })
|
|
||||||
ctx.DrawLine(TropicPen, P(-180, lat), P(180, lat));
|
|
||||||
foreach (var lat in new[] { 90 - _scene.TropicDeg, -(90 - _scene.TropicDeg) })
|
|
||||||
ctx.DrawLine(PolarPen, P(-180, lat), P(180, lat));
|
|
||||||
}
|
|
||||||
|
|
||||||
// 海岸线
|
|
||||||
if (_showCoast)
|
|
||||||
{
|
|
||||||
foreach (var line in _coast.Lines)
|
|
||||||
{
|
|
||||||
if (line.Count < 2) continue;
|
|
||||||
var geo = new StreamGeometry();
|
|
||||||
using (var g = geo.Open())
|
|
||||||
{
|
|
||||||
g.BeginFigure(P(line[0][0], line[0][1]), false);
|
|
||||||
for (var i = 1; i < line.Count; i++)
|
|
||||||
{
|
|
||||||
var p = line[i];
|
|
||||||
if (p.Length >= 2) g.LineTo(P(p[0], p[1]));
|
|
||||||
}
|
|
||||||
g.EndFigure(false);
|
|
||||||
}
|
|
||||||
ctx.DrawGeometry(null, CoastPen, geo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 板块
|
|
||||||
if (_showPlates)
|
|
||||||
{
|
|
||||||
foreach (var pl in _plates.Plates)
|
|
||||||
{
|
|
||||||
var pen = PlatePenFor(pl.Id);
|
|
||||||
foreach (var line in pl.Lines)
|
|
||||||
DrawFlatPolyline(ctx, line, P, pen);
|
|
||||||
|
|
||||||
if (!_showLabels) continue;
|
|
||||||
var c = Centroid(pl.Lines);
|
|
||||||
if (c == null) continue;
|
|
||||||
var at = P(c[0], c[1]);
|
|
||||||
DrawText(ctx, Pick(pl.NameI18n, pl.Id), at.X, at.Y, 10.5 * TextScale,
|
|
||||||
PlateBrushFor(pl.Id), TextAlignment.Center);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 洲界
|
|
||||||
if (_showBorders)
|
|
||||||
{
|
|
||||||
foreach (var b in _borders.Borders)
|
|
||||||
{
|
|
||||||
var pen = BorderPenFor(b.Between);
|
|
||||||
foreach (var line in b.Lines) DrawFlatPolyline(ctx, line, P, pen.Glow);
|
|
||||||
foreach (var line in b.Lines) DrawFlatPolyline(ctx, line, P, pen.Main);
|
|
||||||
|
|
||||||
if (b.Lines.Count == 0) continue;
|
|
||||||
var mid = MidPoint(b.Lines[0]);
|
|
||||||
if (mid == null) continue;
|
|
||||||
var at = P(mid[0], mid[1]);
|
|
||||||
ctx.DrawEllipse(pen.DotBrush, null, at, 3.4, 3.4);
|
|
||||||
if (_showLabels)
|
|
||||||
DrawText(ctx, $"{Pick(b.NameI18n, b.Name)}({b.Between})",
|
|
||||||
at.X + 9, at.Y - 6, 10.5 * TextScale, pen.DotBrush, TextAlignment.Left);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 大洲大洋标签
|
|
||||||
if (_showLabels)
|
|
||||||
{
|
|
||||||
foreach (var lb in _labels.Labels)
|
|
||||||
{
|
|
||||||
var at = P(lb.Lon, lb.Lat);
|
|
||||||
var ocean = lb.Kind == "ocean";
|
|
||||||
DrawText(ctx, Pick(lb.NameI18n, ""), at.X, at.Y, (ocean ? 11 : 12.5) * TextScale,
|
|
||||||
ocean ? OceanBrush : ContinentBrush, TextAlignment.Center,
|
|
||||||
ocean ? FontStyle.Italic : FontStyle.Normal);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 经纬网 + 外框
|
|
||||||
for (var lon = -180; lon <= 180; lon += 30)
|
|
||||||
ctx.DrawLine(GridPen, P(lon, -90), P(lon, 90));
|
|
||||||
for (var lat = -60; lat <= 60; lat += 30)
|
|
||||||
ctx.DrawLine(GridPen, P(-180, lat), P(180, lat));
|
|
||||||
ctx.DrawRectangle(null, new Pen(new SolidColorBrush(Color.FromArgb(180, 150, 200, 255)), 1.3), frame);
|
|
||||||
|
|
||||||
DrawReadout(ctx, size, "平面等经纬投影");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void DrawFlatPolyline(DrawingContext ctx, IReadOnlyList<double[]> latLon,
|
|
||||||
Func<double, double, Point> proj, IPen pen)
|
|
||||||
{
|
|
||||||
if (latLon.Count < 2) return;
|
|
||||||
var geo = new StreamGeometry();
|
|
||||||
using (var g = geo.Open())
|
|
||||||
{
|
|
||||||
var first = latLon[0];
|
|
||||||
if (first.Length < 2) return;
|
|
||||||
g.BeginFigure(proj(first[0], first[1]), false);
|
|
||||||
for (var i = 1; i < latLon.Count; i++)
|
|
||||||
{
|
|
||||||
var p = latLon[i];
|
|
||||||
if (p.Length >= 2) g.LineTo(proj(p[0], p[1]));
|
|
||||||
}
|
|
||||||
g.EndFigure(false);
|
|
||||||
}
|
|
||||||
ctx.DrawGeometry(null, pen, geo);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ================================================================ 配色(每类分界独立颜色)
|
|
||||||
private static IBrush ZoneFill(string id) => id switch
|
|
||||||
{
|
|
||||||
"torrid" => new SolidColorBrush(Color.FromArgb(34, 255, 150, 60)),
|
|
||||||
"north-temperate" or "south-temperate" => new SolidColorBrush(Color.FromArgb(30, 90, 210, 130)),
|
|
||||||
_ => new SolidColorBrush(Color.FromArgb(34, 140, 195, 255))
|
|
||||||
};
|
|
||||||
|
|
||||||
private static (IPen Glow, IPen Main, IBrush DotBrush) BorderPenFor(string between)
|
|
||||||
{
|
|
||||||
// 每条洲界一种颜色,便于区分
|
|
||||||
var baseColor = between switch
|
|
||||||
{
|
|
||||||
"亚洲-非洲" => Color.FromRgb(255, 214, 92), // 金黄
|
|
||||||
"亚洲-欧洲" => Color.FromRgb(120, 226, 255), // 青
|
|
||||||
"欧洲-非洲" => Color.FromRgb(168, 148, 255), // 紫
|
|
||||||
"北美-南美" => Color.FromRgb(120, 255, 176), // 绿
|
|
||||||
"亚洲-北美" => Color.FromRgb(255, 140, 220), // 粉
|
|
||||||
"亚洲-大洋洲" => Color.FromRgb(255, 160, 96), // 橙
|
|
||||||
"南极洲" => Color.FromRgb(200, 225, 255), // 冰蓝
|
|
||||||
_ => Color.FromRgb(255, 214, 92)
|
|
||||||
};
|
|
||||||
var glow = new Pen(new SolidColorBrush(Color.FromArgb(70, baseColor.R, baseColor.G, baseColor.B)), 5.0);
|
|
||||||
var main = new Pen(new SolidColorBrush(Color.FromArgb(240, baseColor.R, baseColor.G, baseColor.B)), 1.7,
|
|
||||||
new DashStyle(new double[] { 6, 3 }, 0)) { LineCap = PenLineCap.Round };
|
|
||||||
return (glow, main, new SolidColorBrush(Color.FromArgb(245, baseColor.R, baseColor.G, baseColor.B)));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IPen PlatePenFor(string id)
|
|
||||||
{
|
|
||||||
var c = id switch
|
|
||||||
{
|
|
||||||
"pacific" => Color.FromRgb(255, 110, 110),
|
|
||||||
"north-american" => Color.FromRgb(255, 176, 84),
|
|
||||||
"south-american" => Color.FromRgb(255, 226, 96),
|
|
||||||
"african" => Color.FromRgb(150, 230, 110),
|
|
||||||
"eurasian" => Color.FromRgb(110, 214, 230),
|
|
||||||
"indo-australian" => Color.FromRgb(126, 160, 255),
|
|
||||||
"antarctic" => Color.FromRgb(208, 190, 255),
|
|
||||||
"nazca" => Color.FromRgb(255, 140, 200),
|
|
||||||
"cocos" => Color.FromRgb(255, 200, 130),
|
|
||||||
"caribbean" => Color.FromRgb(180, 240, 160),
|
|
||||||
"philippine" => Color.FromRgb(255, 160, 230),
|
|
||||||
"arabian" => Color.FromRgb(200, 220, 255),
|
|
||||||
_ => Color.FromRgb(255, 150, 100)
|
|
||||||
};
|
|
||||||
return new Pen(new SolidColorBrush(Color.FromArgb(225, c.R, c.G, c.B)), 1.55,
|
|
||||||
new DashStyle(new double[] { 8, 4 }, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IBrush PlateBrushFor(string id)
|
|
||||||
{
|
|
||||||
var pen = PlatePenFor(id);
|
|
||||||
return pen.Brush ?? Brushes.White;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ================================================================ 通用画笔
|
|
||||||
private static readonly IPen CoastPen = new Pen(new SolidColorBrush(Color.FromArgb(250, 236, 246, 255)), 1.75)
|
|
||||||
{ LineJoin = PenLineJoin.Round, LineCap = PenLineCap.Round };
|
|
||||||
|
|
||||||
private static readonly IPen TropicPen = new Pen(new SolidColorBrush(Color.FromArgb(220, 255, 190, 100)), 1.3);
|
|
||||||
private static readonly IPen PolarPen = new Pen(new SolidColorBrush(Color.FromArgb(210, 150, 205, 255)), 1.3);
|
|
||||||
private static readonly IPen ZoneEdgePen = new Pen(new SolidColorBrush(Color.FromArgb(110, 200, 225, 255)), 0.9);
|
|
||||||
private static readonly IPen EquatorPen = new Pen(new SolidColorBrush(Color.FromArgb(240, 120, 226, 255)), 1.8,
|
|
||||||
new DashStyle(new double[] { 6, 4 }, 0));
|
|
||||||
private static readonly IPen GridPen = new Pen(new SolidColorBrush(Color.FromArgb(46, 150, 190, 240)), 0.8);
|
|
||||||
|
|
||||||
private static readonly IBrush ContinentBrush = new SolidColorBrush(Color.FromArgb(248, 236, 245, 255));
|
|
||||||
private static readonly IBrush OceanBrush = new SolidColorBrush(Color.FromArgb(220, 130, 190, 245));
|
|
||||||
|
|
||||||
// ================================================================ 工具
|
|
||||||
private static Point Pt(Vector2 v) => new(v.X, v.Y);
|
|
||||||
|
|
||||||
private static void DrawText(DrawingContext ctx, string text, double x, double y, double size,
|
|
||||||
IBrush brush, TextAlignment align, FontStyle style = FontStyle.Normal)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(text)) return;
|
|
||||||
var ft = new FormattedText(text, CultureInfo.CurrentCulture, FlowDirection.LeftToRight,
|
|
||||||
new Typeface(FontFamily.Default, style, FontWeight.SemiBold), size, brush);
|
|
||||||
var px = align switch
|
|
||||||
{
|
|
||||||
TextAlignment.Center => x - ft.Width / 2,
|
|
||||||
TextAlignment.Right => x - ft.Width,
|
|
||||||
_ => x
|
|
||||||
};
|
|
||||||
ctx.DrawText(ft, new Point(px, y));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void DrawReadout(DrawingContext ctx, Size size, string text)
|
|
||||||
=> DrawText(ctx, text, 18, size.Height - 24, 11,
|
|
||||||
new SolidColorBrush(Color.FromArgb(150, 160, 190, 230)), TextAlignment.Left);
|
|
||||||
|
|
||||||
private static double Norm(double deg)
|
|
||||||
{
|
|
||||||
var v = deg % 360;
|
|
||||||
if (v > 180) v -= 360;
|
|
||||||
if (v < -180) v += 360;
|
|
||||||
return Math.Abs(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static double[]? MidPoint(List<double[]> line)
|
|
||||||
{
|
|
||||||
for (var i = line.Count / 2; i < line.Count; i++)
|
|
||||||
if (line[i].Length >= 2) return line[i];
|
|
||||||
return line.Count > 0 && line[0].Length >= 2 ? line[0] : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string Pick(Dictionary<string, string>? dict, string fallback)
|
|
||||||
{
|
|
||||||
if (dict == null || dict.Count == 0) return fallback;
|
|
||||||
foreach (var key in new[] { "zh-CN", "en" })
|
|
||||||
if (dict.TryGetValue(key, out var v) && !string.IsNullOrWhiteSpace(v)) return v;
|
|
||||||
foreach (var kv in dict)
|
|
||||||
if (!string.IsNullOrWhiteSpace(kv.Value)) return kv.Value;
|
|
||||||
return fallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static double[]? Centroid(List<List<double[]>> lines)
|
|
||||||
{
|
|
||||||
double sx = 0, sy = 0, sz = 0;
|
|
||||||
var n = 0;
|
|
||||||
foreach (var l in lines)
|
|
||||||
foreach (var p in l)
|
|
||||||
{
|
|
||||||
if (p.Length < 2) continue;
|
|
||||||
var v = Geometry.LatLonToUnit(p[1], p[0]);
|
|
||||||
sx += v.X; sy += v.Y; sz += v.Z; n++;
|
|
||||||
}
|
|
||||||
if (n == 0) return null;
|
|
||||||
var len = Math.Sqrt(sx * sx + sy * sy + sz * sz);
|
|
||||||
if (len < 1e-9) return null;
|
|
||||||
return new[]
|
|
||||||
{
|
|
||||||
Math.Atan2(sx / len, sz / len) * 180.0 / Math.PI,
|
|
||||||
Math.Asin(Math.Clamp(sy / len, -1, 1)) * 180.0 / Math.PI
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-29
@@ -1,29 +0,0 @@
|
|||||||
{
|
|
||||||
"schemaVersion": 1,
|
|
||||||
"id": "earth-revolution",
|
|
||||||
"name": "Earth Revolution",
|
|
||||||
"nameI18n": {
|
|
||||||
"zh-CN": "地球公转",
|
|
||||||
"en": "Earth Revolution"
|
|
||||||
},
|
|
||||||
"author": "NeoRF",
|
|
||||||
"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": "NeoRF.EarthModels.RevolutionModelFactory",
|
|
||||||
"preview": "preview.png",
|
|
||||||
"apiVersion": 1,
|
|
||||||
"version": "1.0",
|
|
||||||
"updatedAt": "2026-11-08T09:22:29Z",
|
|
||||||
"build": "a24be3664d"
|
|
||||||
}
|
|
||||||
BIN
Binary file not shown.
Vendored
-33
@@ -1,33 +0,0 @@
|
|||||||
{
|
|
||||||
"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"
|
|
||||||
}
|
|
||||||
Vendored
-33
@@ -1,33 +0,0 @@
|
|||||||
{
|
|
||||||
"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": "双指捏合或滚轮缩放 · 拖动可转动地球"
|
|
||||||
}
|
|
||||||
-98
@@ -1,98 +0,0 @@
|
|||||||
{
|
|
||||||
"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]]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Vendored
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 67 KiB |
Vendored
-139
@@ -1,139 +0,0 @@
|
|||||||
{
|
|
||||||
"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
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
-28
@@ -1,28 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<ImplicitUsings>disable</ImplicitUsings>
|
|
||||||
<RootNamespace>NeoRF.EarthModels</RootNamespace>
|
|
||||||
<AssemblyName>EarthRevolutionModel</AssemblyName>
|
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
|
||||||
<IsPackable>false</IsPackable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<!-- 共享引擎源码就在 model/_engine 里(模型目录内),本模型直接编译进去 -->
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="../../_engine/src/**/*.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\..\_sdk\EarthModelStudio.ModelSdk\EarthModelStudio.ModelSdk.csproj">
|
|
||||||
<Private>false</Private>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
-11
@@ -1,11 +0,0 @@
|
|||||||
using EarthModelStudio.ModelSdk;
|
|
||||||
|
|
||||||
namespace NeoRF.EarthModels;
|
|
||||||
|
|
||||||
/// <summary>地球公转模型入口(清单里的 type 指向这里)。</summary>
|
|
||||||
public sealed class RevolutionModelFactory : IModelFactory
|
|
||||||
{
|
|
||||||
public int ApiVersion => EarthModelRuntime.SupportedApiVersion;
|
|
||||||
|
|
||||||
public IModelRuntime Create() => new EarthModelRuntime();
|
|
||||||
}
|
|
||||||
Loaded 100 of 279 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user