isard 1.3.0 → 1.5.0

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.
Files changed (97) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/README.md +23 -6
  3. package/dist/basemap/basemaps.js +1 -0
  4. package/dist/basemap/basemaps.js.map +1 -1
  5. package/dist/basemap/vectortiles/context.d.ts +43 -0
  6. package/dist/basemap/vectortiles/context.js +6 -0
  7. package/dist/basemap/vectortiles/context.js.map +1 -0
  8. package/dist/basemap/vectortiles/extrusions.d.ts +11 -0
  9. package/dist/basemap/vectortiles/extrusions.js +46 -0
  10. package/dist/basemap/vectortiles/extrusions.js.map +1 -0
  11. package/dist/basemap/vectortiles/labels.d.ts +22 -0
  12. package/dist/basemap/vectortiles/labels.js +225 -0
  13. package/dist/basemap/vectortiles/labels.js.map +1 -0
  14. package/dist/basemap/vectortiles/requests.d.ts +24 -0
  15. package/dist/basemap/vectortiles/requests.js +61 -0
  16. package/dist/basemap/vectortiles/requests.js.map +1 -0
  17. package/dist/basemap/vectortiles/street-wind.d.ts +19 -0
  18. package/dist/basemap/vectortiles/street-wind.js +133 -0
  19. package/dist/basemap/vectortiles/street-wind.js.map +1 -0
  20. package/dist/basemap/vectortiles/style.d.ts +47 -0
  21. package/dist/basemap/vectortiles/style.js +141 -0
  22. package/dist/basemap/vectortiles/style.js.map +1 -0
  23. package/dist/basemap/vectortiles/tiles.d.ts +34 -0
  24. package/dist/basemap/vectortiles/tiles.js +62 -0
  25. package/dist/basemap/vectortiles/tiles.js.map +1 -0
  26. package/dist/basemap/vectortiles/trees.d.ts +19 -0
  27. package/dist/basemap/vectortiles/trees.js +93 -0
  28. package/dist/basemap/vectortiles/trees.js.map +1 -0
  29. package/dist/basemap/vectortiles/vectors.d.ts +20 -0
  30. package/dist/basemap/vectortiles/vectors.js +167 -0
  31. package/dist/basemap/vectortiles/vectors.js.map +1 -0
  32. package/dist/basemap/vectortiles.d.ts +34 -75
  33. package/dist/basemap/vectortiles.js +70 -654
  34. package/dist/basemap/vectortiles.js.map +1 -1
  35. package/dist/basemap/workerpool.js +33 -5
  36. package/dist/basemap/workerpool.js.map +1 -1
  37. package/dist/basemap.worker.js +2 -2
  38. package/dist/basemap.worker.js.map +8 -5
  39. package/dist/bind/layers.js +10 -0
  40. package/dist/bind/layers.js.map +1 -1
  41. package/dist/decoder.worker.js +5 -4
  42. package/dist/decoder.worker.js.map +8 -6
  43. package/dist/engine/decoders.d.ts +4 -8
  44. package/dist/engine/decoders.js +29 -2
  45. package/dist/engine/decoders.js.map +1 -1
  46. package/dist/engine-loader.d.ts +4 -1
  47. package/dist/engine-loader.js +9 -0
  48. package/dist/engine-loader.js.map +1 -1
  49. package/dist/grid-module.d.ts +44 -0
  50. package/dist/grid-module.js +63 -0
  51. package/dist/grid-module.js.map +1 -0
  52. package/dist/grids.d.ts +51 -0
  53. package/dist/grids.js +88 -0
  54. package/dist/grids.js.map +1 -0
  55. package/dist/index.d.ts +10 -1
  56. package/dist/index.js +3 -1
  57. package/dist/index.js.map +1 -1
  58. package/dist/isard_bg.wasm +0 -0
  59. package/dist/isard_core_bg.wasm +0 -0
  60. package/dist/isard_grid_bg.wasm +0 -0
  61. package/dist/layers/flow.d.ts +118 -0
  62. package/dist/layers/flow.js +263 -0
  63. package/dist/layers/flow.js.map +1 -0
  64. package/dist/layers/panoramas.d.ts +2 -0
  65. package/dist/layers/panoramas.js +27 -6
  66. package/dist/layers/panoramas.js.map +1 -1
  67. package/dist/layers/symbols.d.ts +2 -0
  68. package/dist/layers/symbols.js +2 -1
  69. package/dist/layers/symbols.js.map +1 -1
  70. package/dist/map/layer-spec.d.ts +4 -1
  71. package/dist/map/layer-spec.js +2 -0
  72. package/dist/map/layer-spec.js.map +1 -1
  73. package/dist/map/workers.d.ts +4 -0
  74. package/dist/map/workers.js +38 -0
  75. package/dist/map/workers.js.map +1 -1
  76. package/dist/map.d.ts +14 -0
  77. package/dist/map.js +19 -1
  78. package/dist/map.js.map +1 -1
  79. package/dist/react/Layer.d.ts +2 -0
  80. package/dist/react/Layer.js.map +1 -1
  81. package/dist/types.d.ts +7 -3
  82. package/dist/types.js.map +1 -1
  83. package/dist/util/read.d.ts +4 -0
  84. package/dist/util/read.js +28 -0
  85. package/dist/util/read.js.map +1 -0
  86. package/dist/wasm/isard.d.ts +55 -0
  87. package/dist/wasm/isard.js +112 -1
  88. package/dist/wasm/isard_core.d.ts +55 -0
  89. package/dist/wasm/isard_core.js +112 -1
  90. package/dist/wasm/isard_grid.d.ts +101 -0
  91. package/dist/wasm/isard_grid.js +375 -0
  92. package/dist/workers/basemap/street.d.ts +19 -0
  93. package/dist/workers/basemap.worker.d.ts +21 -0
  94. package/dist/workers/basemap.worker.js +23 -4
  95. package/dist/workers/basemap.worker.js.map +1 -1
  96. package/package.json +2 -1
  97. package/vite.js +3 -2
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 './engine/decoders.ts';\nimport type { Feature, Ramp, Size } from './layers/features.ts';\nimport type { Layer } from './layers/layers.ts';\nimport type { AttributionOptions } from './ui/controls.ts';\nimport type { Camera, Engine } from './wasm/isard.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). 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 | '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\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 /** 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_bg.wasm`, `isard_core_bg.wasm`,\n * `isard_points_bg.wasm`, `isard_tess_bg.wasm`, and its workers, `decoder.worker.js`, `basemap.worker.js`): one option for a bundler that\n * moves them, the `…Url` options below for each one. `isard/vite` sets it for the whole page; default next to the\n * module */\n assetsUrl?: string | URL;\n /** Where to load the engine with 3D Tiles from (`isard_bg.wasm`), when a bundler does not resolve the default URL.\n * Given without `coreWasmUrl`, maps load this engine from the start */\n wasmUrl?: string | URL;\n /** Where to load the engine without 3D Tiles from (`isard_core_bg.wasm`, a third smaller), when a bundler does not\n * resolve the default URL. Maps load it first, and the engine with 3D Tiles (`wasmUrl`) for their first 3D Tiles\n * layer only */\n coreWasmUrl?: 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 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 /** Load the engine with 3D Tiles from the start (default false: it is loaded when the first 3D Tiles layer or glTF\n * model is added, the map then moving its camera and layers onto it, a stall of about a frame or two). For a map that shows 3D Tiles\n * at once: one engine downloaded instead of two. `'preload'`: the map starts on the engine without 3D Tiles and\n * downloads and compiles the other once idle, without running it: its first 3D Tiles layer does not wait for the\n * download (for a map that will show 3D Tiles later, on demand) */\n tiles3d?: boolean | 'preload';\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/** What `RasterLayer.setStyle` changes */\nexport interface RasterStyle {\n opacity: number;\n /** 0 = greyscale, 1 = original colors */\n saturation: number;\n}\n\nexport interface RasterOptions {\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}\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> {\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}\n\nexport interface Tiles3dOptions extends Partial<Tiles3dStyle> {\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}\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/** 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 /** 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}\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 './engine/decoders.ts';\nimport type { Feature, Ramp, Size } from './layers/features.ts';\nimport type { Layer } from './layers/layers.ts';\nimport type { AttributionOptions } from './ui/controls.ts';\nimport type { Camera, Engine } from './wasm/isard.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\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 /** 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_bg.wasm`, `isard_core_bg.wasm`,\n * `isard_points_bg.wasm`, `isard_tess_bg.wasm`, `isard_grid_bg.wasm`, and its workers, `decoder.worker.js`, `basemap.worker.js`): one option for a bundler that\n * moves them, the `…Url` options below for each one. `isard/vite` sets it for the whole page; default next to the\n * module */\n assetsUrl?: string | URL;\n /** Where to load the engine with 3D Tiles from (`isard_bg.wasm`), when a bundler does not resolve the default URL.\n * Given without `coreWasmUrl`, maps load this engine from the start */\n wasmUrl?: string | URL;\n /** Where to load the engine without 3D Tiles from (`isard_core_bg.wasm`, a third smaller), when a bundler does not\n * resolve the default URL. Maps load it first, and the engine with 3D Tiles (`wasmUrl`) for their first 3D Tiles\n * layer only */\n coreWasmUrl?: 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 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 /** Load the engine with 3D Tiles from the start (default false: it is loaded when the first 3D Tiles layer or glTF\n * model is added, the map then moving its camera and layers onto it, a stall of about a frame or two). For a map that shows 3D Tiles\n * at once: one engine downloaded instead of two. `'preload'`: the map starts on the engine without 3D Tiles and\n * downloads and compiles the other once idle, without running it: its first 3D Tiles layer does not wait for the\n * download (for a map that will show 3D Tiles later, on demand) */\n tiles3d?: boolean | 'preload';\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/** What `RasterLayer.setStyle` changes */\nexport interface RasterStyle {\n opacity: number;\n /** 0 = greyscale, 1 = original colors */\n saturation: number;\n}\n\nexport interface RasterOptions {\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}\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> {\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}\n\nexport interface Tiles3dOptions extends Partial<Tiles3dStyle> {\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}\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/** 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 /** 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}\n"]}
@@ -0,0 +1,4 @@
1
+ /** Reading a response's body within a limit */
2
+ /** A response's body if it holds no more than `limit` bytes, read no further than that; undefined past it (its
3
+ * reading stopped) */
4
+ export declare const readAtMost: (response: Response, limit: number) => Promise<Uint8Array | undefined>;
@@ -0,0 +1,28 @@
1
+ /** Reading a response's body within a limit */
2
+ /** A response's body if it holds no more than `limit` bytes, read no further than that; undefined past it (its
3
+ * reading stopped) */
4
+ export const readAtMost = async (response, limit) => {
5
+ const reader = response.body?.getReader();
6
+ if (!reader)
7
+ return new Uint8Array(await response.arrayBuffer());
8
+ const chunks = [];
9
+ let length = 0;
10
+ for (;;) {
11
+ const { done, value } = await reader.read();
12
+ if (done)
13
+ break;
14
+ length += value.length;
15
+ if (length > limit) {
16
+ await reader.cancel();
17
+ return undefined;
18
+ }
19
+ chunks.push(value);
20
+ }
21
+ const bytes = new Uint8Array(length);
22
+ chunks.reduce((at, chunk) => {
23
+ bytes.set(chunk, at);
24
+ return at + chunk.length;
25
+ }, 0);
26
+ return bytes;
27
+ };
28
+ //# sourceMappingURL=read.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read.js","sourceRoot":"","sources":["../../src/util/read.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAE/C;sBACsB;AACtB,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,EAAE,QAAkB,EAAE,KAAa,EAAmC,EAAE;IACrG,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC;IAE1C,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,UAAU,CAAC,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;IAEjE,MAAM,MAAM,GAAiB,EAAE,CAAC;IAChC,IAAI,MAAM,GAAG,CAAC,CAAC;IAEf,SAAS,CAAC;QACR,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QAE5C,IAAI,IAAI;YAAE,MAAM;QAChB,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC;QACvB,IAAI,MAAM,GAAG,KAAK,EAAE,CAAC;YACnB,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC;YAEtB,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IAErC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE;QAC1B,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAErB,OAAO,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC;IAC3B,CAAC,EAAE,CAAC,CAAC,CAAC;IAEN,OAAO,KAAK,CAAC;AACf,CAAC,CAAC","sourcesContent":["/** Reading a response's body within a limit */\n\n/** A response's body if it holds no more than `limit` bytes, read no further than that; undefined past it (its\n * reading stopped) */\nexport const readAtMost = async (response: Response, limit: number): Promise<Uint8Array | undefined> => {\n const reader = response.body?.getReader();\n\n if (!reader) return new Uint8Array(await response.arrayBuffer());\n\n const chunks: Uint8Array[] = [];\n let length = 0;\n\n for (;;) {\n const { done, value } = await reader.read();\n\n if (done) break;\n length += value.length;\n if (length > limit) {\n await reader.cancel();\n\n return undefined;\n }\n chunks.push(value);\n }\n\n const bytes = new Uint8Array(length);\n\n chunks.reduce((at, chunk) => {\n bytes.set(chunk, at);\n\n return at + chunk.length;\n }, 0);\n\n return bytes;\n};\n"]}
@@ -307,6 +307,16 @@ export class Engine {
307
307
  * info log), or when `feature_count` features need a table texture past the GPU's `MAX_TEXTURE_SIZE`
308
308
  */
309
309
  addFills(points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, feature: Uint32Array, feature_count: number): number;
310
+ /**
311
+ * A flow layer of `particles` particles (rounded up to a multiple of 4096) with trails of `trail` positions; its
312
+ * field comes with `setFlowField`
313
+ *
314
+ * # Errors
315
+ *
316
+ * Throws (to JavaScript) when a WebGL object cannot be created, a shader fails to compile or the trails need a
317
+ * table texture past the GPU's `MAX_TEXTURE_SIZE`
318
+ */
319
+ addFlow(particles: number, trail: number): number;
310
320
  /**
311
321
  * Ground layer running `code` (GLSL ES 3.0 defining `vec4 ground(vec2 offset)`, see `render::ground`) over the
312
322
  * ground; `anchor`: Mercator point the offsets are taken from; bounds: Mercator box it shows in. Compilation errors
@@ -511,6 +521,11 @@ export class Engine {
511
521
  * Screen point (CSS pixels) of a ground position, or `height` metres above it, undefined behind the camera
512
522
  */
513
523
  project(lon: number, lat: number, height?: number | null): [x: number, y: number] | undefined;
524
+ /**
525
+ * A flow layer's second field becomes its field (the model's next hour reached): only the hour after it is then
526
+ * sent (`setFlowNext`)
527
+ */
528
+ promoteFlowNext(id: number): void;
514
529
  /**
515
530
  * Removes batch `key` of an extrusion layer (nothing if there is none)
516
531
  */
@@ -625,6 +640,33 @@ export class Engine {
625
640
  * of view of `fov` degrees. A camera set with `setCamera` turns around a point again
626
641
  */
627
642
  setFirstPerson(lon: number, lat: number, height: number, bearing: number, pitch: number, fov: number): void;
643
+ /**
644
+ * How far a flow layer's field has gone towards its next one, 0 to 1 (the time between the model's two hours)
645
+ */
646
+ setFlowBlend(id: number, blend: number): void;
647
+ /**
648
+ * The field of a flow layer: `width` × `height` points over `bounds` (west, south, east, north, degrees: the
649
+ * longitudes and latitudes of the corner points; a last column one step short of 360° round the world), their
650
+ * east and north components (m/s, row after row from the north; not a number: none there). On the grid of the
651
+ * field before, the particles go on (its next field and blend kept); on another one, they start again
652
+ */
653
+ setFlowField(id: number, width: number, height: number, u: Float32Array, v: Float32Array, bounds: Float64Array): void;
654
+ /**
655
+ * A flow layer's second field, on its grid (the model's next hour, or the flow of a wind towards the north: east
656
+ * and north components, row after row; empty: none), mixed in by `setFlowBlend` or `setFlowWeights`
657
+ */
658
+ setFlowNext(id: number, u: Float32Array, v: Float32Array): void;
659
+ /**
660
+ * The look of a flow layer's trails: speeds (m/s) and their colors (RGBA 0-1, four numbers each), up to 8;
661
+ * width (CSS pixels), opacity, height over the ground (metres), speed on screen (pixels a second for 10 m/s),
662
+ * particles moving for each 100 × 100 CSS pixels of the view (at most the layer's)
663
+ */
664
+ setFlowStyle(id: number, speeds: Float32Array, colors: Float32Array, width: number, opacity: number, height: number, speed: number, density: number): void;
665
+ /**
666
+ * A flow layer's velocity as `a` times its field plus `b` times its second one (a wind of `a` m/s towards the east
667
+ * and `b` towards the north, from the flows of 1 m/s each way): nothing sent again but two numbers
668
+ */
669
+ setFlowWeights(id: number, a: number, b: number): void;
628
670
  /**
629
671
  * Color of the globe under the tiles (polar caps)
630
672
  */
@@ -895,6 +937,11 @@ export class Engine {
895
937
  * Tile counters of the raster layers, for diagnostics
896
938
  */
897
939
  stats(): RasterLayerStats[];
940
+ /**
941
+ * Moves a flow layer's particles by `seconds` of the page's time (one animation frame), in the current view;
942
+ * whether they moved (none in view, or no field: the map need not be drawn again)
943
+ */
944
+ stepFlow(id: number, seconds: number): boolean;
898
945
  /**
899
946
  * The height above the relief (metres) of the top of what stands at a position (degrees): a roof, a mesh, 0 on
900
947
  * the bare ground; undefined where nothing of the last frame is there. The scene is drawn from above into a single
@@ -984,6 +1031,7 @@ export interface InitOutput {
984
1031
  readonly engine_addCustomLayer: (a: number, b: any, c: number) => number;
985
1032
  readonly engine_addExtrusions: (a: number) => [number, number, number];
986
1033
  readonly engine_addFills: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number];
1034
+ readonly engine_addFlow: (a: number, b: number, c: number) => [number, number, number];
987
1035
  readonly engine_addGround: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number];
988
1036
  readonly engine_addLines: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number];
989
1037
  readonly engine_addModels: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
@@ -1015,6 +1063,7 @@ export interface InitOutput {
1015
1063
  readonly engine_pollPick: (a: number) => any;
1016
1064
  readonly engine_preload: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
1017
1065
  readonly engine_project: (a: number, b: number, c: number, d: number, e: number) => any;
1066
+ readonly engine_promoteFlowNext: (a: number, b: number) => void;
1018
1067
  readonly engine_removeExtrusionBatch: (a: number, b: number, c: number) => void;
1019
1068
  readonly engine_removeLayer: (a: number, b: number) => void;
1020
1069
  readonly engine_removeVectorTile: (a: number, b: number, c: number) => void;
@@ -1037,6 +1086,11 @@ export interface InitOutput {
1037
1086
  readonly engine_setFeatureValues: (a: number, b: number, c: number, d: number, e: number) => void;
1038
1087
  readonly engine_setFills: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
1039
1088
  readonly engine_setFirstPerson: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
1089
+ readonly engine_setFlowBlend: (a: number, b: number, c: number) => void;
1090
+ readonly engine_setFlowField: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
1091
+ readonly engine_setFlowNext: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
1092
+ readonly engine_setFlowStyle: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
1093
+ readonly engine_setFlowWeights: (a: number, b: number, c: number, d: number) => void;
1040
1094
  readonly engine_setGlobe: (a: number, b: number) => void;
1041
1095
  readonly engine_setGlobeColor: (a: number, b: number, c: number, d: number) => void;
1042
1096
  readonly engine_setGlyphAtlas: (a: number, b: number, c: number, d: number, e: number) => [number, number];
@@ -1075,6 +1129,7 @@ export interface InitOutput {
1075
1129
  readonly engine_setViewshed: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
1076
1130
  readonly engine_setZoomRange: (a: number, b: number, c: number) => void;
1077
1131
  readonly engine_stats: (a: number) => any;
1132
+ readonly engine_stepFlow: (a: number, b: number, c: number) => number;
1078
1133
  readonly engine_surface: (a: number, b: number, c: number) => any;
1079
1134
  readonly engine_surfaceAt: (a: number, b: number, c: number) => any;
1080
1135
  readonly engine_textureFormats: (a: number) => any;
@@ -97,6 +97,25 @@ export class Engine {
97
97
  }
98
98
  return ret[0] >>> 0;
99
99
  }
100
+ /**
101
+ * A flow layer of `particles` particles (rounded up to a multiple of 4096) with trails of `trail` positions; its
102
+ * field comes with `setFlowField`
103
+ *
104
+ * # Errors
105
+ *
106
+ * Throws (to JavaScript) when a WebGL object cannot be created, a shader fails to compile or the trails need a
107
+ * table texture past the GPU's `MAX_TEXTURE_SIZE`
108
+ * @param {number} particles
109
+ * @param {number} trail
110
+ * @returns {number}
111
+ */
112
+ addFlow(particles, trail) {
113
+ const ret = wasm.engine_addFlow(this.__wbg_ptr, particles, trail);
114
+ if (ret[2]) {
115
+ throw takeFromExternrefTable0(ret[1]);
116
+ }
117
+ return ret[0] >>> 0;
118
+ }
100
119
  /**
101
120
  * Ground layer running `code` (GLSL ES 3.0 defining `vec4 ground(vec2 offset)`, see `render::ground`) over the
102
121
  * ground; `anchor`: Mercator point the offsets are taken from; bounds: Mercator box it shows in. Compilation errors
@@ -555,6 +574,14 @@ export class Engine {
555
574
  const ret = wasm.engine_project(this.__wbg_ptr, lon, lat, !isLikeNone(height), isLikeNone(height) ? 0 : height);
556
575
  return ret;
557
576
  }
577
+ /**
578
+ * A flow layer's second field becomes its field (the model's next hour reached): only the hour after it is then
579
+ * sent (`setFlowNext`)
580
+ * @param {number} id
581
+ */
582
+ promoteFlowNext(id) {
583
+ wasm.engine_promoteFlowNext(this.__wbg_ptr, id);
584
+ }
558
585
  /**
559
586
  * Removes batch `key` of an extrusion layer (nothing if there is none)
560
587
  * @param {number} id
@@ -833,6 +860,79 @@ export class Engine {
833
860
  setFirstPerson(lon, lat, height, bearing, pitch, fov) {
834
861
  wasm.engine_setFirstPerson(this.__wbg_ptr, lon, lat, height, bearing, pitch, fov);
835
862
  }
863
+ /**
864
+ * How far a flow layer's field has gone towards its next one, 0 to 1 (the time between the model's two hours)
865
+ * @param {number} id
866
+ * @param {number} blend
867
+ */
868
+ setFlowBlend(id, blend) {
869
+ wasm.engine_setFlowBlend(this.__wbg_ptr, id, blend);
870
+ }
871
+ /**
872
+ * The field of a flow layer: `width` × `height` points over `bounds` (west, south, east, north, degrees: the
873
+ * longitudes and latitudes of the corner points; a last column one step short of 360° round the world), their
874
+ * east and north components (m/s, row after row from the north; not a number: none there). On the grid of the
875
+ * field before, the particles go on (its next field and blend kept); on another one, they start again
876
+ * @param {number} id
877
+ * @param {number} width
878
+ * @param {number} height
879
+ * @param {Float32Array} u
880
+ * @param {Float32Array} v
881
+ * @param {Float64Array} bounds
882
+ */
883
+ setFlowField(id, width, height, u, v, bounds) {
884
+ const ptr0 = passArrayF32ToWasm0(u, wasm.__wbindgen_malloc);
885
+ const len0 = WASM_VECTOR_LEN;
886
+ const ptr1 = passArrayF32ToWasm0(v, wasm.__wbindgen_malloc);
887
+ const len1 = WASM_VECTOR_LEN;
888
+ const ptr2 = passArrayF64ToWasm0(bounds, wasm.__wbindgen_malloc);
889
+ const len2 = WASM_VECTOR_LEN;
890
+ wasm.engine_setFlowField(this.__wbg_ptr, id, width, height, ptr0, len0, ptr1, len1, ptr2, len2);
891
+ }
892
+ /**
893
+ * A flow layer's second field, on its grid (the model's next hour, or the flow of a wind towards the north: east
894
+ * and north components, row after row; empty: none), mixed in by `setFlowBlend` or `setFlowWeights`
895
+ * @param {number} id
896
+ * @param {Float32Array} u
897
+ * @param {Float32Array} v
898
+ */
899
+ setFlowNext(id, u, v) {
900
+ const ptr0 = passArrayF32ToWasm0(u, wasm.__wbindgen_malloc);
901
+ const len0 = WASM_VECTOR_LEN;
902
+ const ptr1 = passArrayF32ToWasm0(v, wasm.__wbindgen_malloc);
903
+ const len1 = WASM_VECTOR_LEN;
904
+ wasm.engine_setFlowNext(this.__wbg_ptr, id, ptr0, len0, ptr1, len1);
905
+ }
906
+ /**
907
+ * The look of a flow layer's trails: speeds (m/s) and their colors (RGBA 0-1, four numbers each), up to 8;
908
+ * width (CSS pixels), opacity, height over the ground (metres), speed on screen (pixels a second for 10 m/s),
909
+ * particles moving for each 100 × 100 CSS pixels of the view (at most the layer's)
910
+ * @param {number} id
911
+ * @param {Float32Array} speeds
912
+ * @param {Float32Array} colors
913
+ * @param {number} width
914
+ * @param {number} opacity
915
+ * @param {number} height
916
+ * @param {number} speed
917
+ * @param {number} density
918
+ */
919
+ setFlowStyle(id, speeds, colors, width, opacity, height, speed, density) {
920
+ const ptr0 = passArrayF32ToWasm0(speeds, wasm.__wbindgen_malloc);
921
+ const len0 = WASM_VECTOR_LEN;
922
+ const ptr1 = passArrayF32ToWasm0(colors, wasm.__wbindgen_malloc);
923
+ const len1 = WASM_VECTOR_LEN;
924
+ wasm.engine_setFlowStyle(this.__wbg_ptr, id, ptr0, len0, ptr1, len1, width, opacity, height, speed, density);
925
+ }
926
+ /**
927
+ * A flow layer's velocity as `a` times its field plus `b` times its second one (a wind of `a` m/s towards the east
928
+ * and `b` towards the north, from the flows of 1 m/s each way): nothing sent again but two numbers
929
+ * @param {number} id
930
+ * @param {number} a
931
+ * @param {number} b
932
+ */
933
+ setFlowWeights(id, a, b) {
934
+ wasm.engine_setFlowWeights(this.__wbg_ptr, id, a, b);
935
+ }
836
936
  /**
837
937
  * Color of the globe under the tiles (polar caps)
838
938
  * @param {number} r
@@ -1510,6 +1610,17 @@ export class Engine {
1510
1610
  const ret = wasm.engine_stats(this.__wbg_ptr);
1511
1611
  return ret;
1512
1612
  }
1613
+ /**
1614
+ * Moves a flow layer's particles by `seconds` of the page's time (one animation frame), in the current view;
1615
+ * whether they moved (none in view, or no field: the map need not be drawn again)
1616
+ * @param {number} id
1617
+ * @param {number} seconds
1618
+ * @returns {boolean}
1619
+ */
1620
+ stepFlow(id, seconds) {
1621
+ const ret = wasm.engine_stepFlow(this.__wbg_ptr, id, seconds);
1622
+ return ret !== 0;
1623
+ }
1513
1624
  /**
1514
1625
  * The height above the relief (metres) of the top of what stands at a position (degrees): a roof, a mesh, 0 on
1515
1626
  * the bare ground; undefined where nothing of the last frame is there. The scene is drawn from above into a single
@@ -2908,7 +3019,7 @@ function __wbg_get_imports() {
2908
3019
  return ret;
2909
3020
  },
2910
3021
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
2911
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 214, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3022
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 218, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2912
3023
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_2e566c63402fe7fa___convert__closures_____invoke___wasm_bindgen_2e566c63402fe7fa___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_2e566c63402fe7fa___JsError___true_);
2913
3024
  return ret;
2914
3025
  },
@@ -103,6 +103,16 @@ export class Engine {
103
103
  * info log), or when `feature_count` features need a table texture past the GPU's `MAX_TEXTURE_SIZE`
104
104
  */
105
105
  addFills(points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, feature: Uint32Array, feature_count: number): number;
106
+ /**
107
+ * A flow layer of `particles` particles (rounded up to a multiple of 4096) with trails of `trail` positions; its
108
+ * field comes with `setFlowField`
109
+ *
110
+ * # Errors
111
+ *
112
+ * Throws (to JavaScript) when a WebGL object cannot be created, a shader fails to compile or the trails need a
113
+ * table texture past the GPU's `MAX_TEXTURE_SIZE`
114
+ */
115
+ addFlow(particles: number, trail: number): number;
106
116
  /**
107
117
  * Ground layer running `code` (GLSL ES 3.0 defining `vec4 ground(vec2 offset)`, see `render::ground`) over the
108
118
  * ground; `anchor`: Mercator point the offsets are taken from; bounds: Mercator box it shows in. Compilation errors
@@ -257,6 +267,11 @@ export class Engine {
257
267
  * Screen point (CSS pixels) of a ground position, or `height` metres above it, undefined behind the camera
258
268
  */
259
269
  project(lon: number, lat: number, height?: number | null): [x: number, y: number] | undefined;
270
+ /**
271
+ * A flow layer's second field becomes its field (the model's next hour reached): only the hour after it is then
272
+ * sent (`setFlowNext`)
273
+ */
274
+ promoteFlowNext(id: number): void;
260
275
  /**
261
276
  * Removes batch `key` of an extrusion layer (nothing if there is none)
262
277
  */
@@ -371,6 +386,33 @@ export class Engine {
371
386
  * of view of `fov` degrees. A camera set with `setCamera` turns around a point again
372
387
  */
373
388
  setFirstPerson(lon: number, lat: number, height: number, bearing: number, pitch: number, fov: number): void;
389
+ /**
390
+ * How far a flow layer's field has gone towards its next one, 0 to 1 (the time between the model's two hours)
391
+ */
392
+ setFlowBlend(id: number, blend: number): void;
393
+ /**
394
+ * The field of a flow layer: `width` × `height` points over `bounds` (west, south, east, north, degrees: the
395
+ * longitudes and latitudes of the corner points; a last column one step short of 360° round the world), their
396
+ * east and north components (m/s, row after row from the north; not a number: none there). On the grid of the
397
+ * field before, the particles go on (its next field and blend kept); on another one, they start again
398
+ */
399
+ setFlowField(id: number, width: number, height: number, u: Float32Array, v: Float32Array, bounds: Float64Array): void;
400
+ /**
401
+ * A flow layer's second field, on its grid (the model's next hour, or the flow of a wind towards the north: east
402
+ * and north components, row after row; empty: none), mixed in by `setFlowBlend` or `setFlowWeights`
403
+ */
404
+ setFlowNext(id: number, u: Float32Array, v: Float32Array): void;
405
+ /**
406
+ * The look of a flow layer's trails: speeds (m/s) and their colors (RGBA 0-1, four numbers each), up to 8;
407
+ * width (CSS pixels), opacity, height over the ground (metres), speed on screen (pixels a second for 10 m/s),
408
+ * particles moving for each 100 × 100 CSS pixels of the view (at most the layer's)
409
+ */
410
+ setFlowStyle(id: number, speeds: Float32Array, colors: Float32Array, width: number, opacity: number, height: number, speed: number, density: number): void;
411
+ /**
412
+ * A flow layer's velocity as `a` times its field plus `b` times its second one (a wind of `a` m/s towards the east
413
+ * and `b` towards the north, from the flows of 1 m/s each way): nothing sent again but two numbers
414
+ */
415
+ setFlowWeights(id: number, a: number, b: number): void;
374
416
  /**
375
417
  * Color of the globe under the tiles (polar caps)
376
418
  */
@@ -600,6 +642,11 @@ export class Engine {
600
642
  * Tile counters of the raster layers, for diagnostics
601
643
  */
602
644
  stats(): RasterLayerStats[];
645
+ /**
646
+ * Moves a flow layer's particles by `seconds` of the page's time (one animation frame), in the current view;
647
+ * whether they moved (none in view, or no field: the map need not be drawn again)
648
+ */
649
+ stepFlow(id: number, seconds: number): boolean;
603
650
  /**
604
651
  * The height above the relief (metres) of the top of what stands at a position (degrees): a roof, a mesh, 0 on
605
652
  * the bare ground; undefined where nothing of the last frame is there. The scene is drawn from above into a single
@@ -659,6 +706,7 @@ export interface InitOutput {
659
706
  readonly engine_addCustomLayer: (a: number, b: any, c: number) => number;
660
707
  readonly engine_addExtrusions: (a: number) => [number, number, number];
661
708
  readonly engine_addFills: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number];
709
+ readonly engine_addFlow: (a: number, b: number, c: number) => [number, number, number];
662
710
  readonly engine_addGround: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number];
663
711
  readonly engine_addLines: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number];
664
712
  readonly engine_addNetwork: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => [number, number, number];
@@ -683,6 +731,7 @@ export interface InitOutput {
683
731
  readonly engine_pollPick: (a: number) => any;
684
732
  readonly engine_preload: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
685
733
  readonly engine_project: (a: number, b: number, c: number, d: number, e: number) => any;
734
+ readonly engine_promoteFlowNext: (a: number, b: number) => void;
686
735
  readonly engine_removeExtrusionBatch: (a: number, b: number, c: number) => void;
687
736
  readonly engine_removeLayer: (a: number, b: number) => void;
688
737
  readonly engine_removeVectorTile: (a: number, b: number, c: number) => void;
@@ -705,6 +754,11 @@ export interface InitOutput {
705
754
  readonly engine_setFeatureValues: (a: number, b: number, c: number, d: number, e: number) => void;
706
755
  readonly engine_setFills: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
707
756
  readonly engine_setFirstPerson: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
757
+ readonly engine_setFlowBlend: (a: number, b: number, c: number) => void;
758
+ readonly engine_setFlowField: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
759
+ readonly engine_setFlowNext: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
760
+ readonly engine_setFlowStyle: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
761
+ readonly engine_setFlowWeights: (a: number, b: number, c: number, d: number) => void;
708
762
  readonly engine_setGlobe: (a: number, b: number) => void;
709
763
  readonly engine_setGlobeColor: (a: number, b: number, c: number, d: number) => void;
710
764
  readonly engine_setGlyphAtlas: (a: number, b: number, c: number, d: number, e: number) => [number, number];
@@ -737,6 +791,7 @@ export interface InitOutput {
737
791
  readonly engine_setViewshed: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
738
792
  readonly engine_setZoomRange: (a: number, b: number, c: number) => void;
739
793
  readonly engine_stats: (a: number) => any;
794
+ readonly engine_stepFlow: (a: number, b: number, c: number) => number;
740
795
  readonly engine_surface: (a: number, b: number, c: number) => any;
741
796
  readonly engine_surfaceAt: (a: number, b: number, c: number) => any;
742
797
  readonly engine_updateGlyphAtlas: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;