本文へ移動

Hoshi Stars星

肉眼で見える星の名前・色・距離、88星座の線と境界、メシエ天体、そしてそれらを描くための7種類の図法を使えます。

「星」(ほし) は、夜空に光って見えるものです。 名前について(英語)

目次

リファレンス · データの入口(自分で用意した星やディープスカイ天体を、ライセンスと出典つきのソースとして渡し、いま画面にあるのは誰のデータかを示します)

StarSky型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

The faint stars of a page from any number of sources: loads the tiles a patch needs from each and answers from the ones it has. With only ucac4Source it is faintSky.

インポート

import type { StarSky } from "@johnmorrisdotca/hoshi-stars/door";

定義

interface StarSky {
    readonly sources: readonly StarSource[];
    addSource(source: StarSource): () => void;
    removeSource(id: string): boolean;
    enable(id: string, on: boolean): void;
    ownOnly(on: boolean): void;
    load(field: FaintField, limit?: number): Promise<void>;
    stars(field: FaintField, limit?: number, max?: number): {
        stars: FaintStar[];
        depth: number;
        loaded: boolean;
    };
    credits(): Credit[];
    readonly size: number;
    stats(): TileStats & {
        skipped: number;
    };
}

メンバー

名前型説明
sourcesreadonly StarSource[]

The sources now in the view, in the order added.

addSource(source: StarSource): () => void

Adds a source. It throws a TypeError at once for a source validateSource refuses, an id already in the view or a source that is not a tile source. Returns the function that removes it.

removeSource(id: string): boolean

Removes a source by id: aborts its loads, frees its tiles, drops its credit. Returns whether there was one.

enable(id: string, on: boolean): void

Switches a source off (false) or on: off aborts its loads, frees its tiles and drops its credit, and the source stays in the view.

ownOnly(on: boolean): void

true ignores every source that is not the package's own, at once (the same as data="own" on an element).

load(field: FaintField, limit?: number): Promise<void>

Fetch the tiles the patch needs for stars to limit from every source in use. Resolves when they are all here or refused for room, and rejects with the first error if a tile could not be fetched (the others stay). Asking again tries what is missing once more.

stars(field: FaintField, limit?: number, max?: number): { stars: FaintStar[]; depth: number; loaded: boolean; }

The stars of the patch from the tiles that are here, brightest first, from all sources together (see faintStarsIn), and loaded: whether every tile the patch needs is here. Sends nothing.

credits(): Credit[]

The sources that gave at least one star to the last stars call, the package's own first (creditLine writes them).

sizenumber

How many tiles are here.

stats(): TileStats & { skipped: number; }

What the store has done (loads started, failed, refused, held bytes), and skipped: the stars the last stars call left out for a number that is not finite.

例

import { creditLine, starSky, ucac4Source, type StarSource } from "@johnmorrisdotca/hoshi-stars/door";

declare const mySource: StarSource;
const sky = starSky({ sources: [ucac4Source()] });
const remove = sky.addSource(mySource); // checked at once; returns the way to take it away
await sky.load({ rightAscension: 83.8, declination: -5.4, radius: 1 }, 12);
console.log(creditLine(sky.credits(), "en"));
remove();

ソースを見るGitHub で編集@johnmorrisdotca/hoshi-stars 0.47.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。