This commit is contained in:
2509_92447106 committed 2026-11-12 19:30:45 +08:00
1 parent 7de92a25f5
commit 0e86c17056
131 files changed
+1309 -907

No files matched your search

+1 -1
View File
@@ -21,7 +21,7 @@
-->
<AvaloniaVersion>11.3.9</AvaloniaVersion>
<MvvmVersion>8.2.2</MvvmVersion>
<Version>1.0.4</Version>
<Version>1.0.5</Version>
<Company>NeoRF</Company>
<Product>Earth Model Studio</Product>
<NeutralLanguage>zh-Hans</NeutralLanguage>
@@ -6,7 +6,7 @@
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {
"VersionStamp/1.0.4": {
"VersionStamp/1.0.5": {
"runtime": {
"VersionStamp.dll": {}
}
@@ -14,7 +14,7 @@
}
},
"libraries": {
"VersionStamp/1.0.4": {
"VersionStamp/1.0.5": {
"type": "project",
"serviceable": false,
"sha512": ""
@@ -12,11 +12,11 @@ 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+936aec81850fb15f55014c66116d174dc9e2f967")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.5.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.5+7de92a25f5b91dfe2b85dcd95639fdcc353badf2")]
[assembly: System.Reflection.AssemblyProductAttribute("Earth Model Studio")]
[assembly: System.Reflection.AssemblyTitleAttribute("VersionStamp")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.4.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.5.0")]
[assembly: System.Resources.NeutralResourcesLanguageAttribute("zh-Hans")]
// Generated by the MSBuild WriteCodeFragment class.
@@ -1 +1 @@
227dfd55e1626217a9b4b76559607d369bc84a173b8c542681a836eb300be0a1
25ae86342f7aef96f55d822e4132919c7d8a2fcbeeecb4d340860a96977bc7a0
@@ -5,7 +5,7 @@
},
"projects": {
"/Users/morris/Downloads/GC#/model/_engine/VersionStamp/VersionStamp.csproj": {
"version": "1.0.4",
"version": "1.0.5",
"restore": {
"projectUniqueName": "/Users/morris/Downloads/GC#/model/_engine/VersionStamp/VersionStamp.csproj",
"projectName": "VersionStamp",
@@ -11,7 +11,7 @@
"/Users/morris/.nuget/packages/": {}
},
"project": {
"version": "1.0.4",
"version": "1.0.5",
"restore": {
"projectUniqueName": "/Users/morris/Downloads/GC#/model/_engine/VersionStamp/VersionStamp.csproj",
"projectName": "VersionStamp",
@@ -1,6 +1,6 @@
{
"version": 2,
"dgSpecHash": "d5HD23m5HNE=",
"dgSpecHash": "0mFpXnqc6/I=",
"success": true,
"projectFilePath": "/Users/morris/Downloads/GC#/model/_engine/VersionStamp/VersionStamp.csproj",
"expectedPackageFiles": [],
+30 -8
View File
@@ -44,10 +44,33 @@ public static class Geometry
float radius, float centerX, float centerY,
bool closed = false)
{
var result = new List<List<Vector2>>();
if (latLonPoints.Count < 2) return result;
// 兼容旧调用:按需转换(点位少的分支,如洲界)
var unit = new Vector3[latLonPoints.Count];
for (var i = 0; i < latLonPoints.Count; i++)
{
var p = latLonPoints[i];
unit[i] = p.Length >= 2 ? LatLonToUnit(p[1], p[0]) : Vector3.Zero;
}
var valid = new bool[unit.Length];
for (var i = 0; i < latLonPoints.Count; i++) valid[i] = latLonPoints[i].Length >= 2;
return ProjectUnitPolyline(unit, valid, planet, cam, radius, centerX, centerY, closed);
}
var count = latLonPoints.Count;
/// <summary>
/// 预计算单位球坐标后的快速投影:每帧只做矩阵乘 + 正交投影,
/// 不再重复计算 sin/cos(地理模型约 2.6 万个点,这是最大开销)。
/// </summary>
public static List<List<Vector2>> ProjectUnitPolyline(
IReadOnlyList<Vector3> unitPoints,
IReadOnlyList<bool> valid,
Matrix4x4 planet, Matrix4x4 cam,
float radius, float centerX, float centerY,
bool closed = false)
{
var result = new List<List<Vector2>>();
if (unitPoints.Count < 2) return result;
var count = unitPoints.Count;
var total = closed ? count + 1 : count;
List<Vector2>? current = null;
@@ -56,18 +79,17 @@ public static class Geometry
for (var i = 0; i < total; i++)
{
var p = latLonPoints[i % count];
if (p.Length < 2) { havePrev = false; continue; }
var k = i % count;
if (!valid[k]) { havePrev = false; continue; }
var camPos = ToCamera(LatLonToUnit(p[1], p[0]), planet, cam);
var camPos = Vector3.Transform(Vector3.Transform(unitPoints[k], planet), cam);
var visible = camPos.Z > 0f;
if (!havePrev)
{
if (visible)
{
current = new List<Vector2>();
current.Add(Project(camPos, radius, centerX, centerY));
current = new List<Vector2> { Project(camPos, radius, centerX, centerY) };
}
prevCam = camPos;
havePrev = true;
@@ -6,7 +6,7 @@
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {
"EarthModelStudio.ModelSdk/1.0.4": {
"EarthModelStudio.ModelSdk/1.0.5": {
"dependencies": {
"Avalonia": "11.3.9"
},
@@ -85,7 +85,7 @@
}
},
"libraries": {
"EarthModelStudio.ModelSdk/1.0.4": {
"EarthModelStudio.ModelSdk/1.0.5": {
"type": "project",
"serviceable": false,
"sha512": ""
@@ -6,7 +6,7 @@
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {
"EarthModelStudio.ModelSdk/1.0.4": {
"EarthModelStudio.ModelSdk/1.0.5": {
"dependencies": {
"Avalonia": "11.3.9"
},
@@ -85,7 +85,7 @@
}
},
"libraries": {
"EarthModelStudio.ModelSdk/1.0.4": {
"EarthModelStudio.ModelSdk/1.0.5": {
"type": "project",
"serviceable": false,
"sha512": ""
@@ -13,11 +13,11 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("NeoRF")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyDescriptionAttribute("Earth Model 模型契约:启动器与模型之间唯一的编译期依赖。")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.4.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.4+f69a8fbb7fa563800802d3c2e319ed56365c3b8c")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.5.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.5+7de92a25f5b91dfe2b85dcd95639fdcc353badf2")]
[assembly: System.Reflection.AssemblyProductAttribute("Earth Model Studio")]
[assembly: System.Reflection.AssemblyTitleAttribute("EarthModelStudio.ModelSdk")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.4.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.5.0")]
[assembly: System.Resources.NeutralResourcesLanguageAttribute("zh-Hans")]
// Generated by the MSBuild WriteCodeFragment class.
@@ -1 +1 @@
d6cbf6a817e6aee9414cc9cd44beae17a3d7a177fe3f87185800ffb9e4ec71ca
333d391e56b5f8ac1b45ed85b7e0835410214f510c5f7dbd262998bc4f766e86
@@ -5,7 +5,7 @@
},
"projects": {
"/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/EarthModelStudio.ModelSdk.csproj": {
"version": "1.0.4",
"version": "1.0.5",
"restore": {
"projectUniqueName": "/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/EarthModelStudio.ModelSdk.csproj",
"projectName": "EarthModelStudio.ModelSdk",
@@ -13,11 +13,11 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("NeoRF")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyDescriptionAttribute("Earth Model 模型契约:启动器与模型之间唯一的编译期依赖。")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.4.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.4+874c97ee271617592f530440ae8879461e91488b")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.5.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.5+7de92a25f5b91dfe2b85dcd95639fdcc353badf2")]
[assembly: System.Reflection.AssemblyProductAttribute("Earth Model Studio")]
[assembly: System.Reflection.AssemblyTitleAttribute("EarthModelStudio.ModelSdk")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.4.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.5.0")]
[assembly: System.Resources.NeutralResourcesLanguageAttribute("zh-Hans")]
// Generated by the MSBuild WriteCodeFragment class.
@@ -1 +1 @@
1e556d89cb334279dd738ee053373abdd6a4398ad2892bf59fdbda53299c0ae5
6c7c97c3f02eeffc76d4879c61550f9a465c23d5767074c56b7ae34e38adcbd9
@@ -344,7 +344,7 @@
"/Users/morris/.nuget/packages/": {}
},
"project": {
"version": "1.0.4",
"version": "1.0.5",
"restore": {
"projectUniqueName": "/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/EarthModelStudio.ModelSdk.csproj",
"projectName": "EarthModelStudio.ModelSdk",
@@ -1,6 +1,6 @@
{
"version": 2,
"dgSpecHash": "XCy7zfNs4zI=",
"dgSpecHash": "S0CEqT8FqCs=",
"success": true,
"projectFilePath": "/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/EarthModelStudio.ModelSdk.csproj",
"expectedPackageFiles": [
+10 -3
View File
@@ -17,7 +17,14 @@
"atlas"
],
"dataDir": "earth-geography.model",
"version": "1.2",
"updatedAt": "2026-11-08T12:19:03Z",
"build": "5e12cd2ee1"
"version": "1.6",
"updatedAt": "2026-11-12T11:29:46Z",
"chrome": {
"titleBar": "#0C1828",
"titleBorder": "#1B2740",
"titleText": "#EAF2FF",
"button": "#9FB4D4",
"frame": "#0A1524"
},
"build": "c568a1b05e"
}
@@ -1 +1 @@
{"lines":[[[179.999,-16.169],[179.564,-16.637],[179.568,-16.747],[179.93,-16.519],[179.928,-16.744],[179.419,-16.807],[179.202,-16.713],[179.007,-16.9],[178.707,-16.976],[178.604,-16.801],[178.497,-16.788],[178.584,-16.622],[178.805,-16.631],[178.961,-16.483],[179.552,-16.25],[179.999,-16.169]],[[143.179,-11.954],[143.11,-12.304],[143.402,-12.64],[143.587,-13.444],[143.548,-13.741],[143.756,-14.349],[143.962,-14.463],[144.473,-14.232],[144.648,-14.492],[145.288,-14.943],[145.272,-15.477],[145.458,-16.056],[145.426,-16.406],[145.755,-16.879],[145.912,-16.913],[146.126,-17.635],[146.032,-18.273],[146.333,-18.554],[146.297,-18.841],[146.383,-18.977],[147.139,-19.393],[147.419,-19.378],[147.742,-19.77],[148.759,-20.29],[148.885,-20.481],[148.73,-20.468],[148.684,-20.58],[149.205,-21.125],[149.329,-21.476],[149.454,-21.579],[149.704,-22.441],[149.822,-22.39],[149.974,-22.551],[149.942,-22.308],[150.021,-22.168],[150.541,-22.559],[150.623,-22.367],[150.764,-22.576],[150.843,-23.458],[151.154,-23.784],[151.832,-24.123],[152.13,-24.598],[152.456,-24.802],[152.654,-25.202],[152.913,-25.432],[152.921,-25.689],[153.165,-25.964],[153.084,-26.304],[153.117,-27.194],[153.576,-28.241],[153.617,-28.673],[153.605,-28.854],[153.348,-29.29],[153.272,-29.892],[153.031,-30.563],[152.944,-31.435],[152.559,-32.046],[152.47,-32.439],[152.137,-32.678],[152.164,-32.757],[151.813,-32.901],[151.432,-33.522],[151.292,-33.581],[151.28,-33.927],[151.125,-34.005],[151.232,-34.03],[150.871,-34.499],[150.805,-35.013],[150.567,-35.214],[150.195,-35.834],[149.96,-36.846],[149.933,-37.529],[149.481,-37.771],[148.262,-37.831],[147.877,-37.934],[146.857,-38.663],[146.217,-38.727],[146.337,-38.894],[146.467,-38.84],[146.484,-39.065],[146.4,-39.146],[146.158,-38.866],[145.935,-38.902],[145.791,-38.667],[145.397,-38.535],[145.542,-38.394],[145.476,-38.244],[145.293,-38.238],[144.96,-38.501],[144.718,-38.34],[144.911,-38.344],[145.12,-38.091],[144.891,-37.9],[144.396,-38.137],[144.665,-38.21],[143.539,-38.821],[142.456,-38.386],[141.725,-38.271],[141.594,-38.388],[141.424,-38.363],[141.011,-38.077],[140.39,-37.897],[139.784,-37.246],[139.738,-37.06],[139.857,-36.662],[139.729,-36.371],[139.466,-36.01],[138.969,-35.581],[139.178,-35.523],[139.289,-35.611],[139.283,-35.375],[138.522,-35.642],[138.184,-35.613],[138.511,-35.024],[138.49,-34.764],[138.089,-34.17],[137.692,-35.143],[136.884,-35.24],[137.014,-34.916],[137.391,-34.913],[137.494,-34.161],[137.932,-33.579],[137.852,-33.201],[137.993,-33.094],[137.783,-32.578],[137.791,-32.823],[137.442,-33.194],[137.237,-33.629],[136.431,-34.03],[135.891,-34.661],[135.97,-34.982],[135.792,-34.863],[135.648,-34.94],[135.231,-34.58],[135.123,-34.586],[135.217,-34.487],[135.45,-34.581],[135.219,-33.96],[134.889,-33.626],[134.719,-33.255],[134.301,-33.165],[134.1,-32.749],[134.227,-32.731],[134.234,-32.549],[133.665,-32.207],[133.212,-32.184],[132.757,-31.956],[132.215,-32.007],[131.721,-31.696],[131.144,-31.496],[130.783,-31.604],[130.13,-31.579],[128.946,-31.703],[127.32,-32.264],[125.917,-32.297],[124.759,-32.883],[124.244,-33.015],[123.868,-33.596],[123.507,-33.916],[123.208,-33.988],[122.778,-33.891],[122.151,-33.992],[122.061,-33.874],[121.405,-33.827],[119.854,-33.975],[119.635,-34.101],[119.451,-34.368],[118.895,-34.48],[118.136,-34.987],[117.863,-35.055],[116.517,-34.988],[115.987,-34.795],[115.565,-34.426],[115.009,-34.256],[114.994,-33.515],[115.182,-33.643],[115.359,-33.64],[115.515,-33.531],[115.683,-33.193],[115.619,-32.667],[115.725,-32.401],[115.698,-31.695],[115.078,-30.56],[114.857,-29.143],[114.165,-28.081],[114.028,-27.347],[113.185,-26.182],[113.323,-26.244],[113.356,-26.08],[113.582,-26.558],[113.734,-26.595],[113.836,-26.501],[113.853,-26.332],[113.589,-26.099],[113.395,-25.713],[113.451,-25.599],[113.713,-25.831],[113.724,-26.13],[113.854,-26.014],[113.992,-26.321],[114.09,-26.394],[114.216,-26.289],[114.214,-25.852],[113.418,-24.436],[113.49,-23.87],[113.757,-23.418],[113.795,-22.915],[113.683,-22.638],[114.023,-21.881],[114.124,-21.829],[114.142,-22.483],[114.378,-22.342],[114.709,-21.823],[115.456,-21.492],[116.011,-21.03],[116.707,-20.654],[117.406,-20.721],[118.199,-20.375],[118.751,-20.262],[119.104,-19.995],[119.586,-20.038],[120.434,-19.842],[120.998,-19.604],[121.338,-19.32],[121.834,-18.477],[122.345,-18.112],[122.147,-17.549],[122.261,-17.136],[122.72,-16.788],[122.971,-16.437],[123.563,-17.521],[123.594,-17.03],[123.831,-17.121],[123.874,-16.919],[123.49,-16.491],[123.626,-16.416],[123.607,-16.224],[123.729,-16.192],[123.859,-16.382],[124.044,-16.265],[124.3,-16.388],[124.772,-16.403],[124.405,-16.299],[124.416,-16.133],[124.577,-16.114],[124.649,-15.87],[124.648,-15.805],[124.504,-15.972],[124.382,-15.758],[124.44,-15.494],[124.562,-15.496],[124.693,-15.274],[125.063,-15.442],[125.073,-15.307],[124.909,-15.31],[124.839,-15.161],[125.038,-15.004],[125.356,-15.12],[125.384,-15.016],[125.243,-14.945],[125.179,-14.715],[125.285,-14.584],[125.58,-14.483],[125.628,-14.257],[125.705Line truncated
{"lines":[[[180.0,-16.17],[179.56,-16.64],[179.93,-16.52],[179.93,-16.74],[179.2,-16.71],[178.71,-16.98],[178.5,-16.79],[178.58,-16.62],[180.0,-16.17]],[[143.18,-11.95],[143.11,-12.3],[143.4,-12.64],[143.76,-14.35],[143.96,-14.46],[144.47,-14.23],[145.29,-14.94],[145.43,-16.41],[145.91,-16.91],[146.13,-17.64],[146.03,-18.27],[146.33,-18.55],[146.38,-18.98],[147.42,-19.38],[147.74,-19.77],[148.76,-20.29],[148.88,-20.48],[148.68,-20.58],[149.45,-21.58],[149.7,-22.44],[149.97,-22.55],[150.02,-22.17],[150.54,-22.56],[150.62,-22.37],[150.84,-23.46],[151.83,-24.12],[153.16,-25.96],[153.12,-27.19],[153.62,-28.67],[153.03,-30.56],[152.94,-31.43],[152.47,-32.44],[151.81,-32.9],[151.29,-33.58],[150.81,-35.01],[150.19,-35.83],[149.93,-37.53],[149.48,-37.77],[147.88,-37.93],[146.86,-38.66],[146.22,-38.73],[146.47,-38.84],[146.4,-39.15],[145.4,-38.53],[145.48,-38.24],[144.96,-38.5],[144.72,-38.34],[145.12,-38.09],[144.89,-37.9],[144.4,-38.14],[144.66,-38.21],[143.54,-38.82],[142.46,-38.39],[141.42,-38.36],[140.39,-37.9],[139.78,-37.25],[139.73,-36.37],[138.97,-35.58],[139.29,-35.61],[139.28,-35.38],[138.18,-35.61],[138.51,-35.02],[138.09,-34.17],[137.69,-35.14],[136.88,-35.24],[137.01,-34.92],[137.39,-34.91],[137.49,-34.16],[137.93,-33.58],[137.85,-33.2],[137.99,-33.09],[137.78,-32.58],[137.79,-32.82],[137.24,-33.63],[136.43,-34.03],[135.89,-34.66],[135.97,-34.98],[135.65,-34.94],[135.12,-34.59],[135.45,-34.58],[135.22,-33.96],[134.72,-33.26],[134.3,-33.16],[134.1,-32.75],[134.23,-32.55],[133.66,-32.21],[132.76,-31.96],[132.22,-32.01],[131.14,-31.5],[128.95,-31.7],[127.32,-32.26],[125.92,-32.3],[124.24,-33.02],[123.51,-33.92],[122.15,-33.99],[121.41,-33.83],[119.85,-33.98],[119.45,-34.37],[117.86,-35.05],[116.52,-34.99],[115.01,-34.26],[114.99,-33.52],[115.36,-33.64],[115.68,-33.19],[115.7,-31.7],[115.08,-30.56],[114.86,-29.14],[114.17,-28.08],[114.03,-27.35],[113.19,-26.18],[113.32,-26.24],[113.36,-26.08],[113.58,-26.56],[113.84,-26.5],[113.45,-25.6],[113.71,-25.83],[113.72,-26.13],[113.85,-26.01],[113.99,-26.32],[114.22,-26.29],[114.21,-25.85],[113.42,-24.44],[113.76,-23.42],[113.68,-22.64],[114.02,-21.88],[114.14,-22.48],[114.71,-21.82],[116.71,-20.65],[117.41,-20.72],[119.1,-20.0],[119.59,-20.04],[121.0,-19.6],[121.83,-18.48],[122.34,-18.11],[122.15,-17.55],[122.26,-17.14],[122.97,-16.44],[123.56,-17.52],[123.59,-17.03],[123.83,-17.12],[123.87,-16.92],[123.49,-16.49],[123.61,-16.22],[124.77,-16.4],[124.41,-16.3],[124.65,-15.87],[124.5,-15.97],[124.38,-15.76],[124.44,-15.49],[124.69,-15.27],[125.06,-15.44],[124.84,-15.16],[125.04,-15.0],[125.36,-15.12],[125.18,-14.71],[125.58,-14.48],[125.63,-14.26],[125.66,-14.53],[126.02,-14.49],[126.05,-13.98],[126.57,-14.16],[126.9,-13.74],[127.46,-14.03],[128.2,-14.75],[128.07,-15.33],[128.58,-14.78],[129.06,-14.88],[129.22,-15.16],[129.27,-14.87],[129.63,-15.14],[129.64,-14.85],[129.85,-14.83],[129.38,-14.39],[129.84,-13.57],[130.26,-13.3],[130.17,-12.96],[130.62,-12.65],[130.62,-12.43],[130.87,-12.56],[131.29,-12.07],[131.44,-12.28],[132.41,-12.29],[132.71,-12.12],[132.67,-11.65],[131.82,-11.3],[131.96,-11.18],[135.03,-12.19],[135.92,-11.83],[135.7,-12.21],[136.01,-12.19],[136.08,-12.42],[136.26,-12.43],[136.27,-12.13],[136.54,-11.96],[136.95,-12.35],[136.54,-12.78],[136.46,-13.22],[135.93,-13.3],[135.95,-13.94],[135.45,-14.92],[138.25,-16.72],[139.01,-16.9],[139.25,-17.33],[140.04,-17.7],[140.51,-17.62],[140.83,-17.41],[141.41,-16.07],[141.62,-15.06],[141.47,-13.8],[141.61,-12.94],[141.93,-12.74],[141.69,-12.35],[141.96,-12.05],[142.17,-10.95],[142.6,-10.75],[142.87,-11.82],[143.18,-11.95]],[[178.28,-17.37],[178.59,-17.65],[178.67,-18.08],[177.96,-18.26],[177.32,-18.08],[177.26,-17.86],[177.5,-17.54],[178.28,-17.37]],[[164.2,-20.25],[165.19,-20.77],[166.94,-22.09],[166.97,-22.32],[166.47,-22.26],[164.93,-21.29],[164.38,-20.74],[164.04,-20.17],[164.2,-20.25]],[[127.73,0.85],[127.88,0.83],[128.22,1.4],[128.69,1.57],[128.7,1.11],[128.26,0.73],[128.9,0.22],[127.98,0.47],[127.89,0.3],[127.98,-0.25],[128.43,-0.89],[127.69,-0.24],[127.61,0.85],[127.43,1.14],[127.63,1.84],[128.04,2.2],[127.89,1.83],[128.01,1.33],[127.65,1.01],[127.73,0.85]],[[69.19,-49.11],[69.59,-48.97],[69.64,-49.12],[69.41,-49.18],[69.54,-49.26],[70.32,-49.06],[70.56,-49.2],[70.39,-49.43],[69.76,-49.43],[70.31,-49.58],[70.12,-49.7],[69.15,-49.53],[68.81,-49.7],[68.77,-49.07],[69.0,-48.66],[69.19,-49.11]],[[63.37,80.7],[62.52,80.82],[64.1,81.0],[64.31,81.17],[65.17,81.14],[65.44,80.93],[63.37,80.7]],[[-25.43,70.92],[-25.4,70.65],[-26.22,70.45],[-28.04,70.49],[-27.62,70.91],[-25.82,71.04],[-25.43,70.92]],[[117.31,8.44],[117.35,8.71],[119.22,10.48],[119.55,11.31],[119.69,10.5],[118.78,9.92],[118.44,9.26],[117.31,8.44]],[[122.5,11.62],[122.89,11.44],[123.16,11.54],[123.12,11.29],[122.77,10.82],[121.95,10.44],[122.1,11.64],[121.92,11.85],[122.5,11.62]],[[123.13,9.06],[122.4,9.82],[122.86,10.09],[122.98,10.89],[123.26,10.99],[123.57,10.78],[123.16,9.86],[123.32,9.27],[123.13,9.06]],[[124.58,11.34],[124.93,11.37],[125.0Line truncated
@@ -1,44 +1 @@
{
"continents": [
{
"id": "eurasia",
"nameI18n": { "zh-CN": "亚欧大陆", "en": "Eurasia" },
"label": [85, 52],
"lines": [
[[-10,36],[-9,43],[-2,48],[3,52],[8,58],[12,65],[20,70],[30,71],[45,68],[60,72],[80,74],[100,76],[120,73],[140,70],[160,62],[170,60],[160,54],[145,50],[140,42],[130,38],[122,30],[120,22],[110,20],[105,10],[100,5],[103,-2],[98,2],[92,20],[88,22],[80,8],[77,8],[72,20],[68,24],[62,25],[57,25],[50,28],[45,38],[35,36],[28,40],[26,40],[20,42],[15,38],[10,37],[0,36],[-10,36]]
]
},
{
"id": "africa",
"nameI18n": { "zh-CN": "非洲大陆", "en": "Africa" },
"label": [18, 2],
"lines": [
[[-17,15],[-16,21],[-10,27],[-6,36],[10,37],[20,33],[32,31],[35,24],[38,18],[43,12],[51,11],[48,5],[42,-2],[41,-12],[40,-20],[35,-26],[30,-31],[25,-35],[18,-34],[15,-27],[12,-18],[9,-5],[8,4],[3,6],[-4,5],[-8,5],[-13,10],[-17,15]]
]
},
{
"id": "america",
"nameI18n": { "zh-CN": "美洲大陆", "en": "America" },
"label": [-88, 8],
"lines": [
[[-168,66],[-160,70],[-145,70],[-130,68],[-115,70],[-100,72],[-85,70],[-75,63],[-62,60],[-55,52],[-60,47],[-66,45],[-70,42],[-75,36],[-81,30],[-80,25],[-83,22],[-87,21],[-90,18],[-88,16],[-83,10],[-78,9],[-77,8],[-79,2],[-81,-5],[-76,-14],[-71,-18],[-70,-24],[-72,-38],[-74,-45],[-70,-52],[-68,-55],[-72,-54],[-75,-48],[-73,-40],[-71,-30],[-70,-20],[-75,-10],[-80,0],[-83,8],[-88,14],[-95,16],[-105,20],[-110,24],[-114,30],[-117,33],[-122,38],[-124,45],[-130,52],[-135,58],[-145,60],[-155,58],[-165,60],[-168,66]]
]
},
{
"id": "australia",
"nameI18n": { "zh-CN": "澳大利亚大陆", "en": "Australia" },
"label": [134, -25],
"lines": [
[[113,-22],[114,-27],[116,-33],[122,-34],[129,-32],[134,-33],[138,-35],[141,-38],[147,-38],[150,-35],[153,-29],[153,-25],[149,-21],[146,-19],[142,-11],[138,-12],[136,-14],[132,-11],[129,-15],[125,-14],[122,-17],[117,-20],[113,-22]]
]
},
{
"id": "antarctica",
"nameI18n": { "zh-CN": "南极大陆", "en": "Antarctica" },
"label": [20, -78],
"lines": [
[[-180,-72],[-150,-75],[-120,-73],[-90,-75],[-60,-70],[-45,-73],[-20,-70],[0,-69],[30,-68],[60,-67],[90,-66],[120,-66],[150,-70],[170,-72],[180,-78],[150,-80],[120,-80],[90,-79],[60,-78],[30,-76],[0,-75],[-30,-76],[-60,-77],[-90,-78],[-120,-77],[-150,-76],[-180,-72]]
]
}
]
}
{"continents":[{"id":"eurasia","nameI18n":{"zh-CN":"亚欧大陆","en":"Eurasia"},"label":[85,52],"lines":[[[127.7,0.8],[127.9,0.8],[128.2,1.4],[128.7,1.6],[128.7,1.1],[128.3,0.9],[128.3,0.7],[128.9,0.2],[128.0,0.5],[127.9,0.3]],[[127.7,0.3],[127.4,1.1],[127.6,1.8],[128.0,2.2],[128.0,1.3],[127.7,0.8]],[[63.4,80.7],[62.5,80.8],[63.1,81.0],[64.1,81.0],[64.3,81.2],[65.4,81.1],[65.4,80.9],[63.4,80.7]],[[117.3,8.4],[117.3,8.7],[119.2,10.5],[119.3,11.0],[119.6,11.3],[119.5,11.0],[119.7,10.5],[118.8,9.9],[118.4,9.3],[117.3,8.4]],[[122.5,11.6],[122.8,11.6],[122.9,11.4],[123.2,11.5],[122.8,10.8],[122.0,10.4],[122.1,11.6],[121.9,11.9],[122.5,11.6]],[[123.1,9.1],[122.4,9.8],[122.5,10.0],[122.9,10.1],[122.8,10.5],[123.0,10.9],[123.3,11.0],[123.6,10.8],[123.2,9.9],[123.3,9.3],[123.1,9.1]],[[124.6,11.3],[124.9,11.4],[125.3,10.3],[125.1,10.2],[125.0,10.4],[125.0,10.0],[124.8,10.2],[124.7,11.0],[124.4,10.9],[124.3,11.5],[124.6,11.3]],[[125.2,12.5],[125.5,12.2],[125.7,11.1],[125.2,11.1],[124.9,11.6],[125.0,11.8],[124.4,12.2],[124.3,12.6],[125.2,12.5]],[[120.7,13.5],[121.2,13.4],[121.5,13.1],[121.5,12.6],[121.2,12.2],[120.5,13.4],[120.3,13.4],[120.7,13.5]],[[22.6,58.6],[23.3,58.5],[22.0,57.9],[22.2,58.2],[21.9,58.3],[21.9,58.5],[22.6,58.6]],[[21.6,78.6],[22.0,78.6],[22.3,78.2],[23.0,78.3],[23.5,78.1],[23.1,78.0],[24.9,77.8],[22.8,77.3],[22.4,77.3],[22.7,77.6],[21.1,77.4],[20.9,77.6],[21.7,77.9],[20.2,78.5],[21.6,78.6]],[[47.4,80.9],[48.4,80.8],[48.7,80.6],[47.7,80.8],[46.1,80.4],[46.0,80.6],[44.9,80.6],[47.4,80.9]],[[50.3,80.9],[51.7,80.7],[51.0,80.5],[48.8,80.4],[48.7,80.3],[49.0,80.2],[48.4,80.1],[46.6,80.3],[49.1,80.5],[49.2,80.8],[50.3,80.9]],[[50.3,69.2],[50.2,69.0],[48.9,68.7],[48.4,68.8],[48.3,69.0],[48.4,69.3],[49.0,69.5],[50.3,69.2]],[[23.9,35.5],[24.2,35.6],[24.1,35.5],[24.4,35.4],[25.7,35.3],[25.8,35.1],[26.3,35.3],[26.2,35.0]],[[23.9,35.5],[24.2,35.6],[24.1,35.5],[24.4,35.4],[25.7,35.3],[25.8,35.1],[26.3,35.3],[26.2,35.0],[24.8,34.9],[24.5,35.2],[23.6,35.3],[23.7,35.7],[23.9,35.5]],[[23.4,39.0],[23.5,38.8],[24.1,38.6],[24.6,38.0],[22.9,38.9],[23.4,39.0]],[[34.5,35.6],[33.9,35.3],[34.0,35.0],[33.0,34.6],[32.4,34.7],[32.3,35.1],[32.9,35.2],[32.9,35.4],[34.5,35.6]],[[19.1,57.8],[18.8,57.7],[18.9,57.4],[18.1,56.9],[18.3,57.1],[18.1,57.6],[18.9,57.9],[19.1,57.8]],[[12.6,55.8],[12.2,55.5],[12.4,55.3],[12.1,55.2],[12.1,54.8],[11.9,54.8],[11.7,55.2],[11.3,55.2],[11.0,55.7],[11.6,56.0],[11.8,55.7],[11.9,56.0],[12.2,56.1],[12.6,56.1],[12.6,55.8]],[[96.5,81.1],[97.9,80.7],[97.1,80.6],[97.0,80.5],[97.4,80.3],[97.2,80.2],[93.9,80.0],[91.5,80.4],[92.8,80.6],[93.3,80.8],[92.6,80.8],[93.4,81.0],[95.8,81.3],[96.5,81.1]],[[97.7,80.2],[98.0,80.0],[97.6,79.8],[98.4,79.9],[98.6,80.1],[100.1,79.8],[99.7,79.3],[99.0,79.3],[99.9,79.0],[99.4,78.8],[94.8,79.1],[94.2,79.4],[93.1,79.5],[95.0,80.1],[97.7,80.2]],[[102.9,79.3],[102.4,78.8],[103.0,79.1],[103.8,79.1],[105.1,78.8],[105.3,78.5],[104.7,78.3],[99.3,78.0],[100.0,78.3],[100.4,78.8],[101.0,78.8],[100.9,78.9],[101.5,79.3],[102.9,79.3]],[[140.0,75.8],[140.8,75.6],[141.0,76.0],[141.5,76.1],[143.7,75.9],[145.4,75.5],[144.7,75.4],[144.9,75.3],[144.0,75.0],[142.8,75.3],[142.7,75.5],[143.0,75.6],[142.9,75.7],[142.1,75.7],[142.6,75.1],[143.1,75.0],[142.5,74.8],[142.0,75.0],[140.3,74.8],[139.7,75.0],[139.1,74.7],[138.1,74.8],[136.9,75.3],[137.3,75.3],[137.2,75.6],[137.7,75.8],[137.5,75.9],[137.6,76.0],[138.2,76.1],[138.9,76.2],[140.0,75.8]],[[142.2,73.9],[143.5,73.5],[143.5,73.2],[140.7,73.5],[139.7,73.4],[140.4,73.5],[141.1,73.9],[142.2,73.9]],[[146.8,75.4],[150.8,75.2],[150.6,74.9],[148.1,74.8],[146.1,75.2],[146.4,75.6],[146.8,75.4]],[[126.0,9.3],[126.2,9.3],[126.3,9.0],[126.1,8.6],[126.4,8.5],[126.6,7.2],[126.2,6.9],[126.2,6.3],[125.7,7.3],[125.4,6.7],[125.7,6.0],[125.3,5.6],[125.2,6.1],[124.9,5.9],[124.2,6.2],[124.0,7.0],[124.2,7.4],[124.0,7.7],[123.5,7.8],[123.4,7.4],[123.1,7.7],[122.8,7.5],[122.6,7.8],[122.0,7.0],[121.9,7.2],[122.2,7.9],[122.9,8.2],[123.4,8.7],[123.7,8.6],[123.8,8.0],[124.2,8.2],[124.4,8.6],[124.7,8.6],[124.9,9.0],[125.5,9.0],[125.5,9.8],[126.0,9.3]],[[121.1,18.6],[121.8,18.3],[122.3,18.5],[122.2,17.7],[122.5,17.1],[122.1,16.2],[121.6,15.9],[121.4,15.3],[121.7,14.8],[121.6,14.6],[121.9,14.0],[122.2,13.9],[122.2,14.1],[122.6,14.3],[122.9,14.2],[123.1,13.8],[123.3,13.8],[123.3,14.1],[123.8,13.8],[123.5,13.6],[123.8,13.1],[124.1,13.0],[124.1,12.6],[123.9,12.9],[123.3,13.0],[123.2,13.4],[122.6,13.9],[122.6,13.2],[121.8,13.9],[121.3,13.6],[120.8,13.9],[120.6,13.8],[120.6,14.2],[120.9,14.6],[120.6,14.9],[120.6,14.5],[120.4,14.5],[120.1,14.9],[119.8,16.3],[120.2,16.0],[120.4,16.1],[120.3,16.6],[120.6,18.5],[121.1,18.6]],[[124.9,1.0],[124.4,0.5],[123.8,0.3],[123.3,0.3],[123.0,0.5],[120.6,0.5],[120.2,0.3]],[[119.9,0.0],[119.8,0.2],[120.3,1.0],[120.4,0.8],[120.9,1.3],[122.8,0.8],[123.9,0.8],[125.1,1.7],[125.2,1.5],[124.9,1.0]],[[96.5,5.2],[97.5,5.2],[98.3,4.1],[99.7,3.2],[100.5,2.2],[100.9,1.9],[100.8,2.2],[101.0,2.3],[102.4,0.8],[103.0,0.6],[103.0,0.4],[102.5,0.2],[103.3,0.5],[10Line truncated
@@ -0,0 +1,124 @@
{
"zh-CN": {
"title": "如何使用 · 地球地理",
"sections": [
{
"h": "开始使用(跟着做)",
"lines": [
"第 1 步:点右上「平面」,先看完整的世界地图,确认七大洲四大洋的位置。",
"第 2 步:点「五带」,看回归线与极圈怎么把地球分成五个温度带。",
"第 3 步:关掉「五带」,打开「六大板块」,记住六块板块的名字和范围。",
"第 4 步:再打开「五大陆」,对比金色实线(大陆)与彩色虚线(板块)的差别。",
"第 5 步:切回「3D 球面」,拖动转动地球,看背面会自动隐藏。",
"看不清?滚轮放大;想重来点「复位」。每个图层都能单独开关,互不干扰。"
]
},
{
"h": "一、这个模型包含什么",
"lines": [
"五带:热带、南北温带、南北寒带(按回归线 23.5° 与极圈 66.5° 划分)。",
"七大洲四大洋轮廓,以及洲与洲之间的分界线(苏伊士运河、巴拿马运河、白令海峡等)。",
"六大板块:亚欧、非洲、美洲、太平洋、印度洋、南极洲板块。",
"五块大陆:亚欧大陆、非洲大陆、美洲大陆、澳大利亚大陆、南极大陆。"
]
},
{
"h": "二、两种视图",
"lines": [
"「3D 球面」:正交投影球体,拖动旋转、滚轮缩放,背面自动裁掉。",
"「平面」:等经纬矩形地图,课本地图样式,一次看全整幅。",
"「复位」回到初始视角与缩放。"
]
},
{
"h": "三、图层开关(各自独立)",
"lines": [
"「五带」:叠加五带分界线与回归线、极圈。",
"「大洲轮廓」:白色海岸线。",
"「六大板块」:彩色虚线,是板块边界(不是大陆边界)。",
"「五大陆」:金色实线,是大陆轮廓。",
"「洲界」:分界点与分界线标签(如德雷克海峡、乌拉尔山…)。"
]
},
{
"h": "四、颜色与图例",
"lines": [
"右侧图例说明三种线型:海岸线 / 板块边界 / 分界线。",
"底部色块对应五个温度带。",
"六大板块各一种颜色,标签放在板块中心附近。"
]
},
{
"h": "五、教学要点与易错点",
"lines": [
"「板块 ≠ 大陆」:美洲板块覆盖南北美大陆并向东到大西洋中脊;印度洋板块包含澳大利亚与印度次大陆。",
"六大板块是全球一级板块,纳斯卡、阿拉伯等属于次级小板块,教材不列入。",
"板块交界处多火山地震(环太平洋带、地中海—喜马拉雅带)。",
"洲界是人为约定:亚欧以乌拉尔山—乌拉尔河—里海—大高加索山—黑海—土耳其海峡为界;亚非以苏伊士运河为界;南北美以巴拿马运河为界;南美与南极以德雷克海峡为界。",
"Esc 关闭窗口,F11 全屏。"
]
}
]
},
"en": {
"title": "How to use · Earth Geography",
"sections": [
{
"h": "Getting started (follow along)",
"lines": [
"Step 1: click Flat in the top right for the whole world map first.",
"Step 2: turn on Climate zones to see how the tropics and polar circles split five belts.",
"Step 3: switch zones off and turn on Six plates; learn the six names and extents.",
"Step 4: turn on Five mainlands and compare solid gold lines (mainlands) with dashed colored lines (plates).",
"Step 5: switch back to 3D globe, drag to rotate, and see back faces clip automatically.",
"Hard to read? Scroll to zoom; press Reset to start over. Each layer toggles independently."
]
},
{
"h": "1. What this model contains",
"lines": [
"Five climate zones split by the tropics (23.5°) and polar circles (66.5°).",
"Seven continents, four oceans, and continental borders (Suez, Panama, Bering, etc.).",
"Six major plates: Eurasian, African, American, Pacific, Indian Ocean, Antarctic.",
"Five mainlands: Eurasia, Africa, America, Australia, Antarctica."
]
},
{
"h": "2. Two views",
"lines": [
"3D globe: orthographic sphere; drag to rotate, scroll to zoom, back faces clipped.",
"Flat: equirectangular textbook map, whole world at once.",
"Reset restores the initial view and zoom."
]
},
{
"h": "3. Independent layer toggles",
"lines": [
"Climate zones: tropics, polar circles and zone edges.",
"Coastlines: white continental outlines.",
"Six plates: dashed colored lines — plate BOUNDARIES, not continental edges.",
"Five mainlands: solid gold lines — continental outlines.",
"Borders: boundary dots and labels (Drake Passage, Ural Mts., ...)."
]
},
{
"h": "4. Colors & legend",
"lines": [
"The right legend explains the three line styles.",
"The bottom strip maps the five climate zones.",
"Each of the six plates has its own color, labelled near its center."
]
},
{
"h": "5. Teaching notes & pitfalls",
"lines": [
"Plates are NOT mainlands: the American Plate spans both Americas to the Mid-Atlantic Ridge; the Indian Ocean Plate includes Australia and the Indian subcontinent.",
"These six are the first-order plates; Nazca, Arabian, etc. are secondary and are not listed in textbooks.",
"Volcanoes and earthquakes concentrate along plate boundaries (Pacific Ring, Mediterranean–Himalayan belt).",
"Borders are conventions: Asia/Europe along the Urals–Ural River–Caspian–Caucasus–Black Sea–Turkish Straits; Asia/Africa at Suez; N/S America at Panama; S. America/Antarctica at Drake Passage.",
"Esc closes, F11 toggles fullscreen."
]
}
]
}
}
+221 -88
View File
@@ -41,6 +41,23 @@ public sealed class GeographyView : Control
private bool _showLabels = true;
private GeoMode _mode = GeoMode.Sphere3D;
// ── 平面视图几何缓存:五大陆有 1.3 万点,每帧重建 StreamGeometry 会明显掉帧。
// 尺寸/缩放不变时复用同一份几何,只重画笔刷。
private readonly Dictionary<string, Avalonia.Media.Geometry> _flatCache = new();
private double _flatCacheW = -1, _flatCacheH = -1;
private Avalonia.Media.Geometry? _coastGeo;
private double _coastCacheW = -1, _coastCacheH = -1;
// 单位球坐标缓存:三角运算只算一次,之后每帧只做矩阵乘 + 投影
private readonly Dictionary<string, (Vector3[] Pts, bool[] Valid)> _unitCache = new();
// ── 3D 视图成品几何缓存:旋转/缩放/尺寸都不变时直接复用上一帧的几何,
// 避免每帧重建 2.6 万点的 StreamGeometry 并重新提交给 Skia。
// 用户静止观察时这是绝大多数情况;拖动时按角度量化命中,转动依然跟手。
private Avalonia.Media.Geometry? _s3dCoast, _s3dCont;
private readonly Dictionary<string, Avalonia.Media.Geometry> _s3dBands = new();
private readonly Dictionary<string, Avalonia.Media.Geometry> _s3dPlates = new();
private string _s3dKey = "";
public event Action? StateChanged;
public GeographyView(IModelContext context, GeoScene scene, GeoData coast,
@@ -165,10 +182,52 @@ public sealed class GeographyView : Control
DrawOceanDisc(ctx, cx, cy, r);
if (_showZones) DrawZones3D(ctx, m, cx, cy, r);
if (_showCoast) DrawCoast3D(ctx, m, cx, cy, r);
// 成品几何缓存 key:旋转 / 缩放 / 尺寸 / 图层只要有一个变了才重建几何。
// 静止观察时命中率 100%,拖动时按 0.5° 量化,仍然跟手。
var key = string.Create(System.Globalization.CultureInfo.InvariantCulture,
$"{Math.Round(_yawDeg * 2) / 2}|{Math.Round(_pitchDeg * 2) / 2}|{Math.Round(_zoom, 3)}|" +
$"{Math.Round(size.Width)}|{Math.Round(size.Height)}|" +
$"{(_showZones ? 1 : 0)}{(_showCoast ? 1 : 0)}{(_showPlates ? 1 : 0)}{(_showContinents ? 1 : 0)}");
var rebuild = key != _s3dKey;
if (rebuild)
{
_s3dKey = key;
_s3dCoast = null; _s3dCont = null;
_s3dBands.Clear();
_s3dPlates.Clear();
}
if (_showZones)
{
// 每个温度带一种颜色,所以按带分别缓存一份几何
foreach (var zone in _scene.Zones)
{
var zkey = "band:" + zone.Id;
if (rebuild || !_s3dBands.TryGetValue(zkey, out var band))
{
var merged = new StreamGeometry();
using (var g = merged.Open())
AppendBand(g, m, cx, cy, r, zone.LatMin, zone.LatMax);
band = merged;
_s3dBands[zkey] = band;
}
ctx.DrawGeometry(ZoneFill(zone.Id), null, band);
}
// 边界线(赤道/回归线/极圈)随旋转变化,直接画
DrawZoneLines3D(ctx, m, cx, cy, r);
}
if (_showCoast)
{
if (rebuild || _s3dCoast == null) _s3dCoast = BuildCoast(m, cx, cy, r);
ctx.DrawGeometry(null, CoastPen, _s3dCoast);
}
if (_showPlates) DrawPlates3D(ctx, m, cx, cy, r);
if (_showContinents) DrawContinents3D(ctx, m, cx, cy, r);
if (_showContinents)
{
if (rebuild || _s3dCont == null) _s3dCont = BuildContinents(m, cx, cy, r);
ctx.DrawGeometry(null, ContinentPen, _s3dCont);
}
if (_showBorders) DrawBorders3D(ctx, m, cx, cy, r);
if (_showLabels) DrawLabels3D(ctx, m, cx, cy, r);
@@ -234,15 +293,9 @@ public sealed class GeographyView : Control
ctx.DrawEllipse(spec, null, new Point(cx, cy), r, r);
}
// ---- 五带:按纬度带填色(用四边形条带逐格填充,避免整环多边形跨地平线破面)----
private void DrawZones3D(DrawingContext ctx, Matrix4x4 m, float cx, float cy, float r)
// ---- 五带边界线:赤道 / 回归线 / 极圈(随旋转变化,每帧直接画)----
private void DrawZoneLines3D(DrawingContext ctx, Matrix4x4 m, float cx, float cy, float r)
{
foreach (var zone in _scene.Zones)
{
var fill = ZoneFill(zone.Id);
FillBand3D(ctx, m, cx, cy, r, zone.LatMin, zone.LatMax, fill);
}
// 边界线:赤道 / 回归线 / 极圈
foreach (var zone in _scene.Zones)
{
DrawParallel3D(ctx, m, cx, cy, r, zone.LatMin, ZoneEdgePen);
@@ -254,44 +307,6 @@ public sealed class GeographyView : Control
DrawParallel3D(ctx, m, cx, cy, r, 90 - _scene.TropicDeg, PolarPen);
DrawParallel3D(ctx, m, cx, cy, r, -(90 - _scene.TropicDeg), PolarPen);
}
/// <summary>
/// 纬度带填充:沿经度切成小四边形逐格画。
/// 每个格子独立判断可见性——这样跨地平线的格子会被跳过,
/// 而不是像整环多边形那样把背面点也连进去导致形状撕裂。
/// </summary>
private static void FillBand3D(DrawingContext ctx, Matrix4x4 m, float cx, float cy, float r,
double latMin, double latMax, IBrush fill)
{
const int steps = 180;
const double lonStep = 360.0 / steps;
for (var i = 0; i < steps; i++)
{
var lon0 = -180.0 + lonStep * i;
var lon1 = lon0 + lonStep;
var a = Geometry.ToCamera(Geometry.LatLonToUnit(latMin, lon0), Matrix4x4.Identity, m);
var b = Geometry.ToCamera(Geometry.LatLonToUnit(latMin, lon1), Matrix4x4.Identity, m);
var c = Geometry.ToCamera(Geometry.LatLonToUnit(latMax, lon1), Matrix4x4.Identity, m);
var d = Geometry.ToCamera(Geometry.LatLonToUnit(latMax, lon0), Matrix4x4.Identity, m);
// 四角都在正面才填这一格
if (a.Z <= 0 || b.Z <= 0 || c.Z <= 0 || d.Z <= 0) continue;
var geo = new StreamGeometry();
using (var g = geo.Open())
{
g.BeginFigure(Pt(Geometry.Project(a, r, cx, cy)), true);
g.LineTo(Pt(Geometry.Project(b, r, cx, cy)));
g.LineTo(Pt(Geometry.Project(c, r, cx, cy)));
g.LineTo(Pt(Geometry.Project(d, r, cx, cy)));
g.EndFigure(true);
}
ctx.DrawGeometry(fill, null, geo);
}
}
private static void DrawParallel3D(DrawingContext ctx, Matrix4x4 m, float cx, float cy, float r,
double lat, IPen pen)
{
@@ -299,11 +314,86 @@ public sealed class GeographyView : Control
for (var i = 0; i < 145; i++) pts.Add(new[] { -180.0 + 360.0 * i / 144.0, lat });
DrawGeo3D(ctx, pts, m, cx, cy, r, pen, false);
}
private void DrawCoast3D(DrawingContext ctx, Matrix4x4 m, float cx, float cy, float r)
/// <summary>海岸线合并几何(供成品缓存使用)。</summary>
private Avalonia.Media.Geometry BuildCoast(Matrix4x4 m, float cx, float cy, float r)
{
foreach (var line in _coast.Lines)
DrawGeo3D(ctx, line, m, cx, cy, r, CoastPen, true);
var merged = new StreamGeometry();
using (var g = merged.Open())
{
for (var i = 0; i < _coast.Lines.Count; i++)
AppendCached(g, "coast:" + i, _coast.Lines[i], m, r, cx, cy, true);
}
return merged;
}
/// <summary>五大陆合并几何(供成品缓存使用)。</summary>
private Avalonia.Media.Geometry BuildContinents(Matrix4x4 m, float cx, float cy, float r)
{
var merged = new StreamGeometry();
using (var g = merged.Open())
{
foreach (var c in _continents.Continents)
for (var i = 0; i < c.Lines.Count; i++)
AppendCached(g, "cont:" + c.Id + ":" + i, c.Lines[i], m, r, cx, cy, true);
}
return merged;
}
/// <summary>把一个纬度带的可见格子追加到几何里(每格独立判断可见性)。</summary>
private static void AppendBand(StreamGeometryContext g, Matrix4x4 m, float cx, float cy, float r,
double latMin, double latMax)
{
const int steps = 180;
const double lonStep = 360.0 / steps;
for (var i = 0; i < steps; i++)
{
var lon0 = -180.0 + lonStep * i;
var lon1 = lon0 + lonStep;
var a = Geometry.ToCamera(Geometry.LatLonToUnit(latMin, lon0), Matrix4x4.Identity, m);
var b = Geometry.ToCamera(Geometry.LatLonToUnit(latMin, lon1), Matrix4x4.Identity, m);
var c = Geometry.ToCamera(Geometry.LatLonToUnit(latMax, lon1), Matrix4x4.Identity, m);
var d = Geometry.ToCamera(Geometry.LatLonToUnit(latMax, lon0), Matrix4x4.Identity, m);
if (a.Z <= 0 || b.Z <= 0 || c.Z <= 0 || d.Z <= 0) continue;
g.BeginFigure(Pt(Geometry.Project(a, r, cx, cy)), true);
g.LineTo(Pt(Geometry.Project(b, r, cx, cy)));
g.LineTo(Pt(Geometry.Project(c, r, cx, cy)));
g.LineTo(Pt(Geometry.Project(d, r, cx, cy)));
g.EndFigure(true);
}
}
/// <summary>把一条缓存折线的所有可见弧段追加到同一个几何里。</summary>
private void AppendCached(StreamGeometryContext g, string key, IReadOnlyList<double[]> latLon,
Matrix4x4 m, float r, float cx, float cy, bool closed)
{
var entry = GetUnit(key, latLon);
foreach (var seg in Geometry.ProjectUnitPolyline(entry.Pts, entry.Valid,
Matrix4x4.Identity, m, r, cx, cy, closed))
{
if (seg.Count < 2) continue;
g.BeginFigure(Pt(seg[0]), false);
for (var i = 1; i < seg.Count; i++) g.LineTo(Pt(seg[i]));
g.EndFigure(false);
}
}
private (Vector3[] Pts, bool[] Valid) GetUnit(string key, IReadOnlyList<double[]> latLon)
{
if (_unitCache.TryGetValue(key, out var entry)) return entry;
var pts = new Vector3[latLon.Count];
var valid = new bool[latLon.Count];
for (var i = 0; i < latLon.Count; i++)
{
var p = latLon[i];
if (p.Length >= 2)
{
pts[i] = Geometry.LatLonToUnit(p[1], p[0]);
valid[i] = true;
}
}
entry = (pts, valid);
_unitCache[key] = entry;
return entry;
}
private void DrawPlates3D(DrawingContext ctx, Matrix4x4 m, float cx, float cy, float r)
@@ -311,7 +401,13 @@ public sealed class GeographyView : Control
foreach (var p in _plates.Plates)
{
var pen = PlatePenFor(p.Id);
foreach (var line in p.Lines) DrawGeo3D(ctx, line, m, cx, cy, r, pen, true);
var merged = new StreamGeometry();
using (var g = merged.Open())
{
for (var i = 0; i < p.Lines.Count; i++)
AppendCached(g, "plate:" + p.Id + ":" + i, p.Lines[i], m, r, cx, cy, true);
}
ctx.DrawGeometry(null, pen, merged);
}
if (_showLabels) DrawPlateLabels3D(ctx, m, cx, cy, r);
}
@@ -329,28 +425,6 @@ public sealed class GeographyView : Control
PlateBrushFor(p.Id), TextAlignment.Center);
}
}
/// <summary>五块大陆:与板块独立的线稿图层,便于讲清「板块 ≠ 大陆」。</summary>
private void DrawContinents3D(DrawingContext ctx, Matrix4x4 m, float cx, float cy, float r)
{
var pen = ContinentPen;
foreach (var c in _continents.Continents)
foreach (var line in c.Lines)
DrawGeo3D(ctx, line, m, cx, cy, r, pen, true);
if (!_showLabels) return;
foreach (var c in _continents.Continents)
{
var at = c.Label is { Length: >= 2 } ? c.Label : Centroid(c.Lines);
if (at == null) continue;
var cam = Geometry.ToCamera(Geometry.LatLonToUnit(at[1], at[0]), Matrix4x4.Identity, m);
if (cam.Z <= 0.2f) continue;
var pos = Geometry.Project(cam, r, cx, cy);
DrawText(ctx, Pick(c.NameI18n, c.Id), pos.X, pos.Y, 12 * TextScale,
MainlandBrush, TextAlignment.Center, FontStyle.Normal);
}
}
private void DrawBorders3D(DrawingContext ctx, Matrix4x4 m, float cx, float cy, float r)
{
foreach (var b in _borders.Borders)
@@ -438,6 +512,29 @@ public sealed class GeographyView : Control
}
}
/// <summary>
/// 缓存版绘制:单位球坐标按 key 缓存一次,之后每帧只做矩阵乘与投影。
/// 海岸线/大陆共 2.6 万点,这是 3D 视图的主要开销来源。
/// </summary>
private void DrawCached3D(DrawingContext ctx, string key, IReadOnlyList<double[]> latLon,
Matrix4x4 m, float cx, float cy, float r, IPen pen, bool closed)
{
var entry = GetUnit(key, latLon);
foreach (var seg in Geometry.ProjectUnitPolyline(entry.Pts, entry.Valid,
Matrix4x4.Identity, m, r, cx, cy, closed))
{
if (seg.Count < 2) continue;
var geo = new StreamGeometry();
using (var g = geo.Open())
{
g.BeginFigure(Pt(seg[0]), false);
for (var i = 1; i < seg.Count; i++) g.LineTo(Pt(seg[i]));
g.EndFigure(false);
}
ctx.DrawGeometry(null, pen, geo);
}
}
// ================================================================ 平面等经纬
private void RenderFlat(DrawingContext ctx, Size size)
{
@@ -483,22 +580,29 @@ public sealed class GeographyView : Control
// 海岸线
if (_showCoast)
{
foreach (var line in _coast.Lines)
var cw = Math.Round(size.Width);
var ch = Math.Round(size.Height);
if (Math.Abs(cw - _coastCacheW) > 0.5 || Math.Abs(ch - _coastCacheH) > 0.5 || _coastGeo == null)
{
if (line.Count < 2) continue;
var geo = new StreamGeometry();
using (var g = geo.Open())
var merged = new StreamGeometry();
using (var g = merged.Open())
{
g.BeginFigure(P(line[0][0], line[0][1]), false);
for (var i = 1; i < line.Count; i++)
foreach (var line in _coast.Lines)
{
var p = line[i];
if (p.Length >= 2) g.LineTo(P(p[0], p[1]));
if (line.Count < 2) continue;
g.BeginFigure(P(line[0][0], line[0][1]), false);
for (var i = 1; i < line.Count; i++)
{
var p = line[i];
if (p.Length >= 2) g.LineTo(P(p[0], p[1]));
}
g.EndFigure(false);
}
g.EndFigure(false);
}
ctx.DrawGeometry(null, CoastPen, geo);
_coastGeo = merged;
_coastCacheW = cw; _coastCacheH = ch;
}
ctx.DrawGeometry(null, CoastPen, _coastGeo);
}
// 板块
@@ -522,10 +626,39 @@ public sealed class GeographyView : Control
// 五大陆
if (_showContinents)
{
// 用缓存几何:尺寸不变时只画一次构建开销
var fw = Math.Round(size.Width);
var fh = Math.Round(size.Height);
if (Math.Abs(fw - _flatCacheW) > 0.5 || Math.Abs(fh - _flatCacheH) > 0.5 || _flatCache.Count == 0)
{
_flatCache.Clear();
_flatCacheW = fw; _flatCacheH = fh;
}
foreach (var c in _continents.Continents)
{
foreach (var line in c.Lines)
DrawFlatPolyline(ctx, line, P, ContinentPen);
var key = "cont:" + c.Id;
if (!_flatCache.TryGetValue(key, out var geo))
{
var merged = new StreamGeometry();
using (var g = merged.Open())
{
foreach (var line in c.Lines)
{
if (line.Count < 2) continue;
g.BeginFigure(P(line[0][0], line[0][1]), false);
for (var i = 1; i < line.Count; i++)
{
var p = line[i];
if (p.Length >= 2) g.LineTo(P(p[0], p[1]));
}
g.EndFigure(false);
}
}
geo = merged;
_flatCache[key] = geo;
}
ctx.DrawGeometry(null, ContinentPen, geo);
if (!_showLabels) continue;
var a = c.Label is { Length: >= 2 } ? c.Label : Centroid(c.Lines);
@@ -6,7 +6,7 @@
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {
"EarthGeographyModel/1.0.4": {
"EarthGeographyModel/1.0.5": {
"dependencies": {
"Avalonia": "11.3.9"
},
@@ -85,7 +85,7 @@
}
},
"libraries": {
"EarthGeographyModel/1.0.4": {
"EarthGeographyModel/1.0.5": {
"type": "project",
"serviceable": false,
"sha512": ""
@@ -5,7 +5,7 @@
},
"projects": {
"/Users/morris/Downloads/GC#/model/earth-geography/src/EarthGeographyModel.csproj": {
"version": "1.0.4",
"version": "1.0.5",
"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.4",
"version": "1.0.5",
"restore": {
"projectUniqueName": "/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/EarthModelStudio.ModelSdk.csproj",
"projectName": "EarthModelStudio.ModelSdk",
@@ -12,11 +12,11 @@ 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+874c97ee271617592f530440ae8879461e91488b")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.5.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.5+7de92a25f5b91dfe2b85dcd95639fdcc353badf2")]
[assembly: System.Reflection.AssemblyProductAttribute("Earth Model Studio")]
[assembly: System.Reflection.AssemblyTitleAttribute("EarthGeographyModel")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.4.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.5.0")]
[assembly: System.Resources.NeutralResourcesLanguageAttribute("zh-Hans")]
// Generated by the MSBuild WriteCodeFragment class.
@@ -1 +1 @@
d4fd061fd66be936bfe3ff861ab130f2046842e22ccd1d5d0250ed8beb77769b
062653d3e1d47934e0fb66390c659baa5321aec21f144eef538d7735eb367f94
@@ -112,7 +112,7 @@
"lib/net5.0/MicroCom.Runtime.dll": {}
}
},
"EarthModelStudio.ModelSdk/1.0.4": {
"EarthModelStudio.ModelSdk/1.0.5": {
"type": "project",
"framework": ".NETCoreApp,Version=v8.0",
"dependencies": {
@@ -347,7 +347,7 @@
"microcom.runtime.nuspec"
]
},
"EarthModelStudio.ModelSdk/1.0.4": {
"EarthModelStudio.ModelSdk/1.0.5": {
"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.4"
"EarthModelStudio.ModelSdk >= 1.0.5"
]
},
"packageFolders": {
"/Users/morris/.nuget/packages/": {}
},
"project": {
"version": "1.0.4",
"version": "1.0.5",
"restore": {
"projectUniqueName": "/Users/morris/Downloads/GC#/model/earth-geography/src/EarthGeographyModel.csproj",
"projectName": "EarthGeographyModel",
@@ -432,13 +432,5 @@
"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."
}
]
}
}
@@ -1,6 +1,6 @@
{
"version": 2,
"dgSpecHash": "8duKn1xFDI4=",
"dgSpecHash": "KQi6iFsaWE4=",
"success": true,
"projectFilePath": "/Users/morris/Downloads/GC#/model/earth-geography/src/EarthGeographyModel.csproj",
"expectedPackageFiles": [
@@ -9,15 +9,5 @@
"/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": [
{
"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": []
}
]
"logs": []
}
+10 -3
View File
@@ -23,7 +23,14 @@
"type": "NeoRF.EarthModels.RevolutionModelFactory",
"preview": "preview.png",
"apiVersion": 1,
"version": "1.1",
"updatedAt": "2026-11-08T12:19:03Z",
"build": "92a820f30c"
"version": "1.4",
"updatedAt": "2026-11-12T11:29:46Z",
"chrome": {
"titleBar": "#0C1828",
"titleBorder": "#1B2740",
"titleText": "#EAF2FF",
"button": "#9FB4D4",
"frame": "#0A1524"
},
"build": "41a6e0ead8"
}
@@ -0,0 +1,124 @@
{
"zh-CN": {
"title": "如何使用 · 地球公转",
"sections": [
{
"h": "开始使用(跟着做)",
"lines": [
"第 1 步:先按「1」定格到春分,看读数区「太阳直射」是多少度。",
"第 2 步:再按「2」,直射纬度变成 23.5°N —— 这就是北半球夏至。",
"第 3 步:依次按「3」「4」,对比四个节气的直射点位置。",
"第 4 步:按「空格」播放,看地球绕太阳走完一圈要多久(有速度调节)。",
"第 5 步:拖动鼠标换到「俯视」,能看到轨道是个椭圆,地轴始终指向同一方向。",
"看不到变化?确认顶部「节气定位」已打开,且没有停在暂停状态。"
]
},
{
"h": "一、这个模型讲什么",
"lines": [
"地球绕太阳公转,周期约 365.25 天,轨道近似椭圆,地轴始终指向北极星附近。",
"地轴与公转轨道面成 66.5° 夹角(赤道面与轨道面夹角 23.5°,即黄赤交角)。",
"由于地轴倾斜方向不变,太阳直射点在南北回归线之间往返,形成四季更替。",
"二分二至:春分 3/21、夏至 6/22、秋分 9/23、冬至 12/22(教材值)。"
]
},
{
"h": "二、基本操作",
"lines": [
"「播放 / 暂停」控制公转动画;「速度」调节一年走完的快慢。",
"「步进」让地球沿轨道前进一小格,便于逐段观察。",
"拖动或滚轮改变观察角度与缩放;「俯视 / 侧视」切换视角。",
"「重置」回到春分起点。"
]
},
{
"h": "三、节气定位(重点)",
"lines": [
"按 1–4 直接定格到春分、夏至、秋分、冬至。",
"春分 / 秋分:太阳直射赤道(0°),全球昼夜平分。",
"夏至:直射北回归线 23.5°N,北半球昼最长、北极圈内极昼。",
"冬至:直射南回归线 23.5°S,北半球昼最短、北极圈内极夜。",
"定格后读数区显示:公转角度、太阳直射纬度、教材日期、节气名称。"
]
},
{
"h": "四、读数与课堂卡",
"lines": [
"「太阳直射」读数来自模型数据里的 declinationDeg,不是近似公式。",
"「节气定位」面板列出四个节气的日期与现象说明(中英双语)。",
"「教学要点」解释:直射点移动 → 正午太阳高度与昼长变化 → 四季。"
]
},
{
"h": "五、易错点",
"lines": [
"四季成因是「地轴倾斜且方向不变」,不是「地球离太阳忽远忽近」。",
"近日点在 1 月初(北半球冬天),远日点在 7 月初(北半球夏天)。",
"南北半球季节相反:北半球夏至时南半球是冬至。",
"Esc 关闭窗口,F11 全屏。"
]
}
]
},
"en": {
"title": "How to use · Earth Revolution",
"sections": [
{
"h": "Getting started (follow along)",
"lines": [
"Step 1: press 1 to freeze at the spring equinox and read the subsolar latitude.",
"Step 2: press 2 — the subsolar point jumps to 23.5°N, the June solstice.",
"Step 3: press 3 and 4 to compare all four key positions.",
"Step 4: press Space to animate one full orbit; adjust Speed as needed.",
"Step 5: drag to Top view to see the elliptical orbit and the fixed axis direction.",
"Nothing changing? Make sure Seasons is on in the top bar and the model isn't paused."
]
},
{
"h": "1. What this model shows",
"lines": [
"Earth orbits the Sun in ~365.25 days; the axis keeps pointing near Polaris.",
"The axis is tilted 66.5° to the orbital plane (obliquity 23.5°).",
"Because the tilt direction is fixed, the subsolar point migrates between the tropics, making seasons.",
"Key dates: spring equinox 3/21, summer solstice 6/22, autumn equinox 9/23, winter solstice 12/22."
]
},
{
"h": "2. Basic controls",
"lines": [
"Play/Pause runs the orbit; Speed sets how fast a year passes.",
"Step advances one increment for close observation.",
"Drag or scroll to change view/zoom; Top view / Side view switch perspective.",
"Reset returns to the spring equinox."
]
},
{
"h": "3. Solstices & equinoxes",
"lines": [
"Keys 1–4 freeze at spring equinox, summer solstice, autumn equinox, winter solstice.",
"Equinoxes: subsolar at the equator (0°), equal day and night worldwide.",
"June solstice: subsolar at 23.5°N; longest day in the north, polar day inside the Arctic Circle.",
"December solstice: subsolar at 23.5°S; shortest day in the north, polar night.",
"The readout shows orbit angle, subsolar latitude, textbook date and season name."
]
},
{
"h": "4. Readouts & classroom cards",
"lines": [
"Subsolar latitude comes from declinationDeg in the model data, not an approximation.",
"The seasons panel lists dates and phenomena for all four (bilingual).",
"Teaching notes: migrating subsolar point → changing noon altitude and day length → seasons."
]
},
{
"h": "5. Common mistakes",
"lines": [
"Seasons come from the fixed axial tilt, NOT from Earth being closer/farther to the Sun.",
"Perihelion is early January (northern winter); aphelion is early July (northern summer).",
"Seasons are opposite in the two hemispheres.",
"Esc closes, F11 toggles fullscreen."
]
}
]
}
}
+10 -3
View File
@@ -23,7 +23,14 @@
"type": "NeoRF.EarthModels.RotationModelFactory",
"preview": "preview.png",
"apiVersion": 1,
"version": "1.1",
"updatedAt": "2026-11-08T12:19:03Z",
"build": "e9e9851c56"
"version": "1.4",
"updatedAt": "2026-11-12T11:29:46Z",
"chrome": {
"titleBar": "#0C1828",
"titleBorder": "#1B2740",
"titleText": "#EAF2FF",
"button": "#9FB4D4",
"frame": "#0A1524"
},
"build": "5544dcea30"
}
@@ -0,0 +1,121 @@
{
"zh-CN": {
"title": "如何使用 · 地球自转",
"sections": [
{
"h": "开始使用(跟着做)",
"lines": [
"第 1 步:窗口打开后先按「空格」暂停,动画停住才好观察。",
"第 2 步:按住鼠标左键拖动地球,把晨昏线转到正对你。",
"第 3 步:点顶部「经纬网」打开网格,能看清哪一段是夜半球。",
"第 4 步:再按「空格」播放,盯住一个点,看它从黑夜转进白天。",
"第 5 步:按住「←」「→」可以一格一格慢慢看昼夜交界线怎么移动。",
"找不到按钮?所有开关都在窗口顶部那一排;转不动地球就点「复位」重来。"
]
},
{
"h": "一、这个模型讲什么",
"lines": [
"地球绕地轴自西向东自转,周期约 24 小时(一个太阳日)。",
"自转产生三个可观察现象:昼夜交替、地方时差、地转偏向力。",
"晨昏线( terminator )是把地球分成昼半球与夜半球的大圆,它随自转不断西移。",
"太阳直射点是地表太阳高度为 90° 的点,正午太阳高度由它向南北两侧递减。"
]
},
{
"h": "二、基本操作",
"lines": [
"拖动地球:改变观察角度(经度/纬度),可从极地或赤道上空看。",
"滚轮或双指捏合:缩放;右上角「放大」可切到地球特写。",
"「播放 / 暂停」开始或停止自转动画;「速度」调节快慢。",
"「重置」把角度、速度、缩放恢复到初始状态。"
]
},
{
"h": "三、图层开关",
"lines": [
"「经纬网」叠加经线与纬线,便于读出赤道、回归线、极圈。",
"「标注」显示北极、南极、太阳直射点、赤道等关键标签。",
"「轨道」显示自转轴与赤道面;「夸张倾角」把 23.5° 放大便于观察。",
"「教学要点」展开课堂讲解文字,适合投屏授课。"
]
},
{
"h": "四、键盘快捷键",
"lines": [
"空格:播放 / 暂停。",
"← →:逐帧步进(暂停时最有用)。",
"Esc:关闭窗口;F11:全屏 / 退出全屏。"
]
},
{
"h": "五、课堂上怎么用",
"lines": [
"先暂停,把晨昏线转到与经线重合,说明「昼夜平分」只在二分日出现。",
"再播放,让学生观察同一地点如何由夜入昼(晨线)与由昼入夜(昏线)。",
"对比不同经度:东边地点先见到日出,引出「东早西晚」的地方时差。",
"易错提醒:昼夜现象本身由「地球不发光、不透明」造成,自转只造成「交替」。"
]
}
]
},
"en": {
"title": "How to use · Earth Rotation",
"sections": [
{
"h": "Getting started (follow along)",
"lines": [
"Step 1: press Space to pause first — a still globe is easier to read.",
"Step 2: hold the left mouse button and drag until the terminator faces you.",
"Step 3: switch on Graticule in the top bar to see which side is night.",
"Step 4: press Space to play and watch one point rotate from night into day.",
"Step 5: use ← / → to step frame by frame and follow the day/night boundary.",
"Can't find a control? Every toggle is in the top bar; if the globe gets twisted, press Reset."
]
},
{
"h": "1. What this model shows",
"lines": [
"Earth spins west-to-east on its axis in about 24 hours (a solar day).",
"Rotation causes the day/night cycle, local time differences and the Coriolis effect.",
"The terminator is the great circle splitting day and night; it moves west as Earth turns.",
"The subsolar point is where the Sun is overhead; noon altitude decreases away from it."
]
},
{
"h": "2. Basic controls",
"lines": [
"Drag the globe to change the viewing angle (from pole or equator).",
"Scroll or pinch to zoom; the close-up button gives an Earth detail view.",
"Play/Pause starts or stops the spin; Speed changes the rate.",
"Reset restores the initial angle, speed and zoom."
]
},
{
"h": "3. Layer toggles",
"lines": [
"Graticule overlays meridians and parallels (equator, tropics, polar circles).",
"Labels shows poles, subsolar point and the equator.",
"Orbit shows the axis and equatorial plane; Exaggerate tilt magnifies the 23.5° tilt.",
"Teaching notes expands classroom text, useful on a projector."
]
},
{
"h": "4. Keyboard shortcuts",
"lines": [
"Space: play / pause. ← →: step one frame (best while paused).",
"Esc: close window. F11: toggle fullscreen."
]
},
{
"h": "5. In the classroom",
"lines": [
"Pause with the terminator along a meridian to show equal day/night at equinoxes.",
"Play again and watch a site cross the dawn line and the dusk line.",
"Compare longitudes: eastern places see sunrise earlier — local time runs ahead.",
"Common mistake: day/night exists because Earth is opaque; rotation only makes it alternate."
]
}
]
}
}
+10 -3
View File
@@ -24,7 +24,14 @@
"type": "NeoRF.ScaleCalculator.ScaleCalculatorFactory",
"preview": "preview.png",
"apiVersion": 1,
"version": "1.0",
"updatedAt": "2026-11-08T12:19:03Z",
"build": "4cb6aafff8"
"version": "1.3",
"updatedAt": "2026-11-12T11:29:46Z",
"chrome": {
"titleBar": "#FFFFFF",
"titleBorder": "#E3E8F3",
"titleText": "#111A2E",
"button": "#5B6A86",
"frame": "#F4F6FB"
},
"build": "f6418437d4"
}
@@ -0,0 +1,146 @@
{
"zh-CN": {
"title": "如何使用 · 比例尺计算器",
"sections": [
{
"h": "开始使用(跟着做)",
"lines": [
"第 1 步:顶部选「求实地距离」,此时蓝色卡是答案,另外两个是输入。",
"第 2 步:在「图上距离」里填 3,在「比例尺分母」里填 100000。",
"第 3 步:看蓝色卡算出 3 千米 —— 再点「解题步骤」核对每一步。",
"第 4 步:改成「求比例尺」,把实地距离填成 6 千米,看分母怎么翻倍。",
"第 5 步:拖动中间标尺的滑块,观察蓝色条(图上)与绿色条(实地)的长度关系。",
"第 6 步:滚到底部「练习闯关」,自己做一道,答错会自动展开步骤。",
"算不出来?先检查单位:填了 km 就不要再按 cm 算,模型会自动换算。"
]
},
{
"h": "一、核心公式(先记住这一条)",
"lines": [
"比例尺 = 图上距离 ÷ 实地距离,写作 1 : N。",
"N 是分母,含义是「实地距离是图上距离的 N 倍」,两句都必须统一成同一单位。",
"三个变形:实地 = 图上 × N;图上 = 实地 ÷ N;N = 实地 ÷ 图上。",
"单位换算:1 m = 100 cm,1 km = 1000 m = 100000 cm(km 化 cm 加 5 个 0)。"
]
},
{
"h": "二、三种求解模式",
"lines": [
"顶部三个按钮选「求实地距离 / 求图上距离 / 求比例尺」。",
"选中的那一项会变成蓝色结果卡(只读),另外两项留作输入。",
"拖动滑块或直接输入数字,三栏读数与中栏标尺实时联动。",
"「重置」回到 3 cm / 1:100000 / 3 km 的初始例子。"
]
},
{
"h": "三、中栏可视化标尺",
"lines": [
"上条(蓝)是图上距离,按真实厘米画刻度。",
"下条(绿)是同一段实地距离按当前比例尺压缩后的长度,与上方同宽。",
"线段式比例尺会按 1/2/5×10ⁿ 自动换挡,任何比例尺都画得下。",
"比例尺光谱把 1:1千 到 1:10亿 排在对数轴上,当前值用指针标出。",
"若超出图幅,会提示「需要更小的比例尺」——这正是选图幅的教学点。"
]
},
{
"h": "四、三种写法与解题步骤",
"lines": [
"数字式 1 : N;文字式「图上 1 厘米代表实地 …」;线段式(图形刻度)。",
"右栏三者实时联动,可直接抄到作业里。",
"「解题步骤」可展开:① 统一单位 → ② 列公式 → ③ 代入 → ④ 得数 → ⑤ 换算合适单位。",
"「大小判读」卡:大 / 中 / 小比例尺 +「分母越大 → 比例尺越小 → 范围越大 → 越简略」。"
]
},
{
"h": "五、实地尺与练习",
"lines": [
"「实地尺」内置教室 10 m、操场 400 m、马拉松 42.195 km、京沪 1080 km、赤道 4 万 km。",
"改变比例尺,看这段真实距离画到图上是多长(或画不下 / 几乎看不见)。",
"「练习闯关」随机出三类题,填数字后回车或点「检查」,答错展开完整解题步骤。",
"连对计数会一直累计,答错清零。"
]
},
{
"h": "六、易错点",
"lines": [
"忘记统一单位:km 必须 ×100000 变成 cm 才能代入。",
"「放大 2 倍」是分母 ÷ 2(比例尺变大),不是 × 2。",
"图上距离与实地距离别代反了;N 是「实地是图上的几倍」。",
"比例尺是比值,没有单位;说「比例尺越大」指的是比值越大、分母越小。"
]
}
]
},
"en": {
"title": "How to use · Scale Calculator",
"sections": [
{
"h": "Getting started (follow along)",
"lines": [
"Step 1: choose Find real distance at the top — the blue card is the answer, the other two are inputs.",
"Step 2: enter 3 as the map distance and 100000 as the scale denominator.",
"Step 3: the blue card shows 3 km — open Worked steps and check each line.",
"Step 4: switch to Find scale, set the real distance to 6 km, and watch the denominator change.",
"Step 5: drag the ruler slider and compare the blue bar (map) with the green bar (real).",
"Step 6: scroll to Practice and try one; a wrong answer expands the full solution.",
"Stuck? Check your units first — the model converts automatically, so don't mix km and cm."
]
},
{
"h": "1. The core formula",
"lines": [
"Scale = map distance ÷ real distance, written 1 : N.",
"N is the denominator: the real distance is N times the map distance — both must share one unit.",
"Three forms: real = map × N; map = real ÷ N; N = real ÷ map.",
"Unit conversions: 1 m = 100 cm, 1 km = 1000 m = 100000 cm (add five zeros)."
]
},
{
"h": "2. Three solve modes",
"lines": [
"Pick Find real distance / Find map distance / Find scale at the top.",
"The chosen one becomes the blue read-only result card; the other two stay as inputs.",
"Drag a slider or type a number — all three columns and the ruler update live.",
"Reset returns to the default 3 cm / 1:100000 / 3 km example."
]
},
{
"h": "3. The visual ruler",
"lines": [
"The blue bar is the map distance in real centimetres.",
"The green bar is the same real distance compressed by the current scale — same width.",
"The graphic scale auto-ranges over 1/2/5×10ⁿ so it always fits.",
"The spectrum places 1:1k … 1:1B on a log axis with a pointer at the current value.",
"Overflow warns “use a smaller scale” — that IS the lesson on choosing a sheet size."
]
},
{
"h": "4. Three notations & worked steps",
"lines": [
"Numeric 1:N; verbal “1 cm on the map = … on the ground”; graphic bar scale.",
"All three stay in sync and can be copied straight into homework.",
"Expand Worked steps: unify units → formula → substitute → result → convert unit.",
"The grade card: large / medium / small scale and “bigger denominator → smaller scale → larger area → less detail”."
]
},
{
"h": "5. Real-world ruler & practice",
"lines": [
"Built-in distances: classroom 10 m, track 400 m, marathon 42.195 km, Beijing–Shanghai 1080 km, equator 40,000 km.",
"Change the scale to see how long each becomes on paper (or that it won't fit / is invisible).",
"Practice generates three question types; type a number and press Enter or Check; wrong answers reveal full steps.",
"The streak counter accumulates and resets on a wrong answer."
]
},
{
"h": "6. Common mistakes",
"lines": [
"Forgetting to unify units: km ×100000 → cm before substituting.",
"“Zoom 2×” means denominator ÷ 2 (a larger scale), not × 2.",
"Don't swap map and real distance; N means “how many times the map length the real length is”.",
"A scale is a ratio with no unit; “larger scale” means a larger ratio, i.e. a SMALLER denominator."
]
}
]
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 54 KiB

+10 -10
View File
@@ -1,12 +1,12 @@
{
"schema": 1,
"generated": "2026-11-08T12:19:03Z",
"generated": "2026-11-12T11:29:46Z",
"repository": "https://gitcode.com/2509_92447106/GC",
"branch": "main",
"modelDir": "model",
"launcher": {
"version": "1.0.4",
"revision": "e8d68d13ed",
"revision": "f43354e248",
"packages": {
"win-x64": {
"path": "dist/GC-win-x64.zip",
@@ -33,26 +33,26 @@
"models": [
{
"id": "earth-geography",
"version": "1.2",
"build": "5e12cd2ee1",
"version": "1.6",
"build": "c568a1b05e",
"dir": "model/earth-geography"
},
{
"id": "earth-revolution",
"version": "1.1",
"build": "92a820f30c",
"version": "1.4",
"build": "41a6e0ead8",
"dir": "model/earth-revolution"
},
{
"id": "earth-rotation",
"version": "1.1",
"build": "e9e9851c56",
"version": "1.4",
"build": "5544dcea30",
"dir": "model/earth-rotation"
},
{
"id": "scale-calculator",
"version": "1.0",
"build": "4cb6aafff8",
"version": "1.3",
"build": "f6418437d4",
"dir": "model/scale-calculator"
}
]
@@ -28,6 +28,18 @@ public sealed class ModelManifest
public string? License { get; set; }
public string? UpdatedAt { get; set; }
public string? MinAppVersion { get; set; }
/// <summary>模型窗口标题栏配色(模型自带,跟随模型界面风格);缺省时用深色。</summary>
public WindowChrome? Chrome { get; set; }
}
/// <summary>模型窗口自建标题栏的颜色,由模型清单提供。</summary>
public sealed class WindowChrome
{
public string? TitleBar { get; set; }
public string? TitleBorder { get; set; }
public string? TitleText { get; set; }
public string? Button { get; set; }
public string? Frame { get; set; }
}
public sealed class ModelPackage
@@ -1,10 +1,13 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.Json;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Layout;
using Avalonia.Media;
using System.Collections.Generic;
using EarthModelStudio.Models;
using EarthModelStudio.Services;
@@ -18,6 +21,19 @@ namespace EarthModelStudio.Views;
public sealed class PlayerWindow : Window
{
private LoadedModel? _model;
private Button? _maximizeButton;
private Border? _frame;
private TextBlock? _titleText;
private Border? _titleBar;
private readonly List<Button> _titleButtons = new();
private Button? _helpButton;
/// <summary>基准尺寸(1240×820 时的标题栏高度与按钮尺寸)。</summary>
private const double BaseWidth = 1240;
private const double BaseTitleBarHeight = 34;
private const double BaseButtonWidth = 38;
private const double BaseButtonHeight = 28;
private const double BaseTitleFont = 11.5;
private const double BaseHelpFont = 11.5;
public PlayerWindow(ModelPackage package, LoadedModel model)
{
@@ -33,46 +49,114 @@ public sealed class PlayerWindow : Window
// 与启动器一致:去掉系统标题栏,自己做一个极简顶栏(否则 Esc 之外无法关闭)
SystemDecorations = Avalonia.Controls.SystemDecorations.None;
// 标题栏配色来自模型清单,跟随模型自己的界面风格:
// 地球模型是深色舞台,比例尺计算器是浅色卡片,两者不能共用一套深色。
var chrome = package.Manifest.Chrome;
var barBg = ParseColor(chrome?.TitleBar, "#0C1828");
var barBorder = ParseColor(chrome?.TitleBorder, "#1B2740");
var barText = ParseColor(chrome?.TitleText, "#EAF2FF");
var btnText = ParseColor(chrome?.Button, "#9FB4D4");
var frameBg = ParseColor(chrome?.Frame, "#0A1524");
var titleText = new TextBlock
{
Text = package.LocalizedName,
Foreground = new SolidColorBrush(barText),
FontSize = 11.5,
Margin = new Thickness(14, 0, 0, 0),
VerticalAlignment = VerticalAlignment.Center,
[Grid.ColumnProperty] = 0
};
_titleText = titleText;
var helpButton = new Button
{
Content = IsEnglish() ? "How to use?" : "如何使用?",
Height = 26,
Padding = new Thickness(12, 0),
Background = Brushes.Transparent,
Foreground = new SolidColorBrush(btnText),
BorderThickness = new Thickness(0),
FontSize = 11.5,
CornerRadius = new CornerRadius(7),
Margin = new Thickness(0, 0, 6, 0),
HorizontalContentAlignment = HorizontalAlignment.Center,
VerticalContentAlignment = VerticalAlignment.Center,
Cursor = new Cursor(StandardCursorType.Hand),
[Grid.ColumnProperty] = 1
};
helpButton.Click += (_, _) => ShowHelp(package, barBg, barBorder, barText, btnText, frameBg);
// 标题栏三键:最小化 / 最大化 / 关闭。配色与按钮尺寸都跟随模型 chrome。
Button TitleButton(string glyph, int column, bool isClose = false)
{
var b = new Button
{
Content = glyph,
Width = 38,
Height = 28,
Background = Brushes.Transparent,
Foreground = new SolidColorBrush(btnText),
BorderThickness = new Thickness(0),
FontSize = 13,
CornerRadius = new CornerRadius(7),
Margin = new Thickness(2, 0, 0, 0),
HorizontalContentAlignment = HorizontalAlignment.Center,
VerticalContentAlignment = VerticalAlignment.Center,
Cursor = new Cursor(StandardCursorType.Hand),
[Grid.ColumnProperty] = column
};
// 悬停:深色标题栏用亮一点的同调色,浅色标题栏用浅灰,避免出现突兀的深色块
var hover = isClose ? Color.Parse("#D64545")
: IsLight(barBg) ? Color.Parse("#EDF2FC") : Color.Parse("#223252");
var hoverText = isClose ? Colors.White
: IsLight(barBg) ? (Color?)Color.Parse("#111A2E") : Colors.White;
b.PointerEntered += (_, _) =>
{
b.Background = new SolidColorBrush(hover);
if (hoverText.HasValue) b.Foreground = new SolidColorBrush(hoverText.Value);
};
b.PointerExited += (_, _) =>
{
b.Background = Brushes.Transparent;
b.Foreground = new SolidColorBrush(btnText);
};
b.Classes.Add("model-titlebtn");
return b;
}
var minimizeButton = TitleButton("—", 2);
var maximizeButton = TitleButton("□", 3);
var closeButton = TitleButton("✕", 4, isClose: true);
minimizeButton.Click += (_, _) => WindowState = WindowState.Minimized;
maximizeButton.Click += (_, _) => ToggleMaximize();
closeButton.Click += (_, _) => Close();
var titleBar = new Border
{
Height = 34,
Background = new SolidColorBrush(Color.Parse("#0A1120")),
Background = new SolidColorBrush(barBg),
BorderBrush = new SolidColorBrush(barBorder),
BorderThickness = new Thickness(0, 0, 0, 1),
Child = new Grid
{
ColumnDefinitions = new ColumnDefinitions("*,Auto"),
Children =
{
new TextBlock
{
Text = package.LocalizedName,
Foreground = new SolidColorBrush(Color.Parse("#A9B8D4")),
FontSize = 11.5,
Margin = new Thickness(14, 0, 0, 0),
VerticalAlignment = VerticalAlignment.Center,
[Grid.ColumnProperty] = 0
},
new Button
{
Content = "✕",
Width = 40,
Height = 28,
Background = Brushes.Transparent,
Foreground = new SolidColorBrush(Color.Parse("#A9B8D4")),
BorderThickness = new Thickness(0),
FontSize = 13,
CornerRadius = new CornerRadius(7),
Margin = new Thickness(0, 0, 8, 0),
HorizontalContentAlignment = HorizontalAlignment.Center,
VerticalContentAlignment = VerticalAlignment.Center,
[Grid.ColumnProperty] = 1
}
}
ColumnDefinitions = new ColumnDefinitions("*,Auto,Auto,Auto,Auto,Auto"),
Children = { titleText, helpButton, minimizeButton, maximizeButton, closeButton }
}
};
titleBar.PointerPressed += OnTitleBarPointerPressed;
if (titleBar.Child is Grid g)
foreach (var child in g.Children)
if (child is Button b) b.Click += (_, _) => Close();
// 双击标题栏 = 最大化 / 还原(与系统标题栏一致)
titleBar.DoubleTapped += (_, e) =>
{
if (e.Source is Button) return;
ToggleMaximize();
};
_maximizeButton = maximizeButton;
_titleBar = titleBar;
_helpButton = helpButton;
_titleButtons.Add(minimizeButton);
_titleButtons.Add(maximizeButton);
_titleButtons.Add(closeButton);
var dock = new DockPanel { LastChildFill = true };
DockPanel.SetDock(titleBar, Dock.Top);
@@ -82,15 +166,255 @@ public sealed class PlayerWindow : Window
Content = new Border
{
CornerRadius = new CornerRadius(16),
Background = new SolidColorBrush(Color.Parse("#05070F")),
Background = new SolidColorBrush(frameBg),
ClipToBounds = true,
Child = dock
};
_frame = (Border)Content;
// 最大化 / 还原时同步圆角与按钮图标
PropertyChanged += (_, e) =>
{
if (e.Property == WindowStateProperty) UpdateMaximizeVisual();
};
// 窗口随心拉大 / 拉小时,标题栏文字与按钮同比缩放。
// 同时监听 Bounds 属性(不只是 SizeChanged),保证最大化/还原也立刻生效。
SizeChanged += (_, _) => ApplyChromeScale();
PropertyChanged += (_, e) =>
{
if (e.Property == BoundsProperty) ApplyChromeScale();
};
ApplyChromeScale();
KeyDown += OnKeyDown;
Closed += OnClosed;
}
/// <summary>
/// 让标题栏的文字与按钮尺寸跟随窗口大小。
/// 以 1240px 宽为基准线性缩放,限制在 0.85–1.9 倍,
/// 避免最大化到 4K 时按钮大得离谱、缩到最小又点不中。
/// </summary>
private void ApplyChromeScale()
{
if (Bounds.Width < 100) return;
var scale = Math.Clamp(Bounds.Width / BaseWidth, 0.85, 1.9);
if (_titleBar != null) _titleBar.Height = Math.Round(BaseTitleBarHeight * scale);
foreach (var b in _titleButtons)
{
b.Width = Math.Round(BaseButtonWidth * scale);
b.Height = Math.Round(BaseButtonHeight * scale);
b.FontSize = Math.Round(13 * scale, 1);
b.CornerRadius = new CornerRadius(Math.Round(7 * scale, 1));
}
if (_helpButton != null)
{
_helpButton.Height = Math.Round(26 * scale);
_helpButton.FontSize = Math.Round(BaseHelpFont * scale, 1);
_helpButton.Padding = new Thickness(Math.Round(12 * scale), 0);
_helpButton.CornerRadius = new CornerRadius(Math.Round(7 * scale, 1));
}
if (_titleText != null)
{
_titleText.FontSize = Math.Round(BaseTitleFont * scale, 1);
_titleText.Margin = new Thickness(Math.Round(14 * scale), 0, 0, 0);
}
}
/// <summary>判断颜色是否属于浅色系(用于决定悬停用深色还是浅色)。</summary>
private static bool IsLight(Color c)
{
// 相对亮度(sRGB 近似)
var lum = (0.299 * c.R + 0.587 * c.G + 0.114 * c.B) / 255.0;
return lum > 0.6;
}
private void ToggleMaximize()
{
WindowState = WindowState == WindowState.Maximized
? WindowState.Normal
: WindowState.Maximized;
}
private void UpdateMaximizeVisual()
{
var max = WindowState == WindowState.Maximized || WindowState == WindowState.FullScreen;
if (_maximizeButton != null)
{
// ❐ 还原 / □ 最大化
_maximizeButton.Content = max ? "❐" : "□";
Avalonia.Controls.ToolTip.SetTip(_maximizeButton, max
? (IsEnglish() ? "Restore" : "还原")
: (IsEnglish() ? "Maximize" : "最大化"));
}
// 最大化时贴边,不需要圆角;还原后恢复 16
if (_frame != null) _frame.CornerRadius = new CornerRadius(max ? 0 : 16);
}
private static Color ParseColor(string? hex, string fallback)
{
if (!string.IsNullOrWhiteSpace(hex))
{
try { return Color.Parse(hex!); }
catch { /* 模型写错颜色时退回默认 */ }
}
return Color.Parse(fallback);
}
private static bool IsEnglish() => L.I.Language.StartsWith("en", StringComparison.OrdinalIgnoreCase);
/// <summary>
/// 「如何使用?」:读取模型自带数据目录里的 help.json(中英双语),
/// 用与标题栏一致的配色弹出一个独立小窗。说明内容完全由模型提供,启动器不内置文案。
/// </summary>
private void ShowHelp(ModelPackage package, Color barBg, Color barBorder, Color barText,
Color btnText, Color frameBg)
{
var lang = IsEnglish() ? "en" : "zh-CN";
var file = Path.Combine(package.DataDirectory, "help.json");
string title = IsEnglish() ? "How to use" : "如何使用";
// 分节内容:每节一个标题 + 若干条说明;兼容旧的扁平 lines 格式
var sections = new List<(string Heading, List<string> Lines)>();
if (File.Exists(file))
{
try
{
using var doc = JsonDocument.Parse(File.ReadAllText(file));
var root = doc.RootElement;
var node = root.TryGetProperty(lang, out var exact) ? exact
: root.TryGetProperty("zh-CN", out var zh) ? zh : root;
if (node.TryGetProperty("title", out var t)) title = t.GetString() ?? title;
if (node.TryGetProperty("sections", out var arr) && arr.ValueKind == JsonValueKind.Array)
{
foreach (var sec in arr.EnumerateArray())
{
var heading = sec.TryGetProperty("h", out var h) ? h.GetString() ?? "" : "";
var items = new List<string>();
if (sec.TryGetProperty("lines", out var ls) && ls.ValueKind == JsonValueKind.Array)
foreach (var item in ls.EnumerateArray())
if (item.ValueKind == JsonValueKind.String) items.Add(item.GetString() ?? "");
if (items.Count > 0) sections.Add((heading, items));
}
}
else if (node.TryGetProperty("lines", out var flat) && flat.ValueKind == JsonValueKind.Array)
{
var items = new List<string>();
foreach (var item in flat.EnumerateArray())
if (item.ValueKind == JsonValueKind.String) items.Add(item.GetString() ?? "");
if (items.Count > 0) sections.Add(("", items));
}
}
catch (Exception ex)
{
Console.Error.WriteLine($"读取模型帮助失败 {file}: {ex.Message}");
}
}
if (sections.Count == 0)
sections.Add(("", new List<string>
{
IsEnglish() ? "This model has no usage notes yet." : "该模型暂未提供使用说明。"
}));
var body = new StackPanel { Spacing = 6 };
foreach (var (heading, items) in sections)
{
if (!string.IsNullOrWhiteSpace(heading))
body.Children.Add(new TextBlock
{
Text = heading,
Foreground = new SolidColorBrush(barText),
FontSize = 13.5,
FontWeight = FontWeight.SemiBold,
Margin = new Thickness(0, 12, 0, 2)
});
foreach (var line in items)
body.Children.Add(new TextBlock
{
Text = "• " + line,
Foreground = new SolidColorBrush(btnText),
FontSize = 12.5,
TextWrapping = TextWrapping.Wrap,
LineHeight = 19
});
}
var ok = new Button
{
Content = IsEnglish() ? "Got it" : "知道了",
HorizontalAlignment = HorizontalAlignment.Right,
Padding = new Thickness(18, 7),
Margin = new Thickness(0, 14, 0, 0),
Background = new SolidColorBrush(barBorder),
Foreground = new SolidColorBrush(barText),
BorderThickness = new Thickness(0),
CornerRadius = new CornerRadius(8),
Cursor = new Cursor(StandardCursorType.Hand)
};
// 标题固定在顶部,正文滚动;内容再长也不会被裁掉
var rootPanel = new DockPanel { LastChildFill = true };
var header = new Border
{
Padding = new Thickness(24, 18, 24, 10),
Child = new StackPanel
{
Spacing = 8,
Children =
{
new TextBlock
{
Text = title,
Foreground = new SolidColorBrush(barText),
FontSize = 17,
FontWeight = FontWeight.SemiBold
},
new Border { Height = 1, Background = new SolidColorBrush(barBorder) }
}
}
};
DockPanel.SetDock(header, Dock.Top);
rootPanel.Children.Add(header);
var scroll = new ScrollViewer
{
Content = new StackPanel
{
Margin = new Thickness(24, 0, 24, 8),
Children = { body, ok }
},
VerticalScrollBarVisibility = Avalonia.Controls.Primitives.ScrollBarVisibility.Auto,
HorizontalScrollBarVisibility = Avalonia.Controls.Primitives.ScrollBarVisibility.Disabled
};
rootPanel.Children.Add(scroll);
var win = new Window
{
Title = title,
Width = 660,
Height = Math.Min(720, 240 + sections.Sum(s => s.Lines.Count * 24 + 40)),
MinWidth = 480,
MinHeight = 300,
Background = Brushes.Transparent,
TransparencyLevelHint = new[] { WindowTransparencyLevel.Transparent },
SystemDecorations = SystemDecorations.None,
WindowStartupLocation = WindowStartupLocation.CenterOwner,
Content = new Border
{
CornerRadius = new CornerRadius(16),
Background = new SolidColorBrush(frameBg),
BorderBrush = new SolidColorBrush(barBorder),
BorderThickness = new Thickness(1),
ClipToBounds = true,
Child = rootPanel
}
};
ok.Click += (_, _) => win.Close();
win.Show(this);
}
private void OnTitleBarPointerPressed(object? sender, PointerPressedEventArgs e)
{
if (e.GetCurrentPoint(this).Properties.IsLeftButtonPressed)
@@ -6,13 +6,13 @@
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {
"EarthModelStudio/1.0.4": {
"EarthModelStudio/1.0.5": {
"dependencies": {
"Avalonia": "11.3.9",
"Avalonia.Desktop": "11.3.9",
"Avalonia.Themes.Fluent": "11.3.9",
"CommunityToolkit.Mvvm": "8.2.2",
"EarthModelStudio.ModelSdk": "1.0.4"
"EarthModelStudio.ModelSdk": "1.0.5"
},
"runtime": {
"EarthModelStudio.dll": {}
@@ -398,21 +398,21 @@
}
}
},
"EarthModelStudio.ModelSdk/1.0.4": {
"EarthModelStudio.ModelSdk/1.0.5": {
"dependencies": {
"Avalonia": "11.3.9"
},
"runtime": {
"EarthModelStudio.ModelSdk.dll": {
"assemblyVersion": "1.0.4.0",
"fileVersion": "1.0.4.0"
"assemblyVersion": "1.0.5.0",
"fileVersion": "1.0.5.0"
}
}
}
}
},
"libraries": {
"EarthModelStudio/1.0.4": {
"EarthModelStudio/1.0.5": {
"type": "project",
"serviceable": false,
"sha512": ""
@@ -571,7 +571,7 @@
"path": "tmds.dbus.protocol/0.21.2",
"hashPath": "tmds.dbus.protocol.0.21.2.nupkg.sha512"
},
"EarthModelStudio.ModelSdk/1.0.4": {
"EarthModelStudio.ModelSdk/1.0.5": {
"type": "project",
"serviceable": false,
"sha512": ""
@@ -7,13 +7,13 @@
"targets": {
".NETCoreApp,Version=v8.0": {},
".NETCoreApp,Version=v8.0/osx-arm64": {
"EarthModelStudio/1.0.4": {
"EarthModelStudio/1.0.5": {
"dependencies": {
"Avalonia": "11.3.9",
"Avalonia.Desktop": "11.3.9",
"Avalonia.Themes.Fluent": "11.3.9",
"CommunityToolkit.Mvvm": "8.2.2",
"EarthModelStudio.ModelSdk": "1.0.4",
"EarthModelStudio.ModelSdk": "1.0.5",
"runtimepack.Microsoft.NETCore.App.Runtime.osx-arm64": "8.0.31"
},
"runtime": {
@@ -966,21 +966,21 @@
}
}
},
"EarthModelStudio.ModelSdk/1.0.4": {
"EarthModelStudio.ModelSdk/1.0.5": {
"dependencies": {
"Avalonia": "11.3.9"
},
"runtime": {
"EarthModelStudio.ModelSdk.dll": {
"assemblyVersion": "1.0.4.0",
"fileVersion": "1.0.4.0"
"assemblyVersion": "1.0.5.0",
"fileVersion": "1.0.5.0"
}
}
}
}
},
"libraries": {
"EarthModelStudio/1.0.4": {
"EarthModelStudio/1.0.5": {
"type": "project",
"serviceable": false,
"sha512": ""
@@ -1109,7 +1109,7 @@
"path": "tmds.dbus.protocol/0.21.2",
"hashPath": "tmds.dbus.protocol.0.21.2.nupkg.sha512"
},
"EarthModelStudio.ModelSdk/1.0.4": {
"EarthModelStudio.ModelSdk/1.0.5": {
"type": "project",
"serviceable": false,
"sha512": ""
@@ -7,13 +7,13 @@
"targets": {
".NETCoreApp,Version=v8.0": {},
".NETCoreApp,Version=v8.0/win-arm64": {
"EarthModelStudio/1.0.4": {
"EarthModelStudio/1.0.5": {
"dependencies": {
"Avalonia": "11.3.9",
"Avalonia.Desktop": "11.3.9",
"Avalonia.Themes.Fluent": "11.3.9",
"CommunityToolkit.Mvvm": "8.2.2",
"EarthModelStudio.ModelSdk": "1.0.4",
"EarthModelStudio.ModelSdk": "1.0.5",
"runtimepack.Microsoft.NETCore.App.Runtime.win-arm64": "8.0.31"
},
"runtime": {
@@ -969,21 +969,21 @@
}
}
},
"EarthModelStudio.ModelSdk/1.0.4": {
"EarthModelStudio.ModelSdk/1.0.5": {
"dependencies": {
"Avalonia": "11.3.9"
},
"runtime": {
"EarthModelStudio.ModelSdk.dll": {
"assemblyVersion": "1.0.4.0",
"fileVersion": "1.0.4.0"
"assemblyVersion": "1.0.5.0",
"fileVersion": "1.0.5.0"
}
}
}
}
},
"libraries": {
"EarthModelStudio/1.0.4": {
"EarthModelStudio/1.0.5": {
"type": "project",
"serviceable": false,
"sha512": ""
@@ -1119,7 +1119,7 @@
"path": "tmds.dbus.protocol/0.21.2",
"hashPath": "tmds.dbus.protocol.0.21.2.nupkg.sha512"
},
"EarthModelStudio.ModelSdk/1.0.4": {
"EarthModelStudio.ModelSdk/1.0.5": {
"type": "project",
"serviceable": false,
"sha512": ""
@@ -7,13 +7,13 @@
"targets": {
".NETCoreApp,Version=v8.0": {},
".NETCoreApp,Version=v8.0/win-x64": {
"EarthModelStudio/1.0.4": {
"EarthModelStudio/1.0.5": {
"dependencies": {
"Avalonia": "11.3.9",
"Avalonia.Desktop": "11.3.9",
"Avalonia.Themes.Fluent": "11.3.9",
"CommunityToolkit.Mvvm": "8.2.2",
"EarthModelStudio.ModelSdk": "1.0.4",
"EarthModelStudio.ModelSdk": "1.0.5",
"runtimepack.Microsoft.NETCore.App.Runtime.win-x64": "8.0.31"
},
"runtime": {
@@ -969,21 +969,21 @@
}
}
},
"EarthModelStudio.ModelSdk/1.0.4": {
"EarthModelStudio.ModelSdk/1.0.5": {
"dependencies": {
"Avalonia": "11.3.9"
},
"runtime": {
"EarthModelStudio.ModelSdk.dll": {
"assemblyVersion": "1.0.4.0",
"fileVersion": "1.0.4.0"
"assemblyVersion": "1.0.5.0",
"fileVersion": "1.0.5.0"
}
}
}
}
},
"libraries": {
"EarthModelStudio/1.0.4": {
"EarthModelStudio/1.0.5": {
"type": "project",
"serviceable": false,
"sha512": ""
@@ -1119,7 +1119,7 @@
"path": "tmds.dbus.protocol/0.21.2",
"hashPath": "tmds.dbus.protocol.0.21.2.nupkg.sha512"
},
"EarthModelStudio.ModelSdk/1.0.4": {
"EarthModelStudio.ModelSdk/1.0.5": {
"type": "project",
"serviceable": false,
"sha512": ""
@@ -12,11 +12,11 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("NeoRF")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.4.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.4+f69a8fbb7fa563800802d3c2e319ed56365c3b8c")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.5.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.5+7de92a25f5b91dfe2b85dcd95639fdcc353badf2")]
[assembly: System.Reflection.AssemblyProductAttribute("Earth Model Studio")]
[assembly: System.Reflection.AssemblyTitleAttribute("EarthModelStudio")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.4.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.5.0")]
[assembly: System.Resources.NeutralResourcesLanguageAttribute("zh-Hans")]
// Generated by the MSBuild WriteCodeFragment class.
@@ -1 +1 @@
7915cc6a645d81627b594db52c0bcb43aed3975e57c9edf46061b1902e2a7193
bf9e7961280762c40f0481f1ccb3df53604cd782eafe0cf22bcab1892d1ab2f1
@@ -5,7 +5,7 @@
},
"projects": {
"/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/EarthModelStudio.ModelSdk.csproj": {
"version": "1.0.4",
"version": "1.0.5",
"restore": {
"projectUniqueName": "/Users/morris/Downloads/GC#/model/_sdk/EarthModelStudio.ModelSdk/EarthModelStudio.ModelSdk.csproj",
"projectName": "EarthModelStudio.ModelSdk",
@@ -49,12 +49,6 @@
"Avalonia": {
"target": "Package",
"version": "[11.3.9, )"
},
"Microsoft.NET.ILLink.Tasks": {
"suppressParent": "All",
"target": "Package",
"version": "[8.0.31, )",
"autoReferenced": true
}
},
"imports": [
@@ -68,16 +62,6 @@
],
"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"
@@ -85,15 +69,10 @@
},
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/10.0.401/PortableRuntimeIdentifierGraph.json"
}
},
"runtimes": {
"win-arm64": {
"#import": []
}
}
},
"/Users/morris/Downloads/GC#/src/main/dotnet/EarthModelStudio/EarthModelStudio.csproj": {
"version": "1.0.4",
"version": "1.0.5",
"restore": {
"projectUniqueName": "/Users/morris/Downloads/GC#/src/main/dotnet/EarthModelStudio/EarthModelStudio.csproj",
"projectName": "EarthModelStudio",
@@ -153,12 +132,6 @@
"CommunityToolkit.Mvvm": {
"target": "Package",
"version": "[8.2.2, )"
},
"Microsoft.NET.ILLink.Tasks": {
"suppressParent": "All",
"target": "Package",
"version": "[8.0.31, )",
"autoReferenced": true
}
},
"imports": [
@@ -172,20 +145,6 @@
],
"assetTargetFallback": true,
"warn": true,
"downloadDependencies": [
{
"name": "Microsoft.AspNetCore.App.Runtime.win-arm64",
"version": "[8.0.31, 8.0.31]"
},
{
"name": "Microsoft.NETCore.App.Host.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"
@@ -193,11 +152,6 @@
},
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/10.0.401/PortableRuntimeIdentifierGraph.json"
}
},
"runtimes": {
"win-arm64": {
"#import": []
}
}
}
}
@@ -14,12 +14,10 @@
</ItemGroup>
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)skiasharp.nativeassets.webassembly/2.88.9/buildTransitive/netstandard1.0/SkiaSharp.NativeAssets.WebAssembly.props" Condition="Exists('$(NuGetPackageRoot)skiasharp.nativeassets.webassembly/2.88.9/buildTransitive/netstandard1.0/SkiaSharp.NativeAssets.WebAssembly.props')" />
<Import Project="$(NuGetPackageRoot)microsoft.net.illink.tasks/8.0.31/build/Microsoft.NET.ILLink.Tasks.props" Condition="Exists('$(NuGetPackageRoot)microsoft.net.illink.tasks/8.0.31/build/Microsoft.NET.ILLink.Tasks.props')" />
<Import Project="$(NuGetPackageRoot)harfbuzzsharp.nativeassets.webassembly/8.3.1.1/buildTransitive/netstandard1.0/HarfBuzzSharp.NativeAssets.WebAssembly.props" Condition="Exists('$(NuGetPackageRoot)harfbuzzsharp.nativeassets.webassembly/8.3.1.1/buildTransitive/netstandard1.0/HarfBuzzSharp.NativeAssets.WebAssembly.props')" />
<Import Project="$(NuGetPackageRoot)avalonia/11.3.9/buildTransitive/Avalonia.props" Condition="Exists('$(NuGetPackageRoot)avalonia/11.3.9/buildTransitive/Avalonia.props')" />
</ImportGroup>
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<PkgMicrosoft_NET_ILLink_Tasks Condition=" '$(PkgMicrosoft_NET_ILLink_Tasks)' == '' ">/Users/morris/.nuget/packages/microsoft.net.illink.tasks/8.0.31</PkgMicrosoft_NET_ILLink_Tasks>
<PkgAvalonia_BuildServices Condition=" '$(PkgAvalonia_BuildServices)' == '' ">/Users/morris/.nuget/packages/avalonia.buildservices/11.3.2</PkgAvalonia_BuildServices>
<PkgAvalonia Condition=" '$(PkgAvalonia)' == '' ">/Users/morris/.nuget/packages/avalonia/11.3.9</PkgAvalonia>
</PropertyGroup>
@@ -1 +1 @@
b5b025787ddcf020e4af544e7291049bae132a2a48645e60ce75f9c17a36c04e
0aef3705cc5861ae47f166e26ea2e3b27fd85cb1df12754a1e85eb4400e855e9
@@ -12,11 +12,11 @@ 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+936aec81850fb15f55014c66116d174dc9e2f967")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.5.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.5+7de92a25f5b91dfe2b85dcd95639fdcc353badf2")]
[assembly: System.Reflection.AssemblyProductAttribute("Earth Model Studio")]
[assembly: System.Reflection.AssemblyTitleAttribute("EarthModelStudio")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.4.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.5.0")]
[assembly: System.Resources.NeutralResourcesLanguageAttribute("zh-Hans")]
// Generated by the MSBuild WriteCodeFragment class.
@@ -1 +1 @@
205198c382e84cfd75294cd5a2c03ad33c681429a1f83e23c148c445c43cf0bf
002d4cb7097f5a57bf6099af75598276c17f9ec87615927296b7da8e36f07f02
@@ -12,11 +12,11 @@ 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+936aec81850fb15f55014c66116d174dc9e2f967")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.5.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.5+7de92a25f5b91dfe2b85dcd95639fdcc353badf2")]
[assembly: System.Reflection.AssemblyProductAttribute("Earth Model Studio")]
[assembly: System.Reflection.AssemblyTitleAttribute("EarthModelStudio")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.4.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.5.0")]
[assembly: System.Resources.NeutralResourcesLanguageAttribute("zh-Hans")]
// Generated by the MSBuild WriteCodeFragment class.
@@ -1 +1 @@
205198c382e84cfd75294cd5a2c03ad33c681429a1f83e23c148c445c43cf0bf
002d4cb7097f5a57bf6099af75598276c17f9ec87615927296b7da8e36f07f02
@@ -7,13 +7,13 @@
"targets": {
".NETCoreApp,Version=v8.0": {},
".NETCoreApp,Version=v8.0/win-arm64": {
"EarthModelStudio/1.0.4": {
"EarthModelStudio/1.0.5": {
"dependencies": {
"Avalonia": "11.3.9",
"Avalonia.Desktop": "11.3.9",
"Avalonia.Themes.Fluent": "11.3.9",
"CommunityToolkit.Mvvm": "8.2.2",
"EarthModelStudio.ModelSdk": "1.0.4",
"EarthModelStudio.ModelSdk": "1.0.5",
"runtimepack.Microsoft.NETCore.App.Runtime.win-arm64": "8.0.31"
},
"runtime": {
@@ -925,21 +925,21 @@
}
}
},
"EarthModelStudio.ModelSdk/1.0.4": {
"EarthModelStudio.ModelSdk/1.0.5": {
"dependencies": {
"Avalonia": "11.3.9"
},
"runtime": {
"EarthModelStudio.ModelSdk.dll": {
"assemblyVersion": "1.0.4.0",
"fileVersion": "1.0.4.0"
"assemblyVersion": "1.0.5.0",
"fileVersion": "1.0.5.0"
}
}
}
}
},
"libraries": {
"EarthModelStudio/1.0.4": {
"EarthModelStudio/1.0.5": {
"type": "project",
"serviceable": false,
"sha512": ""
@@ -1075,7 +1075,7 @@
"path": "tmds.dbus.protocol/0.21.2",
"hashPath": "tmds.dbus.protocol.0.21.2.nupkg.sha512"
},
"EarthModelStudio.ModelSdk/1.0.4": {
"EarthModelStudio.ModelSdk/1.0.5": {
"type": "project",
"serviceable": false,
"sha512": ""
Loaded 100 of 131 files, more files were not shown because too many files have changed in this diff. Show more