本文へ移動

Chikyu Earth地球

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

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

目次

リファレンス · 地球上の目印

layoutPlaces関数

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

Where each place's marker and name go in one picture. A place on the far side of the Earth, or off the picture, is left out; one near the Earth's edge fades. The stick stands up from the ground as the picture sees it, leaning towards the top of the screen where the reader looks straight down on it, so it never shrinks to a dot; the ring at its foot is flattened as the ground is. A here place is taller and wider than a favourite. Names go at the top of the stick, here first and then in the order given, never over one another or over a box in taken; a name with no free place is left out. With sun, each shape says how far into the night its place is, so it can be drawn dimmer there.

インポート

import { layoutPlaces } from "@johnmorrisdotca/chikyu-earth/markers";

定義

function layoutPlaces(places: readonly Place[], view: PlaceView, look: PlaceLook, options?: PlaceLayoutOptions): PlaceLayout

引数

名前型説明
placesreadonly Place[]

The places, as cleanPlaces makes them.

viewPlaceView

The picture.

lookPlaceLook

beam, pin or ring.

options (省略可)PlaceLayoutOptions

The size of each name, boxes already used, the most names (16) and where the Sun is overhead.

戻り値

PlaceLayout

The markers to draw and where the names go.

例

import { layoutPlaces, orthoView } from "@johnmorrisdotca/chikyu-earth/markers";

const view = orthoView({ lon: 139.69, lat: 35.69, radius: 200, cx: 210, cy: 210, width: 420, height: 420 });
const layout = layoutPlaces([{ id: "tokyo", lon: 139.69, lat: 35.69, label: "Tokyo", kind: "here" }], view, "beam", { size: () => ({ width: 48, height: 18 }) });
console.log(layout.shapes[0]?.length, layout.labels.length);
25.3 1

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

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

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