isard 2.4.2 → 2.6.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 +39 -0
- package/README.md +2 -3
- package/dist/data/ogcapi.d.ts +64 -0
- package/dist/data/ogcapi.js +130 -0
- package/dist/data/ogcapi.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/isard_grid_bg.wasm +0 -0
- package/dist/isard_tess_bg.wasm +0 -0
- package/dist/isard_webgl2_bg.wasm +0 -0
- package/dist/isard_webgpu_bg.wasm +0 -0
- package/dist/layers/tiles3d.d.ts +19 -1
- package/dist/layers/tiles3d.js +44 -0
- package/dist/layers/tiles3d.js.map +1 -1
- package/dist/map.d.ts +11 -1
- package/dist/map.js +29 -0
- package/dist/map.js.map +1 -1
- package/dist/react/IsardMap.d.ts +1 -0
- package/dist/react/IsardMap.js +1 -0
- package/dist/react/IsardMap.js.map +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react/sources.d.ts +3 -0
- package/dist/react/sources.js +5 -0
- package/dist/react/sources.js.map +1 -1
- package/dist/types.d.ts +24 -0
- package/dist/types.js.map +1 -1
- package/dist/wasm/isard_webgl2.d.ts +27 -2
- package/dist/wasm/isard_webgl2.js +89 -11
- package/dist/wasm/isard_webgpu.d.ts +27 -2
- package/dist/wasm/isard_webgpu.js +89 -11
- package/package.json +1 -1
package/dist/react/index.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export { Panel, type PanelProps } from './Panel.tsx';
|
|
|
31
31
|
export { Popup, type PopupProps } from './Popup.tsx';
|
|
32
32
|
export { FirstPerson, Panoramas, type PanoramasProps, Photo, type PhotoProps } from './Street.tsx';
|
|
33
33
|
export { Swipe, SwipeOther, type SwipeProps } from './Swipe.tsx';
|
|
34
|
-
export { collada, geojson, gpx, type Source, source, useLoaded, useLoadedEvent, useSource, wfs, windGrids, } from './sources.ts';
|
|
34
|
+
export { collada, geojson, gpx, ogcFeatures, type Source, source, useLoaded, useLoadedEvent, useSource, wfs, windGrids, } from './sources.ts';
|
|
35
35
|
export { Geometry, type GeometryProps, VectorGeometry, type VectorGeometryProps } from './VectorGeometry.tsx';
|
|
36
36
|
export { Extrusions, Furniture, Labels, Lamps, Raster, StreetWind, Trees, useVectorTiles, VectorTiles, type VectorTilesProps, } from './VectorTiles.tsx';
|
|
37
37
|
export { Viewshed } from './Viewshed.tsx';
|
package/dist/react/index.js
CHANGED
|
@@ -26,7 +26,7 @@ export { Panel } from "./Panel.js";
|
|
|
26
26
|
export { Popup } from "./Popup.js";
|
|
27
27
|
export { FirstPerson, Panoramas, Photo } from "./Street.js";
|
|
28
28
|
export { Swipe, SwipeOther } from "./Swipe.js";
|
|
29
|
-
export { collada, geojson, gpx, source, useLoaded, useLoadedEvent, useSource, wfs, windGrids, } from "./sources.js";
|
|
29
|
+
export { collada, geojson, gpx, ogcFeatures, source, useLoaded, useLoadedEvent, useSource, wfs, windGrids, } from "./sources.js";
|
|
30
30
|
export { Geometry, VectorGeometry } from "./VectorGeometry.js";
|
|
31
31
|
export { Extrusions, Furniture, Labels, Lamps, Raster, StreetWind, Trees, useVectorTiles, VectorTiles, } from "./VectorTiles.js";
|
|
32
32
|
export { Viewshed } from "./Viewshed.js";
|
package/dist/react/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAOH,OAAO,EAAE,UAAU,EAAwB,MAAM,iBAAkB,CAAC;AACpE,OAAO,EAAE,OAAO,EAAqB,MAAM,cAAe,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAyB,MAAM,kBAAmB,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;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AAE,UAAU,EAAmB,MAAM,YAAa,CAAC;AACjE,OAAO,EACL,OAAO,EACP,OAAO,EACP,GAAG,EACH,WAAW,EAEX,MAAM,EACN,SAAS,EACT,cAAc,EACd,SAAS,EACT,GAAG,EACH,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAsB,cAAc,EAA4B,MAAM,qBAAsB,CAAC;AAC9G,OAAO,EACL,UAAU,EACV,SAAS,EACT,MAAM,EACN,KAAK,EACL,MAAM,EACN,UAAU,EACV,KAAK,EACL,cAAc,EACd,WAAW,GAEZ,MAAM,kBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAgB,CAAC","sourcesContent":["/**\n * Isard in React: the map, its layers, markers, popups, panels and effects as components, created when they mount,\n * updated by the least their props need and removed when they unmount.\n *\n * ```tsx\n * <IsardMap preset=\"ign-3d\" center={[2.35, 48.85]} zoom={15} style={{ height: 400 }}>\n * <VectorTiles style={OPENFREEMAP_STYLES.liberty}>\n * <Geometry roofs=\"generated\" />\n * <Trees />\n * <Labels />\n * </VectorTiles>\n * <Layer type=\"lines\" data={routes} color=\"#0057b8\" width={3} />\n * <Marker lonLat={[2.35, 48.85]}><Popup>Here</Popup></Marker>\n * </IsardMap>\n * ```\n */\n\nexport type { Layer as LayerHandle } from '../layers/layers.ts';\nexport type { GeoMap, LayerSpec } from '../map.ts';\nexport type { LonLat } from '../types.ts';\nexport type { Marker as MarkerHandle, Panel as PanelHandle, Popup as PopupHandle } from '../ui/overlay.ts';\nexport type { Camera } from '../wasm/isard_webgpu.js';\nexport { ClipVolume, type ClipVolumeProps } from './ClipVolume.tsx';\nexport { Control, type ControlProps } from './Control.tsx';\nexport { CustomLayer, type CustomLayerProps } from './CustomLayer.tsx';\nexport { useMap, useMapEvent, useMapRedraw } from './context.ts';\nexport { Ifc, type IfcProps, useFrame } from './Ifc.tsx';\nexport { IsardMap, type IsardMapProps, type MapEventProps } from './IsardMap.tsx';\nexport { Layer, type LayerHandles, type LayerProps, type LayerType } from './Layer.tsx';\nexport { Marker, type MarkerProps } from './Marker.tsx';\nexport { Panel, type PanelProps } from './Panel.tsx';\nexport { Popup, type PopupProps } from './Popup.tsx';\nexport { FirstPerson, Panoramas, type PanoramasProps, Photo, type PhotoProps } from './Street.tsx';\nexport { Swipe, SwipeOther, type SwipeProps } from './Swipe.tsx';\nexport {\n collada,\n geojson,\n gpx,\n ogcFeatures,\n type Source,\n source,\n useLoaded,\n useLoadedEvent,\n useSource,\n wfs,\n windGrids,\n} from './sources.ts';\nexport { Geometry, type GeometryProps, VectorGeometry, type VectorGeometryProps } from './VectorGeometry.tsx';\nexport {\n Extrusions,\n Furniture,\n Labels,\n Lamps,\n Raster,\n StreetWind,\n Trees,\n useVectorTiles,\n VectorTiles,\n type VectorTilesProps,\n} from './VectorTiles.tsx';\nexport { Viewshed } from './Viewshed.tsx';\n"]}
|
package/dist/react/sources.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* the source changes (its key), given up when the component goes; React's strict mode, mounting twice, loads once what
|
|
6
6
|
* it keeps. A source is plain data compared by its key: written inline at each render, it loads nothing again.
|
|
7
7
|
*/
|
|
8
|
+
import type { OgcFeaturesOptions } from '../data/ogcapi.ts';
|
|
8
9
|
import type * as Grids from '../grids.ts';
|
|
9
10
|
import type { FeatureCollection, Properties } from '../layers/features.ts';
|
|
10
11
|
import type { TimedField } from '../layers/flow.ts';
|
|
@@ -27,6 +28,8 @@ export declare const wfs: <P = Properties>(typeName: string, box: [west: number,
|
|
|
27
28
|
count?: number;
|
|
28
29
|
srsName?: string;
|
|
29
30
|
}) => Source<FeatureCollection<P>>;
|
|
31
|
+
/** The features of a collection of an OGC API - Features service (`ogcFeatures`): by box, by a CQL2 filter */
|
|
32
|
+
export declare const ogcFeatures: <P = Properties>(url: string, collection: string, options?: Omit<OgcFeaturesOptions, "signal">) => Source<FeatureCollection<P>>;
|
|
30
33
|
/** A COLLADA model read into a glTF binary (`loadCollada`): a models layer's `data` */
|
|
31
34
|
export declare const collada: (url: string) => Source<Uint8Array<ArrayBuffer>>;
|
|
32
35
|
/** The wind of a GRIB2 or NetCDF file (`map.readGrids`, `windFields`): a flow layer's `fields`, read by the map's
|
package/dist/react/sources.js
CHANGED
|
@@ -31,6 +31,11 @@ export const wfs = (typeName, box, options = {}) => source(`wfs:${JSON.stringify
|
|
|
31
31
|
const { geoplateformeWfs } = await import("../geoplateforme.js");
|
|
32
32
|
return geoplateformeWfs(typeName, box, { ...options, signal });
|
|
33
33
|
});
|
|
34
|
+
/** The features of a collection of an OGC API - Features service (`ogcFeatures`): by box, by a CQL2 filter */
|
|
35
|
+
export const ogcFeatures = (url, collection, options = {}) => source(`ogcFeatures:${JSON.stringify([url, collection, options])}`, async (signal) => {
|
|
36
|
+
const { ogcFeatures: load } = await import("../data/ogcapi.js");
|
|
37
|
+
return load(url, collection, { ...options, signal });
|
|
38
|
+
});
|
|
34
39
|
/** A COLLADA model read into a glTF binary (`loadCollada`): a models layer's `data` */
|
|
35
40
|
export const collada = (url) => source(`collada:${url}`, async (signal) => {
|
|
36
41
|
const { loadCollada } = await import("../data/collada.js");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sources.js","sourceRoot":"","sources":["../../src/react/sources.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAKpD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAUtC,+FAA+F;AAC/F,MAAM,CAAC,MAAM,MAAM,GAAG,CAAI,GAAW,EAAE,IAAyC,EAAa,EAAE,CAAC,CAAC;IAC/F,OAAO,EAAE,GAAG;IACZ,IAAI;CACL,CAAC,CAAC;AAEH,qBAAqB;AACrB,MAAM,CAAC,MAAM,OAAO,GAAG,CAAiB,GAAW,EAAgC,EAAE,CACnF,MAAM,CAAC,WAAW,GAAG,EAAE,E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AAC,MAAM,SAAS,GAAG,CACvB,MAA6B,EAC7B,UAA4E,EAAE,EAC/D,EAAE;IACjB,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,MAAM,CAAC;IAElC,wCAAwC;IACxC,OAAO,SAAS,CACd,MAAM,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAC3D,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC,EAC/E,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CACpD,CAAC;AACJ,CAAC,CAAC;AAEF,4FAA4F;AAC5F,MAAM,CAAC,MAAM,cAAc,GAAG,CAAI,KAAoB,EAAE,QAA0C,EAAQ,EAAE;IAC1G,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAEhC,MAAM,CAAC,OAAO,GAAG,QAAQ,CAAC;IAC1B,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,KAAK,KAAK,SAAS;YAAE,MAAM,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;IACnD,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AACd,CAAC,CAAC","sourcesContent":["/**\n * What a component loads, declared rather than written as an effect: `useSource(wfs(typeName, box))` gives the\n * Géoplateforme's features once fetched (undefined before), to give to a `<Layer>`'s `data`; `geojson(url)`,\n * `gpx(url)`, `collada(url)`, `windGrids(url)` the same, `useLoaded(key, load)` anything else. Loaded again only when\n * the source changes (its key), given up when the component goes; React's strict mode, mounting twice, loads once what\n * it keeps. A source is plain data compared by its key: written inline at each render, it loads nothing again.\n */\n\nimport { useEffect, useRef, useState } from 'react';\nimport type * as Grids from '../grids.ts';\nimport type { FeatureCollection, Properties } from '../layers/features.ts';\nimport type { TimedField } from '../layers/flow.ts';\nimport type { GeoMap } from '../map.ts';\nimport { useMap } from './context.ts';\n\n/** Something a component loads: `$source` tells two sources apart (the same key, the same thing loaded), `load` loads\n * it, given up when `signal` aborts; `map` the map it needs (loaded inside an `<IsardMap>` then, once the map is there) */\nexport interface Source<T> {\n readonly $source: string;\n readonly map?: true;\n load(signal: AbortSignal, map: GeoMap | undefined): Promise<T>;\n}\n\n/** A source of its own: `key` the same for the same thing loaded (its URL and options, say) */\nexport const source = <T>(key: string, load: (signal: AbortSignal) => Promise<T>): Source<T> => ({\n $source: key,\n load,\n});\n\n/** A GeoJSON file */\nexport const geojson = <P = Properties>(url: string): Source<FeatureCollection<P>> =>\n source(`geojson:${url}`, async (signal) => {\n const response = await fetch(url, { signal });\n\n if (!response.ok) throw new Error(`${url}: ${response.status}`);\n\n return response.json();\n });\n\n/** A GPX file's tracks, routes and waypoints (`parseGpx`) */\nexport const gpx = <P = Properties>(url: string): Source<FeatureCollection<P>> =>\n source(`gpx:${url}`, async (signal) => {\n const [{ parseGpx }, response] = await Promise.all([import('../data/gpx.ts'), fetch(url, { signal })]);\n\n if (!response.ok) throw new Error(`${url}: ${response.status}`);\n\n return parseGpx<P>(await response.text());\n });\n\n/** The Géoplateforme's features of a type in a box (`geoplateformeWfs`) */\nexport const wfs = <P = Properties>(\n typeName: string,\n box: [west: number, south: number, east: number, north: number],\n options: { count?: number; srsName?: string } = {},\n): Source<FeatureCollection<P>> =>\n source(`wfs:${JSON.stringify([typeName, box, options])}`, async (signal) => {\n const { geoplateformeWfs } = await import('../geoplateforme.ts');\n\n return geoplateformeWfs<P>(typeName, box, { ...options, signal });\n });\n\n/** A COLLADA model read into a glTF binary (`loadCollada`): a models layer's `data` */\nexport const collada = (url: string): Source<Uint8Array<ArrayBuffer>> =>\n source(`collada:${url}`, async (signal) => {\n const { loadCollada } = await import('../data/collada.ts');\n\n return loadCollada(url, { signal });\n });\n\n/** The wind of a GRIB2 or NetCDF file (`map.readGrids`, `windFields`): a flow layer's `fields`, read by the map's\n * workers (inside an `<IsardMap>`) */\nexport const windGrids = (url: string, options: Parameters<typeof Grids.windFields>[1] = {}): Source<TimedField[]> => ({\n $source: `wind:${url}:${JSON.stringify(options)}`,\n map: true,\n load: async (_, map) => {\n if (!map) throw new Error('windGrids: no map');\n\n const { windFields } = await import('../grids.ts');\n\n return windFields(await map.readGrids(url), options);\n },\n});\n\n/**\n * What `load` gives, once loaded (undefined before, or when it failed: `onError`). Loaded again when `key` changes (a\n * string, or an object compared by identity: `useStableOptions`'), given up when the component goes (its signal\n * aborted), what it gave let go then by `dispose`; nothing loaded while `key` is undefined\n */\nexport const useLoaded = <T>(\n key: unknown,\n load: (signal: AbortSignal) => Promise<T>,\n { onError = console.error, dispose }: { onError?: (error: unknown) => void; dispose?: (value: T) => void } = {},\n): T | undefined => {\n const [loaded, setLoaded] = useState<{ key: unknown; value: T }>();\n // Read when the key changes only: inline functions at each render load nothing again\n const latest = useRef({ load, onError, dispose });\n\n latest.current = { load, onError, dispose };\n // Loading while mounted and the key the same; a strict mode's first mount aborted, what it gave let go\n useEffect(() => {\n if (key === undefined) return;\n\n const controller = new AbortController();\n const kept: { value?: T } = {};\n const { load, onError, dispose } = latest.current;\n\n load(controller.signal).then(\n (value) => {\n if (controller.signal.aborted) {\n dispose?.(value);\n\n return;\n }\n kept.value = value;\n setLoaded({ key, value });\n },\n (error: unknown) => {\n if (!controller.signal.aborted) onError(error);\n },\n );\n\n return () => {\n controller.abort();\n if (kept.value !== undefined) dispose?.(kept.value);\n };\n }, [key]);\n\n return loaded && loaded.key === key ? loaded.value : undefined;\n};\n\n/** What a source loads, once loaded (undefined before; none without a source). A source needing the map takes the one\n * around, or `map` (outside an `<IsardMap>`: the one its `onLoad` gave); a failure given to `onError` */\nexport const useSource = <T>(\n source: Source<T> | undefined,\n options: { map?: GeoMap | undefined; onError?: (error: unknown) => void } = {},\n): T | undefined => {\n const around = useMap();\n const map = options.map ?? around;\n\n // A source needing the map waits for it\n return useLoaded(\n source && (!source.map || map) ? source.$source : undefined,\n (signal) => source?.load(signal, map) ?? Promise.reject(new Error('no source')),\n options.onError ? { onError: options.onError } : {},\n );\n};\n\n/** Calls `listener` once with each value loaded (the listener may change at each render) */\nexport const useLoadedEvent = <T>(value: T | undefined, listener: ((value: T) => void) | undefined): void => {\n const latest = useRef(listener);\n\n latest.current = listener;\n useEffect(() => {\n if (value !== undefined) latest.current?.(value);\n }, [value]);\n};\n"]}
|
|
1
|
+
{"version":3,"file":"sources.js","sourceRoot":"","sources":["../../src/react/sources.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAMpD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAUtC,+FAA+F;AAC/F,MAAM,CAAC,MAAM,MAAM,GAAG,CAAI,GAAW,EAAE,IAAyC,EAAa,EAAE,CAAC,CAAC;IAC/F,OAAO,EAAE,GAAG;IACZ,IAAI;CACL,CAAC,CAAC;AAEH,qBAAqB;AACrB,MAAM,CAAC,MAAM,OAAO,GAAG,CAAiB,GAAW,EAAgC,EAAE,CACnF,MAAM,CAAC,WAAW,GAAG,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;IACxC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAE9C,IAAI,CAAC,QAAQ,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,KAAK,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IAEhE,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;AACzB,CAAC,CAAC,CAAC;AAEL,6DAA6D;AAC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,KAAK,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACjE,CAAC,CAAC;AAEF;yGACyG;AACzG,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,MAA6B,EAC7B,UAA4E,EAAE,EAC/D,EAAE;IACjB,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,MAAM,CAAC;IAElC,wCAAwC;IACxC,OAAO,SAAS,CACd,MAAM,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAC3D,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC,EAC/E,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CACpD,CAAC;AACJ,CAAC,CAAC;AAEF,4FAA4F;AAC5F,MAAM,CAAC,MAAM,cAAc,GAAG,CAAI,KAAoB,EAAE,QAA0C,EAAQ,EAAE;IAC1G,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAEhC,MAAM,CAAC,OAAO,GAAG,QAAQ,CAAC;IAC1B,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,KAAK,KAAK,SAAS;YAAE,MAAM,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;IACnD,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AACd,CAAC,CAAC","sourcesContent":["/**\n * What a component loads, declared rather than written as an effect: `useSource(wfs(typeName, box))` gives the\n * Géoplateforme's features once fetched (undefined before), to give to a `<Layer>`'s `data`; `geojson(url)`,\n * `gpx(url)`, `collada(url)`, `windGrids(url)` the same, `useLoaded(key, load)` anything else. Loaded again only when\n * the source changes (its key), given up when the component goes; React's strict mode, mounting twice, loads once what\n * it keeps. A source is plain data compared by its key: written inline at each render, it loads nothing again.\n */\n\nimport { useEffect, useRef, useState } from 'react';\nimport type { OgcFeaturesOptions } from '../data/ogcapi.ts';\nimport type * as Grids from '../grids.ts';\nimport type { FeatureCollection, Properties } from '../layers/features.ts';\nimport type { TimedField } from '../layers/flow.ts';\nimport type { GeoMap } from '../map.ts';\nimport { useMap } from './context.ts';\n\n/** Something a component loads: `$source` tells two sources apart (the same key, the same thing loaded), `load` loads\n * it, given up when `signal` aborts; `map` the map it needs (loaded inside an `<IsardMap>` then, once the map is there) */\nexport interface Source<T> {\n readonly $source: string;\n readonly map?: true;\n load(signal: AbortSignal, map: GeoMap | undefined): Promise<T>;\n}\n\n/** A source of its own: `key` the same for the same thing loaded (its URL and options, say) */\nexport const source = <T>(key: string, load: (signal: AbortSignal) => Promise<T>): Source<T> => ({\n $source: key,\n load,\n});\n\n/** A GeoJSON file */\nexport const geojson = <P = Properties>(url: string): Source<FeatureCollection<P>> =>\n source(`geojson:${url}`, async (signal) => {\n const response = await fetch(url, { signal });\n\n if (!response.ok) throw new Error(`${url}: ${response.status}`);\n\n return response.json();\n });\n\n/** A GPX file's tracks, routes and waypoints (`parseGpx`) */\nexport const gpx = <P = Properties>(url: string): Source<FeatureCollection<P>> =>\n source(`gpx:${url}`, async (signal) => {\n const [{ parseGpx }, response] = await Promise.all([import('../data/gpx.ts'), fetch(url, { signal })]);\n\n if (!response.ok) throw new Error(`${url}: ${response.status}`);\n\n return parseGpx<P>(await response.text());\n });\n\n/** The Géoplateforme's features of a type in a box (`geoplateformeWfs`) */\nexport const wfs = <P = Properties>(\n typeName: string,\n box: [west: number, south: number, east: number, north: number],\n options: { count?: number; srsName?: string } = {},\n): Source<FeatureCollection<P>> =>\n source(`wfs:${JSON.stringify([typeName, box, options])}`, async (signal) => {\n const { geoplateformeWfs } = await import('../geoplateforme.ts');\n\n return geoplateformeWfs<P>(typeName, box, { ...options, signal });\n });\n\n/** The features of a collection of an OGC API - Features service (`ogcFeatures`): by box, by a CQL2 filter */\nexport const ogcFeatures = <P = Properties>(\n url: string,\n collection: string,\n options: Omit<OgcFeaturesOptions, 'signal'> = {},\n): Source<FeatureCollection<P>> =>\n source(`ogcFeatures:${JSON.stringify([url, collection, options])}`, async (signal) => {\n const { ogcFeatures: load } = await import('../data/ogcapi.ts');\n\n return load<P>(url, collection, { ...options, signal });\n });\n\n/** A COLLADA model read into a glTF binary (`loadCollada`): a models layer's `data` */\nexport const collada = (url: string): Source<Uint8Array<ArrayBuffer>> =>\n source(`collada:${url}`, async (signal) => {\n const { loadCollada } = await import('../data/collada.ts');\n\n return loadCollada(url, { signal });\n });\n\n/** The wind of a GRIB2 or NetCDF file (`map.readGrids`, `windFields`): a flow layer's `fields`, read by the map's\n * workers (inside an `<IsardMap>`) */\nexport const windGrids = (url: string, options: Parameters<typeof Grids.windFields>[1] = {}): Source<TimedField[]> => ({\n $source: `wind:${url}:${JSON.stringify(options)}`,\n map: true,\n load: async (_, map) => {\n if (!map) throw new Error('windGrids: no map');\n\n const { windFields } = await import('../grids.ts');\n\n return windFields(await map.readGrids(url), options);\n },\n});\n\n/**\n * What `load` gives, once loaded (undefined before, or when it failed: `onError`). Loaded again when `key` changes (a\n * string, or an object compared by identity: `useStableOptions`'), given up when the component goes (its signal\n * aborted), what it gave let go then by `dispose`; nothing loaded while `key` is undefined\n */\nexport const useLoaded = <T>(\n key: unknown,\n load: (signal: AbortSignal) => Promise<T>,\n { onError = console.error, dispose }: { onError?: (error: unknown) => void; dispose?: (value: T) => void } = {},\n): T | undefined => {\n const [loaded, setLoaded] = useState<{ key: unknown; value: T }>();\n // Read when the key changes only: inline functions at each render load nothing again\n const latest = useRef({ load, onError, dispose });\n\n latest.current = { load, onError, dispose };\n // Loading while mounted and the key the same; a strict mode's first mount aborted, what it gave let go\n useEffect(() => {\n if (key === undefined) return;\n\n const controller = new AbortController();\n const kept: { value?: T } = {};\n const { load, onError, dispose } = latest.current;\n\n load(controller.signal).then(\n (value) => {\n if (controller.signal.aborted) {\n dispose?.(value);\n\n return;\n }\n kept.value = value;\n setLoaded({ key, value });\n },\n (error: unknown) => {\n if (!controller.signal.aborted) onError(error);\n },\n );\n\n return () => {\n controller.abort();\n if (kept.value !== undefined) dispose?.(kept.value);\n };\n }, [key]);\n\n return loaded && loaded.key === key ? loaded.value : undefined;\n};\n\n/** What a source loads, once loaded (undefined before; none without a source). A source needing the map takes the one\n * around, or `map` (outside an `<IsardMap>`: the one its `onLoad` gave); a failure given to `onError` */\nexport const useSource = <T>(\n source: Source<T> | undefined,\n options: { map?: GeoMap | undefined; onError?: (error: unknown) => void } = {},\n): T | undefined => {\n const around = useMap();\n const map = options.map ?? around;\n\n // A source needing the map waits for it\n return useLoaded(\n source && (!source.map || map) ? source.$source : undefined,\n (signal) => source?.load(signal, map) ?? Promise.reject(new Error('no source')),\n options.onError ? { onError: options.onError } : {},\n );\n};\n\n/** Calls `listener` once with each value loaded (the listener may change at each render) */\nexport const useLoadedEvent = <T>(value: T | undefined, listener: ((value: T) => void) | undefined): void => {\n const latest = useRef(listener);\n\n latest.current = listener;\n useEffect(() => {\n if (value !== undefined) latest.current?.(value);\n }, [value]);\n};\n"]}
|
package/dist/types.d.ts
CHANGED
|
@@ -331,6 +331,30 @@ export interface FlyToOptions extends AnimationOptions {
|
|
|
331
331
|
/** Average speed in screens per second when `duration` is not given (default 1.2) */
|
|
332
332
|
speed?: number;
|
|
333
333
|
}
|
|
334
|
+
/** A box to frame (`GeoMap.fitBounds`): on the ground, or in space from a bottom to a top altitude */
|
|
335
|
+
export interface FitBox {
|
|
336
|
+
bounds: [west: number, south: number, east: number, north: number];
|
|
337
|
+
/** Metres above the ellipsoid (default 0) */
|
|
338
|
+
bottom?: number;
|
|
339
|
+
/** Metres above the ellipsoid (default `bottom`): a building's roof, a pipe's top */
|
|
340
|
+
top?: number;
|
|
341
|
+
}
|
|
342
|
+
export interface FitBoundsOptions extends FlyToOptions {
|
|
343
|
+
/** Room left around the box, CSS pixels: one for all sides, or each (default 40) */
|
|
344
|
+
padding?: number | {
|
|
345
|
+
top?: number;
|
|
346
|
+
right?: number;
|
|
347
|
+
bottom?: number;
|
|
348
|
+
left?: number;
|
|
349
|
+
};
|
|
350
|
+
/** The camera's pitch and bearing there, degrees (default the current ones) */
|
|
351
|
+
pitch?: number;
|
|
352
|
+
bearing?: number;
|
|
353
|
+
/** The closest zoom, for a small box (default the map's) */
|
|
354
|
+
maxZoom?: number;
|
|
355
|
+
/** A flight zooming out on its way (`flyTo`, a far box), else an ease (`easeTo`); `duration: 0` jumps */
|
|
356
|
+
fly?: boolean;
|
|
357
|
+
}
|
|
334
358
|
/**
|
|
335
359
|
* Tile grid of a raster's URL. 'mercator': Web Mercator (XYZ, WMTS PM), the engine's own. 'equirectangular':
|
|
336
360
|
* longitudes and latitudes (Plate Carrée, EPSG:4326-like), two 256 px tiles side by side at level 0, rows from the
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,0CAA0C","sourcesContent":["/** Public types of the `isard` package */\n\nimport type { TileGrid } from './basemap/grid.ts';\nimport type { DecoderUrls } from './decoding/decoders.ts';\nimport type { Feature, Ramp, Size } from './layers/features.ts';\nimport type { Layer } from './layers/layers.ts';\nimport type { RasterLayer } from './layers/raster.ts';\nimport type { QualitySettings } from './map/quality.ts';\nimport type { AttributionOptions } from './ui/controls.ts';\nimport type { Camera, Engine } from './wasm/isard_webgpu.js';\n\nexport type LonLat = [lon: number, lat: number];\nexport type Point = [x: number, y: number];\n\n/**\n * The named basemaps. OpenFreeMap's vector styles, OpenStreetMap data worldwide, their labels above the other layers:\n * `osm-positron` (light grey, quiet: data over it reads first), `osm-liberty` and `osm-bright` (in colour), `osm-dark`\n * (near black: bright data over it, a wind's particles, lights). The\n * Géoplateforme's (IGN, France): rasters (`ign-plan`, `ign-plan-grey`, `ign-ortho`, the aerial photographs) or vector\n * tiles with their labels (`ign-plan-vector`, `ign-plan-grey-vector`, the PLAN.IGN styles).\n */\nexport type BasemapName =\n | 'osm-positron'\n | 'osm-liberty'\n | 'osm-bright'\n | 'osm-dark'\n | 'ign-plan'\n | 'ign-plan-grey'\n | 'ign-ortho'\n | 'ign-plan-vector'\n | 'ign-plan-grey-vector'\n | 'none';\n\n/** A basemap by name (see `BasemapName`) */\nexport type Basemap = BasemapName;\n\n/**\n * The Earth's named terrain models. `'terrain-tiles'`: worldwide, the Terrain Tiles of AWS's open data registry\n * (SRTM, EU-DEM, GMTED… merged by Mapzen, 30 m in most places), the sea floor flattened at sea level. `'ign'`: France,\n * the IGN's RGE ALTI from the Géoplateforme (1 to 5 m), raised by the RAF20 geoid to heights above the ellipsoid.\n */\nexport type TerrainModel = 'terrain-tiles' | 'ign';\n\n/** How tiles encode their altitudes: `'float32'`, raw little-endian floats (`image/x-bil;bits=32`, an ArcGIS raw\n * grid); `'terrarium'`, the colors of a PNG, `R × 256 + G + B / 256 - 32768`; `'mapbox'`, those of Terrain-RGB,\n * `(R × 65536 + G × 256 + B) / 10 - 10000` */\nexport type TerrainEncoding = 'float32' | 'terrarium' | 'mapbox';\n\n/**\n * How tiles load and show. 'immediate' (default): everything visible loads, tiles show as soon as they arrive.\n * 'smooth': during flights the levels flown through are skipped, off-center tiles wait while the camera moves, tiles\n * fade in; fewer downloads, for slow networks or GPUs.\n */\nexport type LoadingMode = 'immediate' | 'smooth';\n\n/** 'globe': a sphere at low zoom, blending into Web Mercator between zooms 5 and 7, up to three levels later under a\n * tilted camera (it sees much farther than its center: the horizon stays curved) */\nexport type Projection = 'globe' | 'mercator';\n\n/** A body to draw the map on, other than the named ones (`CelestialBody`) */\nexport interface BodyOptions {\n /** Equatorial radius, metres */\n radius: number;\n /** Flattening of its ellipsoid, 0 for a sphere (default 0) */\n flattening?: number;\n /** An atmosphere: its halo around the globe, true for the Earth's light blue, or a CSS color (its alpha the\n * halo's strength) (default false) */\n atmosphere?: boolean | string;\n /** Color of the globe where no tile covers it (past the Web Mercator latitudes, 85°), a CSS color (default\n * `#808080`) */\n color?: string;\n /** Lowest and highest altitudes of its ground, metres around the ellipsoid: what its relief may raise into view\n * (default ±1 % of the radius) */\n relief?: [lowest: number, highest: number];\n}\n\n/**\n * The body the map is drawn on: 'earth' (WGS 84, the default), 'moon' (a sphere of 1 737 400 m, no atmosphere),\n * 'mars' (a sphere of 3 396 190 m, its equatorial radius, a thin dusty halo; planetocentric latitudes) or another\n * one. Zoom levels keep their meaning on screen (the Web Mercator tile pyramid), their metres follow the body:\n * altitudes, relief, buildings, 3D Tiles. Off the Earth, the map has none of the Earth's defaults: no basemap, no\n * credits, and space for its background; the Moon and Mars have NASA's relief for `terrain: true`.\n */\nexport type CelestialBody = 'earth' | 'moon' | 'mars' | BodyOptions;\n\n/** A level of the map's quality (`GeoMapOptions.quality`) */\nexport type Quality = 'high' | 'medium' | 'low';\n\nexport interface GeoMapOptions extends Partial<Camera> {\n /** The body the map is drawn on (default 'earth'); set at creation */\n body?: CelestialBody;\n /** Default 'globe' */\n projection?: Projection;\n /** Default 'immediate' */\n loading?: LoadingMode;\n /** The basemap (default 'osm-positron'; 'none' off the Earth) */\n basemap?: Basemap;\n /** Opacity of the IGN hillshade over the basemap (France, Géoplateforme), 0 for none (default 0) */\n hillshade?: number;\n /** Color behind the map (sky of tilted flat views), a CSS color (default `#f2f2f0`; black off the Earth) */\n background?: string;\n /** Space behind the globe: stars and atmosphere halo, fading out as the globe turns flat (default true) */\n sky?: boolean;\n /** The sun casting the shadows of buildings, trees, models and the relief (`setSun`); none by default */\n sun?: SunOptions;\n /** What the map draws less of on a device that cannot keep up (`setQuality`): `'high'` (the default) all of it;\n * `'medium'` at most 1.5 device pixels a CSS pixel, the 3D Tiles coarser far away; `'low'` one device pixel a CSS\n * pixel, no sun's shadows, the 3D Tiles coarser still; `'auto'` high, a level lower each time the frames stay slow\n * while the map moves (`'quality'` event) */\n quality?: Quality | 'auto';\n /** The GPU memory, megabytes, the layers' tiles (3D Tiles, point clouds, vector tiles) and the rasters' tiles may\n * hold all together: past it the tiles drawn least recently are unloaded, whichever their layer, the vector tiles\n * (those of the view) kept (`GeoMap.memory`). `'auto'` (the default): 256 on a touch screen (a phone, a tablet: iOS\n * closes a page past about a gigabyte, the page's workers included), 1024 elsewhere. Set at creation */\n memory?: number | 'auto';\n /** Multisampled antialiasing of the canvas (default true): the edges of the buildings, 3D Tiles and models smooth.\n * False draws each pixel once (lines and halos antialias themselves): wide translucent layers, a network's halo over\n * a region, cost up to four times less on an integrated GPU (MapLibre's default). Set at creation */\n antialias?: boolean;\n /** The engine on wgpu (#146): 'auto' (default) WebGPU where the browser gives an adapter, else wgpu's WebGL2 fallback;\n * 'webgpu' or 'webgl' forces one */\n renderer?: 'auto' | 'webgpu' | 'webgl2';\n /** Relief under the basemap: true for the body's terrain model (on the Earth the worldwide Terrain Tiles; NASA's on\n * the Moon and Mars: LOLA, MOLA), one of the Earth's models by name (`'ign'`: France, RGE ALTI), or its options\n * (default false; on another body, its `url` is required). Network layers are draped on it */\n terrain?: boolean | TerrainModel | TerrainOptions;\n minZoom?: number;\n maxZoom?: number;\n /** Highest pitch, degrees, up to 85 (default 70) */\n maxPitch?: number;\n /** Sky over the plane, seen when the camera is tilted towards the horizon, and the fog the ground fades into\n * (MapLibre's `setSky`); default none: the background color */\n atmosphere?: AtmosphereOptions;\n /** Mouse, touch and keyboard controls (default true) */\n interactive?: boolean;\n /** Keyboard controls once the map has the focus (it is reached with Tab): arrows pan, Shift + arrows rotate and\n * tilt, + and - zoom (Shift: two levels), 0 faces north and levels the view (default true; none when not\n * `interactive`) */\n keyboard?: boolean;\n /** Accessible name of the map, read by screen readers (default 'Map') */\n ariaLabel?: string;\n /** A preset of map options (`IGN_PRESETS`: `'ign'`, `'ign-3d'`, `'ign-ortho-3d'`), the other options over it */\n preset?: 'ign' | 'ign-3d' | 'ign-ortho-3d';\n /** The folder isard's files are served from (its engines, `isard_webgpu_bg.wasm`, `isard_webgl2_bg.wasm`, its\n * modules, `isard_points_bg.wasm`, `isard_tiles3d_bg.wasm`, `isard_tess_bg.wasm`, `isard_grid_bg.wasm`, and its\n * workers, `decoder.worker.js`, `basemap.worker.js`): one option for a bundler that moves them, the `…Url` options\n * below for each one. `isard/vite` sets it for the whole page; default next to the module */\n assetsUrl?: string | URL;\n /** Where to load the engine on WebGPU from (`isard_webgpu_bg.wasm`), when a bundler does not resolve the default URL */\n webgpuWasmUrl?: string | URL;\n /** Where to load the engine's WebGL2 fallback from (`isard_webgl2_bg.wasm`, for a browser without WebGPU), when a\n * bundler does not resolve the default URL */\n webgl2WasmUrl?: string | URL;\n /** Where the decoding workers load the point cloud module from (`isard_points_bg.wasm`, the LAZ decoder of COPC),\n * when a bundler does not resolve the default URL. Loaded with the first point cloud only */\n pointsWasmUrl?: string | URL;\n /** Where the decoding workers load the 3D Tiles module from (`isard_tiles3d_bg.wasm`: a tile's content decoded for\n * the GPU), when a bundler does not resolve the default URL. Loaded with the first tile */\n tiles3dWasmUrl?: string | URL;\n /** Where the basemap workers load the tessellation module from (`isard_tess_bg.wasm`: the vector tiles drawn as\n * geometry, `vectorTiles().vectors()`, made ready for the GPU off the main thread), when a bundler does not resolve\n * the default URL. Loaded with the first tile of geometry; without it, the main thread does that work */\n tessWasmUrl?: string | URL;\n /** Where the workers load the grid module from (`isard_grid_bg.wasm`: GRIB2 and NetCDF files read by\n * `map.readGrids`), when a bundler does not resolve the default URL. Loaded with the first file */\n gridWasmUrl?: string | URL;\n /** Where to load the vector basemap worker from, when a bundler does not resolve the default URL */\n basemapWorkerUrl?: string | URL;\n /** Texture size of the vector basemap's tiles, pixels (default 512: lines and edges sharp at every zoom on a screen\n * of pixel ratio 1). 256: a quarter of the drawing in the workers, of the uploads and of the GPU memory, for lines\n * and edges a little softer between two zoom levels (the tiles are shown 181 to 362 CSS pixels wide) */\n basemapTileSize?: number;\n /** Glyphs of the symbol layers: a URL with `{fontstack}` and `{range}` (MapLibre's glyph format; default\n * OpenFreeMap's fonts, Noto Sans). A vector basemap's labels take the glyphs of its style */\n glyphs?: string;\n /** Workers decoding 3D Tiles off the main thread: a count, or false to decode on the main thread (default: cores - 1,\n * 1 to 4). False (or 0) also decodes the PNG relief and reprojects the equirectangular rasters on the main thread,\n * else done by the vector basemap's workers */\n workers?: number | false;\n /** Where to load the decoding worker from, when a bundler does not resolve the default URL */\n workerUrl?: string | URL;\n /** Folders of the Draco and Basis Universal decoders, loaded by the workers on first use (default: the official\n * builds on gstatic.com and jsDelivr; self-host them for offline or locked-down networks). They run through\n * `new Function`: a Content Security Policy needs `'unsafe-eval'` (see `DecoderUrls`) */\n decoders?: Partial<DecoderUrls>;\n /** Credits at the bottom right: false for none, or its options (default true: the credits of the basemap,\n * hillshade and relief in use, compact on maps narrower than 640 px) */\n attributionControl?: boolean | AttributionOptions;\n}\n\nexport interface TerrainOptions {\n /** One of the Earth's named models (default `'terrain-tiles'` on the Earth); unused with a `url` */\n model?: TerrainModel;\n /** Altitudes of 256 × 256 tiles in `encoding`: a WMS GetMap URL with {bbox} (EPSG:3857 on the Earth, the body's\n * Mercator metres elsewhere: the sphere of its radius), a tile URL with {z}, {x} and {y}, or an ArcGIS image service\n * (a URL ending in `/ImageServer`), asked for raw altitudes in the body's Mercator (default: the `model`'s; on the\n * Moon and Mars, NASA's Trek LOLA and MOLA models) */\n url?: string;\n /** How the tiles of `url` encode their altitudes (default `'float32'`); `'terrarium'` and `'mapbox'` take a URL with\n * {z}, {x} and {y} */\n encoding?: TerrainEncoding;\n /** Vertical exaggeration, 1 for the true relief (default 1) */\n exaggeration?: number;\n /** Finest level of the relief, up to 15 (default 15; 14 for the Terrain Tiles, 8 for the Moon's and Mars's models). It\n * starts at level 6 on the Earth, coarser on bodies of a larger relief for their size (3 on the Moon and Mars) */\n maxZoom?: number;\n /** Altitudes over mainland France raised by the height of the RAF20 geoid (the French one, 0 away from France), to\n * heights above the ellipsoid (those of 3D Tiles); false keeps the altitudes as served (NGF-IGN69 for the IGN's)\n * (default true for the `'ign'` model, false otherwise) */\n geoid?: boolean;\n}\n\n/** Sky, horizon and fog over the plane, with the names and meanings of MapLibre's `setSky` */\nexport interface AtmosphereOptions {\n /** A CSS color (default `#9cc7ec`) */\n skyColor?: string;\n /** (default `#e8f1f8`) */\n horizonColor?: string;\n /** (default `#f2f5f8`) */\n fogColor?: string;\n /** Blend from the horizon to the sky color, share of the field of view above the horizon, 0-1 (default 0.6) */\n skyHorizonBlend?: number;\n /** Blend from the horizon to the fog color below the horizon, 0-1 (default 0.7) */\n horizonFogBlend?: number;\n /** Share of the distance to the far plane over which the ground fades into the fog, 0-1 (default 0.4) */\n fogGroundBlend?: number;\n}\n\n/** The sun casting shadows (`GeoMap.setSun`): where it stands, by date or by hand, and how dark its shadows are */\nexport interface SunOptions {\n /** The time: the sun where it stands then over the map's center (default now, unless `azimuth` and `altitude`) */\n date?: Date;\n /** Degrees clockwise from north, with `altitude`: the sun placed by hand */\n azimuth?: number;\n /** Degrees above the horizon; at or under it, no shadows */\n altitude?: number;\n /** How dark the shadows are, 0 to 1 (default 0.35) */\n opacity?: number;\n /** How dark the night is, 0 to 1: the scene tinted in its blue, the windows of the buildings and the streets of\n * `vectors()` lit, the labels light on dark. By default from the sun's altitude: falling from 6° above the horizon\n * to 6° under it */\n night?: number;\n}\n\n/** What can be seen from a point (`GeoMap.setViewshed`); with several observers, the colors, the opacity and the\n * cone's color are the first one's */\nexport interface ViewshedOptions {\n /** The observer */\n position: LonLat;\n /** Metres above the ground (default 1.7, eye level) */\n height?: number;\n /** Metres around the observer that are tinted (default 1000) */\n range?: number;\n /** A CSS color for what is seen (default `#2f9e44`) */\n visibleColor?: string;\n /** A CSS color for what is hidden (default `#e03131`) */\n hiddenColor?: string;\n /** How strongly the colors tint the scene, multiplied into it so that its textures and shading stay, 0-1 (default\n * 0.7) */\n opacity?: number;\n /** A CSS color for the cone drawn in 3D (one way only): its fan through the axis, at the eye's height and tilted\n * with it, from the eye to the range; solid where nothing hides it, faint behind the scene; none by default */\n coneColor?: string;\n /** To look one way only (a camera, a lookout), degrees clockwise from north; all around without it */\n direction?: number;\n /** Degrees above the horizon the cone looks, negative below (default 0) */\n tilt?: number;\n /** Angle of view across, degrees (default 60) */\n fov?: number;\n /** Angle of view up and down, degrees (default 40) */\n verticalFov?: number;\n}\n\n/** What every clipping volume has (`ClipVolume`) */\ninterface ClipVolumeBase {\n /** Metres of its foot above the ground (or above the ellipsoid, `altitudeReference: 'sea'`); 0 by default */\n altitude?: number;\n /** What the altitude is above: `'ground'` (the relief, the default) or `'sea'` (the ellipsoid), as the models' */\n altitudeReference?: 'ground' | 'sea';\n /** Metres up from its foot */\n height: number;\n /** What is cut: `'inside'` (the default) what lies inside the volume, `'outside'` what lies outside it */\n cut?: 'inside' | 'outside';\n /** A CSS color for the faces the cut opens, the inside of walls and floors (default `#d9cfc1`); `null` leaves them\n * open */\n sectionColor?: string | null;\n /** Handles on the volume to size and move it with the pointer: a disc on each of a box's faces, on a cylinder's rim,\n * on each of a polygon's vertices, on the top and the bottom, and one at its middle to move it; the map tells each\n * change by `'clipvolume'`. None by default */\n handles?: boolean;\n}\n\n/** A box: its foot's center, its size, its heading */\nexport interface ClipBox extends ClipVolumeBase {\n shape: 'box';\n /** The center of its foot */\n position: LonLat;\n /** Metres across its heading */\n width: number;\n /** Metres along its heading */\n length: number;\n /** Degrees clockwise from north of its length; 0 by default */\n heading?: number;\n}\n\n/** A cylinder standing up: its foot's center, its radius */\nexport interface ClipCylinder extends ClipVolumeBase {\n shape: 'cylinder';\n /** The center of its foot */\n position: LonLat;\n /** Metres */\n radius: number;\n}\n\n/** A prism standing on a polygon: a building's outline, a plot */\nexport interface ClipPolygon extends ClipVolumeBase {\n shape: 'polygon';\n /** Its vertices, 3 to 16, open (its last not repeating its first) */\n polygon: LonLat[];\n}\n\n/**\n * A volume cutting the map's 3D layers (`GeoMap.setClipVolume`): a box, a cylinder or a prism on a polygon. The models,\n * the 3D Tiles, the extrusions and the point clouds are cut; the ground and the flat layers stay whole. What lies\n * inside it is cut, all around it stays (a cutaway, to look into a building or under the ground), or what lies outside\n * it (a BIM viewer's section box); the faces the cut opens filled, as a section on a plan.\n */\nexport type ClipVolume = ClipBox | ClipCylinder | ClipPolygon;\n\n/** An eye at street level (`GeoMap.setFirstPerson`) */\nexport interface FirstPersonView {\n /** Where it stands */\n lonLat: LonLat;\n /** Metres above the ground (default 1.7) */\n height?: number;\n /** Degrees clockwise from north it looks to */\n bearing: number;\n /** Degrees from straight down: 90 level (the default), 180 straight up */\n pitch?: number;\n /** Vertical field of view, degrees (default 75) */\n fov?: number;\n}\n\n/** Layers shown on one side of a vertical line only (`GeoMap.setSwipe`) */\nexport interface SwipeOptions {\n /** CSS pixels from the left of the map */\n position: number;\n layers: readonly Layer[];\n /** The side they show on (default 'left') */\n side?: 'left' | 'right';\n /** Layers shown on the other side only: two meshes of the same place, each on its side, never drawn over each other */\n other?: readonly Layer[];\n}\n\n/** Animation of a camera move */\nexport interface AnimationOptions {\n /** Milliseconds */\n duration?: number;\n /** Progress over time, both 0 to 1 */\n easing?: (t: number) => number;\n}\n\nexport interface FlyToOptions extends AnimationOptions {\n /** How far the flight zooms out on its way, as MapLibre's `curve` (default 1.42) */\n curve?: number;\n /** Average speed in screens per second when `duration` is not given (default 1.2) */\n speed?: number;\n}\n\n/**\n * Tile grid of a raster's URL. 'mercator': Web Mercator (XYZ, WMTS PM), the engine's own. 'equirectangular':\n * longitudes and latitudes (Plate Carrée, EPSG:4326-like), two 256 px tiles side by side at level 0, rows from the\n * north (NASA's Trek WMTS, WorldCRS84Quad). A `TileGrid`: the tile matrices of a WMTS in any CRS (Lambert-93…), or a\n * WMS asked for each tile's box in its CRS. The last two are reprojected into Web Mercator tiles by the map's workers\n * (in the page with `workers: false`).\n */\nexport type RasterGrid = 'mercator' | 'equirectangular' | TileGrid;\n\n/** The GPU memory of a map's layers (`GeoMap.memory`), bytes */\nexport interface MapMemory {\n /** What they may hold (`GeoMapOptions.memory`) */\n budget: number;\n /** What they hold: the tiles of the 3D Tiles, point clouds and vector tiles, the pools of the rasters' tiles (the\n * relief's included), each one's full from its creation */\n held: number;\n /** Each layer's, bottom first */\n layers: { layer: Layer; bytes: number }[];\n}\n\n/** What `RasterLayer.setStyle` changes */\nexport interface RasterStyle {\n opacity: number;\n /** 0 = greyscale, 1 = original colors */\n saturation: number;\n}\n\n/** Where a new layer goes: under `before`, or on top of the others (under the labels kept on top) */\nexport interface Placement {\n before?: Layer;\n}\n\nexport interface RasterOptions extends Placement {\n /** Tile URL with {z}, {x} and {y} (256 px tiles); unused with a `loader` */\n url: string;\n /** Tile grid of `url` (default 'mercator'); with 'equirectangular', `minZoom` and `maxZoom` are levels of that\n * grid; with a `TileGrid`, they are map zooms, by default those its matrices span */\n grid?: RasterGrid;\n minZoom?: number;\n maxZoom?: number;\n opacity?: number;\n /** 0 = greyscale, 1 = original colors */\n saturation?: number;\n /** Side of the tiles' textures, pixels (default 256): more for sharper tiles drawn by a `loader` */\n size?: number;\n /** Draws each tile instead of fetching `url`: an image of `size` × `size`, null for nothing there; a rejection is\n * retried like a network error */\n loader?: (z: number, x: number, y: number, signal: AbortSignal) => Promise<ImageBitmap | null>;\n /** Credits of the tiles, HTML: shown by the attribution control while the layer is on the map */\n attribution?: string;\n /** Drawn on the ground (default true); false: only on the 3D layers it is draped on (`Tiles3dOptions.drape`), its\n * tiles still loaded as the ground's would be: a solar potential on the roofs only */\n ground?: boolean;\n}\n\nexport interface NetworkStyle {\n /** Line width, CSS pixels, or zoom stops `[[zoom, width], …]` (default 2) */\n width: Size;\n /** Values above are drawn as unreached (default 1800) */\n max: number;\n /** Darker line every `contour` value units, 0 for none (default 0) */\n contour: number;\n opacity: number;\n /** Width of the halo drawn under the lines, CSS pixels or zoom stops, 0 for none (default 0): wide and faint, the\n * reached streets add up into a heat map that fills the blocks */\n halo: Size;\n /** Opacity of the halo at the middle of a line, fading quadratically to its sides (default 0.11) */\n haloOpacity: number;\n /** Colors from 0 to `max`: `[[fraction of max, color], …]` (default green to red) */\n ramp: Ramp | undefined;\n /** Color of the parts beyond `max` or unreached (default `rgba(140, 140, 140, 0.25)`) */\n unreachedColor: string;\n /** Share of `max` over which the colors fade out before it, 0 to 1 (default 0) */\n fade: number;\n}\n\nexport interface NetworkOptions extends Partial<NetworkStyle>, Placement {\n /** Node coordinates in degrees: lon0, lat0, lon1, lat1… */\n nodes: Float64Array;\n /** Edges as node index pairs: a0, b0, a1, b1… */\n edges: Uint32Array;\n /** Line of each edge, from A to B: the points of edge e are `points[start[e] .. start[e + 1]]` (lon, lat pairs,\n * counted in points); with fewer than two points an edge is straight. Default: all straight. */\n lines?: { start: Uint32Array; points: Float64Array };\n /** Per edge, the cost of travelling it from A to B then from B to A, in value units (Infinity: closed that way;\n * closed both ways: not drawn). A point along an edge then takes the quickest way there, min(value(A) + cost from\n * A, value(B) + cost from B), as a travel time does. Without costs, values are interpolated along the edges. */\n costs?: Float32Array;\n /** Width factor of each edge (default 1): rail lines wider than streets */\n edgeWidths?: Float32Array;\n}\n\nexport interface Tiles3dStyle {\n /** Screen-space error (CSS pixels) above which a tile is refined: 16 by default, lower is finer and heavier */\n maxScreenSpaceError: number;\n opacity: number;\n /** Size of the points of point cloud tiles (`.pnts`, glTF points), CSS pixels: 2 by default */\n pointSize?: number;\n /** A CSS color multiplying the textures of the meshes, the color of the untextured ones (buildings without\n * textures are light grey without it); none by default */\n color?: string;\n /** Each feature's color from its properties (a building's height, its use: a thematic map), in place of `color`: a\n * CSS color, or undefined for the layer's. Asked once for each feature of a tile, when the tile is first drawn, and\n * again for every tile when it changes (in React, keep the same function from one render to the next) */\n featureColor?: FeatureColor | undefined;\n}\n\n/** A feature's color from its properties and its index in its tile (`Tiles3dStyle.featureColor`) */\nexport type FeatureColor = (properties: Record<string, unknown>, feature: number) => string | undefined;\n\nexport interface Tiles3dOptions extends Partial<Tiles3dStyle>, Placement {\n /** URL of a `tileset.json` (3D Tiles 1.0 b3dm and pnts, 1.1 glb meshes and points, external tilesets) */\n url: string;\n /** Its heights are altitudes above the geoid (NGF-IGN69), as the IGN's Bâtiments 3D, rather than above the\n * ellipsoid (3D Tiles as specified): each tile raised by the RAF20 geoid, onto the IGN relief (default false) */\n geoid?: boolean;\n /** The walls of its untextured meshes show windows: glass by day, some lit at night (`setFacades`; default false) */\n facades?: boolean;\n /** A raster layer draped on its meshes (`setDrape`): an ortho or a solar potential on the roofs */\n drape?: Drape | undefined;\n}\n\n/** A raster layer draped on a 3D layer's faces (3D Tiles, extrusions, a vector tiles layer's buildings, models), as\n * Cesium's imagery on 3D Tiles: each point of a face takes the raster's color where it stands (its longitude and\n * latitude, whatever its height) */\nexport interface Drape {\n /** The raster layer, on the same map (with `ground: false`, on the 3D layers only) */\n raster: RasterLayer;\n /** 'up': the faces looking up, the roofs (default); 'all': the walls too, the raster stretched down them */\n faces?: 'up' | 'all';\n /** 0 to 1 (default 1), times the raster layer's opacity */\n opacity?: number;\n}\n\nexport interface MapPointerEvent {\n point: Point;\n /** Undefined above the horizon */\n lonLat: LonLat | undefined;\n}\n\n/** What 'hoverfeature' found under the pointer */\nexport interface MapHoverFeatureEvent extends MapPointerEvent {\n /** The feature under the pointer (see `GeoMap.pickFeature`), undefined if none */\n hit: FeatureHit | undefined;\n}\n\n/** The GPU time of a frame (`GeoMap.gpuTimings`), in all and by part (ms) */\nexport interface MapGpuTimings {\n /** The frame's number */\n frame: number;\n ms: number;\n /** The backdrop (sky, globe), the ground (the raster layers over the relief), each layer (with its handle), the\n * shadows, the panorama, the viewshed */\n parts: { part: 'backdrop' | 'ground' | 'layer' | 'shadows' | 'panorama' | 'viewshed'; layer?: Layer; ms: number }[];\n}\n\n/** What a pick looks at: within `radius` CSS pixels of the point (default 0), among `layers` (default every layer;\n * the others hide nothing) */\nexport interface PickOptions {\n radius?: number;\n layers?: readonly Layer[];\n}\n\n/** A picked feature: its layer handle, its index there and, for line, circle, fill, extrusion, point cloud and 3D\n * Tiles layers, the feature itself (a building of 3D Tiles with its properties) */\nexport interface FeatureHit {\n layer: Layer;\n index: number;\n feature: Feature | undefined;\n}\n\nexport interface MapEvents {\n /** The camera started moving (a gesture, an animation or `setCamera`) */\n movestart: Camera;\n /** The camera moved */\n move: Camera;\n /** The camera stopped: no gesture held, no animation running */\n moveend: Camera;\n /** The map changed size (CSS pixels) */\n resize: { width: number; height: number };\n /** The pointer moved over the map (at most once per frame, not while dragging) */\n hover: MapPointerEvent;\n /** What is under the pointer, picked without stalling the GPU: a frame or two after 'hover', only while listened to\n * (radius and layers in `GeoMap.hoverPicking`) */\n hoverfeature: MapHoverFeatureEvent;\n /** Click without drag */\n click: MapPointerEvent;\n /** A frame was drawn; duration of the engine call in milliseconds */\n render: { ms: number };\n /** The map's quality changed, by `setQuality` or stepped down by `'auto'` */\n quality: { quality: Quality };\n /** The WebGPU device was lost (a phone taking its memory back, the GPU process gone): the map made again at once,\n * lighter (`recovery`): `'lighter'`, the low quality and half the GPU memory budget (the first loss); `'webgl2'`,\n * through the WebGL2 fallback (a loss after it, or no new WebGPU device). `losses`: how many so far */\n gpulost: { reason: string; message: string; losses: number; recovery: 'lighter' | 'webgl2' };\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 /** The clipping volume moved or was sized by its handles (`ClipVolume.handles`): the volume now set */\n clipvolume: ClipVolume;\n}\n\n/** What a layer handle needs from its map */\nexport interface LayerHost {\n readonly engine: Engine;\n requestRender(): void;\n /** Forgets a removed layer */\n detach(layer: Layer): void;\n /** Moves a layer under `before`, or on top */\n moveLayer(layer: Layer, before: Layer | undefined): void;\n /** A layer created again in the engine (new id): put at the place of its old id, which is removed */\n replaceLayer(layer: Layer, old: number): void;\n /** Resolves once the map is idle (everything in view loaded and drawn) */\n whenIdle(): Promise<void>;\n /** Work the map waits on before it is idle (`GeoMap.track`) */\n track<T>(work: Promise<T>): Promise<T>;\n /** What its quality draws (`GeoMap.setQuality`) */\n readonly quality: QualitySettings;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,0CAA0C","sourcesContent":["/** Public types of the `isard` package */\n\nimport type { TileGrid } from './basemap/grid.ts';\nimport type { DecoderUrls } from './decoding/decoders.ts';\nimport type { Feature, Ramp, Size } from './layers/features.ts';\nimport type { Layer } from './layers/layers.ts';\nimport type { RasterLayer } from './layers/raster.ts';\nimport type { QualitySettings } from './map/quality.ts';\nimport type { AttributionOptions } from './ui/controls.ts';\nimport type { Camera, Engine } from './wasm/isard_webgpu.js';\n\nexport type LonLat = [lon: number, lat: number];\nexport type Point = [x: number, y: number];\n\n/**\n * The named basemaps. OpenFreeMap's vector styles, OpenStreetMap data worldwide, their labels above the other layers:\n * `osm-positron` (light grey, quiet: data over it reads first), `osm-liberty` and `osm-bright` (in colour), `osm-dark`\n * (near black: bright data over it, a wind's particles, lights). The\n * Géoplateforme's (IGN, France): rasters (`ign-plan`, `ign-plan-grey`, `ign-ortho`, the aerial photographs) or vector\n * tiles with their labels (`ign-plan-vector`, `ign-plan-grey-vector`, the PLAN.IGN styles).\n */\nexport type BasemapName =\n | 'osm-positron'\n | 'osm-liberty'\n | 'osm-bright'\n | 'osm-dark'\n | 'ign-plan'\n | 'ign-plan-grey'\n | 'ign-ortho'\n | 'ign-plan-vector'\n | 'ign-plan-grey-vector'\n | 'none';\n\n/** A basemap by name (see `BasemapName`) */\nexport type Basemap = BasemapName;\n\n/**\n * The Earth's named terrain models. `'terrain-tiles'`: worldwide, the Terrain Tiles of AWS's open data registry\n * (SRTM, EU-DEM, GMTED… merged by Mapzen, 30 m in most places), the sea floor flattened at sea level. `'ign'`: France,\n * the IGN's RGE ALTI from the Géoplateforme (1 to 5 m), raised by the RAF20 geoid to heights above the ellipsoid.\n */\nexport type TerrainModel = 'terrain-tiles' | 'ign';\n\n/** How tiles encode their altitudes: `'float32'`, raw little-endian floats (`image/x-bil;bits=32`, an ArcGIS raw\n * grid); `'terrarium'`, the colors of a PNG, `R × 256 + G + B / 256 - 32768`; `'mapbox'`, those of Terrain-RGB,\n * `(R × 65536 + G × 256 + B) / 10 - 10000` */\nexport type TerrainEncoding = 'float32' | 'terrarium' | 'mapbox';\n\n/**\n * How tiles load and show. 'immediate' (default): everything visible loads, tiles show as soon as they arrive.\n * 'smooth': during flights the levels flown through are skipped, off-center tiles wait while the camera moves, tiles\n * fade in; fewer downloads, for slow networks or GPUs.\n */\nexport type LoadingMode = 'immediate' | 'smooth';\n\n/** 'globe': a sphere at low zoom, blending into Web Mercator between zooms 5 and 7, up to three levels later under a\n * tilted camera (it sees much farther than its center: the horizon stays curved) */\nexport type Projection = 'globe' | 'mercator';\n\n/** A body to draw the map on, other than the named ones (`CelestialBody`) */\nexport interface BodyOptions {\n /** Equatorial radius, metres */\n radius: number;\n /** Flattening of its ellipsoid, 0 for a sphere (default 0) */\n flattening?: number;\n /** An atmosphere: its halo around the globe, true for the Earth's light blue, or a CSS color (its alpha the\n * halo's strength) (default false) */\n atmosphere?: boolean | string;\n /** Color of the globe where no tile covers it (past the Web Mercator latitudes, 85°), a CSS color (default\n * `#808080`) */\n color?: string;\n /** Lowest and highest altitudes of its ground, metres around the ellipsoid: what its relief may raise into view\n * (default ±1 % of the radius) */\n relief?: [lowest: number, highest: number];\n}\n\n/**\n * The body the map is drawn on: 'earth' (WGS 84, the default), 'moon' (a sphere of 1 737 400 m, no atmosphere),\n * 'mars' (a sphere of 3 396 190 m, its equatorial radius, a thin dusty halo; planetocentric latitudes) or another\n * one. Zoom levels keep their meaning on screen (the Web Mercator tile pyramid), their metres follow the body:\n * altitudes, relief, buildings, 3D Tiles. Off the Earth, the map has none of the Earth's defaults: no basemap, no\n * credits, and space for its background; the Moon and Mars have NASA's relief for `terrain: true`.\n */\nexport type CelestialBody = 'earth' | 'moon' | 'mars' | BodyOptions;\n\n/** A level of the map's quality (`GeoMapOptions.quality`) */\nexport type Quality = 'high' | 'medium' | 'low';\n\nexport interface GeoMapOptions extends Partial<Camera> {\n /** The body the map is drawn on (default 'earth'); set at creation */\n body?: CelestialBody;\n /** Default 'globe' */\n projection?: Projection;\n /** Default 'immediate' */\n loading?: LoadingMode;\n /** The basemap (default 'osm-positron'; 'none' off the Earth) */\n basemap?: Basemap;\n /** Opacity of the IGN hillshade over the basemap (France, Géoplateforme), 0 for none (default 0) */\n hillshade?: number;\n /** Color behind the map (sky of tilted flat views), a CSS color (default `#f2f2f0`; black off the Earth) */\n background?: string;\n /** Space behind the globe: stars and atmosphere halo, fading out as the globe turns flat (default true) */\n sky?: boolean;\n /** The sun casting the shadows of buildings, trees, models and the relief (`setSun`); none by default */\n sun?: SunOptions;\n /** What the map draws less of on a device that cannot keep up (`setQuality`): `'high'` (the default) all of it;\n * `'medium'` at most 1.5 device pixels a CSS pixel, the 3D Tiles coarser far away; `'low'` one device pixel a CSS\n * pixel, no sun's shadows, the 3D Tiles coarser still; `'auto'` high, a level lower each time the frames stay slow\n * while the map moves (`'quality'` event) */\n quality?: Quality | 'auto';\n /** The GPU memory, megabytes, the layers' tiles (3D Tiles, point clouds, vector tiles) and the rasters' tiles may\n * hold all together: past it the tiles drawn least recently are unloaded, whichever their layer, the vector tiles\n * (those of the view) kept (`GeoMap.memory`). `'auto'` (the default): 256 on a touch screen (a phone, a tablet: iOS\n * closes a page past about a gigabyte, the page's workers included), 1024 elsewhere. Set at creation */\n memory?: number | 'auto';\n /** Multisampled antialiasing of the canvas (default true): the edges of the buildings, 3D Tiles and models smooth.\n * False draws each pixel once (lines and halos antialias themselves): wide translucent layers, a network's halo over\n * a region, cost up to four times less on an integrated GPU (MapLibre's default). Set at creation */\n antialias?: boolean;\n /** The engine on wgpu (#146): 'auto' (default) WebGPU where the browser gives an adapter, else wgpu's WebGL2 fallback;\n * 'webgpu' or 'webgl' forces one */\n renderer?: 'auto' | 'webgpu' | 'webgl2';\n /** Relief under the basemap: true for the body's terrain model (on the Earth the worldwide Terrain Tiles; NASA's on\n * the Moon and Mars: LOLA, MOLA), one of the Earth's models by name (`'ign'`: France, RGE ALTI), or its options\n * (default false; on another body, its `url` is required). Network layers are draped on it */\n terrain?: boolean | TerrainModel | TerrainOptions;\n minZoom?: number;\n maxZoom?: number;\n /** Highest pitch, degrees, up to 85 (default 70) */\n maxPitch?: number;\n /** Sky over the plane, seen when the camera is tilted towards the horizon, and the fog the ground fades into\n * (MapLibre's `setSky`); default none: the background color */\n atmosphere?: AtmosphereOptions;\n /** Mouse, touch and keyboard controls (default true) */\n interactive?: boolean;\n /** Keyboard controls once the map has the focus (it is reached with Tab): arrows pan, Shift + arrows rotate and\n * tilt, + and - zoom (Shift: two levels), 0 faces north and levels the view (default true; none when not\n * `interactive`) */\n keyboard?: boolean;\n /** Accessible name of the map, read by screen readers (default 'Map') */\n ariaLabel?: string;\n /** A preset of map options (`IGN_PRESETS`: `'ign'`, `'ign-3d'`, `'ign-ortho-3d'`), the other options over it */\n preset?: 'ign' | 'ign-3d' | 'ign-ortho-3d';\n /** The folder isard's files are served from (its engines, `isard_webgpu_bg.wasm`, `isard_webgl2_bg.wasm`, its\n * modules, `isard_points_bg.wasm`, `isard_tiles3d_bg.wasm`, `isard_tess_bg.wasm`, `isard_grid_bg.wasm`, and its\n * workers, `decoder.worker.js`, `basemap.worker.js`): one option for a bundler that moves them, the `…Url` options\n * below for each one. `isard/vite` sets it for the whole page; default next to the module */\n assetsUrl?: string | URL;\n /** Where to load the engine on WebGPU from (`isard_webgpu_bg.wasm`), when a bundler does not resolve the default URL */\n webgpuWasmUrl?: string | URL;\n /** Where to load the engine's WebGL2 fallback from (`isard_webgl2_bg.wasm`, for a browser without WebGPU), when a\n * bundler does not resolve the default URL */\n webgl2WasmUrl?: string | URL;\n /** Where the decoding workers load the point cloud module from (`isard_points_bg.wasm`, the LAZ decoder of COPC),\n * when a bundler does not resolve the default URL. Loaded with the first point cloud only */\n pointsWasmUrl?: string | URL;\n /** Where the decoding workers load the 3D Tiles module from (`isard_tiles3d_bg.wasm`: a tile's content decoded for\n * the GPU), when a bundler does not resolve the default URL. Loaded with the first tile */\n tiles3dWasmUrl?: string | URL;\n /** Where the basemap workers load the tessellation module from (`isard_tess_bg.wasm`: the vector tiles drawn as\n * geometry, `vectorTiles().vectors()`, made ready for the GPU off the main thread), when a bundler does not resolve\n * the default URL. Loaded with the first tile of geometry; without it, the main thread does that work */\n tessWasmUrl?: string | URL;\n /** Where the workers load the grid module from (`isard_grid_bg.wasm`: GRIB2 and NetCDF files read by\n * `map.readGrids`), when a bundler does not resolve the default URL. Loaded with the first file */\n gridWasmUrl?: string | URL;\n /** Where to load the vector basemap worker from, when a bundler does not resolve the default URL */\n basemapWorkerUrl?: string | URL;\n /** Texture size of the vector basemap's tiles, pixels (default 512: lines and edges sharp at every zoom on a screen\n * of pixel ratio 1). 256: a quarter of the drawing in the workers, of the uploads and of the GPU memory, for lines\n * and edges a little softer between two zoom levels (the tiles are shown 181 to 362 CSS pixels wide) */\n basemapTileSize?: number;\n /** Glyphs of the symbol layers: a URL with `{fontstack}` and `{range}` (MapLibre's glyph format; default\n * OpenFreeMap's fonts, Noto Sans). A vector basemap's labels take the glyphs of its style */\n glyphs?: string;\n /** Workers decoding 3D Tiles off the main thread: a count, or false to decode on the main thread (default: cores - 1,\n * 1 to 4). False (or 0) also decodes the PNG relief and reprojects the equirectangular rasters on the main thread,\n * else done by the vector basemap's workers */\n workers?: number | false;\n /** Where to load the decoding worker from, when a bundler does not resolve the default URL */\n workerUrl?: string | URL;\n /** Folders of the Draco and Basis Universal decoders, loaded by the workers on first use (default: the official\n * builds on gstatic.com and jsDelivr; self-host them for offline or locked-down networks). They run through\n * `new Function`: a Content Security Policy needs `'unsafe-eval'` (see `DecoderUrls`) */\n decoders?: Partial<DecoderUrls>;\n /** Credits at the bottom right: false for none, or its options (default true: the credits of the basemap,\n * hillshade and relief in use, compact on maps narrower than 640 px) */\n attributionControl?: boolean | AttributionOptions;\n}\n\nexport interface TerrainOptions {\n /** One of the Earth's named models (default `'terrain-tiles'` on the Earth); unused with a `url` */\n model?: TerrainModel;\n /** Altitudes of 256 × 256 tiles in `encoding`: a WMS GetMap URL with {bbox} (EPSG:3857 on the Earth, the body's\n * Mercator metres elsewhere: the sphere of its radius), a tile URL with {z}, {x} and {y}, or an ArcGIS image service\n * (a URL ending in `/ImageServer`), asked for raw altitudes in the body's Mercator (default: the `model`'s; on the\n * Moon and Mars, NASA's Trek LOLA and MOLA models) */\n url?: string;\n /** How the tiles of `url` encode their altitudes (default `'float32'`); `'terrarium'` and `'mapbox'` take a URL with\n * {z}, {x} and {y} */\n encoding?: TerrainEncoding;\n /** Vertical exaggeration, 1 for the true relief (default 1) */\n exaggeration?: number;\n /** Finest level of the relief, up to 15 (default 15; 14 for the Terrain Tiles, 8 for the Moon's and Mars's models). It\n * starts at level 6 on the Earth, coarser on bodies of a larger relief for their size (3 on the Moon and Mars) */\n maxZoom?: number;\n /** Altitudes over mainland France raised by the height of the RAF20 geoid (the French one, 0 away from France), to\n * heights above the ellipsoid (those of 3D Tiles); false keeps the altitudes as served (NGF-IGN69 for the IGN's)\n * (default true for the `'ign'` model, false otherwise) */\n geoid?: boolean;\n}\n\n/** Sky, horizon and fog over the plane, with the names and meanings of MapLibre's `setSky` */\nexport interface AtmosphereOptions {\n /** A CSS color (default `#9cc7ec`) */\n skyColor?: string;\n /** (default `#e8f1f8`) */\n horizonColor?: string;\n /** (default `#f2f5f8`) */\n fogColor?: string;\n /** Blend from the horizon to the sky color, share of the field of view above the horizon, 0-1 (default 0.6) */\n skyHorizonBlend?: number;\n /** Blend from the horizon to the fog color below the horizon, 0-1 (default 0.7) */\n horizonFogBlend?: number;\n /** Share of the distance to the far plane over which the ground fades into the fog, 0-1 (default 0.4) */\n fogGroundBlend?: number;\n}\n\n/** The sun casting shadows (`GeoMap.setSun`): where it stands, by date or by hand, and how dark its shadows are */\nexport interface SunOptions {\n /** The time: the sun where it stands then over the map's center (default now, unless `azimuth` and `altitude`) */\n date?: Date;\n /** Degrees clockwise from north, with `altitude`: the sun placed by hand */\n azimuth?: number;\n /** Degrees above the horizon; at or under it, no shadows */\n altitude?: number;\n /** How dark the shadows are, 0 to 1 (default 0.35) */\n opacity?: number;\n /** How dark the night is, 0 to 1: the scene tinted in its blue, the windows of the buildings and the streets of\n * `vectors()` lit, the labels light on dark. By default from the sun's altitude: falling from 6° above the horizon\n * to 6° under it */\n night?: number;\n}\n\n/** What can be seen from a point (`GeoMap.setViewshed`); with several observers, the colors, the opacity and the\n * cone's color are the first one's */\nexport interface ViewshedOptions {\n /** The observer */\n position: LonLat;\n /** Metres above the ground (default 1.7, eye level) */\n height?: number;\n /** Metres around the observer that are tinted (default 1000) */\n range?: number;\n /** A CSS color for what is seen (default `#2f9e44`) */\n visibleColor?: string;\n /** A CSS color for what is hidden (default `#e03131`) */\n hiddenColor?: string;\n /** How strongly the colors tint the scene, multiplied into it so that its textures and shading stay, 0-1 (default\n * 0.7) */\n opacity?: number;\n /** A CSS color for the cone drawn in 3D (one way only): its fan through the axis, at the eye's height and tilted\n * with it, from the eye to the range; solid where nothing hides it, faint behind the scene; none by default */\n coneColor?: string;\n /** To look one way only (a camera, a lookout), degrees clockwise from north; all around without it */\n direction?: number;\n /** Degrees above the horizon the cone looks, negative below (default 0) */\n tilt?: number;\n /** Angle of view across, degrees (default 60) */\n fov?: number;\n /** Angle of view up and down, degrees (default 40) */\n verticalFov?: number;\n}\n\n/** What every clipping volume has (`ClipVolume`) */\ninterface ClipVolumeBase {\n /** Metres of its foot above the ground (or above the ellipsoid, `altitudeReference: 'sea'`); 0 by default */\n altitude?: number;\n /** What the altitude is above: `'ground'` (the relief, the default) or `'sea'` (the ellipsoid), as the models' */\n altitudeReference?: 'ground' | 'sea';\n /** Metres up from its foot */\n height: number;\n /** What is cut: `'inside'` (the default) what lies inside the volume, `'outside'` what lies outside it */\n cut?: 'inside' | 'outside';\n /** A CSS color for the faces the cut opens, the inside of walls and floors (default `#d9cfc1`); `null` leaves them\n * open */\n sectionColor?: string | null;\n /** Handles on the volume to size and move it with the pointer: a disc on each of a box's faces, on a cylinder's rim,\n * on each of a polygon's vertices, on the top and the bottom, and one at its middle to move it; the map tells each\n * change by `'clipvolume'`. None by default */\n handles?: boolean;\n}\n\n/** A box: its foot's center, its size, its heading */\nexport interface ClipBox extends ClipVolumeBase {\n shape: 'box';\n /** The center of its foot */\n position: LonLat;\n /** Metres across its heading */\n width: number;\n /** Metres along its heading */\n length: number;\n /** Degrees clockwise from north of its length; 0 by default */\n heading?: number;\n}\n\n/** A cylinder standing up: its foot's center, its radius */\nexport interface ClipCylinder extends ClipVolumeBase {\n shape: 'cylinder';\n /** The center of its foot */\n position: LonLat;\n /** Metres */\n radius: number;\n}\n\n/** A prism standing on a polygon: a building's outline, a plot */\nexport interface ClipPolygon extends ClipVolumeBase {\n shape: 'polygon';\n /** Its vertices, 3 to 16, open (its last not repeating its first) */\n polygon: LonLat[];\n}\n\n/**\n * A volume cutting the map's 3D layers (`GeoMap.setClipVolume`): a box, a cylinder or a prism on a polygon. The models,\n * the 3D Tiles, the extrusions and the point clouds are cut; the ground and the flat layers stay whole. What lies\n * inside it is cut, all around it stays (a cutaway, to look into a building or under the ground), or what lies outside\n * it (a BIM viewer's section box); the faces the cut opens filled, as a section on a plan.\n */\nexport type ClipVolume = ClipBox | ClipCylinder | ClipPolygon;\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/** A box to frame (`GeoMap.fitBounds`): on the ground, or in space from a bottom to a top altitude */\nexport interface FitBox {\n bounds: [west: number, south: number, east: number, north: number];\n /** Metres above the ellipsoid (default 0) */\n bottom?: number;\n /** Metres above the ellipsoid (default `bottom`): a building's roof, a pipe's top */\n top?: number;\n}\n\nexport interface FitBoundsOptions extends FlyToOptions {\n /** Room left around the box, CSS pixels: one for all sides, or each (default 40) */\n padding?: number | { top?: number; right?: number; bottom?: number; left?: number };\n /** The camera's pitch and bearing there, degrees (default the current ones) */\n pitch?: number;\n bearing?: number;\n /** The closest zoom, for a small box (default the map's) */\n maxZoom?: number;\n /** A flight zooming out on its way (`flyTo`, a far box), else an ease (`easeTo`); `duration: 0` jumps */\n fly?: boolean;\n}\n\n/**\n * Tile grid of a raster's URL. 'mercator': Web Mercator (XYZ, WMTS PM), the engine's own. 'equirectangular':\n * longitudes and latitudes (Plate Carrée, EPSG:4326-like), two 256 px tiles side by side at level 0, rows from the\n * north (NASA's Trek WMTS, WorldCRS84Quad). A `TileGrid`: the tile matrices of a WMTS in any CRS (Lambert-93…), or a\n * WMS asked for each tile's box in its CRS. The last two are reprojected into Web Mercator tiles by the map's workers\n * (in the page with `workers: false`).\n */\nexport type RasterGrid = 'mercator' | 'equirectangular' | TileGrid;\n\n/** The GPU memory of a map's layers (`GeoMap.memory`), bytes */\nexport interface MapMemory {\n /** What they may hold (`GeoMapOptions.memory`) */\n budget: number;\n /** What they hold: the tiles of the 3D Tiles, point clouds and vector tiles, the pools of the rasters' tiles (the\n * relief's included), each one's full from its creation */\n held: number;\n /** Each layer's, bottom first */\n layers: { layer: Layer; bytes: number }[];\n}\n\n/** What `RasterLayer.setStyle` changes */\nexport interface RasterStyle {\n opacity: number;\n /** 0 = greyscale, 1 = original colors */\n saturation: number;\n}\n\n/** Where a new layer goes: under `before`, or on top of the others (under the labels kept on top) */\nexport interface Placement {\n before?: Layer;\n}\n\nexport interface RasterOptions extends Placement {\n /** Tile URL with {z}, {x} and {y} (256 px tiles); unused with a `loader` */\n url: string;\n /** Tile grid of `url` (default 'mercator'); with 'equirectangular', `minZoom` and `maxZoom` are levels of that\n * grid; with a `TileGrid`, they are map zooms, by default those its matrices span */\n grid?: RasterGrid;\n minZoom?: number;\n maxZoom?: number;\n opacity?: number;\n /** 0 = greyscale, 1 = original colors */\n saturation?: number;\n /** Side of the tiles' textures, pixels (default 256): more for sharper tiles drawn by a `loader` */\n size?: number;\n /** Draws each tile instead of fetching `url`: an image of `size` × `size`, null for nothing there; a rejection is\n * retried like a network error */\n loader?: (z: number, x: number, y: number, signal: AbortSignal) => Promise<ImageBitmap | null>;\n /** Credits of the tiles, HTML: shown by the attribution control while the layer is on the map */\n attribution?: string;\n /** Drawn on the ground (default true); false: only on the 3D layers it is draped on (`Tiles3dOptions.drape`), its\n * tiles still loaded as the ground's would be: a solar potential on the roofs only */\n ground?: boolean;\n}\n\nexport interface NetworkStyle {\n /** Line width, CSS pixels, or zoom stops `[[zoom, width], …]` (default 2) */\n width: Size;\n /** Values above are drawn as unreached (default 1800) */\n max: number;\n /** Darker line every `contour` value units, 0 for none (default 0) */\n contour: number;\n opacity: number;\n /** Width of the halo drawn under the lines, CSS pixels or zoom stops, 0 for none (default 0): wide and faint, the\n * reached streets add up into a heat map that fills the blocks */\n halo: Size;\n /** Opacity of the halo at the middle of a line, fading quadratically to its sides (default 0.11) */\n haloOpacity: number;\n /** Colors from 0 to `max`: `[[fraction of max, color], …]` (default green to red) */\n ramp: Ramp | undefined;\n /** Color of the parts beyond `max` or unreached (default `rgba(140, 140, 140, 0.25)`) */\n unreachedColor: string;\n /** Share of `max` over which the colors fade out before it, 0 to 1 (default 0) */\n fade: number;\n}\n\nexport interface NetworkOptions extends Partial<NetworkStyle>, Placement {\n /** Node coordinates in degrees: lon0, lat0, lon1, lat1… */\n nodes: Float64Array;\n /** Edges as node index pairs: a0, b0, a1, b1… */\n edges: Uint32Array;\n /** Line of each edge, from A to B: the points of edge e are `points[start[e] .. start[e + 1]]` (lon, lat pairs,\n * counted in points); with fewer than two points an edge is straight. Default: all straight. */\n lines?: { start: Uint32Array; points: Float64Array };\n /** Per edge, the cost of travelling it from A to B then from B to A, in value units (Infinity: closed that way;\n * closed both ways: not drawn). A point along an edge then takes the quickest way there, min(value(A) + cost from\n * A, value(B) + cost from B), as a travel time does. Without costs, values are interpolated along the edges. */\n costs?: Float32Array;\n /** Width factor of each edge (default 1): rail lines wider than streets */\n edgeWidths?: Float32Array;\n}\n\nexport interface Tiles3dStyle {\n /** Screen-space error (CSS pixels) above which a tile is refined: 16 by default, lower is finer and heavier */\n maxScreenSpaceError: number;\n opacity: number;\n /** Size of the points of point cloud tiles (`.pnts`, glTF points), CSS pixels: 2 by default */\n pointSize?: number;\n /** A CSS color multiplying the textures of the meshes, the color of the untextured ones (buildings without\n * textures are light grey without it); none by default */\n color?: string;\n /** Each feature's color from its properties (a building's height, its use: a thematic map), in place of `color`: a\n * CSS color, or undefined for the layer's. Asked once for each feature of a tile, when the tile is first drawn, and\n * again for every tile when it changes (in React, keep the same function from one render to the next) */\n featureColor?: FeatureColor | undefined;\n}\n\n/** A feature's color from its properties and its index in its tile (`Tiles3dStyle.featureColor`) */\nexport type FeatureColor = (properties: Record<string, unknown>, feature: number) => string | undefined;\n\nexport interface Tiles3dOptions extends Partial<Tiles3dStyle>, Placement {\n /** URL of a `tileset.json` (3D Tiles 1.0 b3dm and pnts, 1.1 glb meshes and points, external tilesets) */\n url: string;\n /** Its heights are altitudes above the geoid (NGF-IGN69), as the IGN's Bâtiments 3D, rather than above the\n * ellipsoid (3D Tiles as specified): each tile raised by the RAF20 geoid, onto the IGN relief (default false) */\n geoid?: boolean;\n /** The walls of its untextured meshes show windows: glass by day, some lit at night (`setFacades`; default false) */\n facades?: boolean;\n /** A raster layer draped on its meshes (`setDrape`): an ortho or a solar potential on the roofs */\n drape?: Drape | undefined;\n}\n\n/** A raster layer draped on a 3D layer's faces (3D Tiles, extrusions, a vector tiles layer's buildings, models), as\n * Cesium's imagery on 3D Tiles: each point of a face takes the raster's color where it stands (its longitude and\n * latitude, whatever its height) */\nexport interface Drape {\n /** The raster layer, on the same map (with `ground: false`, on the 3D layers only) */\n raster: RasterLayer;\n /** 'up': the faces looking up, the roofs (default); 'all': the walls too, the raster stretched down them */\n faces?: 'up' | 'all';\n /** 0 to 1 (default 1), times the raster layer's opacity */\n opacity?: number;\n}\n\nexport interface MapPointerEvent {\n point: Point;\n /** Undefined above the horizon */\n lonLat: LonLat | undefined;\n}\n\n/** What 'hoverfeature' found under the pointer */\nexport interface MapHoverFeatureEvent extends MapPointerEvent {\n /** The feature under the pointer (see `GeoMap.pickFeature`), undefined if none */\n hit: FeatureHit | undefined;\n}\n\n/** The GPU time of a frame (`GeoMap.gpuTimings`), in all and by part (ms) */\nexport interface MapGpuTimings {\n /** The frame's number */\n frame: number;\n ms: number;\n /** The backdrop (sky, globe), the ground (the raster layers over the relief), each layer (with its handle), the\n * shadows, the panorama, the viewshed */\n parts: { part: 'backdrop' | 'ground' | 'layer' | 'shadows' | 'panorama' | 'viewshed'; layer?: Layer; ms: number }[];\n}\n\n/** What a pick looks at: within `radius` CSS pixels of the point (default 0), among `layers` (default every layer;\n * the others hide nothing) */\nexport interface PickOptions {\n radius?: number;\n layers?: readonly Layer[];\n}\n\n/** A picked feature: its layer handle, its index there and, for line, circle, fill, extrusion, point cloud and 3D\n * Tiles layers, the feature itself (a building of 3D Tiles with its properties) */\nexport interface FeatureHit {\n layer: Layer;\n index: number;\n feature: Feature | undefined;\n}\n\nexport interface MapEvents {\n /** The camera started moving (a gesture, an animation or `setCamera`) */\n movestart: Camera;\n /** The camera moved */\n move: Camera;\n /** The camera stopped: no gesture held, no animation running */\n moveend: Camera;\n /** The map changed size (CSS pixels) */\n resize: { width: number; height: number };\n /** The pointer moved over the map (at most once per frame, not while dragging) */\n hover: MapPointerEvent;\n /** What is under the pointer, picked without stalling the GPU: a frame or two after 'hover', only while listened to\n * (radius and layers in `GeoMap.hoverPicking`) */\n hoverfeature: MapHoverFeatureEvent;\n /** Click without drag */\n click: MapPointerEvent;\n /** A frame was drawn; duration of the engine call in milliseconds */\n render: { ms: number };\n /** The map's quality changed, by `setQuality` or stepped down by `'auto'` */\n quality: { quality: Quality };\n /** The WebGPU device was lost (a phone taking its memory back, the GPU process gone): the map made again at once,\n * lighter (`recovery`): `'lighter'`, the low quality and half the GPU memory budget (the first loss); `'webgl2'`,\n * through the WebGL2 fallback (a loss after it, or no new WebGPU device). `losses`: how many so far */\n gpulost: { reason: string; message: string; losses: number; recovery: 'lighter' | 'webgl2' };\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 /** The clipping volume moved or was sized by its handles (`ClipVolume.handles`): the volume now set */\n clipvolume: ClipVolume;\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"]}
|
|
@@ -329,6 +329,12 @@ export class Engine {
|
|
|
329
329
|
* CPU (as coarse as the tiles loaded there); undefined without relief or where none is loaded
|
|
330
330
|
*/
|
|
331
331
|
elevationAt(lon: number, lat: number): number | undefined;
|
|
332
|
+
/**
|
|
333
|
+
* The camera framing a box (the camera unmoved): `bounds` west, south, east, north (degrees), from `bottom` to
|
|
334
|
+
* `top` (metres; the same for a box on the ground), `padding` top, right, bottom, left (CSS pixels), at `pitch`
|
|
335
|
+
* and `bearing` (degrees); undefined for a box that is not one
|
|
336
|
+
*/
|
|
337
|
+
fitCamera(bounds: Float64Array, bottom: number, top: number, padding: Float64Array, pitch: number, bearing: number): Camera | undefined;
|
|
332
338
|
/**
|
|
333
339
|
* Height of the RAF20 geoid above the ellipsoid at a position (metres; 0 away from mainland France): what raises
|
|
334
340
|
* the altitudes (NGF-IGN69) of a source onto the IGN relief
|
|
@@ -784,6 +790,11 @@ export class Engine {
|
|
|
784
790
|
* Each feature of a 3D Tiles layer its color (null: the layer's)
|
|
785
791
|
*/
|
|
786
792
|
setTiles3dFeatureColors(id: number, colors: ((properties: Record<string, unknown>[] | undefined, count: number) => Uint8Array) | null): void;
|
|
793
|
+
/**
|
|
794
|
+
* A box a 3D Tiles layer loads to its finest tiles, first, in view or not: west, south, east, north (degrees),
|
|
795
|
+
* bottom and top (metres above the ellipsoid); empty for none
|
|
796
|
+
*/
|
|
797
|
+
setTiles3dFocus(id: number, focus: Float64Array): void;
|
|
787
798
|
/**
|
|
788
799
|
* Screen-space error threshold, opacity, size of the points (CSS pixels, 2 if not given) and color (RGB 0-1, empty
|
|
789
800
|
* for none: it tints the textures and colors the untextured meshes) of a 3D Tiles layer
|
|
@@ -882,6 +893,15 @@ export class Engine {
|
|
|
882
893
|
* pass
|
|
883
894
|
*/
|
|
884
895
|
tiles3dFeature(id: number, index: number): [properties: Record<string, unknown> | undefined, feature: number] | undefined;
|
|
896
|
+
/**
|
|
897
|
+
* The first feature of a 3D Tiles layer's tiles drawn whose properties `matches` takes, the finest tiles first:
|
|
898
|
+
* `[properties, feature]`, its properties and its index in its tile; undefined if none
|
|
899
|
+
*/
|
|
900
|
+
tiles3dFind(id: number, matches: (properties: Record<string, unknown>) => boolean): [properties: Record<string, unknown>, feature: number] | undefined;
|
|
901
|
+
/**
|
|
902
|
+
* The tiles of a 3D Tiles layer's focus box still to load at the last frame; undefined before its root tileset
|
|
903
|
+
*/
|
|
904
|
+
tiles3dFocusPending(id: number): number | undefined;
|
|
885
905
|
/**
|
|
886
906
|
* Counters of a 3D Tiles layer, undefined if there is none with this id
|
|
887
907
|
*/
|
|
@@ -955,6 +975,7 @@ export interface InitOutput {
|
|
|
955
975
|
readonly engine_create: (a: any, b: any, c: number) => any;
|
|
956
976
|
readonly engine_customMatrix: (a: number, b: number, c: number) => [number, number];
|
|
957
977
|
readonly engine_elevationAt: (a: number, b: number, c: number) => [number, number];
|
|
978
|
+
readonly engine_fitCamera: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => any;
|
|
958
979
|
readonly engine_geoidHeight: (a: number, b: number) => number;
|
|
959
980
|
readonly engine_gpuDevice: (a: number) => any;
|
|
960
981
|
readonly engine_ground: (a: number, b: number, c: number) => any;
|
|
@@ -1039,6 +1060,7 @@ export interface InitOutput {
|
|
|
1039
1060
|
readonly engine_setTileLoader: (a: number, b: any) => void;
|
|
1040
1061
|
readonly engine_setTiles3dFacades: (a: number, b: number, c: number) => void;
|
|
1041
1062
|
readonly engine_setTiles3dFeatureColors: (a: number, b: number, c: any) => void;
|
|
1063
|
+
readonly engine_setTiles3dFocus: (a: number, b: number, c: number, d: number) => void;
|
|
1042
1064
|
readonly engine_setTiles3dStyle: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
1043
1065
|
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;
|
|
1044
1066
|
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];
|
|
@@ -1052,6 +1074,8 @@ export interface InitOutput {
|
|
|
1052
1074
|
readonly engine_surfaceAt: (a: number, b: number, c: number) => any;
|
|
1053
1075
|
readonly engine_textureFormats: (a: number) => any;
|
|
1054
1076
|
readonly engine_tiles3dFeature: (a: number, b: number, c: number) => any;
|
|
1077
|
+
readonly engine_tiles3dFind: (a: number, b: number, c: any) => any;
|
|
1078
|
+
readonly engine_tiles3dFocusPending: (a: number, b: number) => number;
|
|
1055
1079
|
readonly engine_tiles3dStats: (a: number, b: number) => any;
|
|
1056
1080
|
readonly engine_updateGlyphAtlas: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
1057
1081
|
readonly engine_updateGlyphPage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
@@ -1060,11 +1084,12 @@ export interface InitOutput {
|
|
|
1060
1084
|
readonly engine_vectorTilesInView: (a: number, b: number, c: number, d: number) => [number, number];
|
|
1061
1085
|
readonly engine_wantedTiles: (a: number, b: number) => [number, number];
|
|
1062
1086
|
readonly engine_zoomAt: (a: number, b: number, c: number, d: number) => void;
|
|
1087
|
+
readonly wasm_bindgen_4346cdda5a9d72ac___convert__closures_____invoke___wasm_bindgen_4346cdda5a9d72ac___JsValue__u32__js_sys_5e75a17f0680aa0e___Array__bool__true_: (a: number, b: number, c: any, d: number, e: any) => number;
|
|
1063
1088
|
readonly wasm_bindgen_4346cdda5a9d72ac___convert__closures_____invoke___js_sys_5e75a17f0680aa0e___Function_fn_wasm_bindgen_4346cdda5a9d72ac___JsValue_____wasm_bindgen_4346cdda5a9d72ac___sys__Undefined___js_sys_5e75a17f0680aa0e___Function_fn_wasm_bindgen_4346cdda5a9d72ac___JsValue_____wasm_bindgen_4346cdda5a9d72ac___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
|
|
1064
1089
|
readonly wasm_bindgen_4346cdda5a9d72ac___convert__closures_____invoke___wasm_bindgen_4346cdda5a9d72ac___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_4346cdda5a9d72ac___JsError___true_: (a: number, b: number, c: any) => [number, number];
|
|
1065
1090
|
readonly wasm_bindgen_4346cdda5a9d72ac___convert__closures_____invoke___wasm_bindgen_4346cdda5a9d72ac___sys__JsNullable_wgpu_ce7204c20056c03e___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_4346cdda5a9d72ac___JsError___true_: (a: number, b: number, c: any) => [number, number];
|
|
1066
|
-
readonly
|
|
1067
|
-
readonly
|
|
1091
|
+
readonly wasm_bindgen_4346cdda5a9d72ac___convert__closures_____invoke___wasm_bindgen_4346cdda5a9d72ac___sys__JsNullable_wgpu_ce7204c20056c03e___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_4346cdda5a9d72ac___JsError___true__139: (a: number, b: number, c: any) => [number, number];
|
|
1092
|
+
readonly wasm_bindgen_4346cdda5a9d72ac___convert__closures_____invoke___wasm_bindgen_4346cdda5a9d72ac___sys__JsNullable_wgpu_ce7204c20056c03e___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_4346cdda5a9d72ac___JsError___true__140: (a: number, b: number, c: any) => [number, number];
|
|
1068
1093
|
readonly wasm_bindgen_4346cdda5a9d72ac___convert__closures_____invoke___wgpu_ce7204c20056c03e___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true_: (a: number, b: number, c: any) => void;
|
|
1069
1094
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
1070
1095
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
@@ -431,6 +431,26 @@ export class Engine {
|
|
|
431
431
|
const ret = wasm.engine_elevationAt(this.__wbg_ptr, lon, lat);
|
|
432
432
|
return ret[0] === 0 ? undefined : ret[1];
|
|
433
433
|
}
|
|
434
|
+
/**
|
|
435
|
+
* The camera framing a box (the camera unmoved): `bounds` west, south, east, north (degrees), from `bottom` to
|
|
436
|
+
* `top` (metres; the same for a box on the ground), `padding` top, right, bottom, left (CSS pixels), at `pitch`
|
|
437
|
+
* and `bearing` (degrees); undefined for a box that is not one
|
|
438
|
+
* @param {Float64Array} bounds
|
|
439
|
+
* @param {number} bottom
|
|
440
|
+
* @param {number} top
|
|
441
|
+
* @param {Float64Array} padding
|
|
442
|
+
* @param {number} pitch
|
|
443
|
+
* @param {number} bearing
|
|
444
|
+
* @returns {Camera | undefined}
|
|
445
|
+
*/
|
|
446
|
+
fitCamera(bounds, bottom, top, padding, pitch, bearing) {
|
|
447
|
+
const ptr0 = passArrayF64ToWasm0(bounds, wasm.__wbindgen_malloc);
|
|
448
|
+
const len0 = WASM_VECTOR_LEN;
|
|
449
|
+
const ptr1 = passArrayF64ToWasm0(padding, wasm.__wbindgen_malloc);
|
|
450
|
+
const len1 = WASM_VECTOR_LEN;
|
|
451
|
+
const ret = wasm.engine_fitCamera(this.__wbg_ptr, ptr0, len0, bottom, top, ptr1, len1, pitch, bearing);
|
|
452
|
+
return ret;
|
|
453
|
+
}
|
|
434
454
|
/**
|
|
435
455
|
* Height of the RAF20 geoid above the ellipsoid at a position (metres; 0 away from mainland France): what raises
|
|
436
456
|
* the altitudes (NGF-IGN69) of a source onto the IGN relief
|
|
@@ -1502,6 +1522,17 @@ export class Engine {
|
|
|
1502
1522
|
setTiles3dFeatureColors(id, colors) {
|
|
1503
1523
|
wasm.engine_setTiles3dFeatureColors(this.__wbg_ptr, id, colors);
|
|
1504
1524
|
}
|
|
1525
|
+
/**
|
|
1526
|
+
* A box a 3D Tiles layer loads to its finest tiles, first, in view or not: west, south, east, north (degrees),
|
|
1527
|
+
* bottom and top (metres above the ellipsoid); empty for none
|
|
1528
|
+
* @param {number} id
|
|
1529
|
+
* @param {Float64Array} focus
|
|
1530
|
+
*/
|
|
1531
|
+
setTiles3dFocus(id, focus) {
|
|
1532
|
+
const ptr0 = passArrayF64ToWasm0(focus, wasm.__wbindgen_malloc);
|
|
1533
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1534
|
+
wasm.engine_setTiles3dFocus(this.__wbg_ptr, id, ptr0, len0);
|
|
1535
|
+
}
|
|
1505
1536
|
/**
|
|
1506
1537
|
* Screen-space error threshold, opacity, size of the points (CSS pixels, 2 if not given) and color (RGB 0-1, empty
|
|
1507
1538
|
* for none: it tints the textures and colors the untextured meshes) of a 3D Tiles layer
|
|
@@ -1815,6 +1846,26 @@ export class Engine {
|
|
|
1815
1846
|
const ret = wasm.engine_tiles3dFeature(this.__wbg_ptr, id, index);
|
|
1816
1847
|
return ret;
|
|
1817
1848
|
}
|
|
1849
|
+
/**
|
|
1850
|
+
* The first feature of a 3D Tiles layer's tiles drawn whose properties `matches` takes, the finest tiles first:
|
|
1851
|
+
* `[properties, feature]`, its properties and its index in its tile; undefined if none
|
|
1852
|
+
* @param {number} id
|
|
1853
|
+
* @param {(properties: Record<string, unknown>) => boolean} matches
|
|
1854
|
+
* @returns {[properties: Record<string, unknown>, feature: number] | undefined}
|
|
1855
|
+
*/
|
|
1856
|
+
tiles3dFind(id, matches) {
|
|
1857
|
+
const ret = wasm.engine_tiles3dFind(this.__wbg_ptr, id, matches);
|
|
1858
|
+
return ret;
|
|
1859
|
+
}
|
|
1860
|
+
/**
|
|
1861
|
+
* The tiles of a 3D Tiles layer's focus box still to load at the last frame; undefined before its root tileset
|
|
1862
|
+
* @param {number} id
|
|
1863
|
+
* @returns {number | undefined}
|
|
1864
|
+
*/
|
|
1865
|
+
tiles3dFocusPending(id) {
|
|
1866
|
+
const ret = wasm.engine_tiles3dFocusPending(this.__wbg_ptr, id);
|
|
1867
|
+
return ret === Number.MAX_SAFE_INTEGER ? undefined : ret;
|
|
1868
|
+
}
|
|
1818
1869
|
/**
|
|
1819
1870
|
* Counters of a 3D Tiles layer, undefined if there is none with this id
|
|
1820
1871
|
* @param {number} id
|
|
@@ -2560,6 +2611,24 @@ function __wbg_get_imports() {
|
|
|
2560
2611
|
const ret = arg0.fetch(getStringFromWasm0(arg1, arg2), arg3);
|
|
2561
2612
|
return ret;
|
|
2562
2613
|
},
|
|
2614
|
+
__wbg_findIndex_af2ae0290a92a901: function(arg0, arg1, arg2) {
|
|
2615
|
+
try {
|
|
2616
|
+
var state0 = {a: arg1, b: arg2};
|
|
2617
|
+
var cb0 = (arg0, arg1, arg2) => {
|
|
2618
|
+
const a = state0.a;
|
|
2619
|
+
state0.a = 0;
|
|
2620
|
+
try {
|
|
2621
|
+
return wasm_bindgen_4346cdda5a9d72ac___convert__closures_____invoke___wasm_bindgen_4346cdda5a9d72ac___JsValue__u32__js_sys_5e75a17f0680aa0e___Array__bool__true_(a, state0.b, arg0, arg1, arg2);
|
|
2622
|
+
} finally {
|
|
2623
|
+
state0.a = a;
|
|
2624
|
+
}
|
|
2625
|
+
};
|
|
2626
|
+
const ret = arg0.findIndex(cb0);
|
|
2627
|
+
return ret;
|
|
2628
|
+
} finally {
|
|
2629
|
+
state0.a = 0;
|
|
2630
|
+
}
|
|
2631
|
+
},
|
|
2563
2632
|
__wbg_finish_09ec094c10f41e7b: function(arg0) {
|
|
2564
2633
|
const ret = arg0.finish();
|
|
2565
2634
|
return ret;
|
|
@@ -2727,6 +2796,10 @@ function __wbg_get_imports() {
|
|
|
2727
2796
|
const ret = Reflect.get(arg0, arg1);
|
|
2728
2797
|
return ret;
|
|
2729
2798
|
}, arguments); },
|
|
2799
|
+
__wbg_get_6c896e0571ddae51: function(arg0, arg1) {
|
|
2800
|
+
const ret = arg0[arg1 >>> 0];
|
|
2801
|
+
return ret;
|
|
2802
|
+
},
|
|
2730
2803
|
__wbg_get_806853698d9fc227: function() { return handleError(function (arg0, arg1) {
|
|
2731
2804
|
const ret = Reflect.get(arg0, arg1 >>> 0);
|
|
2732
2805
|
return ret;
|
|
@@ -4340,28 +4413,28 @@ function __wbg_get_imports() {
|
|
|
4340
4413
|
arg0.writeTexture(arg1, getArrayU8FromWasm0(arg2, arg3), arg4, arg5);
|
|
4341
4414
|
}, arguments); },
|
|
4342
4415
|
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
4343
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
4416
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 2403, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
4344
4417
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_4346cdda5a9d72ac___convert__closures_____invoke___wasm_bindgen_4346cdda5a9d72ac___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_4346cdda5a9d72ac___JsError___true_);
|
|
4345
4418
|
return ret;
|
|
4346
4419
|
},
|
|
4347
4420
|
__wbindgen_generic_0000000000000002: function(arg0, arg1) {
|
|
4348
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx:
|
|
4421
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx: 336, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
4349
4422
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_4346cdda5a9d72ac___convert__closures_____invoke___wasm_bindgen_4346cdda5a9d72ac___sys__JsNullable_wgpu_ce7204c20056c03e___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_4346cdda5a9d72ac___JsError___true_);
|
|
4350
4423
|
return ret;
|
|
4351
4424
|
},
|
|
4352
4425
|
__wbindgen_generic_0000000000000003: function(arg0, arg1) {
|
|
4353
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx:
|
|
4426
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx: 340, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
4354
4427
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_4346cdda5a9d72ac___convert__closures_____invoke___wgpu_ce7204c20056c03e___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true_);
|
|
4355
4428
|
return ret;
|
|
4356
4429
|
},
|
|
4357
4430
|
__wbindgen_generic_0000000000000004: function(arg0, arg1) {
|
|
4358
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx:
|
|
4359
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
4431
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx: 336, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
4432
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_4346cdda5a9d72ac___convert__closures_____invoke___wasm_bindgen_4346cdda5a9d72ac___sys__JsNullable_wgpu_ce7204c20056c03e___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_4346cdda5a9d72ac___JsError___true__139);
|
|
4360
4433
|
return ret;
|
|
4361
4434
|
},
|
|
4362
4435
|
__wbindgen_generic_0000000000000005: function(arg0, arg1) {
|
|
4363
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx:
|
|
4364
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
4436
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 336, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
4437
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_4346cdda5a9d72ac___convert__closures_____invoke___wasm_bindgen_4346cdda5a9d72ac___sys__JsNullable_wgpu_ce7204c20056c03e___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_4346cdda5a9d72ac___JsError___true__140);
|
|
4365
4438
|
return ret;
|
|
4366
4439
|
},
|
|
4367
4440
|
__wbindgen_generic_0000000000000006: function(arg0) {
|
|
@@ -4443,15 +4516,15 @@ function wasm_bindgen_4346cdda5a9d72ac___convert__closures_____invoke___wasm_bin
|
|
|
4443
4516
|
}
|
|
4444
4517
|
}
|
|
4445
4518
|
|
|
4446
|
-
function
|
|
4447
|
-
const ret = wasm.
|
|
4519
|
+
function wasm_bindgen_4346cdda5a9d72ac___convert__closures_____invoke___wasm_bindgen_4346cdda5a9d72ac___sys__JsNullable_wgpu_ce7204c20056c03e___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_4346cdda5a9d72ac___JsError___true__139(arg0, arg1, arg2) {
|
|
4520
|
+
const ret = wasm.wasm_bindgen_4346cdda5a9d72ac___convert__closures_____invoke___wasm_bindgen_4346cdda5a9d72ac___sys__JsNullable_wgpu_ce7204c20056c03e___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_4346cdda5a9d72ac___JsError___true__139(arg0, arg1, arg2);
|
|
4448
4521
|
if (ret[1]) {
|
|
4449
4522
|
throw takeFromExternrefTable0(ret[0]);
|
|
4450
4523
|
}
|
|
4451
4524
|
}
|
|
4452
4525
|
|
|
4453
|
-
function
|
|
4454
|
-
const ret = wasm.
|
|
4526
|
+
function wasm_bindgen_4346cdda5a9d72ac___convert__closures_____invoke___wasm_bindgen_4346cdda5a9d72ac___sys__JsNullable_wgpu_ce7204c20056c03e___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_4346cdda5a9d72ac___JsError___true__140(arg0, arg1, arg2) {
|
|
4527
|
+
const ret = wasm.wasm_bindgen_4346cdda5a9d72ac___convert__closures_____invoke___wasm_bindgen_4346cdda5a9d72ac___sys__JsNullable_wgpu_ce7204c20056c03e___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_4346cdda5a9d72ac___JsError___true__140(arg0, arg1, arg2);
|
|
4455
4528
|
if (ret[1]) {
|
|
4456
4529
|
throw takeFromExternrefTable0(ret[0]);
|
|
4457
4530
|
}
|
|
@@ -4461,6 +4534,11 @@ function wasm_bindgen_4346cdda5a9d72ac___convert__closures_____invoke___js_sys_5
|
|
|
4461
4534
|
wasm.wasm_bindgen_4346cdda5a9d72ac___convert__closures_____invoke___js_sys_5e75a17f0680aa0e___Function_fn_wasm_bindgen_4346cdda5a9d72ac___JsValue_____wasm_bindgen_4346cdda5a9d72ac___sys__Undefined___js_sys_5e75a17f0680aa0e___Function_fn_wasm_bindgen_4346cdda5a9d72ac___JsValue_____wasm_bindgen_4346cdda5a9d72ac___sys__Undefined_______true_(arg0, arg1, arg2, arg3);
|
|
4462
4535
|
}
|
|
4463
4536
|
|
|
4537
|
+
function wasm_bindgen_4346cdda5a9d72ac___convert__closures_____invoke___wasm_bindgen_4346cdda5a9d72ac___JsValue__u32__js_sys_5e75a17f0680aa0e___Array__bool__true_(arg0, arg1, arg2, arg3, arg4) {
|
|
4538
|
+
const ret = wasm.wasm_bindgen_4346cdda5a9d72ac___convert__closures_____invoke___wasm_bindgen_4346cdda5a9d72ac___JsValue__u32__js_sys_5e75a17f0680aa0e___Array__bool__true_(arg0, arg1, arg2, arg3, arg4);
|
|
4539
|
+
return ret !== 0;
|
|
4540
|
+
}
|
|
4541
|
+
|
|
4464
4542
|
|
|
4465
4543
|
const __wbindgen_enum_ColorSpaceConversion = ["none", "default"];
|
|
4466
4544
|
|