本文へ移動

Chikyu Earth地球

世界の国の輪郭を線で描いた地球儀です。地球と同じ速さで回ります。宇宙から見たような地球と、好きな場所の目印も使えます。

「地球」(ちきゅう) は、私たちが住む星の名前です。 名前について(英語)

目次

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

EarthMapSource型

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

A source of the Earth's map in tiles for one layer (or every layer of a folder): a TileSource of the family's map shape (the place is a MapPlace, the detail is the pixels across the whole circumference, a tile is an ImageTile) that says which layer it is for. A layer of "*" is every layer of a folder (the place then names the one, in place.layer, and the keys start with its name). The keys a source returns end in level/column/row on the package's pyramid. levels says which levels the source has when that has to be asked (a folder's manifest); left out, levels 3 and 4.

インポート

import type { EarthMapSource } from "@johnmorrisdotca/chikyu-earth/door";

定義

type EarthMapSource = TileSource<EarthMapPlace, number, ImageTile> & {
    layer: MapLayer | "*";
    levels?(layer: string, signal: AbortSignal): TileLayer | undefined | Promise<TileLayer | undefined>;
    grid?: MapGrid;
    holes?: boolean;
    look?: {
        clear: readonly [
            number,
            number
        ];
        gain?: readonly [
            number,
            number,
            number
        ];
    };
};

メンバー

名前型説明
kind"tiles"
infoSourceInfo
need(place: EarthMapPlace, detail: number): readonly string[]

The keys of the tiles a place needs at a detail. Pure: no fetching.

load(key: string, signal: AbortSignal): Promise<ImageTile>

Loads one tile. The source may use the network or not; it must stop when the signal aborts.

bytes(tile: ImageTile): number

The tile's size in memory, in bytes, for the budget.

layerMapLayer | "*"
levels (省略可)((layer: string, signal: AbortSignal) => TileLayer | undefined | Promise<TileLayer | undefined>) | undefined
grid (省略可)MapGrid | undefined

The source's own grid, when it is not the package's pyramid (2^(L+1) columns by 2^L rows). The loader places tiles from this. Left out, the pyramid is unchanged.

holes (省略可)boolean | undefined

True when the source's tiles may have transparent pixels (a place it has no data for), so the loader draws them blended and the picture underneath shows through.

look (省略可){ clear: readonly [number, number]; gain?: readonly [number, number, number]; } | undefined

How the loader draws this source's tiles, on the graphics card: clear is the luminance (0 to 255) at or below which a pixel is wholly transparent and from which it is wholly opaque, and gain multiplies each colour. Left out, tiles are drawn as they are.

例

import type { EarthMapSource } from "@johnmorrisdotca/chikyu-earth/door";

const layers = (sources: readonly EarthMapSource[]): string[] => sources.map((source) => source.layer);
console.log(layers([]));
[]

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/chikyu-earth 0.51.1 のソースから作成しました。

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