diff --git a/.gitignore b/.gitignore
index 82b552e..9ff1194 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,10 @@
# 运行数据目录(settings/model/cache/update),绝不入库
.GC/
+# .NET 构建中间产物(已跟踪的历史文件不动,只防新增)
+bin/
+obj/
+
.venv/
venv/
env/
diff --git a/model/_engine/PreviewGen/PreviewGen.csproj b/model/_engine/PreviewGen/PreviewGen.csproj
index f8477ab..abd17f0 100644
--- a/model/_engine/PreviewGen/PreviewGen.csproj
+++ b/model/_engine/PreviewGen/PreviewGen.csproj
@@ -18,6 +18,8 @@
+
+
diff --git a/model/_engine/PreviewGen/Program.cs b/model/_engine/PreviewGen/Program.cs
index 7c7d80b..227d6d2 100644
--- a/model/_engine/PreviewGen/Program.cs
+++ b/model/_engine/PreviewGen/Program.cs
@@ -1,24 +1,44 @@
using System;
+using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Reflection;
+using System.Runtime.Loader;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Headless;
using Avalonia.Media.Imaging;
+using Avalonia.Platform;
+using EarthModelStudio.ModelSdk;
using NeoRF.EarthModels;
namespace NeoRF.EarthModels.Preview;
///
-/// 封面生成工具:用模型自己的渲染器给每个模型画一张封面 preview.png。
-/// 封面在模型包里,启动器只负责显示 —— 所以公转模型的封面一定就是公转场景。
-/// 用法:dotnet run --project model-src/tools/PreviewGen -- <仓库根>
+/// 封面生成工具:给每个模型画一张 preview.png。
+///
+/// 两条路径:
+/// 1) 通用路径(默认):按模型清单的 assembly + type 加载模型程序集,
+/// 调它自己的 IModelRuntime.CreateView 做 headless 渲染 —— 任何新模型都能自动出封面。
+/// 2) 地球模型路径:仍走共享引擎的 CelestialView(保留 --bench 基准测试能力)。
+///
+/// 封面在模型包里,启动器只负责显示。用法:
+/// dotnet run --project model/_engine/PreviewGen -- <仓库根> [--bench]
///
internal static class Program
{
private const int Width = 768;
private const int Height = 316;
+ /// headless 封面应用:带上 Fluent 主题,UserControl 才有模板可渲染。
+ private sealed class PreviewApp : Application
+ {
+ public override void Initialize()
+ {
+ Styles.Add(new Avalonia.Themes.Fluent.FluentTheme());
+ }
+ }
+
[STAThread]
public static int Main(string[] args)
{
@@ -32,23 +52,53 @@ internal static class Program
var bench = args.Contains("--bench");
- AppBuilder.Configure()
+ AppBuilder.Configure()
.UseSkia()
.UseHeadless(new AvaloniaHeadlessPlatformOptions { UseHeadlessDrawing = false })
.SetupWithoutStarting();
- foreach (var modelDir in Directory.GetDirectories(modelRoot))
+ foreach (var modelDir in Directory.GetDirectories(modelRoot).OrderBy(p => p, StringComparer.Ordinal))
{
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;
+ if (id.StartsWith('.') || id.StartsWith('_')) continue;
+ var dataDir = Path.Combine(modelDir, id + ".model");
+ if (!Directory.Exists(dataDir)) continue;
+
+ var outFile = Path.Combine(dataDir, "preview.png");
+ var hasScene = File.Exists(Path.Combine(dataDir, "scene.json"));
+
+ // 基准测试只对地球模型(依赖 CelestialView)
+ if (bench)
+ {
+ if (!hasScene) continue;
+ BenchEarthModel(dataDir, id);
+ continue;
+ }
+
+ var ok = false;
+ string? err = null;
+ if (hasScene)
+ ok = TryRenderEarthModel(dataDir, outFile, out err);
+ if (!ok)
+ ok = TryRenderViaContract(modelDir, dataDir, outFile, out err);
+ if (!ok)
+ Console.Error.WriteLine($"preview 跳过 {id}:{err}");
+ }
+
+ return 0;
+ }
+
+ // ─────────────────────────────────────────── 地球模型(保留原渲染器,封面一定是真场景)
+
+ private static bool TryRenderEarthModel(string dataDir, string outFile, out string? error)
+ {
+ error = null;
+ try
+ {
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,
@@ -62,52 +112,181 @@ internal static class Program
Width = Width,
Height = Height
};
- view.Measure(new Size(Width, Height));
- view.Arrange(new Rect(0, 0, Width, Height));
+ PrepareView(view, 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}");
+ Save(view, outFile);
+ return true;
}
+ catch (Exception ex)
+ {
+ error = ex.Message;
+ return false;
+ }
+ }
- return 0;
+ private static void BenchEarthModel(string dataDir, string id)
+ {
+ 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
+ };
+ PrepareView(view, Width, Height);
+ view.JumpToOrbit(revolution ? 45 : 0);
+ view.JumpToSpin(20);
+
+ view.Width = 1240;
+ view.Height = 820;
+ view.Measure(new Size(1240, 820));
+ view.Arrange(new Rect(0, 0, 1240, 820));
+ var animField = typeof(CelestialView)
+ .GetField("_animating", BindingFlags.NonPublic | 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");
+ }
+
+ // ─────────────────────────────────────────── 通用路径:按契约加载模型自己的界面
+
+ private sealed class PreviewContext : IModelContext
+ {
+ public string ModelId { get; init; } = "";
+ public string ModelDirectory { get; init; } = "";
+ public string DataDirectory { get; init; } = "";
+ public string Language => "zh-CN";
+ public int MemoryBudgetMb => 512;
+ public void RequestClose() { }
+ public void ReportProgress(double value, string? message = null) { }
+ public void Log(string message) => Console.WriteLine(" " + message);
+ }
+
+ private static bool TryRenderViaContract(string modelDir, string dataDir, string outFile, out string? error)
+ {
+ error = null;
+ var manifestPath = Path.Combine(modelDir, Path.GetFileName(modelDir) + ".json");
+ if (!File.Exists(manifestPath)) { error = "缺少模型清单"; return false; }
+
+ try
+ {
+ using var doc = System.Text.Json.JsonDocument.Parse(File.ReadAllText(manifestPath));
+ var root = doc.RootElement;
+ var id = Path.GetFileName(modelDir);
+ var asmName = GetString(root, "assembly") ?? (id + ".dll");
+ var typeName = GetString(root, "type");
+ var asmPath = Path.Combine(dataDir, asmName);
+ if (!File.Exists(asmPath)) { error = $"找不到功能程序集 {asmName}"; return false; }
+
+ var alc = new AssemblyLoadContext("preview:" + id, isCollectible: true);
+ alc.Resolving += (_, name) =>
+ {
+ // 契约与 Avalonia 一律回到默认上下文,与启动器 ModelLoadContext 一致
+ if (name.Name is null) return null;
+ if (name.Name.StartsWith("System", StringComparison.OrdinalIgnoreCase)) return null;
+ var shared = new[] { "EarthModelStudio.ModelSdk", "Avalonia", "Avalonia.Base",
+ "Avalonia.Controls", "Avalonia.Skia", "Avalonia.Themes.Fluent", "SkiaSharp", "HarfBuzzSharp" };
+ if (shared.Contains(name.Name, StringComparer.OrdinalIgnoreCase)) return null;
+ var candidate = Path.Combine(dataDir, name.Name + ".dll");
+ return File.Exists(candidate) ? alc.LoadFromAssemblyPath(candidate) : null;
+ };
+
+ var asm = alc.LoadFromAssemblyPath(asmPath);
+ Type? factoryType = null;
+ if (!string.IsNullOrWhiteSpace(typeName))
+ factoryType = asm.GetType(typeName!, throwOnError: false);
+ factoryType ??= asm.GetTypes().FirstOrDefault(t =>
+ !t.IsAbstract && !t.IsInterface && typeof(IModelFactory).IsAssignableFrom(t));
+ if (factoryType == null) { error = "程序集里没有 IModelFactory 实现"; return false; }
+ if (Activator.CreateInstance(factoryType) is not IModelFactory factory)
+ { error = "无法创建模型入口"; return false; }
+
+ var runtime = factory.Create();
+ var ctx = new PreviewContext
+ {
+ ModelId = id,
+ ModelDirectory = modelDir,
+ DataDirectory = dataDir
+ };
+ runtime.Prepare(ctx);
+ var view = runtime.CreateView(ctx);
+ if (view == null) { error = "模型没有返回界面"; return false; }
+
+ PrepareView(view, Width, Height);
+ Save(view, outFile);
+ runtime.Dispose();
+ (view as IDisposable)?.Dispose();
+ alc.Unload();
+ return true;
+ }
+ catch (Exception ex)
+ {
+ error = ex.ToString();
+ return false;
+ }
+ }
+
+ private static string? GetString(System.Text.Json.JsonElement e, string name)
+ => e.TryGetProperty(name, out var v) && v.ValueKind == System.Text.Json.JsonValueKind.String
+ ? v.GetString() : null;
+
+ // ─────────────────────────────────────────── 公共
+
+ private static void PrepareView(Control view, double w, double h)
+ {
+ // 封面是宽幅(768×316),模型界面按设计尺寸是 1240×820;这里把布局直接按封面
+ // 尺寸 Measure/Arrange,让卡片上看到的是完整布局而不是被裁掉一角。
+ view.Width = w;
+ view.Height = h;
+ view.Measure(new Size(w, h));
+ view.Arrange(new Rect(0, 0, w, h));
+ }
+
+ private static void Save(Control view, string outFile)
+ {
+ // headless 下 UserControl 必须挂进 Window 才有视觉树;直接 Render(Control)
+ // 会得到一张全黑的图(实测)。地球模型的裸 Control 走同一路径也正常工作。
+ var win = new Window
+ {
+ Width = Width,
+ Height = Height,
+ Background = Avalonia.Media.Brushes.White,
+ Content = view,
+ SystemDecorations = SystemDecorations.None,
+ ShowInTaskbar = false
+ };
+ win.Show();
+ using var bitmap = new RenderTargetBitmap(new PixelSize(Width, Height), new Vector(96, 96));
+ bitmap.Render(win);
+ bitmap.Save(outFile);
+ win.Content = null;
+ win.Close();
+ Console.WriteLine($"preview -> {outFile}");
}
}
diff --git a/model/_engine/VersionStamp/bin/Release/net8.0/VersionStamp.dll b/model/_engine/VersionStamp/bin/Release/net8.0/VersionStamp.dll
index bc7cfec..d14a62d 100644
Binary files a/model/_engine/VersionStamp/bin/Release/net8.0/VersionStamp.dll and b/model/_engine/VersionStamp/bin/Release/net8.0/VersionStamp.dll differ
diff --git a/model/_engine/VersionStamp/bin/Release/net8.0/VersionStamp.pdb b/model/_engine/VersionStamp/bin/Release/net8.0/VersionStamp.pdb
index 82cfaca..6d8b00c 100644
Binary files a/model/_engine/VersionStamp/bin/Release/net8.0/VersionStamp.pdb and b/model/_engine/VersionStamp/bin/Release/net8.0/VersionStamp.pdb differ
diff --git a/model/_engine/VersionStamp/obj/Release/net8.0/VersionStamp.AssemblyInfo.cs b/model/_engine/VersionStamp/obj/Release/net8.0/VersionStamp.AssemblyInfo.cs
index fd4b40e..f0c63a2 100644
--- a/model/_engine/VersionStamp/obj/Release/net8.0/VersionStamp.AssemblyInfo.cs
+++ b/model/_engine/VersionStamp/obj/Release/net8.0/VersionStamp.AssemblyInfo.cs
@@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("NeoRF")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.4.0")]
-[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.4+f69a8fbb7fa563800802d3c2e319ed56365c3b8c")]
+[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.4+936aec81850fb15f55014c66116d174dc9e2f967")]
[assembly: System.Reflection.AssemblyProductAttribute("Earth Model Studio")]
[assembly: System.Reflection.AssemblyTitleAttribute("VersionStamp")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.4.0")]
diff --git a/model/_engine/VersionStamp/obj/Release/net8.0/VersionStamp.AssemblyInfoInputs.cache b/model/_engine/VersionStamp/obj/Release/net8.0/VersionStamp.AssemblyInfoInputs.cache
index ca6c729..d833a98 100644
--- a/model/_engine/VersionStamp/obj/Release/net8.0/VersionStamp.AssemblyInfoInputs.cache
+++ b/model/_engine/VersionStamp/obj/Release/net8.0/VersionStamp.AssemblyInfoInputs.cache
@@ -1 +1 @@
-3b8298611572abd644375ee2ce7c50d06658f3258c6e704cac568afa265ab293
+227dfd55e1626217a9b4b76559607d369bc84a173b8c542681a836eb300be0a1
diff --git a/model/_engine/VersionStamp/obj/Release/net8.0/VersionStamp.dll b/model/_engine/VersionStamp/obj/Release/net8.0/VersionStamp.dll
index bc7cfec..d14a62d 100644
Binary files a/model/_engine/VersionStamp/obj/Release/net8.0/VersionStamp.dll and b/model/_engine/VersionStamp/obj/Release/net8.0/VersionStamp.dll differ
diff --git a/model/_engine/VersionStamp/obj/Release/net8.0/VersionStamp.pdb b/model/_engine/VersionStamp/obj/Release/net8.0/VersionStamp.pdb
index 82cfaca..6d8b00c 100644
Binary files a/model/_engine/VersionStamp/obj/Release/net8.0/VersionStamp.pdb and b/model/_engine/VersionStamp/obj/Release/net8.0/VersionStamp.pdb differ
diff --git a/model/_engine/VersionStamp/obj/Release/net8.0/ref/VersionStamp.dll b/model/_engine/VersionStamp/obj/Release/net8.0/ref/VersionStamp.dll
index 27f6733..71b4f51 100644
Binary files a/model/_engine/VersionStamp/obj/Release/net8.0/ref/VersionStamp.dll and b/model/_engine/VersionStamp/obj/Release/net8.0/ref/VersionStamp.dll differ
diff --git a/model/_engine/VersionStamp/obj/Release/net8.0/refint/VersionStamp.dll b/model/_engine/VersionStamp/obj/Release/net8.0/refint/VersionStamp.dll
index 27f6733..71b4f51 100644
Binary files a/model/_engine/VersionStamp/obj/Release/net8.0/refint/VersionStamp.dll and b/model/_engine/VersionStamp/obj/Release/net8.0/refint/VersionStamp.dll differ
diff --git a/model/_sdk/EarthModelStudio.ModelSdk/bin/Release/net8.0/EarthModelStudio.ModelSdk.dll b/model/_sdk/EarthModelStudio.ModelSdk/bin/Release/net8.0/EarthModelStudio.ModelSdk.dll
index 8e46e48..6f098ca 100644
Binary files a/model/_sdk/EarthModelStudio.ModelSdk/bin/Release/net8.0/EarthModelStudio.ModelSdk.dll and b/model/_sdk/EarthModelStudio.ModelSdk/bin/Release/net8.0/EarthModelStudio.ModelSdk.dll differ
diff --git a/model/_sdk/EarthModelStudio.ModelSdk/obj/EarthModelStudio.ModelSdk.csproj.nuget.dgspec.json b/model/_sdk/EarthModelStudio.ModelSdk/obj/EarthModelStudio.ModelSdk.csproj.nuget.dgspec.json
index 8973a95..d9a1beb 100644
--- a/model/_sdk/EarthModelStudio.ModelSdk/obj/EarthModelStudio.ModelSdk.csproj.nuget.dgspec.json
+++ b/model/_sdk/EarthModelStudio.ModelSdk/obj/EarthModelStudio.ModelSdk.csproj.nuget.dgspec.json
@@ -49,6 +49,12 @@
"Avalonia": {
"target": "Package",
"version": "[11.3.9, )"
+ },
+ "Microsoft.NET.ILLink.Tasks": {
+ "suppressParent": "All",
+ "target": "Package",
+ "version": "[8.0.31, )",
+ "autoReferenced": true
}
},
"imports": [
@@ -62,6 +68,16 @@
],
"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"
@@ -69,6 +85,11 @@
},
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/10.0.401/PortableRuntimeIdentifierGraph.json"
}
+ },
+ "runtimes": {
+ "win-arm64": {
+ "#import": []
+ }
}
}
}
diff --git a/model/_sdk/EarthModelStudio.ModelSdk/obj/EarthModelStudio.ModelSdk.csproj.nuget.g.props b/model/_sdk/EarthModelStudio.ModelSdk/obj/EarthModelStudio.ModelSdk.csproj.nuget.g.props
index 49d666c..8d169b0 100644
--- a/model/_sdk/EarthModelStudio.ModelSdk/obj/EarthModelStudio.ModelSdk.csproj.nuget.g.props
+++ b/model/_sdk/EarthModelStudio.ModelSdk/obj/EarthModelStudio.ModelSdk.csproj.nuget.g.props
@@ -13,9 +13,11 @@
+
+ /Users/morris/.nuget/packages/microsoft.net.illink.tasks/8.0.31
/Users/morris/.nuget/packages/avalonia.buildservices/11.3.2
/Users/morris/.nuget/packages/avalonia/11.3.9
diff --git a/model/_sdk/EarthModelStudio.ModelSdk/obj/Release/net8.0/EarthModelStudio.ModelSdk.AssemblyInfo.cs b/model/_sdk/EarthModelStudio.ModelSdk/obj/Release/net8.0/EarthModelStudio.ModelSdk.AssemblyInfo.cs
index a8a8b1b..8f530c2 100644
--- a/model/_sdk/EarthModelStudio.ModelSdk/obj/Release/net8.0/EarthModelStudio.ModelSdk.AssemblyInfo.cs
+++ b/model/_sdk/EarthModelStudio.ModelSdk/obj/Release/net8.0/EarthModelStudio.ModelSdk.AssemblyInfo.cs
@@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyDescriptionAttribute("Earth Model 模型契约:启动器与模型之间唯一的编译期依赖。")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.4.0")]
-[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.4+f69a8fbb7fa563800802d3c2e319ed56365c3b8c")]
+[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.4+936aec81850fb15f55014c66116d174dc9e2f967")]
[assembly: System.Reflection.AssemblyProductAttribute("Earth Model Studio")]
[assembly: System.Reflection.AssemblyTitleAttribute("EarthModelStudio.ModelSdk")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.4.0")]
diff --git a/model/_sdk/EarthModelStudio.ModelSdk/obj/Release/net8.0/EarthModelStudio.ModelSdk.AssemblyInfoInputs.cache b/model/_sdk/EarthModelStudio.ModelSdk/obj/Release/net8.0/EarthModelStudio.ModelSdk.AssemblyInfoInputs.cache
index e64d77c..0bd2cec 100644
--- a/model/_sdk/EarthModelStudio.ModelSdk/obj/Release/net8.0/EarthModelStudio.ModelSdk.AssemblyInfoInputs.cache
+++ b/model/_sdk/EarthModelStudio.ModelSdk/obj/Release/net8.0/EarthModelStudio.ModelSdk.AssemblyInfoInputs.cache
@@ -1 +1 @@
-b9b8447b2594c792cbc333c84cc292043141fc69d483deb7c3e65d16b2166d2f
+1f535105af85de59d3ced8e39e19db7d5ce25d28d2d77df0d87a42c9c0bf481e
diff --git a/model/_sdk/EarthModelStudio.ModelSdk/obj/Release/net8.0/EarthModelStudio.ModelSdk.dll b/model/_sdk/EarthModelStudio.ModelSdk/obj/Release/net8.0/EarthModelStudio.ModelSdk.dll
index 8e46e48..6f098ca 100644
Binary files a/model/_sdk/EarthModelStudio.ModelSdk/obj/Release/net8.0/EarthModelStudio.ModelSdk.dll and b/model/_sdk/EarthModelStudio.ModelSdk/obj/Release/net8.0/EarthModelStudio.ModelSdk.dll differ
diff --git a/model/_sdk/EarthModelStudio.ModelSdk/obj/Release/net8.0/ref/EarthModelStudio.ModelSdk.dll b/model/_sdk/EarthModelStudio.ModelSdk/obj/Release/net8.0/ref/EarthModelStudio.ModelSdk.dll
index 6af9c7d..b50bfdf 100644
Binary files a/model/_sdk/EarthModelStudio.ModelSdk/obj/Release/net8.0/ref/EarthModelStudio.ModelSdk.dll and b/model/_sdk/EarthModelStudio.ModelSdk/obj/Release/net8.0/ref/EarthModelStudio.ModelSdk.dll differ
diff --git a/model/_sdk/EarthModelStudio.ModelSdk/obj/Release/net8.0/refint/EarthModelStudio.ModelSdk.dll b/model/_sdk/EarthModelStudio.ModelSdk/obj/Release/net8.0/refint/EarthModelStudio.ModelSdk.dll
index 6af9c7d..b50bfdf 100644
Binary files a/model/_sdk/EarthModelStudio.ModelSdk/obj/Release/net8.0/refint/EarthModelStudio.ModelSdk.dll and b/model/_sdk/EarthModelStudio.ModelSdk/obj/Release/net8.0/refint/EarthModelStudio.ModelSdk.dll differ
diff --git a/model/_sdk/EarthModelStudio.ModelSdk/obj/project.assets.json b/model/_sdk/EarthModelStudio.ModelSdk/obj/project.assets.json
index 5e1f0ac..5f52cca 100644
--- a/model/_sdk/EarthModelStudio.ModelSdk/obj/project.assets.json
+++ b/model/_sdk/EarthModelStudio.ModelSdk/obj/project.assets.json
@@ -111,6 +111,130 @@
"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": {}
+ }
}
}
},
@@ -333,11 +457,63 @@
"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"
+ "Avalonia >= 11.3.9",
+ "Microsoft.NET.ILLink.Tasks >= 8.0.31"
]
},
"packageFolders": {
@@ -388,6 +564,12 @@
"Avalonia": {
"target": "Package",
"version": "[11.3.9, )"
+ },
+ "Microsoft.NET.ILLink.Tasks": {
+ "suppressParent": "All",
+ "target": "Package",
+ "version": "[8.0.31, )",
+ "autoReferenced": true
}
},
"imports": [
@@ -401,6 +583,16 @@
],
"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"
@@ -408,6 +600,11 @@
},
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/10.0.401/PortableRuntimeIdentifierGraph.json"
}
+ },
+ "runtimes": {
+ "win-arm64": {
+ "#import": []
+ }
}
}
}
\ No newline at end of file
diff --git a/model/_sdk/EarthModelStudio.ModelSdk/obj/project.nuget.cache b/model/_sdk/EarthModelStudio.ModelSdk/obj/project.nuget.cache
index d3eb6b2..839ed83 100644
--- a/model/_sdk/EarthModelStudio.ModelSdk/obj/project.nuget.cache
+++ b/model/_sdk/EarthModelStudio.ModelSdk/obj/project.nuget.cache
@@ -1,13 +1,16 @@
{
"version": 2,
- "dgSpecHash": "XCy7zfNs4zI=",
+ "dgSpecHash": "1rhPDKvFVIw=",
"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/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": []
}
\ No newline at end of file
diff --git a/model/earth-geography/earth-geography.json b/model/earth-geography/earth-geography.json
index 8722c13..bbecdf2 100644
--- a/model/earth-geography/earth-geography.json
+++ b/model/earth-geography/earth-geography.json
@@ -17,7 +17,7 @@
"atlas"
],
"dataDir": "earth-geography.model",
- "version": "1.1",
- "updatedAt": "2026-11-08T10:20:04Z",
- "build": "82846c81ab"
+ "version": "1.2",
+ "updatedAt": "2026-11-08T12:19:03Z",
+ "build": "5e12cd2ee1"
}
diff --git a/model/earth-geography/earth-geography.model/EarthGeographyModel.dll b/model/earth-geography/earth-geography.model/EarthGeographyModel.dll
index 146b4f8..baf6111 100644
Binary files a/model/earth-geography/earth-geography.model/EarthGeographyModel.dll and b/model/earth-geography/earth-geography.model/EarthGeographyModel.dll differ
diff --git a/model/earth-geography/earth-geography.model/borders.json b/model/earth-geography/earth-geography.model/borders.json
index ff51aab..ce9ae14 100644
--- a/model/earth-geography/earth-geography.model/borders.json
+++ b/model/earth-geography/earth-geography.model/borders.json
@@ -1 +1 @@
-{"borders":[{"between":"亚洲-非洲","name":"苏伊士运河","lines":[[[32.6,31.3],[32.4,30.5],[32.3,29.9]]]},{"between":"亚洲-欧洲","name":"亚欧分界(乌拉尔山—乌拉尔河—里海—大高加索山—黑海—土耳其海峡)","segments":[{"name":"乌拉尔山","nameI18n":{"zh-CN":"乌拉尔山","en":"Ural Mts."},"lines":[[[66.0,68.5],[64.0,64.0],[60.5,60.0],[58.5,54.0],[57.0,51.0]]]},{"name":"乌拉尔河","nameI18n":{"zh-CN":"乌拉尔河","en":"Ural River"},"lines":[[[57.0,51.0],[55.5,49.0],[53.0,47.0],[51.5,46.5]]]},{"name":"里海","nameI18n":{"zh-CN":"里海","en":"Caspian Sea"},"lines":[[[51.5,46.5],[50.5,44.0],[49.5,41.0],[50.0,38.0],[51.0,36.5]]]},{"name":"大高加索山","nameI18n":{"zh-CN":"大高加索山","en":"Greater Caucasus"},"lines":[[[51.0,36.5],[46.0,42.5],[43.0,42.8],[41.0,43.2]]]},{"name":"黑海","nameI18n":{"zh-CN":"黑海","en":"Black Sea"},"lines":[[[41.0,43.2],[36.0,44.5],[31.0,44.0],[29.0,41.5]]]},{"name":"土耳其海峡","nameI18n":{"zh-CN":"土耳其海峡","en":"Turkish Straits"},"lines":[[[29.0,41.5],[28.0,40.5],[26.5,40.0],[26.2,39.5]]]}],"lines":[[[66.0,68.5],[64.0,64.0],[60.5,60.0],[58.5,54.0],[57.0,51.0],[57.0,51.0],[55.5,49.0],[53.0,47.0],[51.5,46.5],[51.5,46.5],[50.5,44.0],[49.5,41.0],[50.0,38.0],[51.0,36.5],[51.0,36.5],[46.0,42.5],[43.0,42.8],[41.0,43.2],[41.0,43.2],[36.0,44.5],[31.0,44.0],[29.0,41.5],[29.0,41.5],[28.0,40.5],[26.5,40.0],[26.2,39.5]]]},{"between":"亚洲-非洲","name":"红海","lines":[[[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]]]}]}
\ No newline at end of file
+{"borders":[{"between":"亚洲-非洲","name":"苏伊士运河","lines":[[[32.6,31.3],[32.4,30.5],[32.3,29.9]]]},{"between":"亚洲-欧洲","name":"亚欧分界(乌拉尔山—乌拉尔河—里海—大高加索山—黑海—土耳其海峡)","segments":[{"name":"乌拉尔山","nameI18n":{"zh-CN":"乌拉尔山","en":"Ural Mts."},"lines":[[[66.0,68.5],[64.0,64.0],[60.5,60.0],[58.5,54.0],[57.0,51.0]]]},{"name":"乌拉尔河","nameI18n":{"zh-CN":"乌拉尔河","en":"Ural River"},"lines":[[[57.0,51.0],[55.5,49.0],[53.0,47.0],[51.5,46.5]]]},{"name":"里海","nameI18n":{"zh-CN":"里海","en":"Caspian Sea"},"lines":[[[51.5,46.5],[50.5,44.0],[49.5,41.0],[50.0,38.0],[51.0,36.5]]]},{"name":"大高加索山","nameI18n":{"zh-CN":"大高加索山","en":"Greater Caucasus"},"lines":[[[51.0,36.5],[46.0,42.5],[43.0,42.8],[41.0,43.2]]]},{"name":"黑海","nameI18n":{"zh-CN":"黑海","en":"Black Sea"},"lines":[[[41.0,43.2],[36.0,44.5],[31.0,44.0],[29.0,41.5]]]},{"name":"土耳其海峡","nameI18n":{"zh-CN":"土耳其海峡","en":"Turkish Straits"},"lines":[[[29.0,41.5],[28.0,40.5],[26.5,40.0],[26.2,39.5]]]}],"lines":[[[66.0,68.5],[64.0,64.0],[60.5,60.0],[58.5,54.0],[57.0,51.0],[57.0,51.0],[55.5,49.0],[53.0,47.0],[51.5,46.5],[51.5,46.5],[50.5,44.0],[49.5,41.0],[50.0,38.0],[51.0,36.5],[51.0,36.5],[46.0,42.5],[43.0,42.8],[41.0,43.2],[41.0,43.2],[36.0,44.5],[31.0,44.0],[29.0,41.5],[29.0,41.5],[28.0,40.5],[26.5,40.0],[26.2,39.5]]]},{"between":"欧洲-非洲","name":"直布罗陀海峡","lines":[[[-5.6,36.0],[-4.0,36.2],[0.0,36.5]]]},{"between":"北美-南美","name":"巴拿马运河","lines":[[[-79.6,9.1],[-78.5,8.9],[-77.5,8.6]]]},{"between":"南美-南极","name":"德雷克海峡","nameI18n":{"zh-CN":"德雷克海峡","en":"Drake Passage"},"lines":[[[-68.0,-56.0],[-66.5,-57.5],[-65.0,-59.0],[-63.5,-60.5],[-62.0,-62.0]]]},{"between":"亚洲-北美","name":"白令海峡","lines":[[[-169.0,65.5],[-170.5,65.8],[-172.0,66.0]]]},{"between":"亚洲-大洋洲","name":"印尼群岛","lines":[[[120.0,-1.0],[125.0,-2.0],[130.0,-3.0]]]},{"between":"南极洲","name":"南极圈","lines":[[[-180.0,-66.5],[-170.0,-66.5],[-160.0,-66.5],[-150.0,-66.5],[-140.0,-66.5],[-130.0,-66.5],[-120.0,-66.5],[-110.0,-66.5],[-100.0,-66.5],[-90.0,-66.5],[-80.0,-66.5],[-70.0,-66.5],[-60.0,-66.5],[-50.0,-66.5],[-40.0,-66.5],[-30.0,-66.5],[-20.0,-66.5],[-10.0,-66.5],[0.0,-66.5],[10.0,-66.5],[20.0,-66.5],[30.0,-66.5],[40.0,-66.5],[50.0,-66.5],[60.0,-66.5],[70.0,-66.5],[80.0,-66.5],[90.0,-66.5],[100.0,-66.5],[110.0,-66.5],[120.0,-66.5],[130.0,-66.5],[140.0,-66.5],[150.0,-66.5],[160.0,-66.5],[170.0,-66.5],[180.0,-66.5]]]}]}
\ No newline at end of file
diff --git a/model/earth-geography/earth-geography.model/preview.png b/model/earth-geography/earth-geography.model/preview.png
index a0baeb3..024d7b8 100644
Binary files a/model/earth-geography/earth-geography.model/preview.png and b/model/earth-geography/earth-geography.model/preview.png differ
diff --git a/model/earth-geography/src/GeographyView.cs b/model/earth-geography/src/GeographyView.cs
index 5fe7658..1beb359 100644
--- a/model/earth-geography/src/GeographyView.cs
+++ b/model/earth-geography/src/GeographyView.cs
@@ -570,6 +570,7 @@ public sealed class GeographyView : Control
"亚洲-欧洲" => Color.FromRgb(120, 226, 255), // 青
"欧洲-非洲" => Color.FromRgb(168, 148, 255), // 紫
"北美-南美" => Color.FromRgb(120, 255, 176), // 绿
+ "南美-南极" => Color.FromRgb(96, 232, 222), // 青绿(德雷克海峡)
"亚洲-北美" => Color.FromRgb(255, 140, 220), // 粉
"亚洲-大洋洲" => Color.FromRgb(255, 160, 96), // 橙
"南极洲" => Color.FromRgb(200, 225, 255), // 冰蓝
diff --git a/model/earth-geography/src/bin/Release/net8.0/EarthGeographyModel.deps.json b/model/earth-geography/src/bin/Release/net8.0/EarthGeographyModel.deps.json
index 1421767..f92258d 100644
--- a/model/earth-geography/src/bin/Release/net8.0/EarthGeographyModel.deps.json
+++ b/model/earth-geography/src/bin/Release/net8.0/EarthGeographyModel.deps.json
@@ -6,7 +6,7 @@
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {
- "EarthGeographyModel/1.0.3": {
+ "EarthGeographyModel/1.0.4": {
"dependencies": {
"Avalonia": "11.3.9"
},
@@ -85,7 +85,7 @@
}
},
"libraries": {
- "EarthGeographyModel/1.0.3": {
+ "EarthGeographyModel/1.0.4": {
"type": "project",
"serviceable": false,
"sha512": ""
diff --git a/model/earth-geography/src/bin/Release/net8.0/EarthGeographyModel.dll b/model/earth-geography/src/bin/Release/net8.0/EarthGeographyModel.dll
index 146b4f8..baf6111 100644
Binary files a/model/earth-geography/src/bin/Release/net8.0/EarthGeographyModel.dll and b/model/earth-geography/src/bin/Release/net8.0/EarthGeographyModel.dll differ
diff --git a/model/earth-geography/src/bin/Release/net8.0/EarthGeographyModel.pdb b/model/earth-geography/src/bin/Release/net8.0/EarthGeographyModel.pdb
index 92ad5a3..a9811b7 100644
Binary files a/model/earth-geography/src/bin/Release/net8.0/EarthGeographyModel.pdb and b/model/earth-geography/src/bin/Release/net8.0/EarthGeographyModel.pdb differ
diff --git a/model/earth-geography/src/obj/EarthGeographyModel.csproj.nuget.dgspec.json b/model/earth-geography/src/obj/EarthGeographyModel.csproj.nuget.dgspec.json
index 786ee67..1988b6b 100644
--- a/model/earth-geography/src/obj/EarthGeographyModel.csproj.nuget.dgspec.json
+++ b/model/earth-geography/src/obj/EarthGeographyModel.csproj.nuget.dgspec.json
@@ -5,7 +5,7 @@
},
"projects": {
"/Users/morris/Downloads/GC#/model/earth-geography/src/EarthGeographyModel.csproj": {
- "version": "1.0.3",
+ "version": "1.0.4",
"restore": {
"projectUniqueName": "/Users/morris/Downloads/GC#/model/earth-geography/src/EarthGeographyModel.csproj",
"projectName": "EarthGeographyModel",
@@ -76,7 +76,7 @@
}
},
"/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/EarthModelStudio.ModelSdk.csproj": {
- "version": "1.0.3",
+ "version": "1.0.4",
"restore": {
"projectUniqueName": "/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/EarthModelStudio.ModelSdk.csproj",
"projectName": "EarthModelStudio.ModelSdk",
diff --git a/model/earth-geography/src/obj/Release/net8.0/Avalonia/Resources.Inputs.cache b/model/earth-geography/src/obj/Release/net8.0/Avalonia/Resources.Inputs.cache
index d176387..2c6e493 100644
--- a/model/earth-geography/src/obj/Release/net8.0/Avalonia/Resources.Inputs.cache
+++ b/model/earth-geography/src/obj/Release/net8.0/Avalonia/Resources.Inputs.cache
@@ -1 +1 @@
-c5f16ca9fce0f0594ebc177c2ecb2b54604734e59fc765d9f79f6e5986cc8840
+53167376ca320a2883b3ea70457ba5caa49ab452af81a313044551fea9319e36
diff --git a/model/earth-geography/src/obj/Release/net8.0/EarthGeographyModel.AssemblyInfo.cs b/model/earth-geography/src/obj/Release/net8.0/EarthGeographyModel.AssemblyInfo.cs
index 772a7db..c397542 100644
--- a/model/earth-geography/src/obj/Release/net8.0/EarthGeographyModel.AssemblyInfo.cs
+++ b/model/earth-geography/src/obj/Release/net8.0/EarthGeographyModel.AssemblyInfo.cs
@@ -12,11 +12,11 @@ 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+5e0b46b3f3cd9800af177571c7809a7cdc8e9249")]
+[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.4.0")]
+[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.4+936aec81850fb15f55014c66116d174dc9e2f967")]
[assembly: System.Reflection.AssemblyProductAttribute("Earth Model Studio")]
[assembly: System.Reflection.AssemblyTitleAttribute("EarthGeographyModel")]
-[assembly: System.Reflection.AssemblyVersionAttribute("1.0.3.0")]
+[assembly: System.Reflection.AssemblyVersionAttribute("1.0.4.0")]
[assembly: System.Resources.NeutralResourcesLanguageAttribute("zh-Hans")]
// Generated by the MSBuild WriteCodeFragment class.
diff --git a/model/earth-geography/src/obj/Release/net8.0/EarthGeographyModel.AssemblyInfoInputs.cache b/model/earth-geography/src/obj/Release/net8.0/EarthGeographyModel.AssemblyInfoInputs.cache
index 3bc87c1..2eb646e 100644
--- a/model/earth-geography/src/obj/Release/net8.0/EarthGeographyModel.AssemblyInfoInputs.cache
+++ b/model/earth-geography/src/obj/Release/net8.0/EarthGeographyModel.AssemblyInfoInputs.cache
@@ -1 +1 @@
-64d244f4a14d63a2a4b7a2c2c5d4c77c5e5f540fcf0498aa4b7729198e9b47da
+ed259fd40e43f2cdb14b0deef0da4645edb339d430e473fbc89582da08e3d2b5
diff --git a/model/earth-geography/src/obj/Release/net8.0/EarthGeographyModel.assets.cache b/model/earth-geography/src/obj/Release/net8.0/EarthGeographyModel.assets.cache
index a20549e..15d0132 100644
Binary files a/model/earth-geography/src/obj/Release/net8.0/EarthGeographyModel.assets.cache and b/model/earth-geography/src/obj/Release/net8.0/EarthGeographyModel.assets.cache differ
diff --git a/model/earth-geography/src/obj/Release/net8.0/EarthGeographyModel.csproj.AssemblyReference.cache b/model/earth-geography/src/obj/Release/net8.0/EarthGeographyModel.csproj.AssemblyReference.cache
index fd28939..1324542 100644
Binary files a/model/earth-geography/src/obj/Release/net8.0/EarthGeographyModel.csproj.AssemblyReference.cache and b/model/earth-geography/src/obj/Release/net8.0/EarthGeographyModel.csproj.AssemblyReference.cache differ
diff --git a/model/earth-geography/src/obj/Release/net8.0/EarthGeographyModel.dll b/model/earth-geography/src/obj/Release/net8.0/EarthGeographyModel.dll
index 146b4f8..baf6111 100644
Binary files a/model/earth-geography/src/obj/Release/net8.0/EarthGeographyModel.dll and b/model/earth-geography/src/obj/Release/net8.0/EarthGeographyModel.dll differ
diff --git a/model/earth-geography/src/obj/Release/net8.0/EarthGeographyModel.pdb b/model/earth-geography/src/obj/Release/net8.0/EarthGeographyModel.pdb
index 92ad5a3..a9811b7 100644
Binary files a/model/earth-geography/src/obj/Release/net8.0/EarthGeographyModel.pdb and b/model/earth-geography/src/obj/Release/net8.0/EarthGeographyModel.pdb differ
diff --git a/model/earth-geography/src/obj/Release/net8.0/ref/EarthGeographyModel.dll b/model/earth-geography/src/obj/Release/net8.0/ref/EarthGeographyModel.dll
index 959196a..9c427ff 100644
Binary files a/model/earth-geography/src/obj/Release/net8.0/ref/EarthGeographyModel.dll and b/model/earth-geography/src/obj/Release/net8.0/ref/EarthGeographyModel.dll differ
diff --git a/model/earth-geography/src/obj/Release/net8.0/refint/EarthGeographyModel.dll b/model/earth-geography/src/obj/Release/net8.0/refint/EarthGeographyModel.dll
index 959196a..9c427ff 100644
Binary files a/model/earth-geography/src/obj/Release/net8.0/refint/EarthGeographyModel.dll and b/model/earth-geography/src/obj/Release/net8.0/refint/EarthGeographyModel.dll differ
diff --git a/model/earth-geography/src/obj/project.assets.json b/model/earth-geography/src/obj/project.assets.json
index ca026a9..13f6de3 100644
--- a/model/earth-geography/src/obj/project.assets.json
+++ b/model/earth-geography/src/obj/project.assets.json
@@ -112,7 +112,7 @@
"lib/net5.0/MicroCom.Runtime.dll": {}
}
},
- "EarthModelStudio.ModelSdk/1.0.3": {
+ "EarthModelStudio.ModelSdk/1.0.4": {
"type": "project",
"framework": ".NETCoreApp,Version=v8.0",
"dependencies": {
@@ -347,7 +347,7 @@
"microcom.runtime.nuspec"
]
},
- "EarthModelStudio.ModelSdk/1.0.3": {
+ "EarthModelStudio.ModelSdk/1.0.4": {
"type": "project",
"path": "../../_sdk/EarthModelStudio.ModelSdk/EarthModelStudio.ModelSdk.csproj",
"msbuildProject": "../../_sdk/EarthModelStudio.ModelSdk/EarthModelStudio.ModelSdk.csproj"
@@ -356,14 +356,14 @@
"projectFileDependencyGroups": {
"net8.0": [
"Avalonia >= 11.3.9",
- "EarthModelStudio.ModelSdk >= 1.0.3"
+ "EarthModelStudio.ModelSdk >= 1.0.4"
]
},
"packageFolders": {
"/Users/morris/.nuget/packages/": {}
},
"project": {
- "version": "1.0.3",
+ "version": "1.0.4",
"restore": {
"projectUniqueName": "/Users/morris/Downloads/GC#/model/earth-geography/src/EarthGeographyModel.csproj",
"projectName": "EarthGeographyModel",
@@ -432,5 +432,13 @@
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/10.0.401/PortableRuntimeIdentifierGraph.json"
}
}
- }
+ },
+ "logs": [
+ {
+ "code": "NU1900",
+ "level": "Warning",
+ "warningLevel": 1,
+ "message": "获取包漏洞数据时出错: Access to the path '/Users/morris/.local/share/NuGet/http-cache/670c1461c29885f9aa22c281d8b7da90845b38e4$ps:_api.nuget.org_v3_index.json/vuln_index.dat-new' is denied."
+ }
+ ]
}
\ No newline at end of file
diff --git a/model/earth-geography/src/obj/project.nuget.cache b/model/earth-geography/src/obj/project.nuget.cache
index ae6e18d..a1f57dc 100644
--- a/model/earth-geography/src/obj/project.nuget.cache
+++ b/model/earth-geography/src/obj/project.nuget.cache
@@ -1,6 +1,6 @@
{
"version": 2,
- "dgSpecHash": "3ZSn38nmvSY=",
+ "dgSpecHash": "8duKn1xFDI4=",
"success": true,
"projectFilePath": "/Users/morris/Downloads/GC#/model/earth-geography/src/EarthGeographyModel.csproj",
"expectedPackageFiles": [
@@ -9,5 +9,15 @@
"/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"
],
- "logs": []
+ "logs": [
+ {
+ "code": "NU1900",
+ "level": "Warning",
+ "message": "获取包漏洞数据时出错: Access to the path '/Users/morris/.local/share/NuGet/http-cache/670c1461c29885f9aa22c281d8b7da90845b38e4$ps:_api.nuget.org_v3_index.json/vuln_index.dat-new' is denied.",
+ "projectPath": "/Users/morris/Downloads/GC#/model/earth-geography/src/EarthGeographyModel.csproj",
+ "warningLevel": 1,
+ "filePath": "/Users/morris/Downloads/GC#/model/earth-geography/src/EarthGeographyModel.csproj",
+ "targetGraphs": []
+ }
+ ]
}
\ No newline at end of file
diff --git a/model/earth-revolution/earth-revolution.json b/model/earth-revolution/earth-revolution.json
index 48054f7..1b2960e 100644
--- a/model/earth-revolution/earth-revolution.json
+++ b/model/earth-revolution/earth-revolution.json
@@ -24,6 +24,6 @@
"preview": "preview.png",
"apiVersion": 1,
"version": "1.1",
- "updatedAt": "2026-11-08T10:20:04Z",
- "build": "a9110f4ecf"
+ "updatedAt": "2026-11-08T12:19:03Z",
+ "build": "92a820f30c"
}
diff --git a/model/earth-rotation/earth-rotation.json b/model/earth-rotation/earth-rotation.json
index 2c70179..4dccf49 100644
--- a/model/earth-rotation/earth-rotation.json
+++ b/model/earth-rotation/earth-rotation.json
@@ -24,6 +24,6 @@
"preview": "preview.png",
"apiVersion": 1,
"version": "1.1",
- "updatedAt": "2026-11-08T10:20:04Z",
- "build": "b6d88b8214"
+ "updatedAt": "2026-11-08T12:19:03Z",
+ "build": "e9e9851c56"
}
diff --git a/model/scale-calculator/scale-calculator.json b/model/scale-calculator/scale-calculator.json
new file mode 100644
index 0000000..a32bac5
--- /dev/null
+++ b/model/scale-calculator/scale-calculator.json
@@ -0,0 +1,30 @@
+{
+ "schemaVersion": 1,
+ "id": "scale-calculator",
+ "name": "Scale Calculator",
+ "nameI18n": {
+ "zh-CN": "比例尺计算器",
+ "en": "Scale Calculator"
+ },
+ "author": "Morris GC",
+ "description": "把比例尺变成可以拖、可以量的可视化标尺",
+ "descriptionI18n": {
+ "zh-CN": "三种求解模式、图上/实地双条对比、线段式比例尺自动换挡、比例尺光谱、真实地标实地尺与练习闯关。",
+ "en": "Three solve modes, dual map/real bars, auto-ranging graphic scale, scale spectrum, real-world landmarks and practice quizzes."
+ },
+ "tags": [
+ "geography",
+ "map",
+ "scale",
+ "calculator"
+ ],
+ "entry": "scales.json",
+ "license": "MIT",
+ "assembly": "ScaleCalculatorModel.dll",
+ "type": "NeoRF.ScaleCalculator.ScaleCalculatorFactory",
+ "preview": "preview.png",
+ "apiVersion": 1,
+ "version": "1.0",
+ "updatedAt": "2026-11-08T12:19:03Z",
+ "build": "4cb6aafff8"
+}
diff --git a/model/scale-calculator/scale-calculator.model/ScaleCalculatorModel.dll b/model/scale-calculator/scale-calculator.model/ScaleCalculatorModel.dll
new file mode 100644
index 0000000..a8d2f6c
Binary files /dev/null and b/model/scale-calculator/scale-calculator.model/ScaleCalculatorModel.dll differ
diff --git a/model/scale-calculator/scale-calculator.model/i18n/en.json b/model/scale-calculator/scale-calculator.model/i18n/en.json
new file mode 100644
index 0000000..ed7d13d
--- /dev/null
+++ b/model/scale-calculator/scale-calculator.model/i18n/en.json
@@ -0,0 +1,106 @@
+{
+ "app.title": "Scale Calculator",
+ "app.subtitle": "Turn map-distance ÷ real-distance into a ruler you can drag and measure",
+ "mode.real": "Find real distance",
+ "mode.map": "Find map distance",
+ "mode.scale": "Find scale",
+ "mode.hint": "Pick what to solve; the blue card is the answer",
+ "input.title": "Given",
+ "input.map": "Map distance",
+ "input.real": "Real distance",
+ "input.scale": "Scale denominator N",
+ "input.nPrefix": "1 :",
+ "input.unit": "Unit",
+ "input.reset": "Reset",
+ "input.presets": "Common scales",
+ "input.dragHint": "Drag the slider or type a number — everything updates live",
+ "result.title": "Result",
+ "result.real": "Real distance",
+ "result.map": "Map distance",
+ "result.scale": "Scale",
+ "result.formula": "Formula",
+ "forms.title": "Three ways to write a scale",
+ "forms.digital": "Numeric",
+ "forms.verbal": "Verbal",
+ "forms.segment": "Graphic (bar)",
+ "forms.verbalTpl": "1 cm on the map = {0} on the ground",
+ "forms.segmentDesc": "Each division {0}, {1} divisions",
+ "steps.title": "Worked solution",
+ "steps.show": "Show steps",
+ "steps.hide": "Hide steps",
+ "steps.1.unify": "① Unify units: convert the real distance to cm (1 km = 100000 cm)",
+ "steps.2.formulaReal": "② Real distance = map distance × scale denominator",
+ "steps.2.formulaMap": "② Map distance = real distance ÷ scale denominator",
+ "steps.2.formulaScale": "② Scale denominator = real distance ÷ map distance",
+ "steps.3.substitute": "③ Substitute: {0}",
+ "steps.4.result": "④ Result: {0}",
+ "steps.5.convert": "⑤ Convert to a sensible unit (cm → m → km)",
+ "grade.title": "Large / small scale",
+ "grade.large": "Large scale",
+ "grade.medium": "Medium scale",
+ "grade.small": "Small scale",
+ "grade.largeNote": "Small area · detailed · e.g. campus plan",
+ "grade.mediumNote": "Medium area · e.g. city map",
+ "grade.smallNote": "Large area · simplified · e.g. world map",
+ "grade.rule": "Bigger denominator → smaller scale → larger area → less detail",
+ "pit.title": "Common mistakes",
+ "pit.1": "① Forgetting to unify units: km ×100000 = cm",
+ "pit.2": "② \"Zoom 2×\" means denominator ÷ 2, not × 2",
+ "pit.3": "③ Don't swap map distance and real distance",
+ "field.title": "Real-world ruler · how long on the map",
+ "field.hint": "Pick a real distance and change the scale to see its map length",
+ "field.mapLength": "On map {0}",
+ "field.tooLong": "too long",
+ "field.tooShort": "barely visible",
+ "quiz.title": "Practice",
+ "quiz.promptReal": "Scale 1:{0}, map distance {1} cm — what is the real distance? (enter the number in the shown unit)",
+ "quiz.promptMap": "Scale 1:{0}, real distance {1} — what is the map distance in cm?",
+ "quiz.promptScale": "{0} cm on the map = {1} on the ground — what is the scale denominator?",
+ "quiz.answer": "Your answer",
+ "quiz.check": "Check",
+ "quiz.next": "Next",
+ "quiz.correct": "✓ Correct!",
+ "quiz.wrong": "✗ Try again — read the steps",
+ "quiz.streak": "{0} in a row",
+ "quiz.showSteps": "Show solution",
+ "quiz.unit": "Unit: {0}",
+ "ruler.title": "Visual ruler",
+ "ruler.mapBar": "Map distance (real cm)",
+ "ruler.realBar": "Real distance (compressed by the same scale)",
+ "ruler.sameWidth": "same width as above",
+ "ruler.equals": "equals",
+ "ruler.segment": "Graphic scale",
+ "ruler.segmentHint": "auto-ranging ticks",
+ "ruler.spectrum": "Scale spectrum",
+ "ruler.scopeUp": "◀ larger area",
+ "ruler.detailDown": "more detail ▶",
+ "ruler.hint": "Blue is the real map length; green is the same real distance compressed by the scale",
+ "ruler.overflowMap": "This map distance overflows the sheet — use a smaller scale",
+ "ruler.overflowReal": "This real distance won't fit at this scale — use a smaller scale",
+ "unit.cm": "cm",
+ "unit.m": "m",
+ "unit.km": "km",
+ "unit.none": "(unitless)",
+ "spec.campus": "Campus",
+ "spec.city": "City",
+ "spec.china": "China",
+ "spec.world": "World",
+ "preset.campus": "Campus 1:10k",
+ "preset.campusNote": "Buildings clearly drawn",
+ "preset.town": "Town 1:50k",
+ "preset.townNote": "Villages and roads",
+ "preset.city": "City 1:250k",
+ "preset.cityNote": "Urban area and arterials",
+ "preset.province": "Province 1:1M",
+ "preset.provinceNote": "Cities and rivers",
+ "preset.china": "China 1:10M",
+ "preset.chinaNote": "Province outlines",
+ "preset.world": "World 1:100M",
+ "preset.worldNote": "Continents & oceans",
+ "lm.classroom": "Classroom 10 m",
+ "lm.track": "Running track 400 m",
+ "lm.marathon": "Marathon 42.195 km",
+ "lm.beijingShanghai": "Beijing–Shanghai 1080 km",
+ "lm.equator": "Equator 40,000 km",
+ "common.footer": "Scale = map distance ÷ real distance · unify units first · bigger denominator = smaller scale"
+}
diff --git a/model/scale-calculator/scale-calculator.model/i18n/zh-CN.json b/model/scale-calculator/scale-calculator.model/i18n/zh-CN.json
new file mode 100644
index 0000000..f12a9d7
--- /dev/null
+++ b/model/scale-calculator/scale-calculator.model/i18n/zh-CN.json
@@ -0,0 +1,106 @@
+{
+ "app.title": "比例尺计算器",
+ "app.subtitle": "把「图上距离 ÷ 实地距离」变成可以拖、可以量的可视化标尺",
+ "mode.real": "求实地距离",
+ "mode.map": "求图上距离",
+ "mode.scale": "求比例尺",
+ "mode.hint": "选择要求什么,蓝色结果卡就是答案",
+ "input.title": "已知量",
+ "input.map": "图上距离",
+ "input.real": "实地距离",
+ "input.scale": "比例尺分母 N",
+ "input.nPrefix": "1 :",
+ "input.unit": "单位",
+ "input.reset": "重置",
+ "input.presets": "常用比例尺",
+ "input.dragHint": "拖动滑块或直接输入数字,读数实时联动",
+ "result.title": "计算结果",
+ "result.real": "实地距离",
+ "result.map": "图上距离",
+ "result.scale": "比例尺",
+ "result.formula": "计算公式",
+ "forms.title": "比例尺的三种写法",
+ "forms.digital": "数字式",
+ "forms.verbal": "文字式",
+ "forms.segment": "线段式",
+ "forms.verbalTpl": "图上 1 厘米代表实地 {0}",
+ "forms.segmentDesc": "每格 {0},共 {1} 格",
+ "steps.title": "解题步骤",
+ "steps.show": "展开步骤",
+ "steps.hide": "收起步骤",
+ "steps.1.unify": "① 统一单位:把实地距离化成厘米(1 km = 100000 cm,去掉 5 个 0)",
+ "steps.2.formulaReal": "② 实地距离 = 图上距离 × 比例尺分母",
+ "steps.2.formulaMap": "② 图上距离 = 实地距离 ÷ 比例尺分母",
+ "steps.2.formulaScale": "② 比例尺分母 = 实地距离 ÷ 图上距离",
+ "steps.3.substitute": "③ 代入数值:{0}",
+ "steps.4.result": "④ 算出结果:{0}",
+ "steps.5.convert": "⑤ 换算成合适单位(cm → m → km)",
+ "grade.title": "大小判读",
+ "grade.large": "大比例尺",
+ "grade.medium": "中比例尺",
+ "grade.small": "小比例尺",
+ "grade.largeNote": "范围小 · 内容详细 · 如校园平面图",
+ "grade.mediumNote": "范围中等 · 如城市交通图",
+ "grade.smallNote": "范围大 · 内容简略 · 如世界地图",
+ "grade.rule": "分母越大 → 比例尺越小 → 范围越大 → 越简略",
+ "pit.title": "易错点",
+ "pit.1": "① 忘记统一单位:km 要 ×100000 才成 cm",
+ "pit.2": "② 「放大 2 倍」是分母 ÷ 2,不是 × 2",
+ "pit.3": "③ 图上距离与实地距离别代反了",
+ "field.title": "实地尺 · 这段距离画到图上多长",
+ "field.hint": "选一个真实距离,改变比例尺看它在图上的长度",
+ "field.mapLength": "图上 {0}",
+ "field.tooLong": "画不下",
+ "field.tooShort": "几乎看不见",
+ "quiz.title": "练习闯关",
+ "quiz.promptReal": "比例尺 1:{0},图上 {1} 厘米,实地距离是多少?(按提示单位填数字)",
+ "quiz.promptMap": "比例尺 1:{0},实地 {1},图上距离是多少厘米?",
+ "quiz.promptScale": "图上 {0} 厘米代表实地 {1},比例尺分母是多少?",
+ "quiz.answer": "输入答案",
+ "quiz.check": "检查",
+ "quiz.next": "下一题",
+ "quiz.correct": "✓ 答对了!",
+ "quiz.wrong": "✗ 再想想,看看解题步骤",
+ "quiz.streak": "连对 {0} 题",
+ "quiz.showSteps": "查看解题步骤",
+ "quiz.unit": "单位:{0}",
+ "ruler.title": "可视化标尺",
+ "ruler.mapBar": "图上距离(真实厘米)",
+ "ruler.realBar": "实地距离(按同一比例尺压缩)",
+ "ruler.sameWidth": "与上方同宽",
+ "ruler.equals": "等于",
+ "ruler.segment": "线段式比例尺",
+ "ruler.segmentHint": "刻度自动换挡",
+ "ruler.spectrum": "比例尺光谱",
+ "ruler.scopeUp": "◀ 范围越大",
+ "ruler.detailDown": "内容越详细 ▶",
+ "ruler.hint": "蓝色是图上真实长度;绿色是同一段实地按比例尺压缩后的长度",
+ "ruler.overflowMap": "这段图上距离超出图幅,需要更小的比例尺",
+ "ruler.overflowReal": "这段实地距离在该比例尺下画不下,需要更小的比例尺",
+ "unit.cm": "厘米",
+ "unit.m": "米",
+ "unit.km": "千米",
+ "unit.none": "(无单位)",
+ "spec.campus": "校园",
+ "spec.city": "城市",
+ "spec.china": "中国",
+ "spec.world": "世界",
+ "preset.campus": "校园 1:1万",
+ "preset.campusNote": "操场、教学楼都画得清",
+ "preset.town": "乡镇 1:5万",
+ "preset.townNote": "村镇与道路",
+ "preset.city": "城市 1:25万",
+ "preset.cityNote": "城区与主干道",
+ "preset.province": "省区 1:100万",
+ "preset.provinceNote": "地级市与河流",
+ "preset.china": "中国 1:1000万",
+ "preset.chinaNote": "省级轮廓",
+ "preset.world": "世界 1:1亿",
+ "preset.worldNote": "大洲大洋",
+ "lm.classroom": "教室 10 m",
+ "lm.track": "操场一圈 400 m",
+ "lm.marathon": "马拉松 42.195 km",
+ "lm.beijingShanghai": "北京—上海 1080 km",
+ "lm.equator": "赤道 4 万 km",
+ "common.footer": "比例尺 = 图上距离 ÷ 实地距离 · 单位统一是第一步 · 分母越大,比例尺越小"
+}
diff --git a/model/scale-calculator/scale-calculator.model/preview.png b/model/scale-calculator/scale-calculator.model/preview.png
new file mode 100644
index 0000000..8a816a4
Binary files /dev/null and b/model/scale-calculator/scale-calculator.model/preview.png differ
diff --git a/model/scale-calculator/scale-calculator.model/scales.json b/model/scale-calculator/scale-calculator.model/scales.json
new file mode 100644
index 0000000..aa23424
--- /dev/null
+++ b/model/scale-calculator/scale-calculator.model/scales.json
@@ -0,0 +1,23 @@
+{
+ "presets": [
+ { "n": 10000, "nameKey": "preset.campus", "noteKey": "preset.campusNote" },
+ { "n": 50000, "nameKey": "preset.town", "noteKey": "preset.townNote" },
+ { "n": 250000, "nameKey": "preset.city", "noteKey": "preset.cityNote" },
+ { "n": 1000000, "nameKey": "preset.province", "noteKey": "preset.provinceNote" },
+ { "n": 10000000, "nameKey": "preset.china", "noteKey": "preset.chinaNote" },
+ { "n": 100000000, "nameKey": "preset.world", "noteKey": "preset.worldNote" }
+ ],
+ "spectrum": [
+ { "n": 10000, "labelKey": "spec.campus", "scopeKey": "spec.campusScope" },
+ { "n": 250000, "labelKey": "spec.city", "scopeKey": "spec.cityScope" },
+ { "n": 10000000, "labelKey": "spec.china", "scopeKey": "spec.chinaScope" },
+ { "n": 100000000, "labelKey": "spec.world", "scopeKey": "spec.worldScope" }
+ ],
+ "landmarks": [
+ { "nameKey": "lm.classroom", "meters": 10 },
+ { "nameKey": "lm.track", "meters": 400 },
+ { "nameKey": "lm.marathon", "meters": 42195 },
+ { "nameKey": "lm.beijingShanghai", "meters": 1080000 },
+ { "nameKey": "lm.equator", "meters": 40000000 }
+ ]
+}
diff --git a/model/scale-calculator/src/DefaultTexts.cs b/model/scale-calculator/src/DefaultTexts.cs
new file mode 100644
index 0000000..f2b0f05
--- /dev/null
+++ b/model/scale-calculator/src/DefaultTexts.cs
@@ -0,0 +1,251 @@
+using System.Collections.Generic;
+
+namespace NeoRF.ScaleCalculator;
+
+/// 内置全量文案兜底:即使模型包里没有语言包也能完整显示。
+internal static class DefaultTexts
+{
+ public static readonly Dictionary Zh = new()
+ {
+ ["app.title"] = "比例尺计算器",
+ ["app.subtitle"] = "把「图上距离 ÷ 实地距离」变成可以拖、可以量的可视化标尺",
+ ["mode.real"] = "求实地距离",
+ ["mode.map"] = "求图上距离",
+ ["mode.scale"] = "求比例尺",
+ ["mode.hint"] = "选择要求什么,蓝色结果卡就是答案",
+
+ ["input.title"] = "已知量",
+ ["input.map"] = "图上距离",
+ ["input.real"] = "实地距离",
+ ["input.scale"] = "比例尺分母 N",
+ ["input.nPrefix"] = "1 :",
+ ["input.unit"] = "单位",
+ ["input.reset"] = "重置",
+ ["input.presets"] = "常用比例尺",
+ ["input.dragHint"] = "拖动滑块或直接输入数字,读数实时联动",
+
+ ["result.title"] = "计算结果",
+ ["result.real"] = "实地距离",
+ ["result.map"] = "图上距离",
+ ["result.scale"] = "比例尺",
+ ["result.formula"] = "计算公式",
+
+ ["forms.title"] = "比例尺的三种写法",
+ ["forms.digital"] = "数字式",
+ ["forms.verbal"] = "文字式",
+ ["forms.segment"] = "线段式",
+ ["forms.verbalTpl"] = "图上 1 厘米代表实地 {0}",
+ ["forms.segmentDesc"] = "每格 {0},共 {1} 格",
+
+ ["steps.title"] = "解题步骤",
+ ["steps.show"] = "展开步骤",
+ ["steps.hide"] = "收起步骤",
+ ["steps.1.unify"] = "① 统一单位:把实地距离化成厘米(1 km = 100000 cm,去掉 5 个 0)",
+ ["steps.2.formulaReal"] = "② 实地距离 = 图上距离 × 比例尺分母",
+ ["steps.2.formulaMap"] = "② 图上距离 = 实地距离 ÷ 比例尺分母",
+ ["steps.2.formulaScale"] = "② 比例尺分母 = 实地距离 ÷ 图上距离",
+ ["steps.3.substitute"] = "③ 代入数值:{0}",
+ ["steps.4.result"] = "④ 算出结果:{0}",
+ ["steps.5.convert"] = "⑤ 换算成合适单位(cm → m → km)",
+
+ ["grade.title"] = "大小判读",
+ ["grade.large"] = "大比例尺",
+ ["grade.medium"] = "中比例尺",
+ ["grade.small"] = "小比例尺",
+ ["grade.largeNote"] = "范围小 · 内容详细 · 如校园平面图",
+ ["grade.mediumNote"] = "范围中等 · 如城市交通图",
+ ["grade.smallNote"] = "范围大 · 内容简略 · 如世界地图",
+ ["grade.rule"] = "分母越大 → 比例尺越小 → 范围越大 → 越简略",
+
+ ["pit.title"] = "易错点",
+ ["pit.1"] = "① 忘记统一单位:km 要 ×100000 才成 cm",
+ ["pit.2"] = "② 「放大 2 倍」是分母 ÷ 2,不是 × 2",
+ ["pit.3"] = "③ 图上距离与实地距离别代反了",
+
+ ["field.title"] = "实地尺 · 这段距离画到图上多长",
+ ["field.hint"] = "选一个真实距离,改变比例尺看它在图上的长度",
+ ["field.mapLength"] = "图上 {0}",
+ ["field.tooLong"] = "画不下",
+ ["field.tooShort"] = "几乎看不见",
+
+ ["quiz.title"] = "练习闯关",
+ ["quiz.promptReal"] = "比例尺 1:{0},图上 {1} 厘米,实地距离是多少?(按提示单位填数字)",
+ ["quiz.promptMap"] = "比例尺 1:{0},实地 {1},图上距离是多少厘米?",
+ ["quiz.promptScale"] = "图上 {0} 厘米代表实地 {1},比例尺分母是多少?",
+ ["quiz.answer"] = "输入答案",
+ ["quiz.check"] = "检查",
+ ["quiz.next"] = "下一题",
+ ["quiz.correct"] = "✓ 答对了!",
+ ["quiz.wrong"] = "✗ 再想想,看看解题步骤",
+ ["quiz.streak"] = "连对 {0} 题",
+ ["quiz.showSteps"] = "查看解题步骤",
+ ["quiz.unit"] = "单位:{0}",
+
+ ["ruler.title"] = "可视化标尺",
+ ["ruler.mapBar"] = "图上距离(真实厘米)",
+ ["ruler.realBar"] = "实地距离(按同一比例尺压缩)",
+ ["ruler.sameWidth"] = "与上方同宽",
+ ["ruler.equals"] = "等于",
+ ["ruler.segment"] = "线段式比例尺",
+ ["ruler.segmentHint"] = "刻度自动换挡",
+ ["ruler.spectrum"] = "比例尺光谱",
+ ["ruler.scopeUp"] = "◀ 范围越大",
+ ["ruler.detailDown"] = "内容越详细 ▶",
+ ["ruler.hint"] = "蓝色是图上真实长度;绿色是同一段实地按比例尺压缩后的长度",
+ ["ruler.overflowMap"] = "这段图上距离超出图幅,需要更小的比例尺",
+ ["ruler.overflowReal"] = "这段实地距离在该比例尺下画不下,需要更小的比例尺",
+
+ ["unit.cm"] = "厘米",
+ ["unit.m"] = "米",
+ ["unit.km"] = "千米",
+ ["unit.none"] = "(无单位)",
+
+ ["spec.campus"] = "校园",
+ ["spec.city"] = "城市",
+ ["spec.china"] = "中国",
+ ["spec.world"] = "世界",
+
+ ["preset.campus"] = "校园 1:1万",
+ ["preset.campusNote"] = "操场、教学楼都画得清",
+ ["preset.town"] = "乡镇 1:5万",
+ ["preset.townNote"] = "村镇与道路",
+ ["preset.city"] = "城市 1:25万",
+ ["preset.cityNote"] = "城区与主干道",
+ ["preset.province"] = "省区 1:100万",
+ ["preset.provinceNote"] = "地级市与河流",
+ ["preset.china"] = "中国 1:1000万",
+ ["preset.chinaNote"] = "省级轮廓",
+ ["preset.world"] = "世界 1:1亿",
+ ["preset.worldNote"] = "大洲大洋",
+
+ ["lm.classroom"] = "教室 10 m",
+ ["lm.track"] = "操场一圈 400 m",
+ ["lm.marathon"] = "马拉松 42.195 km",
+ ["lm.beijingShanghai"] = "北京—上海 1080 km",
+ ["lm.equator"] = "赤道 4 万 km",
+
+ ["common.footer"] = "比例尺 = 图上距离 ÷ 实地距离 · 单位统一是第一步 · 分母越大,比例尺越小"
+ };
+
+ public static readonly Dictionary En = new()
+ {
+ ["app.title"] = "Scale Calculator",
+ ["app.subtitle"] = "Turn map-distance ÷ real-distance into a ruler you can drag and measure",
+ ["mode.real"] = "Find real distance",
+ ["mode.map"] = "Find map distance",
+ ["mode.scale"] = "Find scale",
+ ["mode.hint"] = "Pick what to solve; the blue card is the answer",
+
+ ["input.title"] = "Given",
+ ["input.map"] = "Map distance",
+ ["input.real"] = "Real distance",
+ ["input.scale"] = "Scale denominator N",
+ ["input.nPrefix"] = "1 :",
+ ["input.unit"] = "Unit",
+ ["input.reset"] = "Reset",
+ ["input.presets"] = "Common scales",
+ ["input.dragHint"] = "Drag the slider or type a number — everything updates live",
+
+ ["result.title"] = "Result",
+ ["result.real"] = "Real distance",
+ ["result.map"] = "Map distance",
+ ["result.scale"] = "Scale",
+ ["result.formula"] = "Formula",
+
+ ["forms.title"] = "Three ways to write a scale",
+ ["forms.digital"] = "Numeric",
+ ["forms.verbal"] = "Verbal",
+ ["forms.segment"] = "Graphic (bar)",
+ ["forms.verbalTpl"] = "1 cm on the map = {0} on the ground",
+ ["forms.segmentDesc"] = "Each division {0}, {1} divisions",
+
+ ["steps.title"] = "Worked solution",
+ ["steps.show"] = "Show steps",
+ ["steps.hide"] = "Hide steps",
+ ["steps.1.unify"] = "① Unify units: convert the real distance to cm (1 km = 100000 cm)",
+ ["steps.2.formulaReal"] = "② Real distance = map distance × scale denominator",
+ ["steps.2.formulaMap"] = "② Map distance = real distance ÷ scale denominator",
+ ["steps.2.formulaScale"] = "② Scale denominator = real distance ÷ map distance",
+ ["steps.3.substitute"] = "③ Substitute: {0}",
+ ["steps.4.result"] = "④ Result: {0}",
+ ["steps.5.convert"] = "⑤ Convert to a sensible unit (cm → m → km)",
+
+ ["grade.title"] = "Large / small scale",
+ ["grade.large"] = "Large scale",
+ ["grade.medium"] = "Medium scale",
+ ["grade.small"] = "Small scale",
+ ["grade.largeNote"] = "Small area · detailed · e.g. campus plan",
+ ["grade.mediumNote"] = "Medium area · e.g. city map",
+ ["grade.smallNote"] = "Large area · simplified · e.g. world map",
+ ["grade.rule"] = "Bigger denominator → smaller scale → larger area → less detail",
+
+ ["pit.title"] = "Common mistakes",
+ ["pit.1"] = "① Forgetting to unify units: km ×100000 = cm",
+ ["pit.2"] = "② \"Zoom 2×\" means denominator ÷ 2, not × 2",
+ ["pit.3"] = "③ Don't swap map distance and real distance",
+
+ ["field.title"] = "Real-world ruler · how long on the map",
+ ["field.hint"] = "Pick a real distance and change the scale to see its map length",
+ ["field.mapLength"] = "On map {0}",
+ ["field.tooLong"] = "too long",
+ ["field.tooShort"] = "barely visible",
+
+ ["quiz.title"] = "Practice",
+ ["quiz.promptReal"] = "Scale 1:{0}, map distance {1} cm — what is the real distance? (enter the number in the shown unit)",
+ ["quiz.promptMap"] = "Scale 1:{0}, real distance {1} — what is the map distance in cm?",
+ ["quiz.promptScale"] = "{0} cm on the map = {1} on the ground — what is the scale denominator?",
+ ["quiz.answer"] = "Your answer",
+ ["quiz.check"] = "Check",
+ ["quiz.next"] = "Next",
+ ["quiz.correct"] = "✓ Correct!",
+ ["quiz.wrong"] = "✗ Try again — read the steps",
+ ["quiz.streak"] = "{0} in a row",
+ ["quiz.showSteps"] = "Show solution",
+ ["quiz.unit"] = "Unit: {0}",
+
+ ["ruler.title"] = "Visual ruler",
+ ["ruler.mapBar"] = "Map distance (real cm)",
+ ["ruler.realBar"] = "Real distance (compressed by the same scale)",
+ ["ruler.sameWidth"] = "same width as above",
+ ["ruler.equals"] = "equals",
+ ["ruler.segment"] = "Graphic scale",
+ ["ruler.segmentHint"] = "auto-ranging ticks",
+ ["ruler.spectrum"] = "Scale spectrum",
+ ["ruler.scopeUp"] = "◀ larger area",
+ ["ruler.detailDown"] = "more detail ▶",
+ ["ruler.hint"] = "Blue is the real map length; green is the same real distance compressed by the scale",
+ ["ruler.overflowMap"] = "This map distance overflows the sheet — use a smaller scale",
+ ["ruler.overflowReal"] = "This real distance won't fit at this scale — use a smaller scale",
+
+ ["unit.cm"] = "cm",
+ ["unit.m"] = "m",
+ ["unit.km"] = "km",
+ ["unit.none"] = "(unitless)",
+
+ ["spec.campus"] = "Campus",
+ ["spec.city"] = "City",
+ ["spec.china"] = "China",
+ ["spec.world"] = "World",
+
+ ["preset.campus"] = "Campus 1:10k",
+ ["preset.campusNote"] = "Buildings clearly drawn",
+ ["preset.town"] = "Town 1:50k",
+ ["preset.townNote"] = "Villages and roads",
+ ["preset.city"] = "City 1:250k",
+ ["preset.cityNote"] = "Urban area and arterials",
+ ["preset.province"] = "Province 1:1M",
+ ["preset.provinceNote"] = "Cities and rivers",
+ ["preset.china"] = "China 1:10M",
+ ["preset.chinaNote"] = "Province outlines",
+ ["preset.world"] = "World 1:100M",
+ ["preset.worldNote"] = "Continents & oceans",
+
+ ["lm.classroom"] = "Classroom 10 m",
+ ["lm.track"] = "Running track 400 m",
+ ["lm.marathon"] = "Marathon 42.195 km",
+ ["lm.beijingShanghai"] = "Beijing–Shanghai 1080 km",
+ ["lm.equator"] = "Equator 40,000 km",
+
+ ["common.footer"] = "Scale = map distance ÷ real distance · unify units first · bigger denominator = smaller scale"
+ };
+}
diff --git a/model/scale-calculator/src/ScaleCalculatorFactory.cs b/model/scale-calculator/src/ScaleCalculatorFactory.cs
new file mode 100644
index 0000000..179465a
--- /dev/null
+++ b/model/scale-calculator/src/ScaleCalculatorFactory.cs
@@ -0,0 +1,10 @@
+using EarthModelStudio.ModelSdk;
+
+namespace NeoRF.ScaleCalculator;
+
+/// 比例尺计算器模型入口(清单里的 type 指向这里)。
+public sealed class ScaleCalculatorFactory : IModelFactory
+{
+ public int ApiVersion => 1;
+ public IModelRuntime Create() => new ScaleCalculatorRuntime();
+}
diff --git a/model/scale-calculator/src/ScaleCalculatorModel.csproj b/model/scale-calculator/src/ScaleCalculatorModel.csproj
new file mode 100644
index 0000000..1e2de8f
--- /dev/null
+++ b/model/scale-calculator/src/ScaleCalculatorModel.csproj
@@ -0,0 +1,24 @@
+
+
+
+ net8.0
+ enable
+ disable
+ NeoRF.ScaleCalculator
+ ScaleCalculatorModel
+ true
+ false
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
diff --git a/model/scale-calculator/src/ScaleCalculatorRuntime.cs b/model/scale-calculator/src/ScaleCalculatorRuntime.cs
new file mode 100644
index 0000000..e494d50
--- /dev/null
+++ b/model/scale-calculator/src/ScaleCalculatorRuntime.cs
@@ -0,0 +1,78 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text.Json;
+using Avalonia.Controls;
+using EarthModelStudio.ModelSdk;
+
+namespace NeoRF.ScaleCalculator;
+
+///
+/// 比例尺计算器运行时。Prepare 在后台线程读数据/语言包,CreateView 在 UI 线程构建界面。
+/// 不依赖 _engine(没有球面渲染),只用 Avalonia 基础控件 + 一个自绘标尺。
+///
+public sealed class ScaleCalculatorRuntime : IModelRuntime
+{
+ private ScaleData? _data;
+ private Dictionary? _texts;
+
+ public void Prepare(IModelContext context)
+ {
+ context.ReportProgress(0.1, "载入预设数据");
+ _data = ScaleData.Load(context.DataDirectory);
+
+ context.ReportProgress(0.55, "载入语言包");
+ _texts = LoadTexts(context.DataDirectory, context.Language);
+
+ context.ReportProgress(0.9, "准备界面");
+ context.Log($"[scale-calculator] 语言 {context.Language}," +
+ $"预设 {_data.Presets.Count} 档 / 地标 {_data.Landmarks.Count} 个");
+ }
+
+ public Control CreateView(IModelContext context)
+ {
+ context.ReportProgress(0.96, "构建界面");
+ _data ??= ScaleData.Load(context.DataDirectory);
+ _texts ??= LoadTexts(context.DataDirectory, context.Language);
+ var view = new ScaleCalculatorView(_data, _texts, context.Language);
+ context.ReportProgress(1.0, "准备就绪");
+ return view;
+ }
+
+ public void Dispose()
+ {
+ _data = null;
+ _texts = null;
+ GC.SuppressFinalize(this);
+ }
+
+ private static Dictionary LoadTexts(string dataDir, string language)
+ {
+ // 先内置中文兜底,再按 language 覆盖,最后用 zh-CN 补齐缺键
+ var map = new Dictionary(DefaultTexts.Zh);
+ var isEn = language.StartsWith("en", StringComparison.OrdinalIgnoreCase);
+ if (isEn)
+ foreach (var kv in DefaultTexts.En) map[kv.Key] = kv.Value;
+
+ Overlay(Path.Combine(dataDir, "i18n", "zh-CN.json"), map);
+ if (isEn) Overlay(Path.Combine(dataDir, "i18n", "en.json"), map);
+ else Overlay(Path.Combine(dataDir, "i18n", language + ".json"), map);
+ return map;
+ }
+
+ private static void Overlay(string path, Dictionary target)
+ {
+ if (!File.Exists(path)) return;
+ try
+ {
+ var extra = JsonSerializer.Deserialize>(File.ReadAllText(path),
+ new JsonSerializerOptions { ReadCommentHandling = JsonCommentHandling.Skip, AllowTrailingCommas = true });
+ if (extra == null) return;
+ foreach (var kv in extra) target[kv.Key] = kv.Value;
+ }
+ catch (Exception ex)
+ {
+ Console.Error.WriteLine($"[scale-calculator] 语言包读取失败 {path}: {ex.Message}");
+ }
+ }
+}
diff --git a/model/scale-calculator/src/ScaleCalculatorView.Layout.cs b/model/scale-calculator/src/ScaleCalculatorView.Layout.cs
new file mode 100644
index 0000000..ccde528
--- /dev/null
+++ b/model/scale-calculator/src/ScaleCalculatorView.Layout.cs
@@ -0,0 +1,489 @@
+using System;
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Controls.Primitives;
+using Avalonia.Layout;
+using Avalonia.Media;
+
+namespace NeoRF.ScaleCalculator;
+
+public sealed partial class ScaleCalculatorView
+{
+ // 模式条
+ private Button _btnReal = null!, _btnMap = null!, _btnScale = null!;
+
+ // 左栏输入
+ private Slider _mapSlider = null!;
+ private TextBox _mapBox = null!, _realBox = null!, _nBox = null!;
+ private ComboBox _unitBox = null!;
+ private TextBlock _mapCardLabel = null!, _realCardLabel = null!, _scaleCardLabel = null!;
+ private TextBlock _mapResultText = null!, _realResultText = null!, _scaleResultText = null!;
+ private Border _mapCard = null!, _realCard = null!, _scaleCard = null!;
+ private WrapPanel _presetPanel = null!;
+
+ // 中栏
+ private ScaleRuler _ruler = null!;
+
+ // 右栏
+ private TextBlock _digitalText = null!, _verbalText = null!, _segmentText = null!;
+ private TextBlock _gradeTitle = null!, _gradeNote = null!, _gradeRule = null!;
+ private Border _gradeChip = null!;
+ private StackPanel _stepsPanel = null!;
+ private Button _stepsToggle = null!;
+ private bool _stepsOpen;
+
+ // 底部:实地尺
+ private ComboBox _landmarkBox = null!;
+ private TextBlock _landmarkResult = null!;
+
+ // 底部:练习
+ private TextBlock _quizPrompt = null!, _quizFeedback = null!, _quizStreak = null!, _quizUnit = null!;
+ private TextBox _quizInput = null!;
+ private Button _quizCheck = null!, _quizNext = null!;
+ private StackPanel _quizSteps = null!;
+
+ private void BuildLayout()
+ {
+ var root = new Grid { Background = B(CAppBg) };
+ root.RowDefinitions.Add(new RowDefinition(GridLength.Auto)); // 顶部
+ root.RowDefinitions.Add(new RowDefinition(GridLength.Star)); // 三栏
+ root.RowDefinitions.Add(new RowDefinition(GridLength.Auto)); // 底部
+ root.RowDefinitions.Add(new RowDefinition(GridLength.Auto)); // 页脚
+
+ var header = BuildHeader();
+ Grid.SetRow(header, 0);
+ root.Children.Add(header);
+
+ var columns = new Grid { Margin = new Thickness(16, 12, 16, 8) };
+ columns.ColumnDefinitions.Add(new ColumnDefinition(new GridLength(300)));
+ columns.ColumnDefinitions.Add(new ColumnDefinition(new GridLength(16)));
+ columns.ColumnDefinitions.Add(new ColumnDefinition(GridLength.Star));
+ columns.ColumnDefinitions.Add(new ColumnDefinition(new GridLength(16)));
+ columns.ColumnDefinitions.Add(new ColumnDefinition(new GridLength(320)));
+
+ var left = BuildLeft();
+ Grid.SetColumn(left, 0);
+ columns.Children.Add(left);
+ var mid = BuildMiddle();
+ Grid.SetColumn(mid, 2);
+ columns.Children.Add(mid);
+ var right = BuildRight();
+ Grid.SetColumn(right, 4);
+ columns.Children.Add(right);
+ Grid.SetRow(columns, 1);
+ root.Children.Add(columns);
+
+ var bottom = BuildBottom();
+ Grid.SetRow(bottom, 2);
+ root.Children.Add(bottom);
+
+ var footer = new Border
+ {
+ Background = B(CSurfaceAlt),
+ BorderBrush = B(CLine),
+ BorderThickness = new Thickness(0, 1, 0, 0),
+ Padding = new Thickness(20, 9),
+ Child = Tb(T("common.footer"), 11, CInkFaint)
+ };
+ Grid.SetRow(footer, 3);
+ root.Children.Add(footer);
+
+ Content = root;
+ }
+
+ private Control BuildHeader()
+ {
+ var title = Tb(T("app.title"), 22, CInk, FontWeight.SemiBold);
+ var sub = Tb(T("app.subtitle"), 12, CInkDim);
+
+ _btnReal = Btn(T("mode.real"));
+ _btnMap = Btn(T("mode.map"));
+ _btnScale = Btn(T("mode.scale"));
+
+ var modes = H(8);
+ modes.Children.Add(_btnReal);
+ modes.Children.Add(_btnMap);
+ modes.Children.Add(_btnScale);
+
+ var leftStack = V(2);
+ leftStack.Children.Add(title);
+ leftStack.Children.Add(sub);
+
+ var grid = new Grid
+ {
+ Background = B(CSurface),
+ Margin = new Thickness(0)
+ };
+ grid.ColumnDefinitions.Add(new ColumnDefinition(GridLength.Star));
+ grid.ColumnDefinitions.Add(new ColumnDefinition(GridLength.Auto));
+ var leftBorder = new Border { Padding = new Thickness(20, 14, 10, 14), Child = leftStack };
+ Grid.SetColumn(leftBorder, 0);
+ grid.Children.Add(leftBorder);
+ var rightBorder = new Border
+ {
+ Padding = new Thickness(10, 14, 20, 14),
+ VerticalAlignment = VerticalAlignment.Center,
+ Child = V(4)
+ };
+ // 右侧:提示 + 模式按钮
+ var rv = (StackPanel)rightBorder.Child!;
+ rv.Children.Add(Tb(T("mode.hint"), 10.5, CInkFaint, align: TextAlignment.Right));
+ rv.Children.Add(modes);
+ Grid.SetColumn(rightBorder, 1);
+ grid.Children.Add(rightBorder);
+
+ var outer = new Border
+ {
+ Background = B(CSurface),
+ BorderBrush = B(CLine),
+ BorderThickness = new Thickness(0, 0, 0, 1),
+ Child = grid
+ };
+ return outer;
+ }
+
+ private Control BuildLeft()
+ {
+ var panel = V(10);
+
+ var head = H(6);
+ head.Children.Add(new Border
+ {
+ Width = 4, Height = 16, Background = B(CAccent),
+ CornerRadius = new CornerRadius(2)
+ });
+ head.Children.Add(H3(T("input.title")));
+ panel.Children.Add(head);
+
+ // ── 图上距离卡
+ panel.Children.Add(BuildInputCard(
+ "input.map", "unit.cm", out _mapCard, out _mapCardLabel, out _mapResultText,
+ out _mapSlider, out _mapBox, withSlider: true));
+
+ // ── 实地距离卡
+ panel.Children.Add(BuildRealCard());
+
+ // ── 比例尺卡
+ panel.Children.Add(BuildScaleCard());
+
+ // 预设
+ panel.Children.Add(Label(T("input.presets"), 11.5, CInkFaint));
+ _presetPanel = new WrapPanel { Orientation = Orientation.Horizontal };
+ foreach (var p in _data.Presets)
+ {
+ var b = Btn(T(p.NameKey));
+ b.Tag = p;
+ b.Click += (_, _) => ApplyPreset((PresetItem)b.Tag!);
+ b.Margin = new Thickness(0, 0, 6, 6);
+ _presetPanel.Children.Add(b);
+ }
+ panel.Children.Add(_presetPanel);
+
+ panel.Children.Add(Divider());
+ var reset = Btn(T("input.reset"));
+ reset.Click += (_, _) => ResetState();
+ panel.Children.Add(reset);
+ panel.Children.Add(Tb(T("input.dragHint"), 10.5, CInkFaint));
+
+ var scroll = new ScrollViewer
+ {
+ Content = new Border { Padding = new Thickness(14), Child = panel },
+ VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
+ HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled
+ };
+ return Card(scroll);
+ }
+
+ private Control BuildInputCard(string labelKey, string unitKey,
+ out Border card, out TextBlock label, out TextBlock resultText,
+ out Slider slider, out TextBox box, bool withSlider)
+ {
+ label = Label(T(labelKey), 11.5);
+ resultText = Tb("—", 15, CInk, FontWeight.SemiBold);
+ var top = new DockPanel();
+ top.Children.Add(resultText);
+ DockPanel.SetDock(resultText, Dock.Right);
+ top.Children.Add(label);
+
+ box = Input("3");
+ box.Width = 110;
+ box.HorizontalAlignment = HorizontalAlignment.Left;
+
+ slider = new Slider
+ {
+ Minimum = 0.1,
+ Maximum = 20,
+ Value = 3,
+ TickFrequency = 0.5,
+ IsSnapToTickEnabled = false,
+ Foreground = B(CAccent),
+ Margin = new Thickness(0, 2, 0, 0)
+ };
+
+ var stack = V(6);
+ stack.Children.Add(top);
+ stack.Children.Add(box);
+ if (withSlider) stack.Children.Add(slider);
+
+ card = new Border
+ {
+ Background = B(CSurfaceAlt),
+ BorderBrush = B(CLine),
+ BorderThickness = new Thickness(1),
+ CornerRadius = new CornerRadius(10),
+ Padding = new Thickness(12),
+ Child = stack
+ };
+ return card;
+ }
+
+ private Control BuildRealCard()
+ {
+ _realCardLabel = Label(T("input.real"), 11.5);
+ _realResultText = Tb("—", 15, CInk, FontWeight.SemiBold);
+ var top = new DockPanel();
+ top.Children.Add(_realResultText);
+ DockPanel.SetDock(_realResultText, Dock.Right);
+ top.Children.Add(_realCardLabel);
+
+ _realBox = Input("3");
+ _unitBox = new ComboBox
+ {
+ FontSize = 12.5,
+ Background = B(CSurface),
+ Foreground = B(CInk),
+ BorderBrush = B(CLineStrong),
+ BorderThickness = new Thickness(1),
+ CornerRadius = new CornerRadius(9),
+ Padding = new Thickness(10, 6),
+ MinHeight = 34,
+ Width = 92,
+ ItemsSource = new[] { "unit.km", "unit.m", "unit.cm" },
+ SelectedIndex = 0
+ };
+ // 显示本地化单位名
+ _unitBox.SelectionChanged += (_, _) => { SyncUnitDisplay(); RefreshAll(syncInputs: true); };
+
+ var row = H(8);
+ row.Children.Add(_realBox);
+ row.Children.Add(_unitBox);
+
+ var stack = V(6);
+ stack.Children.Add(top);
+ stack.Children.Add(row);
+
+ _realCard = new Border
+ {
+ Background = B(CSurfaceAlt),
+ BorderBrush = B(CLine),
+ BorderThickness = new Thickness(1),
+ CornerRadius = new CornerRadius(10),
+ Padding = new Thickness(12),
+ Child = stack
+ };
+ return _realCard;
+ }
+
+ private Control BuildScaleCard()
+ {
+ _scaleCardLabel = Label(T("input.scale"), 11.5);
+ _scaleResultText = Tb("—", 15, CInk, FontWeight.SemiBold);
+ var top = new DockPanel();
+ top.Children.Add(_scaleResultText);
+ DockPanel.SetDock(_scaleResultText, Dock.Right);
+ top.Children.Add(_scaleCardLabel);
+
+ _nBox = Input("100000");
+ var prefix = Tb(T("input.nPrefix"), 13, CInkDim, FontWeight.SemiBold);
+ var row = H(8);
+ row.Children.Add(prefix);
+ row.Children.Add(_nBox);
+
+ var stack = V(6);
+ stack.Children.Add(top);
+ stack.Children.Add(row);
+
+ _scaleCard = new Border
+ {
+ Background = B(CSurfaceAlt),
+ BorderBrush = B(CLine),
+ BorderThickness = new Thickness(1),
+ CornerRadius = new CornerRadius(10),
+ Padding = new Thickness(12),
+ Child = stack
+ };
+ return _scaleCard;
+ }
+
+ private Control BuildMiddle()
+ {
+ _ruler = new ScaleRuler
+ {
+ Data = _data,
+ State = _state,
+ T = T,
+ Height = 470,
+ VerticalAlignment = VerticalAlignment.Top
+ };
+ var holder = new Border
+ {
+ Background = B(CSurface),
+ BorderBrush = B(CLine),
+ BorderThickness = new Thickness(1),
+ CornerRadius = new CornerRadius(14),
+ Padding = new Thickness(6),
+ Child = _ruler
+ };
+ return holder;
+ }
+
+ private Control BuildRight()
+ {
+ var panel = V(10);
+
+ // 三种写法
+ panel.Children.Add(SectionTitle(T("forms.title")));
+ _digitalText = Tb("", 16, CAccentDark, FontWeight.SemiBold);
+ _verbalText = Tb("", 12, CInk);
+ _segmentText = Tb("", 12, CInk);
+ var forms = V(8);
+ forms.Children.Add(FormRow(T("forms.digital"), _digitalText));
+ forms.Children.Add(FormRow(T("forms.verbal"), _verbalText));
+ forms.Children.Add(FormRow(T("forms.segment"), _segmentText));
+ panel.Children.Add(forms);
+
+ panel.Children.Add(Divider());
+
+ // 解题步骤
+ _stepsToggle = Btn(T("steps.show"));
+ _stepsToggle.Click += (_, _) => ToggleSteps();
+ var sh = new DockPanel();
+ DockPanel.SetDock(_stepsToggle, Dock.Right);
+ sh.Children.Add(_stepsToggle);
+ sh.Children.Add(SectionTitle(T("steps.title")));
+ panel.Children.Add(sh);
+ _stepsPanel = V(4);
+ _stepsPanel.IsVisible = false;
+ panel.Children.Add(_stepsPanel);
+
+ panel.Children.Add(Divider());
+
+ // 判读
+ panel.Children.Add(SectionTitle(T("grade.title")));
+ _gradeChip = Chip("", CAccentSoft, CAccentDark);
+ _gradeChip.HorizontalAlignment = HorizontalAlignment.Left;
+ _gradeTitle = Tb("", 13, CInk, FontWeight.SemiBold);
+ _gradeNote = Tb("", 11.5, CInkDim);
+ _gradeRule = Tb(T("grade.rule"), 11, CAccentDark, FontWeight.SemiBold);
+ var gradeBox = V(6);
+ gradeBox.Children.Add(_gradeChip);
+ gradeBox.Children.Add(_gradeNote);
+ gradeBox.Children.Add(_gradeRule);
+ panel.Children.Add(gradeBox);
+
+ panel.Children.Add(Divider());
+
+ // 易错点
+ panel.Children.Add(SectionTitle(T("pit.title")));
+ var pit = V(4);
+ pit.Children.Add(Tb(T("pit.1"), 11, CInkDim));
+ pit.Children.Add(Tb(T("pit.2"), 11, CInkDim));
+ pit.Children.Add(Tb(T("pit.3"), 11, CInkDim));
+ panel.Children.Add(pit);
+
+ var scroll = new ScrollViewer
+ {
+ Content = new Border { Padding = new Thickness(14), Child = panel },
+ VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
+ HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled
+ };
+ return Card(scroll);
+ }
+
+ private Control FormRow(string name, TextBlock value)
+ {
+ var g = new Grid();
+ g.ColumnDefinitions.Add(new ColumnDefinition(new GridLength(62)));
+ g.ColumnDefinitions.Add(new ColumnDefinition(GridLength.Star));
+ var n = Tb(name, 11, CInkFaint);
+ Grid.SetColumn(n, 0);
+ g.Children.Add(n);
+ Grid.SetColumn(value, 1);
+ g.Children.Add(value);
+ return g;
+ }
+
+ private Control SectionTitle(string text)
+ => Tb(text, 12.5, CInk, FontWeight.SemiBold);
+
+ private Control BuildBottom()
+ {
+ var grid = new Grid { Margin = new Thickness(16, 4, 16, 12) };
+ grid.ColumnDefinitions.Add(new ColumnDefinition(GridLength.Star));
+ grid.ColumnDefinitions.Add(new ColumnDefinition(new GridLength(12)));
+ grid.ColumnDefinitions.Add(new ColumnDefinition(new GridLength(1.4, GridUnitType.Star)));
+
+ // ── 实地尺
+ var field = V(8);
+ field.Children.Add(SectionTitle(T("field.title")));
+ field.Children.Add(Tb(T("field.hint"), 10.5, CInkFaint));
+ _landmarkBox = new ComboBox
+ {
+ FontSize = 12.5,
+ Background = B(CSurface),
+ Foreground = B(CInk),
+ BorderBrush = B(CLineStrong),
+ BorderThickness = new Thickness(1),
+ CornerRadius = new CornerRadius(9),
+ Padding = new Thickness(10, 6),
+ MinHeight = 34,
+ HorizontalAlignment = HorizontalAlignment.Stretch
+ };
+ foreach (var lm in _data.Landmarks) _landmarkBox.Items!.Add(T(lm.NameKey));
+ _landmarkBox.SelectedIndex = 0;
+ _landmarkBox.SelectionChanged += (_, _) => RefreshField();
+ field.Children.Add(_landmarkBox);
+ _landmarkResult = Tb("", 14, CSuccess, FontWeight.SemiBold);
+ field.Children.Add(_landmarkResult);
+ var fieldCard = Card(field);
+ Grid.SetColumn(fieldCard, 0);
+ grid.Children.Add(fieldCard);
+
+ // ── 练习
+ var quiz = V(8);
+ _quizStreak = Tb(TF("quiz.streak", 0), 11, CAccentDark, FontWeight.SemiBold);
+ var qh = new DockPanel();
+ DockPanel.SetDock(_quizStreak, Dock.Right);
+ qh.Children.Add(_quizStreak);
+ qh.Children.Add(SectionTitle(T("quiz.title")));
+ quiz.Children.Add(qh);
+
+ _quizPrompt = Tb("", 12, CInk);
+ quiz.Children.Add(_quizPrompt);
+ _quizUnit = Tb("", 10.5, CInkFaint);
+ quiz.Children.Add(_quizUnit);
+
+ var qrow = H(8);
+ _quizInput = Input("");
+ _quizInput.Width = 140;
+ _quizCheck = Btn(T("quiz.check"), primary: true);
+ _quizNext = Btn(T("quiz.next"));
+ _quizCheck.Click += (_, _) => CheckQuiz();
+ _quizNext.Click += (_, _) => NewQuiz();
+ qrow.Children.Add(_quizInput);
+ qrow.Children.Add(_quizCheck);
+ qrow.Children.Add(_quizNext);
+ quiz.Children.Add(qrow);
+
+ _quizFeedback = Tb("", 12, CInkDim, FontWeight.SemiBold);
+ quiz.Children.Add(_quizFeedback);
+ _quizSteps = V(2);
+ quiz.Children.Add(_quizSteps);
+
+ var quizCard = Card(quiz);
+ Grid.SetColumn(quizCard, 2);
+ grid.Children.Add(quizCard);
+
+ return grid;
+ }
+}
diff --git a/model/scale-calculator/src/ScaleCalculatorView.Logic.cs b/model/scale-calculator/src/ScaleCalculatorView.Logic.cs
new file mode 100644
index 0000000..09a6592
--- /dev/null
+++ b/model/scale-calculator/src/ScaleCalculatorView.Logic.cs
@@ -0,0 +1,312 @@
+using System;
+using System.Globalization;
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Controls.Primitives;
+using Avalonia.Media;
+
+namespace NeoRF.ScaleCalculator;
+
+public sealed partial class ScaleCalculatorView
+{
+ private readonly ScaleState _state = new();
+ private bool _suppress;
+ private string _realUnit = "unit.km";
+ private QuizItem _quiz = new();
+ private int _streak;
+ private bool _quizAnswered;
+
+ private void WireEvents()
+ {
+ _btnReal.Click += (_, _) => SetMode(SolveMode.Real);
+ _btnMap.Click += (_, _) => SetMode(SolveMode.Map);
+ _btnScale.Click += (_, _) => SetMode(SolveMode.Scale);
+
+ _mapSlider.ValueChanged += (_, e) =>
+ {
+ if (_suppress) return;
+ _state.MapCm = e.NewValue;
+ _suppress = true;
+ _mapBox.Text = ScaleMath.Num(_state.MapCm);
+ _suppress = false;
+ RefreshAll(syncInputs: false);
+ };
+ _mapBox.TextChanged += (_, _) => OnTextInput(_mapBox, v => { _state.MapCm = v; }, v =>
+ {
+ _suppress = true;
+ _mapSlider.Value = Math.Clamp(v, 0.1, 20);
+ _suppress = false;
+ });
+ _realBox.TextChanged += (_, _) =>
+ {
+ if (_suppress) return;
+ if (ScaleMath.TryParseReal(_realBox.Text ?? "", _realUnit, out var cm))
+ {
+ _state.RealCm = cm;
+ RefreshAll(syncInputs: false);
+ }
+ };
+ _nBox.TextChanged += (_, _) => OnTextInput(_nBox, v => { _state.N = v; }, null);
+
+ _quizInput.KeyDown += (_, e) =>
+ {
+ if (e.Key == Avalonia.Input.Key.Enter) CheckQuiz();
+ };
+ }
+
+ private void OnTextInput(TextBox box, Action apply, Action? extra)
+ {
+ if (_suppress) return;
+ if (!double.TryParse((box.Text ?? "").Replace(",", "").Trim(), NumberStyles.Float,
+ CultureInfo.InvariantCulture, out var v) || v < 0 || double.IsNaN(v) || double.IsInfinity(v))
+ return;
+ apply(v);
+ extra?.Invoke(v);
+ RefreshAll(syncInputs: false);
+ }
+
+ private void SetMode(SolveMode mode, bool initial = false)
+ {
+ _state.Mode = mode;
+ if (!initial) ScaleMath.Solve(_state);
+ UpdateModeButtons();
+ RefreshAll(syncInputs: true);
+ }
+
+ private void UpdateModeButtons()
+ {
+ StyleMode(_btnReal, _state.Mode == SolveMode.Real);
+ StyleMode(_btnMap, _state.Mode == SolveMode.Map);
+ StyleMode(_btnScale, _state.Mode == SolveMode.Scale);
+
+ // 结果卡高亮:待求的那一张变蓝
+ StyleCard(_mapCard, _state.Mode == SolveMode.Map);
+ StyleCard(_realCard, _state.Mode == SolveMode.Real);
+ StyleCard(_scaleCard, _state.Mode == SolveMode.Scale);
+
+ _mapResultText.Foreground = B(_state.Mode == SolveMode.Map ? CAccentDark : CInk);
+ _realResultText.Foreground = B(_state.Mode == SolveMode.Real ? CAccentDark : CInk);
+ _scaleResultText.Foreground = B(_state.Mode == SolveMode.Scale ? CAccentDark : CInk);
+ }
+
+ private void StyleMode(Button b, bool active)
+ {
+ b.Background = B(active ? CAccent : CSurface);
+ b.BorderBrush = B(active ? CAccent : CLineStrong);
+ b.BorderThickness = new Thickness(active ? 0 : 1);
+ if (b.Content is TextBlock t)
+ t.Foreground = B(active ? Colors.White : CInk);
+ }
+
+ private static void StyleCard(Border card, bool active)
+ {
+ card.Background = B(active ? Color.Parse("#F0F5FF") : Color.Parse("#F7F9FE"));
+ card.BorderBrush = B(active ? Color.Parse("#2F6BFF") : Color.Parse("#E3E8F3"));
+ card.BorderThickness = new Thickness(active ? 1.5 : 1);
+ }
+
+ private void ApplyPreset(PresetItem p)
+ {
+ _state.N = p.N;
+ ScaleMath.Solve(_state);
+ RefreshAll(syncInputs: true);
+ }
+
+ private void ResetState()
+ {
+ _state.MapCm = 3.0;
+ _state.N = 100000.0;
+ ScaleMath.Solve(_state);
+ RefreshAll(syncInputs: true);
+ }
+
+ private void SyncUnitDisplay()
+ {
+ // ComboBox 的 ItemsSource 是 "unit.km" 等键;这里只记录选择,显示由下拉项本身处理
+ var idx = _unitBox.SelectedIndex;
+ _realUnit = idx switch { 1 => "unit.m", 2 => "unit.cm", _ => "unit.km" };
+ }
+
+ ///
+ /// 全量刷新。syncInputs=true 时把三个输入框/滑块同步成 state(切换模式、预设、重置后需要);
+ /// false 时保留用户正在输入的文本(避免光标跳动)。
+ ///
+ private void RefreshAll(bool syncInputs)
+ {
+ ScaleMath.Solve(_state);
+
+ if (syncInputs)
+ {
+ _suppress = true;
+ _mapBox.Text = ScaleMath.Num(_state.MapCm);
+ _mapSlider.Value = Math.Clamp(_state.MapCm, 0.1, 20);
+ _nBox.Text = ScaleMath.FormatN(_state.N);
+ var (rv, _) = ScaleMath.HumanReal(_state.RealCm);
+ // 用当前选择的单位显示
+ _realBox.Text = ScaleMath.Num(ScaleMath.ToUnit(_state.RealCm, _realUnit));
+ _suppress = false;
+ }
+
+ UpdateModeButtons();
+
+ // 结果卡读数(三张都显示当前值,蓝色那张是"答案")
+ _mapResultText.Text = ScaleMath.Num(_state.MapCm) + " " + T("unit.cm");
+ var (rv2, rkey2) = ScaleMath.HumanReal(_state.RealCm);
+ _realResultText.Text = ScaleMath.Num(rv2) + " " + T(rkey2);
+ _scaleResultText.Text = "1 : " + ScaleMath.FormatN(_state.N);
+
+ // 三种写法
+ _digitalText.Text = ScaleMath.Digital(_state.N);
+ _verbalText.Text = TF("forms.verbalTpl", ScaleMath.VerbalDistance(_state.N));
+ _segmentText.Text = TF("forms.segmentDesc",
+ ScaleMath.SegmentLabel(_ruler.Segment.MetersPerDiv), _ruler.Segment.DivCount);
+
+ // 判读
+ var gradeKey = ScaleMath.GradeKey(_state.N);
+ _gradeTitle.Text = T(gradeKey);
+ _gradeChip.Child = Tb(T(gradeKey), 11, CAccentDark, FontWeight.SemiBold);
+ _gradeNote.Text = T(gradeKey + "Note");
+ _gradeRule.Text = T("grade.rule");
+
+ // 标尺
+ _ruler.State = _state.Clone();
+ _ruler.Refresh();
+ _segmentText.Text = TF("forms.segmentDesc",
+ ScaleMath.SegmentLabel(_ruler.Segment.MetersPerDiv), _ruler.Segment.DivCount);
+
+ BuildSteps();
+ RefreshField();
+ }
+
+ private void BuildSteps()
+ {
+ _stepsPanel.Children.Clear();
+ var map = ScaleMath.Num(_state.MapCm);
+ var realCm = ScaleMath.Num(_state.RealCm);
+ var n = ScaleMath.FormatN(_state.N);
+ var (rv, rk) = ScaleMath.HumanReal(_state.RealCm);
+ var result = _state.Mode switch
+ {
+ SolveMode.Real => ScaleMath.Num(rv) + " " + T(rk),
+ SolveMode.Map => ScaleMath.Num(_state.MapCm) + " " + T("unit.cm"),
+ _ => "1 : " + ScaleMath.FormatN(_state.N)
+ };
+ var formulaKey = _state.Mode switch
+ {
+ SolveMode.Real => "steps.2.formulaReal",
+ SolveMode.Map => "steps.2.formulaMap",
+ _ => "steps.2.formulaScale"
+ };
+ var substitute = _state.Mode switch
+ {
+ SolveMode.Real => map + " cm × " + n,
+ SolveMode.Map => realCm + " cm ÷ " + n,
+ _ => realCm + " cm ÷ " + map + " cm"
+ };
+
+ var lines = new System.Collections.Generic.List
+ {
+ T("steps.1.unify"),
+ T(formulaKey),
+ TF("steps.3.substitute", substitute),
+ TF("steps.4.result", result),
+ T("steps.5.convert")
+ };
+ var i = 0;
+ foreach (var line in lines)
+ {
+ _stepsPanel.Children.Add(Tb(line, 11, i == 3 ? CAccentDark : CInkDim,
+ i == 3 ? FontWeight.SemiBold : null));
+ i++;
+ }
+ }
+
+ private void ToggleSteps()
+ {
+ _stepsOpen = !_stepsOpen;
+ _stepsPanel.IsVisible = _stepsOpen;
+ _stepsToggle.Content = Tb(T(_stepsOpen ? "steps.hide" : "steps.show"), 12.5, CInk, FontWeight.SemiBold);
+ }
+
+ private void RefreshField()
+ {
+ var idx = _landmarkBox.SelectedIndex;
+ if (idx < 0 || idx >= _data.Landmarks.Count) return;
+ var meters = _data.Landmarks[idx].Meters;
+ var realCm = meters * ScaleMath.CmPerM;
+ var mapCm = ScaleMath.RealToMapCm(realCm, _state.N);
+ var px = ScaleMath.CmToPx(mapCm, _ruler.PxPerCm);
+ // mapCm 是厘米,按 HumanReal 换算成"图上长度"的合适单位
+ var (mv, mk) = ScaleMath.HumanReal(mapCm);
+
+ string text;
+ if (px > _ruler.MaxBarWidth)
+ text = TF("field.mapLength", ScaleMath.Num(mv) + " " + T(mk)) + " · " + T("field.tooLong");
+ else if (px < 1)
+ text = TF("field.mapLength", ScaleMath.Num(mv) + " " + T(mk)) + " · " + T("field.tooShort");
+ else
+ text = TF("field.mapLength", ScaleMath.Num(mv) + " " + T(mk));
+ _landmarkResult.Text = text;
+ _landmarkResult.Foreground = B(px > _ruler.MaxBarWidth ? CDanger : px < 1 ? CWarn : CSuccess);
+ }
+
+ // ────────────────────────────────────────────────────────── 练习
+
+ private void NewQuiz()
+ {
+ _quiz = ScaleMath.GenerateQuiz(_rnd);
+ _quizAnswered = false;
+ _quizInput.Text = "";
+ _quizFeedback.Text = "";
+ _quizSteps.Children.Clear();
+ _quizPrompt.Text = TF(_quiz.PromptKey, _quiz.PromptArgs);
+ var unitText = _quiz.AnswerUnitKey == "unit.none" ? T("unit.none") : T(_quiz.AnswerUnitKey);
+ _quizUnit.Text = TF("quiz.unit", unitText);
+ _quizStreak.Text = TF("quiz.streak", _streak);
+ }
+
+ private void CheckQuiz()
+ {
+ if (_quizAnswered) return;
+ if (!double.TryParse((_quizInput.Text ?? "").Replace(",", "").Trim(), NumberStyles.Float,
+ CultureInfo.InvariantCulture, out var v))
+ {
+ _quizFeedback.Text = T("quiz.wrong");
+ _quizFeedback.Foreground = B(CDanger);
+ return;
+ }
+
+ if (ScaleMath.CheckAnswer(_quiz, v))
+ {
+ _streak++;
+ _quizFeedback.Text = T("quiz.correct");
+ _quizFeedback.Foreground = B(CSuccess);
+ }
+ else
+ {
+ _streak = 0;
+ _quizFeedback.Text = T("quiz.wrong");
+ _quizFeedback.Foreground = B(CDanger);
+ ShowQuizSteps();
+ }
+ _quizAnswered = true;
+ _quizStreak.Text = TF("quiz.streak", _streak);
+ }
+
+ private void ShowQuizSteps()
+ {
+ _quizSteps.Children.Clear();
+ _quizSteps.Children.Add(Tb(T("quiz.showSteps"), 10.5, CInkFaint, FontWeight.SemiBold));
+ foreach (var key in _quiz.StepKeys)
+ {
+ var line = T(key);
+ if (line.Contains("{0}")) line = TF(key, ScaleMath.Num(_quiz.Answer) + " " +
+ (_quiz.AnswerUnitKey == "unit.none" ? "" : T(_quiz.AnswerUnitKey)));
+ _quizSteps.Children.Add(Tb(line, 10.5, CInkDim));
+ }
+ _quizSteps.Children.Add(Tb(TF("steps.4.result",
+ ScaleMath.Num(_quiz.Answer) + " " +
+ (_quiz.AnswerUnitKey == "unit.none" ? "" : T(_quiz.AnswerUnitKey))),
+ 10.5, CAccentDark, FontWeight.SemiBold));
+ }
+}
diff --git a/model/scale-calculator/src/ScaleCalculatorView.cs b/model/scale-calculator/src/ScaleCalculatorView.cs
new file mode 100644
index 0000000..e9d115b
--- /dev/null
+++ b/model/scale-calculator/src/ScaleCalculatorView.cs
@@ -0,0 +1,141 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Controls.Primitives;
+using Avalonia.Input;
+using Avalonia.Layout;
+using Avalonia.Media;
+
+namespace NeoRF.ScaleCalculator;
+
+///
+/// 比例尺计算器主界面。三栏(已知量 / 可视化标尺 / 三种写法与判读)+ 底部实地尺与练习。
+/// 全部用显式画刷(与启动器 AppTheme 同色),不依赖 DynamicResource —— 模型 dll 在
+/// 独立 ALC 里加载,headless 生成封面时也没有 Application 样式。
+///
+public sealed partial class ScaleCalculatorView : UserControl
+{
+ // 调色(与 src/main/dotnet/EarthModelStudio/Styles/AppTheme.axaml 一致)
+ internal static readonly Color CAppBg = Color.Parse("#F4F6FB");
+ internal static readonly Color CSurface = Color.Parse("#FFFFFF");
+ internal static readonly Color CSurfaceAlt = Color.Parse("#F7F9FE");
+ internal static readonly Color CLine = Color.Parse("#E3E8F3");
+ internal static readonly Color CLineStrong = Color.Parse("#D2DAEA");
+ internal static readonly Color CInk = Color.Parse("#111A2E");
+ internal static readonly Color CInkDim = Color.Parse("#5B6A86");
+ internal static readonly Color CInkFaint = Color.Parse("#8A97B1");
+ internal static readonly Color CAccent = Color.Parse("#2F6BFF");
+ internal static readonly Color CAccentDark = Color.Parse("#1F4FD0");
+ internal static readonly Color CAccentSoft = Color.Parse("#EAF1FF");
+ internal static readonly Color CSuccess = Color.Parse("#1F9D6B");
+ internal static readonly Color CDanger = Color.Parse("#D64545");
+ internal static readonly Color CWarn = Color.Parse("#D98613");
+ internal static readonly Color CHero = Color.Parse("#12203C");
+
+ internal static SolidColorBrush B(Color c) => new(c);
+ internal static SolidColorBrush Brush(string hex) => new(Color.Parse(hex));
+
+ private readonly ScaleData _data;
+ private readonly Dictionary _texts;
+ private readonly string _language;
+ private readonly Random _rnd = new();
+
+ public string T(string key)
+ => _texts.TryGetValue(key, out var v) ? v
+ : DefaultTexts.Zh.TryGetValue(key, out var f) ? f : key;
+
+ public string TF(string key, params object[] args)
+ => string.Format(CultureInfo.InvariantCulture, T(key), args);
+
+ public ScaleCalculatorView(ScaleData data, Dictionary texts, string language)
+ {
+ _data = data;
+ _texts = texts;
+ _language = language;
+
+ BuildLayout();
+ WireEvents();
+ SetMode(SolveMode.Real, initial: true);
+ NewQuiz();
+ RefreshAll(syncInputs: true);
+ }
+
+ // ────────────────────────────────────────────────────────── 小工具
+
+ internal static Border Card(Control content, double radius = 14)
+ => new()
+ {
+ Background = B(CSurface),
+ BorderBrush = B(CLine),
+ BorderThickness = new Thickness(1),
+ CornerRadius = new CornerRadius(radius),
+ Padding = new Thickness(14),
+ Child = content
+ };
+
+ internal static TextBlock Tb(string text, double size, Color color, FontWeight? weight = null,
+ TextAlignment align = TextAlignment.Left)
+ => new()
+ {
+ Text = text,
+ FontSize = size,
+ Foreground = B(color),
+ FontWeight = weight ?? FontWeight.Normal,
+ TextAlignment = align,
+ TextWrapping = TextWrapping.Wrap
+ };
+
+ internal static TextBlock Label(string text, double size = 12, Color? color = null)
+ => Tb(text, size, color ?? CInkDim);
+
+ internal static TextBlock H3(string text) => Tb(text, 13.5, CInk, FontWeight.SemiBold);
+
+ internal static Border Chip(string text, Color bg, Color fg, double radius = 8)
+ => new()
+ {
+ Background = B(bg),
+ CornerRadius = new CornerRadius(radius),
+ Padding = new Thickness(10, 4),
+ Child = Tb(text, 11, fg, FontWeight.SemiBold)
+ };
+
+ internal static Button Btn(string text, bool primary = false)
+ => new()
+ {
+ Content = Tb(text, 12.5, primary ? Colors.White : CInk, FontWeight.SemiBold),
+ Background = B(primary ? CAccent : CSurface),
+ BorderBrush = B(primary ? CAccent : CLineStrong),
+ BorderThickness = new Thickness(primary ? 0 : 1),
+ CornerRadius = new CornerRadius(9),
+ Padding = new Thickness(12, 7),
+ HorizontalContentAlignment = HorizontalAlignment.Center,
+ VerticalContentAlignment = VerticalAlignment.Center,
+ Cursor = new Cursor(StandardCursorType.Hand)
+ };
+
+ internal static TextBox Input(string text = "")
+ => new()
+ {
+ Text = text,
+ FontSize = 12.5,
+ Background = B(CSurface),
+ Foreground = B(CInk),
+ BorderBrush = B(CLineStrong),
+ BorderThickness = new Thickness(1),
+ CornerRadius = new CornerRadius(9),
+ Padding = new Thickness(10, 7),
+ VerticalContentAlignment = VerticalAlignment.Center,
+ MinHeight = 34
+ };
+
+ internal static Border Divider(double h = 1)
+ => new() { Background = B(CLine), Height = h, Margin = new Thickness(0, 10, 0, 10) };
+
+ internal static StackPanel V(double spacing = 8)
+ => new() { Orientation = Orientation.Vertical, Spacing = spacing };
+
+ internal static StackPanel H(double spacing = 8)
+ => new() { Orientation = Orientation.Horizontal, Spacing = spacing, VerticalAlignment = VerticalAlignment.Center };
+}
diff --git a/model/scale-calculator/src/ScaleData.cs b/model/scale-calculator/src/ScaleData.cs
new file mode 100644
index 0000000..9c22c6e
--- /dev/null
+++ b/model/scale-calculator/src/ScaleData.cs
@@ -0,0 +1,88 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+
+namespace NeoRF.ScaleCalculator;
+
+public sealed class PresetItem
+{
+ public double N { get; set; }
+ public string NameKey { get; set; } = "";
+ public string NoteKey { get; set; } = "";
+}
+
+public sealed class SpectrumItem
+{
+ public double N { get; set; }
+ public string LabelKey { get; set; } = "";
+ public string ScopeKey { get; set; } = "";
+}
+
+public sealed class LandmarkItem
+{
+ public string NameKey { get; set; } = "";
+ /// 实地距离(米)。
+ public double Meters { get; set; }
+}
+
+public sealed class ScaleData
+{
+ public List Presets { get; set; } = new();
+ public List Spectrum { get; set; } = new();
+ public List Landmarks { get; set; } = new();
+
+ private static readonly JsonSerializerOptions Opts = new()
+ {
+ PropertyNameCaseInsensitive = true,
+ ReadCommentHandling = JsonCommentHandling.Skip,
+ AllowTrailingCommas = true,
+ NumberHandling = JsonNumberHandling.AllowReadingFromString
+ };
+
+ public static ScaleData Load(string dataDir)
+ {
+ var path = Path.Combine(dataDir, "scales.json");
+ if (!File.Exists(path)) return Fallback();
+ try
+ {
+ var d = JsonSerializer.Deserialize(File.ReadAllText(path), Opts);
+ if (d == null || d.Presets.Count == 0) return Fallback();
+ return d;
+ }
+ catch (Exception ex)
+ {
+ Console.Error.WriteLine($"[scale-calculator] 读取 scales.json 失败: {ex.Message}");
+ return Fallback();
+ }
+ }
+
+ private static ScaleData Fallback() => new()
+ {
+ Presets = new List
+ {
+ new() { N = 10000, NameKey = "preset.campus", NoteKey = "preset.campusNote" },
+ new() { N = 50000, NameKey = "preset.town", NoteKey = "preset.townNote" },
+ new() { N = 250000, NameKey = "preset.city", NoteKey = "preset.cityNote" },
+ new() { N = 1000000, NameKey = "preset.province", NoteKey = "preset.provinceNote" },
+ new() { N = 10000000, NameKey = "preset.china", NoteKey = "preset.chinaNote" },
+ new() { N = 100000000, NameKey = "preset.world", NoteKey = "preset.worldNote" }
+ },
+ Spectrum = new List
+ {
+ new() { N = 10000, LabelKey = "spec.campus", ScopeKey = "spec.campusScope" },
+ new() { N = 250000, LabelKey = "spec.city", ScopeKey = "spec.cityScope" },
+ new() { N = 10000000, LabelKey = "spec.china", ScopeKey = "spec.chinaScope" },
+ new() { N = 100000000, LabelKey = "spec.world", ScopeKey = "spec.worldScope" }
+ },
+ Landmarks = new List
+ {
+ new() { NameKey = "lm.classroom", Meters = 10 },
+ new() { NameKey = "lm.track", Meters = 400 },
+ new() { NameKey = "lm.marathon", Meters = 42195 },
+ new() { NameKey = "lm.beijingShanghai", Meters = 1080000 },
+ new() { NameKey = "lm.equator", Meters = 40000000 }
+ }
+ };
+}
diff --git a/model/scale-calculator/src/ScaleMath.cs b/model/scale-calculator/src/ScaleMath.cs
new file mode 100644
index 0000000..879b27d
--- /dev/null
+++ b/model/scale-calculator/src/ScaleMath.cs
@@ -0,0 +1,291 @@
+using System;
+using System.Globalization;
+
+namespace NeoRF.ScaleCalculator;
+
+/// 三种求解模式:待求的量。
+public enum SolveMode
+{
+ /// 求实地距离
+ Real,
+ /// 求图上距离
+ Map,
+ /// 求比例尺
+ Scale
+}
+
+public enum ScaleGrade { Large, Medium, Small }
+
+///
+/// 三个量始终同时存在:图上距离(cm)、实地距离(cm)、比例尺分母 N。
+/// 指定哪个是"待求结果",另两个是输入;
+/// 只由两个输入重算结果量,切换模式时数值保持连续。
+///
+public sealed class ScaleState
+{
+ public double MapCm = 3.0;
+ public double RealCm = 300000.0; // 3 km
+ public double N = 100000.0; // 1:100000
+ public SolveMode Mode = SolveMode.Real;
+
+ public ScaleState Clone() => new()
+ {
+ MapCm = MapCm, RealCm = RealCm, N = N, Mode = Mode
+ };
+}
+
+/// 线段式比例尺换挡结果。
+public sealed class SegmentScale
+{
+ /// 每一格代表的实地距离(米)。
+ public double MetersPerDiv;
+ /// 每一格在屏幕上的像素宽度。
+ public double DivPx;
+ /// 绘制的格数。
+ public int DivCount = 5;
+}
+
+/// 一道练习题。
+public sealed class QuizItem
+{
+ public SolveMode Mode;
+ public string PromptKey = "";
+ public object[] PromptArgs = Array.Empty