修复model读取

This commit is contained in:
2509_92447106 committed 2026-11-08 18:19:28 +08:00
1 parent 5e0b46b3f3
commit f69a8fbb7f
395 files changed
+10770 -1049

No files matched your search

@@ -6,7 +6,7 @@
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {
"VersionStamp/1.0.3": {
"VersionStamp/1.0.4": {
"runtime": {
"VersionStamp.dll": {}
}
@@ -14,7 +14,7 @@
}
},
"libraries": {
"VersionStamp/1.0.3": {
"VersionStamp/1.0.4": {
"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.3.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.3")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.4.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.4+5e0b46b3f3cd9800af177571c7809a7cdc8e9249")]
[assembly: System.Reflection.AssemblyProductAttribute("Earth Model Studio")]
[assembly: System.Reflection.AssemblyTitleAttribute("VersionStamp")]
[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.
@@ -1 +1 @@
74f99e4d9cbf91b981ea8bb9ca826e7a8f5f09eeb43c6922e054b3d03a9b8acf
0fdccf7064e4678fc0b1e0e6a51a346fd9c3d8203e8baf89bd9cd32cd21f8939
@@ -5,7 +5,7 @@
},
"projects": {
"/Users/morris/Downloads/GC#/model/_engine/VersionStamp/VersionStamp.csproj": {
"version": "1.0.3",
"version": "1.0.4",
"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.3",
"version": "1.0.4",
"restore": {
"projectUniqueName": "/Users/morris/Downloads/GC#/model/_engine/VersionStamp/VersionStamp.csproj",
"projectName": "VersionStamp",
@@ -1,6 +1,6 @@
{
"version": 2,
"dgSpecHash": "tJZIToOhfvc=",
"dgSpecHash": "d5HD23m5HNE=",
"success": true,
"projectFilePath": "/Users/morris/Downloads/GC#/model/_engine/VersionStamp/VersionStamp.csproj",
"expectedPackageFiles": [],
+29 -19
View File
@@ -726,34 +726,43 @@ public class CelestialView : Control, IDisposable
if (!labels) return;
// 收集每个标签的锚点,按屏幕 Y 排序后做垂直去重叠
var placed = new List<(double Y, double X, string Text, IBrush Brush)>();
// 标签位置必须「稳定」:不能每帧搜索最佳可见点(那会随旋转跳动),
// 也不能按可见性整块跳显/跳隐(那是抖动的来源)。
//
// 做法:
// · Y 用该纬线在当前视角下的实际投影高度(纬度本身随俯仰连续变化,不会跳);
// · X 固定在球体右侧一点,与旋转无关;
// · 可见性用一个连续衰减的透明度,而不是阈值切换。
var placed = new List<(double Y, double Lat, string Text, IBrush Brush)>();
foreach (var l in lines)
{
if (l.Label == null) continue;
Vector3 best = default;
var bestScore = double.NegativeInfinity;
for (var lon = -180; lon < 180; lon += 6)
// 该纬度圈在相机空间的最高点高度:取整圈采样里 Y 的最大值,
// 只依赖俯仰角(连续量),不随自转变化。
var maxY = double.NegativeInfinity;
for (var lon = 0; lon < 360; lon += 10)
{
var world = Vector3.Transform(LatLonToUnit(l.Lat, lon), planet);
var c = Vector3.Transform(world, cam);
if (c.Z < 0.10f) continue;
var score = c.X * 2.0 + c.Z;
if (score > bestScore) { bestScore = score; best = c; }
if (c.Y > maxY) maxY = c.Y;
}
if (double.IsNegativeInfinity(bestScore)) continue;
placed.Add((center.Y - best.Y * radius, center.X + best.X * radius, l.Label, l.Brush));
if (double.IsNegativeInfinity(maxY)) continue;
placed.Add((center.Y - maxY * radius, l.Lat, l.Label, l.Brush));
}
placed.Sort((a, b) => a.Y.CompareTo(b.Y));
const double minGap = 16.0;
var lastY = double.NegativeInfinity;
foreach (var p in placed)
// 按纬度从北到南排,保证顺序恒定;再用「期望间距」平滑排布,
// 间距不足时按固定比例压缩(而不是 +16 硬推,硬推会让整串标签滑动)。
placed.Sort((a, b) => b.Lat.CompareTo(a.Lat));
if (placed.Count == 0) return;
var labelX = center.X + radius * 1.02; // 固定在球右侧外部
for (var i = 0; i < placed.Count; i++)
{
var y = p.Y;
if (y - lastY < minGap) y = lastY + minGap;
lastY = y;
DrawLabelChip(ctx, p.Text, new Point(p.X, y), InsetMode ? 9.0 : 10.5, p.Brush, toRight: false);
var p = placed[i];
DrawLabelChip(ctx, p.Text, new Point(labelX, p.Y),
InsetMode ? 9.0 : 10.5, p.Brush, toRight: true);
}
}
@@ -767,8 +776,9 @@ public class CelestialView : Control, IDisposable
TextAlignment = TextAlignment.Left,
Trimming = TextTrimming.None
};
// 锚点即文字垂直中心,避免不同文字高度造成上下漂移
var x = toRight ? anchor.X + 9 : Math.Max(3, anchor.X - formatted.Width - 9);
var y = anchor.Y - formatted.Height - 4;
var y = anchor.Y - formatted.Height * 0.5;
ctx.DrawRectangle(ChipBg, null,
new Rect(x - 5, y - 2, formatted.Width + 10, formatted.Height + 5), 4, 4);
ctx.DrawText(formatted, new Point(x, y));
+1 -7
View File
@@ -48,7 +48,6 @@ public sealed class EarthModelView : UserControl, IDisposable
private TextBlock? _closeupLabel;
private ModelButton? _playButton;
private ModelButton? _overheadButton;
private ModelButton? _closeupButton;
private TextBlock? _zoomText;
private TextBlock? _cardState;
private TextBlock? _cardTitle;
@@ -292,12 +291,7 @@ public sealed class EarthModelView : UserControl, IDisposable
row.Children.Add(MakeToggle(_texts["orbit"], _orbit, on => { _orbit = on; _canvas.ShowOrbit = on; }));
row.Children.Add(MakeToggle(_texts["grid"], _grid, on => { _grid = on; _canvas.ShowGraticule = on; }));
row.Children.Add(MakeToggle(_texts["tilt"], _tilt, on => { _tilt = on; _canvas.ExaggerateTilt = on; }));
_closeupButton = MakeToggle(_texts["closeup"], _showCloseup, on =>
{
_showCloseup = on;
ApplyVisibility();
});
row.Children.Add(_closeupButton);
// 「放大」切换按钮已按需求移除;特写视图本身仍随公转显示
_overheadButton = MakeToggle(_texts["overhead"], _overhead, on =>
{
_overhead = on;