isard 1.14.0 → 1.16.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.
- package/CHANGELOG.md +63 -0
- package/dist/bind/layers.js +3 -1
- package/dist/bind/layers.js.map +1 -1
- package/dist/decoder.worker.js +5 -5
- package/dist/decoder.worker.js.map +3 -3
- package/dist/engine-loader.d.ts +1 -1
- package/dist/engine-loader.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/isard_bg.wasm +0 -0
- package/dist/isard_core_bg.wasm +0 -0
- package/dist/isard_grid_bg.wasm +0 -0
- package/dist/isard_points_bg.wasm +0 -0
- package/dist/layers/raster.js +2 -2
- package/dist/layers/raster.js.map +1 -1
- package/dist/layers/tiles3d.d.ts +5 -1
- package/dist/layers/tiles3d.js +23 -1
- package/dist/layers/tiles3d.js.map +1 -1
- package/dist/layers/vectors.js +3 -3
- package/dist/layers/vectors.js.map +1 -1
- package/dist/map/engines.d.ts +1 -1
- package/dist/map/engines.js +1 -1
- package/dist/map/engines.js.map +1 -1
- package/dist/map.js +4 -4
- package/dist/map.js.map +1 -1
- package/dist/types.d.ts +20 -0
- package/dist/types.js.map +1 -1
- package/dist/wasm/isard.d.ts +18 -12
- package/dist/wasm/isard.js +52 -20
- package/dist/wasm/isard_core.d.ts +13 -12
- package/dist/wasm/isard_core.js +42 -20
- package/package.json +1 -1
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 { QualitySettings } from './map/quality.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\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 /** 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\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}\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}\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/** 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.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 /** 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 /** 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\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?: Tiles3dDrape | undefined;\n}\n\n/** A raster layer draped on a 3D Tiles layer's meshes, as Cesium's imagery on 3D Tiles: each point of a face takes the\n * raster's color where it stands (its longitude and latitude, whatever its height) */\nexport interface Tiles3dDrape {\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/** 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/wasm/isard.d.ts
CHANGED
|
@@ -376,13 +376,13 @@ export class Engine {
|
|
|
376
376
|
/**
|
|
377
377
|
* Raster tiles in Web Mercator; `url` holds {z}, {x} and {y}. `size`: side of the tiles' textures (256 by
|
|
378
378
|
* default); `loader`: draws each tile instead of fetching `url`, `(z, x, y, signal) => Promise<ImageBitmap |
|
|
379
|
-
* null>`, an image of `size` × `size` (null: nothing there)
|
|
379
|
+
* null>`, an image of `size` × `size` (null: nothing there); `ground: false`: draped on 3D layers only
|
|
380
380
|
*
|
|
381
381
|
* # Errors
|
|
382
382
|
*
|
|
383
383
|
* Throws (to JavaScript) when the texture holding the layer's tiles cannot be created
|
|
384
384
|
*/
|
|
385
|
-
addRaster(url: string, min_z: number, max_z: number, opacity: number, saturation: number, size: number | null | undefined, loader: ((z: number, x: number, y: number, signal: AbortSignal) => Promise<ImageBitmap | null>) | undefined): number;
|
|
385
|
+
addRaster(url: string, min_z: number, max_z: number, opacity: number, saturation: number, size: number | null | undefined, loader: ((z: number, x: number, y: number, signal: AbortSignal) => Promise<ImageBitmap | null>) | undefined, ground?: boolean | null): number;
|
|
386
386
|
/**
|
|
387
387
|
* An empty symbol layer
|
|
388
388
|
*
|
|
@@ -480,14 +480,14 @@ export class Engine {
|
|
|
480
480
|
*/
|
|
481
481
|
networkStats(id: number): NetworkStats | undefined;
|
|
482
482
|
/**
|
|
483
|
-
* `redraw` is called when the engine needs a new frame (a tile arrived)
|
|
483
|
+
* `redraw` is called when the engine needs a new frame (a tile arrived); `antialias`: multisampled (default true)
|
|
484
484
|
*
|
|
485
485
|
* # Errors
|
|
486
486
|
*
|
|
487
487
|
* Throws (to JavaScript) when the canvas gives no WebGL2 context ("WebGL2 is not available"), or when a WebGL
|
|
488
488
|
* object of the globe, the sky or the raster pass cannot be created or one of their shaders fails to compile
|
|
489
489
|
*/
|
|
490
|
-
constructor(canvas: HTMLCanvasElement, redraw: () => void);
|
|
490
|
+
constructor(canvas: HTMLCanvasElement, redraw: () => void, antialias?: boolean | null);
|
|
491
491
|
/**
|
|
492
492
|
* Drags the ground from one screen point to another (CSS pixels); in relief, the ground point grabbed stays
|
|
493
493
|
* under the cursor
|
|
@@ -900,6 +900,10 @@ export class Engine {
|
|
|
900
900
|
* it, tiles are decoded on the main thread. Set it before adding 3D Tiles layers.
|
|
901
901
|
*/
|
|
902
902
|
setTileLoader(loader: TileLoaderLike | null): void;
|
|
903
|
+
/**
|
|
904
|
+
* A raster layer draped on a 3D Tiles layer's roofs, or all its faces (`raster` undefined: none)
|
|
905
|
+
*/
|
|
906
|
+
setTiles3dDrape(id: number, raster: number | null | undefined, all_faces: boolean, opacity: number): void;
|
|
903
907
|
/**
|
|
904
908
|
* Whether the walls of a 3D Tiles layer's untextured meshes show their windows: glass by day, some lit at night
|
|
905
909
|
*/
|
|
@@ -933,14 +937,14 @@ export class Engine {
|
|
|
933
937
|
* end of each), its line pieces (`pieces::Piece` as bytes), the line table (feature and length of each line),
|
|
934
938
|
* per sublayer its pieces (`line_ranges`: first, end), the blocks of its extrusion sublayers (`shapes::Block` as
|
|
935
939
|
* bytes), their triangles, per sublayer its blocks' triangles (`block_ranges`: first, end), the extent of its
|
|
936
|
-
* points (`bounds`: min x, min y, max x, max y), `
|
|
940
|
+
* points (`bounds`: min x, min y, max x, max y), its features' sublayers (one each, as for `setVectorTile`)
|
|
937
941
|
*
|
|
938
942
|
* # Errors
|
|
939
943
|
*
|
|
940
944
|
* Throws (to JavaScript) when the vertices, pieces or blocks are cut short, when a WebGL object of the tile cannot be
|
|
941
945
|
* created, or when its features or lines need a table texture past the GPU's `MAX_TEXTURE_SIZE`
|
|
942
946
|
*/
|
|
943
|
-
setVectorTileMesh(id: number, key: number, points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, polygon_feature: Uint32Array, fill_start: Uint32Array, vertices: Uint8Array, indices: Uint32Array, fill_ranges: Uint32Array, prism: boolean, pieces: Uint8Array, line_table: Float32Array, line_ranges: Uint32Array, blocks: Uint8Array, block_indices: Uint32Array, block_ranges: Uint32Array, bounds: Float64Array,
|
|
947
|
+
setVectorTileMesh(id: number, key: number, points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, polygon_feature: Uint32Array, fill_start: Uint32Array, vertices: Uint8Array, indices: Uint32Array, fill_ranges: Uint32Array, prism: boolean, pieces: Uint8Array, line_table: Float32Array, line_ranges: Uint32Array, blocks: Uint8Array, block_indices: Uint32Array, block_ranges: Uint32Array, bounds: Float64Array, feature_sublayer: Uint16Array): void;
|
|
944
948
|
/**
|
|
945
949
|
* The points of tile `key` of a vector tile layer, after the tile itself (`setVectorTile`, `setVectorTileMesh`):
|
|
946
950
|
* Mercator, interleaved, each with its feature (styled as a circle's: a color, a radius and a stroke width, then the
|
|
@@ -950,7 +954,8 @@ export class Engine {
|
|
|
950
954
|
/**
|
|
951
955
|
* Adds or replaces tile `key` of a vector tile layer: its polygons as for `addFills` (`fill_start`: the first
|
|
952
956
|
* polygon of each sublayer, and the end; those of an extrusion sublayer raised into blocks), its lines as for
|
|
953
|
-
* `addLines` (`line_start`: the first line of each sublayer, and the end),
|
|
957
|
+
* `addLines` (`line_start`: the first line of each sublayer, and the end), its features' sublayers (one each, the
|
|
958
|
+
* features of a sublayer after those of the one before), styled as an
|
|
954
959
|
* extrusion layer's (`setFeatureStyle` with the key: a color, then a line's width or a block's height and base);
|
|
955
960
|
* `tile`: the corners of the tile they are cut to (west, north, east, south; empty: none), along whose edges no
|
|
956
961
|
* wall of a block rises; `roofs` and `roof_heights`: per polygon, the shape and height of its block's roof
|
|
@@ -964,7 +969,7 @@ export class Engine {
|
|
|
964
969
|
* Throws (to JavaScript) when a WebGL object of the tile cannot be created, or when its features or lines need a
|
|
965
970
|
* table texture past the GPU's `MAX_TEXTURE_SIZE`
|
|
966
971
|
*/
|
|
967
|
-
setVectorTile(id: number, key: number, points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, polygon_feature: Uint32Array, fill_start: Uint32Array, line_points: Float64Array, line_first: Uint32Array, line_feature: Uint32Array, line_start: Uint32Array,
|
|
972
|
+
setVectorTile(id: number, key: number, points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, polygon_feature: Uint32Array, fill_start: Uint32Array, line_points: Float64Array, line_first: Uint32Array, line_feature: Uint32Array, line_start: Uint32Array, feature_sublayer: Uint16Array, tile: Float64Array, roofs: Uint8Array, roof_heights: Float32Array, roof_outlines: Float64Array, roof_outline_start: Uint32Array, roof_metres: number): void;
|
|
968
973
|
/**
|
|
969
974
|
* Shows what can be seen from points, each within its range: `observers` holds 8 numbers per observer
|
|
970
975
|
* (16 at most): longitude, latitude (degrees), metres above the ground, range (metres), then to look one way
|
|
@@ -1092,7 +1097,7 @@ export interface InitOutput {
|
|
|
1092
1097
|
readonly engine_addModels: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
1093
1098
|
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];
|
|
1094
1099
|
readonly engine_addPointCloud: (a: number, b: number, c: number, d: any) => [number, number, number];
|
|
1095
|
-
readonly engine_addRaster: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number];
|
|
1100
|
+
readonly engine_addRaster: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number];
|
|
1096
1101
|
readonly engine_addSymbols: (a: number) => [number, number, number];
|
|
1097
1102
|
readonly engine_addTiles3d: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
1098
1103
|
readonly engine_addVectorTiles: (a: number) => [number, number, number];
|
|
@@ -1110,7 +1115,7 @@ export interface InitOutput {
|
|
|
1110
1115
|
readonly engine_localMatrix: (a: number, b: number, c: number, d: number) => [number, number];
|
|
1111
1116
|
readonly engine_moveLayer: (a: number, b: number, c: number) => void;
|
|
1112
1117
|
readonly engine_networkStats: (a: number, b: number) => any;
|
|
1113
|
-
readonly engine_new: (a: any, b: any) => [number, number, number];
|
|
1118
|
+
readonly engine_new: (a: any, b: any, c: number) => [number, number, number];
|
|
1114
1119
|
readonly engine_pan: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1115
1120
|
readonly engine_pick: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;
|
|
1116
1121
|
readonly engine_pointCloudInfo: (a: number, b: number) => any;
|
|
@@ -1182,12 +1187,13 @@ export interface InitOutput {
|
|
|
1182
1187
|
readonly engine_setSymbols: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number];
|
|
1183
1188
|
readonly engine_setTerrain: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
1184
1189
|
readonly engine_setTileLoader: (a: number, b: any) => void;
|
|
1190
|
+
readonly engine_setTiles3dDrape: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1185
1191
|
readonly engine_setTiles3dFacades: (a: number, b: number, c: number) => void;
|
|
1186
1192
|
readonly engine_setTiles3dFeatureColors: (a: number, b: number, c: any) => void;
|
|
1187
1193
|
readonly engine_setTiles3dStyle: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
1188
1194
|
readonly engine_setVectorSublayers: (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, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number) => void;
|
|
1189
|
-
readonly engine_setVectorTile: (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, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number, g1: number) => [number, number];
|
|
1190
|
-
readonly engine_setVectorTileMesh: (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, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number, g1: number, h1: number, i1: number) => [number, number];
|
|
1195
|
+
readonly engine_setVectorTile: (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, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number, g1: number, h1: number) => [number, number];
|
|
1196
|
+
readonly engine_setVectorTileMesh: (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, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number, g1: number, h1: number, i1: number, j1: number) => [number, number];
|
|
1191
1197
|
readonly engine_setVectorTilePoints: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
1192
1198
|
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];
|
|
1193
1199
|
readonly engine_setZoomRange: (a: number, b: number, c: number) => void;
|
package/dist/wasm/isard.js
CHANGED
|
@@ -262,7 +262,7 @@ export class Engine {
|
|
|
262
262
|
/**
|
|
263
263
|
* Raster tiles in Web Mercator; `url` holds {z}, {x} and {y}. `size`: side of the tiles' textures (256 by
|
|
264
264
|
* default); `loader`: draws each tile instead of fetching `url`, `(z, x, y, signal) => Promise<ImageBitmap |
|
|
265
|
-
* null>`, an image of `size` × `size` (null: nothing there)
|
|
265
|
+
* null>`, an image of `size` × `size` (null: nothing there); `ground: false`: draped on 3D layers only
|
|
266
266
|
*
|
|
267
267
|
* # Errors
|
|
268
268
|
*
|
|
@@ -274,12 +274,13 @@ export class Engine {
|
|
|
274
274
|
* @param {number} saturation
|
|
275
275
|
* @param {number | null | undefined} size
|
|
276
276
|
* @param {((z: number, x: number, y: number, signal: AbortSignal) => Promise<ImageBitmap | null>) | undefined} loader
|
|
277
|
+
* @param {boolean | null} [ground]
|
|
277
278
|
* @returns {number}
|
|
278
279
|
*/
|
|
279
|
-
addRaster(url, min_z, max_z, opacity, saturation, size, loader) {
|
|
280
|
+
addRaster(url, min_z, max_z, opacity, saturation, size, loader, ground) {
|
|
280
281
|
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
281
282
|
const len0 = WASM_VECTOR_LEN;
|
|
282
|
-
const ret = wasm.engine_addRaster(this.__wbg_ptr, ptr0, len0, min_z, max_z, opacity, saturation, isLikeNone(size) ? Number.MAX_SAFE_INTEGER : (size) >> 0, isLikeNone(loader) ? 0 : addToExternrefTable0(loader));
|
|
283
|
+
const ret = wasm.engine_addRaster(this.__wbg_ptr, ptr0, len0, min_z, max_z, opacity, saturation, isLikeNone(size) ? Number.MAX_SAFE_INTEGER : (size) >> 0, isLikeNone(loader) ? 0 : addToExternrefTable0(loader), isLikeNone(ground) ? 0xFFFFFF : ground ? 1 : 0);
|
|
283
284
|
if (ret[2]) {
|
|
284
285
|
throw takeFromExternrefTable0(ret[1]);
|
|
285
286
|
}
|
|
@@ -479,7 +480,7 @@ export class Engine {
|
|
|
479
480
|
return ret;
|
|
480
481
|
}
|
|
481
482
|
/**
|
|
482
|
-
* `redraw` is called when the engine needs a new frame (a tile arrived)
|
|
483
|
+
* `redraw` is called when the engine needs a new frame (a tile arrived); `antialias`: multisampled (default true)
|
|
483
484
|
*
|
|
484
485
|
* # Errors
|
|
485
486
|
*
|
|
@@ -487,9 +488,10 @@ export class Engine {
|
|
|
487
488
|
* object of the globe, the sky or the raster pass cannot be created or one of their shaders fails to compile
|
|
488
489
|
* @param {HTMLCanvasElement} canvas
|
|
489
490
|
* @param {() => void} redraw
|
|
491
|
+
* @param {boolean | null} [antialias]
|
|
490
492
|
*/
|
|
491
|
-
constructor(canvas, redraw) {
|
|
492
|
-
const ret = wasm.engine_new(canvas, redraw);
|
|
493
|
+
constructor(canvas, redraw, antialias) {
|
|
494
|
+
const ret = wasm.engine_new(canvas, redraw, isLikeNone(antialias) ? 0xFFFFFF : antialias ? 1 : 0);
|
|
493
495
|
if (ret[2]) {
|
|
494
496
|
throw takeFromExternrefTable0(ret[1]);
|
|
495
497
|
}
|
|
@@ -1467,6 +1469,16 @@ export class Engine {
|
|
|
1467
1469
|
setTileLoader(loader) {
|
|
1468
1470
|
wasm.engine_setTileLoader(this.__wbg_ptr, loader);
|
|
1469
1471
|
}
|
|
1472
|
+
/**
|
|
1473
|
+
* A raster layer draped on a 3D Tiles layer's roofs, or all its faces (`raster` undefined: none)
|
|
1474
|
+
* @param {number} id
|
|
1475
|
+
* @param {number | null | undefined} raster
|
|
1476
|
+
* @param {boolean} all_faces
|
|
1477
|
+
* @param {number} opacity
|
|
1478
|
+
*/
|
|
1479
|
+
setTiles3dDrape(id, raster, all_faces, opacity) {
|
|
1480
|
+
wasm.engine_setTiles3dDrape(this.__wbg_ptr, id, isLikeNone(raster) ? Number.MAX_SAFE_INTEGER : (raster) >>> 0, all_faces, opacity);
|
|
1481
|
+
}
|
|
1470
1482
|
/**
|
|
1471
1483
|
* Whether the walls of a 3D Tiles layer's untextured meshes show their windows: glass by day, some lit at night
|
|
1472
1484
|
* @param {number} id
|
|
@@ -1550,7 +1562,7 @@ export class Engine {
|
|
|
1550
1562
|
* end of each), its line pieces (`pieces::Piece` as bytes), the line table (feature and length of each line),
|
|
1551
1563
|
* per sublayer its pieces (`line_ranges`: first, end), the blocks of its extrusion sublayers (`shapes::Block` as
|
|
1552
1564
|
* bytes), their triangles, per sublayer its blocks' triangles (`block_ranges`: first, end), the extent of its
|
|
1553
|
-
* points (`bounds`: min x, min y, max x, max y), `
|
|
1565
|
+
* points (`bounds`: min x, min y, max x, max y), its features' sublayers (one each, as for `setVectorTile`)
|
|
1554
1566
|
*
|
|
1555
1567
|
* # Errors
|
|
1556
1568
|
*
|
|
@@ -1574,9 +1586,9 @@ export class Engine {
|
|
|
1574
1586
|
* @param {Uint32Array} block_indices
|
|
1575
1587
|
* @param {Uint32Array} block_ranges
|
|
1576
1588
|
* @param {Float64Array} bounds
|
|
1577
|
-
* @param {
|
|
1589
|
+
* @param {Uint16Array} feature_sublayer
|
|
1578
1590
|
*/
|
|
1579
|
-
setVectorTileMesh(id, key, points, ring_start, polygon_start, polygon_feature, fill_start, vertices, indices, fill_ranges, prism, pieces, line_table, line_ranges, blocks, block_indices, block_ranges, bounds,
|
|
1591
|
+
setVectorTileMesh(id, key, points, ring_start, polygon_start, polygon_feature, fill_start, vertices, indices, fill_ranges, prism, pieces, line_table, line_ranges, blocks, block_indices, block_ranges, bounds, feature_sublayer) {
|
|
1580
1592
|
const ptr0 = passArrayF64ToWasm0(points, wasm.__wbindgen_malloc);
|
|
1581
1593
|
const len0 = WASM_VECTOR_LEN;
|
|
1582
1594
|
const ptr1 = passArray32ToWasm0(ring_start, wasm.__wbindgen_malloc);
|
|
@@ -1607,7 +1619,9 @@ export class Engine {
|
|
|
1607
1619
|
const len13 = WASM_VECTOR_LEN;
|
|
1608
1620
|
const ptr14 = passArrayF64ToWasm0(bounds, wasm.__wbindgen_malloc);
|
|
1609
1621
|
const len14 = WASM_VECTOR_LEN;
|
|
1610
|
-
const
|
|
1622
|
+
const ptr15 = passArray16ToWasm0(feature_sublayer, wasm.__wbindgen_malloc);
|
|
1623
|
+
const len15 = WASM_VECTOR_LEN;
|
|
1624
|
+
const ret = wasm.engine_setVectorTileMesh(this.__wbg_ptr, id, key, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, prism, ptr8, len8, ptr9, len9, ptr10, len10, ptr11, len11, ptr12, len12, ptr13, len13, ptr14, len14, ptr15, len15);
|
|
1611
1625
|
if (ret[1]) {
|
|
1612
1626
|
throw takeFromExternrefTable0(ret[0]);
|
|
1613
1627
|
}
|
|
@@ -1634,7 +1648,8 @@ export class Engine {
|
|
|
1634
1648
|
/**
|
|
1635
1649
|
* Adds or replaces tile `key` of a vector tile layer: its polygons as for `addFills` (`fill_start`: the first
|
|
1636
1650
|
* polygon of each sublayer, and the end; those of an extrusion sublayer raised into blocks), its lines as for
|
|
1637
|
-
* `addLines` (`line_start`: the first line of each sublayer, and the end),
|
|
1651
|
+
* `addLines` (`line_start`: the first line of each sublayer, and the end), its features' sublayers (one each, the
|
|
1652
|
+
* features of a sublayer after those of the one before), styled as an
|
|
1638
1653
|
* extrusion layer's (`setFeatureStyle` with the key: a color, then a line's width or a block's height and base);
|
|
1639
1654
|
* `tile`: the corners of the tile they are cut to (west, north, east, south; empty: none), along whose edges no
|
|
1640
1655
|
* wall of a block rises; `roofs` and `roof_heights`: per polygon, the shape and height of its block's roof
|
|
@@ -1658,7 +1673,7 @@ export class Engine {
|
|
|
1658
1673
|
* @param {Uint32Array} line_first
|
|
1659
1674
|
* @param {Uint32Array} line_feature
|
|
1660
1675
|
* @param {Uint32Array} line_start
|
|
1661
|
-
* @param {
|
|
1676
|
+
* @param {Uint16Array} feature_sublayer
|
|
1662
1677
|
* @param {Float64Array} tile
|
|
1663
1678
|
* @param {Uint8Array} roofs
|
|
1664
1679
|
* @param {Float32Array} roof_heights
|
|
@@ -1666,7 +1681,7 @@ export class Engine {
|
|
|
1666
1681
|
* @param {Uint32Array} roof_outline_start
|
|
1667
1682
|
* @param {number} roof_metres
|
|
1668
1683
|
*/
|
|
1669
|
-
setVectorTile(id, key, points, ring_start, polygon_start, polygon_feature, fill_start, line_points, line_first, line_feature, line_start,
|
|
1684
|
+
setVectorTile(id, key, points, ring_start, polygon_start, polygon_feature, fill_start, line_points, line_first, line_feature, line_start, feature_sublayer, tile, roofs, roof_heights, roof_outlines, roof_outline_start, roof_metres) {
|
|
1670
1685
|
const ptr0 = passArrayF64ToWasm0(points, wasm.__wbindgen_malloc);
|
|
1671
1686
|
const len0 = WASM_VECTOR_LEN;
|
|
1672
1687
|
const ptr1 = passArray32ToWasm0(ring_start, wasm.__wbindgen_malloc);
|
|
@@ -1685,17 +1700,19 @@ export class Engine {
|
|
|
1685
1700
|
const len7 = WASM_VECTOR_LEN;
|
|
1686
1701
|
const ptr8 = passArray32ToWasm0(line_start, wasm.__wbindgen_malloc);
|
|
1687
1702
|
const len8 = WASM_VECTOR_LEN;
|
|
1688
|
-
const ptr9 =
|
|
1703
|
+
const ptr9 = passArray16ToWasm0(feature_sublayer, wasm.__wbindgen_malloc);
|
|
1689
1704
|
const len9 = WASM_VECTOR_LEN;
|
|
1690
|
-
const ptr10 =
|
|
1705
|
+
const ptr10 = passArrayF64ToWasm0(tile, wasm.__wbindgen_malloc);
|
|
1691
1706
|
const len10 = WASM_VECTOR_LEN;
|
|
1692
|
-
const ptr11 =
|
|
1707
|
+
const ptr11 = passArray8ToWasm0(roofs, wasm.__wbindgen_malloc);
|
|
1693
1708
|
const len11 = WASM_VECTOR_LEN;
|
|
1694
|
-
const ptr12 =
|
|
1709
|
+
const ptr12 = passArrayF32ToWasm0(roof_heights, wasm.__wbindgen_malloc);
|
|
1695
1710
|
const len12 = WASM_VECTOR_LEN;
|
|
1696
|
-
const ptr13 =
|
|
1711
|
+
const ptr13 = passArrayF64ToWasm0(roof_outlines, wasm.__wbindgen_malloc);
|
|
1697
1712
|
const len13 = WASM_VECTOR_LEN;
|
|
1698
|
-
const
|
|
1713
|
+
const ptr14 = passArray32ToWasm0(roof_outline_start, wasm.__wbindgen_malloc);
|
|
1714
|
+
const len14 = WASM_VECTOR_LEN;
|
|
1715
|
+
const ret = wasm.engine_setVectorTile(this.__wbg_ptr, id, key, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8, ptr9, len9, ptr10, len10, ptr11, len11, ptr12, len12, ptr13, len13, ptr14, len14, roof_metres);
|
|
1699
1716
|
if (ret[1]) {
|
|
1700
1717
|
throw takeFromExternrefTable0(ret[0]);
|
|
1701
1718
|
}
|
|
@@ -2671,6 +2688,14 @@ function __wbg_get_imports() {
|
|
|
2671
2688
|
const ret = arg0.isContextLost();
|
|
2672
2689
|
return ret;
|
|
2673
2690
|
},
|
|
2691
|
+
__wbg_isEnabled_a3522bc4076e6296: function(arg0, arg1) {
|
|
2692
|
+
const ret = arg0.isEnabled(arg1 >>> 0);
|
|
2693
|
+
return ret;
|
|
2694
|
+
},
|
|
2695
|
+
__wbg_isEnabled_acb9d89bd88c16bd: function(arg0, arg1) {
|
|
2696
|
+
const ret = arg0.isEnabled(arg1 >>> 0);
|
|
2697
|
+
return ret;
|
|
2698
|
+
},
|
|
2674
2699
|
__wbg_is_4b278c0bd3caba97: function(arg0, arg1) {
|
|
2675
2700
|
const ret = Object.is(arg0, arg1);
|
|
2676
2701
|
return ret;
|
|
@@ -3185,7 +3210,7 @@ function __wbg_get_imports() {
|
|
|
3185
3210
|
return ret;
|
|
3186
3211
|
},
|
|
3187
3212
|
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
3188
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
3213
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 234, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
3189
3214
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_2e566c63402fe7fa___convert__closures_____invoke___wasm_bindgen_2e566c63402fe7fa___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_2e566c63402fe7fa___JsError___true_);
|
|
3190
3215
|
return ret;
|
|
3191
3216
|
},
|
|
@@ -3508,6 +3533,13 @@ function makeMutClosure(arg0, arg1, f) {
|
|
|
3508
3533
|
return real;
|
|
3509
3534
|
}
|
|
3510
3535
|
|
|
3536
|
+
function passArray16ToWasm0(arg, malloc) {
|
|
3537
|
+
const ptr = malloc(arg.length * 2, 2) >>> 0;
|
|
3538
|
+
getUint16ArrayMemory0().set(arg, ptr / 2);
|
|
3539
|
+
WASM_VECTOR_LEN = arg.length;
|
|
3540
|
+
return ptr;
|
|
3541
|
+
}
|
|
3542
|
+
|
|
3511
3543
|
function passArray32ToWasm0(arg, malloc) {
|
|
3512
3544
|
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
3513
3545
|
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
@@ -150,13 +150,13 @@ export class Engine {
|
|
|
150
150
|
/**
|
|
151
151
|
* Raster tiles in Web Mercator; `url` holds {z}, {x} and {y}. `size`: side of the tiles' textures (256 by
|
|
152
152
|
* default); `loader`: draws each tile instead of fetching `url`, `(z, x, y, signal) => Promise<ImageBitmap |
|
|
153
|
-
* null>`, an image of `size` × `size` (null: nothing there)
|
|
153
|
+
* null>`, an image of `size` × `size` (null: nothing there); `ground: false`: draped on 3D layers only
|
|
154
154
|
*
|
|
155
155
|
* # Errors
|
|
156
156
|
*
|
|
157
157
|
* Throws (to JavaScript) when the texture holding the layer's tiles cannot be created
|
|
158
158
|
*/
|
|
159
|
-
addRaster(url: string, min_z: number, max_z: number, opacity: number, saturation: number, size: number | null | undefined, loader: ((z: number, x: number, y: number, signal: AbortSignal) => Promise<ImageBitmap | null>) | undefined): number;
|
|
159
|
+
addRaster(url: string, min_z: number, max_z: number, opacity: number, saturation: number, size: number | null | undefined, loader: ((z: number, x: number, y: number, signal: AbortSignal) => Promise<ImageBitmap | null>) | undefined, ground?: boolean | null): number;
|
|
160
160
|
/**
|
|
161
161
|
* An empty symbol layer
|
|
162
162
|
*
|
|
@@ -239,14 +239,14 @@ export class Engine {
|
|
|
239
239
|
*/
|
|
240
240
|
networkStats(id: number): NetworkStats | undefined;
|
|
241
241
|
/**
|
|
242
|
-
* `redraw` is called when the engine needs a new frame (a tile arrived)
|
|
242
|
+
* `redraw` is called when the engine needs a new frame (a tile arrived); `antialias`: multisampled (default true)
|
|
243
243
|
*
|
|
244
244
|
* # Errors
|
|
245
245
|
*
|
|
246
246
|
* Throws (to JavaScript) when the canvas gives no WebGL2 context ("WebGL2 is not available"), or when a WebGL
|
|
247
247
|
* object of the globe, the sky or the raster pass cannot be created or one of their shaders fails to compile
|
|
248
248
|
*/
|
|
249
|
-
constructor(canvas: HTMLCanvasElement, redraw: () => void);
|
|
249
|
+
constructor(canvas: HTMLCanvasElement, redraw: () => void, antialias?: boolean | null);
|
|
250
250
|
/**
|
|
251
251
|
* Drags the ground from one screen point to another (CSS pixels); in relief, the ground point grabbed stays
|
|
252
252
|
* under the cursor
|
|
@@ -620,14 +620,14 @@ export class Engine {
|
|
|
620
620
|
* end of each), its line pieces (`pieces::Piece` as bytes), the line table (feature and length of each line),
|
|
621
621
|
* per sublayer its pieces (`line_ranges`: first, end), the blocks of its extrusion sublayers (`shapes::Block` as
|
|
622
622
|
* bytes), their triangles, per sublayer its blocks' triangles (`block_ranges`: first, end), the extent of its
|
|
623
|
-
* points (`bounds`: min x, min y, max x, max y), `
|
|
623
|
+
* points (`bounds`: min x, min y, max x, max y), its features' sublayers (one each, as for `setVectorTile`)
|
|
624
624
|
*
|
|
625
625
|
* # Errors
|
|
626
626
|
*
|
|
627
627
|
* Throws (to JavaScript) when the vertices, pieces or blocks are cut short, when a WebGL object of the tile cannot be
|
|
628
628
|
* created, or when its features or lines need a table texture past the GPU's `MAX_TEXTURE_SIZE`
|
|
629
629
|
*/
|
|
630
|
-
setVectorTileMesh(id: number, key: number, points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, polygon_feature: Uint32Array, fill_start: Uint32Array, vertices: Uint8Array, indices: Uint32Array, fill_ranges: Uint32Array, prism: boolean, pieces: Uint8Array, line_table: Float32Array, line_ranges: Uint32Array, blocks: Uint8Array, block_indices: Uint32Array, block_ranges: Uint32Array, bounds: Float64Array,
|
|
630
|
+
setVectorTileMesh(id: number, key: number, points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, polygon_feature: Uint32Array, fill_start: Uint32Array, vertices: Uint8Array, indices: Uint32Array, fill_ranges: Uint32Array, prism: boolean, pieces: Uint8Array, line_table: Float32Array, line_ranges: Uint32Array, blocks: Uint8Array, block_indices: Uint32Array, block_ranges: Uint32Array, bounds: Float64Array, feature_sublayer: Uint16Array): void;
|
|
631
631
|
/**
|
|
632
632
|
* The points of tile `key` of a vector tile layer, after the tile itself (`setVectorTile`, `setVectorTileMesh`):
|
|
633
633
|
* Mercator, interleaved, each with its feature (styled as a circle's: a color, a radius and a stroke width, then the
|
|
@@ -637,7 +637,8 @@ export class Engine {
|
|
|
637
637
|
/**
|
|
638
638
|
* Adds or replaces tile `key` of a vector tile layer: its polygons as for `addFills` (`fill_start`: the first
|
|
639
639
|
* polygon of each sublayer, and the end; those of an extrusion sublayer raised into blocks), its lines as for
|
|
640
|
-
* `addLines` (`line_start`: the first line of each sublayer, and the end),
|
|
640
|
+
* `addLines` (`line_start`: the first line of each sublayer, and the end), its features' sublayers (one each, the
|
|
641
|
+
* features of a sublayer after those of the one before), styled as an
|
|
641
642
|
* extrusion layer's (`setFeatureStyle` with the key: a color, then a line's width or a block's height and base);
|
|
642
643
|
* `tile`: the corners of the tile they are cut to (west, north, east, south; empty: none), along whose edges no
|
|
643
644
|
* wall of a block rises; `roofs` and `roof_heights`: per polygon, the shape and height of its block's roof
|
|
@@ -651,7 +652,7 @@ export class Engine {
|
|
|
651
652
|
* Throws (to JavaScript) when a WebGL object of the tile cannot be created, or when its features or lines need a
|
|
652
653
|
* table texture past the GPU's `MAX_TEXTURE_SIZE`
|
|
653
654
|
*/
|
|
654
|
-
setVectorTile(id: number, key: number, points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, polygon_feature: Uint32Array, fill_start: Uint32Array, line_points: Float64Array, line_first: Uint32Array, line_feature: Uint32Array, line_start: Uint32Array,
|
|
655
|
+
setVectorTile(id: number, key: number, points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, polygon_feature: Uint32Array, fill_start: Uint32Array, line_points: Float64Array, line_first: Uint32Array, line_feature: Uint32Array, line_start: Uint32Array, feature_sublayer: Uint16Array, tile: Float64Array, roofs: Uint8Array, roof_heights: Float32Array, roof_outlines: Float64Array, roof_outline_start: Uint32Array, roof_metres: number): void;
|
|
655
656
|
/**
|
|
656
657
|
* Shows what can be seen from points, each within its range: `observers` holds 8 numbers per observer
|
|
657
658
|
* (16 at most): longitude, latitude (degrees), metres above the ground, range (metres), then to look one way
|
|
@@ -747,7 +748,7 @@ export interface InitOutput {
|
|
|
747
748
|
readonly engine_addGround: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number];
|
|
748
749
|
readonly engine_addLines: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => [number, number, number];
|
|
749
750
|
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];
|
|
750
|
-
readonly engine_addRaster: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number];
|
|
751
|
+
readonly engine_addRaster: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number];
|
|
751
752
|
readonly engine_addSymbols: (a: number) => [number, number, number];
|
|
752
753
|
readonly engine_addVectorTiles: (a: number) => [number, number, number];
|
|
753
754
|
readonly engine_bounds: (a: number) => [number, number];
|
|
@@ -763,7 +764,7 @@ export interface InitOutput {
|
|
|
763
764
|
readonly engine_localMatrix: (a: number, b: number, c: number, d: number) => [number, number];
|
|
764
765
|
readonly engine_moveLayer: (a: number, b: number, c: number) => void;
|
|
765
766
|
readonly engine_networkStats: (a: number, b: number) => any;
|
|
766
|
-
readonly engine_new: (a: any, b: any) => [number, number, number];
|
|
767
|
+
readonly engine_new: (a: any, b: any, c: number) => [number, number, number];
|
|
767
768
|
readonly engine_pan: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
768
769
|
readonly engine_pick: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;
|
|
769
770
|
readonly engine_pollPick: (a: number) => any;
|
|
@@ -826,8 +827,8 @@ export interface InitOutput {
|
|
|
826
827
|
readonly engine_setSymbols: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number];
|
|
827
828
|
readonly engine_setTerrain: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
828
829
|
readonly engine_setVectorSublayers: (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, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number) => void;
|
|
829
|
-
readonly engine_setVectorTile: (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, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number, g1: number) => [number, number];
|
|
830
|
-
readonly engine_setVectorTileMesh: (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, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number, g1: number, h1: number, i1: number) => [number, number];
|
|
830
|
+
readonly engine_setVectorTile: (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, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number, g1: number, h1: number) => [number, number];
|
|
831
|
+
readonly engine_setVectorTileMesh: (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, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number, g1: number, h1: number, i1: number, j1: number) => [number, number];
|
|
831
832
|
readonly engine_setVectorTilePoints: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
832
833
|
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];
|
|
833
834
|
readonly engine_setZoomRange: (a: number, b: number, c: number) => void;
|