svgmap

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package svgmap 提供日食和月掩 SVG 共用的无国界 Natural Earth 地图 / Package svgmap provides the shared, border-free Natural Earth map used by 日食、月食和月掩 SVG 渲染器共用 / eclipse and lunar-occultation SVG renderers.

Index

Constants

View Source
const (
	ProjectionEquirectangular = geodata.ProjectionEquirectangular
	ProjectionNorthPolar      = geodata.ProjectionNorthPolar
	ProjectionSouthPolar      = geodata.ProjectionSouthPolar
)

Variables

This section is empty.

Functions

func PolygonFragments

func PolygonFragments(points []GeoPoint, projection Projection) [][]GeoPoint

PolygonFragments 将地理多边形裁剪到选定地图范围 / PolygonFragments clips a geographic polygon to the selected map extent.

func PolylineSegments

func PolylineSegments(points []GeoPoint, projection Projection) [][]GeoPoint

PolylineSegments 将地理折线裁剪到选定投影并 / PolylineSegments clips a geographic polyline to the selected projection and 在等经纬投影中按日界线拆分路径 / splits equirectangular paths at the antimeridian.

func SameGeoPoint

func SameGeoPoint(a, b GeoPoint) bool

SameGeoPoint 判断两个经纬度点是否在拓扑所需精度内相等 / SameGeoPoint reports whether two longitude/latitude points are equal within 地图拓扑辅助函数所需的精度内相等 / the precision needed by the map topology helpers.

func VisibleHemispherePolygons

func VisibleHemispherePolygons(center GeoPoint, projection Projection, samples int) [][]GeoPoint

VisibleHemispherePolygons 返回以指定中心为中心的半球多边形 / VisibleHemispherePolygons returns polygons for the hemisphere centered on 中心的半球多边形,并裁剪到请求的地图投影 / center, clipped to the requested map projection.

Types

type Frame

type Frame struct {
	X          float64
	Y          float64
	Width      float64
	Height     float64
	Projection Projection
}

Frame 描述一个投影地图在 SVG 画布中的位置 / Frame places one projected map in an SVG canvas.

func (Frame) ClipDefinition

func (frame Frame) ClipDefinition(id string) string

ClipDefinition 写入地图的矩形或圆形裁剪路径 / ClipDefinition writes the rectangular or circular clipping path for a map.

func (Frame) IsPolar

func (frame Frame) IsPolar() bool

IsPolar 判断当前画布是否使用半球方位投影 / IsPolar reports whether the frame uses a hemispheric azimuthal projection.

func (Frame) Project

func (frame Frame) Project(longitude, latitude float64) (float64, float64, bool)

Project 将经纬度映射为 SVG 坐标;布尔值为 false 表示点在极区投影半球外 / Project maps longitude and latitude to SVG coordinates. The boolean is false 点位于极区投影的可见半球之外时返回 false / when a point lies outside a polar projection's visible hemisphere.

func (Frame) WriteFrame

func (frame Frame) WriteFrame(builder *strings.Builder)

WriteFrame 绘制地图轮廓 / WriteFrame renders the map outline.

func (Frame) WriteGraticule

func (frame Frame) WriteGraticule(builder *strings.Builder, clipID string)

WriteGraticule 绘制符合投影的经线和纬线 / WriteGraticule renders projection-correct meridians and parallels.

func (Frame) WriteLand

func (frame Frame) WriteLand(builder *strings.Builder, clipID string)

WriteLand 绘制无国界的 Natural Earth 1:50m 陆地 / WriteLand renders Natural Earth 1:50m physical land without borders.

func (Frame) WriteOcean

func (frame Frame) WriteOcean(builder *strings.Builder)

WriteOcean 绘制地图的物理范围 / WriteOcean renders the map's physical extent.

type GeoPoint

type GeoPoint = geodata.GeoPoint

GeoPoint 是以度表示的地理点,东经为正 / GeoPoint is a geographic point in degrees, with east longitude positive.

func JoinPolylineSegments

func JoinPolylineSegments(segments [][]GeoPoint) []GeoPoint

JoinPolylineSegments 按最近端点连接无序边界线段 / JoinPolylineSegments joins unordered boundary segments by their nearest 端点连接;输入线段不会被修改 / endpoints. The input segments are not modified.

func ShortestCircleArc

func ShortestCircleArc(circle []GeoPoint, from, to GeoPoint) []GeoPoint

ShortestCircleArc 返回两点之间较短的采样圆弧 / ShortestCircleArc returns the shorter sampled arc from one point to another.

func SphericalCircle

func SphericalCircle(center GeoPoint, radiusDegrees float64, points int) []GeoPoint

SphericalCircle 返回球面小圆上的等间隔采样点 / SphericalCircle returns evenly spaced points on a small circle on the 球面小圆;方位角从地理北方顺时针采样 / sphere. Bearings are sampled clockwise from geographic north.

type Projection

type Projection = geodata.Projection

Projection 标识受支持的地图投影 / Projection identifies one of the supported map projections.

func ResolveProjection

func ResolveProjection(requested Projection, focusLatitude, minimumLatitude, maximumLatitude float64) Projection

ResolveProjection 校验显式投影,或为高纬事件选择极区视图 / ResolveProjection validates an explicit projection or selects a polar view 为始终位于一个半球内的高纬事件选择极区视图 / for a high-latitude event that stays in one hemisphere.

Directories

Path Synopsis
internal
mapgen command
Command mapgen 将 Natural Earth 陆地多边形转换为供共享世界地图渲染器使用的紧凑 SVG 路径 / Command mapgen converts Natural Earth land polygons into compact SVG paths for the shared world-map renderer.
Command mapgen 将 Natural Earth 陆地多边形转换为供共享世界地图渲染器使用的紧凑 SVG 路径 / Command mapgen converts Natural Earth land polygons into compact SVG paths for the shared world-map renderer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL