isard 1.13.0 → 1.15.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.
Binary file
Binary file
Binary file
Binary file
@@ -202,12 +202,12 @@ export class VectorLayer extends Layer {
202
202
  }
203
203
  /** A tile to the engine: its mesh uploaded as it is, or without one its geometry, which the engine makes ready */
204
204
  sendTile(engine, id, key, vectors) {
205
- const { fills, lines, circles, styles, properties, mesh } = vectors;
205
+ const { fills, lines, circles, styles, sublayer, mesh } = vectors;
206
206
  if (mesh) {
207
- engine.setVectorTileMesh(id, key, fills.points, fills.ringStart, fills.polygonStart, fills.feature, fills.fillStart, mesh.vertices, mesh.indices, mesh.fillRanges, mesh.prism, mesh.pieces, mesh.lineTable, mesh.lineRanges, mesh.blocks, mesh.blockIndices, mesh.blockRanges, mesh.bounds, properties.length);
207
+ engine.setVectorTileMesh(id, key, fills.points, fills.ringStart, fills.polygonStart, fills.feature, fills.fillStart, mesh.vertices, mesh.indices, mesh.fillRanges, mesh.prism, mesh.pieces, mesh.lineTable, mesh.lineRanges, mesh.blocks, mesh.blockIndices, mesh.blockRanges, mesh.bounds, sublayer);
208
208
  }
209
209
  else {
210
- engine.setVectorTile(id, key, fills.points, fills.ringStart, fills.polygonStart, fills.feature, fills.fillStart, lines.points, lines.start, lines.feature, lines.lineStart, properties.length, vectors.tile ?? new Float64Array(), fills.roofs ?? new Uint8Array(), fills.roofHeights ?? new Float32Array(), fills.roofOutlines ?? new Float64Array(), fills.roofOutlineStart ?? new Uint32Array(), fills.roofMetres ?? 0);
210
+ engine.setVectorTile(id, key, fills.points, fills.ringStart, fills.polygonStart, fills.feature, fills.fillStart, lines.points, lines.start, lines.feature, lines.lineStart, sublayer, vectors.tile ?? new Float64Array(), fills.roofs ?? new Uint8Array(), fills.roofHeights ?? new Float32Array(), fills.roofOutlines ?? new Float64Array(), fills.roofOutlineStart ?? new Uint32Array(), fills.roofMetres ?? 0);
211
211
  }
212
212
  // The circles' points, once the tile is there
213
213
  if (circles)
@@ -1 +1 @@
1
- {"version":3,"file":"vectors.js","sourceRoot":"","sources":["../../src/layers/vectors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGjD,OAAO,EAA2B,KAAK,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAsCpC;yFACyF;AACzF,MAAM,SAAS,GAAG,CAAC,CAAC;AASpB,MAAM,OAAO,WAAY,SAAQ,KAAK;IACnB,KAAK,GAAG,IAAI,GAAG,EAAgB,CAAC;IACjD;oDACgD;IAC/B,KAAK,GAAG,IAAI,GAAG,EAAyE,CAAC;IAClG,QAAQ,GAAG,KAAK,CAAC;IACjB,SAAS,GAAqB,EAAE,CAAC;IACjC,OAAO,GAAG,CAAC,CAAC;IACpB,+EAA+E;IACvE,KAAK,GAAG,IAAI,CAAC;IACrB,6DAA6D;IACrD,OAAO,GAAG,KAAK,CAAC;IACxB,wGAAwG;IACxG,MAAM,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAC;IAC1C,qFAAqF;IACrF,OAAO,CAAiG;IACxG,sHAAsH;IACtH,KAAK,CAA2B;IAChC,8FAA8F;IAC9F,OAAO,CAA2B;IAClC,6GAA6G;IAC7G,WAAW,CAA2B;IAEtC,gBAAgB;IAChB,YAAY,GAAc;QACxB,KAAK,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;IAED,8DAA8D;IACrD,cAAc;QACrB,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;IACnB,CAAC;IAED;4BACwB;IACxB,IAAa,KAAK;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;IAED,uCAAuC;IACvC,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,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M,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;QACvG,MAAM,CAAC,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1C,CAAC;IAED,gBAAgB;IACN,MAAM,CAAC,MAAc;QAC7B,MAAM,EAAE,GAAG,MAAM,CAAC,cAAc,EAAE,CAAC;QAEnC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC/B,MAAM,CAAC,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACpC,iHAAiH;QACjH,4FAA4F;QAC5F,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,cAAc,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAErC,OAAO,EAAE,CAAC;IACZ,CAAC;CACF","sourcesContent":["/**\n * The fills and lines of a MapLibre style drawn as geometry, tile by tile (`VectorTiles.vectors`), instead of into the\n * images of a raster layer: sharp at any zoom and pitch, on the relief, picked by feature, restyled without cutting the\n * tiles again. The workers cut each vector tile into polygons and lines and style its features; the engine draws the\n * style's layers in their order, each over its zoom range.\n */\n\nimport type { LayerHost } from '../types.ts';\nimport { FLOATS } from '../util/style-floats.ts';\nimport type { Engine } from '../wasm/isard.js';\nimport type { TileVectors } from '../workers/basemap/protocol.ts';\nimport { type Feature, type Size, stops } from './features.ts';\nimport { Layer } from './layers.ts';\nimport type { Tiles3dLayer } from './tiles3d.ts';\n\n/** A style layer as the engine draws it: its kind, zoom range, visibility and dashes (dash, gap, dash, gap, in line\n * widths; zeros: solid) */\nexport interface VectorSublayer {\n /** The style layer's id */\n id: string;\n /** Its source layer, if any (not for a background) */\n sourceLayer: string | undefined;\n kind: 'fill' | 'line' | 'extrusion' | 'circle';\n minZoom: number;\n maxZoom: number;\n visible: boolean;\n /** Its opacity when it depends on the zoom only, evaluated at the camera's zoom (else 1: the features' colors hold\n * it) */\n opacity: Size;\n dash: [number, number, number, number];\n /** The caps of its lines' ends (`line-cap`) */\n cap: 'butt' | 'round' | 'square';\n /** The joins of its lines' pieces (`line-join`), a miter longer than `miterLimit` line widths bevelled\n * (`line-miter-limit`); round and 2 if left out */\n join?: 'miter' | 'bevel' | 'round';\n miterLimit?: number;\n /** How far its fills or lines move on screen (`fill-translate`, `line-translate`: CSS pixels, x right, y down),\n * turning with the map or staying on the screen (`*-translate-anchor`); none and `map` if left out */\n translate?: [number, number];\n translateAnchor?: 'map' | 'viewport';\n /** Its fills have patterns (`fill-pattern`, `background-pattern`): over the relief, the engine finds the ground under\n * them */\n patterned?: boolean;\n /** Its lines glow at night (the streets: its id names a road, not its casing; `setSun`) */\n lit: boolean;\n}\n\n/** The properties of a picked feature, with the style layer that drew it */\nexport type VectorFeature = Feature<Record<string, unknown>> & { layer: string; sourceLayer: string | undefined };\n\n/** The main thread's time a frame gives to uploading tiles (ms): tiles arriving together are uploaded over several\n * frames, not all in the one (copying a tile's buffers to the GPU takes milliseconds) */\nconst UPLOAD_MS = 4;\n\ninterface Tile {\n /** Its number in the engine: tiles are numbered for picking in this order */\n key: number;\n /** What picking needs (its geometry and styles are the engine's only: an engine made anew asks the tiles again) */\n vectors: Pick<TileVectors, 'properties' | 'sublayer'>;\n}\n\nexport class VectorLayer extends Layer {\n private readonly tiles = new Map<string, Tile>();\n /** The tiles waiting for their upload (`UPLOAD_MS` a frame), each with what resolves its `setTile`; `sent`: in the\n * engine already, its blocks still uploading */\n private readonly queue = new Map<string, { vectors: TileVectors; uploaded: () => void; sent?: number }>();\n private flushing = false;\n private sublayers: VectorSublayer[] = [];\n private nextKey = 0;\n /** The whole layer shown (`setVisible`), over each style layer's visibility */\n private shown = true;\n /** Its buildings' walls show their windows (`setFacades`) */\n private facades = false;\n /** @internal Resolved once the style is loaded and its layers drawn known (set by its `VectorTiles`) */\n styled: Promise<void> = Promise.resolve();\n /** @internal Changes a property of a style layer drawn (set by its `VectorTiles`) */\n restyle: ((layer: string, group: 'paint' | 'layout', name: string, value: unknown) => void) | undefined;\n /** @internal Asks the workers for the tiles in view again (set by its `VectorTiles`): an engine made anew has none */\n recut: (() => void) | undefined;\n /** @internal Asks for the tiles in view (set by its `VectorTiles`): those of a new quality */\n refresh: (() => void) | undefined;\n /** The 3D buildings drawn in place of its raised ones (`vectors({ buildings3d })`), for `map.pickFeature` */\n buildings3d: Tiles3dLayer | undefined;\n\n /** @internal */\n constructor(map: LayerHost) {\n super(map);\n }\n\n /** @internal Its tiles as far as the map's quality reaches */\n override qualityChanged(): void {\n this.refresh?.();\n }\n\n /** Resolves once the style is loaded, its layers drawn known (`layers`), and the map has drawn the layer; rejected\n * if the style fails */\n override get ready(): Promise<void> {\n return this.styled.then(() => super.ready);\n }\n\n /** The style layers drawn, in order */\n get layers(): readonly VectorSublayer[] {\n return this.sublayers;\n }\n\n /** Keys of the tiles held (`z/x/y`) */\n get tileKeys(): string[] {\n return [...this.tiles.keys()];\n }\n\n /** @internal Sets the style layers drawn, in order (the tiles' sublayers) */\n setSublayers(sublayers: VectorSublayer[]): void {\n this.sublayers = sublayers;\n this.sendSublayers(this.map.engine, this.id);\n this.map.requestRender();\n }\n\n /** @internal Adds or replaces a tile, cut by the workers (and made ready for the GPU there, with its mesh): uploaded\n * on a coming frame, within its share of the frame (`UPLOAD_MS`); resolves once it is (or once dropped meanwhile) */\n setTile(tile: string, vectors: TileVectors): Promise<void> {\n if (this.removed) return Promise.resolve();\n // The map not idle until it is uploaded\n return this.map.track(\n new Promise((uploaded) => {\n // A newer cut of a tile still waiting takes its place\n this.queue.get(tile)?.uploaded();\n this.queue.set(tile, { vectors, uploaded });\n this.flushSoon();\n }),\n );\n }\n\n /** Uploads the waiting tiles on the next frame */\n private flushSoon(): void {\n if (this.flushing) return;\n this.flushing = true;\n requestAnimationFrame(() => {\n this.flushing = false;\n this.flush();\n });\n }\n\n /** Uploads waiting tiles for `UPLOAD_MS` at most (one at least, or a part of its blocks), the rest on the next\n * frames; a tile's `setTile` resolves once its blocks are all there */\n private flush(): void {\n // Removed meanwhile, or between two engines (the new one asks for the tiles again)\n if (this.id < 0) return;\n\n const start = performance.now();\n const within = () => performance.now() - start <= UPLOAD_MS;\n\n for (const [tile, waiting] of this.queue) {\n waiting.sent ??= this.upload(tile, waiting.vectors);\n\n // A large tile's blocks (a pitched view's far tiles of a city: 10 MB and more), a part at a time\n let left = this.map.engine.uploadVectorTile(this.id, waiting.sent);\n\n while (left && within()) left = this.map.engine.uploadVectorTile(this.id, waiting.sent);\n if (left) break;\n this.queue.delete(tile);\n waiting.uploaded();\n if (!within()) break;\n }\n if (this.queue.size > 0) this.flushSoon();\n this.map.requestRender();\n }\n\n /** Sends a tile to the engine (its blocks' first part); its key */\n private upload(tile: string, vectors: TileVectors): number {\n const key = this.tiles.get(tile)?.key ?? this.nextKey++;\n const { properties, sublayer } = vectors;\n\n this.tiles.set(tile, { key, vectors: { properties, sublayer } });\n this.sendTile(this.map.engine, this.id, key, vectors);\n\n return key;\n }\n\n /** @internal New styles of a tile's features, as the workers evaluated them (the same features) */\n setTileStyles(tile: string, styles: Float32Array): void {\n const waiting = this.queue.get(tile);\n\n // Not uploaded yet: uploaded with them\n if (waiting && waiting.sent === undefined) {\n if (styles.length === waiting.vectors.properties.length * FLOATS) waiting.vectors.styles = styles;\n\n return;\n }\n\n const t = this.tiles.get(tile);\n\n if (!t || styles.length !== t.vectors.properties.length * FLOATS) return;\n this.map.engine.setFeatureStyle(this.id, styles, t.key);\n this.map.requestRender();\n }\n\n override remove(): void {\n super.remove();\n this.dispose();\n }\n\n /** @internal The tiles waiting resolved (dropped), none held */\n override dispose(): void {\n this.queue.forEach((waiting) => {\n waiting.uploaded();\n });\n this.queue.clear();\n this.tiles.clear();\n }\n\n /** @internal */\n removeTile(tile: string): void {\n this.queue.get(tile)?.uploaded();\n this.queue.delete(tile);\n\n const t = this.tiles.get(tile);\n\n if (!t) return;\n this.tiles.delete(tile);\n this.map.engine.removeVectorTile(this.id, t.key);\n this.map.requestRender();\n }\n\n /** The feature of a picked index (no geometry: the tiles hold it cut), its properties and style layer. Tiles are\n * numbered one after the other, in the order they were first added */\n featureAt(index: number): VectorFeature | undefined {\n const tiles = [...this.tiles.values()].sort((a, b) => a.key - b.key);\n // The tile holding the index, and the index among its features (one pass, the features of the tiles before\n // taken off)\n const { tile, rest } = tiles.reduce<{ tile?: Tile; rest: number }>(\n (found, t) => {\n if (found.tile) return found;\n\n const count = t.vectors.properties.length;\n\n return found.rest < count ? { tile: t, rest: found.rest } : { rest: found.rest - count };\n },\n { rest: index },\n );\n\n if (!tile) return undefined;\n\n const properties = tile.vectors.properties[rest];\n const sublayer = this.sublayers[tile.vectors.sublayer[rest] ?? -1];\n\n if (properties === undefined || !sublayer) return undefined;\n\n return { type: 'Feature', properties, geometry: null, layer: sublayer.id, sourceLayer: sublayer.sourceLayer };\n }\n\n /** Changes a paint property of a style layer drawn, as MapLibre's `setPaintProperty`: the tiles are restyled, not cut\n * again */\n setPaintProperty(layer: string, name: string, value: unknown): void {\n this.restyle?.(layer, 'paint', name, value);\n }\n\n /** Changes a layout property of a style layer drawn (`visibility`: shown or hidden at once), as MapLibre's\n * `setLayoutProperty` */\n setLayoutProperty(layer: string, name: string, value: unknown): void {\n this.restyle?.(layer, 'layout', name, value);\n }\n\n /** Whether its buildings' walls show their windows: glass by day, some lit at night (only the lit ones without) */\n setFacades(facades: boolean): void {\n this.facades = facades;\n this.map.engine.setFacades(this.id, facades);\n // Its 3D buildings' walls too\n this.buildings3d?.setFacades(facades);\n this.map.requestRender();\n }\n\n setVisible(visible: boolean): void {\n this.shown = visible;\n this.sendSublayers(this.map.engine, this.id);\n this.map.requestRender();\n }\n\n private sendSublayers(engine: Engine, id: number): void {\n const s = this.sublayers;\n\n engine.setVectorSublayers(\n id,\n Uint8Array.from(s, (l) => ({ fill: 0, line: 1, extrusion: 2, circle: 3 })[l.kind]),\n Float64Array.from(s.flatMap((l) => [l.minZoom, l.maxZoom])),\n Uint8Array.from(s, (l) => (l.visible && this.shown ? 1 : 0)),\n Float32Array.from(s.flatMap((l) => l.dash)),\n Float32Array.from(s.flatMap((l) => stops(l.opacity))),\n Uint8Array.from(s, (l) => ({ butt: 0, round: 1, square: 2 })[l.cap]),\n Uint8Array.from(s, (l) => (l.lit ? 1 : 0)),\n Float32Array.from(s.flatMap((l) => [{ round: 0, miter: 1, bevel: 2 }[l.join ?? 'round'], l.miterLimit ?? 2])),\n Float32Array.from(s.flatMap((l) => [...(l.translate ?? [0, 0]), l.translateAnchor === 'viewport' ? 1 : 0])),\n Uint8Array.from(s, (l) => (l.patterned ? 1 : 0)),\n );\n }\n\n /** A tile to the engine: its mesh uploaded as it is, or without one its geometry, which the engine makes ready */\n private sendTile(engine: Engine, id: number, key: number, vectors: TileVectors): void {\n const { fills, lines, circles, styles, properties, mesh } = vectors;\n\n if (mesh) {\n engine.setVectorTileMesh(\n id,\n key,\n fills.points,\n fills.ringStart,\n fills.polygonStart,\n fills.feature,\n fills.fillStart,\n mesh.vertices,\n mesh.indices,\n mesh.fillRanges,\n mesh.prism,\n mesh.pieces,\n mesh.lineTable,\n mesh.lineRanges,\n mesh.blocks,\n mesh.blockIndices,\n mesh.blockRanges,\n mesh.bounds,\n properties.length,\n );\n } else {\n engine.setVectorTile(\n id,\n key,\n fills.points,\n fills.ringStart,\n fills.polygonStart,\n fills.feature,\n fills.fillStart,\n lines.points,\n lines.start,\n lines.feature,\n lines.lineStart,\n properties.length,\n vectors.tile ?? new Float64Array(),\n fills.roofs ?? new Uint8Array(),\n fills.roofHeights ?? new Float32Array(),\n fills.roofOutlines ?? new Float64Array(),\n fills.roofOutlineStart ?? new Uint32Array(),\n fills.roofMetres ?? 0,\n );\n }\n // The circles' points, once the tile is there\n if (circles) engine.setVectorTilePoints(id, key, circles.points, circles.feature, circles.circleStart);\n engine.setFeatureStyle(id, styles, key);\n }\n\n /** @internal */\n protected create(engine: Engine): number {\n const id = engine.addVectorTiles();\n\n this.sendSublayers(engine, id);\n engine.setFacades(id, this.facades);\n // An engine made anew (after a context loss, or the one with 3D Tiles): its tiles cut again by the workers, once\n // the layer has its id there. Keeping their geometry here would double the memory they take\n this.dispose();\n queueMicrotask(() => this.recut?.());\n\n return id;\n }\n}\n"]}
1
+ {"version":3,"file":"vectors.js","sourceRoot":"","sources":["../../src/layers/vectors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGjD,OAAO,EAA2B,KAAK,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAsCpC;yFACyF;AACzF,MAAM,SAAS,GAAG,CAAC,CAAC;AASpB,MAAM,OAAO,WAAY,SAAQ,KAAK;IACnB,KAAK,GAAG,IAAI,GAAG,EAAgB,CAAC;IACjD;oDACgD;IAC/B,KAAK,GAAG,IAAI,GAAG,EAAyE,CAAC;IAClG,QAAQ,GAAG,KAAK,CAAC;IACjB,SAAS,GAAqB,EAAE,CAAC;IACjC,OAAO,GAAG,CAAC,CAAC;IACpB,+EAA+E;IACvE,KAAK,GAAG,IAAI,CAAC;IACrB,6DAA6D;IACrD,OAAO,GAAG,KAAK,CAAC;IACxB,wGAAwG;IACxG,MAAM,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAC;IAC1C,qFAAqF;IACrF,OAAO,CAAiG;IACxG,sHAAsH;IACtH,KAAK,CAA2B;IAChC,8FAA8F;IAC9F,OAAO,CAA2B;IAClC,6GAA6G;IAC7G,WAAW,CAA2B;IAEtC,gBAAgB;IAChB,YAAY,GAAc;QACxB,KAAK,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;IAED,8DAA8D;IACrD,cAAc;QACrB,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;IACnB,CAAC;IAED;4BACwB;IACxB,IAAa,KAAK;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK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AA8C;QAC9C,IAAI,OAAO;YAAE,MAAM,CAAC,mBAAmB,CAAC,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;QACvG,MAAM,CAAC,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1C,CAAC;IAED,gBAAgB;IACN,MAAM,CAAC,MAAc;QAC7B,MAAM,EAAE,GAAG,MAAM,CAAC,cAAc,EAAE,CAAC;QAEnC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC/B,MAAM,CAAC,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACpC,iHAAiH;QACjH,4FAA4F;QAC5F,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,cAAc,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAErC,OAAO,EAAE,CAAC;IACZ,CAAC;CACF","sourcesContent":["/**\n * The fills and lines of a MapLibre style drawn as geometry, tile by tile (`VectorTiles.vectors`), instead of into the\n * images of a raster layer: sharp at any zoom and pitch, on the relief, picked by feature, restyled without cutting the\n * tiles again. The workers cut each vector tile into polygons and lines and style its features; the engine draws the\n * style's layers in their order, each over its zoom range.\n */\n\nimport type { LayerHost } from '../types.ts';\nimport { FLOATS } from '../util/style-floats.ts';\nimport type { Engine } from '../wasm/isard.js';\nimport type { TileVectors } from '../workers/basemap/protocol.ts';\nimport { type Feature, type Size, stops } from './features.ts';\nimport { Layer } from './layers.ts';\nimport type { Tiles3dLayer } from './tiles3d.ts';\n\n/** A style layer as the engine draws it: its kind, zoom range, visibility and dashes (dash, gap, dash, gap, in line\n * widths; zeros: solid) */\nexport interface VectorSublayer {\n /** The style layer's id */\n id: string;\n /** Its source layer, if any (not for a background) */\n sourceLayer: string | undefined;\n kind: 'fill' | 'line' | 'extrusion' | 'circle';\n minZoom: number;\n maxZoom: number;\n visible: boolean;\n /** Its opacity when it depends on the zoom only, evaluated at the camera's zoom (else 1: the features' colors hold\n * it) */\n opacity: Size;\n dash: [number, number, number, number];\n /** The caps of its lines' ends (`line-cap`) */\n cap: 'butt' | 'round' | 'square';\n /** The joins of its lines' pieces (`line-join`), a miter longer than `miterLimit` line widths bevelled\n * (`line-miter-limit`); round and 2 if left out */\n join?: 'miter' | 'bevel' | 'round';\n miterLimit?: number;\n /** How far its fills or lines move on screen (`fill-translate`, `line-translate`: CSS pixels, x right, y down),\n * turning with the map or staying on the screen (`*-translate-anchor`); none and `map` if left out */\n translate?: [number, number];\n translateAnchor?: 'map' | 'viewport';\n /** Its fills have patterns (`fill-pattern`, `background-pattern`): over the relief, the engine finds the ground under\n * them */\n patterned?: boolean;\n /** Its lines glow at night (the streets: its id names a road, not its casing; `setSun`) */\n lit: boolean;\n}\n\n/** The properties of a picked feature, with the style layer that drew it */\nexport type VectorFeature = Feature<Record<string, unknown>> & { layer: string; sourceLayer: string | undefined };\n\n/** The main thread's time a frame gives to uploading tiles (ms): tiles arriving together are uploaded over several\n * frames, not all in the one (copying a tile's buffers to the GPU takes milliseconds) */\nconst UPLOAD_MS = 4;\n\ninterface Tile {\n /** Its number in the engine: tiles are numbered for picking in this order */\n key: number;\n /** What picking needs (its geometry and styles are the engine's only: an engine made anew asks the tiles again) */\n vectors: Pick<TileVectors, 'properties' | 'sublayer'>;\n}\n\nexport class VectorLayer extends Layer {\n private readonly tiles = new Map<string, Tile>();\n /** The tiles waiting for their upload (`UPLOAD_MS` a frame), each with what resolves its `setTile`; `sent`: in the\n * engine already, its blocks still uploading */\n private readonly queue = new Map<string, { vectors: TileVectors; uploaded: () => void; sent?: number }>();\n private flushing = false;\n private sublayers: VectorSublayer[] = [];\n private nextKey = 0;\n /** The whole layer shown (`setVisible`), over each style layer's visibility */\n private shown = true;\n /** Its buildings' walls show their windows (`setFacades`) */\n private facades = false;\n /** @internal Resolved once the style is loaded and its layers drawn known (set by its `VectorTiles`) */\n styled: Promise<void> = Promise.resolve();\n /** @internal Changes a property of a style layer drawn (set by its `VectorTiles`) */\n restyle: ((layer: string, group: 'paint' | 'layout', name: string, value: unknown) => void) | undefined;\n /** @internal Asks the workers for the tiles in view again (set by its `VectorTiles`): an engine made anew has none */\n recut: (() => void) | undefined;\n /** @internal Asks for the tiles in view (set by its `VectorTiles`): those of a new quality */\n refresh: (() => void) | undefined;\n /** The 3D buildings drawn in place of its raised ones (`vectors({ buildings3d })`), for `map.pickFeature` */\n buildings3d: Tiles3dLayer | undefined;\n\n /** @internal */\n constructor(map: LayerHost) {\n super(map);\n }\n\n /** @internal Its tiles as far as the map's quality reaches */\n override qualityChanged(): void {\n this.refresh?.();\n }\n\n /** Resolves once the style is loaded, its layers drawn known (`layers`), and the map has drawn the layer; rejected\n * if the style fails */\n override get ready(): Promise<void> {\n return this.styled.then(() => super.ready);\n }\n\n /** The style layers drawn, in order */\n get layers(): readonly VectorSublayer[] {\n return this.sublayers;\n }\n\n /** Keys of the tiles held (`z/x/y`) */\n get tileKeys(): string[] {\n return [...this.tiles.keys()];\n }\n\n /** @internal Sets the style layers drawn, in order (the tiles' sublayers) */\n setSublayers(sublayers: VectorSublayer[]): void {\n this.sublayers = sublayers;\n this.sendSublayers(this.map.engine, this.id);\n this.map.requestRender();\n }\n\n /** @internal Adds or replaces a tile, cut by the workers (and made ready for the GPU there, with its mesh): uploaded\n * on a coming frame, within its share of the frame (`UPLOAD_MS`); resolves once it is (or once dropped meanwhile) */\n setTile(tile: string, vectors: TileVectors): Promise<void> {\n if (this.removed) return Promise.resolve();\n // The map not idle until it is uploaded\n return this.map.track(\n new Promise((uploaded) => {\n // A newer cut of a tile still waiting takes its place\n this.queue.get(tile)?.uploaded();\n this.queue.set(tile, { vectors, uploaded });\n this.flushSoon();\n }),\n );\n }\n\n /** Uploads the waiting tiles on the next frame */\n private flushSoon(): void {\n if (this.flushing) return;\n this.flushing = true;\n requestAnimationFrame(() => {\n this.flushing = false;\n this.flush();\n });\n }\n\n /** Uploads waiting tiles for `UPLOAD_MS` at most (one at least, or a part of its blocks), the rest on the next\n * frames; a tile's `setTile` resolves once its blocks are all there */\n private flush(): void {\n // Removed meanwhile, or between two engines (the new one asks for the tiles again)\n if (this.id < 0) return;\n\n const start = performance.now();\n const within = () => performance.now() - start <= UPLOAD_MS;\n\n for (const [tile, waiting] of this.queue) {\n waiting.sent ??= this.upload(tile, waiting.vectors);\n\n // A large tile's blocks (a pitched view's far tiles of a city: 10 MB and more), a part at a time\n let left = this.map.engine.uploadVectorTile(this.id, waiting.sent);\n\n while (left && within()) left = this.map.engine.uploadVectorTile(this.id, waiting.sent);\n if (left) break;\n this.queue.delete(tile);\n waiting.uploaded();\n if (!within()) break;\n }\n if (this.queue.size > 0) this.flushSoon();\n this.map.requestRender();\n }\n\n /** Sends a tile to the engine (its blocks' first part); its key */\n private upload(tile: string, vectors: TileVectors): number {\n const key = this.tiles.get(tile)?.key ?? this.nextKey++;\n const { properties, sublayer } = vectors;\n\n this.tiles.set(tile, { key, vectors: { properties, sublayer } });\n this.sendTile(this.map.engine, this.id, key, vectors);\n\n return key;\n }\n\n /** @internal New styles of a tile's features, as the workers evaluated them (the same features) */\n setTileStyles(tile: string, styles: Float32Array): void {\n const waiting = this.queue.get(tile);\n\n // Not uploaded yet: uploaded with them\n if (waiting && waiting.sent === undefined) {\n if (styles.length === waiting.vectors.properties.length * FLOATS) waiting.vectors.styles = styles;\n\n return;\n }\n\n const t = this.tiles.get(tile);\n\n if (!t || styles.length !== t.vectors.properties.length * FLOATS) return;\n this.map.engine.setFeatureStyle(this.id, styles, t.key);\n this.map.requestRender();\n }\n\n override remove(): void {\n super.remove();\n this.dispose();\n }\n\n /** @internal The tiles waiting resolved (dropped), none held */\n override dispose(): void {\n this.queue.forEach((waiting) => {\n waiting.uploaded();\n });\n this.queue.clear();\n this.tiles.clear();\n }\n\n /** @internal */\n removeTile(tile: string): void {\n this.queue.get(tile)?.uploaded();\n this.queue.delete(tile);\n\n const t = this.tiles.get(tile);\n\n if (!t) return;\n this.tiles.delete(tile);\n this.map.engine.removeVectorTile(this.id, t.key);\n this.map.requestRender();\n }\n\n /** The feature of a picked index (no geometry: the tiles hold it cut), its properties and style layer. Tiles are\n * numbered one after the other, in the order they were first added */\n featureAt(index: number): VectorFeature | undefined {\n const tiles = [...this.tiles.values()].sort((a, b) => a.key - b.key);\n // The tile holding the index, and the index among its features (one pass, the features of the tiles before\n // taken off)\n const { tile, rest } = tiles.reduce<{ tile?: Tile; rest: number }>(\n (found, t) => {\n if (found.tile) return found;\n\n const count = t.vectors.properties.length;\n\n return found.rest < count ? { tile: t, rest: found.rest } : { rest: found.rest - count };\n },\n { rest: index },\n );\n\n if (!tile) return undefined;\n\n const properties = tile.vectors.properties[rest];\n const sublayer = this.sublayers[tile.vectors.sublayer[rest] ?? -1];\n\n if (properties === undefined || !sublayer) return undefined;\n\n return { type: 'Feature', properties, geometry: null, layer: sublayer.id, sourceLayer: sublayer.sourceLayer };\n }\n\n /** Changes a paint property of a style layer drawn, as MapLibre's `setPaintProperty`: the tiles are restyled, not cut\n * again */\n setPaintProperty(layer: string, name: string, value: unknown): void {\n this.restyle?.(layer, 'paint', name, value);\n }\n\n /** Changes a layout property of a style layer drawn (`visibility`: shown or hidden at once), as MapLibre's\n * `setLayoutProperty` */\n setLayoutProperty(layer: string, name: string, value: unknown): void {\n this.restyle?.(layer, 'layout', name, value);\n }\n\n /** Whether its buildings' walls show their windows: glass by day, some lit at night (only the lit ones without) */\n setFacades(facades: boolean): void {\n this.facades = facades;\n this.map.engine.setFacades(this.id, facades);\n // Its 3D buildings' walls too\n this.buildings3d?.setFacades(facades);\n this.map.requestRender();\n }\n\n setVisible(visible: boolean): void {\n this.shown = visible;\n this.sendSublayers(this.map.engine, this.id);\n this.map.requestRender();\n }\n\n private sendSublayers(engine: Engine, id: number): void {\n const s = this.sublayers;\n\n engine.setVectorSublayers(\n id,\n Uint8Array.from(s, (l) => ({ fill: 0, line: 1, extrusion: 2, circle: 3 })[l.kind]),\n Float64Array.from(s.flatMap((l) => [l.minZoom, l.maxZoom])),\n Uint8Array.from(s, (l) => (l.visible && this.shown ? 1 : 0)),\n Float32Array.from(s.flatMap((l) => l.dash)),\n Float32Array.from(s.flatMap((l) => stops(l.opacity))),\n Uint8Array.from(s, (l) => ({ butt: 0, round: 1, square: 2 })[l.cap]),\n Uint8Array.from(s, (l) => (l.lit ? 1 : 0)),\n Float32Array.from(s.flatMap((l) => [{ round: 0, miter: 1, bevel: 2 }[l.join ?? 'round'], l.miterLimit ?? 2])),\n Float32Array.from(s.flatMap((l) => [...(l.translate ?? [0, 0]), l.translateAnchor === 'viewport' ? 1 : 0])),\n Uint8Array.from(s, (l) => (l.patterned ? 1 : 0)),\n );\n }\n\n /** A tile to the engine: its mesh uploaded as it is, or without one its geometry, which the engine makes ready */\n private sendTile(engine: Engine, id: number, key: number, vectors: TileVectors): void {\n const { fills, lines, circles, styles, sublayer, mesh } = vectors;\n\n if (mesh) {\n engine.setVectorTileMesh(\n id,\n key,\n fills.points,\n fills.ringStart,\n fills.polygonStart,\n fills.feature,\n fills.fillStart,\n mesh.vertices,\n mesh.indices,\n mesh.fillRanges,\n mesh.prism,\n mesh.pieces,\n mesh.lineTable,\n mesh.lineRanges,\n mesh.blocks,\n mesh.blockIndices,\n mesh.blockRanges,\n mesh.bounds,\n sublayer,\n );\n } else {\n engine.setVectorTile(\n id,\n key,\n fills.points,\n fills.ringStart,\n fills.polygonStart,\n fills.feature,\n fills.fillStart,\n lines.points,\n lines.start,\n lines.feature,\n lines.lineStart,\n sublayer,\n vectors.tile ?? new Float64Array(),\n fills.roofs ?? new Uint8Array(),\n fills.roofHeights ?? new Float32Array(),\n fills.roofOutlines ?? new Float64Array(),\n fills.roofOutlineStart ?? new Uint32Array(),\n fills.roofMetres ?? 0,\n );\n }\n // The circles' points, once the tile is there\n if (circles) engine.setVectorTilePoints(id, key, circles.points, circles.feature, circles.circleStart);\n engine.setFeatureStyle(id, styles, key);\n }\n\n /** @internal */\n protected create(engine: Engine): number {\n const id = engine.addVectorTiles();\n\n this.sendSublayers(engine, id);\n engine.setFacades(id, this.facades);\n // An engine made anew (after a context loss, or the one with 3D Tiles): its tiles cut again by the workers, once\n // the layer has its id there. Keeping their geometry here would double the memory they take\n this.dispose();\n queueMicrotask(() => this.recut?.());\n\n return id;\n }\n}\n"]}
@@ -933,14 +933,14 @@ export class Engine {
933
933
  * end of each), its line pieces (`pieces::Piece` as bytes), the line table (feature and length of each line),
934
934
  * per sublayer its pieces (`line_ranges`: first, end), the blocks of its extrusion sublayers (`shapes::Block` as
935
935
  * bytes), their triangles, per sublayer its blocks' triangles (`block_ranges`: first, end), the extent of its
936
- * points (`bounds`: min x, min y, max x, max y), `feature_count` features
936
+ * points (`bounds`: min x, min y, max x, max y), its features' sublayers (one each, as for `setVectorTile`)
937
937
  *
938
938
  * # Errors
939
939
  *
940
940
  * Throws (to JavaScript) when the vertices, pieces or blocks are cut short, when a WebGL object of the tile cannot be
941
941
  * created, or when its features or lines need a table texture past the GPU's `MAX_TEXTURE_SIZE`
942
942
  */
943
- setVectorTileMesh(id: number, key: number, points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, polygon_feature: Uint32Array, fill_start: Uint32Array, vertices: Uint8Array, indices: Uint32Array, fill_ranges: Uint32Array, prism: boolean, pieces: Uint8Array, line_table: Float32Array, line_ranges: Uint32Array, blocks: Uint8Array, block_indices: Uint32Array, block_ranges: Uint32Array, bounds: Float64Array, feature_count: number): void;
943
+ setVectorTileMesh(id: number, key: number, points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, polygon_feature: Uint32Array, fill_start: Uint32Array, vertices: Uint8Array, indices: Uint32Array, fill_ranges: Uint32Array, prism: boolean, pieces: Uint8Array, line_table: Float32Array, line_ranges: Uint32Array, blocks: Uint8Array, block_indices: Uint32Array, block_ranges: Uint32Array, bounds: Float64Array, feature_sublayer: Uint16Array): void;
944
944
  /**
945
945
  * The points of tile `key` of a vector tile layer, after the tile itself (`setVectorTile`, `setVectorTileMesh`):
946
946
  * Mercator, interleaved, each with its feature (styled as a circle's: a color, a radius and a stroke width, then the
@@ -950,7 +950,8 @@ export class Engine {
950
950
  /**
951
951
  * Adds or replaces tile `key` of a vector tile layer: its polygons as for `addFills` (`fill_start`: the first
952
952
  * polygon of each sublayer, and the end; those of an extrusion sublayer raised into blocks), its lines as for
953
- * `addLines` (`line_start`: the first line of each sublayer, and the end), `feature_count` features, styled as an
953
+ * `addLines` (`line_start`: the first line of each sublayer, and the end), its features' sublayers (one each, the
954
+ * features of a sublayer after those of the one before), styled as an
954
955
  * extrusion layer's (`setFeatureStyle` with the key: a color, then a line's width or a block's height and base);
955
956
  * `tile`: the corners of the tile they are cut to (west, north, east, south; empty: none), along whose edges no
956
957
  * wall of a block rises; `roofs` and `roof_heights`: per polygon, the shape and height of its block's roof
@@ -964,7 +965,7 @@ export class Engine {
964
965
  * Throws (to JavaScript) when a WebGL object of the tile cannot be created, or when its features or lines need a
965
966
  * table texture past the GPU's `MAX_TEXTURE_SIZE`
966
967
  */
967
- setVectorTile(id: number, key: number, points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, polygon_feature: Uint32Array, fill_start: Uint32Array, line_points: Float64Array, line_first: Uint32Array, line_feature: Uint32Array, line_start: Uint32Array, feature_count: number, tile: Float64Array, roofs: Uint8Array, roof_heights: Float32Array, roof_outlines: Float64Array, roof_outline_start: Uint32Array, roof_metres: number): void;
968
+ setVectorTile(id: number, key: number, points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, polygon_feature: Uint32Array, fill_start: Uint32Array, line_points: Float64Array, line_first: Uint32Array, line_feature: Uint32Array, line_start: Uint32Array, feature_sublayer: Uint16Array, tile: Float64Array, roofs: Uint8Array, roof_heights: Float32Array, roof_outlines: Float64Array, roof_outline_start: Uint32Array, roof_metres: number): void;
968
969
  /**
969
970
  * Shows what can be seen from points, each within its range: `observers` holds 8 numbers per observer
970
971
  * (16 at most): longitude, latitude (degrees), metres above the ground, range (metres), then to look one way
@@ -1186,8 +1187,8 @@ export interface InitOutput {
1186
1187
  readonly engine_setTiles3dFeatureColors: (a: number, b: number, c: any) => void;
1187
1188
  readonly engine_setTiles3dStyle: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
1188
1189
  readonly engine_setVectorSublayers: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number) => void;
1189
- readonly engine_setVectorTile: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number, g1: number) => [number, number];
1190
- readonly engine_setVectorTileMesh: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number, g1: number, h1: number, i1: number) => [number, number];
1190
+ readonly engine_setVectorTile: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number, g1: number, h1: number) => [number, number];
1191
+ readonly engine_setVectorTileMesh: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number, g1: number, h1: number, i1: number, j1: number) => [number, number];
1191
1192
  readonly engine_setVectorTilePoints: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
1192
1193
  readonly engine_setViewshed: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
1193
1194
  readonly engine_setZoomRange: (a: number, b: number, c: number) => void;
@@ -1550,7 +1550,7 @@ export class Engine {
1550
1550
  * end of each), its line pieces (`pieces::Piece` as bytes), the line table (feature and length of each line),
1551
1551
  * per sublayer its pieces (`line_ranges`: first, end), the blocks of its extrusion sublayers (`shapes::Block` as
1552
1552
  * bytes), their triangles, per sublayer its blocks' triangles (`block_ranges`: first, end), the extent of its
1553
- * points (`bounds`: min x, min y, max x, max y), `feature_count` features
1553
+ * points (`bounds`: min x, min y, max x, max y), its features' sublayers (one each, as for `setVectorTile`)
1554
1554
  *
1555
1555
  * # Errors
1556
1556
  *
@@ -1574,9 +1574,9 @@ export class Engine {
1574
1574
  * @param {Uint32Array} block_indices
1575
1575
  * @param {Uint32Array} block_ranges
1576
1576
  * @param {Float64Array} bounds
1577
- * @param {number} feature_count
1577
+ * @param {Uint16Array} feature_sublayer
1578
1578
  */
1579
- setVectorTileMesh(id, key, points, ring_start, polygon_start, polygon_feature, fill_start, vertices, indices, fill_ranges, prism, pieces, line_table, line_ranges, blocks, block_indices, block_ranges, bounds, feature_count) {
1579
+ setVectorTileMesh(id, key, points, ring_start, polygon_start, polygon_feature, fill_start, vertices, indices, fill_ranges, prism, pieces, line_table, line_ranges, blocks, block_indices, block_ranges, bounds, feature_sublayer) {
1580
1580
  const ptr0 = passArrayF64ToWasm0(points, wasm.__wbindgen_malloc);
1581
1581
  const len0 = WASM_VECTOR_LEN;
1582
1582
  const ptr1 = passArray32ToWasm0(ring_start, wasm.__wbindgen_malloc);
@@ -1607,7 +1607,9 @@ export class Engine {
1607
1607
  const len13 = WASM_VECTOR_LEN;
1608
1608
  const ptr14 = passArrayF64ToWasm0(bounds, wasm.__wbindgen_malloc);
1609
1609
  const len14 = WASM_VECTOR_LEN;
1610
- const ret = wasm.engine_setVectorTileMesh(this.__wbg_ptr, id, key, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, prism, ptr8, len8, ptr9, len9, ptr10, len10, ptr11, len11, ptr12, len12, ptr13, len13, ptr14, len14, feature_count);
1610
+ const ptr15 = passArray16ToWasm0(feature_sublayer, wasm.__wbindgen_malloc);
1611
+ const len15 = WASM_VECTOR_LEN;
1612
+ const ret = wasm.engine_setVectorTileMesh(this.__wbg_ptr, id, key, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, prism, ptr8, len8, ptr9, len9, ptr10, len10, ptr11, len11, ptr12, len12, ptr13, len13, ptr14, len14, ptr15, len15);
1611
1613
  if (ret[1]) {
1612
1614
  throw takeFromExternrefTable0(ret[0]);
1613
1615
  }
@@ -1634,7 +1636,8 @@ export class Engine {
1634
1636
  /**
1635
1637
  * Adds or replaces tile `key` of a vector tile layer: its polygons as for `addFills` (`fill_start`: the first
1636
1638
  * polygon of each sublayer, and the end; those of an extrusion sublayer raised into blocks), its lines as for
1637
- * `addLines` (`line_start`: the first line of each sublayer, and the end), `feature_count` features, styled as an
1639
+ * `addLines` (`line_start`: the first line of each sublayer, and the end), its features' sublayers (one each, the
1640
+ * features of a sublayer after those of the one before), styled as an
1638
1641
  * extrusion layer's (`setFeatureStyle` with the key: a color, then a line's width or a block's height and base);
1639
1642
  * `tile`: the corners of the tile they are cut to (west, north, east, south; empty: none), along whose edges no
1640
1643
  * wall of a block rises; `roofs` and `roof_heights`: per polygon, the shape and height of its block's roof
@@ -1658,7 +1661,7 @@ export class Engine {
1658
1661
  * @param {Uint32Array} line_first
1659
1662
  * @param {Uint32Array} line_feature
1660
1663
  * @param {Uint32Array} line_start
1661
- * @param {number} feature_count
1664
+ * @param {Uint16Array} feature_sublayer
1662
1665
  * @param {Float64Array} tile
1663
1666
  * @param {Uint8Array} roofs
1664
1667
  * @param {Float32Array} roof_heights
@@ -1666,7 +1669,7 @@ export class Engine {
1666
1669
  * @param {Uint32Array} roof_outline_start
1667
1670
  * @param {number} roof_metres
1668
1671
  */
1669
- setVectorTile(id, key, points, ring_start, polygon_start, polygon_feature, fill_start, line_points, line_first, line_feature, line_start, feature_count, tile, roofs, roof_heights, roof_outlines, roof_outline_start, roof_metres) {
1672
+ setVectorTile(id, key, points, ring_start, polygon_start, polygon_feature, fill_start, line_points, line_first, line_feature, line_start, feature_sublayer, tile, roofs, roof_heights, roof_outlines, roof_outline_start, roof_metres) {
1670
1673
  const ptr0 = passArrayF64ToWasm0(points, wasm.__wbindgen_malloc);
1671
1674
  const len0 = WASM_VECTOR_LEN;
1672
1675
  const ptr1 = passArray32ToWasm0(ring_start, wasm.__wbindgen_malloc);
@@ -1685,17 +1688,19 @@ export class Engine {
1685
1688
  const len7 = WASM_VECTOR_LEN;
1686
1689
  const ptr8 = passArray32ToWasm0(line_start, wasm.__wbindgen_malloc);
1687
1690
  const len8 = WASM_VECTOR_LEN;
1688
- const ptr9 = passArrayF64ToWasm0(tile, wasm.__wbindgen_malloc);
1691
+ const ptr9 = passArray16ToWasm0(feature_sublayer, wasm.__wbindgen_malloc);
1689
1692
  const len9 = WASM_VECTOR_LEN;
1690
- const ptr10 = passArray8ToWasm0(roofs, wasm.__wbindgen_malloc);
1693
+ const ptr10 = passArrayF64ToWasm0(tile, wasm.__wbindgen_malloc);
1691
1694
  const len10 = WASM_VECTOR_LEN;
1692
- const ptr11 = passArrayF32ToWasm0(roof_heights, wasm.__wbindgen_malloc);
1695
+ const ptr11 = passArray8ToWasm0(roofs, wasm.__wbindgen_malloc);
1693
1696
  const len11 = WASM_VECTOR_LEN;
1694
- const ptr12 = passArrayF64ToWasm0(roof_outlines, wasm.__wbindgen_malloc);
1697
+ const ptr12 = passArrayF32ToWasm0(roof_heights, wasm.__wbindgen_malloc);
1695
1698
  const len12 = WASM_VECTOR_LEN;
1696
- const ptr13 = passArray32ToWasm0(roof_outline_start, wasm.__wbindgen_malloc);
1699
+ const ptr13 = passArrayF64ToWasm0(roof_outlines, wasm.__wbindgen_malloc);
1697
1700
  const len13 = WASM_VECTOR_LEN;
1698
- const ret = wasm.engine_setVectorTile(this.__wbg_ptr, id, key, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8, feature_count, ptr9, len9, ptr10, len10, ptr11, len11, ptr12, len12, ptr13, len13, roof_metres);
1701
+ const ptr14 = passArray32ToWasm0(roof_outline_start, wasm.__wbindgen_malloc);
1702
+ const len14 = WASM_VECTOR_LEN;
1703
+ const ret = wasm.engine_setVectorTile(this.__wbg_ptr, id, key, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8, ptr9, len9, ptr10, len10, ptr11, len11, ptr12, len12, ptr13, len13, ptr14, len14, roof_metres);
1699
1704
  if (ret[1]) {
1700
1705
  throw takeFromExternrefTable0(ret[0]);
1701
1706
  }
@@ -3185,7 +3190,7 @@ function __wbg_get_imports() {
3185
3190
  return ret;
3186
3191
  },
3187
3192
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
3188
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 229, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3193
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 230, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3189
3194
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_2e566c63402fe7fa___convert__closures_____invoke___wasm_bindgen_2e566c63402fe7fa___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_2e566c63402fe7fa___JsError___true_);
3190
3195
  return ret;
3191
3196
  },
@@ -3508,6 +3513,13 @@ function makeMutClosure(arg0, arg1, f) {
3508
3513
  return real;
3509
3514
  }
3510
3515
 
3516
+ function passArray16ToWasm0(arg, malloc) {
3517
+ const ptr = malloc(arg.length * 2, 2) >>> 0;
3518
+ getUint16ArrayMemory0().set(arg, ptr / 2);
3519
+ WASM_VECTOR_LEN = arg.length;
3520
+ return ptr;
3521
+ }
3522
+
3511
3523
  function passArray32ToWasm0(arg, malloc) {
3512
3524
  const ptr = malloc(arg.length * 4, 4) >>> 0;
3513
3525
  getUint32ArrayMemory0().set(arg, ptr / 4);
@@ -620,14 +620,14 @@ export class Engine {
620
620
  * end of each), its line pieces (`pieces::Piece` as bytes), the line table (feature and length of each line),
621
621
  * per sublayer its pieces (`line_ranges`: first, end), the blocks of its extrusion sublayers (`shapes::Block` as
622
622
  * bytes), their triangles, per sublayer its blocks' triangles (`block_ranges`: first, end), the extent of its
623
- * points (`bounds`: min x, min y, max x, max y), `feature_count` features
623
+ * points (`bounds`: min x, min y, max x, max y), its features' sublayers (one each, as for `setVectorTile`)
624
624
  *
625
625
  * # Errors
626
626
  *
627
627
  * Throws (to JavaScript) when the vertices, pieces or blocks are cut short, when a WebGL object of the tile cannot be
628
628
  * created, or when its features or lines need a table texture past the GPU's `MAX_TEXTURE_SIZE`
629
629
  */
630
- setVectorTileMesh(id: number, key: number, points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, polygon_feature: Uint32Array, fill_start: Uint32Array, vertices: Uint8Array, indices: Uint32Array, fill_ranges: Uint32Array, prism: boolean, pieces: Uint8Array, line_table: Float32Array, line_ranges: Uint32Array, blocks: Uint8Array, block_indices: Uint32Array, block_ranges: Uint32Array, bounds: Float64Array, feature_count: number): void;
630
+ setVectorTileMesh(id: number, key: number, points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, polygon_feature: Uint32Array, fill_start: Uint32Array, vertices: Uint8Array, indices: Uint32Array, fill_ranges: Uint32Array, prism: boolean, pieces: Uint8Array, line_table: Float32Array, line_ranges: Uint32Array, blocks: Uint8Array, block_indices: Uint32Array, block_ranges: Uint32Array, bounds: Float64Array, feature_sublayer: Uint16Array): void;
631
631
  /**
632
632
  * The points of tile `key` of a vector tile layer, after the tile itself (`setVectorTile`, `setVectorTileMesh`):
633
633
  * Mercator, interleaved, each with its feature (styled as a circle's: a color, a radius and a stroke width, then the
@@ -637,7 +637,8 @@ export class Engine {
637
637
  /**
638
638
  * Adds or replaces tile `key` of a vector tile layer: its polygons as for `addFills` (`fill_start`: the first
639
639
  * polygon of each sublayer, and the end; those of an extrusion sublayer raised into blocks), its lines as for
640
- * `addLines` (`line_start`: the first line of each sublayer, and the end), `feature_count` features, styled as an
640
+ * `addLines` (`line_start`: the first line of each sublayer, and the end), its features' sublayers (one each, the
641
+ * features of a sublayer after those of the one before), styled as an
641
642
  * extrusion layer's (`setFeatureStyle` with the key: a color, then a line's width or a block's height and base);
642
643
  * `tile`: the corners of the tile they are cut to (west, north, east, south; empty: none), along whose edges no
643
644
  * wall of a block rises; `roofs` and `roof_heights`: per polygon, the shape and height of its block's roof
@@ -651,7 +652,7 @@ export class Engine {
651
652
  * Throws (to JavaScript) when a WebGL object of the tile cannot be created, or when its features or lines need a
652
653
  * table texture past the GPU's `MAX_TEXTURE_SIZE`
653
654
  */
654
- setVectorTile(id: number, key: number, points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, polygon_feature: Uint32Array, fill_start: Uint32Array, line_points: Float64Array, line_first: Uint32Array, line_feature: Uint32Array, line_start: Uint32Array, feature_count: number, tile: Float64Array, roofs: Uint8Array, roof_heights: Float32Array, roof_outlines: Float64Array, roof_outline_start: Uint32Array, roof_metres: number): void;
655
+ setVectorTile(id: number, key: number, points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, polygon_feature: Uint32Array, fill_start: Uint32Array, line_points: Float64Array, line_first: Uint32Array, line_feature: Uint32Array, line_start: Uint32Array, feature_sublayer: Uint16Array, tile: Float64Array, roofs: Uint8Array, roof_heights: Float32Array, roof_outlines: Float64Array, roof_outline_start: Uint32Array, roof_metres: number): void;
655
656
  /**
656
657
  * Shows what can be seen from points, each within its range: `observers` holds 8 numbers per observer
657
658
  * (16 at most): longitude, latitude (degrees), metres above the ground, range (metres), then to look one way
@@ -826,8 +827,8 @@ export interface InitOutput {
826
827
  readonly engine_setSymbols: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number];
827
828
  readonly engine_setTerrain: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
828
829
  readonly engine_setVectorSublayers: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number) => void;
829
- readonly engine_setVectorTile: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number, g1: number) => [number, number];
830
- readonly engine_setVectorTileMesh: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number, g1: number, h1: number, i1: number) => [number, number];
830
+ readonly engine_setVectorTile: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number, g1: number, h1: number) => [number, number];
831
+ readonly engine_setVectorTileMesh: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number, g1: number, h1: number, i1: number, j1: number) => [number, number];
831
832
  readonly engine_setVectorTilePoints: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
832
833
  readonly engine_setViewshed: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
833
834
  readonly engine_setZoomRange: (a: number, b: number, c: number) => void;
@@ -1310,7 +1310,7 @@ export class Engine {
1310
1310
  * end of each), its line pieces (`pieces::Piece` as bytes), the line table (feature and length of each line),
1311
1311
  * per sublayer its pieces (`line_ranges`: first, end), the blocks of its extrusion sublayers (`shapes::Block` as
1312
1312
  * bytes), their triangles, per sublayer its blocks' triangles (`block_ranges`: first, end), the extent of its
1313
- * points (`bounds`: min x, min y, max x, max y), `feature_count` features
1313
+ * points (`bounds`: min x, min y, max x, max y), its features' sublayers (one each, as for `setVectorTile`)
1314
1314
  *
1315
1315
  * # Errors
1316
1316
  *
@@ -1334,9 +1334,9 @@ export class Engine {
1334
1334
  * @param {Uint32Array} block_indices
1335
1335
  * @param {Uint32Array} block_ranges
1336
1336
  * @param {Float64Array} bounds
1337
- * @param {number} feature_count
1337
+ * @param {Uint16Array} feature_sublayer
1338
1338
  */
1339
- setVectorTileMesh(id, key, points, ring_start, polygon_start, polygon_feature, fill_start, vertices, indices, fill_ranges, prism, pieces, line_table, line_ranges, blocks, block_indices, block_ranges, bounds, feature_count) {
1339
+ setVectorTileMesh(id, key, points, ring_start, polygon_start, polygon_feature, fill_start, vertices, indices, fill_ranges, prism, pieces, line_table, line_ranges, blocks, block_indices, block_ranges, bounds, feature_sublayer) {
1340
1340
  const ptr0 = passArrayF64ToWasm0(points, wasm.__wbindgen_malloc);
1341
1341
  const len0 = WASM_VECTOR_LEN;
1342
1342
  const ptr1 = passArray32ToWasm0(ring_start, wasm.__wbindgen_malloc);
@@ -1367,7 +1367,9 @@ export class Engine {
1367
1367
  const len13 = WASM_VECTOR_LEN;
1368
1368
  const ptr14 = passArrayF64ToWasm0(bounds, wasm.__wbindgen_malloc);
1369
1369
  const len14 = WASM_VECTOR_LEN;
1370
- const ret = wasm.engine_setVectorTileMesh(this.__wbg_ptr, id, key, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, prism, ptr8, len8, ptr9, len9, ptr10, len10, ptr11, len11, ptr12, len12, ptr13, len13, ptr14, len14, feature_count);
1370
+ const ptr15 = passArray16ToWasm0(feature_sublayer, wasm.__wbindgen_malloc);
1371
+ const len15 = WASM_VECTOR_LEN;
1372
+ const ret = wasm.engine_setVectorTileMesh(this.__wbg_ptr, id, key, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, prism, ptr8, len8, ptr9, len9, ptr10, len10, ptr11, len11, ptr12, len12, ptr13, len13, ptr14, len14, ptr15, len15);
1371
1373
  if (ret[1]) {
1372
1374
  throw takeFromExternrefTable0(ret[0]);
1373
1375
  }
@@ -1394,7 +1396,8 @@ export class Engine {
1394
1396
  /**
1395
1397
  * Adds or replaces tile `key` of a vector tile layer: its polygons as for `addFills` (`fill_start`: the first
1396
1398
  * polygon of each sublayer, and the end; those of an extrusion sublayer raised into blocks), its lines as for
1397
- * `addLines` (`line_start`: the first line of each sublayer, and the end), `feature_count` features, styled as an
1399
+ * `addLines` (`line_start`: the first line of each sublayer, and the end), its features' sublayers (one each, the
1400
+ * features of a sublayer after those of the one before), styled as an
1398
1401
  * extrusion layer's (`setFeatureStyle` with the key: a color, then a line's width or a block's height and base);
1399
1402
  * `tile`: the corners of the tile they are cut to (west, north, east, south; empty: none), along whose edges no
1400
1403
  * wall of a block rises; `roofs` and `roof_heights`: per polygon, the shape and height of its block's roof
@@ -1418,7 +1421,7 @@ export class Engine {
1418
1421
  * @param {Uint32Array} line_first
1419
1422
  * @param {Uint32Array} line_feature
1420
1423
  * @param {Uint32Array} line_start
1421
- * @param {number} feature_count
1424
+ * @param {Uint16Array} feature_sublayer
1422
1425
  * @param {Float64Array} tile
1423
1426
  * @param {Uint8Array} roofs
1424
1427
  * @param {Float32Array} roof_heights
@@ -1426,7 +1429,7 @@ export class Engine {
1426
1429
  * @param {Uint32Array} roof_outline_start
1427
1430
  * @param {number} roof_metres
1428
1431
  */
1429
- setVectorTile(id, key, points, ring_start, polygon_start, polygon_feature, fill_start, line_points, line_first, line_feature, line_start, feature_count, tile, roofs, roof_heights, roof_outlines, roof_outline_start, roof_metres) {
1432
+ setVectorTile(id, key, points, ring_start, polygon_start, polygon_feature, fill_start, line_points, line_first, line_feature, line_start, feature_sublayer, tile, roofs, roof_heights, roof_outlines, roof_outline_start, roof_metres) {
1430
1433
  const ptr0 = passArrayF64ToWasm0(points, wasm.__wbindgen_malloc);
1431
1434
  const len0 = WASM_VECTOR_LEN;
1432
1435
  const ptr1 = passArray32ToWasm0(ring_start, wasm.__wbindgen_malloc);
@@ -1445,17 +1448,19 @@ export class Engine {
1445
1448
  const len7 = WASM_VECTOR_LEN;
1446
1449
  const ptr8 = passArray32ToWasm0(line_start, wasm.__wbindgen_malloc);
1447
1450
  const len8 = WASM_VECTOR_LEN;
1448
- const ptr9 = passArrayF64ToWasm0(tile, wasm.__wbindgen_malloc);
1451
+ const ptr9 = passArray16ToWasm0(feature_sublayer, wasm.__wbindgen_malloc);
1449
1452
  const len9 = WASM_VECTOR_LEN;
1450
- const ptr10 = passArray8ToWasm0(roofs, wasm.__wbindgen_malloc);
1453
+ const ptr10 = passArrayF64ToWasm0(tile, wasm.__wbindgen_malloc);
1451
1454
  const len10 = WASM_VECTOR_LEN;
1452
- const ptr11 = passArrayF32ToWasm0(roof_heights, wasm.__wbindgen_malloc);
1455
+ const ptr11 = passArray8ToWasm0(roofs, wasm.__wbindgen_malloc);
1453
1456
  const len11 = WASM_VECTOR_LEN;
1454
- const ptr12 = passArrayF64ToWasm0(roof_outlines, wasm.__wbindgen_malloc);
1457
+ const ptr12 = passArrayF32ToWasm0(roof_heights, wasm.__wbindgen_malloc);
1455
1458
  const len12 = WASM_VECTOR_LEN;
1456
- const ptr13 = passArray32ToWasm0(roof_outline_start, wasm.__wbindgen_malloc);
1459
+ const ptr13 = passArrayF64ToWasm0(roof_outlines, wasm.__wbindgen_malloc);
1457
1460
  const len13 = WASM_VECTOR_LEN;
1458
- const ret = wasm.engine_setVectorTile(this.__wbg_ptr, id, key, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8, feature_count, ptr9, len9, ptr10, len10, ptr11, len11, ptr12, len12, ptr13, len13, roof_metres);
1461
+ const ptr14 = passArray32ToWasm0(roof_outline_start, wasm.__wbindgen_malloc);
1462
+ const len14 = WASM_VECTOR_LEN;
1463
+ const ret = wasm.engine_setVectorTile(this.__wbg_ptr, id, key, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8, ptr9, len9, ptr10, len10, ptr11, len11, ptr12, len12, ptr13, len13, ptr14, len14, roof_metres);
1459
1464
  if (ret[1]) {
1460
1465
  throw takeFromExternrefTable0(ret[0]);
1461
1466
  }
@@ -2995,6 +3000,13 @@ function makeMutClosure(arg0, arg1, f) {
2995
3000
  return real;
2996
3001
  }
2997
3002
 
3003
+ function passArray16ToWasm0(arg, malloc) {
3004
+ const ptr = malloc(arg.length * 2, 2) >>> 0;
3005
+ getUint16ArrayMemory0().set(arg, ptr / 2);
3006
+ WASM_VECTOR_LEN = arg.length;
3007
+ return ptr;
3008
+ }
3009
+
2998
3010
  function passArray32ToWasm0(arg, malloc) {
2999
3011
  const ptr = malloc(arg.length * 4, 4) >>> 0;
3000
3012
  getUint32ArrayMemory0().set(arg, ptr / 4);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isard",
3
- "version": "1.13.0",
3
+ "version": "1.15.0",
4
4
  "description": "A WebGL2 map engine for large, interactive data layers, labels and 3D Tiles over raster or vector basemaps (Rust core in WebAssembly)",
5
5
  "license": "MIT",
6
6
  "author": "Kevin Graff",