isard 1.8.0 → 1.10.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 +82 -1
- package/README.md +9 -4
- 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/requests.d.ts +8 -1
- package/dist/basemap/vectortiles/requests.js +32 -4
- package/dist/basemap/vectortiles/requests.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 +9 -3
- package/dist/basemap/vectortiles/vectors.js +26 -2
- package/dist/basemap/vectortiles/vectors.js.map +1 -1
- package/dist/basemap/vectortiles.d.ts +8 -6
- package/dist/basemap/vectortiles.js +7 -4
- 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/bind/layers.js +3 -0
- package/dist/bind/layers.js.map +1 -1
- 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/data/tileset.d.ts +21 -0
- package/dist/data/tileset.js +101 -0
- package/dist/data/tileset.js.map +1 -0
- 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 +3 -3
- package/dist/engine-loader.js +12 -5
- 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 +20 -0
- package/dist/layers/tiles3d.js +69 -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.d.ts +3 -0
- package/dist/layers/vectors.js +4 -0
- 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 +25 -58
- package/dist/map.js +61 -53
- 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/VectorGeometry.d.ts +4 -0
- package/dist/react/VectorGeometry.js +6 -3
- package/dist/react/VectorGeometry.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 +16 -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.d.ts +4 -0
- package/dist/ui/interaction.js +59 -7
- 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.d.ts +18 -1
- package/dist/wasm/isard.js +28 -2
- package/dist/wasm/isard_core.d.ts +13 -1
- package/dist/wasm/isard_core.js +20 -2
- package/dist/workers/basemap/geometry.d.ts +9 -19
- package/dist/workers/{basemap.worker.d.ts → basemap/protocol.d.ts} +32 -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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basemap-layers.js","sourceRoot":"","sources":["../../src/map/basemap-layers.ts"],"names":[],"mappings":"AAAA;mBACmB;AAEnB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAOzE,MAAM,QAAQ,GAAG,CAAC,IAAiB,EAAwC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;AACnH,MAAM,QAAQ,GAAG,CAAC,IAAiB,EAAiC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAErG,gEAAgE;AAChE,MAAM,OAAO,aAAa;IACP,GAAG,CAAS;IACZ,KAAK,CAAa;IACnC,0CAA0C;IACzB,SAAS,CAAe;IACzC,iDAAiD;IAChC,QAAQ,CAAqB;IACtC,OAAO,CAA0B;IACjC,SAAS,CAA0B;IAC3C,oEAAoE;IAC5D,MAAM,CAA0E;IAExF,uCAAuC;IACvC,YAAY,GAAW,EAAE,KAAiB,EAAE,SAAuB,EAAE,QAA4B;QAC/F,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,KAAK,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,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;QAClD,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC5E,CAAC;IACH,CAAC;IAED,yGAAyG;IACzG,YAAY,CAAC,OAAe;QAC1B,IAAI,CAAC,SAAS,GAAG,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,GAAG,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACzF,IAAI,IAAI,CAAC,SAAS;YAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxD,IAAI,IAAI,CAAC,OAAO;YAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACtD,CAAC;IAED,8DAA8D;IAC9D,OAAO;QACL,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;IAC9B,CAAC;CACF","sourcesContent":["/** The layers of a map's basemap: a raster or vector basemap (its labels kept on top) and the IGN hillshade, under the\n * other layers. */\n\nimport { BASEMAPS, HILLSHADE } from '../basemap/basemaps.ts';\nimport type { LabelCandidate } from '../basemap/vectorstyle.ts';\nimport { VECTOR_BASEMAPS, VectorTiles } from '../basemap/vectortiles.ts';\nimport type { RasterLayer } from '../layers/raster.ts';\nimport type { SymbolLayer } from '../layers/symbols.ts';\nimport type { GeoMap } from '../map.ts';\nimport type { BasemapName } from '../types.ts';\nimport type { LayerStack } from './layer-stack.ts';\n\nconst isVector = (name: BasemapName): name is keyof typeof VECTOR_BASEMAPS => Object.hasOwn(VECTOR_BASEMAPS, name);\nconst isRaster = (name: BasemapName): name is keyof typeof BASEMAPS => Object.hasOwn(BASEMAPS, name);\n\n/** The basemap and the hillshade of a map, replaced together */\nexport class BasemapLayers {\n private readonly map: GeoMap;\n private readonly stack: LayerStack;\n /** URL of the vector basemaps' workers */\n private readonly workerUrl: string | URL;\n /** Texture size of the vector basemap's tiles */\n private readonly tileSize: number | undefined;\n private basemap: RasterLayer | undefined;\n private hillshade: RasterLayer | undefined;\n /** The vector basemap, if any: its tiles' workers and its labels */\n private vector: { tiles: VectorTiles; labels: SymbolLayer<LabelCandidate> } | undefined;\n\n /** `stack`: the map's drawing order */\n constructor(map: GeoMap, stack: LayerStack, workerUrl: string | URL, tileSize: number | undefined) {\n this.map = map;\n this.stack = stack;\n this.workerUrl = workerUrl;\n this.tileSize = tileSize;\n }\n\n /** Removes the basemap and the hillshade, then adds the basemap `name` (none for 'none') */\n replace(name: BasemapName): void {\n const { map } = this;\n\n if (this.basemap && map.hasLayer(this.basemap)) this.basemap.remove();\n if (this.hillshade && map.hasLayer(this.hillshade)) this.hillshade.remove();\n // Its raster and labels go with it\n this.destroy();\n this.vector = undefined;\n\n if (isVector(name)) {\n const tiles = new VectorTiles(map, {\n style: VECTOR_BASEMAPS[name],\n ...(this.workerUrl ? { workerUrl: this.workerUrl } : {}),\n });\n\n this.basemap = tiles.raster(this.tileSize ? { size: this.tileSize } : {});\n this.vector = { tiles, labels: tiles.labels() };\n } else {\n this.basemap = isRaster(name) ? map.addRaster(BASEMAPS[name]) : undefined;\n }\n }\n\n /** Adds the hillshade at `opacity` (0: none), then puts it and the basemap under all the other layers */\n addHillshade(opacity: number): void {\n this.hillshade = opacity > 0 ? this.map.addRaster({ ...HILLSHADE, opacity }) : undefined;\n if (this.hillshade) this.stack.toBottom(this.hillshade);\n if (this.basemap) this.stack.toBottom(this.basemap);\n }\n\n /** Stops the vector basemap's tiles (their layers removed) */\n destroy(): void {\n this.vector?.tiles.remove();\n }\n}\n"]}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* context loss or once the engine with 3D Tiles is loaded), with the page's request headers.
|
|
4
4
|
*/
|
|
5
5
|
import type { PngEncoding } from '../basemap/terrain.ts';
|
|
6
|
-
import { type HeaderRules } from '../engine/requests.ts';
|
|
7
6
|
import { type Settings, type TerrainLoader } from '../settings.ts';
|
|
8
7
|
import type { GeoMapOptions } from '../types.ts';
|
|
8
|
+
import { type HeaderRules } from '../util/requests.ts';
|
|
9
9
|
import type { Engine } from '../wasm/isard.js';
|
|
10
10
|
/** The settings of a map from its options; `earth`: the map is of the Earth */
|
|
11
11
|
export declare const mapSettings: (options: GeoMapOptions, earth: boolean, terrainLoader: (url: string, encoding: PngEncoding, floor?: number) => TerrainLoader) => Settings;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* context loss or once the engine with 3D Tiles is loaded), with the page's request headers.
|
|
4
4
|
*/
|
|
5
5
|
import { SEA } from "../basemap/basemaps.js";
|
|
6
|
-
import { headerRules } from "../engine/requests.js";
|
|
7
6
|
import { atmosphereSettings, bodySettings, haloSettings, rgb, terrainSettings, } from "../settings.js";
|
|
7
|
+
import { headerRules } from "../util/requests.js";
|
|
8
8
|
/** The settings of a map from its options; `earth`: the map is of the Earth */
|
|
9
9
|
export const mapSettings = (options, earth, terrainLoader) => {
|
|
10
10
|
const body = bodySettings(options.body);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-settings.js","sourceRoot":"","sources":["../../src/map/engine-settings.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAE7C,OAAO,
|
|
1
|
+
{"version":3,"file":"engine-settings.js","sourceRoot":"","sources":["../../src/map/engine-settings.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAE7C,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,YAAY,EACZ,GAAG,EAGH,e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,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,EACrE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,CAC/D,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n * The settings of the map's engine: made from the options, given to each new engine (at creation, and again after a\n * context loss or once the engine with 3D Tiles is loaded), with the page's request headers.\n */\n\nimport { SEA } from '../basemap/basemaps.ts';\nimport type { PngEncoding } from '../basemap/terrain.ts';\nimport {\n atmosphereSettings,\n bodySettings,\n haloSettings,\n rgb,\n type Settings,\n type TerrainLoader,\n terrainSettings,\n} from '../settings.ts';\nimport type { GeoMapOptions } from '../types.ts';\nimport { type HeaderRules, headerRules } from '../util/requests.ts';\nimport type { Engine } from '../wasm/isard.js';\n\n/** The settings of a map from its options; `earth`: the map is of the Earth */\nexport const mapSettings = (\n options: GeoMapOptions,\n earth: boolean,\n terrainLoader: (url: string, encoding: PngEncoding, floor?: number) => TerrainLoader,\n): Settings => {\n const body = bodySettings(options.body);\n\n return {\n body,\n zoomRange: [options.minZoom ?? 0, options.maxZoom ?? 22],\n maxPitch: options.maxPitch ?? 70,\n globe: (options.projection ?? 'globe') === 'globe',\n sky: options.sky ?? true,\n atmosphere: atmosphereSettings(options.atmosphere),\n terrain: terrainSettings(options.terrain, options.body, body.radius, terrainLoader),\n loading: options.loading ?? 'immediate',\n background: rgb(options.background ?? (earth ? '#f2f2f0' : '#000000')),\n globeColor: earth ? SEA['osm-positron'] : rgb(body.color),\n };\n};\n\n/** Gives a new engine the settings and the page's request headers */\nexport const applySettings = (engine: Engine, settings: Settings): void => {\n // The body first: the layers' shaders may take its size\n const { radius, flattening, atmosphere: air, relief } = settings.body;\n\n engine.setBody(radius, flattening, haloSettings(air), ...relief);\n sendHeaders(engine, headerRules());\n\n const { zoomRange, maxPitch, globe, sky, atmosphere, terrain, loading, background, globeColor } = settings;\n\n engine.setZoomRange(...zoomRange);\n engine.setMaxPitch(maxPitch);\n engine.setGlobe(globe);\n engine.setSky(sky);\n engine.setAtmosphere(atmosphere);\n engine.setTerrain(terrain?.url, terrain?.exaggeration ?? 1, terrain?.maxZoom, terrain?.geoid, terrain?.loader);\n engine.setImmediateLoading(loading === 'immediate');\n engine.setBackground(...background);\n engine.setGlobeColor(...globeColor);\n};\n\n/** The page's request headers to an engine (its own requests: raster tiles, tilesets, point clouds) */\nexport const sendHeaders = (engine: Engine, rules: HeaderRules): void => {\n engine.setRequestHeaders(\n rules.map(([prefix]) => prefix),\n Uint32Array.from(rules, ([, headers]) => Object.keys(headers).length),\n rules.flatMap(([, headers]) => Object.entries(headers).flat()),\n );\n};\n"]}
|
package/dist/map/engines.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engines.js","sourceRoot":"","sources":["../../src/map/engines.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAEL,SAAS,EACT,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAI7B,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAQrD,iFAAiF;AACjF,MAAM,OAAO,UAAU;IACrB,iHAAiH;IACzG,WAAW,CAAc;IACjC,oGAAoG;IAC5F,MAAM,CAAiC;IAC/C,UAAU,CAA4B;IAC9B,MAAM,CAAyB;IACtB,OAAO,CAAuB;IAC/C,wDAAwD;IACvC,IAAI,CAAgB;IAErC,uFAAuF;IACvF,YACE,WAAwB,EACxB,MAAsC,EACtC,OAA6B,EAC7B,IAAmB;QAEnB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB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I,IAAI,CAAC,IAAI,EAAE;gBAAE,OAAO;YACxB,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;YAC1B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;YACrB,MAAM,EAAE,CAAC;QACX,CAAC,EACD,CAAC,KAAc,EAAE,EAAE;YACjB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;YAC5B,IAAI,IAAI,CAAC,IAAI,EAAE;gBAAE,OAAO;YACxB,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CACF,CAAC;IACJ,CAAC;IAED,mHAAmH;IACnH,OAAO;QACL,iBAAiB,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzF,CAAC;IAED,iCAAiC;IACjC,OAAO;QACL,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;IACzB,CAAC;CACF","sourcesContent":["/**\n * Which engine a map runs: the core one, or the one with 3D Tiles, from the start or loaded once a layer needs it\n * (the map is rebuilt on it then); and the workers decoding its 3D Tiles, started with the first engine that has them.\n */\n\nimport type { TileLoader } from '../
|
|
1
|
+
{"version":3,"file":"engines.js","sourceRoot":"","sources":["../../src/map/engines.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAEL,SAAS,EACT,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAI7B,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAQrD,iFAAiF;AACjF,MAAM,OAAO,UAAU;IACrB,iHAAiH;IACzG,WAAW,CAAc;IACjC,oGAAoG;IAC5F,MAAM,CAAiC;IAC/C,UAAU,CAA4B;IAC9B,MAAM,CAAyB;IACtB,OAAO,CAAuB;IAC/C,wDAAwD;IACvC,IAAI,CAAgB;IAErC,uFAAuF;IACv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AO,CAAC,MAAkB,EAAE,MAAgC;QAC1D,IAAI,CAAC,UAAU,KAAK,mBAAmB,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAC3E,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE;YACrB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;YAC5B,IAAI,IAAI,CAAC,IAAI,EAAE;gBAAE,OAAO;YACxB,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;YAC1B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;YACrB,MAAM,EAAE,CAAC;QACX,CAAC,EACD,CAAC,KAAc,EAAE,EAAE;YACjB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;YAC5B,IAAI,IAAI,CAAC,IAAI,EAAE;gBAAE,OAAO;YACxB,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CACF,CAAC;IACJ,CAAC;IAED,mHAAmH;IACnH,OAAO;QACL,iBAAiB,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzF,CAAC;IAED,iCAAiC;IACjC,OAAO;QACL,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;IACzB,CAAC;CACF","sourcesContent":["/**\n * Which engine a map runs: the core one, or the one with 3D Tiles, from the start or loaded once a layer needs it\n * (the map is rebuilt on it then); and the workers decoding its 3D Tiles, started with the first engine that has them.\n */\n\nimport type { TileLoader } from '../decoding/loader.ts';\nimport {\n type EngineClass,\n engineUrl,\n loadFullEngineLater,\n preloadFullEngine,\n startTileLoader,\n} from '../engine-loader.ts';\nimport type { Settings } from '../settings.ts';\nimport type { GeoMapOptions } from '../types.ts';\nimport type { Engine } from '../wasm/isard.js';\nimport { applySettings } from './engine-settings.ts';\n\n/** What loading the engine with 3D Tiles and its workers needs */\nexport type Tiles3dEngineOptions = Pick<\n GeoMapOptions,\n 'wasmUrl' | 'workers' | 'workerUrl' | 'decoders' | 'pointsWasmUrl' | 'assetsUrl'\n>;\n\n/** The engine class of a map, and the engine with 3D Tiles loaded when needed */\nexport class MapEngines {\n /** The class of the engine: without 3D Tiles until a 3D Tiles layer is added, unless asked for from the start */\n private engineClass: EngineClass;\n /** The module of the engine with 3D Tiles once it runs the map (the decoding workers run it too) */\n private module: WebAssembly.Module | undefined;\n #upgrading: Promise<void> | undefined;\n private loader: TileLoader | undefined;\n private readonly options: Tiles3dEngineOptions;\n /** The map is destroyed: a loaded engine is not used */\n private readonly gone: () => boolean;\n\n /** `module`: the module of the engine with 3D Tiles if `engineClass` is that engine */\n constructor(\n engineClass: EngineClass,\n module: WebAssembly.Module | undefined,\n options: Tiles3dEngineOptions,\n gone: () => boolean,\n ) {\n this.engineClass = engineClass;\n this.module = module;\n this.options = { ...options };\n this.gone = gone;\n }\n\n /** The engine with 3D Tiles runs the map */\n get tiles3d(): boolean {\n return this.module !== undefined;\n }\n\n /** The engine with 3D Tiles is loading, for the 3D Tiles layers added on the core engine */\n get upgrading(): Promise<void> | undefined {\n return this.#upgrading;\n }\n\n /** A new engine drawing on `canvas`, with the settings and the decoding workers of 3D Tiles if it has them */\n create(canvas: HTMLCanvasElement, redraw: () => void, settings: Settings): Engine {\n const engine = new this.engineClass(canvas, redraw);\n\n applySettings(engine, settings);\n // The decoding workers of 3D Tiles, with the engine that has them (they run its module) and unless turned off\n this.loader ??= this.module && startTileLoader(this.module, this.options, engine);\n if (this.loader) engine.setTileLoader(this.loader);\n\n return engine;\n }\n\n /** Height of the geoid above the ellipsoid at a position, in metres */\n geoidHeight(lon: number, lat: number): number {\n return this.engineClass.geoidHeight(lon, lat);\n }\n\n /** The matrix of a custom layer's model at a position */\n customMatrix(lon: number, lat: number, altitude: number): Float32Array | undefined {\n return this.engineClass.customMatrix(lon, lat, altitude);\n }\n\n /** Loads the engine with 3D Tiles, once at a time: `loaded` once it is the map's class, `failed` with the error;\n * neither if the map is gone by then */\n upgrade(loaded: () => void, failed: (error: unknown) => void): void {\n this.#upgrading ??= loadFullEngineLater(engineUrl('full', this.options)).then(\n ({ module, Engine }) => {\n this.#upgrading = undefined;\n if (this.gone()) return;\n this.engineClass = Engine;\n this.module = module;\n loaded();\n },\n (error: unknown) => {\n this.#upgrading = undefined;\n if (this.gone()) return;\n failed(error);\n },\n );\n }\n\n /** Downloads and compiles the engine with 3D Tiles without running it, unless the map is gone or has it by then */\n preload(): void {\n preloadFullEngine(engineUrl('full', this.options), () => !this.gone() && !this.module);\n }\n\n /** Stops the decoding workers */\n destroy(): void {\n this.loader?.destroy();\n }\n}\n"]}
|
package/dist/map/layer-spec.d.ts
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import type { ExtrusionOptions } from '../layers/extrusions.ts';
|
|
3
3
|
import type { CircleOptions, FillOptions, LineOptions } from '../layers/features.ts';
|
|
4
4
|
import type { FlowOptions } from '../layers/flow.ts';
|
|
5
|
-
import type { GroundOptions
|
|
5
|
+
import type { GroundOptions } from '../layers/ground.ts';
|
|
6
|
+
import type { Layer } from '../layers/layers.ts';
|
|
7
|
+
import type { ModelOptions } from '../layers/models.ts';
|
|
6
8
|
import type { PointCloudOptions } from '../layers/pointclouds.ts';
|
|
7
9
|
import type { SymbolOptions } from '../layers/symbols.ts';
|
|
8
10
|
import type { TreeOptions } from '../layers/trees.ts';
|
|
@@ -21,25 +23,17 @@ export type LayerSpec<P = Record<string, unknown>> = ({
|
|
|
21
23
|
type: 'extrusions';
|
|
22
24
|
} & ExtrusionOptions<P>) | ({
|
|
23
25
|
type: 'raster';
|
|
24
|
-
} & RasterOptions
|
|
25
|
-
before?: Layer;
|
|
26
|
-
}) | ({
|
|
26
|
+
} & RasterOptions) | ({
|
|
27
27
|
type: 'ground';
|
|
28
|
-
} & GroundOptions
|
|
29
|
-
before?: Layer;
|
|
30
|
-
}) | ({
|
|
28
|
+
} & GroundOptions) | ({
|
|
31
29
|
type: 'network';
|
|
32
30
|
} & NetworkOptions) | ({
|
|
33
31
|
type: 'tiles3d';
|
|
34
32
|
} & Tiles3dOptions) | ({
|
|
35
33
|
type: 'pointcloud';
|
|
36
|
-
} & PointCloudOptions
|
|
37
|
-
before?: Layer;
|
|
38
|
-
}) | ({
|
|
34
|
+
} & PointCloudOptions) | ({
|
|
39
35
|
type: 'models';
|
|
40
|
-
} & ModelOptions
|
|
41
|
-
before?: Layer;
|
|
42
|
-
}) | ({
|
|
36
|
+
} & ModelOptions) | ({
|
|
43
37
|
type: 'trees';
|
|
44
38
|
} & TreeOptions<P>) | ({
|
|
45
39
|
type: 'flow';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layer-spec.js","sourceRoot":"","sources":["../../src/map/layer-spec.ts"],"names":[],"mappings":"AAAA,oHAAoH;
|
|
1
|
+
{"version":3,"file":"layer-spec.js","sourceRoot":"","sources":["../../src/map/layer-spec.ts"],"names":[],"mappings":"AAAA,oHAAoH;AA8BpH,oGAAoG;AACpG,MAAM,CAAC,MAAM,OAAO,GAAG,CAA8B,GAAW,EAAE,IAAkB,EAAS,EAAE;IAC7F,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,OAAO;YACV,OAAO,GAAG,CAAC,QAAQ,CAAI,IAAI,CAAC,CAAC;QAC/B,KAAK,SAAS;YACZ,OAAO,GAAG,CAAC,UAAU,CAAI,IAAI,CAAC,CAAC;QACjC,KAAK,OAAO;YACV,OAAO,GAAG,CAAC,QAAQ,CAAI,IAAI,CAAC,CAAC;QAC/B,KAAK,SAAS;YACZ,OAAO,GAAG,CAAC,UAAU,CAAI,IAAI,CAAC,CAAC;QACjC,KAAK,YAAY;YACf,OAAO,GAAG,CAAC,aAAa,CAAI,IAAI,CAAC,CAAC;QACpC,KAAK,QAAQ;YACX,OAAO,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC7B,KAAK,QAAQ;YACX,OAAO,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC7B,KAAK,SAAS;YACZ,OAAO,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC9B,KAAK,SAAS;YACZ,OAAO,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC9B,KAAK,YAAY;YACf,OAAO,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QACjC,KAAK,QAAQ;YACX,OAAO,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC7B,KAAK,OAAO;YACV,OAAO,GAAG,CAAC,QAAQ,CAAI,IAAI,CAAC,CAAC;QAC/B,KAAK,MAAM;YACT,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC3B,OAAO,CAAC,CAAC,CAAC;YACR,sFAAsF;YACtF,MAAM,EAAE,IAAI,EAAE,GAAuB,IAAI,CAAC;YAE1C,MAAM,IAAI,KAAK,CAAC,2BAA2B,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;AACH,CAAC,CAAC","sourcesContent":["/** A layer described by its type and options, as an application's configuration gives it, and the map adding it. */\n\nimport type { ExtrusionOptions } from '../layers/extrusions.ts';\nimport type { CircleOptions, FillOptions, LineOptions } from '../layers/features.ts';\nimport type { FlowOptions } from '../layers/flow.ts';\nimport type { GroundOptions } from '../layers/ground.ts';\nimport type { Layer } from '../layers/layers.ts';\nimport type { ModelOptions } from '../layers/models.ts';\nimport type { PointCloudOptions } from '../layers/pointclouds.ts';\nimport type { SymbolOptions } from '../layers/symbols.ts';\nimport type { TreeOptions } from '../layers/trees.ts';\nimport type { GeoMap } from '../map.ts';\nimport type { NetworkOptions, RasterOptions, Tiles3dOptions } from '../types.ts';\n\n/** A layer by its type and the options of its `add…` method (`GeoMap.add`) */\nexport type LayerSpec<P = Record<string, unknown>> =\n | ({ type: 'lines' } & LineOptions<P>)\n | ({ type: 'circles' } & CircleOptions<P>)\n | ({ type: 'fills' } & FillOptions<P>)\n | ({ type: 'symbols' } & SymbolOptions<P>)\n | ({ type: 'extrusions' } & ExtrusionOptions<P>)\n | ({ type: 'raster' } & RasterOptions)\n | ({ type: 'ground' } & GroundOptions)\n | ({ type: 'network' } & NetworkOptions)\n | ({ type: 'tiles3d' } & Tiles3dOptions)\n | ({ type: 'pointcloud' } & PointCloudOptions)\n | ({ type: 'models' } & ModelOptions)\n | ({ type: 'trees' } & TreeOptions<P>)\n | ({ type: 'flow' } & FlowOptions);\n\n/** Adds the layer a description gives with the `add…` method of its type; an unknown type throws */\nexport const addSpec = <P = Record<string, unknown>>(map: GeoMap, spec: LayerSpec<P>): Layer => {\n switch (spec.type) {\n case 'lines':\n return map.addLines<P>(spec);\n case 'circles':\n return map.addCircles<P>(spec);\n case 'fills':\n return map.addFills<P>(spec);\n case 'symbols':\n return map.addSymbols<P>(spec);\n case 'extrusions':\n return map.addExtrusions<P>(spec);\n case 'raster':\n return map.addRaster(spec);\n case 'ground':\n return map.addGround(spec);\n case 'network':\n return map.addNetwork(spec);\n case 'tiles3d':\n return map.addTiles3d(spec);\n case 'pointcloud':\n return map.addPointCloud(spec);\n case 'models':\n return map.addModels(spec);\n case 'trees':\n return map.addTrees<P>(spec);\n case 'flow':\n return map.addFlow(spec);\n default: {\n // Only from an application's configuration, untyped: the cases above cover every type\n const { type }: { type?: unknown } = spec;\n\n throw new Error(`isard: no layer of type ${String(type)}`);\n }\n }\n};\n"]}
|
package/dist/map/workers.js
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { encodedTerrainLoader } from "../basemap/terrain.js";
|
|
6
6
|
import { BasemapWorkers, defaultWorkerCount } from "../basemap/workerpool.js";
|
|
7
|
-
import { withHeaders } from "../engine/requests.js";
|
|
8
7
|
import { decodeGrids } from "../grid-module.js";
|
|
9
8
|
import { gridOf } from "../grids.js";
|
|
9
|
+
import { fetchOk } from "../util/fetch.js";
|
|
10
|
+
import { withHeaders } from "../util/requests.js";
|
|
10
11
|
/** The workers of a map, created on first use */
|
|
11
12
|
export class MapWorkers {
|
|
12
13
|
/** URL of the workers' script */
|
|
@@ -73,9 +74,7 @@ export class MapWorkers {
|
|
|
73
74
|
// Against the page: the workers fetch it, and a relative URL would be theirs
|
|
74
75
|
const absolute = url && typeof document !== 'undefined' ? new URL(url, document.baseURI).href : url;
|
|
75
76
|
const fetchFile = async (at) => {
|
|
76
|
-
const response = await
|
|
77
|
-
if (!response.ok)
|
|
78
|
-
throw new Error(`isard: ${at}: ${response.status}`);
|
|
77
|
+
const response = await fetchOk(at, withHeaders(at, signal ? { signal } : {}));
|
|
79
78
|
return response.arrayBuffer();
|
|
80
79
|
};
|
|
81
80
|
const inPage = async () => decodeGrids(new Uint8Array(bytes ?? (await fetchFile(absolute ?? ''))), module);
|
package/dist/map/workers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workers.js","sourceRoot":"","sources":["../../src/map/workers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,oBAAoB,EAAwC,MAAM,uBAAuB,CAAC;AACnG,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAa,MAAM,EAAE,MAAM,aAAa,CAAC;AAIhD,iDAAiD;AACjD,MAAM,OAAO,UAAU;IACrB,iCAAiC;IACxB,GAAG,CAAe;IACV,OAAO,CAA2B;IACnD,gEAAgE;IAC/C,IAAI,CAAgB;IACrC,8DAA8D;IAC7C,KAAK,CAAS;IAC/B,4CAA4C;IACpC,MAAM,CAA6B;IAC3C;mDAC+C;IAC9B,cAAc,GAAG,IAAI,GAAG,EAAyB,CAAC;IAEnE,4EAA4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I,CAAC,KAAK,CAAC;iBACxG,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;gBACxB,0GAA0G;gBAC1G,qCAAqC;gBACrC,IAAI,MAAM,EAAE,OAAO,IAAI,KAAK,EAAE,UAAU,KAAK,CAAC;oBAAE,MAAM,KAAK,CAAC;gBAE5D,OAAO,MAAM,EAAE,CAAC;YAClB,CAAC,CAAC,CAAC;QACP,CAAC,CAAC;QACF,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;QAEvC,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,YAAY,EAAE,CAAC,CAAC,CAAC;IACzE,CAAC;IAED;;;OAGG;IACK,YAAY;QAClB,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE7B,IAAI,IAAI,CAAC,IAAI,EAAE,IAAI,OAAO,KAAK,KAAK,IAAI,CAAC,OAAO,KAAK,SAAS,IAAI,OAAO,IAAI,CAAC,CAAC;YAAE,OAAO,SAAS,CAAC;QAClG,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,eAAe,KAAK,WAAW;YAAE,OAAO,SAAS,CAAC;QAE9F,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC;IAC1B,CAAC;CACF","sourcesContent":["/**\n * A map's workers: the pool drawing vector tiles, shared by the map's `VectorTiles`, which also decodes the relief and\n * reprojects rasters off the page; and the loaders of the relief, one per tile source.\n */\n\nimport type { RemoteReprojection } from '../basemap/grid.ts';\nimport { encodedTerrainLoader, type PngEncoding, type RemoteHeights } from '../basemap/terrain.ts';\nimport { BasemapWorkers, defaultWorkerCount } from '../basemap/workerpool.ts';\nimport { withHeaders } from '../engine/requests.ts';\nimport { decodeGrids } from '../grid-module.ts';\nimport { type Grid, gridOf } from '../grids.ts';\nimport type { TerrainLoader } from '../settings.ts';\nimport type { GeoMapOptions } from '../types.ts';\n\n/** The workers of a map, created on first use */\nexport class MapWorkers {\n /** URL of the workers' script */\n readonly url: string | URL;\n private readonly workers: GeoMapOptions['workers'];\n /** The map is destroyed: nothing more is sent to the workers */\n private readonly gone: () => boolean;\n /** Whose requests the workers' answer (cancelled together) */\n private readonly owner: object;\n /** The shared pool, created on first use */\n private shared: BasemapWorkers | undefined;\n /** The loaders of the relief by encoding, URL and floor: the same loader for the same tiles (the engine keeps its\n * tiles when only the exaggeration changes) */\n private readonly terrainLoaders = new Map<string, TerrainLoader>();\n\n /** `workers`: the map's option (false or 0, no worker); `owner`: the map */\n constructor(url: string | URL, workers: GeoMapOptions['workers'], gone: () => boolean, owner: object) {\n this.url = url;\n this.workers = workers;\n this.gone = gone;\n this.owner = owner;\n }\n\n /**\n * The workers for a `VectorTiles`: the shared pool, or a pool of its own (`own`, to stop with it) when it asks for\n * another count or URL\n */\n pool(count?: number, url?: string | URL): { pool: BasemapWorkers; own: boolean } {\n // Workers started after the map went would never be stopped\n if (this.gone()) throw new Error('isard: the map was destroyed');\n\n const shared = defaultWorkerCount();\n const workers = Math.max(1, count ?? shared);\n const workerUrl = url ?? this.url;\n\n if (workers === shared && String(workerUrl) === String(this.url)) {\n this.shared ??= new BasemapWorkers(shared, this.url);\n\n return { pool: this.shared, own: false };\n }\n\n return { pool: new BasemapWorkers(workers, workerUrl), own: true };\n }\n\n /** Stops the shared pool */\n terminate(): void {\n this.shared?.terminate();\n this.shared = undefined;\n }\n\n /** Rasters reprojected by the workers (in the page without them) */\n readonly remoteReprojection: RemoteReprojection = (job, tile, signal) =>\n this.decodingPool()?.reproject(job, tile, signal, this.owner);\n\n /** The loader of the relief tiles of `url` in a PNG encoding (one per URL, encoding and floor) */\n readonly terrainLoader = (url: string, encoding: PngEncoding, floor?: number): TerrainLoader => {\n const key = `${encoding} ${floor ?? ''} ${url}`;\n const cached = this.terrainLoaders.get(key);\n\n if (cached) return cached;\n\n const loader = encodedTerrainLoader(url, encoding, floor, this.remoteHeights);\n\n this.terrainLoaders.set(key, loader);\n\n return loader;\n };\n\n private readonly remoteHeights: RemoteHeights = (url, encoding, floor, tile, signal) =>\n this.decodingPool()?.heights(url, encoding, floor, tile, signal, this.owner);\n\n /** A GRIB2 or NetCDF file read into grids by the grid module (`module`), in a worker (in the page without them, or if\n * the worker fails) */\n async readGrids(\n source: string | URL | ArrayBuffer | Uint8Array,\n module: string,\n signal?: AbortSignal,\n ): Promise<Grid[]> {\n const pool = this.decodingPool();\n const url = typeof source === 'string' || source instanceof URL ? String(source) : undefined;\n const copy = source instanceof Uint8Array ? source.slice().buffer : undefined;\n const bytes = copy ?? (source instanceof ArrayBuffer ? source : undefined);\n // Against the page: the workers fetch it, and a relative URL would be theirs\n const absolute = url && typeof document !== 'undefined' ? new URL(url, document.baseURI).href : url;\n const fetchFile = async (at: string) => {\n const response = await fetch(at, withHeaders(at, signal ? { signal } : {}));\n\n if (!response.ok) throw new Error(`isard: ${at}: ${response.status}`);\n\n return response.arrayBuffer();\n };\n const inPage = async () => decodeGrids(new Uint8Array(bytes ?? (await fetchFile(absolute ?? ''))), module);\n const read = async () => {\n if (!pool) return inPage();\n\n return pool\n .grids(absolute ? { url: absolute } : { bytes: bytes ?? new ArrayBuffer(0) }, module, signal, this.owner)\n .catch((error: unknown) => {\n // A worker's failure (the module not fetched, a worker of an older build): read again in the page, unless\n // cancelled or its bytes handed over\n if (signal?.aborted || bytes?.byteLength === 0) throw error;\n\n return inPage();\n });\n };\n const { grids, values } = await read();\n\n return grids.map((g, i) => gridOf(g, values[i] ?? new Float32Array()));\n }\n\n /**\n * The workers decoding the relief and reprojecting rasters: the shared pool, unless the map has no workers\n * (`workers: false` or 0, or none in this browser): that is done in the page then\n */\n private decodingPool(): BasemapWorkers | undefined {\n const workers = this.workers;\n\n if (this.gone() || workers === false || (workers !== undefined && workers <= 0)) return undefined;\n if (typeof Worker === 'undefined' || typeof OffscreenCanvas === 'undefined') return undefined;\n\n return this.pool().pool;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"workers.js","sourceRoot":"","sources":["../../src/map/workers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,oBAAoB,EAAwC,MAAM,uBAAuB,CAAC;AACnG,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAa,MAAM,EAAE,MAAM,aAAa,CAAC;AAGhD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,iDAAiD;AACjD,MAAM,OAAO,UAAU;IACrB,iCAAiC;IACxB,GAAG,CAAe;IACV,OAAO,CAA2B;IACnD,gEAAgE;IAC/C,IAAI,CAAgB;IACrC,8DAA8D;IAC7C,KAAK,CAAS;IAC/B,4CAA4C;IACpC,MAAM,CAA6B;IAC3C;mDAC+C;IAC9B,cAAc,GAAG,IAAI,GAAG,EAAyB,CAAC;IAEnE,4EAA4E;IAC5E,YAAY,GAAiB,EAAE,OAAiC,EAAE,IAAmB,EAAE,KAAa;QAClG,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;;OAGG;IACH,IAAI,CAAC,KAAc,EAAE,GAAkB;QACrC,4DAA4D;QAC5D,IAAI,IAAI,CAAC,IAAI,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAEjE,MAAM,MAAM,GAAG,kBAAkB,EAAE,CAAC;QACpC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,IAAI,MAA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AK,KAAK,IAAI,CAAC,OAAO,KAAK,SAAS,IAAI,OAAO,IAAI,CAAC,CAAC;YAAE,OAAO,SAAS,CAAC;QAClG,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,eAAe,KAAK,WAAW;YAAE,OAAO,SAAS,CAAC;QAE9F,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC;IAC1B,CAAC;CACF","sourcesContent":["/**\n * A map's workers: the pool drawing vector tiles, shared by the map's `VectorTiles`, which also decodes the relief and\n * reprojects rasters off the page; and the loaders of the relief, one per tile source.\n */\n\nimport type { RemoteReprojection } from '../basemap/grid.ts';\nimport { encodedTerrainLoader, type PngEncoding, type RemoteHeights } from '../basemap/terrain.ts';\nimport { BasemapWorkers, defaultWorkerCount } from '../basemap/workerpool.ts';\nimport { decodeGrids } from '../grid-module.ts';\nimport { type Grid, gridOf } from '../grids.ts';\nimport type { TerrainLoader } from '../settings.ts';\nimport type { GeoMapOptions } from '../types.ts';\nimport { fetchOk } from '../util/fetch.ts';\nimport { withHeaders } from '../util/requests.ts';\n\n/** The workers of a map, created on first use */\nexport class MapWorkers {\n /** URL of the workers' script */\n readonly url: string | URL;\n private readonly workers: GeoMapOptions['workers'];\n /** The map is destroyed: nothing more is sent to the workers */\n private readonly gone: () => boolean;\n /** Whose requests the workers' answer (cancelled together) */\n private readonly owner: object;\n /** The shared pool, created on first use */\n private shared: BasemapWorkers | undefined;\n /** The loaders of the relief by encoding, URL and floor: the same loader for the same tiles (the engine keeps its\n * tiles when only the exaggeration changes) */\n private readonly terrainLoaders = new Map<string, TerrainLoader>();\n\n /** `workers`: the map's option (false or 0, no worker); `owner`: the map */\n constructor(url: string | URL, workers: GeoMapOptions['workers'], gone: () => boolean, owner: object) {\n this.url = url;\n this.workers = workers;\n this.gone = gone;\n this.owner = owner;\n }\n\n /**\n * The workers for a `VectorTiles`: the shared pool, or a pool of its own (`own`, to stop with it) when it asks for\n * another count or URL\n */\n pool(count?: number, url?: string | URL): { pool: BasemapWorkers; own: boolean } {\n // Workers started after the map went would never be stopped\n if (this.gone()) throw new Error('isard: the map was destroyed');\n\n const shared = defaultWorkerCount();\n const workers = Math.max(1, count ?? shared);\n const workerUrl = url ?? this.url;\n\n if (workers === shared && String(workerUrl) === String(this.url)) {\n this.shared ??= new BasemapWorkers(shared, this.url);\n\n return { pool: this.shared, own: false };\n }\n\n return { pool: new BasemapWorkers(workers, workerUrl), own: true };\n }\n\n /** Stops the shared pool */\n terminate(): void {\n this.shared?.terminate();\n this.shared = undefined;\n }\n\n /** Rasters reprojected by the workers (in the page without them) */\n readonly remoteReprojection: RemoteReprojection = (job, tile, signal) =>\n this.decodingPool()?.reproject(job, tile, signal, this.owner);\n\n /** The loader of the relief tiles of `url` in a PNG encoding (one per URL, encoding and floor) */\n readonly terrainLoader = (url: string, encoding: PngEncoding, floor?: number): TerrainLoader => {\n const key = `${encoding} ${floor ?? ''} ${url}`;\n const cached = this.terrainLoaders.get(key);\n\n if (cached) return cached;\n\n const loader = encodedTerrainLoader(url, encoding, floor, this.remoteHeights);\n\n this.terrainLoaders.set(key, loader);\n\n return loader;\n };\n\n private readonly remoteHeights: RemoteHeights = (url, encoding, floor, tile, signal) =>\n this.decodingPool()?.heights(url, encoding, floor, tile, signal, this.owner);\n\n /** A GRIB2 or NetCDF file read into grids by the grid module (`module`), in a worker (in the page without them, or if\n * the worker fails) */\n async readGrids(\n source: string | URL | ArrayBuffer | Uint8Array,\n module: string,\n signal?: AbortSignal,\n ): Promise<Grid[]> {\n const pool = this.decodingPool();\n const url = typeof source === 'string' || source instanceof URL ? String(source) : undefined;\n const copy = source instanceof Uint8Array ? source.slice().buffer : undefined;\n const bytes = copy ?? (source instanceof ArrayBuffer ? source : undefined);\n // Against the page: the workers fetch it, and a relative URL would be theirs\n const absolute = url && typeof document !== 'undefined' ? new URL(url, document.baseURI).href : url;\n const fetchFile = async (at: string) => {\n const response = await fetchOk(at, withHeaders(at, signal ? { signal } : {}));\n\n return response.arrayBuffer();\n };\n const inPage = async () => decodeGrids(new Uint8Array(bytes ?? (await fetchFile(absolute ?? ''))), module);\n const read = async () => {\n if (!pool) return inPage();\n\n return pool\n .grids(absolute ? { url: absolute } : { bytes: bytes ?? new ArrayBuffer(0) }, module, signal, this.owner)\n .catch((error: unknown) => {\n // A worker's failure (the module not fetched, a worker of an older build): read again in the page, unless\n // cancelled or its bytes handed over\n if (signal?.aborted || bytes?.byteLength === 0) throw error;\n\n return inPage();\n });\n };\n const { grids, values } = await read();\n\n return grids.map((g, i) => gridOf(g, values[i] ?? new Float32Array()));\n }\n\n /**\n * The workers decoding the relief and reprojecting rasters: the shared pool, unless the map has no workers\n * (`workers: false` or 0, or none in this browser): that is done in the page then\n */\n private decodingPool(): BasemapWorkers | undefined {\n const workers = this.workers;\n\n if (this.gone() || workers === false || (workers !== undefined && workers <= 0)) return undefined;\n if (typeof Worker === 'undefined' || typeof OffscreenCanvas === 'undefined') return undefined;\n\n return this.pool().pool;\n }\n}\n"]}
|
package/dist/map.d.ts
CHANGED
|
@@ -8,19 +8,25 @@
|
|
|
8
8
|
import { type PmtilesOptions } from './basemap/pmtileslayer.ts';
|
|
9
9
|
import { VectorTiles, type VectorTilesOptions } from './basemap/vectortiles.ts';
|
|
10
10
|
import type { Grid } from './grids.ts';
|
|
11
|
+
import { CustomLayer, type CustomLayerInterface } from './layers/custom.ts';
|
|
11
12
|
import { ExtrusionLayer, type ExtrusionOptions } from './layers/extrusions.ts';
|
|
12
13
|
import { CircleLayer, type CircleOptions, FillLayer, type FillOptions, LineLayer, type LineOptions } from './layers/features.ts';
|
|
13
14
|
import { FlowLayer, type FlowOptions } from './layers/flow.ts';
|
|
15
|
+
import { GroundLayer, type GroundOptions } from './layers/ground.ts';
|
|
14
16
|
import type { ImageOptions, Pixels } from './layers/icons.ts';
|
|
15
|
-
import
|
|
17
|
+
import type { Layer } from './layers/layers.ts';
|
|
18
|
+
import { ModelLayer, type ModelOptions } from './layers/models.ts';
|
|
19
|
+
import { NetworkLayer } from './layers/network.ts';
|
|
16
20
|
import { type PanoramaOptions, type Panoramas } from './layers/panoramas.ts';
|
|
17
21
|
import { type PhotoOptions } from './layers/photos.ts';
|
|
18
22
|
import { PointCloudLayer, type PointCloudOptions } from './layers/pointclouds.ts';
|
|
23
|
+
import { RasterLayer } from './layers/raster.ts';
|
|
19
24
|
import { SymbolLayer, type SymbolOptions } from './layers/symbols.ts';
|
|
25
|
+
import { Tiles3dLayer } from './layers/tiles3d.ts';
|
|
20
26
|
import { type TreeOptions } from './layers/trees.ts';
|
|
21
27
|
import { type HoverPicking } from './map/hover-pick.ts';
|
|
22
28
|
import { type LayerSpec } from './map/layer-spec.ts';
|
|
23
|
-
import type { AnimationOptions, AtmosphereOptions, Basemap, FeatureHit, FirstPersonView, FlyToOptions, GeoMapOptions, LoadingMode, LonLat, MapEvents, NetworkOptions, Point, Projection, RasterOptions, SunOptions, SwipeOptions, TerrainModel, TerrainOptions, Tiles3dOptions, ViewshedOptions } from './types.ts';
|
|
29
|
+
import type { AnimationOptions, AtmosphereOptions, Basemap, FeatureHit, FirstPersonView, FlyToOptions, GeoMapOptions, LoadingMode, LonLat, MapEvents, NetworkOptions, PickOptions, Point, Projection, RasterOptions, SunOptions, SwipeOptions, TerrainModel, TerrainOptions, Tiles3dOptions, ViewshedOptions } from './types.ts';
|
|
24
30
|
import { type Control, type ControlPosition } from './ui/controls.ts';
|
|
25
31
|
import type { Camera, PickHit, RasterLayerStats } from './wasm/isard.js';
|
|
26
32
|
export type { LayerSpec } from './map/layer-spec.ts';
|
|
@@ -85,6 +91,13 @@ export declare class GeoMap {
|
|
|
85
91
|
/** Downloads and compiles the engine with 3D Tiles once the map is idle (`tiles3d: 'preload'`), without running
|
|
86
92
|
* it: the first 3D Tiles layer then only instantiates it */
|
|
87
93
|
private preloadTiles3d;
|
|
94
|
+
/**
|
|
95
|
+
* The context is lost: its engine freed at once, the map's calls going to one that does nothing until `restore`
|
|
96
|
+
* builds the next. The old engine's GPU objects went with the context: deleted now, it is silent (on the context
|
|
97
|
+
* restored, each one warns); its 3D Tiles downloads stop. Its layers' updates meanwhile (a tile uploaded, labels)
|
|
98
|
+
* would fail on the lost context, whose limits read 0
|
|
99
|
+
*/
|
|
100
|
+
private dropLostEngine;
|
|
88
101
|
/** After a context loss: a new engine with the same camera, settings and layers (same handles, same order) */
|
|
89
102
|
private restore;
|
|
90
103
|
/** The street-level eye, if the camera is one */
|
|
@@ -108,44 +121,6 @@ export declare class GeoMap {
|
|
|
108
121
|
private addLayer;
|
|
109
122
|
/** Listens to an event; returns the function that stops listening */
|
|
110
123
|
on<K extends keyof MapEvents>(type: K, listener: (event: MapEvents[K]) => void): () => void;
|
|
111
|
-
/**
|
|
112
|
-
* The camera's methods together: `get`, `set`, `easeTo`, `flyTo`, `bounds`, `firstPerson` and `setFirstPerson`
|
|
113
|
-
* (street level), `project`, `unproject`; the same as the map's own (`getCamera`, `setCamera`…)
|
|
114
|
-
*/
|
|
115
|
-
readonly camera: {
|
|
116
|
-
readonly get: () => Camera;
|
|
117
|
-
readonly set: (camera: Partial<Camera>) => void;
|
|
118
|
-
readonly easeTo: (camera: Partial<Camera>, options?: number | AnimationOptions) => void;
|
|
119
|
-
readonly flyTo: (camera: Partial<Camera>, options?: FlyToOptions) => void;
|
|
120
|
-
readonly bounds: () => [west: number, south: number, east: number, north: number];
|
|
121
|
-
readonly firstPerson: () => Readonly<Required<FirstPersonView>> | undefined;
|
|
122
|
-
readonly setFirstPerson: (view: FirstPersonView | undefined) => void;
|
|
123
|
-
readonly project: (lonLat: LonLat, height?: number) => Point | undefined;
|
|
124
|
-
readonly unproject: (point: Point) => LonLat | undefined;
|
|
125
|
-
};
|
|
126
|
-
/**
|
|
127
|
-
* What lies under a point or at a position, together: `feature` (`pickFeature`), `surface` (`pickSurface`),
|
|
128
|
-
* `surfaceAt`, `elevationAt`, `metersPerPixel`
|
|
129
|
-
*/
|
|
130
|
-
readonly query: {
|
|
131
|
-
readonly feature: (point: Point, options?: {
|
|
132
|
-
radius?: number;
|
|
133
|
-
layers?: readonly Layer[];
|
|
134
|
-
}) => FeatureHit | undefined;
|
|
135
|
-
readonly surface: (point: Point) => {
|
|
136
|
-
lonLat: LonLat;
|
|
137
|
-
height: number;
|
|
138
|
-
} | undefined;
|
|
139
|
-
readonly surfaceAt: (lonLat: LonLat) => number | undefined;
|
|
140
|
-
readonly elevationAt: (lonLat: LonLat) => number | undefined;
|
|
141
|
-
readonly metersPerPixel: (point?: Point) => number | undefined;
|
|
142
|
-
};
|
|
143
|
-
/** What is drawn over the scene, together: `viewshed` (`setViewshed`), `sun` (`setSun`), `swipe` (`setSwipe`) */
|
|
144
|
-
readonly effects: {
|
|
145
|
-
readonly viewshed: (options: ViewshedOptions | readonly ViewshedOptions[] | undefined) => void;
|
|
146
|
-
readonly sun: (options: SunOptions | undefined) => void;
|
|
147
|
-
readonly swipe: (options: SwipeOptions | undefined) => void;
|
|
148
|
-
};
|
|
149
124
|
getCamera(): Camera;
|
|
150
125
|
setCamera(camera: Partial<Camera>): void;
|
|
151
126
|
/** Animated move to a camera: over `duration` milliseconds (or the options), ease-out by default */
|
|
@@ -201,16 +176,13 @@ export declare class GeoMap {
|
|
|
201
176
|
* offscreen picking pass, whatever the number of features, but waits for the GPU to finish the frame (a stall): for
|
|
202
177
|
* clicks and one-off queries. On hover, listen to 'hoverfeature' instead, which picks without waiting.
|
|
203
178
|
*/
|
|
204
|
-
pick(point: Point, radius
|
|
179
|
+
pick(point: Point, { radius, layers }?: PickOptions): PickHit | undefined;
|
|
205
180
|
/**
|
|
206
181
|
* The feature under a screen point (CSS pixels), or the nearest one within `radius` pixels: its layer handle, its
|
|
207
182
|
* index there and, for line, circle and fill layers, the feature itself; undefined if none. `layers` restricts the
|
|
208
183
|
* search to some layers (the others hide nothing).
|
|
209
184
|
*/
|
|
210
|
-
pickFeature(point: Point, options?:
|
|
211
|
-
radius?: number;
|
|
212
|
-
layers?: readonly Layer[];
|
|
213
|
-
}): FeatureHit | undefined;
|
|
185
|
+
pickFeature(point: Point, options?: PickOptions): FeatureHit | undefined;
|
|
214
186
|
/** A hit with its layer handle and feature; undefined if the layer is gone */
|
|
215
187
|
private featureHit;
|
|
216
188
|
/** Screen point (CSS pixels) of a position on the ground (the relief), or `height` metres above it, undefined
|
|
@@ -233,6 +205,9 @@ export declare class GeoMap {
|
|
|
233
205
|
metersPerPixel(point?: Point): number | undefined;
|
|
234
206
|
/** Whether a double click zooms in (Shift: out), on by default: off while a drawing takes double clicks */
|
|
235
207
|
setDoubleClickZoom(enabled: boolean): void;
|
|
208
|
+
/** Whether a drag that turns and tilts the map (right button, Ctrl or Shift) goes around what is under the pointer
|
|
209
|
+
* where it starts, a roof or a mesh as the relief (on by default), or around the screen center */
|
|
210
|
+
setRotateAroundPointer(enabled: boolean): void;
|
|
236
211
|
/** What is drawn under a screen point (CSS pixels), on the relief or standing on it (a roof, a wall, a mesh): its
|
|
237
212
|
* position and its height above the relief, in metres; undefined where nothing was drawn. The last frame's scene is
|
|
238
213
|
* drawn again and read back, waiting for the GPU (a stall): for clicks and drags */
|
|
@@ -252,16 +227,14 @@ export declare class GeoMap {
|
|
|
252
227
|
setBasemap(basemap: Basemap, hillshade?: number): void;
|
|
253
228
|
/** Raster tiles ({z}, {x}, {y} URL; Web Mercator, or reprojected from another `grid`: longitudes and latitudes,
|
|
254
229
|
* Lambert-93, UTM…), over the layers already added */
|
|
255
|
-
addRaster(options: RasterOptions
|
|
256
|
-
before?: Layer;
|
|
257
|
-
}): RasterLayer;
|
|
230
|
+
addRaster(options: RasterOptions): RasterLayer;
|
|
258
231
|
/**
|
|
259
232
|
* A PMTiles archive (v3) read by range requests: a raster layer of its images, or vector tiles drawn with `style` (by
|
|
260
233
|
* default a plain style of the archive's layers) with their labels. Its header decides which unless `kind` says;
|
|
261
234
|
* `url` with or without `pmtiles://`, relative to the page, or a `blob:` URL. `addRaster({ url: 'pmtiles://…' })` and
|
|
262
235
|
* a style source `pmtiles://…` in `vectorTiles` read archives too
|
|
263
236
|
*/
|
|
264
|
-
addPmtiles(
|
|
237
|
+
addPmtiles(options: PmtilesOptions): Promise<RasterLayer | VectorTiles>;
|
|
265
238
|
/** Line network colored by a value per node; `layer.setValues` recolors it in one texture upload */
|
|
266
239
|
addNetwork(options: NetworkOptions): NetworkLayer;
|
|
267
240
|
/**
|
|
@@ -277,9 +250,7 @@ export declare class GeoMap {
|
|
|
277
250
|
/** Filled polygons from GeoJSON (holes included), styled per feature; over the relief they lie on the ground */
|
|
278
251
|
addFills<P = Record<string, unknown>>(options: FillOptions<P>): FillLayer<P>;
|
|
279
252
|
/** The application's fragment shader over the ground (see `GroundOptions`); under `before` if given */
|
|
280
|
-
addGround(options: GroundOptions
|
|
281
|
-
before?: Layer;
|
|
282
|
-
}): GroundLayer;
|
|
253
|
+
addGround(options: GroundOptions): GroundLayer;
|
|
283
254
|
/** Polygons raised into blocks with depth (buildings), styled per feature; tiles of them come with `setTile` */
|
|
284
255
|
addExtrusions<P = Record<string, unknown>>(options?: ExtrusionOptions<P>): ExtrusionLayer<P>;
|
|
285
256
|
/** Text labels from GeoJSON (points, the middle of lines, the center of polygons), placed without overlaps */
|
|
@@ -310,9 +281,7 @@ export declare class GeoMap {
|
|
|
310
281
|
* A point cloud (see `PointCloudOptions`): a COPC file read by range requests (IGN's LiDAR HD…), or 3D Tiles
|
|
311
282
|
* points; with depth, on the engine with 3D Tiles; under `before` if given
|
|
312
283
|
*/
|
|
313
|
-
addPointCloud(options: PointCloudOptions
|
|
314
|
-
before?: Layer;
|
|
315
|
-
}): PointCloudLayer;
|
|
284
|
+
addPointCloud(options: PointCloudOptions): PointCloudLayer;
|
|
316
285
|
/**
|
|
317
286
|
* The grids of a GRIB2 or classic NetCDF file (its URL, or its bytes): a weather or ocean model's fields on grids of
|
|
318
287
|
* longitudes and latitudes, read in a worker by the grid module (loaded with the first file). GRIB2 on a regular
|
|
@@ -326,9 +295,7 @@ export declare class GeoMap {
|
|
|
326
295
|
* the globe and the relief (see `FlowOptions`) */
|
|
327
296
|
addFlow(options: FlowOptions): FlowLayer;
|
|
328
297
|
/** A glTF model drawn at positions (see `ModelOptions`), with depth; on the engine with 3D Tiles, as they are */
|
|
329
|
-
addModels(options: ModelOptions
|
|
330
|
-
before?: Layer;
|
|
331
|
-
}): ModelLayer;
|
|
298
|
+
addModels(options: ModelOptions): ModelLayer;
|
|
332
299
|
/** Trees at the points of a source that has them (a city's street trees), broadleaved or conifers by their data,
|
|
333
300
|
* scaled to their height (see `TreeOptions`); the conifers on a layer that goes with the one returned */
|
|
334
301
|
addTrees<P = Record<string, unknown>>(options: TreeOptions<P>): ModelLayer;
|