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
引数
| 名前 | 型 | 説明 |
|---|---|---|
places | readonly Place[] | The places, as |
view | PlaceView | The picture. |
look | PlaceLook |
|
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出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。