isard 2.1.0 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/dist/basemap/mvt.d.ts +11 -4
- package/dist/basemap/mvt.js +75 -15
- package/dist/basemap/mvt.js.map +1 -1
- package/dist/basemap/vectortiles.js +1 -1
- package/dist/basemap/vectortiles.js.map +1 -1
- package/dist/basemap.worker.js +2 -2
- package/dist/basemap.worker.js.map +9 -9
- package/dist/isard_webgl2_bg.wasm +0 -0
- package/dist/isard_webgpu_bg.wasm +0 -0
- package/dist/map/quality.d.ts +3 -2
- package/dist/map/quality.js +3 -3
- package/dist/map/quality.js.map +1 -1
- package/dist/types.d.ts +6 -6
- package/dist/types.js.map +1 -1
- package/dist/util/lru.d.ts +9 -0
- package/dist/util/lru.js +30 -6
- package/dist/util/lru.js.map +1 -1
- package/dist/wasm/isard_webgl2.d.ts +1 -1
- package/dist/wasm/isard_webgl2.js +6 -6
- package/dist/wasm/isard_webgpu.d.ts +1 -1
- package/dist/wasm/isard_webgpu.js +6 -6
- package/dist/workers/basemap/geometry.d.ts +4 -4
- package/dist/workers/basemap/protocol.d.ts +1 -1
- package/dist/workers/basemap/tiles.d.ts +3 -2
- package/dist/workers/basemap/trees.d.ts +2 -2
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
package/dist/map/quality.d.ts
CHANGED
|
@@ -21,8 +21,9 @@ export interface QualitySettings {
|
|
|
21
21
|
/** The most workers cutting the vector tiles, and decoding the 3D Tiles: each one its own heap, its decoded tiles,
|
|
22
22
|
* its modules (a phone's page grows with them as the map moves) */
|
|
23
23
|
workers: number;
|
|
24
|
-
/** The decoded vector tiles the workers keep, all of them together
|
|
25
|
-
|
|
24
|
+
/** The decoded vector tiles the workers keep, all of them together, in megabytes of their heaps (a tile of a city's
|
|
25
|
+
* middle some 5, of a village under 1) */
|
|
26
|
+
cachedMegabytes: number;
|
|
26
27
|
}
|
|
27
28
|
export declare const QUALITY: Readonly<Record<Quality, QualitySettings>>;
|
|
28
29
|
/** The level a map starts at: its option's ('auto' starts high) */
|
package/dist/map/quality.js
CHANGED
|
@@ -14,10 +14,10 @@ export const QUALITY = {
|
|
|
14
14
|
errorScale: 1,
|
|
15
15
|
reach: Number.POSITIVE_INFINITY,
|
|
16
16
|
workers: 4,
|
|
17
|
-
|
|
17
|
+
cachedMegabytes: 192,
|
|
18
18
|
},
|
|
19
|
-
medium: { pixelRatio: 1.5, shadows: true, errorScale: 1.5, reach: 3, workers: 2,
|
|
20
|
-
low: { pixelRatio: 1, shadows: false, errorScale: 2.5, reach: 3, workers: 1,
|
|
19
|
+
medium: { pixelRatio: 1.5, shadows: true, errorScale: 1.5, reach: 3, workers: 2, cachedMegabytes: 64 },
|
|
20
|
+
low: { pixelRatio: 1, shadows: false, errorScale: 2.5, reach: 3, workers: 1, cachedMegabytes: 32 },
|
|
21
21
|
};
|
|
22
22
|
/** The level a map starts at: its option's ('auto' starts high) */
|
|
23
23
|
export const startLevel = (quality) => quality === 'auto' || quality === undefined ? 'high' : quality;
|
package/dist/map/quality.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quality.js","sourceRoot":"","sources":["../../src/map/quality.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"quality.js","sourceRoot":"","sources":["../../src/map/quality.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * The map's quality: what it draws less of on a device that cannot keep up. Each level a ceiling on the pixels drawn\n * (the device's pixel ratio capped: a high-density screen draws four times the pixels of its CSS size), the sun's\n * shadows (the solid scene drawn twice more for them: the sun's map, the camera's depth), how far the 3D Tiles are\n * refined (their screen-space error multiplied: fewer, coarser tiles far away) and how far toward the horizon the\n * vector tiles go (a city's tiles there carry its whole detail over square kilometres, mostly above the screen's top\n * edge: Paris tilted 65° on a phone, 940 MB of a page against 720 without them, the view the same). 'auto' starts high\n * and steps down when the frames stay slow while the map moves.\n */\n\nimport type { Quality } from '../types.ts';\n\n/** What a level draws */\nexport interface QualitySettings {\n /** The highest pixel ratio drawn */\n pixelRatio: number;\n /** The sun casts its shadows (its light and the night stay without) */\n shadows: boolean;\n /** Multiplies the 3D Tiles' screen-space error */\n errorScale: number;\n /** How far toward the horizon the vector tiles go, in distances of the screen center */\n reach: number;\n /** The most workers cutting the vector tiles, and decoding the 3D Tiles: each one its own heap, its decoded tiles,\n * its modules (a phone's page grows with them as the map moves) */\n workers: number;\n /** The decoded vector tiles the workers keep, all of them together, in megabytes of their heaps (a tile of a city's\n * middle some 5, of a village under 1) */\n cachedMegabytes: number;\n}\n\nexport const QUALITY: Readonly<Record<Quality, QualitySettings>> = {\n high: {\n pixelRatio: Number.POSITIVE_INFINITY,\n shadows: true,\n errorScale: 1,\n reach: Number.POSITIVE_INFINITY,\n workers: 4,\n cachedMegabytes: 192,\n },\n medium: { pixelRatio: 1.5, shadows: true, errorScale: 1.5, reach: 3, workers: 2, cachedMegabytes: 64 },\n low: { pixelRatio: 1, shadows: false, errorScale: 2.5, reach: 3, workers: 1, cachedMegabytes: 32 },\n};\n\n/** The level a map starts at: its option's ('auto' starts high) */\nexport const startLevel = (quality: Quality | 'auto' | undefined): Quality =>\n quality === 'auto' || quality === undefined ? 'high' : quality;\n\n/** The level under each, for 'auto' */\nconst LOWER: Readonly<Record<Quality, Quality | undefined>> = { high: 'medium', medium: 'low', low: undefined };\n\n/** A move measured before it is judged: `WINDOW` frames, or `WINDOW_MS` of them on a slow device (at least\n * `MIN_FRAMES`); a gap past `GAP_MS` between two frames is no move (the map was still) */\nconst WINDOW = 60;\nconst WINDOW_MS = 2000;\nconst MIN_FRAMES = 10;\nconst GAP_MS = 500;\n\n/** The median interval between the frames of a move past which the map steps down (some 40 frames a second) */\nconst SLOW_MS = 25;\n\n/** After a step down, the time the new level is given before it is judged */\nconst SETTLE_MS = 3000;\n\n/**\n * 'auto': the intervals between the frames drawn while the map moves; once a window of them (`WINDOW`) has a median\n * past `SLOW_MS`, `step` is called with the level under the current one. It never steps up: at the display's rate a fast\n * frame tells nothing of what a finer level would cost\n */\nexport class QualityWatch {\n private readonly intervals: number[] = [];\n private last = 0;\n private settled = 0;\n\n constructor(\n private level: Quality,\n private readonly step: (level: Quality) => void,\n ) {}\n\n /** A frame drawn at `now` (ms), the map moving or not */\n frame(now: number, moving: boolean): void {\n const gap = now - this.last;\n\n this.last = now;\n if (!moving || gap > GAP_MS || now < this.settled) return;\n this.intervals.push(gap);\n\n const spent = this.intervals.reduce((sum, i) => sum + i, 0);\n\n if (this.intervals.length < WINDOW && (spent < WINDOW_MS || this.intervals.length < MIN_FRAMES)) return;\n\n const sorted = [...this.intervals].sort((a, b) => a - b);\n const median = sorted[Math.floor(sorted.length / 2)] ?? 0;\n const lower = LOWER[this.level];\n\n this.intervals.length = 0;\n if (median <= SLOW_MS || !lower) return;\n this.level = lower;\n this.settled = now + SETTLE_MS;\n this.step(lower);\n }\n}\n"]}
|
package/dist/types.d.ts
CHANGED
|
@@ -86,10 +86,10 @@ export interface GeoMapOptions extends Partial<Camera> {
|
|
|
86
86
|
* pixel, no sun's shadows, the 3D Tiles coarser still; `'auto'` high, a level lower each time the frames stay slow
|
|
87
87
|
* while the map moves (`'quality'` event) */
|
|
88
88
|
quality?: Quality | 'auto';
|
|
89
|
-
/** The GPU memory, megabytes, the layers' tiles (3D Tiles, point clouds) and the rasters' tiles may
|
|
90
|
-
* together: past it the tiles drawn least recently are unloaded, whichever their layer
|
|
91
|
-
* (the default): 256 on a touch screen (a phone, a tablet: iOS
|
|
92
|
-
*
|
|
89
|
+
/** The GPU memory, megabytes, the layers' tiles (3D Tiles, point clouds, vector tiles) and the rasters' tiles may
|
|
90
|
+
* hold all together: past it the tiles drawn least recently are unloaded, whichever their layer, the vector tiles
|
|
91
|
+
* (those of the view) kept (`GeoMap.memory`). `'auto'` (the default): 256 on a touch screen (a phone, a tablet: iOS
|
|
92
|
+
* closes a page past about a gigabyte, the page's workers included), 1024 elsewhere. Set at creation */
|
|
93
93
|
memory?: number | 'auto';
|
|
94
94
|
/** Multisampled antialiasing of the canvas (default true): the edges of the buildings, 3D Tiles and models smooth.
|
|
95
95
|
* False draws each pixel once (lines and halos antialias themselves): wide translucent layers, a network's halo over
|
|
@@ -292,8 +292,8 @@ export type RasterGrid = 'mercator' | 'equirectangular' | TileGrid;
|
|
|
292
292
|
export interface MapMemory {
|
|
293
293
|
/** What they may hold (`GeoMapOptions.memory`) */
|
|
294
294
|
budget: number;
|
|
295
|
-
/** What they hold: the tiles of the 3D Tiles and
|
|
296
|
-
* included), each one's full from its creation */
|
|
295
|
+
/** What they hold: the tiles of the 3D Tiles, point clouds and vector tiles, the pools of the rasters' tiles (the
|
|
296
|
+
* relief's included), each one's full from its creation */
|
|
297
297
|
held: number;
|
|
298
298
|
/** Each layer's, bottom first */
|
|
299
299
|
layers: {
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,0CAA0C","sourcesContent":["/** Public types of the `isard` package */\n\nimport type { TileGrid } from './basemap/grid.ts';\nimport type { DecoderUrls } from './decoding/decoders.ts';\nimport type { Feature, Ramp, Size } from './layers/features.ts';\nimport type { Layer } from './layers/layers.ts';\nimport type { RasterLayer } from './layers/raster.ts';\nimport type { QualitySettings } from './map/quality.ts';\nimport type { AttributionOptions } from './ui/controls.ts';\nimport type { Camera, Engine } from './wasm/isard_webgpu.js';\n\nexport type LonLat = [lon: number, lat: number];\nexport type Point = [x: number, y: number];\n\n/**\n * The named basemaps. OpenFreeMap's vector styles, OpenStreetMap data worldwide, their labels above the other layers:\n * `osm-positron` (light grey, quiet: data over it reads first), `osm-liberty` and `osm-bright` (in colour), `osm-dark`\n * (near black: bright data over it, a wind's particles, lights). The\n * Géoplateforme's (IGN, France): rasters (`ign-plan`, `ign-plan-grey`, `ign-ortho`, the aerial photographs) or vector\n * tiles with their labels (`ign-plan-vector`, `ign-plan-grey-vector`, the PLAN.IGN styles).\n */\nexport type BasemapName =\n | 'osm-positron'\n | 'osm-liberty'\n | 'osm-bright'\n | 'osm-dark'\n | 'ign-plan'\n | 'ign-plan-grey'\n | 'ign-ortho'\n | 'ign-plan-vector'\n | 'ign-plan-grey-vector'\n | 'none';\n\n/** A basemap by name (see `BasemapName`) */\nexport type Basemap = BasemapName;\n\n/**\n * The Earth's named terrain models. `'terrain-tiles'`: worldwide, the Terrain Tiles of AWS's open data registry\n * (SRTM, EU-DEM, GMTED… merged by Mapzen, 30 m in most places), the sea floor flattened at sea level. `'ign'`: France,\n * the IGN's RGE ALTI from the Géoplateforme (1 to 5 m), raised by the RAF20 geoid to heights above the ellipsoid.\n */\nexport type TerrainModel = 'terrain-tiles' | 'ign';\n\n/** How tiles encode their altitudes: `'float32'`, raw little-endian floats (`image/x-bil;bits=32`, an ArcGIS raw\n * grid); `'terrarium'`, the colors of a PNG, `R × 256 + G + B / 256 - 32768`; `'mapbox'`, those of Terrain-RGB,\n * `(R × 65536 + G × 256 + B) / 10 - 10000` */\nexport type TerrainEncoding = 'float32' | 'terrarium' | 'mapbox';\n\n/**\n * How tiles load and show. 'immediate' (default): everything visible loads, tiles show as soon as they arrive.\n * 'smooth': during flights the levels flown through are skipped, off-center tiles wait while the camera moves, tiles\n * fade in; fewer downloads, for slow networks or GPUs.\n */\nexport type LoadingMode = 'immediate' | 'smooth';\n\n/** 'globe': a sphere at low zoom, blending into Web Mercator between zooms 5 and 7, up to three levels later under a\n * tilted camera (it sees much farther than its center: the horizon stays curved) */\nexport type Projection = 'globe' | 'mercator';\n\n/** A body to draw the map on, other than the named ones (`CelestialBody`) */\nexport interface BodyOptions {\n /** Equatorial radius, metres */\n radius: number;\n /** Flattening of its ellipsoid, 0 for a sphere (default 0) */\n flattening?: number;\n /** An atmosphere: its halo around the globe, true for the Earth's light blue, or a CSS color (its alpha the\n * halo's strength) (default false) */\n atmosphere?: boolean | string;\n /** Color of the globe where no tile covers it (past the Web Mercator latitudes, 85°), a CSS color (default\n * `#808080`) */\n color?: string;\n /** Lowest and highest altitudes of its ground, metres around the ellipsoid: what its relief may raise into view\n * (default ±1 % of the radius) */\n relief?: [lowest: number, highest: number];\n}\n\n/**\n * The body the map is drawn on: 'earth' (WGS 84, the default), 'moon' (a sphere of 1 737 400 m, no atmosphere),\n * 'mars' (a sphere of 3 396 190 m, its equatorial radius, a thin dusty halo; planetocentric latitudes) or another\n * one. Zoom levels keep their meaning on screen (the Web Mercator tile pyramid), their metres follow the body:\n * altitudes, relief, buildings, 3D Tiles. Off the Earth, the map has none of the Earth's defaults: no basemap, no\n * credits, and space for its background; the Moon and Mars have NASA's relief for `terrain: true`.\n */\nexport type CelestialBody = 'earth' | 'moon' | 'mars' | BodyOptions;\n\n/** A level of the map's quality (`GeoMapOptions.quality`) */\nexport type Quality = 'high' | 'medium' | 'low';\n\nexport interface GeoMapOptions extends Partial<Camera> {\n /** The body the map is drawn on (default 'earth'); set at creation */\n body?: CelestialBody;\n /** Default 'globe' */\n projection?: Projection;\n /** Default 'immediate' */\n loading?: LoadingMode;\n /** The basemap (default 'osm-positron'; 'none' off the Earth) */\n basemap?: Basemap;\n /** Opacity of the IGN hillshade over the basemap (France, Géoplateforme), 0 for none (default 0) */\n hillshade?: number;\n /** Color behind the map (sky of tilted flat views), a CSS color (default `#f2f2f0`; black off the Earth) */\n background?: string;\n /** Space behind the globe: stars and atmosphere halo, fading out as the globe turns flat (default true) */\n sky?: boolean;\n /** The sun casting the shadows of buildings, trees, models and the relief (`setSun`); none by default */\n sun?: SunOptions;\n /** What the map draws less of on a device that cannot keep up (`setQuality`): `'high'` (the default) all of it;\n * `'medium'` at most 1.5 device pixels a CSS pixel, the 3D Tiles coarser far away; `'low'` one device pixel a CSS\n * pixel, no sun's shadows, the 3D Tiles coarser still; `'auto'` high, a level lower each time the frames stay slow\n * while the map moves (`'quality'` event) */\n quality?: Quality | 'auto';\n /** The GPU memory, megabytes, the layers' tiles (3D Tiles, point clouds) and the rasters' tiles may hold all\n * together: past it the tiles drawn least recently are unloaded, whichever their layer (`GeoMap.memory`). `'auto'`\n * (the default): 256 on a touch screen (a phone, a tablet: iOS closes a page past about a gigabyte, the page's\n * workers and vector tiles included), 1024 elsewhere. Set at creation */\n memory?: number | 'auto';\n /** Multisampled antialiasing of the canvas (default true): the edges of the buildings, 3D Tiles and models smooth.\n * False draws each pixel once (lines and halos antialias themselves): wide translucent layers, a network's halo over\n * a region, cost up to four times less on an integrated GPU (MapLibre's default). Set at creation */\n antialias?: boolean;\n /** The engine on wgpu (#146): 'auto' (default) WebGPU where the browser gives an adapter, else wgpu's WebGL2 fallback;\n * 'webgpu' or 'webgl' forces one */\n renderer?: 'auto' | 'webgpu' | 'webgl2';\n /** Relief under the basemap: true for the body's terrain model (on the Earth the worldwide Terrain Tiles; NASA's on\n * the Moon and Mars: LOLA, MOLA), one of the Earth's models by name (`'ign'`: France, RGE ALTI), or its options\n * (default false; on another body, its `url` is required). Network layers are draped on it */\n terrain?: boolean | TerrainModel | TerrainOptions;\n minZoom?: number;\n maxZoom?: number;\n /** Highest pitch, degrees, up to 85 (default 70) */\n maxPitch?: number;\n /** Sky over the plane, seen when the camera is tilted towards the horizon, and the fog the ground fades into\n * (MapLibre's `setSky`); default none: the background color */\n atmosphere?: AtmosphereOptions;\n /** Mouse, touch and keyboard controls (default true) */\n interactive?: boolean;\n /** Keyboard controls once the map has the focus (it is reached with Tab): arrows pan, Shift + arrows rotate and\n * tilt, + and - zoom (Shift: two levels), 0 faces north and levels the view (default true; none when not\n * `interactive`) */\n keyboard?: boolean;\n /** Accessible name of the map, read by screen readers (default 'Map') */\n ariaLabel?: string;\n /** A preset of map options (`IGN_PRESETS`: `'ign'`, `'ign-3d'`, `'ign-ortho-3d'`), the other options over it */\n preset?: 'ign' | 'ign-3d' | 'ign-ortho-3d';\n /** The folder isard's files are served from (its engines, `isard_webgpu_bg.wasm`, `isard_webgl2_bg.wasm`, its\n * modules, `isard_points_bg.wasm`, `isard_tiles3d_bg.wasm`, `isard_tess_bg.wasm`, `isard_grid_bg.wasm`, and its\n * workers, `decoder.worker.js`, `basemap.worker.js`): one option for a bundler that moves them, the `…Url` options\n * below for each one. `isard/vite` sets it for the whole page; default next to the module */\n assetsUrl?: string | URL;\n /** Where to load the engine on WebGPU from (`isard_webgpu_bg.wasm`), when a bundler does not resolve the default URL */\n webgpuWasmUrl?: string | URL;\n /** Where to load the engine's WebGL2 fallback from (`isard_webgl2_bg.wasm`, for a browser without WebGPU), when a\n * bundler does not resolve the default URL */\n webgl2WasmUrl?: string | URL;\n /** Where the decoding workers load the point cloud module from (`isard_points_bg.wasm`, the LAZ decoder of COPC),\n * when a bundler does not resolve the default URL. Loaded with the first point cloud only */\n pointsWasmUrl?: string | URL;\n /** Where the decoding workers load the 3D Tiles module from (`isard_tiles3d_bg.wasm`: a tile's content decoded for\n * the GPU), when a bundler does not resolve the default URL. Loaded with the first tile */\n tiles3dWasmUrl?: string | URL;\n /** Where the basemap workers load the tessellation module from (`isard_tess_bg.wasm`: the vector tiles drawn as\n * geometry, `vectorTiles().vectors()`, made ready for the GPU off the main thread), when a bundler does not resolve\n * the default URL. Loaded with the first tile of geometry; without it, the main thread does that work */\n tessWasmUrl?: string | URL;\n /** Where the workers load the grid module from (`isard_grid_bg.wasm`: GRIB2 and NetCDF files read by\n * `map.readGrids`), when a bundler does not resolve the default URL. Loaded with the first file */\n gridWasmUrl?: string | URL;\n /** Where to load the vector basemap worker from, when a bundler does not resolve the default URL */\n basemapWorkerUrl?: string | URL;\n /** Texture size of the vector basemap's tiles, pixels (default 512: lines and edges sharp at every zoom on a screen\n * of pixel ratio 1). 256: a quarter of the drawing in the workers, of the uploads and of the GPU memory, for lines\n * and edges a little softer between two zoom levels (the tiles are shown 181 to 362 CSS pixels wide) */\n basemapTileSize?: number;\n /** Glyphs of the symbol layers: a URL with `{fontstack}` and `{range}` (MapLibre's glyph format; default\n * OpenFreeMap's fonts, Noto Sans). A vector basemap's labels take the glyphs of its style */\n glyphs?: string;\n /** Workers decoding 3D Tiles off the main thread: a count, or false to decode on the main thread (default: cores - 1,\n * 1 to 4). False (or 0) also decodes the PNG relief and reprojects the equirectangular rasters on the main thread,\n * else done by the vector basemap's workers */\n workers?: number | false;\n /** Where to load the decoding worker from, when a bundler does not resolve the default URL */\n workerUrl?: string | URL;\n /** Folders of the Draco and Basis Universal decoders, loaded by the workers on first use (default: the official\n * builds on gstatic.com and jsDelivr; self-host them for offline or locked-down networks). They run through\n * `new Function`: a Content Security Policy needs `'unsafe-eval'` (see `DecoderUrls`) */\n decoders?: Partial<DecoderUrls>;\n /** Credits at the bottom right: false for none, or its options (default true: the credits of the basemap,\n * hillshade and relief in use, compact on maps narrower than 640 px) */\n attributionControl?: boolean | AttributionOptions;\n}\n\nexport interface TerrainOptions {\n /** One of the Earth's named models (default `'terrain-tiles'` on the Earth); unused with a `url` */\n model?: TerrainModel;\n /** Altitudes of 256 × 256 tiles in `encoding`: a WMS GetMap URL with {bbox} (EPSG:3857 on the Earth, the body's\n * Mercator metres elsewhere: the sphere of its radius), a tile URL with {z}, {x} and {y}, or an ArcGIS image service\n * (a URL ending in `/ImageServer`), asked for raw altitudes in the body's Mercator (default: the `model`'s; on the\n * Moon and Mars, NASA's Trek LOLA and MOLA models) */\n url?: string;\n /** How the tiles of `url` encode their altitudes (default `'float32'`); `'terrarium'` and `'mapbox'` take a URL with\n * {z}, {x} and {y} */\n encoding?: TerrainEncoding;\n /** Vertical exaggeration, 1 for the true relief (default 1) */\n exaggeration?: number;\n /** Finest level of the relief, up to 15 (default 15; 14 for the Terrain Tiles, 8 for the Moon's and Mars's models). It\n * starts at level 6 on the Earth, coarser on bodies of a larger relief for their size (3 on the Moon and Mars) */\n maxZoom?: number;\n /** Altitudes over mainland France raised by the height of the RAF20 geoid (the French one, 0 away from France), to\n * heights above the ellipsoid (those of 3D Tiles); false keeps the altitudes as served (NGF-IGN69 for the IGN's)\n * (default true for the `'ign'` model, false otherwise) */\n geoid?: boolean;\n}\n\n/** Sky, horizon and fog over the plane, with the names and meanings of MapLibre's `setSky` */\nexport interface AtmosphereOptions {\n /** A CSS color (default `#9cc7ec`) */\n skyColor?: string;\n /** (default `#e8f1f8`) */\n horizonColor?: string;\n /** (default `#f2f5f8`) */\n fogColor?: string;\n /** Blend from the horizon to the sky color, share of the field of view above the horizon, 0-1 (default 0.6) */\n skyHorizonBlend?: number;\n /** Blend from the horizon to the fog color below the horizon, 0-1 (default 0.7) */\n horizonFogBlend?: number;\n /** Share of the distance to the far plane over which the ground fades into the fog, 0-1 (default 0.4) */\n fogGroundBlend?: number;\n}\n\n/** The sun casting shadows (`GeoMap.setSun`): where it stands, by date or by hand, and how dark its shadows are */\nexport interface SunOptions {\n /** The time: the sun where it stands then over the map's center (default now, unless `azimuth` and `altitude`) */\n date?: Date;\n /** Degrees clockwise from north, with `altitude`: the sun placed by hand */\n azimuth?: number;\n /** Degrees above the horizon; at or under it, no shadows */\n altitude?: number;\n /** How dark the shadows are, 0 to 1 (default 0.35) */\n opacity?: number;\n /** How dark the night is, 0 to 1: the scene tinted in its blue, the windows of the buildings and the streets of\n * `vectors()` lit, the labels light on dark. By default from the sun's altitude: falling from 6° above the horizon\n * to 6° under it */\n night?: number;\n}\n\n/** What can be seen from a point (`GeoMap.setViewshed`); with several observers, the colors, the opacity and the\n * cone's color are the first one's */\nexport interface ViewshedOptions {\n /** The observer */\n position: LonLat;\n /** Metres above the ground (default 1.7, eye level) */\n height?: number;\n /** Metres around the observer that are tinted (default 1000) */\n range?: number;\n /** A CSS color for what is seen (default `#2f9e44`) */\n visibleColor?: string;\n /** A CSS color for what is hidden (default `#e03131`) */\n hiddenColor?: string;\n /** How strongly the colors tint the scene, multiplied into it so that its textures and shading stay, 0-1 (default\n * 0.7) */\n opacity?: number;\n /** A CSS color for the cone drawn in 3D (one way only): its fan through the axis, at the eye's height and tilted\n * with it, from the eye to the range; solid where nothing hides it, faint behind the scene; none by default */\n coneColor?: string;\n /** To look one way only (a camera, a lookout), degrees clockwise from north; all around without it */\n direction?: number;\n /** Degrees above the horizon the cone looks, negative below (default 0) */\n tilt?: number;\n /** Angle of view across, degrees (default 60) */\n fov?: number;\n /** Angle of view up and down, degrees (default 40) */\n verticalFov?: number;\n}\n\n/** An eye at street level (`GeoMap.setFirstPerson`) */\nexport interface FirstPersonView {\n /** Where it stands */\n lonLat: LonLat;\n /** Metres above the ground (default 1.7) */\n height?: number;\n /** Degrees clockwise from north it looks to */\n bearing: number;\n /** Degrees from straight down: 90 level (the default), 180 straight up */\n pitch?: number;\n /** Vertical field of view, degrees (default 75) */\n fov?: number;\n}\n\n/** Layers shown on one side of a vertical line only (`GeoMap.setSwipe`) */\nexport interface SwipeOptions {\n /** CSS pixels from the left of the map */\n position: number;\n layers: readonly Layer[];\n /** The side they show on (default 'left') */\n side?: 'left' | 'right';\n /** Layers shown on the other side only: two meshes of the same place, each on its side, never drawn over each other */\n other?: readonly Layer[];\n}\n\n/** Animation of a camera move */\nexport interface AnimationOptions {\n /** Milliseconds */\n duration?: number;\n /** Progress over time, both 0 to 1 */\n easing?: (t: number) => number;\n}\n\nexport interface FlyToOptions extends AnimationOptions {\n /** How far the flight zooms out on its way, as MapLibre's `curve` (default 1.42) */\n curve?: number;\n /** Average speed in screens per second when `duration` is not given (default 1.2) */\n speed?: number;\n}\n\n/**\n * Tile grid of a raster's URL. 'mercator': Web Mercator (XYZ, WMTS PM), the engine's own. 'equirectangular':\n * longitudes and latitudes (Plate Carrée, EPSG:4326-like), two 256 px tiles side by side at level 0, rows from the\n * north (NASA's Trek WMTS, WorldCRS84Quad). A `TileGrid`: the tile matrices of a WMTS in any CRS (Lambert-93…), or a\n * WMS asked for each tile's box in its CRS. The last two are reprojected into Web Mercator tiles by the map's workers\n * (in the page with `workers: false`).\n */\nexport type RasterGrid = 'mercator' | 'equirectangular' | TileGrid;\n\n/** The GPU memory of a map's layers (`GeoMap.memory`), bytes */\nexport interface MapMemory {\n /** What they may hold (`GeoMapOptions.memory`) */\n budget: number;\n /** What they hold: the tiles of the 3D Tiles and point clouds, the pools of the rasters' tiles (the relief's\n * included), each one's full from its creation */\n held: number;\n /** Each layer's, bottom first */\n layers: { layer: Layer; bytes: number }[];\n}\n\n/** What `RasterLayer.setStyle` changes */\nexport interface RasterStyle {\n opacity: number;\n /** 0 = greyscale, 1 = original colors */\n saturation: number;\n}\n\n/** Where a new layer goes: under `before`, or on top of the others (under the labels kept on top) */\nexport interface Placement {\n before?: Layer;\n}\n\nexport interface RasterOptions extends Placement {\n /** Tile URL with {z}, {x} and {y} (256 px tiles); unused with a `loader` */\n url: string;\n /** Tile grid of `url` (default 'mercator'); with 'equirectangular', `minZoom` and `maxZoom` are levels of that\n * grid; with a `TileGrid`, they are map zooms, by default those its matrices span */\n grid?: RasterGrid;\n minZoom?: number;\n maxZoom?: number;\n opacity?: number;\n /** 0 = greyscale, 1 = original colors */\n saturation?: number;\n /** Side of the tiles' textures, pixels (default 256): more for sharper tiles drawn by a `loader` */\n size?: number;\n /** Draws each tile instead of fetching `url`: an image of `size` × `size`, null for nothing there; a rejection is\n * retried like a network error */\n loader?: (z: number, x: number, y: number, signal: AbortSignal) => Promise<ImageBitmap | null>;\n /** Credits of the tiles, HTML: shown by the attribution control while the layer is on the map */\n attribution?: string;\n /** Drawn on the ground (default true); false: only on the 3D layers it is draped on (`Tiles3dOptions.drape`), its\n * tiles still loaded as the ground's would be: a solar potential on the roofs only */\n ground?: boolean;\n}\n\nexport interface NetworkStyle {\n /** Line width, CSS pixels, or zoom stops `[[zoom, width], …]` (default 2) */\n width: Size;\n /** Values above are drawn as unreached (default 1800) */\n max: number;\n /** Darker line every `contour` value units, 0 for none (default 0) */\n contour: number;\n opacity: number;\n /** Width of the halo drawn under the lines, CSS pixels or zoom stops, 0 for none (default 0): wide and faint, the\n * reached streets add up into a heat map that fills the blocks */\n halo: Size;\n /** Opacity of the halo at the middle of a line, fading quadratically to its sides (default 0.11) */\n haloOpacity: number;\n /** Colors from 0 to `max`: `[[fraction of max, color], …]` (default green to red) */\n ramp: Ramp | undefined;\n /** Color of the parts beyond `max` or unreached (default `rgba(140, 140, 140, 0.25)`) */\n unreachedColor: string;\n /** Share of `max` over which the colors fade out before it, 0 to 1 (default 0) */\n fade: number;\n}\n\nexport interface NetworkOptions extends Partial<NetworkStyle>, Placement {\n /** Node coordinates in degrees: lon0, lat0, lon1, lat1… */\n nodes: Float64Array;\n /** Edges as node index pairs: a0, b0, a1, b1… */\n edges: Uint32Array;\n /** Line of each edge, from A to B: the points of edge e are `points[start[e] .. start[e + 1]]` (lon, lat pairs,\n * counted in points); with fewer than two points an edge is straight. Default: all straight. */\n lines?: { start: Uint32Array; points: Float64Array };\n /** Per edge, the cost of travelling it from A to B then from B to A, in value units (Infinity: closed that way;\n * closed both ways: not drawn). A point along an edge then takes the quickest way there, min(value(A) + cost from\n * A, value(B) + cost from B), as a travel time does. Without costs, values are interpolated along the edges. */\n costs?: Float32Array;\n /** Width factor of each edge (default 1): rail lines wider than streets */\n edgeWidths?: Float32Array;\n}\n\nexport interface Tiles3dStyle {\n /** Screen-space error (CSS pixels) above which a tile is refined: 16 by default, lower is finer and heavier */\n maxScreenSpaceError: number;\n opacity: number;\n /** Size of the points of point cloud tiles (`.pnts`, glTF points), CSS pixels: 2 by default */\n pointSize?: number;\n /** A CSS color multiplying the textures of the meshes, the color of the untextured ones (buildings without\n * textures are light grey without it); none by default */\n color?: string;\n /** Each feature's color from its properties (a building's height, its use: a thematic map), in place of `color`: a\n * CSS color, or undefined for the layer's. Asked once for each feature of a tile, when the tile is first drawn, and\n * again for every tile when it changes (in React, keep the same function from one render to the next) */\n featureColor?: FeatureColor | undefined;\n}\n\n/** A feature's color from its properties and its index in its tile (`Tiles3dStyle.featureColor`) */\nexport type FeatureColor = (properties: Record<string, unknown>, feature: number) => string | undefined;\n\nexport interface Tiles3dOptions extends Partial<Tiles3dStyle>, Placement {\n /** URL of a `tileset.json` (3D Tiles 1.0 b3dm and pnts, 1.1 glb meshes and points, external tilesets) */\n url: string;\n /** Its heights are altitudes above the geoid (NGF-IGN69), as the IGN's Bâtiments 3D, rather than above the\n * ellipsoid (3D Tiles as specified): each tile raised by the RAF20 geoid, onto the IGN relief (default false) */\n geoid?: boolean;\n /** The walls of its untextured meshes show windows: glass by day, some lit at night (`setFacades`; default false) */\n facades?: boolean;\n /** A raster layer draped on its meshes (`setDrape`): an ortho or a solar potential on the roofs */\n drape?: Drape | undefined;\n}\n\n/** A raster layer draped on a 3D layer's faces (3D Tiles, extrusions, a vector tiles layer's buildings, models), as\n * Cesium's imagery on 3D Tiles: each point of a face takes the raster's color where it stands (its longitude and\n * latitude, whatever its height) */\nexport interface Drape {\n /** The raster layer, on the same map (with `ground: false`, on the 3D layers only) */\n raster: RasterLayer;\n /** 'up': the faces looking up, the roofs (default); 'all': the walls too, the raster stretched down them */\n faces?: 'up' | 'all';\n /** 0 to 1 (default 1), times the raster layer's opacity */\n opacity?: number;\n}\n\nexport interface MapPointerEvent {\n point: Point;\n /** Undefined above the horizon */\n lonLat: LonLat | undefined;\n}\n\n/** What 'hoverfeature' found under the pointer */\nexport interface MapHoverFeatureEvent extends MapPointerEvent {\n /** The feature under the pointer (see `GeoMap.pickFeature`), undefined if none */\n hit: FeatureHit | undefined;\n}\n\n/** The GPU time of a frame (`GeoMap.gpuTimings`), in all and by part (ms) */\nexport interface MapGpuTimings {\n /** The frame's number */\n frame: number;\n ms: number;\n /** The backdrop (sky, globe), the ground (the raster layers over the relief), each layer (with its handle), the\n * shadows, the panorama, the viewshed */\n parts: { part: 'backdrop' | 'ground' | 'layer' | 'shadows' | 'panorama' | 'viewshed'; layer?: Layer; ms: number }[];\n}\n\n/** What a pick looks at: within `radius` CSS pixels of the point (default 0), among `layers` (default every layer;\n * the others hide nothing) */\nexport interface PickOptions {\n radius?: number;\n layers?: readonly Layer[];\n}\n\n/** A picked feature: its layer handle, its index there and, for line, circle, fill, extrusion, point cloud and 3D\n * Tiles layers, the feature itself (a building of 3D Tiles with its properties) */\nexport interface FeatureHit {\n layer: Layer;\n index: number;\n feature: Feature | undefined;\n}\n\nexport interface MapEvents {\n /** The camera started moving (a gesture, an animation or `setCamera`) */\n movestart: Camera;\n /** The camera moved */\n move: Camera;\n /** The camera stopped: no gesture held, no animation running */\n moveend: Camera;\n /** The map changed size (CSS pixels) */\n resize: { width: number; height: number };\n /** The pointer moved over the map (at most once per frame, not while dragging) */\n hover: MapPointerEvent;\n /** What is under the pointer, picked without stalling the GPU: a frame or two after 'hover', only while listened to\n * (radius and layers in `GeoMap.hoverPicking`) */\n hoverfeature: MapHoverFeatureEvent;\n /** Click without drag */\n click: MapPointerEvent;\n /** A frame was drawn; duration of the engine call in milliseconds */\n render: { ms: number };\n /** The map's quality changed, by `setQuality` or stepped down by `'auto'` */\n quality: { quality: Quality };\n /** Everything in view is loaded and drawn, nothing moves: the end of a load, once after each change (as MapLibre's\n * `idle`). Tiles requested by the first frame count, so it never fires before they arrive. */\n idle: Record<string, never>;\n /** The pointer left the canvas (a mouse going out of the map, or onto a control or marker) */\n leave: Record<string, never>;\n}\n\n/** What a layer handle needs from its map */\nexport interface LayerHost {\n readonly engine: Engine;\n requestRender(): void;\n /** Forgets a removed layer */\n detach(layer: Layer): void;\n /** Moves a layer under `before`, or on top */\n moveLayer(layer: Layer, before: Layer | undefined): void;\n /** A layer created again in the engine (new id): put at the place of its old id, which is removed */\n replaceLayer(layer: Layer, old: number): void;\n /** Resolves once the map is idle (everything in view loaded and drawn) */\n whenIdle(): Promise<void>;\n /** Work the map waits on before it is idle (`GeoMap.track`) */\n track<T>(work: Promise<T>): Promise<T>;\n /** What its quality draws (`GeoMap.setQuality`) */\n readonly quality: QualitySettings;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,0CAA0C","sourcesContent":["/** Public types of the `isard` package */\n\nimport type { TileGrid } from './basemap/grid.ts';\nimport type { DecoderUrls } from './decoding/decoders.ts';\nimport type { Feature, Ramp, Size } from './layers/features.ts';\nimport type { Layer } from './layers/layers.ts';\nimport type { RasterLayer } from './layers/raster.ts';\nimport type { QualitySettings } from './map/quality.ts';\nimport type { AttributionOptions } from './ui/controls.ts';\nimport type { Camera, Engine } from './wasm/isard_webgpu.js';\n\nexport type LonLat = [lon: number, lat: number];\nexport type Point = [x: number, y: number];\n\n/**\n * The named basemaps. OpenFreeMap's vector styles, OpenStreetMap data worldwide, their labels above the other layers:\n * `osm-positron` (light grey, quiet: data over it reads first), `osm-liberty` and `osm-bright` (in colour), `osm-dark`\n * (near black: bright data over it, a wind's particles, lights). The\n * Géoplateforme's (IGN, France): rasters (`ign-plan`, `ign-plan-grey`, `ign-ortho`, the aerial photographs) or vector\n * tiles with their labels (`ign-plan-vector`, `ign-plan-grey-vector`, the PLAN.IGN styles).\n */\nexport type BasemapName =\n | 'osm-positron'\n | 'osm-liberty'\n | 'osm-bright'\n | 'osm-dark'\n | 'ign-plan'\n | 'ign-plan-grey'\n | 'ign-ortho'\n | 'ign-plan-vector'\n | 'ign-plan-grey-vector'\n | 'none';\n\n/** A basemap by name (see `BasemapName`) */\nexport type Basemap = BasemapName;\n\n/**\n * The Earth's named terrain models. `'terrain-tiles'`: worldwide, the Terrain Tiles of AWS's open data registry\n * (SRTM, EU-DEM, GMTED… merged by Mapzen, 30 m in most places), the sea floor flattened at sea level. `'ign'`: France,\n * the IGN's RGE ALTI from the Géoplateforme (1 to 5 m), raised by the RAF20 geoid to heights above the ellipsoid.\n */\nexport type TerrainModel = 'terrain-tiles' | 'ign';\n\n/** How tiles encode their altitudes: `'float32'`, raw little-endian floats (`image/x-bil;bits=32`, an ArcGIS raw\n * grid); `'terrarium'`, the colors of a PNG, `R × 256 + G + B / 256 - 32768`; `'mapbox'`, those of Terrain-RGB,\n * `(R × 65536 + G × 256 + B) / 10 - 10000` */\nexport type TerrainEncoding = 'float32' | 'terrarium' | 'mapbox';\n\n/**\n * How tiles load and show. 'immediate' (default): everything visible loads, tiles show as soon as they arrive.\n * 'smooth': during flights the levels flown through are skipped, off-center tiles wait while the camera moves, tiles\n * fade in; fewer downloads, for slow networks or GPUs.\n */\nexport type LoadingMode = 'immediate' | 'smooth';\n\n/** 'globe': a sphere at low zoom, blending into Web Mercator between zooms 5 and 7, up to three levels later under a\n * tilted camera (it sees much farther than its center: the horizon stays curved) */\nexport type Projection = 'globe' | 'mercator';\n\n/** A body to draw the map on, other than the named ones (`CelestialBody`) */\nexport interface BodyOptions {\n /** Equatorial radius, metres */\n radius: number;\n /** Flattening of its ellipsoid, 0 for a sphere (default 0) */\n flattening?: number;\n /** An atmosphere: its halo around the globe, true for the Earth's light blue, or a CSS color (its alpha the\n * halo's strength) (default false) */\n atmosphere?: boolean | string;\n /** Color of the globe where no tile covers it (past the Web Mercator latitudes, 85°), a CSS color (default\n * `#808080`) */\n color?: string;\n /** Lowest and highest altitudes of its ground, metres around the ellipsoid: what its relief may raise into view\n * (default ±1 % of the radius) */\n relief?: [lowest: number, highest: number];\n}\n\n/**\n * The body the map is drawn on: 'earth' (WGS 84, the default), 'moon' (a sphere of 1 737 400 m, no atmosphere),\n * 'mars' (a sphere of 3 396 190 m, its equatorial radius, a thin dusty halo; planetocentric latitudes) or another\n * one. Zoom levels keep their meaning on screen (the Web Mercator tile pyramid), their metres follow the body:\n * altitudes, relief, buildings, 3D Tiles. Off the Earth, the map has none of the Earth's defaults: no basemap, no\n * credits, and space for its background; the Moon and Mars have NASA's relief for `terrain: true`.\n */\nexport type CelestialBody = 'earth' | 'moon' | 'mars' | BodyOptions;\n\n/** A level of the map's quality (`GeoMapOptions.quality`) */\nexport type Quality = 'high' | 'medium' | 'low';\n\nexport interface GeoMapOptions extends Partial<Camera> {\n /** The body the map is drawn on (default 'earth'); set at creation */\n body?: CelestialBody;\n /** Default 'globe' */\n projection?: Projection;\n /** Default 'immediate' */\n loading?: LoadingMode;\n /** The basemap (default 'osm-positron'; 'none' off the Earth) */\n basemap?: Basemap;\n /** Opacity of the IGN hillshade over the basemap (France, Géoplateforme), 0 for none (default 0) */\n hillshade?: number;\n /** Color behind the map (sky of tilted flat views), a CSS color (default `#f2f2f0`; black off the Earth) */\n background?: string;\n /** Space behind the globe: stars and atmosphere halo, fading out as the globe turns flat (default true) */\n sky?: boolean;\n /** The sun casting the shadows of buildings, trees, models and the relief (`setSun`); none by default */\n sun?: SunOptions;\n /** What the map draws less of on a device that cannot keep up (`setQuality`): `'high'` (the default) all of it;\n * `'medium'` at most 1.5 device pixels a CSS pixel, the 3D Tiles coarser far away; `'low'` one device pixel a CSS\n * pixel, no sun's shadows, the 3D Tiles coarser still; `'auto'` high, a level lower each time the frames stay slow\n * while the map moves (`'quality'` event) */\n quality?: Quality | 'auto';\n /** The GPU memory, megabytes, the layers' tiles (3D Tiles, point clouds, vector tiles) and the rasters' tiles may\n * hold all together: past it the tiles drawn least recently are unloaded, whichever their layer, the vector tiles\n * (those of the view) kept (`GeoMap.memory`). `'auto'` (the default): 256 on a touch screen (a phone, a tablet: iOS\n * closes a page past about a gigabyte, the page's workers included), 1024 elsewhere. Set at creation */\n memory?: number | 'auto';\n /** Multisampled antialiasing of the canvas (default true): the edges of the buildings, 3D Tiles and models smooth.\n * False draws each pixel once (lines and halos antialias themselves): wide translucent layers, a network's halo over\n * a region, cost up to four times less on an integrated GPU (MapLibre's default). Set at creation */\n antialias?: boolean;\n /** The engine on wgpu (#146): 'auto' (default) WebGPU where the browser gives an adapter, else wgpu's WebGL2 fallback;\n * 'webgpu' or 'webgl' forces one */\n renderer?: 'auto' | 'webgpu' | 'webgl2';\n /** Relief under the basemap: true for the body's terrain model (on the Earth the worldwide Terrain Tiles; NASA's on\n * the Moon and Mars: LOLA, MOLA), one of the Earth's models by name (`'ign'`: France, RGE ALTI), or its options\n * (default false; on another body, its `url` is required). Network layers are draped on it */\n terrain?: boolean | TerrainModel | TerrainOptions;\n minZoom?: number;\n maxZoom?: number;\n /** Highest pitch, degrees, up to 85 (default 70) */\n maxPitch?: number;\n /** Sky over the plane, seen when the camera is tilted towards the horizon, and the fog the ground fades into\n * (MapLibre's `setSky`); default none: the background color */\n atmosphere?: AtmosphereOptions;\n /** Mouse, touch and keyboard controls (default true) */\n interactive?: boolean;\n /** Keyboard controls once the map has the focus (it is reached with Tab): arrows pan, Shift + arrows rotate and\n * tilt, + and - zoom (Shift: two levels), 0 faces north and levels the view (default true; none when not\n * `interactive`) */\n keyboard?: boolean;\n /** Accessible name of the map, read by screen readers (default 'Map') */\n ariaLabel?: string;\n /** A preset of map options (`IGN_PRESETS`: `'ign'`, `'ign-3d'`, `'ign-ortho-3d'`), the other options over it */\n preset?: 'ign' | 'ign-3d' | 'ign-ortho-3d';\n /** The folder isard's files are served from (its engines, `isard_webgpu_bg.wasm`, `isard_webgl2_bg.wasm`, its\n * modules, `isard_points_bg.wasm`, `isard_tiles3d_bg.wasm`, `isard_tess_bg.wasm`, `isard_grid_bg.wasm`, and its\n * workers, `decoder.worker.js`, `basemap.worker.js`): one option for a bundler that moves them, the `…Url` options\n * below for each one. `isard/vite` sets it for the whole page; default next to the module */\n assetsUrl?: string | URL;\n /** Where to load the engine on WebGPU from (`isard_webgpu_bg.wasm`), when a bundler does not resolve the default URL */\n webgpuWasmUrl?: string | URL;\n /** Where to load the engine's WebGL2 fallback from (`isard_webgl2_bg.wasm`, for a browser without WebGPU), when a\n * bundler does not resolve the default URL */\n webgl2WasmUrl?: string | URL;\n /** Where the decoding workers load the point cloud module from (`isard_points_bg.wasm`, the LAZ decoder of COPC),\n * when a bundler does not resolve the default URL. Loaded with the first point cloud only */\n pointsWasmUrl?: string | URL;\n /** Where the decoding workers load the 3D Tiles module from (`isard_tiles3d_bg.wasm`: a tile's content decoded for\n * the GPU), when a bundler does not resolve the default URL. Loaded with the first tile */\n tiles3dWasmUrl?: string | URL;\n /** Where the basemap workers load the tessellation module from (`isard_tess_bg.wasm`: the vector tiles drawn as\n * geometry, `vectorTiles().vectors()`, made ready for the GPU off the main thread), when a bundler does not resolve\n * the default URL. Loaded with the first tile of geometry; without it, the main thread does that work */\n tessWasmUrl?: string | URL;\n /** Where the workers load the grid module from (`isard_grid_bg.wasm`: GRIB2 and NetCDF files read by\n * `map.readGrids`), when a bundler does not resolve the default URL. Loaded with the first file */\n gridWasmUrl?: string | URL;\n /** Where to load the vector basemap worker from, when a bundler does not resolve the default URL */\n basemapWorkerUrl?: string | URL;\n /** Texture size of the vector basemap's tiles, pixels (default 512: lines and edges sharp at every zoom on a screen\n * of pixel ratio 1). 256: a quarter of the drawing in the workers, of the uploads and of the GPU memory, for lines\n * and edges a little softer between two zoom levels (the tiles are shown 181 to 362 CSS pixels wide) */\n basemapTileSize?: number;\n /** Glyphs of the symbol layers: a URL with `{fontstack}` and `{range}` (MapLibre's glyph format; default\n * OpenFreeMap's fonts, Noto Sans). A vector basemap's labels take the glyphs of its style */\n glyphs?: string;\n /** Workers decoding 3D Tiles off the main thread: a count, or false to decode on the main thread (default: cores - 1,\n * 1 to 4). False (or 0) also decodes the PNG relief and reprojects the equirectangular rasters on the main thread,\n * else done by the vector basemap's workers */\n workers?: number | false;\n /** Where to load the decoding worker from, when a bundler does not resolve the default URL */\n workerUrl?: string | URL;\n /** Folders of the Draco and Basis Universal decoders, loaded by the workers on first use (default: the official\n * builds on gstatic.com and jsDelivr; self-host them for offline or locked-down networks). They run through\n * `new Function`: a Content Security Policy needs `'unsafe-eval'` (see `DecoderUrls`) */\n decoders?: Partial<DecoderUrls>;\n /** Credits at the bottom right: false for none, or its options (default true: the credits of the basemap,\n * hillshade and relief in use, compact on maps narrower than 640 px) */\n attributionControl?: boolean | AttributionOptions;\n}\n\nexport interface TerrainOptions {\n /** One of the Earth's named models (default `'terrain-tiles'` on the Earth); unused with a `url` */\n model?: TerrainModel;\n /** Altitudes of 256 × 256 tiles in `encoding`: a WMS GetMap URL with {bbox} (EPSG:3857 on the Earth, the body's\n * Mercator metres elsewhere: the sphere of its radius), a tile URL with {z}, {x} and {y}, or an ArcGIS image service\n * (a URL ending in `/ImageServer`), asked for raw altitudes in the body's Mercator (default: the `model`'s; on the\n * Moon and Mars, NASA's Trek LOLA and MOLA models) */\n url?: string;\n /** How the tiles of `url` encode their altitudes (default `'float32'`); `'terrarium'` and `'mapbox'` take a URL with\n * {z}, {x} and {y} */\n encoding?: TerrainEncoding;\n /** Vertical exaggeration, 1 for the true relief (default 1) */\n exaggeration?: number;\n /** Finest level of the relief, up to 15 (default 15; 14 for the Terrain Tiles, 8 for the Moon's and Mars's models). It\n * starts at level 6 on the Earth, coarser on bodies of a larger relief for their size (3 on the Moon and Mars) */\n maxZoom?: number;\n /** Altitudes over mainland France raised by the height of the RAF20 geoid (the French one, 0 away from France), to\n * heights above the ellipsoid (those of 3D Tiles); false keeps the altitudes as served (NGF-IGN69 for the IGN's)\n * (default true for the `'ign'` model, false otherwise) */\n geoid?: boolean;\n}\n\n/** Sky, horizon and fog over the plane, with the names and meanings of MapLibre's `setSky` */\nexport interface AtmosphereOptions {\n /** A CSS color (default `#9cc7ec`) */\n skyColor?: string;\n /** (default `#e8f1f8`) */\n horizonColor?: string;\n /** (default `#f2f5f8`) */\n fogColor?: string;\n /** Blend from the horizon to the sky color, share of the field of view above the horizon, 0-1 (default 0.6) */\n skyHorizonBlend?: number;\n /** Blend from the horizon to the fog color below the horizon, 0-1 (default 0.7) */\n horizonFogBlend?: number;\n /** Share of the distance to the far plane over which the ground fades into the fog, 0-1 (default 0.4) */\n fogGroundBlend?: number;\n}\n\n/** The sun casting shadows (`GeoMap.setSun`): where it stands, by date or by hand, and how dark its shadows are */\nexport interface SunOptions {\n /** The time: the sun where it stands then over the map's center (default now, unless `azimuth` and `altitude`) */\n date?: Date;\n /** Degrees clockwise from north, with `altitude`: the sun placed by hand */\n azimuth?: number;\n /** Degrees above the horizon; at or under it, no shadows */\n altitude?: number;\n /** How dark the shadows are, 0 to 1 (default 0.35) */\n opacity?: number;\n /** How dark the night is, 0 to 1: the scene tinted in its blue, the windows of the buildings and the streets of\n * `vectors()` lit, the labels light on dark. By default from the sun's altitude: falling from 6° above the horizon\n * to 6° under it */\n night?: number;\n}\n\n/** What can be seen from a point (`GeoMap.setViewshed`); with several observers, the colors, the opacity and the\n * cone's color are the first one's */\nexport interface ViewshedOptions {\n /** The observer */\n position: LonLat;\n /** Metres above the ground (default 1.7, eye level) */\n height?: number;\n /** Metres around the observer that are tinted (default 1000) */\n range?: number;\n /** A CSS color for what is seen (default `#2f9e44`) */\n visibleColor?: string;\n /** A CSS color for what is hidden (default `#e03131`) */\n hiddenColor?: string;\n /** How strongly the colors tint the scene, multiplied into it so that its textures and shading stay, 0-1 (default\n * 0.7) */\n opacity?: number;\n /** A CSS color for the cone drawn in 3D (one way only): its fan through the axis, at the eye's height and tilted\n * with it, from the eye to the range; solid where nothing hides it, faint behind the scene; none by default */\n coneColor?: string;\n /** To look one way only (a camera, a lookout), degrees clockwise from north; all around without it */\n direction?: number;\n /** Degrees above the horizon the cone looks, negative below (default 0) */\n tilt?: number;\n /** Angle of view across, degrees (default 60) */\n fov?: number;\n /** Angle of view up and down, degrees (default 40) */\n verticalFov?: number;\n}\n\n/** An eye at street level (`GeoMap.setFirstPerson`) */\nexport interface FirstPersonView {\n /** Where it stands */\n lonLat: LonLat;\n /** Metres above the ground (default 1.7) */\n height?: number;\n /** Degrees clockwise from north it looks to */\n bearing: number;\n /** Degrees from straight down: 90 level (the default), 180 straight up */\n pitch?: number;\n /** Vertical field of view, degrees (default 75) */\n fov?: number;\n}\n\n/** Layers shown on one side of a vertical line only (`GeoMap.setSwipe`) */\nexport interface SwipeOptions {\n /** CSS pixels from the left of the map */\n position: number;\n layers: readonly Layer[];\n /** The side they show on (default 'left') */\n side?: 'left' | 'right';\n /** Layers shown on the other side only: two meshes of the same place, each on its side, never drawn over each other */\n other?: readonly Layer[];\n}\n\n/** Animation of a camera move */\nexport interface AnimationOptions {\n /** Milliseconds */\n duration?: number;\n /** Progress over time, both 0 to 1 */\n easing?: (t: number) => number;\n}\n\nexport interface FlyToOptions extends AnimationOptions {\n /** How far the flight zooms out on its way, as MapLibre's `curve` (default 1.42) */\n curve?: number;\n /** Average speed in screens per second when `duration` is not given (default 1.2) */\n speed?: number;\n}\n\n/**\n * Tile grid of a raster's URL. 'mercator': Web Mercator (XYZ, WMTS PM), the engine's own. 'equirectangular':\n * longitudes and latitudes (Plate Carrée, EPSG:4326-like), two 256 px tiles side by side at level 0, rows from the\n * north (NASA's Trek WMTS, WorldCRS84Quad). A `TileGrid`: the tile matrices of a WMTS in any CRS (Lambert-93…), or a\n * WMS asked for each tile's box in its CRS. The last two are reprojected into Web Mercator tiles by the map's workers\n * (in the page with `workers: false`).\n */\nexport type RasterGrid = 'mercator' | 'equirectangular' | TileGrid;\n\n/** The GPU memory of a map's layers (`GeoMap.memory`), bytes */\nexport interface MapMemory {\n /** What they may hold (`GeoMapOptions.memory`) */\n budget: number;\n /** What they hold: the tiles of the 3D Tiles, point clouds and vector tiles, the pools of the rasters' tiles (the\n * relief's included), each one's full from its creation */\n held: number;\n /** Each layer's, bottom first */\n layers: { layer: Layer; bytes: number }[];\n}\n\n/** What `RasterLayer.setStyle` changes */\nexport interface RasterStyle {\n opacity: number;\n /** 0 = greyscale, 1 = original colors */\n saturation: number;\n}\n\n/** Where a new layer goes: under `before`, or on top of the others (under the labels kept on top) */\nexport interface Placement {\n before?: Layer;\n}\n\nexport interface RasterOptions extends Placement {\n /** Tile URL with {z}, {x} and {y} (256 px tiles); unused with a `loader` */\n url: string;\n /** Tile grid of `url` (default 'mercator'); with 'equirectangular', `minZoom` and `maxZoom` are levels of that\n * grid; with a `TileGrid`, they are map zooms, by default those its matrices span */\n grid?: RasterGrid;\n minZoom?: number;\n maxZoom?: number;\n opacity?: number;\n /** 0 = greyscale, 1 = original colors */\n saturation?: number;\n /** Side of the tiles' textures, pixels (default 256): more for sharper tiles drawn by a `loader` */\n size?: number;\n /** Draws each tile instead of fetching `url`: an image of `size` × `size`, null for nothing there; a rejection is\n * retried like a network error */\n loader?: (z: number, x: number, y: number, signal: AbortSignal) => Promise<ImageBitmap | null>;\n /** Credits of the tiles, HTML: shown by the attribution control while the layer is on the map */\n attribution?: string;\n /** Drawn on the ground (default true); false: only on the 3D layers it is draped on (`Tiles3dOptions.drape`), its\n * tiles still loaded as the ground's would be: a solar potential on the roofs only */\n ground?: boolean;\n}\n\nexport interface NetworkStyle {\n /** Line width, CSS pixels, or zoom stops `[[zoom, width], …]` (default 2) */\n width: Size;\n /** Values above are drawn as unreached (default 1800) */\n max: number;\n /** Darker line every `contour` value units, 0 for none (default 0) */\n contour: number;\n opacity: number;\n /** Width of the halo drawn under the lines, CSS pixels or zoom stops, 0 for none (default 0): wide and faint, the\n * reached streets add up into a heat map that fills the blocks */\n halo: Size;\n /** Opacity of the halo at the middle of a line, fading quadratically to its sides (default 0.11) */\n haloOpacity: number;\n /** Colors from 0 to `max`: `[[fraction of max, color], …]` (default green to red) */\n ramp: Ramp | undefined;\n /** Color of the parts beyond `max` or unreached (default `rgba(140, 140, 140, 0.25)`) */\n unreachedColor: string;\n /** Share of `max` over which the colors fade out before it, 0 to 1 (default 0) */\n fade: number;\n}\n\nexport interface NetworkOptions extends Partial<NetworkStyle>, Placement {\n /** Node coordinates in degrees: lon0, lat0, lon1, lat1… */\n nodes: Float64Array;\n /** Edges as node index pairs: a0, b0, a1, b1… */\n edges: Uint32Array;\n /** Line of each edge, from A to B: the points of edge e are `points[start[e] .. start[e + 1]]` (lon, lat pairs,\n * counted in points); with fewer than two points an edge is straight. Default: all straight. */\n lines?: { start: Uint32Array; points: Float64Array };\n /** Per edge, the cost of travelling it from A to B then from B to A, in value units (Infinity: closed that way;\n * closed both ways: not drawn). A point along an edge then takes the quickest way there, min(value(A) + cost from\n * A, value(B) + cost from B), as a travel time does. Without costs, values are interpolated along the edges. */\n costs?: Float32Array;\n /** Width factor of each edge (default 1): rail lines wider than streets */\n edgeWidths?: Float32Array;\n}\n\nexport interface Tiles3dStyle {\n /** Screen-space error (CSS pixels) above which a tile is refined: 16 by default, lower is finer and heavier */\n maxScreenSpaceError: number;\n opacity: number;\n /** Size of the points of point cloud tiles (`.pnts`, glTF points), CSS pixels: 2 by default */\n pointSize?: number;\n /** A CSS color multiplying the textures of the meshes, the color of the untextured ones (buildings without\n * textures are light grey without it); none by default */\n color?: string;\n /** Each feature's color from its properties (a building's height, its use: a thematic map), in place of `color`: a\n * CSS color, or undefined for the layer's. Asked once for each feature of a tile, when the tile is first drawn, and\n * again for every tile when it changes (in React, keep the same function from one render to the next) */\n featureColor?: FeatureColor | undefined;\n}\n\n/** A feature's color from its properties and its index in its tile (`Tiles3dStyle.featureColor`) */\nexport type FeatureColor = (properties: Record<string, unknown>, feature: number) => string | undefined;\n\nexport interface Tiles3dOptions extends Partial<Tiles3dStyle>, Placement {\n /** URL of a `tileset.json` (3D Tiles 1.0 b3dm and pnts, 1.1 glb meshes and points, external tilesets) */\n url: string;\n /** Its heights are altitudes above the geoid (NGF-IGN69), as the IGN's Bâtiments 3D, rather than above the\n * ellipsoid (3D Tiles as specified): each tile raised by the RAF20 geoid, onto the IGN relief (default false) */\n geoid?: boolean;\n /** The walls of its untextured meshes show windows: glass by day, some lit at night (`setFacades`; default false) */\n facades?: boolean;\n /** A raster layer draped on its meshes (`setDrape`): an ortho or a solar potential on the roofs */\n drape?: Drape | undefined;\n}\n\n/** A raster layer draped on a 3D layer's faces (3D Tiles, extrusions, a vector tiles layer's buildings, models), as\n * Cesium's imagery on 3D Tiles: each point of a face takes the raster's color where it stands (its longitude and\n * latitude, whatever its height) */\nexport interface Drape {\n /** The raster layer, on the same map (with `ground: false`, on the 3D layers only) */\n raster: RasterLayer;\n /** 'up': the faces looking up, the roofs (default); 'all': the walls too, the raster stretched down them */\n faces?: 'up' | 'all';\n /** 0 to 1 (default 1), times the raster layer's opacity */\n opacity?: number;\n}\n\nexport interface MapPointerEvent {\n point: Point;\n /** Undefined above the horizon */\n lonLat: LonLat | undefined;\n}\n\n/** What 'hoverfeature' found under the pointer */\nexport interface MapHoverFeatureEvent extends MapPointerEvent {\n /** The feature under the pointer (see `GeoMap.pickFeature`), undefined if none */\n hit: FeatureHit | undefined;\n}\n\n/** The GPU time of a frame (`GeoMap.gpuTimings`), in all and by part (ms) */\nexport interface MapGpuTimings {\n /** The frame's number */\n frame: number;\n ms: number;\n /** The backdrop (sky, globe), the ground (the raster layers over the relief), each layer (with its handle), the\n * shadows, the panorama, the viewshed */\n parts: { part: 'backdrop' | 'ground' | 'layer' | 'shadows' | 'panorama' | 'viewshed'; layer?: Layer; ms: number }[];\n}\n\n/** What a pick looks at: within `radius` CSS pixels of the point (default 0), among `layers` (default every layer;\n * the others hide nothing) */\nexport interface PickOptions {\n radius?: number;\n layers?: readonly Layer[];\n}\n\n/** A picked feature: its layer handle, its index there and, for line, circle, fill, extrusion, point cloud and 3D\n * Tiles layers, the feature itself (a building of 3D Tiles with its properties) */\nexport interface FeatureHit {\n layer: Layer;\n index: number;\n feature: Feature | undefined;\n}\n\nexport interface MapEvents {\n /** The camera started moving (a gesture, an animation or `setCamera`) */\n movestart: Camera;\n /** The camera moved */\n move: Camera;\n /** The camera stopped: no gesture held, no animation running */\n moveend: Camera;\n /** The map changed size (CSS pixels) */\n resize: { width: number; height: number };\n /** The pointer moved over the map (at most once per frame, not while dragging) */\n hover: MapPointerEvent;\n /** What is under the pointer, picked without stalling the GPU: a frame or two after 'hover', only while listened to\n * (radius and layers in `GeoMap.hoverPicking`) */\n hoverfeature: MapHoverFeatureEvent;\n /** Click without drag */\n click: MapPointerEvent;\n /** A frame was drawn; duration of the engine call in milliseconds */\n render: { ms: number };\n /** The map's quality changed, by `setQuality` or stepped down by `'auto'` */\n quality: { quality: Quality };\n /** Everything in view is loaded and drawn, nothing moves: the end of a load, once after each change (as MapLibre's\n * `idle`). Tiles requested by the first frame count, so it never fires before they arrive. */\n idle: Record<string, never>;\n /** The pointer left the canvas (a mouse going out of the map, or onto a control or marker) */\n leave: Record<string, never>;\n}\n\n/** What a layer handle needs from its map */\nexport interface LayerHost {\n readonly engine: Engine;\n requestRender(): void;\n /** Forgets a removed layer */\n detach(layer: Layer): void;\n /** Moves a layer under `before`, or on top */\n moveLayer(layer: Layer, before: Layer | undefined): void;\n /** A layer created again in the engine (new id): put at the place of its old id, which is removed */\n replaceLayer(layer: Layer, old: number): void;\n /** Resolves once the map is idle (everything in view loaded and drawn) */\n whenIdle(): Promise<void>;\n /** Work the map waits on before it is idle (`GeoMap.track`) */\n track<T>(work: Promise<T>): Promise<T>;\n /** What its quality draws (`GeoMap.setQuality`) */\n readonly quality: QualitySettings;\n}\n"]}
|
package/dist/util/lru.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A cache keeping its most recently used entries (the decoded tiles and images of the workers, the source tiles of a
|
|
3
3
|
* reprojection, the labels of the vector tiles): a `Map` in order of use, the least recent dropped past `capacity`.
|
|
4
|
+
* Each entry weighs 1 unless weighed otherwise (`weigh`: the decoded tiles by their bytes), the capacity then a total
|
|
5
|
+
* weight; the most recent entry is kept whatever it weighs.
|
|
4
6
|
*/
|
|
5
7
|
export declare class Lru<K, V> {
|
|
6
8
|
capacity: number;
|
|
7
9
|
private readonly evict?;
|
|
8
10
|
private readonly entries;
|
|
11
|
+
/** The weights other than 1 */
|
|
12
|
+
private readonly weights;
|
|
13
|
+
private total;
|
|
9
14
|
/** `evict`: told of each entry dropped for room (not of those deleted) */
|
|
10
15
|
constructor(capacity: number, evict?: ((value: V, key: K) => void) | undefined);
|
|
11
16
|
get size(): number;
|
|
@@ -15,7 +20,11 @@ export declare class Lru<K, V> {
|
|
|
15
20
|
has(key: K): boolean;
|
|
16
21
|
/** Adds or replaces a value, the most recently used; drops the least recent ones past the capacity */
|
|
17
22
|
set(key: K, value: V): void;
|
|
23
|
+
/** Weighs a kept entry (its place in the order of use kept); drops the least recent ones past the capacity */
|
|
24
|
+
weigh(key: K, weight: number): void;
|
|
18
25
|
delete(key: K): boolean;
|
|
26
|
+
/** Drops the least recent entries past the capacity, the most recent kept */
|
|
27
|
+
private trim;
|
|
19
28
|
/** The values, least recently used first */
|
|
20
29
|
values(): IterableIterator<V>;
|
|
21
30
|
clear(): void;
|
package/dist/util/lru.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A cache keeping its most recently used entries (the decoded tiles and images of the workers, the source tiles of a
|
|
3
3
|
* reprojection, the labels of the vector tiles): a `Map` in order of use, the least recent dropped past `capacity`.
|
|
4
|
+
* Each entry weighs 1 unless weighed otherwise (`weigh`: the decoded tiles by their bytes), the capacity then a total
|
|
5
|
+
* weight; the most recent entry is kept whatever it weighs.
|
|
4
6
|
*/
|
|
5
7
|
export class Lru {
|
|
6
8
|
capacity;
|
|
7
9
|
evict;
|
|
8
10
|
entries = new Map();
|
|
11
|
+
/** The weights other than 1 */
|
|
12
|
+
weights = new Map();
|
|
13
|
+
total = 0;
|
|
9
14
|
/** `evict`: told of each entry dropped for room (not of those deleted) */
|
|
10
15
|
constructor(capacity, evict) {
|
|
11
16
|
this.capacity = capacity;
|
|
@@ -29,24 +34,43 @@ export class Lru {
|
|
|
29
34
|
}
|
|
30
35
|
/** Adds or replaces a value, the most recently used; drops the least recent ones past the capacity */
|
|
31
36
|
set(key, value) {
|
|
32
|
-
this.
|
|
37
|
+
this.delete(key);
|
|
33
38
|
this.entries.set(key, value);
|
|
39
|
+
this.total += 1;
|
|
40
|
+
this.trim();
|
|
41
|
+
}
|
|
42
|
+
/** Weighs a kept entry (its place in the order of use kept); drops the least recent ones past the capacity */
|
|
43
|
+
weigh(key, weight) {
|
|
44
|
+
if (!this.entries.has(key))
|
|
45
|
+
return;
|
|
46
|
+
this.total += weight - (this.weights.get(key) ?? 1);
|
|
47
|
+
this.weights.set(key, weight);
|
|
48
|
+
this.trim();
|
|
49
|
+
}
|
|
50
|
+
delete(key) {
|
|
51
|
+
if (!this.entries.has(key))
|
|
52
|
+
return false;
|
|
53
|
+
this.total -= this.weights.get(key) ?? 1;
|
|
54
|
+
this.weights.delete(key);
|
|
55
|
+
return this.entries.delete(key);
|
|
56
|
+
}
|
|
57
|
+
/** Drops the least recent entries past the capacity, the most recent kept */
|
|
58
|
+
trim() {
|
|
34
59
|
for (const [oldest, old] of this.entries) {
|
|
35
|
-
if (this.entries.size <=
|
|
60
|
+
if (this.total <= this.capacity || this.entries.size <= 1)
|
|
36
61
|
break;
|
|
37
|
-
this.
|
|
62
|
+
this.delete(oldest);
|
|
38
63
|
this.evict?.(old, oldest);
|
|
39
64
|
}
|
|
40
65
|
}
|
|
41
|
-
delete(key) {
|
|
42
|
-
return this.entries.delete(key);
|
|
43
|
-
}
|
|
44
66
|
/** The values, least recently used first */
|
|
45
67
|
values() {
|
|
46
68
|
return this.entries.values();
|
|
47
69
|
}
|
|
48
70
|
clear() {
|
|
49
71
|
this.entries.clear();
|
|
72
|
+
this.weights.clear();
|
|
73
|
+
this.total = 0;
|
|
50
74
|
}
|
|
51
75
|
}
|
|
52
76
|
//# sourceMappingURL=lru.js.map
|
package/dist/util/lru.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lru.js","sourceRoot":"","sources":["../../src/util/lru.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"lru.js","sourceRoot":"","sources":["../../src/util/lru.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * A cache keeping its most recently used entries (the decoded tiles and images of the workers, the source tiles of a\n * reprojection, the labels of the vector tiles): a `Map` in order of use, the least recent dropped past `capacity`.\n * Each entry weighs 1 unless weighed otherwise (`weigh`: the decoded tiles by their bytes), the capacity then a total\n * weight; the most recent entry is kept whatever it weighs.\n */\nexport class Lru<K, V> {\n private readonly entries = new Map<K, V>();\n /** The weights other than 1 */\n private readonly weights = new Map<K, number>();\n private total = 0;\n\n /** `evict`: told of each entry dropped for room (not of those deleted) */\n constructor(\n public capacity: number,\n private readonly evict?: (value: V, key: K) => void,\n ) {}\n\n get size(): number {\n return this.entries.size;\n }\n\n /** The value of a key, now the most recently used; undefined if absent */\n get(key: K): V | undefined {\n const value = this.entries.get(key);\n\n if (value !== undefined) {\n this.entries.delete(key);\n this.entries.set(key, value);\n }\n\n return value;\n }\n\n /** Whether a key is kept, without using it */\n has(key: K): boolean {\n return this.entries.has(key);\n }\n\n /** Adds or replaces a value, the most recently used; drops the least recent ones past the capacity */\n set(key: K, value: V): void {\n this.delete(key);\n this.entries.set(key, value);\n this.total += 1;\n this.trim();\n }\n\n /** Weighs a kept entry (its place in the order of use kept); drops the least recent ones past the capacity */\n weigh(key: K, weight: number): void {\n if (!this.entries.has(key)) return;\n this.total += weight - (this.weights.get(key) ?? 1);\n this.weights.set(key, weight);\n this.trim();\n }\n\n delete(key: K): boolean {\n if (!this.entries.has(key)) return false;\n this.total -= this.weights.get(key) ?? 1;\n this.weights.delete(key);\n\n return this.entries.delete(key);\n }\n\n /** Drops the least recent entries past the capacity, the most recent kept */\n private trim(): void {\n for (const [oldest, old] of this.entries) {\n if (this.total <= this.capacity || this.entries.size <= 1) break;\n this.delete(oldest);\n this.evict?.(old, oldest);\n }\n }\n\n /** The values, least recently used first */\n values(): IterableIterator<V> {\n return this.entries.values();\n }\n\n clear(): void {\n this.entries.clear();\n this.weights.clear();\n this.total = 0;\n }\n}\n"]}
|
|
@@ -356,7 +356,7 @@ export class Engine {
|
|
|
356
356
|
maxTextureSize(): number;
|
|
357
357
|
/**
|
|
358
358
|
* The GPU memory of the layers the budget counts (`setMemoryBudget`): two numbers a layer, its id and its bytes
|
|
359
|
-
* (a raster's pool, the tiles of a 3D Tiles layer or a
|
|
359
|
+
* (a raster's pool, the tiles of a 3D Tiles layer, a point cloud or a vector tile layer), the relief last with id 0
|
|
360
360
|
*/
|
|
361
361
|
memory(): Float64Array;
|
|
362
362
|
/**
|
|
@@ -490,7 +490,7 @@ export class Engine {
|
|
|
490
490
|
}
|
|
491
491
|
/**
|
|
492
492
|
* The GPU memory of the layers the budget counts (`setMemoryBudget`): two numbers a layer, its id and its bytes
|
|
493
|
-
* (a raster's pool, the tiles of a 3D Tiles layer or a
|
|
493
|
+
* (a raster's pool, the tiles of a 3D Tiles layer, a point cloud or a vector tile layer), the relief last with id 0
|
|
494
494
|
* @returns {Float64Array}
|
|
495
495
|
*/
|
|
496
496
|
memory() {
|
|
@@ -4314,27 +4314,27 @@ function __wbg_get_imports() {
|
|
|
4314
4314
|
arg0.writeTexture(arg1, getArrayU8FromWasm0(arg2, arg3), arg4, arg5);
|
|
4315
4315
|
}, arguments); },
|
|
4316
4316
|
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
4317
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
4317
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 2390, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
4318
4318
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_4346cdda5a9d72ac___convert__closures_____invoke___wasm_bindgen_4346cdda5a9d72ac___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_4346cdda5a9d72ac___JsError___true_);
|
|
4319
4319
|
return ret;
|
|
4320
4320
|
},
|
|
4321
4321
|
__wbindgen_generic_0000000000000002: function(arg0, arg1) {
|
|
4322
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx:
|
|
4322
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx: 323, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
4323
4323
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_4346cdda5a9d72ac___convert__closures_____invoke___wasm_bindgen_4346cdda5a9d72ac___sys__JsNullable_wgpu_ce7204c20056c03e___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_4346cdda5a9d72ac___JsError___true_);
|
|
4324
4324
|
return ret;
|
|
4325
4325
|
},
|
|
4326
4326
|
__wbindgen_generic_0000000000000003: function(arg0, arg1) {
|
|
4327
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx:
|
|
4327
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx: 327, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
4328
4328
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_4346cdda5a9d72ac___convert__closures_____invoke___wgpu_ce7204c20056c03e___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true_);
|
|
4329
4329
|
return ret;
|
|
4330
4330
|
},
|
|
4331
4331
|
__wbindgen_generic_0000000000000004: function(arg0, arg1) {
|
|
4332
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx:
|
|
4332
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx: 323, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
4333
4333
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_4346cdda5a9d72ac___convert__closures_____invoke___wasm_bindgen_4346cdda5a9d72ac___sys__JsNullable_wgpu_ce7204c20056c03e___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_4346cdda5a9d72ac___JsError___true__132);
|
|
4334
4334
|
return ret;
|
|
4335
4335
|
},
|
|
4336
4336
|
__wbindgen_generic_0000000000000005: function(arg0, arg1) {
|
|
4337
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx:
|
|
4337
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 323, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
4338
4338
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_4346cdda5a9d72ac___convert__closures_____invoke___wasm_bindgen_4346cdda5a9d72ac___sys__JsNullable_wgpu_ce7204c20056c03e___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_4346cdda5a9d72ac___JsError___true__133);
|
|
4339
4339
|
return ret;
|
|
4340
4340
|
},
|
|
@@ -356,7 +356,7 @@ export class Engine {
|
|
|
356
356
|
maxTextureSize(): number;
|
|
357
357
|
/**
|
|
358
358
|
* The GPU memory of the layers the budget counts (`setMemoryBudget`): two numbers a layer, its id and its bytes
|
|
359
|
-
* (a raster's pool, the tiles of a 3D Tiles layer or a
|
|
359
|
+
* (a raster's pool, the tiles of a 3D Tiles layer, a point cloud or a vector tile layer), the relief last with id 0
|
|
360
360
|
*/
|
|
361
361
|
memory(): Float64Array;
|
|
362
362
|
/**
|
|
@@ -490,7 +490,7 @@ export class Engine {
|
|
|
490
490
|
}
|
|
491
491
|
/**
|
|
492
492
|
* The GPU memory of the layers the budget counts (`setMemoryBudget`): two numbers a layer, its id and its bytes
|
|
493
|
-
* (a raster's pool, the tiles of a 3D Tiles layer or a
|
|
493
|
+
* (a raster's pool, the tiles of a 3D Tiles layer, a point cloud or a vector tile layer), the relief last with id 0
|
|
494
494
|
* @returns {Float64Array}
|
|
495
495
|
*/
|
|
496
496
|
memory() {
|
|
@@ -3429,27 +3429,27 @@ function __wbg_get_imports() {
|
|
|
3429
3429
|
arg0.writeTexture(arg1, getArrayU8FromWasm0(arg2, arg3), arg4, arg5);
|
|
3430
3430
|
}, arguments); },
|
|
3431
3431
|
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
3432
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
3432
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 319, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
3433
3433
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_2e566c63402fe7fa___convert__closures_____invoke___wasm_bindgen_2e566c63402fe7fa___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_2e566c63402fe7fa___JsError___true_);
|
|
3434
3434
|
return ret;
|
|
3435
3435
|
},
|
|
3436
3436
|
__wbindgen_generic_0000000000000002: function(arg0, arg1) {
|
|
3437
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx:
|
|
3437
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx: 262, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
3438
3438
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_2e566c63402fe7fa___convert__closures_____invoke___wasm_bindgen_2e566c63402fe7fa___sys__JsNullable_wgpu_79b597b3111bcbe9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_2e566c63402fe7fa___JsError___true_);
|
|
3439
3439
|
return ret;
|
|
3440
3440
|
},
|
|
3441
3441
|
__wbindgen_generic_0000000000000003: function(arg0, arg1) {
|
|
3442
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx:
|
|
3442
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx: 266, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3443
3443
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_2e566c63402fe7fa___convert__closures_____invoke___wgpu_79b597b3111bcbe9___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true_);
|
|
3444
3444
|
return ret;
|
|
3445
3445
|
},
|
|
3446
3446
|
__wbindgen_generic_0000000000000004: function(arg0, arg1) {
|
|
3447
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx:
|
|
3447
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx: 262, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
3448
3448
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_2e566c63402fe7fa___convert__closures_____invoke___wasm_bindgen_2e566c63402fe7fa___sys__JsNullable_wgpu_79b597b3111bcbe9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_2e566c63402fe7fa___JsError___true__132);
|
|
3449
3449
|
return ret;
|
|
3450
3450
|
},
|
|
3451
3451
|
__wbindgen_generic_0000000000000005: function(arg0, arg1) {
|
|
3452
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx:
|
|
3452
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 262, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
3453
3453
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_2e566c63402fe7fa___convert__closures_____invoke___wasm_bindgen_2e566c63402fe7fa___sys__JsNullable_wgpu_79b597b3111bcbe9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_2e566c63402fe7fa___JsError___true__133);
|
|
3454
3454
|
return ret;
|
|
3455
3455
|
},
|
|
@@ -24,7 +24,7 @@ export declare const landmarksOf: (layers: Map<string, {
|
|
|
24
24
|
features: TileFeature[];
|
|
25
25
|
}> | undefined) => number[];
|
|
26
26
|
/** Whether a building's rings (tile units) hold one of the landmarks' points */
|
|
27
|
-
export declare const holdsLandmark: (rings: readonly
|
|
27
|
+
export declare const holdsLandmark: (rings: readonly ArrayLike<number>[], points: readonly number[]) => boolean;
|
|
28
28
|
/**
|
|
29
29
|
* The buildings of a layer that are landmarks: those holding a landmark's point (`holdsLandmark`), and the parts of
|
|
30
30
|
* those (a building whose middle is inside one of them, or that holds one's middle: the stage tower, the dome). Their
|
|
@@ -45,15 +45,15 @@ export declare const filterZooms: (layer: StyleLayer, feature: TileFeature, z: n
|
|
|
45
45
|
* A ring cut to the square [0, `extent`] (Sutherland–Hodgman), its points interleaved, unclosed: a polygon lying
|
|
46
46
|
* across the tile's edge keeps its part in the tile, along the edge
|
|
47
47
|
*/
|
|
48
|
-
export declare const clipRing: (ring:
|
|
48
|
+
export declare const clipRing: (ring: ArrayLike<number>, extent: number) => number[];
|
|
49
49
|
/**
|
|
50
50
|
* A line with the points dropped that lie within `tolerance` of the line through their neighbours kept (Douglas–
|
|
51
51
|
* Peucker): a sequence of photos every few metres (Panoramax's) drawn as many pieces under a pixel, each as wide as the
|
|
52
52
|
* line, covered a pixel ten times over
|
|
53
53
|
*/
|
|
54
|
-
export declare const simplifyLine: (line:
|
|
54
|
+
export declare const simplifyLine: (line: ArrayLike<number>, tolerance: number) => number[];
|
|
55
55
|
/** A line cut to the square [0, `extent`] (Liang–Barsky per segment): its runs inside, each two points at least */
|
|
56
|
-
export declare const clipLine: (line:
|
|
56
|
+
export declare const clipLine: (line: ArrayLike<number>, extent: number) => number[][];
|
|
57
57
|
/** The styles alone of a tile's features in the renderer's layers, as `tileVectors` gives them (its paint changed:
|
|
58
58
|
* the same features, in the same order) */
|
|
59
59
|
export declare const tileStyles: (r: Renderer, work: WorkOf<"vectors">) => Promise<TileStyles | undefined>;
|
|
@@ -146,7 +146,7 @@ export type BasemapRequest =
|
|
|
146
146
|
sprites?: Sprite[];
|
|
147
147
|
/** Workers of the pool: each keeps its share of the decoded tiles */
|
|
148
148
|
workers?: number;
|
|
149
|
-
/** The decoded tiles the pool keeps, all its workers together (the map's quality) */
|
|
149
|
+
/** The decoded tiles the pool keeps, all its workers together, in megabytes (the map's quality) */
|
|
150
150
|
cached?: number;
|
|
151
151
|
} | (BasemapWork & {
|
|
152
152
|
id: number;
|
|
@@ -36,9 +36,10 @@ export declare const spriteIcon: (r: Renderer, name: string) => {
|
|
|
36
36
|
image: ImageBitmap;
|
|
37
37
|
} | undefined;
|
|
38
38
|
export declare const renderers: Map<string, Renderer>;
|
|
39
|
-
/** Decoded tiles by URL; this worker's share of them,
|
|
39
|
+
/** Decoded tiles by URL, each weighed by its bytes (`decodedBytes`) once decoded; this worker's share of them (bytes),
|
|
40
|
+
* set by the renderers */
|
|
40
41
|
export declare const cache: Lru<string, Promise<Map<string, TileLayer> | undefined>>;
|
|
41
|
-
/** The decoded tiles one worker of `workers` keeps, of the pool's `cached` */
|
|
42
|
+
/** The bytes of decoded tiles one worker of `workers` keeps, of the pool's `cached` megabytes */
|
|
42
43
|
export declare const cacheShare: (workers: number, cached?: number) => number;
|
|
43
44
|
/** Requests in progress, and those of them aborted (both forgotten once answered) */
|
|
44
45
|
export declare const active: Set<number>;
|
|
@@ -7,14 +7,14 @@ export declare const thinned: (found: readonly number[], max: number) => Float64
|
|
|
7
7
|
/** A number in [0, 1) from four integers, the same for the same ones: where a tree stands in its cell, its size */
|
|
8
8
|
export declare const treeHash: (a: number, b: number, c: number, d: number) => number;
|
|
9
9
|
/** Whether a point lies in rings (interleaved points, unclosed or closed), even-odd: the holes cut out */
|
|
10
|
-
export declare const inRings: (rings: readonly
|
|
10
|
+
export declare const inRings: (rings: readonly ArrayLike<number>[], px: number, py: number) => boolean;
|
|
11
11
|
/**
|
|
12
12
|
* Points scattered over a polygon (its rings, tile units) on a jittered grid of `cell` tile units, the grid and the
|
|
13
13
|
* jitter fixed by the tile (`seed`): the same trees whenever the tile is cut again, none twice across tiles (the points
|
|
14
14
|
* past the tile's edge left to its neighbour). Past `maxCells` cells over the polygon (a tile of a coarse level), the
|
|
15
15
|
* cells grow until they are no more. Each point with a number in [0, 1) for its size and heading
|
|
16
16
|
*/
|
|
17
|
-
export declare const scatter: (rings: readonly
|
|
17
|
+
export declare const scatter: (rings: readonly ArrayLike<number>[], extent: number, spacing: number, seed: [number, number, number], maxCells?: number) => [x: number, y: number, k: number][];
|
|
18
18
|
/**
|
|
19
19
|
* Trees over the polygons of the renderer's layers in a tile: longitude, latitude, scale (0.75 to 1.25), heading
|
|
20
20
|
* (degrees), rank (in [0, 1): the page keeps the lowest far from the view) and kind (1 a conifer, as many as its wood's
|
package/package.json
CHANGED