tileLevel関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The first level to load for a disc: the smallest one whose texels are about a device pixel on the screen, else the finest there is, and none when the whole-Earth picture
(baseWidth across) is already that sharp.
インポート
import { tileLevel } from "@johnmorrisdotca/chikyu-earth/realistic";
定義
function tileLevel(radiusPx: number, layer: TileLayer, baseWidth: number): number | undefined
引数
| 名前 | 型 | 説明 |
|---|---|---|
radiusPx | number | The disc's radius in device pixels. |
layer | TileLayer | The levels the set has for this layer. |
baseWidth | number | The width of the picture the tiles are laid over, 4096 for the day map. |
戻り値
number | undefined
A level in layer, or undefined when no tile is worth loading.
例
import { tileLevel, type TileLayer } from "@johnmorrisdotca/chikyu-earth/realistic";
const day: TileLayer = { tileSize: 512, levels: [{ level: 3, width: 8192 }, { level: 4, width: 16384 }] };
console.log(tileLevel(600, day, 4096), tileLevel(1500, day, 4096), tileLevel(9000, day, 4096));undefined 3 4出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。