isard 1.8.0 → 1.9.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 +32 -1
- package/dist/basemap/grid.js +2 -5
- package/dist/basemap/grid.js.map +1 -1
- package/dist/basemap/models/furniture.d.ts +12 -0
- package/dist/basemap/{furniture.js → models/furniture.js} +6 -8
- package/dist/basemap/models/furniture.js.map +1 -0
- package/dist/basemap/{meshes.js → models/meshes.js} +1 -1
- package/dist/basemap/models/meshes.js.map +1 -0
- package/dist/basemap/models/trees.d.ts +21 -0
- package/dist/basemap/{trees.js → models/trees.js} +4 -36
- package/dist/basemap/models/trees.js.map +1 -0
- package/dist/basemap/placed.d.ts +2 -0
- package/dist/basemap/placed.js +2 -0
- package/dist/basemap/placed.js.map +1 -1
- package/dist/basemap/pmtiles.js +4 -3
- package/dist/basemap/pmtiles.js.map +1 -1
- package/dist/basemap/pmtileslayer.d.ts +4 -4
- package/dist/basemap/pmtileslayer.js +2 -1
- package/dist/basemap/pmtileslayer.js.map +1 -1
- package/dist/basemap/resample.js +3 -2
- package/dist/basemap/resample.js.map +1 -1
- package/dist/basemap/terrain.d.ts +5 -0
- package/dist/basemap/terrain.js +6 -4
- package/dist/basemap/terrain.js.map +1 -1
- package/dist/basemap/vectortiles/context.d.ts +3 -2
- package/dist/basemap/vectortiles/context.js.map +1 -1
- package/dist/basemap/vectortiles/extrusions.js.map +1 -1
- package/dist/basemap/vectortiles/furniture.d.ts +3 -3
- package/dist/basemap/vectortiles/furniture.js +2 -1
- package/dist/basemap/vectortiles/furniture.js.map +1 -1
- package/dist/basemap/vectortiles/labels.js +2 -1
- package/dist/basemap/vectortiles/labels.js.map +1 -1
- package/dist/basemap/vectortiles/lamps.d.ts +3 -3
- package/dist/basemap/vectortiles/lamps.js +1 -1
- package/dist/basemap/vectortiles/lamps.js.map +1 -1
- package/dist/basemap/vectortiles/placed.d.ts +3 -2
- package/dist/basemap/vectortiles/placed.js +5 -10
- package/dist/basemap/vectortiles/placed.js.map +1 -1
- package/dist/basemap/vectortiles/street-wind.js +2 -2
- package/dist/basemap/vectortiles/street-wind.js.map +1 -1
- package/dist/basemap/vectortiles/style.js +7 -8
- package/dist/basemap/vectortiles/style.js.map +1 -1
- package/dist/basemap/vectortiles/tiles.d.ts +1 -3
- package/dist/basemap/vectortiles/tiles.js +1 -1
- package/dist/basemap/vectortiles/tiles.js.map +1 -1
- package/dist/basemap/vectortiles/trees.d.ts +4 -4
- package/dist/basemap/vectortiles/trees.js +2 -1
- package/dist/basemap/vectortiles/trees.js.map +1 -1
- package/dist/basemap/vectortiles/vectors.d.ts +2 -3
- package/dist/basemap/vectortiles/vectors.js.map +1 -1
- package/dist/basemap/vectortiles.d.ts +6 -5
- package/dist/basemap/vectortiles.js +4 -3
- package/dist/basemap/vectortiles.js.map +1 -1
- package/dist/basemap/wmts.js +3 -4
- package/dist/basemap/wmts.js.map +1 -1
- package/dist/basemap/{trees.d.ts → woods.d.ts} +2 -19
- package/dist/basemap/woods.js +38 -0
- package/dist/basemap/woods.js.map +1 -0
- package/dist/basemap/workerpool.d.ts +1 -1
- package/dist/basemap/workerpool.js +3 -3
- package/dist/basemap/workerpool.js.map +1 -1
- package/dist/basemap.worker.js +2 -2
- package/dist/basemap.worker.js.map +23 -22
- package/dist/data/collada.js +4 -4
- package/dist/data/collada.js.map +1 -1
- package/dist/data/ifc.js +6 -11
- package/dist/data/ifc.js.map +1 -1
- package/dist/decoder.worker.js +5 -5
- package/dist/decoder.worker.js.map +7 -6
- package/dist/decoding/decoders.js.map +1 -0
- package/dist/{engine → decoding}/loader.js +2 -2
- package/dist/decoding/loader.js.map +1 -0
- package/dist/{engine → decoding}/protocol.d.ts +1 -1
- package/dist/decoding/protocol.js.map +1 -0
- package/dist/engine-loader.d.ts +1 -1
- package/dist/engine-loader.js +3 -2
- package/dist/engine-loader.js.map +1 -1
- package/dist/geoplateforme.d.ts +2 -1
- package/dist/geoplateforme.js +6 -8
- package/dist/geoplateforme.js.map +1 -1
- package/dist/index.d.ts +15 -7
- package/dist/index.js +9 -3
- 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_tess_bg.wasm +0 -0
- package/dist/layers/custom.d.ts +56 -0
- package/dist/layers/custom.js +93 -0
- package/dist/layers/custom.js.map +1 -0
- package/dist/layers/extrusions.d.ts +4 -2
- package/dist/layers/extrusions.js +2 -1
- package/dist/layers/extrusions.js.map +1 -1
- package/dist/layers/features.d.ts +3 -14
- package/dist/layers/features.js +4 -25
- package/dist/layers/features.js.map +1 -1
- package/dist/layers/flow.d.ts +3 -3
- package/dist/layers/flow.js +3 -4
- package/dist/layers/flow.js.map +1 -1
- package/dist/layers/glyphs.js +5 -3
- package/dist/layers/glyphs.js.map +1 -1
- package/dist/layers/ground.d.ts +57 -0
- package/dist/layers/ground.js +78 -0
- package/dist/layers/ground.js.map +1 -0
- package/dist/layers/icons.js +8 -6
- package/dist/layers/icons.js.map +1 -1
- package/dist/layers/layers.d.ts +2 -199
- package/dist/layers/layers.js +2 -469
- package/dist/layers/layers.js.map +1 -1
- package/dist/layers/models.d.ts +48 -0
- package/dist/layers/models.js +111 -0
- package/dist/layers/models.js.map +1 -0
- package/dist/layers/network.d.ts +26 -0
- package/dist/layers/network.js +127 -0
- package/dist/layers/network.js.map +1 -0
- package/dist/layers/panoramas.d.ts +2 -11
- package/dist/layers/panoramas.js +19 -9
- package/dist/layers/panoramas.js.map +1 -1
- package/dist/layers/photos.d.ts +4 -7
- package/dist/layers/photos.js +3 -4
- package/dist/layers/photos.js.map +1 -1
- package/dist/layers/pointclouds.d.ts +3 -2
- package/dist/layers/pointclouds.js +3 -3
- package/dist/layers/pointclouds.js.map +1 -1
- package/dist/layers/raster.d.ts +9 -0
- package/dist/layers/raster.js +24 -0
- package/dist/layers/raster.js.map +1 -0
- package/dist/layers/symbols.d.ts +2 -2
- package/dist/layers/symbols.js +2 -1
- package/dist/layers/symbols.js.map +1 -1
- package/dist/layers/tiles3d.d.ts +15 -0
- package/dist/layers/tiles3d.js +55 -0
- package/dist/layers/tiles3d.js.map +1 -0
- package/dist/layers/trees.d.ts +5 -7
- package/dist/layers/trees.js +2 -1
- package/dist/layers/trees.js.map +1 -1
- package/dist/layers/vectors.js.map +1 -1
- package/dist/map/basemap-layers.js +1 -1
- package/dist/map/basemap-layers.js.map +1 -1
- package/dist/map/engine-settings.d.ts +1 -1
- package/dist/map/engine-settings.js +1 -1
- package/dist/map/engine-settings.js.map +1 -1
- package/dist/map/engines.js.map +1 -1
- package/dist/map/layer-spec.d.ts +7 -13
- package/dist/map/layer-spec.js.map +1 -1
- package/dist/map/workers.js +3 -4
- package/dist/map/workers.js.map +1 -1
- package/dist/map.d.ts +15 -58
- package/dist/map.js +39 -52
- package/dist/map.js.map +1 -1
- package/dist/panoramax.js +6 -8
- package/dist/panoramax.js.map +1 -1
- package/dist/react/CustomLayer.d.ts +1 -1
- package/dist/react/CustomLayer.js.map +1 -1
- package/dist/react/Layer.d.ts +5 -1
- package/dist/react/Layer.js.map +1 -1
- package/dist/react/VectorTiles.d.ts +2 -2
- package/dist/react/VectorTiles.js +1 -1
- package/dist/react/VectorTiles.js.map +1 -1
- package/dist/types.d.ts +14 -4
- package/dist/types.js.map +1 -1
- package/dist/ui/controls.js +2 -1
- package/dist/ui/controls.js.map +1 -1
- package/dist/ui/interaction.js +6 -5
- package/dist/ui/interaction.js.map +1 -1
- package/dist/ui/minimap.js +1 -1
- package/dist/ui/minimap.js.map +1 -1
- package/dist/ui/overlay.js +3 -3
- package/dist/ui/overlay.js.map +1 -1
- package/dist/ui/search.js +1 -1
- package/dist/ui/search.js.map +1 -1
- package/dist/util/animation.js +3 -2
- package/dist/util/animation.js.map +1 -1
- package/dist/util/color.d.ts +10 -0
- package/dist/util/color.js +29 -9
- package/dist/util/color.js.map +1 -1
- package/dist/util/fetch.d.ts +5 -0
- package/dist/util/fetch.js +11 -0
- package/dist/util/fetch.js.map +1 -0
- package/dist/util/geo.d.ts +5 -0
- package/dist/util/geo.js +8 -2
- package/dist/util/geo.js.map +1 -1
- package/dist/util/math.d.ts +3 -0
- package/dist/util/math.js +4 -0
- package/dist/util/math.js.map +1 -0
- package/dist/util/requests.js.map +1 -0
- package/dist/util/roofs.d.ts +0 -2
- package/dist/util/roofs.js +0 -3
- package/dist/util/roofs.js.map +1 -1
- package/dist/wasm/isard.js +1 -1
- package/dist/wasm/isard_core.js +1 -1
- package/dist/workers/basemap/geometry.d.ts +9 -19
- package/dist/workers/{basemap.worker.d.ts → basemap/protocol.d.ts} +29 -23
- package/dist/workers/basemap/street.d.ts +4 -2
- package/dist/workers/basemap/tiles.d.ts +1 -3
- package/dist/workers/basemap/trees.d.ts +2 -2
- package/package.json +1 -1
- package/dist/basemap/furniture.d.ts +0 -26
- package/dist/basemap/furniture.js.map +0 -1
- package/dist/basemap/meshes.js.map +0 -1
- package/dist/basemap/trees.js.map +0 -1
- package/dist/engine/decoders.js.map +0 -1
- package/dist/engine/loader.js.map +0 -1
- package/dist/engine/protocol.js.map +0 -1
- package/dist/engine/requests.js.map +0 -1
- package/dist/workers/basemap/furniture.d.ts +0 -13
- package/dist/workers/basemap/labels.d.ts +0 -24
- package/dist/workers/basemap/lamps.d.ts +0 -10
- package/dist/workers/basemap/raster.d.ts +0 -10
- package/dist/workers/basemap.worker.js +0 -221
- package/dist/workers/basemap.worker.js.map +0 -1
- /package/dist/basemap/{meshes.d.ts → models/meshes.d.ts} +0 -0
- /package/dist/{engine → decoding}/decoders.d.ts +0 -0
- /package/dist/{engine → decoding}/decoders.js +0 -0
- /package/dist/{engine → decoding}/loader.d.ts +0 -0
- /package/dist/{engine → decoding}/protocol.js +0 -0
- /package/dist/{engine → util}/requests.d.ts +0 -0
- /package/dist/{engine → util}/requests.js +0 -0
package/dist/util/geo.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { clamp } from "./math.js";
|
|
1
2
|
/**
|
|
2
3
|
* Web Mercator in [0, 1] across the world (y towards the south), for the page and the workers alike: the positions
|
|
3
4
|
* sent to the engine, the tiles of a view, the flights, the label candidates of the vector tiles.
|
|
@@ -16,7 +17,7 @@ export const mercatorX = (lon) => {
|
|
|
16
17
|
};
|
|
17
18
|
/** Mercator y of a latitude (degrees), clamped to the edges of the map */
|
|
18
19
|
export const mercatorY = (lat) => {
|
|
19
|
-
const phi = (
|
|
20
|
+
const phi = clamp(lat, -MAX_LAT, MAX_LAT) * RAD;
|
|
20
21
|
return 0.5 - Math.log(Math.tan(Math.PI / 4 + phi / 2)) / (2 * Math.PI);
|
|
21
22
|
};
|
|
22
23
|
/** Longitude (degrees) of a Mercator x */
|
|
@@ -35,6 +36,11 @@ export const toMercator = ([lon, lat]) => {
|
|
|
35
36
|
export const fromMercator = ([x, y]) => {
|
|
36
37
|
return [longitude(x), latitude(y)];
|
|
37
38
|
};
|
|
39
|
+
/** Metres per Mercator unit at a Mercator y (towards the south, [0, 1]): the circumference at its latitude (a roof's
|
|
40
|
+
* slopes, a tile's cells run in metres) */
|
|
41
|
+
export const metresAt = (y) => EARTH_METRES * Math.cos(Math.atan(Math.sinh(Math.PI * (1 - 2 * y))));
|
|
38
42
|
/** Metres across a tile of level `z` and row `y` at its middle */
|
|
39
|
-
export const tileMetres = (z, y) => (
|
|
43
|
+
export const tileMetres = (z, y) => metresAt((y + 0.5) / 2 ** z) / 2 ** z;
|
|
44
|
+
/** A tile's URL from its source's template: every {z}, {x} and {y} replaced (`z` a level, or a WMTS matrix's id) */
|
|
45
|
+
export const tileUrl = (template, z, x, y) => template.replaceAll('{z}', String(z)).replaceAll('{x}', String(x)).replaceAll('{y}', String(y));
|
|
40
46
|
//# sourceMappingURL=geo.js.map
|
package/dist/util/geo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geo.js","sourceRoot":"","sources":["../../src/util/geo.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,0BAA0B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C,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAEpH,kEAAkE;AAClE,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAS,EAAE,CAAS,EAAU,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAElG,oHAAoH;AACpH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,QAAgB,EAAE,CAAkB,EAAE,CAAS,EAAE,CAAS,EAAU,EAAE,CAC5F,QAAQ,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC","sourcesContent":["import { clamp } from './math.ts';\n/**\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/** Radians in a degree */\nexport const RAD = Math.PI / 180;\n\n/** The Earth's circumference at the equator, metres (Web Mercator's sphere: WGS 84's major axis) */\nexport const EARTH_METRES = 40_075_016.686;\n\n/** Metres in a degree of latitude (and of longitude at the equator), on that sphere */\nexport const METRES_PER_DEGREE = EARTH_METRES / 360;\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 = clamp(lat, -MAX_LAT, MAX_LAT) * RAD;\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\n/** Metres per Mercator unit at a Mercator y (towards the south, [0, 1]): the circumference at its latitude (a roof's\n * slopes, a tile's cells run in metres) */\nexport const metresAt = (y: number): number => EARTH_METRES * Math.cos(Math.atan(Math.sinh(Math.PI * (1 - 2 * y))));\n\n/** Metres across a tile of level `z` and row `y` at its middle */\nexport const tileMetres = (z: number, y: number): number => metresAt((y + 0.5) / 2 ** z) / 2 ** z;\n\n/** A tile's URL from its source's template: every {z}, {x} and {y} replaced (`z` a level, or a WMTS matrix's id) */\nexport const tileUrl = (template: string, z: number | string, x: number, y: number): string =>\n template.replaceAll('{z}', String(z)).replaceAll('{x}', String(x)).replaceAll('{y}', String(y));\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"math.js","sourceRoot":"","sources":["../../src/util/math.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAE/D,0CAA0C;AAC1C,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW,EAAU,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC","sourcesContent":["/** Small numeric helpers shared by the page and the workers */\n\n/** `value` kept within `min` and `max` */\nexport const clamp = (value: number, min: number, max: number): number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QAAsC,EAAgB,EAAE;IACpF,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAExB,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC1C,CAAC,CAAC;AAEF,+FAA+F;AAC/F,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAiB,EAAE,OAAoB,EAAE,EAAe,EAAE;IACpF,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IACzB,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IAErE,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAEvC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAE1C,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE;QAC3B,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE;YAC5C,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC;AAC9B,CAAC,CAAC","sourcesContent":["/**\n * Headers added to the requests of the page by URL prefix: an access token for private sources (a Géoplateforme\n * private stream, a server behind single sign-on), on every request isard makes, from the page, its workers (vector\n * tiles, 3D Tiles and point clouds) and its engine (raster tiles, tilesets): `setRequestHeaders(prefix, headers)`,\n * again with a new token when it is renewed. The rules of a URL are merged, the longest prefix last (it wins).\n */\n\n/** Rules: a URL prefix and its headers, the shortest prefix first */\nexport type HeaderRules = [prefix: string, headers: Record<string, string>][];\n\nlet rules: HeaderRules = [];\nconst listeners = new Set<(rules: HeaderRules) => void>();\n\n/**\n * Adds `headers` to every request isard makes to a URL starting with `prefix` (in the page and its workers), or with\n * no headers, stops: `setRequestHeaders('https://data.geopf.fr/private/', { Authorization: 'Bearer …' })`. The\n * server must allow these headers (CORS). For the whole page: every map, the ones to come too\n */\nexport const setRequestHeaders = (prefix: string, headers?: Record<string, string>): void => {\n const kept = rules.filter(([p]) => p !== prefix);\n\n if (headers && Object.keys(headers).length > 0) kept.push([prefix, { ...headers }]);\n kept.sort(([p], [q]) => p.length - q.length);\n setHeaderRules(kept);\n listeners.forEach((listener) => {\n listener(rules);\n });\n};\n\n/** @internal The rules now */\nexport const headerRules = (): HeaderRules => {\n return rules;\n};\n\n/** @internal The rules, from the page (a worker's copy) */\nexport const setHeaderRules = (next: HeaderRules): void => {\n rules = next;\n};\n\n/** @internal Follows the rules (the workers and engines of a map); returns the function that stops */\nexport const onHeaderRules = (listener: (rules: HeaderRules) => void): (() => void) => {\n listeners.add(listener);\n\n return () => listeners.delete(listener);\n};\n\n/** @internal `init` with the headers of the rules matching `url` (unchanged when none does) */\nexport const withHeaders = (url: string | URL, init: RequestInit = {}): RequestInit => {\n const href = String(url);\n const matching = rules.filter(([prefix]) => href.startsWith(prefix));\n\n if (matching.length === 0) return init;\n\n const headers = new Headers(init.headers);\n\n matching.forEach(([, set]) => {\n Object.entries(set).forEach(([name, value]) => {\n headers.set(name, value);\n });\n });\n\n return { ...init, headers };\n};\n"]}
|
package/dist/util/roofs.d.ts
CHANGED
|
@@ -14,5 +14,3 @@ export type RoofMode = 'data' | 'generated' | 'flat';
|
|
|
14
14
|
export declare const roofShapeOf: (properties: unknown, mode: RoofMode) => string | undefined;
|
|
15
15
|
/** A building's roof height from its properties (`roof:height` or `roof_height`; not a number: as its slopes make it) */
|
|
16
16
|
export declare const roofHeightOf: (properties: unknown) => number;
|
|
17
|
-
/** Metres per Mercator unit at a Mercator y (towards the south, [0, 1]): a roof's slopes run in metres */
|
|
18
|
-
export declare const metresAt: (y: number) => number;
|
package/dist/util/roofs.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* The roofs of the buildings as the engine builds them (`RoofShape::number`): the shapes of OpenStreetMap's
|
|
3
3
|
* `roof:shape`, those it does not draw as the nearest of them, or generated from a building's outline
|
|
4
4
|
*/
|
|
5
|
-
import { EARTH_METRES } from "./geo.js";
|
|
6
5
|
import { isRecord } from "./guards.js";
|
|
7
6
|
/** OpenStreetMap's `roof:shape` as the engine's roofs (1 flat, 2 hipped, 3 gabled, 4 pyramidal, 5 mansard) */
|
|
8
7
|
const ROOF_SHAPES = {
|
|
@@ -39,6 +38,4 @@ export const roofShapeOf = (properties, mode) => {
|
|
|
39
38
|
};
|
|
40
39
|
/** A building's roof height from its properties (`roof:height` or `roof_height`; not a number: as its slopes make it) */
|
|
41
40
|
export const roofHeightOf = (properties) => Number(property(properties, ['roof:height', 'roof_height']) ?? Number.NaN);
|
|
42
|
-
/** Metres per Mercator unit at a Mercator y (towards the south, [0, 1]): a roof's slopes run in metres */
|
|
43
|
-
export const metresAt = (y) => EARTH_METRES * Math.cos(Math.atan(Math.sinh(Math.PI * (1 - 2 * y))));
|
|
44
41
|
//# sourceMappingURL=roofs.js.map
|
package/dist/util/roofs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roofs.js","sourceRoot":"","sources":["../../src/util/roofs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"roofs.js","sourceRoot":"","sources":["../../src/util/roofs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,8GAA8G;AAC9G,MAAM,WAAW,GAAqC;IACpD,IAAI,EAAE,CAAC;IACP,QAAQ,EAAE,CAAC;IACX,MAAM,EAAE,CAAC;IACT,aAAa,EAAE,CA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AC,CAAC;AAEF,yHAAyH;AACzH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,UAAmB,EAAU,EAAE,CAC1D,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC","sourcesContent":["/**\n * The roofs of the buildings as the engine builds them (`RoofShape::number`): the shapes of OpenStreetMap's\n * `roof:shape`, those it does not draw as the nearest of them, or generated from a building's outline\n */\n\nimport { isRecord } from './guards.ts';\n\n/** OpenStreetMap's `roof:shape` as the engine's roofs (1 flat, 2 hipped, 3 gabled, 4 pyramidal, 5 mansard) */\nconst ROOF_SHAPES: Readonly<Record<string, number>> = {\n flat: 1,\n skillion: 1,\n hipped: 2,\n 'half-hipped': 2,\n side_hipped: 2,\n dome: 2,\n onion: 2,\n round: 2,\n gabled: 3,\n saltbox: 3,\n pyramidal: 4,\n cone: 4,\n mansard: 5,\n gambrel: 5,\n};\n\n/** A roof generated from its building's outline (`shapes::GENERATED_ROOF`) */\nexport const GENERATED_ROOF = 255;\n\n/** The engine's number of a roof shape (`roof:shape`, or `generated`); undefined for a shape it does not know */\nexport const roofNumber = (shape: string): number | undefined =>\n shape === 'generated' ? GENERATED_ROOF : ROOF_SHAPES[shape];\n\n/** How the buildings' roofs are made: from their data (`roof:shape`, `roof:height`; flat without), generated where\n * they have none, or all flat */\nexport type RoofMode = 'data' | 'generated' | 'flat';\n\n/** The first of a feature's properties `names` it has */\nconst property = (p: unknown, names: readonly string[]): unknown =>\n isRecord(p) ? names.map((n) => p[n]).find((v) => v !== undefined) : undefined;\n\n/** A building's roof shape by the `mode`, from its properties (`roof:shape` or `roof_shape`): one the engine knows,\n * else generated in `generated`; undefined for none (flat) */\nexport const roofShapeOf = (properties: unknown, mode: RoofMode): string | undefined => {\n const shape = property(properties, ['roof:shape', 'roof_shape']);\n\n if (mode === 'flat') return undefined;\n if (typeof shape === 'string' && ROOF_SHAPES[shape] !== undefined) return shape;\n\n return mode === 'generated' ? 'generated' : undefined;\n};\n\n/** A building's roof height from its properties (`roof:height` or `roof_height`; not a number: as its slopes make it) */\nexport const roofHeightOf = (properties: unknown): number =>\n Number(property(properties, ['roof:height', 'roof_height']) ?? Number.NaN);\n"]}
|
package/dist/wasm/isard.js
CHANGED
|
@@ -3129,7 +3129,7 @@ function __wbg_get_imports() {
|
|
|
3129
3129
|
return ret;
|
|
3130
3130
|
},
|
|
3131
3131
|
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
3132
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
3132
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 226, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
3133
3133
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_2e566c63402fe7fa___convert__closures_____invoke___wasm_bindgen_2e566c63402fe7fa___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_2e566c63402fe7fa___JsError___true_);
|
|
3134
3134
|
return ret;
|
|
3135
3135
|
},
|
package/dist/wasm/isard_core.js
CHANGED
|
@@ -2636,7 +2636,7 @@ function __wbg_get_imports() {
|
|
|
2636
2636
|
return ret;
|
|
2637
2637
|
},
|
|
2638
2638
|
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
2639
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
2639
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 117, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
2640
2640
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_2e566c63402fe7fa___convert__closures_____invoke___wasm_bindgen_2e566c63402fe7fa___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_2e566c63402fe7fa___JsError___true_);
|
|
2641
2641
|
return ret;
|
|
2642
2642
|
},
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
import type { TileFeature, Value } from '../../basemap/mvt.ts';
|
|
4
4
|
import { type StyleLayer } from '../../basemap/vectorstyle.ts';
|
|
5
5
|
import { type RoofMode } from '../../util/roofs.ts';
|
|
6
|
-
import type {
|
|
6
|
+
import type { TileAt, TileMesh, TileStyles, TileVectors, WorkOf } from './protocol.ts';
|
|
7
7
|
import { type Renderer } from './tiles.ts';
|
|
8
8
|
/**
|
|
9
9
|
* The polygons of a tile's features in the renderer's fill layers (each feature once, whichever layers keep it), in
|
|
10
10
|
* Mercator [0, 1]: a ring turning clockwise in tile units (y down) starts a polygon, the others are its holes (the
|
|
11
11
|
* vector tile specification)
|
|
12
12
|
*/
|
|
13
|
-
export declare const polygons: (r: Renderer,
|
|
13
|
+
export declare const polygons: (r: Renderer, work: TileAt) => Promise<{
|
|
14
14
|
arrays: {
|
|
15
15
|
points: Float64Array<ArrayBuffer>;
|
|
16
16
|
ringStart: Uint32Array<ArrayBuffer>;
|
|
@@ -54,25 +54,15 @@ export declare const clipRing: (ring: readonly number[], extent: number) => numb
|
|
|
54
54
|
export declare const simplifyLine: (line: readonly number[], tolerance: number) => number[];
|
|
55
55
|
/** A line cut to the square [0, `extent`] (Liang–Barsky per segment): its runs inside, each two points at least */
|
|
56
56
|
export declare const clipLine: (line: readonly number[], extent: number) => number[][];
|
|
57
|
+
/** The styles alone of a tile's features in the renderer's layers, as `tileVectors` gives them (its paint changed:
|
|
58
|
+
* the same features, in the same order) */
|
|
59
|
+
export declare const tileStyles: (r: Renderer, work: WorkOf<"vectors">) => Promise<TileStyles | undefined>;
|
|
57
60
|
/**
|
|
58
|
-
* The
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
+
* The fills, lines, circles and buildings of a tile's features in the renderer's layers, cut to the tile, in Mercator
|
|
62
|
+
* [0, 1], each with its style (color, its opacity folded in; a line's width, its gap folded in as the casing drawn by
|
|
63
|
+
* `draw`; at four zooms over the range the tile is drawn at)
|
|
61
64
|
*/
|
|
62
|
-
export declare const
|
|
63
|
-
/**
|
|
64
|
-
* The fills and lines of a tile's features in the renderer's layers, cut to the tile, in Mercator [0, 1], each with
|
|
65
|
-
* its style (color, its opacity folded in; a line's width, its gap folded in as the casing drawn by `draw`, at four
|
|
66
|
-
* zooms over the range the tile is drawn at); with `stylesOnly`, the styles alone. Patterns, outlines and circles are
|
|
67
|
-
* left to the raster path
|
|
68
|
-
*/
|
|
69
|
-
export declare const vectors: (r: Renderer, { z, x, y, deepest, roofs: roofMode, }: {
|
|
70
|
-
z: number;
|
|
71
|
-
x: number;
|
|
72
|
-
y: number;
|
|
73
|
-
deepest?: number;
|
|
74
|
-
roofs?: RoofMode;
|
|
75
|
-
}, id: number, stylesOnly: boolean, priority?: Priority) => Promise<TileVectors | TileStyles | undefined>;
|
|
65
|
+
export declare const tileVectors: (r: Renderer, work: WorkOf<"vectors">) => Promise<TileVectors | undefined>;
|
|
76
66
|
/** The tessellation module: where it is, and once loaded whether it works (false: the main thread does its work) */
|
|
77
67
|
export declare const tess: {
|
|
78
68
|
url?: string;
|
|
@@ -1,28 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* with the style's raster layers under them, and lists the label candidates of the style's symbol layers (their texts
|
|
5
|
-
* and icons) for the page to shape and place. Extrusions are drawn flat, as fills. Or it cuts the fills, lines and
|
|
6
|
-
* buildings of a tile into geometry for the engine to draw as such (`vectors`), with their style per feature (a
|
|
7
|
-
* building's color, height and base height). It also decodes the
|
|
8
|
-
* altitudes of PNG relief tiles and draws the rasters reprojected from other grids (planned by the page), for the
|
|
9
|
-
* map's other layers.
|
|
10
|
-
*
|
|
11
|
-
* A raster tile of level z covers 256 CSS pixels at map zoom z - 1 (MapLibre's 512 px convention): it is drawn from
|
|
12
|
-
* the vector tile of level z - 1 (or the deepest one the source has), with the style at that zoom.
|
|
13
|
-
*
|
|
14
|
-
* This module answers the page's messages; the jobs are in `./basemap/`: the state they share (`tiles.ts`), the
|
|
15
|
-
* images (`raster.ts`), the labels (`labels.ts`), the geometry (`geometry.ts`), the trees (`trees.ts`).
|
|
2
|
+
* The messages between the page and the basemap workers: the work asked of a worker (`BasemapWork`), the other
|
|
3
|
+
* requests (`BasemapRequest`), the answers (`BasemapResponse`) and the tiles they carry.
|
|
16
4
|
*/
|
|
17
|
-
import type { Value } from '
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import
|
|
23
|
-
import type { RoofMode } from '
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
5
|
+
import type { Value } from '../../basemap/mvt.ts';
|
|
6
|
+
import type { Job } from '../../basemap/resample.ts';
|
|
7
|
+
import type { PngEncoding } from '../../basemap/terrain.ts';
|
|
8
|
+
import type { LabelCandidate, RasterSource, StyleLayer } from '../../basemap/vectorstyle.ts';
|
|
9
|
+
import type { GridDescription, StreetFlows } from '../../grid-module.ts';
|
|
10
|
+
import type { HeaderRules } from '../../util/requests.ts';
|
|
11
|
+
import type { RoofMode } from '../../util/roofs.ts';
|
|
12
|
+
import type { StreetWork } from './street.ts';
|
|
13
|
+
import type { Sprite } from './tiles.ts';
|
|
26
14
|
export type { LabelCandidate, RasterSource, Sprite };
|
|
27
15
|
/** Fetch priority of a request (`fetch`'s `priority`, a hint to the browser) */
|
|
28
16
|
export type Priority = 'high' | 'low' | 'auto';
|
|
@@ -293,3 +281,21 @@ export interface TileMesh {
|
|
|
293
281
|
/** Min x, min y, max x, max y of the tile's points */
|
|
294
282
|
bounds: Float64Array;
|
|
295
283
|
}
|
|
284
|
+
/** Where a job's tile is (`z`, `x`, `y`), and its request: its id (aborted by the page), its priority */
|
|
285
|
+
export interface TileAt {
|
|
286
|
+
z: number;
|
|
287
|
+
x: number;
|
|
288
|
+
y: number;
|
|
289
|
+
id: number;
|
|
290
|
+
priority?: Priority | undefined;
|
|
291
|
+
}
|
|
292
|
+
/** A work of a type, as a worker receives it: with the id of its request */
|
|
293
|
+
export type WorkOf<T extends BasemapWork['type']> = Extract<BasemapWork, {
|
|
294
|
+
type: T;
|
|
295
|
+
}> & {
|
|
296
|
+
id: number;
|
|
297
|
+
};
|
|
298
|
+
/** Each answer of a union without the id of its request */
|
|
299
|
+
type WithoutId<R> = R extends unknown ? Omit<R, 'id'> : never;
|
|
300
|
+
/** An answer without the id of its request (the worker adds it) */
|
|
301
|
+
export type BasemapReply = WithoutId<BasemapResponse>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** The wind of a city's streets: the buildings of the vector tiles around a square, laid on its grid of cells, and
|
|
2
2
|
* the flow round them for a wind towards the east and one towards the north (the grid module) */
|
|
3
3
|
import { type StreetFlows } from '../../grid-module.ts';
|
|
4
|
-
import type { Priority } from '
|
|
4
|
+
import type { Priority } from './protocol.ts';
|
|
5
5
|
import { type Renderer } from './tiles.ts';
|
|
6
6
|
/** What a street flow is asked with: its square (Mercator: west, north, east, south) and grid, the tiles of level `z`
|
|
7
7
|
* over it (x, y pairs), the sweeps, the grid module's URL */
|
|
@@ -16,4 +16,6 @@ export interface StreetWork {
|
|
|
16
16
|
priority?: Priority;
|
|
17
17
|
}
|
|
18
18
|
/** The streets' flows of a square: the buildings of its tiles in cells (those away from it left out), then solved */
|
|
19
|
-
export declare const streetFlowOf: (r: Renderer, work: StreetWork
|
|
19
|
+
export declare const streetFlowOf: (r: Renderer, work: StreetWork & {
|
|
20
|
+
id: number;
|
|
21
|
+
}) => Promise<StreetFlows>;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { type TileLayer } from '../../basemap/mvt.ts';
|
|
4
4
|
import { type Context, type RasterSource, type StyleLayer } from '../../basemap/vectorstyle.ts';
|
|
5
5
|
import { Lru } from '../../util/lru.ts';
|
|
6
|
-
import type { Priority } from '
|
|
6
|
+
import type { Priority } from './protocol.ts';
|
|
7
7
|
export interface Renderer {
|
|
8
8
|
tiles: string;
|
|
9
9
|
maxzoom: number;
|
|
@@ -47,8 +47,6 @@ export declare const aborted: Set<number>;
|
|
|
47
47
|
export declare const image: (url: string, priority?: Priority) => Promise<ImageBitmap | undefined>;
|
|
48
48
|
/** A vector tile, decoded (shared by every renderer of its URL); the first request's priority fetches it */
|
|
49
49
|
export declare const tile: (url: string, priority?: Priority) => Promise<Map<string, TileLayer> | undefined>;
|
|
50
|
-
/** A tile's URL from its source's template */
|
|
51
|
-
export declare const tileUrl: (template: string, z: number, x: number, y: number) => string;
|
|
52
50
|
/** The vector tile to draw a raster tile from, and where the raster tile lies in it (tile units) */
|
|
53
51
|
export declare const source: (r: Renderer, z: number, x: number, y: number) => {
|
|
54
52
|
url: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** The trees of a tile: points scattered over the woods of its polygons, the same each time the tile is cut */
|
|
2
|
-
import type {
|
|
2
|
+
import type { WorkOf } from './protocol.ts';
|
|
3
3
|
import { type Renderer } from './tiles.ts';
|
|
4
4
|
/** Things placed (`PLACED_NUMBERS` each), past `max` thinned evenly by their rank: one in so many kept, the
|
|
5
5
|
* same ones each time */
|
|
@@ -21,4 +21,4 @@ export declare const scatter: (rings: readonly (readonly number[])[], extent: nu
|
|
|
21
21
|
* `coniferShare`, else 0) of each, `spacing[s]` metres apart in layer `s` on a jittered grid; past `maxTrees`, thinned
|
|
22
22
|
* evenly
|
|
23
23
|
*/
|
|
24
|
-
export declare const trees: (r: Renderer,
|
|
24
|
+
export declare const trees: (r: Renderer, work: WorkOf<"trees">) => Promise<Float64Array<ArrayBuffer> | undefined>;
|
package/package.json
CHANGED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The street furniture of a vector map (`VectorTiles.lamps`, `VectorTiles.furniture`), each made here as a glTF binary
|
|
3
|
-
* (no file to download), flat-shaded: a street lamp (its head lit at night: `ModelLayer.setGlow` from `LAMP_HEAD` up),
|
|
4
|
-
* a bus shelter, a waste basket, a post box, a Wallace fountain, bicycle racks, a bench.
|
|
5
|
-
*/
|
|
6
|
-
/** Metres from a lamp's foot to its head: the part lit at night */
|
|
7
|
-
export declare const LAMP_HEAD = 4.6;
|
|
8
|
-
/** A street lamp as a glTF binary, some 5 metres high: a thin pole, a lantern on top */
|
|
9
|
-
export declare const lampModel: () => Uint8Array<ArrayBuffer>;
|
|
10
|
-
/** A bus shelter, 3.6 metres wide, 2.5 high: a back and two sides of glass in a steel frame, a roof, an advert at one
|
|
11
|
-
* end; open toward the street (its front) */
|
|
12
|
-
export declare const shelterModel: () => Uint8Array<ArrayBuffer>;
|
|
13
|
-
/** A waste basket of Paris, about a metre high: a green hoop on a post */
|
|
14
|
-
export declare const binModel: () => Uint8Array<ArrayBuffer>;
|
|
15
|
-
/** A post box of La Poste, 1.3 metres high: a yellow box on a foot */
|
|
16
|
-
export declare const postboxModel: () => Uint8Array<ArrayBuffer>;
|
|
17
|
-
/** A Wallace fountain, 2.7 metres high: a base, a column (its four caryatids), a dome, all dark green cast iron */
|
|
18
|
-
export declare const fountainModel: () => Uint8Array<ArrayBuffer>;
|
|
19
|
-
/** Bicycle racks: three steel hoops a metre apart, 0.8 metres high, across the front */
|
|
20
|
-
export declare const rackModel: () => Uint8Array<ArrayBuffer>;
|
|
21
|
-
/** A bench, 1.8 metres wide: a wooden seat and back on dark green feet, facing its front */
|
|
22
|
-
export declare const benchModel: () => Uint8Array<ArrayBuffer>;
|
|
23
|
-
/** The kinds of furniture placed by the workers, in the order of their numbers (`PLACED_KIND`) */
|
|
24
|
-
export declare const FURNITURE: readonly ["shelter", "bin", "postbox", "fountain", "rack", "bench"];
|
|
25
|
-
/** The model of each kind of furniture */
|
|
26
|
-
export declare const FURNITURE_MODELS: Readonly<Record<(typeof FURNITURE)[number], () => Uint8Array<ArrayBuffer>>>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"furniture.js","sourceRoot":"","sources":["../../src/basemap/furniture.ts"],"names":[],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as a glTF binary\n * (no file to download), flat-shaded: a street lamp (its head lit at night: `ModelLayer.setGlow` from `LAMP_HEAD` up),\n * a bus shelter, a waste basket, a post box, a Wallace fountain, bicycle racks, a bench.\n */\n\nimport { box, type Color, glb, join, revolve } from './meshes.ts';\n\n/** Colors of a street lamp (linear RGBA, as glTF's `baseColorFactor`): Paris's dark green cast iron */\nconst POLE: Color = [0.04, 0.07, 0.05, 1];\nconst HEAD: Color = [0.55, 0.52, 0.42, 1];\n\n/** Metres from a lamp's foot to its head: the part lit at night */\nexport const LAMP_HEAD = 4.6;\n\n/** A street lamp as a glTF binary, some 5 metres high: a thin pole, a lantern on top */\nexport const lampModel = (): Uint8Array<ArrayBuffer> => {\n const pole = revolve(\n [\n [0, 0.14],\n [0.6, 0.1],\n [LAMP_HEAD, 0.06],\n ],\n 5,\n );\n const head = revolve(\n [\n [LAMP_HEAD, 0.12],\n [4.95, 0.32],\n [5.25, 0.26],\n [5.45, 0],\n ],\n 6,\n );\n\n return glb([pole, head], [POLE, HEAD]);\n};\n\n/** Colors of the street furniture (linear RGBA): Paris's dark green cast iron, steel, wood, glass, La Poste's yellow */\nconst GREEN: Color = [0.03, 0.08, 0.05, 1];\nconst STEEL: Color = [0.32, 0.33, 0.34, 1];\nconst WOOD: Color = [0.36, 0.2, 0.09, 1];\nconst GLASS: Color = [0.55, 0.7, 0.75, 0.35];\nconst POSTER: Color = [0.85, 0.82, 0.72, 1];\nconst YELLOW: Color = [0.95, 0.7, 0.02, 1];\n\n/** A bus shelter, 3.6 metres wide, 2.5 high: a back and two sides of glass in a steel frame, a roof, an advert at one\n * end; open toward the street (its front) */\nexport const shelterModel = (): Uint8Array<ArrayBuffer> => {\n const [w, d, h] = [1.8, 0.7, 2.5];\n const frame = join(\n box(-w, 0, -d, -w + 0.08, h, -d + 0.08),\n box(w - 0.08, 0, -d, w, h, -d + 0.08),\n box(-w, 0, d - 0.08, -w + 0.08, h, d),\n box(w - 0.08, 0, d - 0.08, w, h, d),\n box(-w - 0.1, h, -d - 0.1, w + 0.1, h + 0.12, d + 0.25),\n );\n const glass = join(box(-w, 0.15, -d, w, h - 0.1, -d + 0.03), box(-w, 0.15, -d, -w + 0.03, h - 0.1, d - 0.1));\n const advert = box(w - 0.12, 0.3, -d + 0.1, w - 0.04, 2.1, d - 0.1);\n const seat = box(-0.9, 0.42, -d + 0.05, 0.9, 0.48, -d + 0.4);\n\n return glb([frame, glass, advert, seat], [STEEL, GLASS, POSTER, STEEL]);\n};\n\n/** A waste basket of Paris, about a metre high: a green hoop on a post */\nexport const binModel = (): Uint8Array<ArrayBuffer> => {\n const post = box(-0.04, 0, -0.32, 0.04, 1.05, -0.24);\n const hoop = revolve(\n [\n [0.35, 0],\n [0.38, 0.2],\n [0.95, 0.24],\n [0.98, 0.25],\n ],\n 8,\n );\n\n return glb([post, hoop], [GREEN, GREEN]);\n};\n\n/** A post box of La Poste, 1.3 metres high: a yellow box on a foot */\nexport const postboxModel = (): Uint8Array<ArrayBuffer> =>\n glb([box(-0.08, 0, -0.08, 0.08, 0.6, 0.08), box(-0.25, 0.6, -0.18, 0.25, 1.3, 0.18)], [STEEL, YELLOW]);\n\n/** A Wallace fountain, 2.7 metres high: a base, a column (its four caryatids), a dome, all dark green cast iron */\nexport const fountainModel = (): Uint8Array<ArrayBuffer> =>\n glb(\n [\n revolve(\n [\n [0, 0.42],\n [0.35, 0.36],\n [0.5, 0.22],\n [1.9, 0.22],\n [2.05, 0.38],\n [2.3, 0.34],\n [2.55, 0.18],\n [2.75, 0],\n ],\n 8,\n ),\n ],\n [GREEN],\n );\n\n/** Bicycle racks: three steel hoops a metre apart, 0.8 metres high, across the front */\nexport const rackModel = (): Uint8Array<ArrayBuffer> =>\n glb(\n [\n join(\n ...[-1, 0, 1].flatMap((k) => [\n box(k - 0.03, 0, -0.38, k + 0.03, 0.8, -0.32),\n box(k - 0.03, 0, 0.32, k + 0.03, 0.8, 0.38),\n box(k - 0.03, 0.74, -0.38, k + 0.03, 0.8, 0.38),\n ]),\n ),\n ],\n [STEEL],\n );\n\n/** A bench, 1.8 metres wide: a wooden seat and back on dark green feet, facing its front */\nexport const benchModel = (): Uint8Array<ArrayBuffer> => {\n const feet = join(box(-0.85, 0, -0.25, -0.75, 0.45, 0.2), box(0.75, 0, -0.25, 0.85, 0.45, 0.2));\n const wood = join(box(-0.9, 0.42, -0.25, 0.9, 0.48, 0.22), box(-0.9, 0.5, -0.3, 0.9, 0.85, -0.25));\n\n return glb([feet, wood], [GREEN, WOOD]);\n};\n\n/** The kinds of furniture placed by the workers, in the order of their numbers (`PLACED_KIND`) */\nexport const FURNITURE = ['shelter', 'bin', 'postbox', 'fountain', 'rack', 'bench'] as const;\n\n/** The model of each kind of furniture */\nexport const FURNITURE_MODELS: Readonly<Record<(typeof FURNITURE)[number], () => Uint8Array<ArrayBuffer>>> = {\n shelter: shelterModel,\n bin: binModel,\n postbox: postboxModel,\n fountain: fountainModel,\n rack: rackModel,\n bench: benchModel,\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"meshes.js","sourceRoot":"","sources":["../../src/basemap/meshes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAchD;yFACyF;AACzF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAyC,EAAE,KAAa,EAAQ,EAAE;IACxF,MAAM,EAAE,GAAG,CAAC,CAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAmB,EAAQ,EAAE;QACvD,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;QAEpC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/C,CAAC,CAAC;IACF,MAA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,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;aACvG;SACF;QACD,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAChC,oBAAoB,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE;YACvF,iEAAiE;YACjE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;SAC/D,CAAC,CAAC;QACH,SAAS;QACT,WAAW,EAAE,KAAK;QAClB,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC;KAC1C,CAAC;IAEF,OAAO,KAAK,CAAC,IAAI,EAAE,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AACjD,CAAC,CAAC","sourcesContent":["/**\n * Small flat-shaded meshes made in the page (the trees, the street furniture) and their glTF binaries: solids of\n * revolution, boxes, parts joined.\n */\n\nimport { bounds, glbOf } from '../util/gltf.ts';\n\n/** A point or a vector: x, y, z */\ntype Vec3 = [number, number, number];\n\n/** A color: linear RGBA, as glTF's `baseColorFactor` */\nexport type Color = [number, number, number, number];\n\n/** A mesh's triangles: their positions and normals (x, y, z each; one normal per face) */\nexport interface Mesh {\n positions: number[];\n normals: number[];\n}\n\n/** A solid of revolution around the vertical (glTF +Y up), flat-shaded: rings of (height, radius), a point at the\n * top when its radius is 0; the triangles' positions and normals, one normal per face */\nexport const revolve = (rings: [height: number, radius: number][], sides: number): Mesh => {\n const at = (k: number, [h, r]: [number, number]): Vec3 => {\n const a = (k / sides) * Math.PI * 2;\n\n return [Math.cos(a) * r, h, Math.sin(a) * r];\n };\n const positions: number[] = [];\n const normals: number[] = [];\n const face = (a: Vec3, b: Vec3, c: Vec3) => {\n const u: Vec3 = [b[0] - a[0], b[1] - a[1], b[2] - a[2]];\n const v: Vec3 = [c[0] - a[0], c[1] - a[1], c[2] - a[2]];\n const n: Vec3 = [u[1] * v[2] - u[2] * v[1], u[2] * v[0] - u[0] * v[2], u[0] * v[1] - u[1] * v[0]];\n const length = Math.hypot(...n);\n\n // A degenerate face (two points at the apex) is left out\n if (length === 0) return;\n positions.push(...a, ...b, ...c);\n [0, 1, 2].forEach(() => {\n normals.push(n[0] / length, n[1] / length, n[2] / length);\n });\n };\n\n rings.slice(1).forEach((ring, i) => {\n const below = rings[i] ?? ring;\n\n Array.from({ length: sides }, (_, k) => k).forEach((k) => {\n const [a, b] = [at(k, below), at(k + 1, below)];\n const [c, d] = [at(k, ring), at(k + 1, ring)];\n\n // Counter-clockwise seen from outside\n face(a, c, b);\n face(b, c, d);\n });\n });\n // The bottom closed: seen from below\n const base = rings[0];\n\n if (base && base[1] > 0) {\n Array.from({ length: sides }, (_, k) => k).forEach((k) => {\n face([0, base[0], 0], at(k, base), at(k + 1, base));\n });\n }\n\n return { positions, normals };\n};\n\n/** A box from (x0, y0, z0) to (x1, y1, z1) (glTF axes: y up, z the model's front, x its left), its faces outward */\nexport const box = (x0: number, y0: number, z0: number, x1: number, y1: number, z1: number): Mesh => {\n const positions: number[] = [];\n const normals: number[] = [];\n // Each face: its normal and its four corners, counter-clockwise seen from outside\n const faces: [Vec3, Vec3[]][] = [\n [\n [1, 0, 0],\n [\n [x1, y0, z0],\n [x1, y1, z0],\n [x1, y1, z1],\n [x1, y0, z1],\n ],\n ],\n [\n [-1, 0, 0],\n [\n [x0, y0, z1],\n [x0, y1, z1],\n [x0, y1, z0],\n [x0, y0, z0],\n ],\n ],\n [\n [0, 1, 0],\n [\n [x0, y1, z0],\n [x0, y1, z1],\n [x1, y1, z1],\n [x1, y1, z0],\n ],\n ],\n [\n [0, -1, 0],\n [\n [x0, y0, z0],\n [x1, y0, z0],\n [x1, y0, z1],\n [x0, y0, z1],\n ],\n ],\n [\n [0, 0, 1],\n [\n [x0, y0, z1],\n [x1, y0, z1],\n [x1, y1, z1],\n [x0, y1, z1],\n ],\n ],\n [\n [0, 0, -1],\n [\n [x1, y0, z0],\n [x0, y0, z0],\n [x0, y1, z0],\n [x1, y1, z0],\n ],\n ],\n ];\n\n faces.forEach(([n, [a, b, c, d]]) => {\n [a, b, c, a, c, d].forEach((p) => {\n positions.push(...(p ?? [0, 0, 0]));\n normals.push(...n);\n });\n });\n\n return { positions, normals };\n};\n\n/** Parts of one color joined into one */\nexport const join = (...parts: Mesh[]): Mesh => ({\n positions: parts.flatMap((p) => p.positions),\n normals: parts.flatMap((p) => p.normals),\n});\n\n/** Parts flat-shaded in their colors as a glTF binary: one mesh of a primitive each, its front +Z\n * (`ModelInstance.heading` turns it), standing on its origin */\nexport const glb = (parts: Mesh[], colors: Color[]): Uint8Array<ArrayBuffer> => {\n // The buffer: each part's positions then normals, 4-byte floats\n const floats = parts.flatMap((p) => [...p.positions, ...p.normals]);\n const bin = new Float32Array(floats);\n const views = parts.flatMap((p, i) => {\n const before = parts.slice(0, i).reduce((n, q) => n + (q.positions.length + q.normals.length) * 4, 0);\n\n return [\n { buffer: 0, byteOffset: before, byteLength: p.positions.length * 4, target: 34962 },\n { buffer: 0, byteOffset: before + p.positions.length * 4, byteLength: p.normals.length * 4, target: 34962 },\n ];\n });\n const accessors = parts.flatMap((p, i) => [\n { bufferView: i * 2, componentType: 5126, count: p.positions.length / 3, type: 'VEC3', ...bounds(p.positions) },\n { bufferView: i * 2 + 1, componentType: 5126, count: p.normals.length / 3, type: 'VEC3' },\n ]);\n const gltf = {\n asset: { version: '2.0', generator: 'isard' },\n scene: 0,\n scenes: [{ nodes: [0] }],\n nodes: [{ mesh: 0 }],\n meshes: [\n {\n primitives: parts.map((_, i) => ({ attributes: { POSITION: i * 2, NORMAL: i * 2 + 1 }, material: i })),\n },\n ],\n materials: colors.map((color) => ({\n pbrMetallicRoughness: { baseColorFactor: color, metallicFactor: 0, roughnessFactor: 1 },\n // Translucent (a shelter's glass): blended, seen from both sides\n ...(color[3] < 1 && { alphaMode: 'BLEND', doubleSided: true }),\n })),\n accessors,\n bufferViews: views,\n buffers: [{ byteLength: bin.byteLength }],\n };\n\n return glbOf(gltf, new Uint8Array(bin.buffer));\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trees.js","sourceRoot":"","sources":["../../src/basemap/trees.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAIjD,+GAA+G;AAC/G,MAAM,KAAK,GAAG,CAAC,CAAC;AAChB,MAAM,SAAS,GAAG,CAAC,CAAC;AACpB,MAAM,eAAe,GAAG,CAAC,CAAC;AAS1B,oFAAoF;AACpF,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAW,CAAC;AAEvE,MAAM,cAAc,GAAe;IACjC,KAAK,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3B,KAAK,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5B,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;CAC/B,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,SAA8B,EAAE,EAAE,GAAG,GAAG,KAAK,EAA2B,EAAE;IAClG,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,MAAM,EAAE,CA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as glTF binaries (no file to download), a\n * broadleaved one and a conifer, their trunk and crown flat-shaded in their colors; the style layers they grow on by\n * default, and the share of conifers in a wood from its data.\n */\n\nimport { glb, join, revolve } from './meshes.ts';\nimport type { Value } from './mvt.ts';\nimport type { StyleLayer } from './vectorstyle.ts';\n\n/** Sides of the trunk and of the crown near the view; of the crown far away (a pyramid), of the trunk there */\nconst SIDES = 7;\nconst FAR_SIDES = 4;\nconst FAR_TRUNK_SIDES = 3;\n\n/** Colors of the trunk, of the broadleaved crown and of the conifers' (linear RGBA, as glTF's `baseColorFactor`) */\nexport interface TreeColors {\n trunk: [number, number, number, number];\n crown: [number, number, number, number];\n conifer: [number, number, number, number];\n}\n\n/** The models' heights (metres): a tree's height from its data scales them by it */\nexport const TREE_METRES = { broadleaved: 10.2, conifer: 11 } as const;\n\nconst DEFAULT_COLORS: TreeColors = {\n trunk: [0.2, 0.12, 0.07, 1],\n crown: [0.12, 0.27, 0.08, 1],\n conifer: [0.05, 0.16, 0.08, 1],\n};\n\n/**\n * A broadleaved tree as a glTF binary, about 10 metres high: a trunk and a rounded crown in `colors`; `far`: the\n * same simplified for far away, a few faces (some 30 triangles instead of 100)\n */\nexport const treeModel = (colors: Partial<TreeColors> = {}, far = false): Uint8Array<ArrayBuffer> => {\n const { trunk, crown } = { ...DEFAULT_COLORS, ...colors };\n\n if (far) {\n const stem = revolve(\n [\n [0, 0.3],\n [3, 0.22],\n ],\n FAR_TRUNK_SIDES,\n );\n const top = revolve(\n [\n [2.4, 0.8],\n [5.6, 2.9],\n [TREE_METRES.broadleaved, 0],\n ],\n FAR_SIDES,\n );\n\n return glb([stem, top], [trunk, crown]);\n }\n\n const parts = [\n revolve(\n [\n [0, 0.28],\n [3.2, 0.2],\n ],\n SIDES,\n ),\n revolve(\n [\n [2.4, 0.6],\n [3.6, 2.4],\n [5.6, 2.9],\n [7.8, 2.3],\n [9.4, 1.1],\n [TREE_METRES.broadleaved, 0],\n ],\n SIDES,\n ),\n ];\n\n return glb(parts, [trunk, crown]);\n};\n\n/** A cone of the conifers' crown: from `base` metres up, `radius` wide, to its point at `top` */\nconst cone = (base: number, radius: number, top: number) =>\n revolve(\n [\n [base, radius],\n [top, 0],\n ],\n SIDES,\n );\n\n/**\n * A conifer as a glTF binary, about 11 metres high: a trunk and three cones one over the other in `colors`; `far`: one\n * pyramid on a trunk of three faces for far away (some 17 triangles instead of 63)\n */\nexport const coniferModel = (colors: Partial<TreeColors> = {}, far = false): Uint8Array<ArrayBuffer> => {\n const { trunk, conifer } = { ...DEFAULT_COLORS, ...colors };\n\n if (far) {\n const stem = revolve(\n [\n [0, 0.24],\n [2, 0.18],\n ],\n FAR_TRUNK_SIDES,\n );\n const top = revolve(\n [\n [1.4, 2.3],\n [TREE_METRES.conifer, 0],\n ],\n FAR_SIDES,\n );\n\n return glb([stem, top], [trunk, conifer]);\n }\n const tiers = [cone(1.4, 2.4, 5.4), cone(3.6, 1.9, 8), cone(6, 1.3, TREE_METRES.conifer)];\n const crown = join(...tiers);\n const stem = revolve(\n [\n [0, 0.24],\n [2, 0.18],\n ],\n SIDES,\n );\n\n return glb([stem, crown], [trunk, conifer]);\n};\n\n/** Whether a style layer is OpenMapTiles' grass (the lawns of parks and gardens among it) */\nconst isGrass = (layer: StyleLayer): boolean => layer['source-layer'] === 'landcover' && /grass/i.test(layer.id);\n\n/**\n * Whether trees grow on a style layer by default: the woods and forests of the style's fills (OpenMapTiles'\n * `landcover` wood, PLAN IGN's forests) and the grass of its parks and gardens; not the wooded relief of PLAN IGN,\n * which repeats its forests, nor OpenMapTiles' `park` layer (protected areas and historic sites: a river's banks\n * among them)\n */\nexport const isWoodland = (layer: StyleLayer): boolean =>\n layer.type === 'fill' &&\n layer['source-layer'] !== 'oro_relief' &&\n (/wood|forest|for[eê]t/i.test(layer.id) || isGrass(layer));\n\n/** Default spacing of the trees of a layer (metres): close in woods and forests, apart on grass */\nexport const treeSpacing = (layer: StyleLayer): number => (isGrass(layer) ? 25 : 9);\n\n/**\n * The share of conifers in a wood from its properties: OpenStreetMap's `leaf_type` (needleleaved, broadleaved,\n * mixed), PLAN IGN's `nature` (« conifères », « feuillus », « mixte »); without them, OpenMapTiles' forests a third\n * conifers and its other woods some, the grass of parks none\n */\nexport const coniferShare = (properties: Record<string, Value>): number => {\n const leaf = properties.leaf_type;\n const nature = typeof properties.nature === 'string' ? properties.nature : '';\n\n if (leaf === 'needleleaved' || /conif/i.test(nature)) return 1;\n if (leaf === 'broadleaved' || /feuillu/i.test(nature)) return 0;\n if (leaf === 'mixed' || /mixte/i.test(nature)) return 0.5;\n if (properties.class === 'wood') return properties.subclass === 'forest' ? 0.35 : 0.15;\n\n return 0;\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decoders.js","sourceRoot":"","sources":["../../src/engine/decoders.ts"],"names":[],"mappings":";;;;;;;;AAAA;;;;GAIG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAsB7C,MAAM,CAAC,MAAM,gBAAgB,GAAgB;IAC3C,KAAK,EAAE,yDAAyD;IAChE,KAAK,EAAE,qEAAqE;CAC7E,CAAC;AAqEF;;6DAE6D;AAC7D,MAAM,OAAO,GAAG,KAAK,EAAK,GAAW,EAAE,IAAY,EAAuB,EAAE;IAC1E,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC/C,MAAM,IAAI,GAAG,GAAG,CAAC,eAAe,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,MAAM,oBAAoB,IAAI,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC,CAAC,CAAC;IAEhH,IAAI,CAAC;QACH,MAAM,MAAM,GAAY,MAAM,MAAM,kCAAC,kBAAkB,CAAC,IAAI,EAAC,CAAC;QAE9D,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,UA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CAAC,oBAAoB,CAAC,CAAC;QAEvF,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QAClE,MAAM,MAAM,GAAgC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;YAChG,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YACrF,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,6BAA6B,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;YAErF,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;YAE5G,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QACjC,CAAC,CAAC,CAAC;QAEH,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;IAChC,CAAC;YAAS,CAAC;QACT,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;AACH,CAAC,CAAC","sourcesContent":["/**\n * Optional decoders of the worker, loaded on first use from configurable URLs (the official builds three.js and\n * Cesium use): Draco geometry (`KHR_draco_mesh_compression`) and KTX2 / Basis Universal textures (`KHR_texture_basisu`),\n * transcoded to the best compressed format the GPU supports.\n */\nimport { isRecord } from '../util/guards.ts';\nimport type { CompressedTexture, DracoGeometry, DracoRequest, TextureFormats } from '../wasm/isard.js';\n\n/**\n * Base URLs of the decoders (each ending with `/`).\n *\n * The decoders are Emscripten builds published as classic scripts: the worker fetches the script and imports it as a\n * module from a `blob:` URL, so a Content Security Policy needs `blob:` in `script-src` (or `worker-src`) for 3D Tiles\n * that use Draco; it falls back on `new Function` (`'unsafe-eval'`) where `blob:` is refused. The Basis transcoder (KTX2)\n * needs `'unsafe-eval'` anyway: its own bindings (embind) build functions from strings. They are fetched from the default CDNs; to self-host them (offline, locked-down\n * networks, no third-party requests), copy the four files (`draco_wasm_wrapper_gltf.js`, `draco_decoder_gltf.wasm`\n * from the Draco release, `basis_transcoder.js`, `basis_transcoder.wasm` from three.js's `examples/jsm/libs/basis/`)\n * to your server and give their folders in `GeoMapOptions.decoders`.\n */\nexport interface DecoderUrls {\n /** Folder of `draco_wasm_wrapper_gltf.js` and `draco_decoder_gltf.wasm` (and, for Draco point clouds, of the full\n * decoder `draco_wasm_wrapper.js` and `draco_decoder.wasm`) */\n draco: string;\n /** Folder of `basis_transcoder.js` and `basis_transcoder.wasm` */\n basis: string;\n}\n\nexport const DEFAULT_DECODERS: DecoderUrls = {\n draco: 'https://www.gstatic.com/draco/versioned/decoders/1.5.7/',\n basis: 'https://cdn.jsdelivr.net/npm/three@0.170.0/examples/jsm/libs/basis/',\n};\n\n// ── Draco (the subset of its Emscripten API used here) ──\n\ninterface DracoStatus {\n ok(): boolean;\n error_msg(): string;\n}\ninterface DracoMesh {\n num_points(): number;\n num_faces(): number;\n}\ninterface DracoAttribute {\n num_components(): number;\n}\ninterface DracoDecoder {\n DecodeArrayToMesh(data: Int8Array, size: number, mesh: DracoMesh): DracoStatus;\n DecodeArrayToPointCloud(data: Int8Array, size: number, cloud: DracoMesh): DracoStatus;\n GetAttributeByUniqueId(mesh: DracoMesh, id: number): DracoAttribute;\n GetAttributeDataArrayForAllPoints(\n mesh: DracoMesh,\n attribute: DracoAttribute,\n type: number,\n bytes: number,\n pointer: number,\n ): boolean;\n GetTrianglesUInt32Array(mesh: DracoMesh, bytes: number, pointer: number): boolean;\n}\ninterface DracoModule {\n Decoder: new () => DracoDecoder;\n Mesh: new () => DracoMesh;\n PointCloud: new () => DracoMesh;\n DT_FLOAT32: number;\n HEAPF32: Float32Array;\n HEAPU32: Uint32Array;\n _malloc(bytes: number): number;\n _free(pointer: number): void;\n destroy(object: object): void;\n}\n\n// ── Basis Universal transcoder ──\n\ninterface KTX2File {\n isValid(): boolean;\n getLevels(): number;\n getHasAlpha(): boolean;\n startTranscoding(): boolean;\n getImageLevelInfo(level: number, layer: number, face: number): { origWidth: number; origHeight: number };\n getImageTranscodedSizeInBytes(level: number, layer: number, face: number, format: number): number;\n transcodeImage(\n target: Uint8Array,\n level: number,\n layer: number,\n face: number,\n format: number,\n alphaForOpaque: number,\n channel0: number,\n channel1: number,\n ): boolean;\n close(): void;\n delete(): void;\n}\ninterface BasisModule {\n initializeBasis(): void;\n KTX2File: new (data: Uint8Array) => KTX2File;\n}\n\ntype Factory<T> = (options: { wasmBinary: ArrayBuffer }) => Promise<T>;\n\n/** Loads an Emscripten factory published as a classic script (module workers have no importScripts): imported as a\n * module from a `blob:` URL (a Content Security Policy allowing `blob:` scripts is enough), else evaluated (where\n * `blob:` is refused: `'unsafe-eval'`, see `DecoderUrls`) */\nconst factory = async <T>(url: string, name: string): Promise<Factory<T>> => {\n const source = await (await fetch(url)).text();\n const blob = URL.createObjectURL(new Blob([`${source}\\nexport default ${name};`], { type: 'text/javascript' }));\n\n try {\n const module: unknown = await import(/* @vite-ignore */ blob);\n\n if (isRecord(module) && typeof module.default === 'function') return module.default as Factory<T>;\n } catch {\n // Refused (`blob:` not allowed): evaluated below\n } finally {\n URL.revokeObjectURL(blob);\n }\n\n return new Function(`${source}\\nreturn ${name};`)() as Factory<T>;\n};\n\nconst instantiate = async <T>(base: string, script: string, wasm: string, name: string): Promise<T> => {\n const [create, binary] = await Promise.all([\n factory<T>(`${base}${script}`, name),\n fetch(`${base}${wasm}`).then((r) => r.arrayBuffer()),\n ]);\n\n return create({ wasmBinary: binary });\n};\n\nlet draco: Promise<DracoModule> | undefined;\n/** The full Draco decoder: the glTF build decodes meshes only, not the point clouds */\nlet dracoPoints: Promise<DracoModule> | undefined;\nlet basis: Promise<BasisModule> | undefined;\n\n/** Decodes the Draco primitives of a tile (their points alone for point clouds) */\nexport const decodeDraco = async (urls: DecoderUrls, requests: DracoRequest[]): Promise<DracoGeometry[]> => {\n const meshes = requests.some((r) => !r.points);\n\n if (meshes) {\n draco ??= instantiate<DracoModule>(\n urls.draco,\n 'draco_wasm_wrapper_gltf.js',\n 'draco_decoder_gltf.wasm',\n 'DracoDecoderModule',\n );\n }\n if (requests.some((r) => r.points)) {\n dracoPoints ??= instantiate<DracoModule>(\n urls.draco,\n 'draco_wasm_wrapper.js',\n 'draco_decoder.wasm',\n 'DracoDecoderModule',\n );\n }\n\n const [forMeshes, forPoints] = await Promise.all([meshes ? draco : undefined, dracoPoints]);\n\n return requests.map((request) => {\n const module = request.points ? forPoints : forMeshes;\n\n if (!module) throw new Error('isard: the Draco decoder is not loaded');\n\n const decoder = new module.Decoder();\n const mesh = request.points ? new module.PointCloud() : new module.Mesh();\n\n try {\n const data = new Int8Array(request.data.buffer, request.data.byteOffset, request.data.byteLength);\n const status = request.points\n ? decoder.DecodeArrayToPointCloud(data, data.byteLength, mesh)\n : decoder.DecodeArrayToMesh(data, data.byteLength, mesh);\n\n if (!status.ok()) throw new Error(`Draco: ${status.error_msg()}`);\n\n const floats = (id: number): Float32Array => {\n const attribute = decoder.GetAttributeByUniqueId(mesh, id);\n const count = mesh.num_points() * attribute.num_components();\n const pointer = module._malloc(count * 4);\n\n try {\n decoder.GetAttributeDataArrayForAllPoints(mesh, attribute, module.DT_FLOAT32, count * 4, pointer);\n\n return module.HEAPF32.slice(pointer / 4, pointer / 4 + count);\n } finally {\n module._free(pointer);\n }\n };\n\n if (request.points) {\n const geometry: DracoGeometry = {\n mesh: request.mesh,\n primitive: request.primitive,\n positions: floats(request.position),\n };\n\n if (request.color !== undefined) geometry.colors = floats(request.color);\n if (request.normal !== undefined) geometry.normals = floats(request.normal);\n\n return geometry;\n }\n\n const triangles = (): Uint32Array => {\n const count = mesh.num_faces() * 3;\n const pointer = module._malloc(count * 4);\n\n try {\n decoder.GetTrianglesUInt32Array(mesh, count * 4, pointer);\n\n return module.HEAPU32.slice(pointer / 4, pointer / 4 + count);\n } finally {\n module._free(pointer);\n }\n };\n const indices = triangles();\n const geometry: DracoGeometry = {\n mesh: request.mesh,\n primitive: request.primitive,\n positions: floats(request.position),\n indices,\n };\n\n if (request.uv !== undefined) geometry.uvs = floats(request.uv);\n\n return geometry;\n } finally {\n module.destroy(mesh);\n module.destroy(decoder);\n }\n });\n};\n\n/** Basis target format and WebGL internal format, best first */\nconst target = (formats: TextureFormats, alpha: boolean): { basis: number; gl: number } => {\n if (formats.astc) return { basis: 10, gl: 0x93b0 }; // ASTC 4×4\n if (formats.bptc) return { basis: 6, gl: 0x8e8c }; // BC7\n if (formats.etc) return alpha ? { basis: 1, gl: 0x9278 } : { basis: 0, gl: 0x9274 }; // ETC2 RGBA / ETC1 as ETC2 RGB\n if (formats.s3tc) return alpha ? { basis: 3, gl: 0x83f3 } : { basis: 2, gl: 0x83f0 }; // BC3 / BC1\n\n return { basis: 13, gl: 0x8058 }; // RGBA8, uncompressed\n};\n\n/** Transcodes a KTX2 image for the GPU */\nexport const transcodeKtx2 = async (\n urls: DecoderUrls,\n formats: TextureFormats,\n bytes: Uint8Array,\n): Promise<CompressedTexture> => {\n basis ??= instantiate<BasisModule>(urls.basis, 'basis_transcoder.js', 'basis_transcoder.wasm', 'BASIS').then((m) => {\n m.initializeBasis();\n\n return m;\n });\n\n const module = await basis;\n const file = new module.KTX2File(bytes);\n\n try {\n if (!file.isValid() || !file.startTranscoding()) throw new Error('KTX2: invalid file');\n\n const { basis: format, gl } = target(formats, file.getHasAlpha());\n const levels: CompressedTexture['levels'] = Array.from({ length: file.getLevels() }, (_, level) => {\n const { origWidth: width, origHeight: height } = file.getImageLevelInfo(level, 0, 0);\n const data = new Uint8Array(file.getImageTranscodedSizeInBytes(level, 0, 0, format));\n\n if (!file.transcodeImage(data, level, 0, 0, format, 0, -1, -1)) throw new Error('KTX2: transcoding failed');\n\n return { width, height, data };\n });\n\n return { format: gl, levels };\n } finally {\n file.close();\n file.delete();\n }\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/engine/loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAQ3D,MAAM,OAAO,UAAU;IAeF;IACA;IACA;IACA;IACA;IAEA;IApBX,OAAO,GAAa,EAAE,CAAC;IAC/B,oCAAoC;IACnB,IAAI,GAAG,IAAI,GAAG,EAAkB,CAAC;IACjC,OAAO,GAAG,IAAI,GAAG,EAAmB,CAAC;IACtD,+BAA+B;IACvB,MAAM,CAAoB;IAClC,qEAAqE;IACpD,QAAQ,GAAG,aAAa,CAAC,CAAC,KAAK,EAAE,EAAE;QAClD,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YAC9B,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,YACmB,MAA0B,EAC1B,SAAuB,EACvB,IAAY,EACZ,QAAqB,EACrB,OAAuB;IACxC,qDAAqD;IACpC,SAAiB,EAAE;QANnB,WAAM,GAAN,MAAM,CAAoB;QAC1B,cAAS,GAAT,SAAS,CAAc;QACvB,SAAI,GAAJ,IAAI,CAAQ;QACZ,aAAQ,GAAR,QAAQ,CAAa;QACrB,YAAO,GAAP,OAAO,CAAgB;QAEvB,WAAM,GAAN,MAAM,CAAa;IACnC,CAAC;IA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ls `load`, `loadPoints` and `abort`\n * (`TileLoaderLike`); the main thread then only uploads the decoded arrays to the GPU.\n */\n\nimport type { DecodedTile, TextureFormats, TileLoaderLike } from '../wasm/isard.js';\nimport type { DecoderUrls } from './decoders.ts';\nimport type { WorkerReply, WorkerRequest } from './protocol.ts';\nimport { headerRules, onHeaderRules } from './requests.ts';\n\ninterface Pending {\n resolve: (result: DecodedTile | Uint8Array<ArrayBuffer>) => void;\n reject: (error: Error) => void;\n worker: Worker;\n}\n\nexport class TileLoader implements TileLoaderLike {\n private workers: Worker[] = [];\n /** Requests in flight per worker */\n private readonly busy = new Map<Worker, number>();\n private readonly pending = new Map<number, Pending>();\n /** Every worker failed: why */\n private failed: Error | undefined;\n /** The page's request headers, sent to the workers as they change */\n private readonly unfollow = onHeaderRules((rules) => {\n this.workers.forEach((worker) => {\n this.send(worker, { type: 'headers', rules });\n });\n });\n\n constructor(\n private readonly module: WebAssembly.Module,\n private readonly workerUrl: string | URL,\n private readonly size: number,\n private readonly decoders: DecoderUrls,\n private readonly formats: TextureFormats,\n /** URL of the point cloud module, for the workers */\n private readonly points: string = '',\n ) {}\n\n /** Called by the engine: fetch and decode off the main thread, on the least busy worker */\n load(\n id: number,\n url: string,\n transform: Float64Array,\n yUp: boolean,\n reload: boolean,\n priority?: 'high' | 'low',\n ): Promise<DecodedTile> {\n if (this.failed) return Promise.reject(this.failed);\n\n const worker = this.leastBusy();\n\n this.busy.set(worker, (this.busy.get(worker) ?? 0) + 1);\n\n return new Promise((resolve, reject) => {\n this.pending.set(id, { resolve: resolve as Pending['resolve'], reject, worker });\n this.send(worker, { type: 'load', id, url, transform, yUp, reload, ...(priority ? { priority } : {}) });\n });\n }\n\n /** Called by the engine: the points of a COPC node, fetched (a range request) and decoded off the main thread */\n loadPoints(\n id: number,\n url: string,\n offset: number,\n size: number,\n laz: Uint8Array,\n layout: Float64Array,\n grid: Float64Array,\n count: number,\n priority?: 'high' | 'low',\n ): Promise<Uint8Array<ArrayBuffer>> {\n if (this.failed) return Promise.reject(this.failed);\n\n const worker = this.leastBusy();\n\n this.busy.set(worker, (this.busy.get(worker) ?? 0) + 1);\n\n return new Promise((resolve, reject) => {\n this.pending.set(id, { resolve: resolve as Pending['resolve'], reject, worker });\n\n const message = { type: 'points', id, url, offset, size, laz, layout, grid, count } as const;\n\n this.send(worker, { ...message, ...(priority ? { priority } : {}) });\n });\n }\n\n abort(id: number): void {\n const pending = this.pending.get(id);\n\n if (pending) this.send(pending.worker, { type: 'abort', id });\n }\n\n destroy(): void {\n this.unfollow();\n this.workers.forEach((worker) => {\n worker.terminate();\n });\n this.workers = [];\n this.busy.clear();\n this.pending.forEach(({ reject }) => {\n reject(new Error('loader destroyed'));\n });\n this.pending.clear();\n }\n\n /** Workers start with the first tile: a map without 3D Tiles costs nothing */\n private leastBusy(): Worker {\n if (this.workers.length === 0) {\n Array.from({ length: this.size }).forEach(() => {\n const worker = new Worker(this.workerUrl, { type: 'module' });\n\n worker.onmessage = (event: MessageEvent<WorkerReply>) => this.receive(worker, event.data);\n // A worker that fails to load (a bundler serving it from elsewhere) or to read a message fails its requests\n worker.onerror = (event) => {\n event.preventDefault();\n this.fail(worker, `the decoding worker ${this.workerUrl} failed${event.message ? `: ${event.message}` : ''}`);\n };\n worker.onmessageerror = () =>\n this.fail(worker, `the decoding worker ${this.workerUrl} sent an unreadable message`);\n\n const { module, decoders, formats, points } = this;\n\n this.send(worker, { type: 'init', module, decoders, formats, points });\n\n const rules = headerRules();\n\n if (rules.length > 0) this.send(worker, { type: 'headers', rules });\n this.workers.push(worker);\n this.busy.set(worker, 0);\n });\n }\n\n const load = (worker: Worker) => this.busy.get(worker) ?? 0;\n\n return this.workers.reduce((best, worker) => (load(worker) < load(best) ? worker : best));\n }\n\n private send(worker: Worker, message: WorkerRequest): void {\n worker.postMessage(message);\n }\n\n private receive(worker: Worker, reply: WorkerReply): void {\n this.busy.set(worker, Math.max(0, (this.busy.get(worker) ?? 1) - 1));\n\n const pending = this.pending.get(reply.id);\n\n if (!pending) return;\n this.pending.delete(reply.id);\n if (reply.type === 'tile') pending.resolve(reply.tile);\n else if (reply.type === 'points') pending.resolve(reply.vertices);\n else if (reply.aborted) pending.reject(new DOMException(`tile ${reply.id} aborted`, 'AbortError'));\n else pending.reject(new Error(reply.error));\n }\n\n /** Rejects the requests of a failed worker */\n private fail(worker: Worker, message: string): void {\n const error = new Error(\n `isard: ${message}. If a bundler moves the worker, give its URL in the \\`workerUrl\\` option (see \"With a bundler\" in the guide)`,\n );\n\n this.pending.forEach((pending, id) => {\n if (pending.worker !== worker) return;\n this.pending.delete(id);\n pending.reject(error);\n });\n // Out of the pool: when none is left, the next requests fail at once\n worker.terminate();\n this.workers = this.workers.filter((w) => w !== worker);\n this.busy.delete(worker);\n if (this.workers.length === 0) this.failed = error;\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/engine/protocol.ts"],"names":[],"mappings":"AAAA,gEAAgE","sourcesContent":["/** Messages between the main thread and the decoding workers */\n\nimport type { DecodedTile, TextureFormats } from '../wasm/isard.js';\nimport type { DecoderUrls } from './decoders.ts';\nimport type { HeaderRules } from './requests.ts';\n\nexport type WorkerRequest =\n /** The page's request headers (`setRequestHeaders`) */\n | { type: 'headers'; rules: HeaderRules }\n | {\n type: 'init';\n module: WebAssembly.Module;\n decoders: DecoderUrls;\n formats: TextureFormats;\n /** URL of the point cloud module (`isard_points_bg.wasm`), loaded with the first COPC chunk */\n points: string;\n }\n | {\n type: 'load';\n id: number;\n url: string;\n transform: Float64Array;\n yUp: boolean;\n reload: boolean;\n priority?: 'high' | 'low';\n }\n | {\n type: 'points';\n id: number;\n url: string;\n offset: number;\n size: number;\n laz: Uint8Array;\n layout: Float64Array;\n grid: Float64Array;\n count: number;\n priority?: 'high' | 'low';\n }\n | { type: 'abort'; id: number };\n\nexport type WorkerReply =\n | { type: 'tile'; id: number; tile: DecodedTile }\n | { type: 'points'; id: number; vertices: Uint8Array<ArrayBuffer> }\n | { type: 'error'; id: number; error: string; aborted: boolean };\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"requests.js","sourceRoot":"","sources":["../../src/engine/requests.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,IAAI,KAAK,GAAgB,EAAE,CAAC;AAC5B,MAAM,SAAS,GAAG,IAAI,GAAG,EAAgC,CAAC;AAE1D;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAAE,OAAgC,EAAQ,EAAE;IAC1F,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC;IAEjD,IAAI,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC;QAAE,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC;IACpF,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;IAC7C,cAAc,CAAC,IAAI,CAAC,CAAC;IACrB,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC7B,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,8BAA8B;AAC9B,MAAM,CAAC,MAAM,WAAW,GAAG,GAAgB,EAAE;IAC3C,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,2DAA2D;AAC3D,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAiB,EAAQ,EAAE;IACxD,KAAK,GAAG,IAAI,CAAC;AACf,CAAC,CAAC;AAEF,sGAAsG;AACtG,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,QAAsC,EAAgB,EAAE;IACpF,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAExB,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC1C,CAAC,CAAC;AAEF,+FAA+F;AAC/F,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAiB,EAAE,OAAoB,EAAE,EAAe,EAAE;IACpF,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IACzB,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IAErE,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAEvC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAE1C,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE;QAC3B,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE;YAC5C,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC;AAC9B,CAAC,CAAC","sourcesContent":["/**\n * Headers added to the requests of the page by URL prefix: an access token for private sources (a Géoplateforme\n * private stream, a server behind single sign-on), on every request isard makes, from the page, its workers (vector\n * tiles, 3D Tiles and point clouds) and its engine (raster tiles, tilesets): `setRequestHeaders(prefix, headers)`,\n * again with a new token when it is renewed. The rules of a URL are merged, the longest prefix last (it wins).\n */\n\n/** Rules: a URL prefix and its headers, the shortest prefix first */\nexport type HeaderRules = [prefix: string, headers: Record<string, string>][];\n\nlet rules: HeaderRules = [];\nconst listeners = new Set<(rules: HeaderRules) => void>();\n\n/**\n * Adds `headers` to every request isard makes to a URL starting with `prefix` (in the page and its workers), or with\n * no headers, stops: `setRequestHeaders('https://data.geopf.fr/private/', { Authorization: 'Bearer …' })`. The\n * server must allow these headers (CORS). For the whole page: every map, the ones to come too\n */\nexport const setRequestHeaders = (prefix: string, headers?: Record<string, string>): void => {\n const kept = rules.filter(([p]) => p !== prefix);\n\n if (headers && Object.keys(headers).length > 0) kept.push([prefix, { ...headers }]);\n kept.sort(([p], [q]) => p.length - q.length);\n setHeaderRules(kept);\n listeners.forEach((listener) => {\n listener(rules);\n });\n};\n\n/** @internal The rules now */\nexport const headerRules = (): HeaderRules => {\n return rules;\n};\n\n/** @internal The rules, from the page (a worker's copy) */\nexport const setHeaderRules = (next: HeaderRules): void => {\n rules = next;\n};\n\n/** @internal Follows the rules (the workers and engines of a map); returns the function that stops */\nexport const onHeaderRules = (listener: (rules: HeaderRules) => void): (() => void) => {\n listeners.add(listener);\n\n return () => listeners.delete(listener);\n};\n\n/** @internal `init` with the headers of the rules matching `url` (unchanged when none does) */\nexport const withHeaders = (url: string | URL, init: RequestInit = {}): RequestInit => {\n const href = String(url);\n const matching = rules.filter(([prefix]) => href.startsWith(prefix));\n\n if (matching.length === 0) return init;\n\n const headers = new Headers(init.headers);\n\n matching.forEach(([, set]) => {\n Object.entries(set).forEach(([name, value]) => {\n headers.set(name, value);\n });\n });\n\n return { ...init, headers };\n};\n"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The street furniture of a tile, from OpenMapTiles' layers: its points of interest of the street where they stand
|
|
3
|
-
* (bus stops' shelters, waste baskets, post boxes, drinking fountains, bicycle racks), each facing the nearest street;
|
|
4
|
-
* benches along the pedestrian streets and the paths of the parks and gardens. The same each time the tile is cut
|
|
5
|
-
*/
|
|
6
|
-
import type { Priority } from '../basemap.worker.ts';
|
|
7
|
-
import { type Renderer } from './tiles.ts';
|
|
8
|
-
/**
|
|
9
|
-
* The street furniture of a tile: longitude, latitude, scale, heading (degrees, facing its street or path), rank (in
|
|
10
|
-
* [0, 1): the page keeps the lowest far from the view) and kind (`FURNITURE`' index) of each, as things placed
|
|
11
|
-
* (`PLACED_NUMBERS`); past `maxObjects`, thinned evenly
|
|
12
|
-
*/
|
|
13
|
-
export declare const furniture: (r: Renderer, z: number, x: number, y: number, id: number, maxObjects: number, priority?: Priority) => Promise<Float64Array<ArrayBufferLike> | undefined>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/** The label candidates of a tile: the texts and icons of the style's symbol layers, for the page to shape and place */
|
|
2
|
-
import type { TileFeature } from '../../basemap/mvt.ts';
|
|
3
|
-
import { type LabelCandidate } from '../../basemap/vectorstyle.ts';
|
|
4
|
-
import type { Priority } from '../basemap.worker.ts';
|
|
5
|
-
import { type Renderer } from './tiles.ts';
|
|
6
|
-
/** Points every `spacing` along a line (tile units, x and y interleaved), the first half a spacing in (the middle of a
|
|
7
|
-
* shorter line): each point, the segment it lies on and how far along the line it is (x, y, x0, y0, x1, y1, the
|
|
8
|
-
* distance) */
|
|
9
|
-
export declare const lineAnchors: (line: readonly number[], spacing: number) => number[][];
|
|
10
|
-
/** The point `offset` (tile units) beside a line's anchor (`lineAnchors`), the `k`th anchor's on one side of the line,
|
|
11
|
-
* the next one's on the other: x, y and its heading facing the line (degrees; y towards the south in the tile) */
|
|
12
|
-
export declare const besideLine: (anchor: readonly number[], k: number, offset: number) => [x: number, y: number, heading: number];
|
|
13
|
-
/** The part of a line (tile units, interleaved) from `from` to `to` along it (distances from its start) */
|
|
14
|
-
export declare const lineBetween: (line: readonly number[], from: number, to: number) => number[];
|
|
15
|
-
/**
|
|
16
|
-
* The height of the building under a point of a tile (its units), the highest if several: the buildings of the
|
|
17
|
-
* style's `fill-extrusion` layers shown at `zoom`, at their `fill-extrusion-height`; undefined outside them. A label
|
|
18
|
-
* there stands on its roof, not hidden by its walls. The buildings found through a grid of the tile's squares
|
|
19
|
-
*/
|
|
20
|
-
export declare const roofsOf: (r: Renderer, layers: Map<string, {
|
|
21
|
-
extent: number;
|
|
22
|
-
features: TileFeature[];
|
|
23
|
-
}>, zoom: number) => ((px: number, py: number) => number | undefined);
|
|
24
|
-
export declare const labels: (r: Renderer, z: number, x: number, y: number, id: number, priority?: Priority, zoom?: number, roofs?: boolean) => Promise<LabelCandidate[]>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/** The street lamps of a tile: points along its streets, on one side then the other, the same each time the tile is cut */
|
|
2
|
-
import type { Priority } from '../basemap.worker.ts';
|
|
3
|
-
import { type Renderer } from './tiles.ts';
|
|
4
|
-
/**
|
|
5
|
-
* Lamps along the lines of the renderer's layers in a tile, `spacing` metres apart along each street, every other
|
|
6
|
-
* one on its other side, as far from its middle as its class says (`SIDE_METRES`): longitude, latitude, scale, heading
|
|
7
|
-
* (degrees, facing the street) and rank (in [0, 1): the page keeps the lowest far from the view) of each, as things
|
|
8
|
-
* placed (`PLACED_NUMBERS`, the kind 0); past `maxLamps`, thinned evenly. A street in several layers has its lamps once
|
|
9
|
-
*/
|
|
10
|
-
export declare const lamps: (r: Renderer, z: number, x: number, y: number, id: number, spacing: number, maxLamps: number, priority?: Priority) => Promise<Float64Array<ArrayBufferLike> | undefined>;
|