isard 1.0.0 → 1.2.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 +51 -0
- package/dist/{basemaps.d.ts → basemap/basemaps.d.ts} +3 -3
- package/dist/{basemaps.js → basemap/basemaps.js} +3 -3
- package/dist/basemap/basemaps.js.map +1 -0
- package/dist/{grid.d.ts → basemap/grid.d.ts} +6 -6
- package/dist/{grid.js → basemap/grid.js} +61 -67
- package/dist/basemap/grid.js.map +1 -0
- package/dist/{mvt.d.ts → basemap/mvt.d.ts} +1 -1
- package/dist/{mvt.js → basemap/mvt.js} +6 -6
- package/dist/basemap/mvt.js.map +1 -0
- package/dist/{pmtiles.d.ts → basemap/pmtiles.d.ts} +16 -10
- package/dist/{pmtiles.js → basemap/pmtiles.js} +41 -33
- package/dist/basemap/pmtiles.js.map +1 -0
- package/dist/{resample.d.ts → basemap/resample.d.ts} +11 -2
- package/dist/{resample.js → basemap/resample.js} +18 -16
- package/dist/basemap/resample.js.map +1 -0
- package/dist/{terrain.d.ts → basemap/terrain.d.ts} +3 -3
- package/dist/{terrain.js → basemap/terrain.js} +7 -7
- package/dist/basemap/terrain.js.map +1 -0
- package/dist/{vectorstyle.d.ts → basemap/vectorstyle.d.ts} +12 -10
- package/dist/{vectorstyle.js → basemap/vectorstyle.js} +129 -111
- package/dist/basemap/vectorstyle.js.map +1 -0
- package/dist/{vectortiles.d.ts → basemap/vectortiles.d.ts} +18 -18
- package/dist/{vectortiles.js → basemap/vectortiles.js} +157 -109
- package/dist/basemap/vectortiles.js.map +1 -0
- package/dist/{wmts.d.ts → basemap/wmts.d.ts} +3 -3
- package/dist/{wmts.js → basemap/wmts.js} +19 -14
- package/dist/basemap/wmts.js.map +1 -0
- package/dist/basemap.worker.js +2 -2
- package/dist/basemap.worker.js.map +14 -13
- package/dist/bind/layers.d.ts +46 -0
- package/dist/bind/layers.js +154 -0
- package/dist/bind/layers.js.map +1 -0
- package/dist/{crs.d.ts → data/crs.d.ts} +11 -11
- package/dist/{crs.js → data/crs.js} +38 -34
- package/dist/data/crs.js.map +1 -0
- package/dist/{gpx.d.ts → data/gpx.d.ts} +2 -2
- package/dist/{gpx.js → data/gpx.js} +20 -20
- package/dist/data/gpx.js.map +1 -0
- package/dist/{kml.d.ts → data/kml.d.ts} +2 -2
- package/dist/{kml.js → data/kml.js} +42 -39
- package/dist/data/kml.js.map +1 -0
- package/dist/{topojson.d.ts → data/topojson.d.ts} +2 -2
- package/dist/{topojson.js → data/topojson.js} +15 -10
- package/dist/data/topojson.js.map +1 -0
- package/dist/{xml.d.ts → data/xml.d.ts} +5 -5
- package/dist/{xml.js → data/xml.js} +19 -18
- package/dist/data/xml.js.map +1 -0
- package/dist/decoder.worker.js +4 -4
- package/dist/decoder.worker.js.map +7 -7
- package/dist/{decoders.d.ts → engine/decoders.d.ts} +3 -3
- package/dist/{decoders.js → engine/decoders.js} +28 -25
- package/dist/engine/decoders.js.map +1 -0
- package/dist/{loader.d.ts → engine/loader.d.ts} +1 -1
- package/dist/{loader.js → engine/loader.js} +17 -14
- package/dist/engine/loader.js.map +1 -0
- package/dist/{protocol.d.ts → engine/protocol.d.ts} +1 -1
- package/dist/engine/protocol.js +3 -0
- package/dist/engine/protocol.js.map +1 -0
- package/dist/{requests.d.ts → engine/requests.d.ts} +1 -1
- package/dist/{requests.js → engine/requests.js} +19 -16
- package/dist/engine/requests.js.map +1 -0
- package/dist/engine-loader.d.ts +13 -9
- package/dist/engine-loader.js +30 -30
- package/dist/engine-loader.js.map +1 -1
- package/dist/formats.d.ts +3 -3
- package/dist/formats.js +3 -3
- package/dist/formats.js.map +1 -1
- package/dist/geoplateforme.d.ts +13 -13
- package/dist/geoplateforme.js +23 -21
- package/dist/geoplateforme.js.map +1 -1
- package/dist/index.d.ts +30 -29
- package/dist/index.js +18 -18
- package/dist/index.js.map +1 -1
- package/dist/isard_bg.wasm +0 -0
- package/dist/isard_core_bg.wasm +0 -0
- package/dist/isard_points_bg.wasm +0 -0
- package/dist/{extrusions.d.ts → layers/extrusions.d.ts} +1 -1
- package/dist/{extrusions.js → layers/extrusions.js} +10 -5
- package/dist/layers/extrusions.js.map +1 -0
- package/dist/{features.d.ts → layers/features.d.ts} +10 -10
- package/dist/{features.js → layers/features.js} +44 -45
- package/dist/layers/features.js.map +1 -0
- package/dist/{glyphs.d.ts → layers/glyphs.d.ts} +6 -6
- package/dist/{glyphs.js → layers/glyphs.js} +45 -41
- package/dist/layers/glyphs.js.map +1 -0
- package/dist/{icons.d.ts → layers/icons.d.ts} +10 -10
- package/dist/{icons.js → layers/icons.js} +84 -69
- package/dist/layers/icons.js.map +1 -0
- package/dist/{layers.d.ts → layers/layers.d.ts} +9 -4
- package/dist/{layers.js → layers/layers.js} +35 -31
- package/dist/layers/layers.js.map +1 -0
- package/dist/{panoramas.d.ts → layers/panoramas.d.ts} +3 -3
- package/dist/{panoramas.js → layers/panoramas.js} +54 -43
- package/dist/layers/panoramas.js.map +1 -0
- package/dist/{pointclouds.d.ts → layers/pointclouds.d.ts} +5 -5
- package/dist/{pointclouds.js → layers/pointclouds.js} +26 -34
- package/dist/layers/pointclouds.js.map +1 -0
- package/dist/{symbols.d.ts → layers/symbols.d.ts} +3 -3
- package/dist/{symbols.js → layers/symbols.js} +69 -72
- package/dist/layers/symbols.js.map +1 -0
- package/dist/map/basemap-layers.d.ts +26 -0
- package/dist/map/basemap-layers.js +61 -0
- package/dist/map/basemap-layers.js.map +1 -0
- package/dist/map/canvas.d.ts +17 -0
- package/dist/map/canvas.js +56 -0
- package/dist/map/canvas.js.map +1 -0
- package/dist/map/checks.d.ts +11 -0
- package/dist/map/checks.js +39 -0
- package/dist/map/checks.js.map +1 -0
- package/dist/map/credits.d.ts +17 -0
- package/dist/map/credits.js +34 -0
- package/dist/map/credits.js.map +1 -0
- package/dist/map/engine-settings.d.ts +15 -0
- package/dist/map/engine-settings.js +45 -0
- package/dist/map/engine-settings.js.map +1 -0
- package/dist/map/engines.d.ts +41 -0
- package/dist/map/engines.js +77 -0
- package/dist/map/engines.js.map +1 -0
- package/dist/map/events.d.ts +14 -0
- package/dist/map/events.js +46 -0
- package/dist/map/events.js.map +1 -0
- package/dist/map/frame-loop.d.ts +61 -0
- package/dist/map/frame-loop.js +139 -0
- package/dist/map/frame-loop.js.map +1 -0
- package/dist/map/hover-pick.d.ts +30 -0
- package/dist/map/hover-pick.js +56 -0
- package/dist/map/hover-pick.js.map +1 -0
- package/dist/map/layer-spec.d.ts +42 -0
- package/dist/map/layer-spec.js +34 -0
- package/dist/map/layer-spec.js.map +1 -0
- package/dist/map/layer-stack.d.ts +36 -0
- package/dist/map/layer-stack.js +101 -0
- package/dist/map/layer-stack.js.map +1 -0
- package/dist/map/overlay-host.d.ts +36 -0
- package/dist/map/overlay-host.js +101 -0
- package/dist/map/overlay-host.js.map +1 -0
- package/dist/map/panorama-host.d.ts +5 -0
- package/dist/map/panorama-host.js +32 -0
- package/dist/map/panorama-host.js.map +1 -0
- package/dist/map/raster-source.d.ts +11 -0
- package/dist/map/raster-source.js +26 -0
- package/dist/map/raster-source.js.map +1 -0
- package/dist/map/symbol-atlases.d.ts +26 -0
- package/dist/map/symbol-atlases.js +59 -0
- package/dist/map/symbol-atlases.js.map +1 -0
- package/dist/map/viewshed.d.ts +5 -0
- package/dist/map/viewshed.js +28 -0
- package/dist/map/viewshed.js.map +1 -0
- package/dist/map/workers.d.ts +46 -0
- package/dist/map/workers.js +73 -0
- package/dist/map/workers.js.map +1 -0
- package/dist/map.d.ts +46 -127
- package/dist/map.js +183 -698
- package/dist/map.js.map +1 -1
- package/dist/projections.d.ts +3 -3
- package/dist/projections.js +2 -2
- package/dist/projections.js.map +1 -1
- package/dist/react/Control.d.ts +11 -0
- package/dist/react/Control.js +18 -0
- package/dist/react/Control.js.map +1 -0
- package/dist/react/CustomLayer.d.ts +11 -0
- package/dist/react/CustomLayer.js +30 -0
- package/dist/react/CustomLayer.js.map +1 -0
- package/dist/react/IsardMap.d.ts +43 -0
- package/dist/react/IsardMap.js +146 -0
- package/dist/react/IsardMap.js.map +1 -0
- package/dist/react/Layer.d.ts +42 -0
- package/dist/react/Layer.js +74 -0
- package/dist/react/Layer.js.map +1 -0
- package/dist/react/Marker.d.ts +24 -0
- package/dist/react/Marker.js +53 -0
- package/dist/react/Marker.js.map +1 -0
- package/dist/react/Panel.d.ts +11 -0
- package/dist/react/Panel.js +37 -0
- package/dist/react/Panel.js.map +1 -0
- package/dist/react/Popup.d.ts +18 -0
- package/dist/react/Popup.js +60 -0
- package/dist/react/Popup.js.map +1 -0
- package/dist/react/Swipe.d.ts +9 -0
- package/dist/react/Swipe.js +41 -0
- package/dist/react/Swipe.js.map +1 -0
- package/dist/react/Viewshed.d.ts +5 -0
- package/dist/react/Viewshed.js +28 -0
- package/dist/react/Viewshed.js.map +1 -0
- package/dist/react/context.d.ts +32 -0
- package/dist/react/context.js +20 -0
- package/dist/react/context.js.map +1 -0
- package/dist/react/index.d.ts +26 -0
- package/dist/react/index.js +22 -0
- package/dist/react/index.js.map +1 -0
- package/dist/settings.d.ts +6 -10
- package/dist/settings.js +19 -17
- package/dist/settings.js.map +1 -1
- package/dist/types.d.ts +8 -8
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/dist/{controls.d.ts → ui/controls.d.ts} +1 -1
- package/dist/{controls.js → ui/controls.js} +6 -4
- package/dist/ui/controls.js.map +1 -0
- package/dist/{interaction.d.ts → ui/interaction.d.ts} +9 -5
- package/dist/{interaction.js → ui/interaction.js} +9 -8
- package/dist/ui/interaction.js.map +1 -0
- package/dist/{overlay.d.ts → ui/overlay.d.ts} +2 -2
- package/dist/{overlay.js → ui/overlay.js} +18 -20
- package/dist/ui/overlay.js.map +1 -0
- package/dist/{style.d.ts → ui/style.d.ts} +1 -1
- package/dist/{style.js → ui/style.js} +2 -2
- package/dist/ui/style.js.map +1 -0
- package/dist/{animation.d.ts → util/animation.d.ts} +9 -5
- package/dist/{animation.js → util/animation.js} +6 -6
- package/dist/util/animation.js.map +1 -0
- package/dist/{color.d.ts → util/color.d.ts} +1 -1
- package/dist/{color.js → util/color.js} +14 -16
- package/dist/util/color.js.map +1 -0
- package/dist/{geo.d.ts → util/geo.d.ts} +6 -6
- package/dist/{geo.js → util/geo.js} +12 -12
- package/dist/util/geo.js.map +1 -0
- package/dist/util/guards.d.ts +7 -0
- package/dist/util/guards.js +8 -0
- package/dist/util/guards.js.map +1 -0
- package/dist/util/lru.js.map +1 -0
- package/dist/wasm/isard.d.ts +168 -0
- package/dist/wasm/isard.js +146 -0
- package/dist/wasm/isard_core.d.ts +144 -0
- package/dist/wasm/isard_core.js +122 -0
- package/dist/{basemap.worker.d.ts → workers/basemap.worker.d.ts} +17 -7
- package/dist/workers/basemap.worker.js +658 -0
- package/dist/workers/basemap.worker.js.map +1 -0
- package/package.json +24 -1
- package/vite.js +1 -1
- package/dist/animation.js.map +0 -1
- package/dist/basemaps.js.map +0 -1
- package/dist/color.js.map +0 -1
- package/dist/controls.js.map +0 -1
- package/dist/crs.js.map +0 -1
- package/dist/decoders.js.map +0 -1
- package/dist/extrusions.js.map +0 -1
- package/dist/features.js.map +0 -1
- package/dist/geo.js.map +0 -1
- package/dist/glyphs.js.map +0 -1
- package/dist/gpx.js.map +0 -1
- package/dist/grid.js.map +0 -1
- package/dist/icons.js.map +0 -1
- package/dist/interaction.js.map +0 -1
- package/dist/kml.js.map +0 -1
- package/dist/layers.js.map +0 -1
- package/dist/loader.js.map +0 -1
- package/dist/lru.js.map +0 -1
- package/dist/mvt.js.map +0 -1
- package/dist/overlay.js.map +0 -1
- package/dist/panoramas.js.map +0 -1
- package/dist/pmtiles.js.map +0 -1
- package/dist/pointclouds.js.map +0 -1
- package/dist/protocol.js +0 -2
- package/dist/protocol.js.map +0 -1
- package/dist/requests.js.map +0 -1
- package/dist/resample.js.map +0 -1
- package/dist/style.js.map +0 -1
- package/dist/symbols.js.map +0 -1
- package/dist/terrain.js.map +0 -1
- package/dist/topojson.js.map +0 -1
- package/dist/vectorstyle.js.map +0 -1
- package/dist/vectortiles.js.map +0 -1
- package/dist/wmts.js.map +0 -1
- package/dist/xml.js.map +0 -1
- /package/dist/{lru.d.ts → util/lru.d.ts} +0 -0
- /package/dist/{lru.js → util/lru.js} +0 -0
|
@@ -30,30 +30,28 @@ const NAMES = 'aliceblue f0f8ff antiquewhite faebd7 aqua 00ffff aquamarine 7fffd
|
|
|
30
30
|
'springgreen 00ff7f steelblue 4682b4 tan d2b48c teal 008080 thistle d8bfd8 tomato ff6347 turquoise 40e0d0 ' +
|
|
31
31
|
'violet ee82ee wheat f5deb3 white ffffff whitesmoke f5f5f5 yellow ffff00 yellowgreen 9acd32';
|
|
32
32
|
let named;
|
|
33
|
-
|
|
33
|
+
const namedHex = (name) => {
|
|
34
34
|
if (!named) {
|
|
35
|
-
named = new Map();
|
|
36
35
|
const words = NAMES.split(' ');
|
|
37
|
-
|
|
38
|
-
named.set(words[i], words[i + 1]);
|
|
36
|
+
named = new Map(Array.from({ length: Math.floor(words.length / 2) }, (_, i) => [words[2 * i] ?? '', words[2 * i + 1] ?? '']));
|
|
39
37
|
}
|
|
40
38
|
return named.get(name);
|
|
41
|
-
}
|
|
39
|
+
};
|
|
42
40
|
const clamp = (v) => (Number.isFinite(v) ? Math.max(0, Math.min(1, v)) : 0);
|
|
43
|
-
|
|
41
|
+
const hex = (digits) => {
|
|
44
42
|
if (!/^[0-9a-f]+$/.test(digits) || ![3, 4, 6, 8].includes(digits.length))
|
|
45
43
|
return undefined;
|
|
46
44
|
const full = digits.length <= 4 ? [...digits].map((h) => h + h).join('') : digits;
|
|
47
45
|
const v = (i) => Number.parseInt(full.slice(i, i + 2), 16) / 255;
|
|
48
46
|
return [v(0), v(2), v(4), full.length === 8 ? v(6) : 1];
|
|
49
|
-
}
|
|
47
|
+
};
|
|
50
48
|
/** An alpha: a number from 0 to 1 or a percentage */
|
|
51
|
-
|
|
49
|
+
const alpha = (p) => {
|
|
52
50
|
if (p === undefined)
|
|
53
51
|
return 1;
|
|
54
52
|
return clamp(p.endsWith('%') ? Number.parseFloat(p) / 100 : Number.parseFloat(p));
|
|
55
|
-
}
|
|
56
|
-
|
|
53
|
+
};
|
|
54
|
+
const hsl = (h, s, l) => {
|
|
57
55
|
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
58
56
|
const p = 2 * l - q;
|
|
59
57
|
const hue = (t) => {
|
|
@@ -67,9 +65,9 @@ function hsl(h, s, l) {
|
|
|
67
65
|
return p;
|
|
68
66
|
};
|
|
69
67
|
return [hue(h + 1 / 3), hue(h), hue(h - 1 / 3)];
|
|
70
|
-
}
|
|
68
|
+
};
|
|
71
69
|
/** A CSS color to RGBA 0-1; undefined if it is not one */
|
|
72
|
-
export
|
|
70
|
+
export const parseCssColor = (value) => {
|
|
73
71
|
if (typeof value !== 'string')
|
|
74
72
|
return undefined;
|
|
75
73
|
const c = value.trim().toLowerCase();
|
|
@@ -89,10 +87,10 @@ export function parseCssColor(value) {
|
|
|
89
87
|
const a = alpha(parts[3]);
|
|
90
88
|
if (match[1].startsWith('rgb')) {
|
|
91
89
|
const channel = (p) => clamp(p.endsWith('%') ? Number.parseFloat(p) / 100 : Number.parseFloat(p) / 255);
|
|
92
|
-
return [channel(parts[0]), channel(parts[1]), channel(parts[2]), a];
|
|
90
|
+
return [channel(parts[0] ?? ''), channel(parts[1] ?? ''), channel(parts[2] ?? ''), a];
|
|
93
91
|
}
|
|
94
|
-
const h = Number.parseFloat(parts[0]) / 360;
|
|
95
|
-
const [r, g, b] = hsl(h, clamp(Number.parseFloat(parts[1]) / 100), clamp(Number.parseFloat(parts[2]) / 100));
|
|
92
|
+
const h = Number.parseFloat(parts[0] ?? '') / 360;
|
|
93
|
+
const [r, g, b] = hsl(h, clamp(Number.parseFloat(parts[1] ?? '') / 100), clamp(Number.parseFloat(parts[2] ?? '') / 100));
|
|
96
94
|
return [r, g, b, a];
|
|
97
|
-
}
|
|
95
|
+
};
|
|
98
96
|
//# sourceMapping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AC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;QAEhH,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACxF,CAAC;IAED,MAAM,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,GAAG,CAAC;IAClD,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CACnB,CAAC,EACD,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,GAAG,CAAC,EAC9C,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,GAAG,CAAC,CAC/C,CAAC;IAEF,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACtB,CAAC,CAAC","sourcesContent":["/**\n * CSS colors to RGBA 0-1: `#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`, `rgb()` and `rgba()`, `hsl()` and `hsla()` (comma\n * or space syntax, `/` before the alpha, percentages), the CSS named colors and `transparent`. No DOM: the workers use\n * it too.\n */\n\nexport type Rgba = [r: number, g: number, b: number, a: number];\n\n/** The CSS named colors, as name and `rrggbb` pairs */\nconst NAMES =\n 'aliceblue f0f8ff antiquewhite faebd7 aqua 00ffff aquamarine 7fffd4 azure f0ffff beige f5f5dc bisque ffe4c4 ' +\n 'black 000000 blanchedalmond ffebcd blue 0000ff blueviolet 8a2be2 brown a52a2a burlywood deb887 cadetblue 5f9ea0 ' +\n 'chartreuse 7fff00 chocolate d2691e coral ff7f50 cornflowerblue 6495ed cornsilk fff8dc crimson dc143c ' +\n 'cyan 00ffff darkblue 00008b darkcyan 008b8b darkgoldenrod b8860b darkgray a9a9a9 darkgreen 006400 ' +\n 'darkgrey a9a9a9 darkkhaki bdb76b darkmagenta 8b008b darkolivegreen 556b2f darkorange ff8c00 darkorchid 9932cc ' +\n 'darkred 8b0000 darksalmon e9967a darkseagreen 8fbc8f darkslateblue 483d8b darkslategray 2f4f4f ' +\n 'darkslategrey 2f4f4f darkturquoise 00ced1 darkviolet 9400d3 deeppink ff1493 deepskyblue 00bfff dimgray 696969 ' +\n 'dimgrey 696969 dodgerblue 1e90ff firebrick b22222 floralwhite fffaf0 forestgreen 228b22 fuchsia ff00ff ' +\n 'gainsboro dcdcdc ghostwhite f8f8ff gold ffd700 goldenrod daa520 gray 808080 green 008000 greenyellow adff2f ' +\n 'grey 808080 honeydew f0fff0 hotpink ff69b4 indianred cd5c5c indigo 4b0082 ivory fffff0 khaki f0e68c ' +\n 'lavender e6e6fa lavenderblush fff0f5 lawngreen 7cfc00 lemonchiffon fffacd lightblue add8e6 lightcoral f08080 ' +\n 'lightcyan e0ffff lightgoldenrodyellow fafad2 lightgray d3d3d3 lightgreen 90ee90 lightgrey d3d3d3 ' +\n 'lightpink ffb6c1 lightsalmon ffa07a lightseagreen 20b2aa lightskyblue 87cefa lightslategray 778899 ' +\n 'lightslategrey 778899 lightsteelblue b0c4de lightyellow ffffe0 lime 00ff00 limegreen 32cd32 linen faf0e6 ' +\n 'magenta ff00ff maroon 800000 mediumaquamarine 66cdaa mediumblue 0000cd mediumorchid ba55d3 ' +\n 'mediumpurple 9370db mediumseagreen 3cb371 mediumslateblue 7b68ee mediumspringgreen 00fa9a ' +\n 'mediumturquoise 48d1cc mediumvioletred c71585 midnightblue 191970 mintcream f5fffa mistyrose ffe4e1 ' +\n 'moccasin ffe4b5 navajowhite ffdead navy 000080 oldlace fdf5e6 olive 808000 olivedrab 6b8e23 orange ffa500 ' +\n 'orangered ff4500 orchid da70d6 palegoldenrod eee8aa palegreen 98fb98 paleturquoise afeeee ' +\n 'palevioletred db7093 papayawhip ffefd5 peachpuff ffdab9 peru cd853f pink ffc0cb plum dda0dd ' +\n 'powderblue b0e0e6 purple 800080 rebeccapurple 663399 red ff0000 rosybrown bc8f8f royalblue 4169e1 ' +\n 'saddlebrown 8b4513 salmon fa8072 sandybrown f4a460 seagreen 2e8b57 seashell fff5ee sienna a0522d ' +\n 'silver c0c0c0 skyblue 87ceeb slateblue 6a5acd slategray 708090 slategrey 708090 snow fffafa ' +\n 'springgreen 00ff7f steelblue 4682b4 tan d2b48c teal 008080 thistle d8bfd8 tomato ff6347 turquoise 40e0d0 ' +\n 'violet ee82ee wheat f5deb3 white ffffff whitesmoke f5f5f5 yellow ffff00 yellowgreen 9acd32';\n\nlet named: Map<string, string> | undefined;\n\nconst namedHex = (name: string): string | undefined => {\n if (!named) {\n const words = NAMES.split(' ');\n\n named = new Map(\n Array.from({ length: Math.floor(words.length / 2) }, (_, i) => [words[2 * i] ?? '', words[2 * i + 1] ?? '']),\n );\n }\n\n return named.get(name);\n};\n\nconst clamp = (v: number) => (Number.isFinite(v) ? Math.max(0, Math.min(1, v)) : 0);\n\nconst hex = (digits: string): Rgba | undefined => {\n if (!/^[0-9a-f]+$/.test(digits) || ![3, 4, 6, 8].includes(digits.length)) return undefined;\n\n const full = digits.length <= 4 ? [...digits].map((h) => h + h).join('') : digits;\n const v = (i: number) => Number.parseInt(full.slice(i, i + 2), 16) / 255;\n\n return [v(0), v(2), v(4), full.length === 8 ? v(6) : 1];\n};\n\n/** An alpha: a number from 0 to 1 or a percentage */\nconst alpha = (p: string | undefined): number => {\n if (p === undefined) return 1;\n\n return clamp(p.endsWith('%') ? Number.parseFloat(p) / 100 : Number.parseFloat(p));\n};\n\nconst hsl = (h: number, s: number, l: number): [number, number, number] => {\n const q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n const p = 2 * l - q;\n const hue = (t: number) => {\n const u = ((t % 1) + 1) % 1;\n\n if (u < 1 / 6) return p + (q - p) * 6 * u;\n if (u < 1 / 2) return q;\n if (u < 2 / 3) return p + (q - p) * (2 / 3 - u) * 6;\n\n return p;\n };\n\n return [hue(h + 1 / 3), hue(h), hue(h - 1 / 3)];\n};\n\n/** A CSS color to RGBA 0-1; undefined if it is not one */\nexport const parseCssColor = (value: unknown): Rgba | undefined => {\n if (typeof value !== 'string') return undefined;\n\n const c = value.trim().toLowerCase();\n\n if (c.startsWith('#')) return hex(c.slice(1));\n if (c === 'transparent') return [0, 0, 0, 0];\n\n const name = namedHex(c);\n\n if (name) return hex(name);\n\n const match = /^(rgba?|hsla?)\\(([^)]*)\\)$/.exec(c);\n\n if (!match?.[1] || match[2] === undefined) return undefined;\n\n const parts = match[2].split(/[\\s,/]+/).filter(Boolean);\n\n if (parts.length < 3 || parts.slice(0, 3).some((p) => Number.isNaN(Number.parseFloat(p)))) return undefined;\n\n const a = alpha(parts[3]);\n\n if (match[1].startsWith('rgb')) {\n const channel = (p: string) => clamp(p.endsWith('%') ? Number.parseFloat(p) / 100 : Number.parseFloat(p) / 255);\n\n return [channel(parts[0] ?? ''), channel(parts[1] ?? ''), channel(parts[2] ?? ''), a];\n }\n\n const h = Number.parseFloat(parts[0] ?? '') / 360;\n const [r, g, b] = hsl(\n h,\n clamp(Number.parseFloat(parts[1] ?? '') / 100),\n clamp(Number.parseFloat(parts[2] ?? '') / 100),\n );\n\n return [r, g, b, a];\n};\n"]}
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
* sent to the engine, the tiles of a view, the flights, the label candidates of the vector tiles.
|
|
4
4
|
*/
|
|
5
5
|
/** Mercator x of a longitude (degrees) */
|
|
6
|
-
export declare
|
|
6
|
+
export declare const mercatorX: (lon: number) => number;
|
|
7
7
|
/** Mercator y of a latitude (degrees), clamped to the edges of the map */
|
|
8
|
-
export declare
|
|
8
|
+
export declare const mercatorY: (lat: number) => number;
|
|
9
9
|
/** Longitude (degrees) of a Mercator x */
|
|
10
|
-
export declare
|
|
10
|
+
export declare const longitude: (x: number) => number;
|
|
11
11
|
/** Latitude (degrees) of a Mercator y */
|
|
12
|
-
export declare
|
|
12
|
+
export declare const latitude: (y: number) => number;
|
|
13
13
|
/** Mercator x, y of a longitude and latitude */
|
|
14
|
-
export declare
|
|
14
|
+
export declare const toMercator: ([lon, lat]: readonly [number, number, ...unknown[]]) => [x: number, y: number];
|
|
15
15
|
/** Longitude and latitude of a Mercator x, y */
|
|
16
|
-
export declare
|
|
16
|
+
export declare const fromMercator: ([x, y]: readonly [number, number]) => [lon: number, lat: number];
|
|
@@ -5,28 +5,28 @@
|
|
|
5
5
|
/** The latitude where Web Mercator is square: the edges of the map */
|
|
6
6
|
const MAX_LAT = 85.051128779806589;
|
|
7
7
|
/** Mercator x of a longitude (degrees) */
|
|
8
|
-
export
|
|
8
|
+
export const mercatorX = (lon) => {
|
|
9
9
|
return (lon + 180) / 360;
|
|
10
|
-
}
|
|
10
|
+
};
|
|
11
11
|
/** Mercator y of a latitude (degrees), clamped to the edges of the map */
|
|
12
|
-
export
|
|
12
|
+
export const mercatorY = (lat) => {
|
|
13
13
|
const phi = (Math.max(-MAX_LAT, Math.min(MAX_LAT, lat)) * Math.PI) / 180;
|
|
14
14
|
return 0.5 - Math.log(Math.tan(Math.PI / 4 + phi / 2)) / (2 * Math.PI);
|
|
15
|
-
}
|
|
15
|
+
};
|
|
16
16
|
/** Longitude (degrees) of a Mercator x */
|
|
17
|
-
export
|
|
17
|
+
export const longitude = (x) => {
|
|
18
18
|
return x * 360 - 180;
|
|
19
|
-
}
|
|
19
|
+
};
|
|
20
20
|
/** Latitude (degrees) of a Mercator y */
|
|
21
|
-
export
|
|
21
|
+
export const latitude = (y) => {
|
|
22
22
|
return (Math.atan(Math.sinh(Math.PI * (1 - 2 * y))) * 180) / Math.PI;
|
|
23
|
-
}
|
|
23
|
+
};
|
|
24
24
|
/** Mercator x, y of a longitude and latitude */
|
|
25
|
-
export
|
|
25
|
+
export const toMercator = ([lon, lat]) => {
|
|
26
26
|
return [mercatorX(lon), mercatorY(lat)];
|
|
27
|
-
}
|
|
27
|
+
};
|
|
28
28
|
/** Longitude and latitude of a Mercator x, y */
|
|
29
|
-
export
|
|
29
|
+
export const fromMercator = ([x, y]) => {
|
|
30
30
|
return [longitude(x), latitude(y)];
|
|
31
|
-
}
|
|
31
|
+
};
|
|
32
32
|
//# sourceMappingURL=geo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geo.js","sourceRoot":"","sources":["../../src/util/geo.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,sEAAsE;AACtE,MAAM,OAAO,GAAG,kBAAkB,CAAC;AAEnC,0CAA0C;AAC1C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAW,EAAU,EAAE;IAC/C,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AAC3B,CAAC,CAAC;AAEF,0EAA0E;AAC1E,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAW,EAAU,EAAE;IAC/C,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;IAEzE,OAAO,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;AACzE,CAAC,CAAC;AAEF,0CAA0C;AAC1C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAS,EAAU,EAAE;IAC7C,OAAO,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC;AACvB,CAAC,CAAC;AAEF,yCAAyC;AACzC,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAU,EAAE;IAC5C,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;AACvE,CAAC,CAAC;AAEF,gDAAgD;AAChD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAA0C,EAA0B,EAAE;IACxG,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1C,CAAC,CAAC;AAEF,gDAAgD;AAChD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAA4B,EAA8B,EAAE;IAC5F,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AACrC,CAAC,CAAC","sourcesContent":["/**\n * Web Mercator in [0, 1] across the world (y towards the south), for the page and the workers alike: the positions\n * sent to the engine, the tiles of a view, the flights, the label candidates of the vector tiles.\n */\n\n/** The latitude where Web Mercator is square: the edges of the map */\nconst MAX_LAT = 85.051128779806589;\n\n/** Mercator x of a longitude (degrees) */\nexport const mercatorX = (lon: number): number => {\n return (lon + 180) / 360;\n};\n\n/** Mercator y of a latitude (degrees), clamped to the edges of the map */\nexport const mercatorY = (lat: number): number => {\n const phi = (Math.max(-MAX_LAT, Math.min(MAX_LAT, lat)) * Math.PI) / 180;\n\n return 0.5 - Math.log(Math.tan(Math.PI / 4 + phi / 2)) / (2 * Math.PI);\n};\n\n/** Longitude (degrees) of a Mercator x */\nexport const longitude = (x: number): number => {\n return x * 360 - 180;\n};\n\n/** Latitude (degrees) of a Mercator y */\nexport const latitude = (y: number): number => {\n return (Math.atan(Math.sinh(Math.PI * (1 - 2 * y))) * 180) / Math.PI;\n};\n\n/** Mercator x, y of a longitude and latitude */\nexport const toMercator = ([lon, lat]: readonly [number, number, ...unknown[]]): [x: number, y: number] => {\n return [mercatorX(lon), mercatorY(lat)];\n};\n\n/** Longitude and latitude of a Mercator x, y */\nexport const fromMercator = ([x, y]: readonly [number, number]): [lon: number, lat: number] => {\n return [longitude(x), latitude(y)];\n};\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type guards for data from outside (fetched JSON, messages): what the code reads is checked at run time.
|
|
3
|
+
*/
|
|
4
|
+
/** An object (not null, not an array): its keys can be read */
|
|
5
|
+
export declare const isRecord: (value: unknown) => value is Record<string, unknown>;
|
|
6
|
+
/** An array of numbers */
|
|
7
|
+
export declare const isNumbers: (value: unknown) => value is number[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type guards for data from outside (fetched JSON, messages): what the code reads is checked at run time.
|
|
3
|
+
*/
|
|
4
|
+
/** An object (not null, not an array): its keys can be read */
|
|
5
|
+
export const isRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
6
|
+
/** An array of numbers */
|
|
7
|
+
export const isNumbers = (value) => Array.isArray(value) && value.every((v) => typeof v === 'number');
|
|
8
|
+
//# sourceMappingURL=guards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guards.js","sourceRoot":"","sources":["../../src/util/guards.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,+DAA+D;AAC/D,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CAC3E,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAEvE,0BAA0B;AAC1B,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAc,EAAqB,EAAE,CAC7D,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC","sourcesContent":["/**\n * Type guards for data from outside (fetched JSON, messages): what the code reads is checked at run time.\n */\n\n/** An object (not null, not an array): its keys can be read */\nexport const isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n\n/** An array of numbers */\nexport const isNumbers = (value: unknown): value is number[] =>\n Array.isArray(value) && value.every((v) => typeof v === 'number');\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lru.js","sourceRoot":"","sources":["../../src/util/lru.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAO,GAAG;IAKL;IACU;IALF,OAAO,GAAG,IAAI,GAAG,EAAQ,CAAC;IAE3C,0EAA0E;IAC1E,YACS,QAAgB,EACN,KAAkC;QAD5C,aAAQ,GAAR,QAAQ,CAAQ;QACN,UAAK,GAAL,KAAK,CAA6B;IAClD,CAAC;IAEJ,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;IAED,0EAA0E;IAC1E,GAAG,CAAC,GAAM;QACR,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAEpC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACzB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC/B,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAED,8CAA8C;IAC9C,GAAG,CAAC,GAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IAED,sGAAsG;IACtG,GAAG,CAAC,GAAM,EAAE,KAAQ;QAClB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACzB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC7B,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACzC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ;gBAAE,MAAM;YAC9C,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAC5B,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IAED,MAAM,CAAC,GAAM;QACX,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;IAED,4CAA4C;IAC5C,MAAM;QACJ,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;IAC/B,CAAC;IAED,KAAK;QACH,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;CACF","sourcesContent":["/**\n * A cache keeping its most recently used entries (the decoded tiles and images of the workers, the source tiles of a\n * reprojection, the labels of the vector tiles): a `Map` in order of use, the least recent dropped past `capacity`.\n */\nexport class Lru<K, V> {\n private readonly entries = new Map<K, V>();\n\n /** `evict`: told of each entry dropped for room (not of those deleted) */\n constructor(\n public capacity: number,\n private readonly evict?: (value: V, key: K) => void,\n ) {}\n\n get size(): number {\n return this.entries.size;\n }\n\n /** The value of a key, now the most recently used; undefined if absent */\n get(key: K): V | undefined {\n const value = this.entries.get(key);\n\n if (value !== undefined) {\n this.entries.delete(key);\n this.entries.set(key, value);\n }\n\n return value;\n }\n\n /** Whether a key is kept, without using it */\n has(key: K): boolean {\n return this.entries.has(key);\n }\n\n /** Adds or replaces a value, the most recently used; drops the least recent ones past the capacity */\n set(key: K, value: V): void {\n this.entries.delete(key);\n this.entries.set(key, value);\n for (const [oldest, old] of this.entries) {\n if (this.entries.size <= this.capacity) break;\n this.entries.delete(oldest);\n this.evict?.(old, oldest);\n }\n }\n\n delete(key: K): boolean {\n return this.entries.delete(key);\n }\n\n /** The values, least recently used first */\n values(): IterableIterator<V> {\n return this.entries.values();\n }\n\n clear(): void {\n this.entries.clear();\n }\n}\n"]}
|
package/dist/wasm/isard.d.ts
CHANGED
|
@@ -266,10 +266,19 @@ export interface PickResult {
|
|
|
266
266
|
|
|
267
267
|
|
|
268
268
|
|
|
269
|
+
/**
|
|
270
|
+
* A map on one canvas: its WebGL2 context, camera, ground (raster layers over the relief) and the layers over it.
|
|
271
|
+
* Draws only when `render` is called (the JavaScript side calls it after `redraw` asks for a frame)
|
|
272
|
+
*/
|
|
269
273
|
export class Engine {
|
|
270
274
|
free(): void;
|
|
271
275
|
/**
|
|
272
276
|
* Circle layer of `feature_count` features: points (Mercator [0, 1], interleaved) and the feature of each
|
|
277
|
+
*
|
|
278
|
+
* # Errors
|
|
279
|
+
*
|
|
280
|
+
* Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
|
|
281
|
+
* info log), or when `feature_count` features need a table texture past the GPU's `MAX_TEXTURE_SIZE`
|
|
273
282
|
*/
|
|
274
283
|
addCircles(points: Float64Array, feature: Uint32Array, feature_count: number): number;
|
|
275
284
|
/**
|
|
@@ -280,29 +289,53 @@ export class Engine {
|
|
|
280
289
|
addCustomLayer(render: () => void, depth: boolean): number;
|
|
281
290
|
/**
|
|
282
291
|
* An empty extrusion layer: its blocks come in batches (`setExtrusionBatch`)
|
|
292
|
+
*
|
|
293
|
+
* # Errors
|
|
294
|
+
*
|
|
295
|
+
* Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
|
|
296
|
+
* info log)
|
|
283
297
|
*/
|
|
284
298
|
addExtrusions(): number;
|
|
285
299
|
/**
|
|
286
300
|
* Fill layer of `feature_count` features: polygons given by their points (Mercator [0, 1], interleaved), the first
|
|
287
301
|
* point of each ring (`ring_start`, one more entry than rings), the first ring of each polygon (`polygon_start`,
|
|
288
302
|
* one more entry than polygons; the first ring is the outer one, the others holes) and the feature of each polygon
|
|
303
|
+
*
|
|
304
|
+
* # Errors
|
|
305
|
+
*
|
|
306
|
+
* Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
|
|
307
|
+
* info log), or when `feature_count` features need a table texture past the GPU's `MAX_TEXTURE_SIZE`
|
|
289
308
|
*/
|
|
290
309
|
addFills(points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, feature: Uint32Array, feature_count: number): number;
|
|
291
310
|
/**
|
|
292
311
|
* Ground layer running `code` (GLSL ES 3.0 defining `vec4 ground(vec2 offset)`, see `render::ground`) over the
|
|
293
312
|
* ground; `anchor`: Mercator point the offsets are taken from; bounds: Mercator box it shows in. Compilation errors
|
|
294
313
|
* come back with the shader's info log (line numbers of `code`)
|
|
314
|
+
*
|
|
315
|
+
* # Errors
|
|
316
|
+
*
|
|
317
|
+
* Throws (to JavaScript) when `code` does not compile or link, with the shader's info log
|
|
295
318
|
*/
|
|
296
319
|
addGround(code: string, anchor_x: number, anchor_y: number, min_x: number, min_y: number, max_x: number, max_y: number): number;
|
|
297
320
|
/**
|
|
298
321
|
* Line layer of `feature_count` features: polylines given by their points (Mercator [0, 1], interleaved), the
|
|
299
322
|
* first point of each (`start`, one more entry than lines) and the feature each one belongs to
|
|
323
|
+
*
|
|
324
|
+
* # Errors
|
|
325
|
+
*
|
|
326
|
+
* Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
|
|
327
|
+
* info log), or when the features or the lines need a table texture past the GPU's `MAX_TEXTURE_SIZE`
|
|
300
328
|
*/
|
|
301
329
|
addLines(points: Float64Array, start: Uint32Array, feature: Uint32Array, feature_count: number): number;
|
|
302
330
|
/**
|
|
303
331
|
* A glTF / GLB model (its URL, a `blob:` one for data of the page) drawn at each instance of `instances`
|
|
304
332
|
* (`INSTANCE_NUMBERS` numbers each: longitude, latitude, altitude, heading, pitch, roll in degrees, scale);
|
|
305
333
|
* `ground`: altitudes above the relief, else above the ellipsoid
|
|
334
|
+
*
|
|
335
|
+
* # Errors
|
|
336
|
+
*
|
|
337
|
+
* Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
|
|
338
|
+
* info log). A model that fails to load or decode does not throw: the layer stays empty
|
|
306
339
|
*/
|
|
307
340
|
addModels(url: string, instances: Float64Array, ground: boolean): number;
|
|
308
341
|
/**
|
|
@@ -311,28 +344,53 @@ export class Engine {
|
|
|
311
344
|
* edges (node index pairs, interleaved). `line_start` and `line_points`: the line of each edge from A to B, points
|
|
312
345
|
* `line_start[e] .. line_start[e + 1]` of `line_points` (Mercator, interleaved; straight if fewer than two). `costs`: per edge, the
|
|
313
346
|
* cost of travelling it from A to B then from B to A; without, values are interpolated along the edges.
|
|
347
|
+
*
|
|
348
|
+
* # Errors
|
|
349
|
+
*
|
|
350
|
+
* Throws (to JavaScript) when `style` is not 25 numbers, `edges` is not node pairs or names a node past
|
|
351
|
+
* those of `mercator`, the nodes or edges need a table texture past the GPU's `MAX_TEXTURE_SIZE`, or when
|
|
352
|
+
* a WebGL object cannot be created or a shader fails to compile (the error carries its info log)
|
|
314
353
|
*/
|
|
315
354
|
addNetwork(mercator: Float64Array, edges: Uint32Array, line_start: Uint32Array | null | undefined, line_points: Float64Array | null | undefined, costs: Float32Array | null | undefined, style: Float32Array): number;
|
|
316
355
|
/**
|
|
317
356
|
* A COPC point cloud from its URL (HTTP range requests). `resolve(wkt)` gives the CRS of the file from its WKT
|
|
318
357
|
* (undefined if it has none): its inverse projection, whether its altitudes are above the geoid, the metres of
|
|
319
358
|
* a unit of z; it may throw (an unknown CRS), the layer then stays empty
|
|
359
|
+
*
|
|
360
|
+
* # Errors
|
|
361
|
+
*
|
|
362
|
+
* Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
|
|
363
|
+
* info log). The file itself is read later: a bad file, or a `resolve` that throws, leaves the layer empty
|
|
320
364
|
*/
|
|
321
365
|
addPointCloud(url: string, resolve: (wkt: string | undefined) => PointCloudCrs): number;
|
|
322
366
|
/**
|
|
323
367
|
* Raster tiles in Web Mercator; `url` holds {z}, {x} and {y}. `size`: side of the tiles' textures (256 by
|
|
324
368
|
* default); `loader`: draws each tile instead of fetching `url`, `(z, x, y, signal) => Promise<ImageBitmap |
|
|
325
369
|
* null>`, an image of `size` × `size` (null: nothing there)
|
|
370
|
+
*
|
|
371
|
+
* # Errors
|
|
372
|
+
*
|
|
373
|
+
* Throws (to JavaScript) when the texture holding the layer's tiles cannot be created
|
|
326
374
|
*/
|
|
327
375
|
addRaster(url: string, min_z: number, max_z: number, opacity: number, saturation: number, size: number | null | undefined, loader: ((z: number, x: number, y: number, signal: AbortSignal) => Promise<ImageBitmap | null>) | undefined): number;
|
|
328
376
|
/**
|
|
329
377
|
* An empty symbol layer
|
|
378
|
+
*
|
|
379
|
+
* # Errors
|
|
380
|
+
*
|
|
381
|
+
* Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
|
|
382
|
+
* info log)
|
|
330
383
|
*/
|
|
331
384
|
addSymbols(): number;
|
|
332
385
|
/**
|
|
333
386
|
* 3D Tiles (b3dm / glb textured meshes, external tilesets) from the URL of a `tileset.json`. `max_error`:
|
|
334
387
|
* screen-space error (CSS pixels) above which a tile is refined; 16 is the usual value, lower is finer.
|
|
335
388
|
* `geoid`: its heights are altitudes (NGF-IGN69), each tile raised by the RAF20 geoid onto the relief.
|
|
389
|
+
*
|
|
390
|
+
* # Errors
|
|
391
|
+
*
|
|
392
|
+
* Throws (to JavaScript) when one of the layer's programs fails to compile or link (the error carries
|
|
393
|
+
* its info log). The tileset itself is read later: a bad one leaves the layer empty, it does not throw
|
|
336
394
|
*/
|
|
337
395
|
addTiles3d(url: string, max_error: number, geoid?: boolean | null): number;
|
|
338
396
|
/**
|
|
@@ -340,11 +398,17 @@ export class Engine {
|
|
|
340
398
|
* border cast on the ground, or on the far plane where it passes the horizon
|
|
341
399
|
*/
|
|
342
400
|
bounds(): Float64Array;
|
|
401
|
+
/**
|
|
402
|
+
* The camera as set or moved: center (degrees), zoom, pitch and bearing (degrees)
|
|
403
|
+
*/
|
|
343
404
|
camera(): Camera;
|
|
344
405
|
/**
|
|
345
406
|
* Removes the panorama
|
|
346
407
|
*/
|
|
347
408
|
clearPanorama(): void;
|
|
409
|
+
/**
|
|
410
|
+
* Stops loading the tiles of the flight's destination (`preload`)
|
|
411
|
+
*/
|
|
348
412
|
clearPreload(): void;
|
|
349
413
|
/**
|
|
350
414
|
* Removes the viewshed
|
|
@@ -392,6 +456,11 @@ export class Engine {
|
|
|
392
456
|
networkStats(id: number): NetworkStats | undefined;
|
|
393
457
|
/**
|
|
394
458
|
* `redraw` is called when the engine needs a new frame (a tile arrived)
|
|
459
|
+
*
|
|
460
|
+
* # Errors
|
|
461
|
+
*
|
|
462
|
+
* Throws (to JavaScript) when the canvas gives no WebGL2 context ("WebGL2 is not available"), or when a WebGL
|
|
463
|
+
* object of the globe, the sky or the raster pass cannot be created or one of their shaders fails to compile
|
|
395
464
|
*/
|
|
396
465
|
constructor(canvas: HTMLCanvasElement, redraw: () => void);
|
|
397
466
|
/**
|
|
@@ -433,8 +502,18 @@ export class Engine {
|
|
|
433
502
|
* Screen point (CSS pixels) of a ground position, or `height` metres above it, undefined behind the camera
|
|
434
503
|
*/
|
|
435
504
|
project(lon: number, lat: number, height?: number | null): [x: number, y: number] | undefined;
|
|
505
|
+
/**
|
|
506
|
+
* Removes batch `key` of an extrusion layer (nothing if there is none)
|
|
507
|
+
*/
|
|
436
508
|
removeExtrusionBatch(id: number, key: number): void;
|
|
509
|
+
/**
|
|
510
|
+
* Removes a layer and frees its GPU objects; the other layers forget it (a layer that referred to it)
|
|
511
|
+
*/
|
|
437
512
|
removeLayer(id: number): void;
|
|
513
|
+
/**
|
|
514
|
+
* Draws a frame: the backdrop, the ground and the layers over it bottom to top, then the panorama and the
|
|
515
|
+
* viewshed; returns true while tiles are still loading (a new frame will be asked through `redraw`)
|
|
516
|
+
*/
|
|
438
517
|
render(): boolean;
|
|
439
518
|
/**
|
|
440
519
|
* Asks what is under a screen point without waiting for the GPU (as `pick`, with the position there): the
|
|
@@ -455,6 +534,9 @@ export class Engine {
|
|
|
455
534
|
* then the sky-horizon, horizon-fog and fog-ground blends; `undefined` for none (the background color shows)
|
|
456
535
|
*/
|
|
457
536
|
setAtmosphere(settings?: Float32Array | null): void;
|
|
537
|
+
/**
|
|
538
|
+
* Color the canvas is cleared to (RGB 0-1), where neither ground nor sky is drawn
|
|
539
|
+
*/
|
|
458
540
|
setBackground(r: number, g: number, b: number): void;
|
|
459
541
|
/**
|
|
460
542
|
* The body the map is drawn on: its equatorial radius (metres) and flattening (0 for a sphere), the halo of its
|
|
@@ -464,6 +546,10 @@ export class Engine {
|
|
|
464
546
|
* relief, whose shaders may take its size (`ISARD_CIRCUMFERENCE` of the ground layers)
|
|
465
547
|
*/
|
|
466
548
|
setBody(radius: number, flattening: number, halo: Float32Array | null | undefined, lowest: number, highest: number): void;
|
|
549
|
+
/**
|
|
550
|
+
* Sets the camera (degrees, the conventions of `MapLibre`): leaves a street-level view, and the camera keeps this
|
|
551
|
+
* center as the relief comes in
|
|
552
|
+
*/
|
|
467
553
|
setCamera(lon: number, lat: number, zoom: number, pitch: number, bearing: number): void;
|
|
468
554
|
/**
|
|
469
555
|
* Circles lying on the ground (true) or facing the screen
|
|
@@ -475,11 +561,21 @@ export class Engine {
|
|
|
475
561
|
setCircles(id: number, points: Float64Array, feature: Uint32Array): void;
|
|
476
562
|
/**
|
|
477
563
|
* Anchors of batch `key` on the linked network: per feature, node A, node B, cost from A, cost from B
|
|
564
|
+
*
|
|
565
|
+
* # Errors
|
|
566
|
+
*
|
|
567
|
+
* Throws (to JavaScript) when the batch's features need an anchor texture past the GPU's
|
|
568
|
+
* `MAX_TEXTURE_SIZE`, or when it cannot be created
|
|
478
569
|
*/
|
|
479
570
|
setExtrusionAnchors(id: number, key: number, anchors: Float32Array): void;
|
|
480
571
|
/**
|
|
481
572
|
* Adds or replaces batch `key` of an extrusion layer: polygons as for `addFills`, `feature_count` features (the
|
|
482
573
|
* feature style gives each its height and base height as its two sizes, metres)
|
|
574
|
+
*
|
|
575
|
+
* # Errors
|
|
576
|
+
*
|
|
577
|
+
* Throws (to JavaScript) when a WebGL buffer or vertex array of the batch cannot be created, or when
|
|
578
|
+
* `feature_count` features need a table texture past the GPU's `MAX_TEXTURE_SIZE`
|
|
483
579
|
*/
|
|
484
580
|
setExtrusionBatch(id: number, key: number, points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, feature: Uint32Array, feature_count: number): void;
|
|
485
581
|
/**
|
|
@@ -527,29 +623,59 @@ export class Engine {
|
|
|
527
623
|
/**
|
|
528
624
|
* The glyph atlas shared by the symbol layers, one page: `width` × `height` bytes of signed distances
|
|
529
625
|
* (allocated again, filled with `data` if given)
|
|
626
|
+
*
|
|
627
|
+
* # Errors
|
|
628
|
+
*
|
|
629
|
+
* Throws (to JavaScript) as `setGlyphPages` does: a size that is not positive, or the texture not created
|
|
530
630
|
*/
|
|
531
631
|
setGlyphAtlas(width: number, height: number, data?: Uint8Array | null): void;
|
|
532
632
|
/**
|
|
533
633
|
* The glyph atlas shared by the symbol layers, `pages` pages of `width` × `height` bytes of signed distances,
|
|
534
634
|
* allocated again and empty (`updateGlyphPage` fills them). A glyph on page `p` at row `v` has the atlas
|
|
535
635
|
* coordinate `v + p × height`
|
|
636
|
+
*
|
|
637
|
+
* # Errors
|
|
638
|
+
*
|
|
639
|
+
* Throws (to JavaScript) when `width` or `height` is not positive (or their product overflows), `pages`
|
|
640
|
+
* is not 1 to 256, or the atlas texture cannot be created
|
|
536
641
|
*/
|
|
537
642
|
setGlyphPages(width: number, height: number, pages: number): void;
|
|
643
|
+
/**
|
|
644
|
+
* Moves the Mercator box (0-1) a ground layer shows in
|
|
645
|
+
*/
|
|
538
646
|
setGroundBounds(id: number, min_x: number, min_y: number, max_x: number, max_y: number): void;
|
|
539
647
|
/**
|
|
540
648
|
* Creates the texture of sampler `name` (`format`: r8, r8ui, r16ui, r16i, r32ui, r32f, rg16ui, rg32f, rgba8,
|
|
541
649
|
* rgba8ui, rgba16ui, rgba32f; `depth` 0 for 2D, else a 2D array of that many layers; `linear` filtering for the
|
|
542
650
|
* non-integer formats); `data`: its texels as bytes, or undefined for an empty texture
|
|
651
|
+
*
|
|
652
|
+
* # Errors
|
|
653
|
+
*
|
|
654
|
+
* Throws (to JavaScript) on an unknown `format`, a size not positive (or overflowing), `data` shorter
|
|
655
|
+
* than the texels, more textures than the layer takes, or a texture WebGL cannot create
|
|
543
656
|
*/
|
|
544
657
|
setGroundTexture(id: number, name: string, format: string, width: number, height: number, depth: number, linear: boolean, data?: Uint8Array | null): void;
|
|
545
658
|
/**
|
|
546
659
|
* A uniform of a ground layer's code, as numbers
|
|
660
|
+
*
|
|
661
|
+
* # Errors
|
|
662
|
+
*
|
|
663
|
+
* Throws (to JavaScript) when the shader has no uniform `name` (one its code does not use is removed
|
|
664
|
+
* by the compiler)
|
|
547
665
|
*/
|
|
548
666
|
setGroundUniform(id: number, name: string, values: Float64Array): void;
|
|
667
|
+
/**
|
|
668
|
+
* Shows or hides a ground layer (kept, with its uniforms and textures)
|
|
669
|
+
*/
|
|
549
670
|
setGroundVisible(id: number, visible: boolean): void;
|
|
550
671
|
/**
|
|
551
672
|
* The icon atlas shared by the symbol layers: `width` × `height` RGBA texels, premultiplied, allocated again
|
|
552
673
|
* and empty (`updateIconAtlas` fills it)
|
|
674
|
+
*
|
|
675
|
+
* # Errors
|
|
676
|
+
*
|
|
677
|
+
* Throws (to JavaScript) when `width` or `height` is not positive (or their product overflows), or the
|
|
678
|
+
* atlas texture cannot be created
|
|
553
679
|
*/
|
|
554
680
|
setIconAtlas(width: number, height: number): void;
|
|
555
681
|
/**
|
|
@@ -563,6 +689,11 @@ export class Engine {
|
|
|
563
689
|
setLineDash(id: number, dash: number, gap: number): void;
|
|
564
690
|
/**
|
|
565
691
|
* New lines for a line layer (same arguments as `addLines`, the same features)
|
|
692
|
+
*
|
|
693
|
+
* # Errors
|
|
694
|
+
*
|
|
695
|
+
* Throws (to JavaScript) when the lines need a table texture past the GPU's `MAX_TEXTURE_SIZE`, or
|
|
696
|
+
* when it cannot be created; the layer then keeps its lines
|
|
566
697
|
*/
|
|
567
698
|
setLines(id: number, points: Float64Array, start: Uint32Array, feature: Uint32Array): void;
|
|
568
699
|
/**
|
|
@@ -597,6 +728,10 @@ export class Engine {
|
|
|
597
728
|
setNetworkValues(id: number, values: Float32Array): void;
|
|
598
729
|
/**
|
|
599
730
|
* The image of camera `index` of the panorama (the images sharing the size of the first)
|
|
731
|
+
*
|
|
732
|
+
* # Errors
|
|
733
|
+
*
|
|
734
|
+
* Throws (to JavaScript) when WebGL refuses the upload of `image` into the panorama's texture
|
|
600
735
|
*/
|
|
601
736
|
setPanoramaImage(index: number, image: ImageBitmap): void;
|
|
602
737
|
/**
|
|
@@ -605,6 +740,11 @@ export class Engine {
|
|
|
605
740
|
* frame, row-major, 9; position in it, 3; focal x, y; center x, y; skew; image width, height; principal point of
|
|
606
741
|
* the distortion x, y; its coefficients r³, r⁵, r⁷; its limit, pixels), a backdrop sphere of `radius` metres, at
|
|
607
742
|
* `opacity`. Its images come after (`setPanoramaImage`)
|
|
743
|
+
*
|
|
744
|
+
* # Errors
|
|
745
|
+
*
|
|
746
|
+
* Throws (to JavaScript) when `rotation` holds fewer than 9 numbers, or when a WebGL object cannot be created or a
|
|
747
|
+
* shader fails to compile (the error carries its info log)
|
|
608
748
|
*/
|
|
609
749
|
setPanorama(lon: number, lat: number, height: number, rotation: Float64Array, cameras: Float64Array, radius: number, opacity: number): void;
|
|
610
750
|
/**
|
|
@@ -612,6 +752,9 @@ export class Engine {
|
|
|
612
752
|
* alpha 0 hides a class) and the ramp of the altitudes (256 RGBA texels)
|
|
613
753
|
*/
|
|
614
754
|
setPointCloudStyle(id: number, style: Float64Array, palette: Uint8Array, ramp: Uint8Array): void;
|
|
755
|
+
/**
|
|
756
|
+
* Opacity and saturation (0-1) of a raster layer; nothing for another id
|
|
757
|
+
*/
|
|
615
758
|
setRasterStyle(id: number, opacity: number, saturation: number): void;
|
|
616
759
|
/**
|
|
617
760
|
* The headers added to the engine's requests by URL prefix (`setRequestHeaders`, the same for every map of the
|
|
@@ -636,6 +779,11 @@ export class Engine {
|
|
|
636
779
|
* Labels of a symbol layer, shaped by the page: anchors (Mercator, interleaved), their texts' boxes (min x, min y,
|
|
637
780
|
* max x, max y, CSS pixels from the anchor), styles (36 floats each, see `LABEL_FLOATS`) and glyph and icon quads
|
|
638
781
|
* (11 floats each, see `QUAD_FLOATS`)
|
|
782
|
+
*
|
|
783
|
+
* # Errors
|
|
784
|
+
*
|
|
785
|
+
* Throws (to JavaScript) when the labels need a table texture past the GPU's `MAX_TEXTURE_SIZE`, or
|
|
786
|
+
* when it cannot be created; the layer then keeps its labels
|
|
639
787
|
*/
|
|
640
788
|
setSymbols(id: number, anchors: Float64Array, boxes: Float32Array, styles: Float32Array, quads: Float32Array): void;
|
|
641
789
|
/**
|
|
@@ -647,6 +795,10 @@ export class Engine {
|
|
|
647
795
|
* above the ellipsoid, those of 3D Tiles; over France, on the Earth only), else left as served (the default);
|
|
648
796
|
* `loader`: gives the
|
|
649
797
|
* altitudes of each tile instead of fetching `url` (an encoding decoded by the page: Terrarium, Terrain-RGB)
|
|
798
|
+
*
|
|
799
|
+
* # Errors
|
|
800
|
+
*
|
|
801
|
+
* Throws (to JavaScript) when the texture holding the relief's tiles cannot be created
|
|
650
802
|
*/
|
|
651
803
|
setTerrain(url: string | null | undefined, exaggeration: number, max_z: number | null | undefined, geoid: boolean | null | undefined, loader: ((z: number, x: number, y: number, signal: AbortSignal) => Promise<Float32Array | null>) | undefined): void;
|
|
652
804
|
/**
|
|
@@ -666,8 +818,16 @@ export class Engine {
|
|
|
666
818
|
* only heading, tilt, angles of view across and up (degrees), the heading NaN to look all around. What some
|
|
667
819
|
* observer sees is tinted with `visible`, what is hidden from all those that reach it with `hidden` (RGB 0-1),
|
|
668
820
|
* at `opacity`; `outline` (RGB 0-1, or empty) the color of the cones' edges drawn in 3D
|
|
821
|
+
*
|
|
822
|
+
* # Errors
|
|
823
|
+
*
|
|
824
|
+
* Throws (to JavaScript) when, on the first call, a WebGL object cannot be created or a shader fails to compile
|
|
825
|
+
* (the error carries its info log)
|
|
669
826
|
*/
|
|
670
827
|
setViewshed(observers: Float64Array, visible: Float32Array, hidden: Float32Array, opacity: number, outline: Float32Array): void;
|
|
828
|
+
/**
|
|
829
|
+
* Lowest and highest zoom levels the camera accepts
|
|
830
|
+
*/
|
|
671
831
|
setZoomRange(min: number, max: number): void;
|
|
672
832
|
/**
|
|
673
833
|
* Tile counters of the raster layers, for diagnostics
|
|
@@ -709,6 +869,11 @@ export class Engine {
|
|
|
709
869
|
updateGlyphPage(page: number, x: number, y: number, width: number, height: number, data: Uint8Array): void;
|
|
710
870
|
/**
|
|
711
871
|
* Replaces a region of a ground layer's texture (one layer of a 2D array)
|
|
872
|
+
*
|
|
873
|
+
* # Errors
|
|
874
|
+
*
|
|
875
|
+
* Throws (to JavaScript) when there is no texture `name`, or when the region is out of its bounds or
|
|
876
|
+
* `data` holds too few bytes
|
|
712
877
|
*/
|
|
713
878
|
updateGroundTexture(id: number, name: string, x: number, y: number, layer: number, width: number, height: number, data: Uint8Array): void;
|
|
714
879
|
/**
|
|
@@ -720,6 +885,9 @@ export class Engine {
|
|
|
720
885
|
* the eye first: the level each area of the ground is drawn at, for the labels of a vector style to follow it
|
|
721
886
|
*/
|
|
722
887
|
wantedTiles(id: number): Uint32Array;
|
|
888
|
+
/**
|
|
889
|
+
* Zooms by `delta` levels around a screen point (CSS pixels), which keeps the same ground point under it
|
|
890
|
+
*/
|
|
723
891
|
zoomAt(delta: number, x: number, y: number): void;
|
|
724
892
|
}
|
|
725
893
|
|