runwaysSvg関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The runways a window shows as SVG, for drawChizu: a <g class="cz-runways"> holding a
<line class="cz-runway" data-airport="…"> for each runway of each airport in ports that the window's tier shows, the line
between its two ends with the stroke as wide as the runway is on the ground (no thinner than a hairline). A runway
shorter than 1.2% of the window's width is left out, so none is drawn until the window shows a few hundred
kilometres. Empty when none is.
インポート
import { runwaysSvg } from "@johnmorrisdotca/chizu";
定義
function runwaysSvg(map: Pick<ChizuMap, "projection">, ports: readonly ChizuPort[], runways: ChizuRunways, box: MapBox, offsets: readonly number[], options: ChizuPortOptions): string
引数
| 名前 | 型 | 説明 |
|---|---|---|
map | Pick<ChizuMap, "projection"> | The map the runways go on. |
ports | readonly ChizuPort[] | The airports to draw the runways of (a harbour is passed over). |
runways | Readonly<Record<string, readonly ChizuRunway[]>> | The runways, by airport id. |
box | MapBox | The window. |
offsets | readonly number[] | The copies of the canvas across a wrapping map ( |
options | ChizuPortOptions | The tier ( |
戻り値
string
The SVG text, or "".
例
import { localMap, runwaysSvg, wholeMapBox, type ChizuPort } from "@johnmorrisdotca/chizu";
const map = localMap({ centre: [139.78, 35.55], widthMetres: 6000 });
const haneda: ChizuPort = { id: "hnd", kind: "airport", name: { en: "Haneda" }, country: "JP", lat: 35.55, lon: 139.78, tier: 1 };
const svg = runwaysSvg(map, [haneda], { hnd: [[139.77, 35.54, 139.79, 35.56, 60]] }, wholeMapBox(map), [0], {});
console.log(svg.includes('data-airport="hnd"'));
// truetrue出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。