feat: 引入可切换星历模型并扩展天象观测链路

- 新增半解析、旧模型、自定义与多源堆叠星历实例,提供 Context、Instance、SPK 读取及状态与视位置计算
- 统一太阳、月球和行星实例接口,扩展黄经穿越、留、相位、最近角距、偕日可见、任意高度升落、轨道节点及凌日等天象查询
- 完善日月食、月掩与凌日的月缘剖面、有限盘面接触、站心修正、局地可见性、全球路径和地图输出
- 新增 SVG、GeoJSON、KML 天象输出及凌日、月掩和月缘地形相关缓存与几何求解
- 新增恒星星表导入与查询,支持 CSV、Hipparcos、BSC5、Stellarium 等格式及名称、交叉标识、锥面检索和星等过滤
- 补充 IAU 2006、地球定向、折射消光、大气观测、轨道传播及半解析行星/月球数据支持
- 将默认未来民用时标切换为 TimeScaleLeapHour,更新 2027–2400 农历速查表、中文日期解析和时区边界处理
- 增加事件基线、跨模型回归、几何边界、月缘地形和输出契约测试,完善中英文手册、示例资源、NOTICE 与忽略规则
This commit is contained in:
2026-10-15 23:54:15 +08:00
parent 16c62a97d5
commit 044f2f4381
674 changed files with 62983 additions and 8396 deletions
+96
View File
@@ -0,0 +1,96 @@
// Package limbnote 生成出图时写入图注的月面口径声明。
package limbnote
import "strings"
const english = "en"
// Contacts 接触时刻所用月面口径的短标签,保持站心图页脚平衡 / short tag for the contact-time limb convention.
func Contacts(applied bool, language string) string {
if applied {
if language == english {
return "Limb profile."
}
return "月缘剖面。"
}
if language == english {
return "Circular limb."
}
return "圆月面。"
}
// Limits 界线所用月面口径;可见域与等时线始终按圆月面 / limb convention for limit tracks only.
func Limits(applied bool, language string) string {
if applied {
if language == english {
return "Limits use the lunar limb profile (areas and isolines circular)."
}
return "界线按月缘剖面修正(可见域与等时线仍按圆月面)。"
}
if language == english {
return "Circular lunar limb."
}
return "月面按圆月面计算。"
}
// SolarMapLayers 日食全球图各层是否真正按月缘剖面修正 / which global solar map layers the lunar limb actually corrected.
type SolarMapLayers struct {
// GlobalContacts 全球偏食始末与食甚点中心食时长 / global P1/P4 and the central duration at greatest eclipse.
GlobalContacts bool
// LocalPanel 食甚点站心面板 / the local panel at greatest eclipse.
LocalPanel bool
// CentralLimits 中心带南北界与带宽 / central-band limits and width.
CentralLimits bool
// PartialBoundary 偏食可见域外边界 / the outer partial visibility boundary.
PartialBoundary bool
}
// SolarMap 按实际生效的层列出日食全球图的月缘修正,食分线与等时线始终按圆月面 / lists the corrected layers of the global solar map.
func SolarMap(layers SolarMapLayers, language string) string {
type layer struct {
applied bool
zh, english string
}
var names []string
for _, item := range []layer{
{layers.GlobalContacts, "全球始末", "global contacts"},
{layers.LocalPanel, "食甚点站心值", "local values at greatest eclipse"},
{layers.CentralLimits, "中心带界线", "central limits"},
{layers.PartialBoundary, "可见域边界", "visibility boundary"},
} {
if !item.applied {
continue
}
if language == english {
names = append(names, item.english)
} else {
names = append(names, item.zh)
}
}
if len(names) == 0 {
return Limits(false, language)
}
if language == english {
return "Lunar limb profile applied to " + strings.Join(names, ", ") + " (isolines circular)."
}
return "按月缘剖面修正" + strings.Join(names, "、") + "(食分线与等时线仍按圆月面)。"
}
// Join 把月面口径声明接在时标声明之后,二者同占一行 / appends the limb declaration to the time-scale note.
func Join(scaleNote, limbNote, language string) string {
switch {
case scaleNote == "":
return limbNote
case limbNote == "":
return scaleNote
case strings.HasSuffix(scaleNote, "。") || strings.HasSuffix(scaleNote, "."):
if language == english {
return scaleNote + " " + limbNote
}
return scaleNote + limbNote
case language == english:
return scaleNote + ". " + limbNote
default:
return scaleNote + ";" + limbNote
}
}
+23
View File
@@ -0,0 +1,23 @@
package limbnote
import "testing"
func TestSolarMapListsOnlyAppliedLayers(t *testing.T) {
cases := []struct {
layers SolarMapLayers
language string
want string
}{
{SolarMapLayers{}, "zh", "月面按圆月面计算。"},
{SolarMapLayers{}, english, "Circular lunar limb."},
{SolarMapLayers{PartialBoundary: true}, "zh", "按月缘剖面修正可见域边界(食分线与等时线仍按圆月面)。"},
{SolarMapLayers{GlobalContacts: true, CentralLimits: true}, "zh", "按月缘剖面修正全球始末、中心带界线(食分线与等时线仍按圆月面)。"},
{SolarMapLayers{LocalPanel: true, PartialBoundary: true}, english,
"Lunar limb profile applied to local values at greatest eclipse, visibility boundary (isolines circular)."},
}
for _, c := range cases {
if got := SolarMap(c.layers, c.language); got != c.want {
t.Errorf("SolarMap(%+v, %s) = %q, want %q", c.layers, c.language, got, c.want)
}
}
}