isard 0.8.0 → 1.1.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 +47 -0
- package/dist/{basemaps.d.ts → basemap/basemaps.d.ts} +4 -4
- package/dist/{basemaps.js → basemap/basemaps.js} +3 -15
- package/dist/basemap/basemaps.js.map +1 -0
- package/dist/{grid.d.ts → basemap/grid.d.ts} +1 -1
- package/dist/{grid.js → basemap/grid.js} +2 -2
- package/dist/basemap/grid.js.map +1 -0
- package/dist/basemap/mvt.js.map +1 -0
- package/dist/{pmtiles.d.ts → basemap/pmtiles.d.ts} +6 -0
- package/dist/{pmtiles.js → basemap/pmtiles.js} +2 -2
- package/dist/basemap/pmtiles.js.map +1 -0
- package/dist/{resample.d.ts → basemap/resample.d.ts} +9 -0
- package/dist/{resample.js → basemap/resample.js} +2 -2
- package/dist/basemap/resample.js.map +1 -0
- package/dist/{terrain.js → basemap/terrain.js} +1 -1
- package/dist/basemap/terrain.js.map +1 -0
- package/dist/{vectorstyle.js → basemap/vectorstyle.js} +1 -1
- package/dist/basemap/vectorstyle.js.map +1 -0
- package/dist/{vectortiles.d.ts → basemap/vectortiles.d.ts} +9 -9
- package/dist/{vectortiles.js → basemap/vectortiles.js} +19 -8
- package/dist/basemap/vectortiles.js.map +1 -0
- package/dist/{wmts.js → basemap/wmts.js} +3 -3
- package/dist/basemap/wmts.js.map +1 -0
- package/dist/basemap.worker.js +2 -2
- package/dist/basemap.worker.js.map +10 -10
- package/dist/bind/layers.d.ts +37 -0
- package/dist/bind/layers.js +130 -0
- package/dist/bind/layers.js.map +1 -0
- package/dist/{crs.d.ts → data/crs.d.ts} +1 -1
- package/dist/data/crs.js.map +1 -0
- package/dist/{gpx.d.ts → data/gpx.d.ts} +1 -1
- package/dist/data/gpx.js.map +1 -0
- package/dist/{kml.d.ts → data/kml.d.ts} +1 -1
- package/dist/data/kml.js.map +1 -0
- package/dist/{topojson.d.ts → data/topojson.d.ts} +1 -1
- package/dist/data/topojson.js.map +1 -0
- package/dist/data/xml.js.map +1 -0
- package/dist/decoder.worker.js +1 -1
- package/dist/decoder.worker.js.map +4 -4
- package/dist/{decoders.d.ts → engine/decoders.d.ts} +1 -1
- package/dist/engine/decoders.js.map +1 -0
- package/dist/{loader.d.ts → engine/loader.d.ts} +1 -1
- package/dist/{loader.js → engine/loader.js} +4 -0
- package/dist/engine/loader.js.map +1 -0
- package/dist/{protocol.d.ts → engine/protocol.d.ts} +1 -1
- package/dist/engine/protocol.js +3 -0
- package/dist/engine/protocol.js.map +1 -0
- package/dist/engine/requests.js.map +1 -0
- package/dist/engine-loader.d.ts +16 -5
- package/dist/engine-loader.js +39 -8
- package/dist/engine-loader.js.map +1 -1
- package/dist/formats.d.ts +3 -3
- package/dist/formats.js +3 -3
- package/dist/formats.js.map +1 -1
- package/dist/geoplateforme.d.ts +53 -3
- package/dist/geoplateforme.js +35 -1
- package/dist/geoplateforme.js.map +1 -1
- package/dist/index.d.ts +32 -32
- package/dist/index.js +19 -19
- package/dist/index.js.map +1 -1
- package/dist/isard_bg.wasm +0 -0
- package/dist/isard_core_bg.wasm +0 -0
- package/dist/layers/extrusions.js.map +1 -0
- package/dist/{features.js → layers/features.js} +3 -3
- package/dist/layers/features.js.map +1 -0
- package/dist/{glyphs.d.ts → layers/glyphs.d.ts} +3 -3
- package/dist/{glyphs.js → layers/glyphs.js} +11 -1
- package/dist/layers/glyphs.js.map +1 -0
- package/dist/{icons.d.ts → layers/icons.d.ts} +2 -2
- package/dist/{icons.js → layers/icons.js} +8 -1
- package/dist/layers/icons.js.map +1 -0
- package/dist/{layers.d.ts → layers/layers.d.ts} +11 -5
- package/dist/{layers.js → layers/layers.js} +17 -6
- package/dist/layers/layers.js.map +1 -0
- package/dist/{panoramas.d.ts → layers/panoramas.d.ts} +1 -1
- package/dist/{panoramas.js → layers/panoramas.js} +2 -2
- package/dist/layers/panoramas.js.map +1 -0
- package/dist/{pointclouds.d.ts → layers/pointclouds.d.ts} +2 -2
- package/dist/{pointclouds.js → layers/pointclouds.js} +1 -1
- package/dist/layers/pointclouds.js.map +1 -0
- package/dist/{symbols.d.ts → layers/symbols.d.ts} +2 -2
- package/dist/{symbols.js → layers/symbols.js} +1 -1
- package/dist/layers/symbols.js.map +1 -0
- package/dist/map.d.ts +93 -12
- package/dist/map.js +119 -28
- package/dist/map.js.map +1 -1
- package/dist/projections.d.ts +3 -3
- package/dist/projections.js +2 -2
- package/dist/projections.js.map +1 -1
- package/dist/react/index.d.ts +119 -0
- package/dist/react/index.js +409 -0
- package/dist/react/index.js.map +1 -0
- package/dist/settings.d.ts +1 -1
- package/dist/settings.js +2 -2
- package/dist/settings.js.map +1 -1
- package/dist/types.d.ts +16 -12
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/dist/{controls.d.ts → ui/controls.d.ts} +5 -4
- package/dist/{controls.js → ui/controls.js} +0 -8
- package/dist/ui/controls.js.map +1 -0
- package/dist/{interaction.d.ts → ui/interaction.d.ts} +7 -3
- package/dist/{interaction.js → ui/interaction.js} +1 -1
- package/dist/ui/interaction.js.map +1 -0
- package/dist/{overlay.d.ts → ui/overlay.d.ts} +2 -2
- package/dist/ui/overlay.js.map +1 -0
- package/dist/ui/style.js.map +1 -0
- package/dist/{animation.d.ts → util/animation.d.ts} +6 -2
- package/dist/util/animation.js.map +1 -0
- package/dist/util/color.js.map +1 -0
- package/dist/util/geo.js.map +1 -0
- package/dist/util/lru.js.map +1 -0
- package/dist/{basemap.worker.d.ts → workers/basemap.worker.d.ts} +14 -4
- package/dist/workers/basemap.worker.js +647 -0
- package/dist/workers/basemap.worker.js.map +1 -0
- package/package.json +31 -2
- package/vite.d.ts +17 -0
- package/vite.js +64 -0
- package/dist/animation.js.map +0 -1
- package/dist/basemaps.js.map +0 -1
- package/dist/color.js.map +0 -1
- package/dist/controls.js.map +0 -1
- package/dist/crs.js.map +0 -1
- package/dist/decoders.js.map +0 -1
- package/dist/extrusions.js.map +0 -1
- package/dist/features.js.map +0 -1
- package/dist/geo.js.map +0 -1
- package/dist/glyphs.js.map +0 -1
- package/dist/gpx.js.map +0 -1
- package/dist/grid.js.map +0 -1
- package/dist/icons.js.map +0 -1
- package/dist/interaction.js.map +0 -1
- package/dist/kml.js.map +0 -1
- package/dist/layers.js.map +0 -1
- package/dist/loader.js.map +0 -1
- package/dist/lru.js.map +0 -1
- package/dist/mvt.js.map +0 -1
- package/dist/overlay.js.map +0 -1
- package/dist/panoramas.js.map +0 -1
- package/dist/pmtiles.js.map +0 -1
- package/dist/pointclouds.js.map +0 -1
- package/dist/protocol.js +0 -2
- package/dist/protocol.js.map +0 -1
- package/dist/requests.js.map +0 -1
- package/dist/resample.js.map +0 -1
- package/dist/style.js.map +0 -1
- package/dist/symbols.js.map +0 -1
- package/dist/terrain.js.map +0 -1
- package/dist/topojson.js.map +0 -1
- package/dist/vectorstyle.js.map +0 -1
- package/dist/vectortiles.js.map +0 -1
- package/dist/wmts.js.map +0 -1
- package/dist/xml.js.map +0 -1
- /package/dist/{mvt.d.ts → basemap/mvt.d.ts} +0 -0
- /package/dist/{mvt.js → basemap/mvt.js} +0 -0
- /package/dist/{terrain.d.ts → basemap/terrain.d.ts} +0 -0
- /package/dist/{vectorstyle.d.ts → basemap/vectorstyle.d.ts} +0 -0
- /package/dist/{wmts.d.ts → basemap/wmts.d.ts} +0 -0
- /package/dist/{crs.js → data/crs.js} +0 -0
- /package/dist/{gpx.js → data/gpx.js} +0 -0
- /package/dist/{kml.js → data/kml.js} +0 -0
- /package/dist/{topojson.js → data/topojson.js} +0 -0
- /package/dist/{xml.d.ts → data/xml.d.ts} +0 -0
- /package/dist/{xml.js → data/xml.js} +0 -0
- /package/dist/{decoders.js → engine/decoders.js} +0 -0
- /package/dist/{requests.d.ts → engine/requests.d.ts} +0 -0
- /package/dist/{requests.js → engine/requests.js} +0 -0
- /package/dist/{extrusions.d.ts → layers/extrusions.d.ts} +0 -0
- /package/dist/{extrusions.js → layers/extrusions.js} +0 -0
- /package/dist/{features.d.ts → layers/features.d.ts} +0 -0
- /package/dist/{overlay.js → ui/overlay.js} +0 -0
- /package/dist/{style.d.ts → ui/style.d.ts} +0 -0
- /package/dist/{style.js → ui/style.js} +0 -0
- /package/dist/{animation.js → util/animation.js} +0 -0
- /package/dist/{color.d.ts → util/color.d.ts} +0 -0
- /package/dist/{color.js → util/color.js} +0 -0
- /package/dist/{geo.d.ts → util/geo.d.ts} +0 -0
- /package/dist/{geo.js → util/geo.js} +0 -0
- /package/dist/{lru.d.ts → util/lru.d.ts} +0 -0
- /package/dist/{lru.js → util/lru.js} +0 -0
package/dist/loader.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAS3D,MAAM,OAAO,UAAU;IAaF;IACA;IACA;IACA;IACA;IAEA;IAlBX,OAAO,GAAa,EAAE,CAAC;IAC/B,oCAAoC;IACnB,IAAI,GAAG,IAAI,GAAG,EAAkB,CAAC;IACjC,OAAO,GAAG,IAAI,GAAG,EAAmB,CAAC;IACtD,+BAA+B;IACvB,MAAM,CAAoB;IAClC,qEAAqE;IACpD,QAAQ,GAAG,aAAa,CAAC,CAAC,KAAK,EAAE,EAAE;QAClD,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO;YAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;IACnF,CAAC,CAAC,CAAC;IAEH,YACmB,MAA0B,EAC1B,SAAuB,EACvB,IAAY,EACZ,QAAqB,EACrB,OAAuB;IACxC,qDAAqD;IACpC,SAAiB,EAAE;QANnB,WAAM,GAAN,MAAM,CAAoB;QAC1B,cAAS,GAAT,SAAS,CAAc;QACvB,SAAI,GAAJ,IAAI,CAAQ;QACZ,aAA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iles content and point clouds. The engine calls `load`, `loadPoints` and `abort`\n * (`TileLoaderLike`); the main thread then only uploads the decoded arrays to the GPU.\n */\nimport type { DecoderUrls } from './decoders.ts';\nimport type { WorkerReply, WorkerRequest } from './protocol.ts';\nimport { headerRules, onHeaderRules } from './requests.ts';\nimport type { DecodedTile, TextureFormats, TileLoaderLike } from './wasm/isard.js';\n\ninterface Pending {\n resolve: (result: DecodedTile | Uint8Array<ArrayBuffer>) => void;\n reject: (error: Error) => void;\n worker: Worker;\n}\n\nexport class TileLoader implements TileLoaderLike {\n private workers: Worker[] = [];\n /** Requests in flight per worker */\n private readonly busy = new Map<Worker, number>();\n private readonly pending = new Map<number, Pending>();\n /** Every worker failed: why */\n private failed: Error | undefined;\n /** The page's request headers, sent to the workers as they change */\n private readonly unfollow = onHeaderRules((rules) => {\n for (const worker of this.workers) this.send(worker, { type: 'headers', rules });\n });\n\n constructor(\n private readonly module: WebAssembly.Module,\n private readonly workerUrl: string | URL,\n private readonly size: number,\n private readonly decoders: DecoderUrls,\n private readonly formats: TextureFormats,\n /** URL of the point cloud module, for the workers */\n private readonly points: string = '',\n ) {}\n\n /** Called by the engine: fetch and decode off the main thread, on the least busy worker */\n load(\n id: number,\n url: string,\n transform: Float64Array,\n yUp: boolean,\n reload: boolean,\n priority?: 'high' | 'low',\n ): Promise<DecodedTile> {\n if (this.failed) return Promise.reject(this.failed);\n const worker = this.leastBusy();\n this.busy.set(worker, (this.busy.get(worker) ?? 0) + 1);\n return new Promise((resolve, reject) => {\n this.pending.set(id, { resolve: resolve as Pending['resolve'], reject, worker });\n this.send(worker, { type: 'load', id, url, transform, yUp, reload, ...(priority ? { priority } : {}) });\n });\n }\n\n /** Called by the engine: the points of a COPC node, fetched (a range request) and decoded off the main thread */\n loadPoints(\n id: number,\n url: string,\n offset: number,\n size: number,\n laz: Uint8Array,\n layout: Float64Array,\n grid: Float64Array,\n count: number,\n priority?: 'high' | 'low',\n ): Promise<Uint8Array<ArrayBuffer>> {\n if (this.failed) return Promise.reject(this.failed);\n const worker = this.leastBusy();\n this.busy.set(worker, (this.busy.get(worker) ?? 0) + 1);\n return new Promise((resolve, reject) => {\n this.pending.set(id, { resolve: resolve as Pending['resolve'], reject, worker });\n const message = { type: 'points', id, url, offset, size, laz, layout, grid, count } as const;\n this.send(worker, { ...message, ...(priority ? { priority } : {}) });\n });\n }\n\n abort(id: number): void {\n const pending = this.pending.get(id);\n if (pending) this.send(pending.worker, { type: 'abort', id });\n }\n\n destroy(): void {\n this.unfollow();\n for (const worker of this.workers) worker.terminate();\n this.workers = [];\n this.busy.clear();\n for (const { reject } of this.pending.values()) reject(new Error('loader destroyed'));\n this.pending.clear();\n }\n\n /** Workers start with the first tile: a map without 3D Tiles costs nothing */\n private leastBusy(): Worker {\n if (this.workers.length === 0) {\n for (let i = 0; i < this.size; i++) {\n const worker = new Worker(this.workerUrl, { type: 'module' });\n worker.onmessage = (event: MessageEvent<WorkerReply>) => this.receive(worker, event.data);\n // A worker that fails to load (a bundler serving it from elsewhere) or to read a message fails its requests\n worker.onerror = (event) => {\n event.preventDefault();\n this.fail(worker, `the decoding worker ${this.workerUrl} failed${event.message ? `: ${event.message}` : ''}`);\n };\n worker.onmessageerror = () =>\n this.fail(worker, `the decoding worker ${this.workerUrl} sent an unreadable message`);\n const { module, decoders, formats, points } = this;\n this.send(worker, { type: 'init', module, decoders, formats, points });\n const rules = headerRules();\n if (rules.length > 0) this.send(worker, { type: 'headers', rules });\n this.workers.push(worker);\n this.busy.set(worker, 0);\n }\n }\n let best = this.workers[0] as Worker;\n for (const worker of this.workers) {\n if ((this.busy.get(worker) ?? 0) < (this.busy.get(best) ?? 0)) best = worker;\n }\n return best;\n }\n\n private send(worker: Worker, message: WorkerRequest): void {\n worker.postMessage(message);\n }\n\n private receive(worker: Worker, reply: WorkerReply): void {\n this.busy.set(worker, Math.max(0, (this.busy.get(worker) ?? 1) - 1));\n const pending = this.pending.get(reply.id);\n if (!pending) return;\n this.pending.delete(reply.id);\n if (reply.type === 'tile') pending.resolve(reply.tile);\n else if (reply.type === 'points') pending.resolve(reply.vertices);\n else if (reply.aborted) pending.reject(new DOMException(`tile ${reply.id} aborted`, 'AbortError'));\n else pending.reject(new Error(reply.error));\n }\n\n /** Rejects the requests of a failed worker */\n private fail(worker: Worker, message: string): void {\n const error = new Error(\n `isard: ${message}. If a bundler moves the worker, give its URL in the \\`workerUrl\\` option (see \"With a bundler\" in the guide)`,\n );\n for (const [id, pending] of this.pending) {\n if (pending.worker !== worker) continue;\n this.pending.delete(id);\n pending.reject(error);\n }\n // Out of the pool: when none is left, the next requests fail at once\n worker.terminate();\n this.workers = this.workers.filter((w) => w !== worker);\n this.busy.delete(worker);\n if (this.workers.length === 0) this.failed = error;\n }\n}\n"]}
|
package/dist/lru.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lru.js","sourceRoot":"","sources":["../src/lru.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAO,GAAG;IAKL;IACU;IALF,OAAO,GAAG,IAAI,GAAG,EAAQ,CAAC;IAE3C,0EAA0E;IAC1E,YACS,QAAgB,EACN,KAAkC;QAD5C,aAAQ,GAAR,QAAQ,CAAQ;QACN,UAAK,GAAL,KAAK,CAA6B;IAClD,CAAC;IAEJ,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;IAED,0EAA0E;IAC1E,GAAG,CAAC,GAAM;QACR,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACpC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACzB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC/B,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,8CAA8C;IAC9C,GAAG,CAAC,GAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IAED,sGAAsG;IACtG,GAAG,CAAC,GAAM,EAAE,KAAQ;QAClB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACzB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC7B,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACzC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ;gBAAE,MAAM;YAC9C,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAC5B,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IAED,MAAM,CAAC,GAAM;QACX,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;IAED,4CAA4C;IAC5C,MAAM;QACJ,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;IAC/B,CAAC;IAED,KAAK;QACH,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;CACF","sourcesContent":["/**\n * A cache keeping its most recently used entries (the decoded tiles and images of the workers, the source tiles of a\n * reprojection, the labels of the vector tiles): a `Map` in order of use, the least recent dropped past `capacity`.\n */\nexport class Lru<K, V> {\n private readonly entries = new Map<K, V>();\n\n /** `evict`: told of each entry dropped for room (not of those deleted) */\n constructor(\n public capacity: number,\n private readonly evict?: (value: V, key: K) => void,\n ) {}\n\n get size(): number {\n return this.entries.size;\n }\n\n /** The value of a key, now the most recently used; undefined if absent */\n get(key: K): V | undefined {\n const value = this.entries.get(key);\n if (value !== undefined) {\n this.entries.delete(key);\n this.entries.set(key, value);\n }\n return value;\n }\n\n /** Whether a key is kept, without using it */\n has(key: K): boolean {\n return this.entries.has(key);\n }\n\n /** Adds or replaces a value, the most recently used; drops the least recent ones past the capacity */\n set(key: K, value: V): void {\n this.entries.delete(key);\n this.entries.set(key, value);\n for (const [oldest, old] of this.entries) {\n if (this.entries.size <= this.capacity) break;\n this.entries.delete(oldest);\n this.evict?.(old, oldest);\n }\n }\n\n delete(key: K): boolean {\n return this.entries.delete(key);\n }\n\n /** The values, least recently used first */\n values(): IterableIterator<V> {\n return this.entries.values();\n }\n\n clear(): void {\n this.entries.clear();\n }\n}\n"]}
|
package/dist/mvt.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mvt.js","sourceRoot":"","sources":["../src/mvt.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiBH,wCAAwC;AACxC,MAAM,GAAG;IAGY;IAER;IAJX,GAAG,CAAS;IACZ,YACmB,GAAe,EAChC,KAAK,GAAG,CAAC,EACA,MAAM,GAAG,CAAC,MAAM;QAFR,QAAG,GAAH,GAAG,CAAY;QAEvB,QAAG,GAAH,GAAG,CAAa;QAEzB,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC;IACnB,CAAC;IACD,kHAAkH;IAClH,MAAM;QACJ,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;YAC3C,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;YACpC,KAAK,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC;YACjC,IAAI,CAAC,GAAG,IAAI;gBAAE,MAAM;QACtB,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,iFAAiF;IACjF,KAAK;QACH,IAAI,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AE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAc,CAAC;wBACzD,MAAM;oBACR,KAAK,CAAC;wBACJ,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;wBACzB,MAAM;oBACR;wBACE,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;gBAClB,CAAC;YACH,CAAC;YACD,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QACtD,CAAC;QACD,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/**\n * Mapbox Vector Tiles (MVT 2.1) decoding: layers of features with their properties and geometry, in tile units\n * (`extent`, usually 4096 across). Points are lists of points, lines lists of lines, polygons lists of rings (the\n * outer ones clockwise in tile coordinates, y down, holes the other way round, as the specification says).\n */\n\nexport type Value = string | number | boolean;\n\nexport interface TileFeature {\n /** 1 point, 2 line, 3 polygon */\n type: 1 | 2 | 3;\n properties: Record<string, Value>;\n /** Point lists: x0, y0, x1, y1… in tile units */\n geometry: number[][];\n}\n\nexport interface TileLayer {\n extent: number;\n features: TileFeature[];\n}\n\n/** Protobuf reader of a buffer range */\nclass Pbf {\n pos: number;\n constructor(\n private readonly buf: Uint8Array,\n start = 0,\n readonly end = buf.length,\n ) {\n this.pos = start;\n }\n /** An unsigned varint, approximated beyond 2^53; all its bytes are read (up to 10), so the next field is right */\n varint(): number {\n let value = 0;\n for (let shift = 0; shift < 70; shift += 7) {\n const b = this.buf[this.pos++] ?? 0;\n value += (b & 0x7f) * 2 ** shift;\n if (b < 0x80) break;\n }\n return value;\n }\n /** A signed 64-bit varint (two's complement: a negative value takes 10 bytes) */\n int64(): number {\n let lo = 0;\n let hi = 0;\n for (let i = 0; i < 10; i += 1) {\n const b = this.buf[this.pos++] ?? 0;\n const bits = b & 0x7f;\n // Bits 0-27 in the low word, bits 28-31 split, the rest in the high word\n if (i < 4) lo |= bits << (7 * i);\n else if (i === 4) {\n lo |= (bits & 0x0f) << 28;\n hi |= bits >> 4;\n } else hi |= bits << (7 * i - 32);\n if (b < 0x80) break;\n }\n // The high word signed: values from 2^63 up are negative\n return (hi | 0) * 2 ** 32 + (lo >>> 0);\n }\n sint(): number {\n const v = this.varint();\n return v % 2 === 1 ? -(v + 1) / 2 : v / 2;\n }\n /** A length-delimited field as a sub-reader */\n sub(): Pbf {\n const n = this.varint();\n // A length past the end (a truncated tile) stops at the end\n const end = Math.min(this.pos + n, this.end);\n const r = new Pbf(this.buf, this.pos, end);\n this.pos = end;\n return r;\n }\n string(): string {\n const n = this.varint();\n const end = Math.min(this.pos + n, this.end);\n const s = decoder.decode(this.buf.subarray(this.pos, end));\n this.pos = end;\n return s;\n }\n float(): number {\n const v = this.pos + 4 <= this.end ? this.view().getFloat32(this.pos, true) : 0;\n this.pos += 4;\n return v;\n }\n double(): number {\n const v = this.pos + 8 <= this.end ? this.view().getFloat64(this.pos, true) : 0;\n this.pos += 8;\n return v;\n }\n private view(): DataView {\n return new DataView(this.buf.buffer, this.buf.byteOffset, this.buf.byteLength);\n }\n skip(wire: number): void {\n if (wire === 0) this.varint();\n else if (wire === 1) this.pos += 8;\n else if (wire === 2) this.pos += this.varint();\n else if (wire === 5) this.pos += 4;\n }\n get more(): boolean {\n return this.pos < this.end;\n }\n}\n\nconst decoder = new TextDecoder();\n\nfunction value(p: Pbf): Value {\n let v: Value = '';\n while (p.more) {\n const tag = p.varint();\n switch (tag >> 3) {\n case 1:\n v = p.string();\n break;\n case 2:\n v = p.float();\n break;\n case 3:\n v = p.double();\n break;\n case 4:\n v = p.int64();\n break;\n case 5:\n v = p.varint();\n break;\n case 6:\n v = p.sint();\n break;\n case 7:\n v = p.varint() !== 0;\n break;\n default:\n p.skip(tag & 7);\n }\n }\n return v;\n}\n\n/** Point lists of a geometry's commands (MoveTo, LineTo, ClosePath) */\nfunction geometry(p: Pbf): number[][] {\n const out: number[][] = [];\n let current: number[] | undefined;\n let [x, y] = [0, 0];\n while (p.more) {\n const command = p.varint();\n const id = command & 7;\n const count = command >> 3;\n if (id === 7) {\n // ClosePath: back to the first point\n if (current && current.length >= 2) current.push(current[0] ?? 0, current[1] ?? 0);\n continue;\n }\n // A count past the end (a truncated geometry) stops there\n for (let i = 0; i < count && p.more; i += 1) {\n x += p.sint();\n y += p.sint();\n if (id === 1) {\n current = [];\n out.push(current);\n }\n current?.push(x, y);\n }\n }\n return out;\n}\n\n/** Decodes a tile; only the layers in `wanted` (all if undefined) */\nexport function decode(bytes: Uint8Array, wanted?: Set<string>): Map<string, TileLayer> {\n const layers = new Map<string, TileLayer>();\n const tile = new Pbf(bytes);\n while (tile.more) {\n const tag = tile.varint();\n if (tag >> 3 !== 3) {\n tile.skip(tag & 7);\n continue;\n }\n const l = tile.sub();\n let name = '';\n let extent = 4096;\n const keys: string[] = [];\n const values: Value[] = [];\n const raw: Pbf[] = [];\n while (l.more) {\n const t = l.varint();\n switch (t >> 3) {\n case 1:\n name = l.string();\n break;\n case 2:\n raw.push(l.sub());\n break;\n case 3:\n keys.push(l.string());\n break;\n case 4:\n values.push(value(l.sub()));\n break;\n case 5:\n extent = l.varint();\n break;\n default:\n l.skip(t & 7);\n }\n }\n if (wanted && !wanted.has(name)) continue;\n const features: TileFeature[] = [];\n for (const f of raw) {\n let type: 1 | 2 | 3 = 1;\n const properties: Record<string, Value> = {};\n let geom: number[][] = [];\n while (f.more) {\n const t = f.varint();\n switch (t >> 3) {\n case 2: {\n const tags = f.sub();\n while (tags.more) {\n const k = keys[tags.varint()];\n const v = values[tags.varint()];\n if (k !== undefined && v !== undefined) properties[k] = v;\n }\n break;\n }\n case 3:\n type = Math.min(3, Math.max(1, f.varint())) as 1 | 2 | 3;\n break;\n case 4:\n geom = geometry(f.sub());\n break;\n default:\n f.skip(t & 7);\n }\n }\n features.push({ type, properties, geometry: geom });\n }\n layers.set(name, { extent, features });\n }\n return layers;\n}\n"]}
|
package/dist/overlay.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"overlay.js","sourceRoot":"","sources":["../src/overlay.ts"],"names":[],"mappings":"AAoBA,MAAM,gBAAgB,GAA2B;IAC/C,MAAM,EAAE,uBAAuB;IAC/B,GAAG,EAAE,oBAAoB;IACzB,MAAM,EAAE,wBAAwB;IAChC,IAAI,EAAE,oBAAoB;IAC1B,KAAK,EAAE,wBAAwB;IAC/B,UAAU,EAAE,iBAAiB;IAC7B,WAAW,EAAE,qBAAqB;IAClC,aAAa,EAAE,qBAAqB;IACpC,cAAc,EAAE,yBAAyB;CAC1C,CAAC;AAEF,0GAA0G;AAC1G,MAAM,YAAY,GAAqC;IACrD,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,GAAG,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC;IACjB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC;IAClB,KAAK,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;IACtB,UAAU,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;IACtB,WAAW,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC;IAC1B,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC;IAC5B,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;CACjC,CAAC;AAEF;gEACgE;AAChE,MAAM,MAAM,GAAG,GAAG,CAAC;AACnB,sFAAsF;AACtF,MAAM,cAAc,GAAG,CAAC,CAAC;AAQzB,oCAAoC;AACpC,MAAM,OAAO;IACM,SAAS,GAAoD,EAAE,CAAC;IAEjF,EAAE,CAAoB,IAAO,EAAE,QAA+B;QAC5D,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAA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,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QACtF,yEAAyE;QACzE,IAAI,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,EAAE,CAAC;YACnB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC;YACzC,OAAO;QACT,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,EAAE,CAAC;QACnC,yGAAyG;QACzG,wBAAwB;QACxB,MAAM,CAAC,GAAG,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACnC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAC3B,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACrC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IAC5D,CAAC;CACF","sourcesContent":["/**\n * DOM overlays tied to a position: markers and popups. The map places them all in one pass after each frame it draws\n * (camera moves, finer relief arriving), with a CSS transform from `map.project`: the browser only composites them,\n * nothing is laid out again.\n */\nimport type { GeoMap } from './map.ts';\nimport type { LonLat, Point } from './types.ts';\n\n/** Which part of the element sits on the position */\nexport type Anchor =\n | 'center'\n | 'top'\n | 'bottom'\n | 'left'\n | 'right'\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right';\n\nconst ANCHOR_TRANSLATE: Record<Anchor, string> = {\n center: 'translate(-50%, -50%)',\n top: 'translate(-50%, 0)',\n bottom: 'translate(-50%, -100%)',\n left: 'translate(0, -50%)',\n right: 'translate(-100%, -50%)',\n 'top-left': 'translate(0, 0)',\n 'top-right': 'translate(-100%, 0)',\n 'bottom-left': 'translate(0, -100%)',\n 'bottom-right': 'translate(-100%, -100%)',\n};\n\n/** Where the anchor lies within the element, CSS percentages: the stem of a raised marker starts there */\nconst ANCHOR_POINT: Record<Anchor, [string, string]> = {\n center: ['50%', '50%'],\n top: ['50%', '0'],\n bottom: ['50%', '100%'],\n left: ['0', '50%'],\n right: ['100%', '50%'],\n 'top-left': ['0', '0'],\n 'top-right': ['100%', '0'],\n 'bottom-left': ['0', '100%'],\n 'bottom-right': ['100%', '100%'],\n};\n\n/** Overlays further than this out of the canvas (CSS pixels) are hidden: no part of them can show, and huge\n * transforms near the horizon would only cost the compositor */\nconst MARGIN = 500;\n/** A press on a draggable marker that moves less than this (CSS pixels) is a click */\nconst DRAG_TOLERANCE = 3;\n\n/** @internal What the map places after each frame */\nexport interface Positioned {\n /** Places the overlay for the current camera; `size` is the canvas size in CSS pixels */\n position(size: Point): void;\n}\n\n/** Typed listeners of an overlay */\nclass Emitter<E> {\n private readonly listeners: { [K in keyof E]?: Set<(event: E[K]) => void> } = {};\n\n on<K extends keyof E>(type: K, listener: (event: E[K]) => void): () => void {\n const set = this.listeners[type] ?? new Set();\n this.listeners[type] = set;\n set.add(listener);\n return () => set.delete(listener);\n }\n\n emit<K extends keyof E>(type: K, event: E[K]): void {\n for (const listener of this.listeners[type] ?? []) listener(event);\n }\n}\n\n/** Moves `element` so that its anchor sits on `lonLat`, `height` metres above the ground, or hides it when the\n * position is out of sight; returns the screen point */\nfunction place(\n map: GeoMap,\n element: HTMLElement,\n lonLat: LonLat,\n height: number,\n anchor: Anchor,\n offset: Point,\n size: Point,\n): Point | undefined {\n const point = map.project(lonLat, height);\n const visible =\n point !== undefined &&\n point[0] > -MARGIN &&\n point[0] < size[0] + MARGIN &&\n point[1] > -MARGIN &&\n point[1] < size[1] + MARGIN;\n if (!visible) {\n element.style.display = 'none';\n return undefined;\n }\n element.style.display = '';\n // Whole pixels: a fractional translation blurs text and icons\n const x = Math.round(point[0] + offset[0]);\n const y = Math.round(point[1] + offset[1]);\n element.style.transform = `translate(${x}px, ${y}px) ${ANCHOR_TRANSLATE[anchor]}`;\n return point;\n}\n\n/** Round pin, its tip at the bottom: the default marker */\nfunction pin(): HTMLElement {\n const element = document.createElement('div');\n element.innerHTML =\n '<svg class=\"isard-marker-pin\" width=\"25\" height=\"34\" viewBox=\"0 0 25 34\" aria-hidden=\"true\">' +\n '<path fill=\"currentColor\" stroke=\"rgb(0 0 0 / 0.25)\" d=\"M12.5 33.5C12.5 33.5 .5 20.6 .5 12.5a12 12 0 0 1 24 0' +\n 'c0 8.1-12 21-12 21z\"/><circle cx=\"12.5\" cy=\"12.5\" r=\"4.5\" fill=\"#fff\"/></svg>';\n return element;\n}\n\nexport interface MarkerOptions {\n /** The element to show (default: a round pin) */\n element?: HTMLElement;\n /** Which part of the element sits on the position (default 'center' with an element of your own, 'bottom' for the\n * default pin) */\n anchor?: Anchor;\n /** Shift from the anchor, CSS pixels (default [0, 0]) */\n offset?: Point;\n /** The marker can be dragged over the map, on the relief (default false) */\n draggable?: boolean;\n /** Metres above the ground (default 0): a raised marker has a stem down to its position on the ground */\n height?: number;\n /** Classes added to the element, space separated */\n className?: string;\n}\n\nexport interface MarkerEvent {\n target: Marker;\n lonLat: LonLat;\n}\n\nexport interface MarkerEvents {\n dragstart: MarkerEvent;\n drag: MarkerEvent;\n dragend: MarkerEvent;\n}\n\n/** An element at a position on the map, optionally draggable */\nexport class Marker {\n private readonly element: HTMLElement;\n private readonly anchor: Anchor;\n private readonly events = new Emitter<MarkerEvents>();\n private offset: Point;\n private draggable: boolean;\n private lonLat: LonLat = [0, 0];\n private height: number;\n /** Metres above the ground of what the marker stands on, where its stem ends */\n private base = 0;\n /** The line from a raised marker down to the ground */\n private readonly stem: HTMLElement;\n private map: GeoMap | undefined;\n private popup: Popup | undefined;\n /** While pressed: the press point and the gap between the pointer and the marker's position */\n private grab: { start: Point; gap: Point } | undefined;\n private dragging = false;\n /** The click that ends a drag is not a click on the marker */\n private swallowClick = false;\n\n constructor(options: MarkerOptions = {}) {\n this.element = options.element ?? pin();\n this.anchor = options.anchor ?? (options.element ? 'center' : 'bottom');\n this.offset = options.offset ?? [0, 0];\n this.draggable = options.draggable ?? false;\n this.height = options.height ?? 0;\n this.stem = document.createElement('div');\n this.stem.className = 'isard-marker-stem';\n [this.stem.style.left, this.stem.style.top] = ANCHOR_POINT[this.anchor];\n this.element.append(this.stem);\n this.element.classList.add('isard-marker');\n if (options.className) this.element.classList.add(...options.className.split(/\\s+/).filter(Boolean));\n this.element.classList.toggle('isard-marker-draggable', this.draggable);\n this.element.addEventListener('pointerdown', (e) => this.down(e));\n this.element.addEventListener('pointermove', (e) => this.move(e));\n this.element.addEventListener('pointerup', (e) => this.up(e));\n this.element.addEventListener('pointercancel', (e) => this.up(e));\n this.element.addEventListener('click', (e) => this.click(e), { capture: true });\n }\n\n getElement(): HTMLElement {\n return this.element;\n }\n\n getLonLat(): LonLat {\n return [...this.lonLat];\n }\n\n setLonLat(lonLat: LonLat): this {\n this.lonLat = [lonLat[0], lonLat[1]];\n this.map?.positionOverlay(this);\n // An open popup of the marker goes with it\n if (this.popup?.isOpen()) this.popup.setLonLat(this.lonLat);\n return this;\n }\n\n getHeight(): number {\n return this.height;\n }\n\n /** Metres above the ground: a raised marker has a stem down to `base` metres, what it stands on (a roof, a mesh;\n * the ground by default); its popup is raised too */\n setHeight(height: number, base = 0): this {\n this.height = Number.isFinite(height) ? height : 0;\n this.base = Number.isFinite(base) ? Math.min(base, this.height) : 0;\n this.popup?.setHeight(this.height);\n this.map?.positionOverlay(this);\n return this;\n }\n\n setOffset(offset: Point): this {\n this.offset = [offset[0], offset[1]];\n this.map?.positionOverlay(this);\n return this;\n }\n\n setDraggable(draggable: boolean): this {\n this.draggable = draggable;\n this.element.classList.toggle('isard-marker-draggable', draggable);\n return this;\n }\n\n isDraggable(): boolean {\n return this.draggable;\n }\n\n /** A popup that a click on the marker opens and closes, at the marker's position; give it an offset clearing the\n * marker (with the default pin, [0, -34]) */\n setPopup(popup: Popup | undefined): this {\n this.popup?.remove();\n this.popup = popup;\n popup?.setHeight(this.height);\n return this;\n }\n\n getPopup(): Popup | undefined {\n return this.popup;\n }\n\n /** Opens the marker's popup, or closes it if open */\n togglePopup(): this {\n if (!this.popup || !this.map) return this;\n if (this.popup.isOpen()) this.popup.remove();\n else this.popup.setLonLat(this.lonLat).addTo(this.map);\n return this;\n }\n\n /** Listens to the drag of the marker; returns the function that stops listening */\n on<K extends keyof MarkerEvents>(type: K, listener: (event: MarkerEvents[K]) => void): () => void {\n return this.events.on(type, listener);\n }\n\n addTo(map: GeoMap): this {\n if (this.map === map) return this;\n this.remove();\n this.map = map;\n map.attachOverlay(this, this.element);\n return this;\n }\n\n remove(): this {\n this.popup?.remove();\n this.map?.detachOverlay(this, this.element);\n this.map = undefined;\n this.grab = undefined;\n this.dragging = false;\n this.element.classList.remove('isard-marker-dragging');\n return this;\n }\n\n /** @internal */\n position(size: Point): void {\n if (!this.map) return;\n const top = place(this.map, this.element, this.lonLat, this.height, this.anchor, this.offset, size);\n const ground = top && this.height !== this.base ? this.map.project(this.lonLat, this.base) : undefined;\n if (!top || !ground) {\n this.stem.style.display = 'none';\n return;\n }\n // From the anchor down to what it stands on, a line turned toward it\n const [dx, dy] = [ground[0] - top[0], ground[1] - top[1]];\n this.stem.style.display = '';\n this.stem.style.height = `${Math.hypot(dx, dy)}px`;\n this.stem.style.transform = `rotate(${Math.atan2(dy, dx) - Math.PI / 2}rad)`;\n }\n\n private local(e: PointerEvent): Point | undefined {\n const rect = this.map?.getCanvas().getBoundingClientRect();\n return rect && [e.clientX - rect.left, e.clientY - rect.top];\n }\n\n private down(e: PointerEvent): void {\n this.swallowClick = false;\n if (!this.draggable || !this.map || e.button !== 0) return;\n // The gap to the position on the ground, below a raised marker\n const point = this.map.project(this.lonLat);\n const at = this.local(e);\n if (!point || !at) return;\n // The map must not start panning under the marker\n e.stopPropagation();\n e.preventDefault();\n this.element.setPointerCapture(e.pointerId);\n // The grabbed spot of the marker stays under the pointer, wherever the element was pressed\n this.grab = { start: at, gap: [at[0] - point[0], at[1] - point[1]] };\n this.dragging = false;\n }\n\n private move(e: PointerEvent): void {\n const at = this.local(e);\n if (!this.grab || !this.map || !at) return;\n e.stopPropagation();\n const { start, gap } = this.grab;\n if (!this.dragging && Math.hypot(at[0] - start[0], at[1] - start[1]) < DRAG_TOLERANCE) return;\n // On the relief: the ground under the point, read back from the picking pass\n const lonLat = this.map.unproject([at[0] - gap[0], at[1] - gap[1]]);\n if (!lonLat) return;\n if (!this.dragging) {\n this.dragging = true;\n this.element.classList.add('isard-marker-dragging');\n this.events.emit('dragstart', { target: this, lonLat: this.getLonLat() });\n }\n this.setLonLat(lonLat);\n this.events.emit('drag', { target: this, lonLat: this.getLonLat() });\n }\n\n private up(e: PointerEvent): void {\n if (!this.grab) return;\n e.stopPropagation();\n this.grab = undefined;\n if (this.element.hasPointerCapture(e.pointerId)) this.element.releasePointerCapture(e.pointerId);\n if (!this.dragging) return;\n this.dragging = false;\n this.swallowClick = true;\n this.element.classList.remove('isard-marker-dragging');\n this.events.emit('dragend', { target: this, lonLat: this.getLonLat() });\n }\n\n private click(e: MouseEvent): void {\n if (this.swallowClick) {\n this.swallowClick = false;\n e.stopImmediatePropagation();\n e.preventDefault();\n return;\n }\n if (this.popup) this.togglePopup();\n }\n}\n\nexport interface PopupOptions {\n /** A × button in the corner (default true) */\n closeButton?: boolean;\n /** A click on the map elsewhere closes the popup (default true) */\n closeOnClick?: boolean;\n /** CSS max-width of the popup (default '240px') */\n maxWidth?: string;\n /** Classes added to the popup, space separated */\n className?: string;\n /** Which part of the popup sits on the position, its tip there (default 'bottom': the popup is above the point) */\n anchor?: Anchor;\n /** Shift from the anchor, CSS pixels (default [0, 0]) */\n offset?: Point;\n}\n\nexport interface PopupEvents {\n open: { target: Popup };\n close: { target: Popup };\n}\n\n/** A box of content at a position, its tip pointing at it */\nexport class Popup {\n private readonly container: HTMLElement;\n private readonly content: HTMLElement;\n private readonly closeButton: HTMLButtonElement | undefined;\n private readonly anchor: Anchor;\n private readonly closeOnClick: boolean;\n private readonly events = new Emitter<PopupEvents>();\n private offset: Point;\n private lonLat: LonLat = [0, 0];\n private height = 0;\n private map: GeoMap | undefined;\n private stopListening: (() => void) | undefined;\n\n constructor(options: PopupOptions = {}) {\n this.anchor = options.anchor ?? 'bottom';\n this.offset = options.offset ?? [0, 0];\n this.closeOnClick = options.closeOnClick ?? true;\n this.container = document.createElement('div');\n this.container.className = `isard-popup isard-popup-anchor-${this.anchor}`;\n if (options.className) this.container.classList.add(...options.className.split(/\\s+/).filter(Boolean));\n this.container.style.maxWidth = options.maxWidth ?? '240px';\n const tip = document.createElement('div');\n tip.className = 'isard-popup-tip';\n this.content = document.createElement('div');\n this.content.className = 'isard-popup-content';\n if (options.closeButton ?? true) {\n this.container.classList.add('isard-popup-has-close');\n this.closeButton = document.createElement('button');\n this.closeButton.type = 'button';\n this.closeButton.className = 'isard-popup-close';\n this.closeButton.setAttribute('aria-label', 'Close popup');\n this.closeButton.textContent = '×';\n this.closeButton.addEventListener('click', () => this.remove());\n this.content.append(this.closeButton);\n }\n this.container.append(tip, this.content);\n }\n\n getElement(): HTMLElement {\n return this.container;\n }\n\n getLonLat(): LonLat {\n return [...this.lonLat];\n }\n\n setLonLat(lonLat: LonLat): this {\n this.lonLat = [lonLat[0], lonLat[1]];\n this.map?.positionOverlay(this);\n return this;\n }\n\n setOffset(offset: Point): this {\n this.offset = [offset[0], offset[1]];\n this.map?.positionOverlay(this);\n return this;\n }\n\n getHeight(): number {\n return this.height;\n }\n\n /** Metres above the ground (default 0); a marker's popup follows the marker's height */\n setHeight(height: number): this {\n this.height = Number.isFinite(height) ? height : 0;\n this.map?.positionOverlay(this);\n return this;\n }\n\n /** Content from an HTML string: only for trusted HTML (use `setText` for user or remote data) */\n setHTML(html: string): this {\n const template = document.createElement('template');\n template.innerHTML = html;\n return this.setDOMContent(template.content);\n }\n\n setText(text: string): this {\n return this.setDOMContent(document.createTextNode(text));\n }\n\n setDOMContent(node: Node): this {\n this.content.replaceChildren(node);\n if (this.closeButton) this.content.append(this.closeButton);\n this.map?.positionOverlay(this);\n return this;\n }\n\n isOpen(): boolean {\n return this.map !== undefined;\n }\n\n /** Listens to the popup opening or closing; returns the function that stops listening */\n on<K extends keyof PopupEvents>(type: K, listener: (event: PopupEvents[K]) => void): () => void {\n return this.events.on(type, listener);\n }\n\n addTo(map: GeoMap): this {\n if (this.map === map) return this;\n this.remove();\n this.map = map;\n map.attachOverlay(this, this.container);\n if (this.closeOnClick) {\n // From the next task on: a popup opened by a map click must not be closed by that same click\n queueMicrotask(() => {\n if (this.map === map && !this.stopListening) this.stopListening = map.on('click', () => this.remove());\n });\n }\n this.events.emit('open', { target: this });\n return this;\n }\n\n remove(): this {\n if (!this.map) return this;\n this.stopListening?.();\n this.stopListening = undefined;\n this.map.detachOverlay(this, this.container);\n this.map = undefined;\n this.events.emit('close', { target: this });\n return this;\n }\n\n /** @internal */\n position(size: Point): void {\n if (this.map) place(this.map, this.container, this.lonLat, this.height, this.anchor, this.offset, size);\n }\n}\n\nexport interface PanelOptions {\n /** The element shown in 3D (a video, an iframe, an image…), laid out at its CSS size */\n element: HTMLElement;\n /** Its width on the ground, metres; its height follows its CSS aspect */\n width: number;\n /** Degrees clockwise from north the side it faces (default 0: it faces north, read from the north) */\n heading?: number;\n /** Degrees it leans back from upright (default 0: standing; 90: lying flat) */\n pitch?: number;\n /** Metres of its bottom edge above the ground (the relief; default 0) */\n height?: number;\n /** Classes added to the element, space separated */\n className?: string;\n}\n\n/** `a × b`, 4 × 4 column-major */\nfunction multiply(a: ArrayLike<number>, b: ArrayLike<number>): number[] {\n const out = new Array<number>(16).fill(0);\n for (let c = 0; c < 4; c++) {\n for (let r = 0; r < 4; r++) {\n let sum = 0;\n for (let k = 0; k < 4; k++) sum += (a[k * 4 + r] ?? 0) * (b[c * 4 + k] ?? 0);\n out[c * 4 + r] = sum;\n }\n }\n return out;\n}\n\n/**\n * An element standing in 3D at a position: a video, a web page, a sign, `width` metres wide on the ground, facing\n * `heading`. Placed after each frame by a CSS 3D transform (the element is not drawn by WebGL: the scene does not\n * hide it); hidden when its position is behind the camera\n */\nexport class Panel {\n private readonly element: HTMLElement;\n private lonLat: LonLat = [0, 0];\n private width: number;\n private heading: number;\n private pitch: number;\n private height: number;\n private map: GeoMap | undefined;\n /** Its CSS size, read once it is on the page (`resize` reads it again) */\n private size: Point | undefined;\n\n constructor(options: PanelOptions) {\n this.element = options.element;\n this.width = options.width;\n this.heading = options.heading ?? 0;\n this.pitch = options.pitch ?? 0;\n this.height = options.height ?? 0;\n this.element.classList.add('isard-panel');\n if (options.className) this.element.classList.add(...options.className.split(/\\s+/).filter(Boolean));\n }\n\n getElement(): HTMLElement {\n return this.element;\n }\n\n getLonLat(): LonLat {\n return [...this.lonLat];\n }\n\n setLonLat(lonLat: LonLat): this {\n this.lonLat = [lonLat[0], lonLat[1]];\n this.map?.positionOverlay(this);\n return this;\n }\n\n /** Width (metres), heading and pitch (degrees), height of its bottom edge (metres), as in `PanelOptions` */\n setPlacement(placement: Partial<Pick<PanelOptions, 'width' | 'heading' | 'pitch' | 'height'>>): this {\n this.width = placement.width ?? this.width;\n this.heading = placement.heading ?? this.heading;\n this.pitch = placement.pitch ?? this.pitch;\n this.height = placement.height ?? this.height;\n this.map?.positionOverlay(this);\n return this;\n }\n\n /** Reads the element's CSS size again (after it changed) */\n resize(): this {\n this.size = undefined;\n this.map?.positionOverlay(this);\n return this;\n }\n\n addTo(map: GeoMap): this {\n if (this.map === map) return this;\n this.remove();\n this.map = map;\n map.attachOverlay(this, this.element);\n return this;\n }\n\n remove(): this {\n this.map?.detachOverlay(this, this.element);\n this.map = undefined;\n this.size = undefined;\n return this;\n }\n\n /** @internal */\n position(viewport: Point): void {\n const map = this.map;\n if (!map) return;\n this.size ??= [this.element.offsetWidth || 300, this.element.offsetHeight || 150];\n const [w, h] = this.size;\n const ground = map.elevationAt(this.lonLat) ?? 0;\n const local = map.engine.localMatrix(this.lonLat[0], this.lonLat[1], ground);\n // The element's pixels to the local frame (metres, x east, y north, z up): its bottom edge centered on the\n // position, `height` up, facing `heading`, leant back by `pitch`\n const rad = Math.PI / 180;\n const [hd, pt] = [this.heading * rad, this.pitch * rad];\n const s = this.width / w;\n // Across it (left to right as read from the side it faces), and up it\n const [ax, ay] = [-Math.cos(hd), Math.sin(hd)];\n const [ux, uy, uz] = [-Math.sin(hd) * Math.sin(pt), -Math.cos(hd) * Math.sin(pt), Math.cos(pt)];\n const top = h * s;\n const origin = [-ax * (this.width / 2) + ux * top, -ay * (this.width / 2) + uy * top, this.height + uz * top];\n const toLocal = [ax * s, ay * s, 0, 0, -ux * s, -uy * s, -uz * s, 0, 0, 0, 0, 0, ...origin, 1];\n // Clip space to the map's CSS pixels; the depth flattened\n const [vw, vh] = viewport;\n const toScreen = [vw / 2, 0, 0, 0, 0, -vh / 2, 0, 0, 0, 0, 0, 0, vw / 2, vh / 2, 0, 1];\n const clip = multiply(local, toLocal);\n // Behind the camera (its center): hidden\n const centerW = (clip[3] ?? 0) * (w / 2) + (clip[7] ?? 0) * (h / 2) + (clip[15] ?? 0);\n // Hidden without touching its display (the page's layout of its content)\n if (!(centerW > 0)) {\n this.element.style.visibility = 'hidden';\n return;\n }\n this.element.style.visibility = '';\n // Its depth axis the identity, out of the rest: its points have no depth, and a transform that cannot be\n // inverted is not drawn\n const m = multiply(toScreen, clip);\n m.splice(8, 4, 0, 0, 1, 0);\n for (const k of [2, 6, 14]) m[k] = 0;\n this.element.style.transform = `matrix3d(${m.join(',')})`;\n }\n}\n"]}
|
package/dist/panoramas.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"panoramas.js","sourceRoot":"","sources":["../src/panoramas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAA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AC;QAC7F,IAAI,CAAC,IAAI,CAAC;YACR,KAAK,EAAE,IAAI,CAAC,MAAM;YAClB,EAAE,EAAG,CAAC,CAAC,EAAkC,IAAI,IAAI,CAAC,MAAM;YACxD,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;YAClB,MAAM,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACpD,OAAO,EAAE,MAAM,CAAC,SAAS,CAAC;SAC3B,CAAC,CAAC;IACL,CAAC;IACD,OAAO,IAAI,SAAS,CAClB,IAAI,EACJ;QACE,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,kBAAkB,EAAE,OAAO,CAAC,kBAAkB,IAAI,IAAI;QACtD,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,CAAC;KAC9B,EACD,IAAI,EACJ,SAAS,EACT,OAAO,EACP,SAAS,CACV,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Street-level panoramas: the oriented images of a vehicle's cameras around each of its positions (Stereopolis, the\n * iTowns immersive examples), projected onto the scene around the panorama shown. Their positions and attitudes come\n * as GeoJSON points (Lambert-93 by default, altitudes NGF-IGN69 raised by the RAF20 geoid onto the IGN relief), the\n * calibration of the cameras as JSON (rotation and position in the panorama frame, intrinsics, MicMac's radial\n * distortion), the images from a URL template with `{cameraId}` and `{panoId}`.\n *\n * ```ts\n * const panoramas = await map.addPanoramas({ url, orientationsUrl, calibrationUrl });\n * await panoramas.show(panoramas.nearest([2.3345, 48.8505]).index);\n * ```\n */\nimport { getCrs } from './crs.ts';\nimport { withHeaders } from './requests.ts';\nimport type { FirstPersonView, LonLat } from './types.ts';\n\nexport interface PanoramaOptions {\n /** URL of an image: `{cameraId}` and `{panoId}` replaced by a camera's id and a panorama's */\n url: string;\n /** GeoJSON points: each panorama's position, and its `id`, `heading`, `pitch`, `roll` (degrees) in properties */\n orientationsUrl: string;\n /** JSON array of the cameras: `id`, `rotation` (row-major), `position`, `projection`, `size`, `distortion` */\n calibrationUrl: string;\n /** CRS of the positions (default the GeoJSON's `crs` member, else `EPSG:2154`) */\n crs?: string;\n /** Altitudes above the geoid (NGF-IGN69), raised by the RAF20 geoid onto the IGN relief (default true in\n * Lambert-93) */\n geoid?: boolean;\n /** Radius of the sphere around the panorama its images are a backdrop on, metres (default 1000) */\n backgroundDistance?: number;\n /** 0-1 (default 1) */\n opacity?: number;\n}\n\n/** A panorama: where it is and which way the vehicle faced */\nexport interface Panorama {\n index: number;\n id: number | string;\n lonLat: LonLat;\n /** Metres above the ellipsoid */\n height: number;\n /** Degrees clockwise from north */\n heading: number;\n}\n\n/** What the map gives the panoramas */\nexport interface PanoramaHost {\n setPanorama(\n lon: number,\n lat: number,\n height: number,\n rotation: Float64Array,\n cameras: Float64Array,\n radius: number,\n opacity: number,\n ): void;\n setPanoramaImage(index: number, image: ImageBitmap): void;\n clearPanorama(): void;\n geoidHeight(lon: number, lat: number): number;\n /** The street-level eye, and setting it (undefined: back to the camera turning around a point) */\n firstPerson(): Readonly<Required<FirstPersonView>> | undefined;\n setFirstPerson(view: FirstPersonView | undefined): void;\n elevationAt(lonLat: LonLat): number | undefined;\n /** Follows the clicks on the map (with the ground clicked), the keys typed on it and its wheel (taken from the\n * map's own); returns what stops */\n listen(\n click: (lonLat: LonLat | undefined) => void,\n key: (e: KeyboardEvent) => void,\n wheel: (e: WheelEvent) => void,\n ): () => void;\n}\n\ninterface Calibration {\n id: number | string;\n rotation: number[];\n position: number[];\n projection: number[];\n size: number[];\n distortion?: { pps: number[]; poly357: number[]; limit?: number };\n}\n\ninterface Attitude {\n heading: number;\n pitch: number;\n roll: number;\n}\n\nconst RAD = Math.PI / 180;\n\n/** 3 × 3 product, row-major */\nfunction times(a: number[], b: number[]): number[] {\n const out: number[] = [];\n for (let r = 0; r < 3; r++) {\n for (let c = 0; c < 3; c++) {\n let sum = 0;\n for (let k = 0; k < 3; k++) sum += (a[r * 3 + k] ?? 0) * (b[k * 3 + c] ?? 0);\n out.push(sum);\n }\n }\n return out;\n}\n\nconst rotX = (t: number) => [1, 0, 0, 0, Math.cos(t), -Math.sin(t), 0, Math.sin(t), Math.cos(t)];\nconst rotY = (t: number) => [Math.cos(t), 0, Math.sin(t), 0, 1, 0, -Math.sin(t), 0, Math.cos(t)];\nconst rotZ = (t: number) => [Math.cos(t), -Math.sin(t), 0, Math.sin(t), Math.cos(t), 0, 0, 0, 1];\n\n/**\n * The panorama frame to east, north, up (row-major): the vehicle's attitude in the CRS's grid (iTowns'\n * `quaternionFromRollPitchHeading`: Ry(-roll) · Rx(-pitch) · Rz(-heading)), turned by the meridian convergence of the\n * projection (Lambert-93: sin(46.5°) · (3° - longitude))\n */\nexport function panoramaRotation(attitude: Attitude, lon: number, lambert93: boolean): number[] {\n const vehicle = times(times(rotY(-attitude.roll * RAD), rotX(-attitude.pitch * RAD)), rotZ(-attitude.heading * RAD));\n const convergence = lambert93 ? Math.sin(46.5 * RAD) * (3 - lon) * RAD : 0;\n return times(rotZ(convergence), vehicle);\n}\n\n/** The 25 numbers of a camera for `setPanorama` */\nfunction cameraNumbers(c: Calibration): number[] {\n const p = c.projection;\n const d = c.distortion;\n return [\n ...c.rotation.slice(0, 9),\n ...c.position.slice(0, 3),\n p[0] ?? 1,\n p[4] ?? 1,\n p[2] ?? 0,\n p[5] ?? 0,\n p[1] ?? 0,\n c.size[0] ?? 1,\n c.size[1] ?? 1,\n d?.pps[0] ?? 0,\n d?.pps[1] ?? 0,\n d?.poly357[0] ?? 0,\n d?.poly357[1] ?? 0,\n d?.poly357[2] ?? 0,\n d?.limit ?? 0,\n ];\n}\n\n/** The panoramas of a set, one shown at a time */\nexport class Panoramas {\n /** The panorama shown, if any */\n current: Panorama | undefined;\n private shown = 0;\n\n /** @internal */\n constructor(\n private readonly host: PanoramaHost,\n private readonly options: Required<Pick<PanoramaOptions, 'url' | 'backgroundDistance' | 'opacity'>>,\n readonly list: readonly Panorama[],\n private readonly attitudes: readonly Attitude[],\n private readonly cameras: readonly Calibration[],\n private readonly lambert93: boolean,\n ) {}\n\n /** The panorama nearest to a position */\n nearest(lonLat: LonLat): Panorama | undefined {\n const cos = Math.cos(lonLat[1] * RAD);\n let best: Panorama | undefined;\n let distance = Number.POSITIVE_INFINITY;\n for (const p of this.list) {\n const d = ((p.lonLat[0] - lonLat[0]) * cos) ** 2 + (p.lonLat[1] - lonLat[1]) ** 2;\n if (d < distance) [best, distance] = [p, d];\n }\n return best;\n }\n\n /** Shows a panorama (its index in `list`): projected as soon as its first image arrives, the others after */\n async show(index: number): Promise<void> {\n const pano = this.list[index];\n const attitude = this.attitudes[index];\n if (!pano || !attitude) return;\n const shown = ++this.shown;\n this.current = pano;\n const rotation = panoramaRotation(attitude, pano.lonLat[0], this.lambert93);\n const { url, backgroundDistance, opacity } = this.options;\n this.host.setPanorama(\n pano.lonLat[0],\n pano.lonLat[1],\n pano.height,\n Float64Array.from(rotation),\n Float64Array.from(this.cameras.flatMap(cameraNumbers)),\n backgroundDistance,\n opacity,\n );\n await Promise.all(\n this.cameras.map(async (camera, k) => {\n const src = url.replaceAll('{cameraId}', String(camera.id)).replaceAll('{panoId}', String(pano.id));\n const response = await fetch(src, withHeaders(src));\n if (!response.ok) throw new Error(`isard: panorama image ${src}: ${response.status}`);\n const image = await createImageBitmap(await response.blob(), { premultiplyAlpha: 'none' });\n // Another panorama shown since: this image is not its\n if (shown === this.shown) this.host.setPanoramaImage(k, image);\n image.close();\n }),\n );\n }\n\n /** Hides the panorama shown */\n hide(): void {\n this.shown++;\n this.current = undefined;\n this.host.clearPanorama();\n }\n\n /** Stops the walk (`enter`) */\n private stopWalking: (() => void) | undefined;\n\n /**\n * Street-level walk from panorama to panorama (the iTowns immersive view): the eye on a panorama, the drag\n * turning it; a click goes to the panorama nearest to the clicked point, the wheel to the nearest one ahead (or\n * behind), Z and S (or Page Up and Page Down) to the next and the previous ones. Starts on the panorama `index`,\n * else the one nearest to `near`\n */\n async enter(start: { index?: number; near?: LonLat } = {}): Promise<void> {\n const first = start.index ?? (start.near && this.nearest(start.near)?.index) ?? 0;\n this.stopWalking?.();\n this.stopWalking = this.host.listen(\n (lonLat) => {\n const target = lonLat && this.nearest(lonLat);\n if (target && target !== this.current) void this.go(target.index);\n },\n (e) => {\n const step = { z: 1, Z: 1, PageUp: 1, s: -1, S: -1, PageDown: -1 }[e.key];\n if (!step || !this.current) return;\n e.preventDefault();\n void this.go((this.current.index + step + this.list.length) % this.list.length);\n },\n (e) => {\n // One step per notch, the next ones once it is shown\n if (this.moving || e.deltaY === 0) return;\n const target = this.ahead(e.deltaY < 0);\n if (target) {\n this.moving = true;\n void this.go(target.index).finally(() => {\n this.moving = false;\n });\n }\n },\n );\n await this.go(first, this.list[first]?.heading);\n }\n\n /** A step of the wheel under way */\n private moving = false;\n\n /** The nearest panorama ahead of the eye (within 60° of where it looks), or behind it */\n ahead(forward = true): Panorama | undefined {\n const eye = this.host.firstPerson();\n const here = this.current;\n if (!eye || !here) return undefined;\n const cos = Math.cos(here.lonLat[1] * RAD);\n const look = (eye.bearing + (forward ? 0 : 180)) * RAD;\n let best: Panorama | undefined;\n let distance = Number.POSITIVE_INFINITY;\n for (const p of this.list) {\n if (p === here) continue;\n const [east, north] = [(p.lonLat[0] - here.lonLat[0]) * cos, p.lonLat[1] - here.lonLat[1]];\n const d = Math.hypot(east, north);\n const off = Math.acos(Math.max(-1, Math.min(1, (east * Math.sin(look) + north * Math.cos(look)) / (d || 1))));\n if (off < 60 * RAD && d < distance) [best, distance] = [p, d];\n }\n return best;\n }\n\n /** Goes to a panorama during the walk, the eye looking the same way (or `bearing`) */\n async go(index: number, bearing?: number): Promise<void> {\n const pano = this.list[index];\n if (!pano) return;\n const eye = this.host.firstPerson();\n // The eye at the panorama's cameras, above the ground there\n const ground = this.host.elevationAt(pano.lonLat);\n this.host.setFirstPerson({\n lonLat: pano.lonLat,\n height: ground === undefined ? 2.5 : Math.max(0.5, pano.height - ground),\n bearing: bearing ?? eye?.bearing ?? pano.heading,\n ...(eye ? { pitch: eye.pitch, fov: eye.fov } : {}),\n });\n await this.show(index);\n }\n\n /** Ends the walk: the panorama hidden, the camera turning around a point again, above where the eye stood */\n exit(): void {\n this.stopWalking?.();\n this.stopWalking = undefined;\n this.hide();\n this.host.setFirstPerson(undefined);\n }\n}\n\n/** Loads a set of panoramas: their positions and attitudes, the calibration of their cameras */\nexport async function loadPanoramas(host: PanoramaHost, options: PanoramaOptions): Promise<Panoramas> {\n const json = async <T>(src: string) => {\n const response = await fetch(src, withHeaders(src));\n if (!response.ok) throw new Error(`isard: ${src}: ${response.status}`);\n return (await response.json()) as T;\n };\n const [orientations, cameras] = await Promise.all([\n json<{\n crs?: { properties?: { name?: string } };\n features: { geometry: { coordinates: number[] }; properties: Record<string, unknown> }[];\n }>(options.orientationsUrl),\n json<Calibration[]>(options.calibrationUrl),\n ]);\n const crsName = options.crs ?? orientations.crs?.properties?.name ?? 'EPSG:2154';\n const lambert93 = /2154/.test(crsName);\n const crs = getCrs(crsName);\n const geoid = options.geoid ?? lambert93;\n const list: Panorama[] = [];\n const attitudes: Attitude[] = [];\n for (const feature of orientations.features) {\n const [x = 0, y = 0, z = 0] = feature.geometry.coordinates;\n const [lon = 0, lat = 0] = crs.inverse([x, y]);\n const p = feature.properties;\n const number = (key: string) => (typeof p[key] === 'number' ? (p[key] as number) : 0);\n attitudes.push({ heading: number('heading'), pitch: number('pitch'), roll: number('roll') });\n list.push({\n index: list.length,\n id: (p.id as number | string | undefined) ?? list.length,\n lonLat: [lon, lat],\n height: z + (geoid ? host.geoidHeight(lon, lat) : 0),\n heading: number('heading'),\n });\n }\n return new Panoramas(\n host,\n {\n url: options.url,\n backgroundDistance: options.backgroundDistance ?? 1000,\n opacity: options.opacity ?? 1,\n },\n list,\n attitudes,\n cameras,\n lambert93,\n );\n}\n"]}
|
package/dist/pmtiles.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
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MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AACxE,CAAC","sourcesContent":["/**\n * PMTiles v3 archives: one file of tiles read by HTTP range requests (or from a `Blob`), as Protomaps publishes them.\n * The header and root directory in one request, the leaf directories as needed (kept in a small cache), each tile in\n * its own range; gzip through `DecompressionStream`. The same reader in the page (raster tiles) and in the basemap\n * workers (vector tiles of a style source `pmtiles://…`, as MapLibre's protocol names them).\n */\nimport { Lru } from './lru.ts';\nimport { withHeaders } from './requests.ts';\n\n/** What a PMTiles archive's tiles are */\nexport type PmtilesTileType = 'unknown' | 'mvt' | 'png' | 'jpeg' | 'webp' | 'avif';\n\n/** The header of a PMTiles archive (v3) */\nexport interface PmtilesHeader {\n rootDirectoryOffset: number;\n rootDirectoryLength: number;\n metadataOffset: number;\n metadataLength: number;\n leafDirectoryOffset: number;\n leafDirectoryLength: number;\n tileDataOffset: number;\n tileDataLength: number;\n /** 1 none, 2 gzip, 3 brotli, 4 zstd (only none and gzip are read) */\n internalCompression: number;\n tileCompression: number;\n tileType: PmtilesTileType;\n minZoom: number;\n maxZoom: number;\n /** `[west, south, east, north]`, degrees */\n bounds: [number, number, number, number];\n center: [lon: number, lat: number, zoom: number];\n}\n\n/** An entry of a directory: a run of tiles (`runLength` > 0) or a leaf directory (0) */\nexport interface PmtilesEntry {\n tileId: number;\n offset: number;\n length: number;\n runLength: number;\n}\n\nconst HEADER = 127;\n/** The header and the root directory lie within the first 16 KB of the file */\nconst FIRST = 16384;\nconst TYPES: PmtilesTileType[] = ['unknown', 'mvt', 'png', 'jpeg', 'webp', 'avif'];\n\n/** Tiles before level z: (4^z - 1) / 3 */\nconst levelStart = (z: number) => (4 ** z - 1) / 3;\n\n/** The tile id of z/x/y: the tiles of the lower levels, then the position along the level's Hilbert curve */\nexport function zxyToTileId(z: number, x: number, y: number): number {\n if (z > 26) throw new Error(`isard: PMTiles level ${z} past 26`);\n const n = 2 ** z;\n if (x < 0 || y < 0 || x >= n || y >= n) throw new Error(`isard: PMTiles tile ${z}/${x}/${y} out of its level`);\n let [px, py] = [x, y];\n let d = 0;\n for (let s = n / 2; s >= 1; s /= 2) {\n const rx = (px & s) > 0 ? 1 : 0;\n const ry = (py & s) > 0 ? 1 : 0;\n d += s * s * ((3 * rx) ^ ry);\n if (ry === 0) {\n if (rx === 1) [px, py] = [s - 1 - px, s - 1 - py];\n [px, py] = [py, px];\n }\n }\n return levelStart(z) + d;\n}\n\n/** The z/x/y of a tile id (the inverse of `zxyToTileId`) */\nexport function tileIdToZxy(id: number): [z: number, x: number, y: number] {\n let z = 0;\n while (levelStart(z + 1) <= id) z += 1;\n const n = 2 ** z;\n let t = id - levelStart(z);\n let [x, y] = [0, 0];\n for (let s = 1; s < n; s *= 2) {\n // Arithmetic, not bitwise: positions pass 32 bits past level 16\n const rx = Math.floor(t / 2) % 2;\n const ry = (t % 2) ^ rx;\n if (ry === 0) {\n if (rx === 1) [x, y] = [s - 1 - x, s - 1 - y];\n [x, y] = [y, x];\n }\n x += s * rx;\n y += s * ry;\n t = Math.floor(t / 4);\n }\n return [z, x, y];\n}\n\n/** A reader of unsigned varints past 32 bits (tile ids reach 2^52) */\nclass Varints {\n pos = 0;\n constructor(private readonly bytes: Uint8Array) {}\n next(): number {\n let value = 0;\n let scale = 1;\n for (;;) {\n const b = this.bytes[this.pos++];\n if (b === undefined) throw new Error('isard: PMTiles directory truncated');\n value += (b & 0x7f) * scale;\n if (b < 0x80) return value;\n scale *= 128;\n if (scale > 2 ** 63) throw new Error('isard: PMTiles varint too long');\n }\n }\n}\n\n/** The entries of a directory (decompressed) */\nexport function parseDirectory(bytes: Uint8Array): PmtilesEntry[] {\n const v = new Varints(bytes);\n const count = v.next();\n if (count > bytes.length) throw new Error('isard: PMTiles directory larger than its bytes');\n const entries: PmtilesEntry[] = [];\n let id = 0;\n for (let i = 0; i < count; i += 1) {\n id += v.next();\n entries.push({ tileId: id, offset: 0, length: 0, runLength: 1 });\n }\n for (const e of entries) e.runLength = v.next();\n for (const e of entries) e.length = v.next();\n entries.forEach((e, i) => {\n const value = v.next();\n const previous = entries[i - 1];\n // 0 after the first: right after the previous entry's bytes\n e.offset = value === 0 && previous ? previous.offset + previous.length : value - 1;\n });\n return entries;\n}\n\n/** The entry holding a tile id: its run of tiles, or the leaf directory it falls in; undefined if none */\nexport function findEntry(entries: readonly PmtilesEntry[], id: number): PmtilesEntry | undefined {\n let [lo, hi] = [0, entries.length - 1];\n while (lo <= hi) {\n const mid = (lo + hi) >> 1;\n const e = entries[mid] as PmtilesEntry;\n if (e.tileId === id) return e;\n if (e.tileId < id) lo = mid + 1;\n else hi = mid - 1;\n }\n const e = entries[hi];\n if (!e) return undefined;\n if (e.runLength === 0 || id - e.tileId < e.runLength) return e;\n return undefined;\n}\n\n/** The header of an archive from its first bytes */\nexport function parseHeader(bytes: Uint8Array): PmtilesHeader {\n if (bytes.length < HEADER || String.fromCharCode(...bytes.subarray(0, 7)) !== 'PMTiles') {\n throw new Error('isard: not a PMTiles archive');\n }\n if (bytes[7] !== 3) throw new Error(`isard: PMTiles version ${bytes[7]} (only 3 is read)`);\n const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);\n const u64 = (at: number) => Number(view.getBigUint64(at, true));\n const deg = (at: number) => view.getInt32(at, true) / 1e7;\n return {\n rootDirectoryOffset: u64(8),\n rootDirectoryLength: u64(16),\n metadataOffset: u64(24),\n metadataLength: u64(32),\n leafDirectoryOffset: u64(40),\n leafDirectoryLength: u64(48),\n tileDataOffset: u64(56),\n tileDataLength: u64(64),\n internalCompression: view.getUint8(97),\n tileCompression: view.getUint8(98),\n tileType: TYPES[view.getUint8(99)] ?? 'unknown',\n minZoom: view.getUint8(100),\n maxZoom: view.getUint8(101),\n bounds: [deg(102), deg(106), deg(110), deg(114)],\n center: [deg(119), deg(123), view.getUint8(118)],\n };\n}\n\n/** Bytes as they are stored, decompressed (1: none, 2: gzip; 0, unknown, is read as none) */\nexport async function decompress(bytes: Uint8Array, compression: number): Promise<Uint8Array> {\n if (compression === 0 || compression === 1) return bytes;\n if (compression !== 2) {\n throw new Error(`isard: PMTiles compression ${compression === 3 ? 'brotli' : 'zstd'} is not read (gzip only)`);\n }\n const stream = new Blob([bytes as Uint8Array<ArrayBuffer>]).stream().pipeThrough(new DecompressionStream('gzip'));\n return new Uint8Array(await new Response(stream).arrayBuffer());\n}\n\n/** Past this, a whole file sent for a range request (a server ignoring ranges) is an error rather than kept */\nconst WHOLE_FILE_MAX = 64 * 1024 * 1024;\n\n/** A PMTiles archive at a URL (range requests) or in a `Blob` (a dropped file) */\nexport class PMTiles {\n private head: Promise<{ header: PmtilesHeader; root: PmtilesEntry[] }> | undefined;\n /** The leaf directories read, by offset */\n private readonly leaves = new Lru<number, Promise<PmtilesEntry[]>>(64);\n /** The whole file, when the server answered a range request with it (small files, `blob:` URLs) */\n private whole: Promise<Uint8Array> | undefined;\n\n constructor(readonly source: string | Blob) {}\n\n /** `length` bytes from `offset` */\n private async range(offset: number, length: number, signal?: AbortSignal): Promise<Uint8Array> {\n if (typeof this.source !== 'string') {\n return new Uint8Array(await this.source.slice(offset, offset + length).arrayBuffer());\n }\n if (this.whole) return (await this.whole).subarray(offset, offset + length);\n const response = await fetch(\n this.source,\n withHeaders(this.source, {\n headers: { Range: `bytes=${offset}-${offset + Math.max(length, 1) - 1}` },\n ...(signal ? { signal } : {}),\n }),\n );\n if (!response.ok) throw new Error(`${this.source}: HTTP ${response.status}`);\n if (response.status === 206) return new Uint8Array(await response.arrayBuffer());\n // The whole file: kept, when small enough, for the next ranges\n const size = Number(response.headers.get('Content-Length'));\n if (size > WHOLE_FILE_MAX) {\n await response.body?.cancel();\n throw new Error(`${this.source}: the server ignores range requests (HTTP 206 expected)`);\n }\n const whole = response.arrayBuffer().then((b) => new Uint8Array(b));\n this.whole = whole;\n whole.catch(() => {\n this.whole = undefined;\n });\n return (await whole).subarray(offset, offset + length);\n }\n\n private load() {\n this.head ??= (async () => {\n const first = await this.range(0, FIRST);\n const header = parseHeader(first);\n const { rootDirectoryOffset: o, rootDirectoryLength: n } = header;\n const raw = o + n <= first.length ? first.subarray(o, o + n) : await this.range(o, n);\n const root = parseDirectory(await decompress(raw, header.internalCompression));\n return { header, root };\n })();\n // A failure is not kept: asked again next time\n this.head.catch(() => {\n this.head = undefined;\n });\n return this.head;\n }\n\n /** The archive's header */\n async header(): Promise<PmtilesHeader> {\n return (await this.load()).header;\n }\n\n /** The archive's JSON metadata (`vector_layers`, `attribution`, `name`…); `{}` if it has none */\n async metadata(): Promise<Record<string, unknown>> {\n const { header } = await this.load();\n if (header.metadataLength === 0) return {};\n const raw = await this.range(header.metadataOffset, header.metadataLength);\n const text = new TextDecoder().decode(await decompress(raw, header.internalCompression));\n const value: unknown = JSON.parse(text);\n return value && typeof value === 'object' && !Array.isArray(value) ? (value as Record<string, unknown>) : {};\n }\n\n private leaf(header: PmtilesHeader, entry: PmtilesEntry): Promise<PmtilesEntry[]> {\n const offset = header.leafDirectoryOffset + entry.offset;\n let leaf = this.leaves.get(offset);\n if (!leaf) {\n leaf = this.range(offset, entry.length).then(async (raw) =>\n parseDirectory(await decompress(raw, header.internalCompression)),\n );\n leaf.catch(() => this.leaves.delete(offset));\n this.leaves.set(offset, leaf);\n }\n return leaf;\n }\n\n /** The bytes of tile z/x/y, decompressed (a vector tile ungzipped); undefined where the archive has none */\n async tile(z: number, x: number, y: number, signal?: AbortSignal): Promise<Uint8Array | undefined> {\n const { header, root } = await this.load();\n if (z < header.minZoom || z > header.maxZoom) return undefined;\n const id = zxyToTileId(z, x, y);\n let entries = root;\n // The root, then at most three levels of leaves\n for (let depth = 0; depth < 4; depth += 1) {\n const entry = findEntry(entries, id);\n if (!entry) return undefined;\n if (entry.runLength > 0) {\n const raw = await this.range(header.tileDataOffset + entry.offset, entry.length, signal);\n return decompress(raw, header.tileCompression);\n }\n entries = await this.leaf(header, entry);\n }\n throw new Error('isard: PMTiles directories nested too deep');\n }\n}\n\n/** The archives opened, by URL: one reader (and its directory cache) per archive in a page or worker */\nconst archives = new Lru<string, PMTiles>(16);\n\n/** The reader of an archive URL (without `pmtiles://`), shared */\nexport function pmtiles(url: string): PMTiles {\n let archive = archives.get(url);\n if (!archive) {\n archive = new PMTiles(url);\n archives.set(url, archive);\n }\n return archive;\n}\n\n/** The archive URL of a `pmtiles://` URL, absolute (relative to the page), or undefined for another URL */\nexport function pmtilesUrl(url: string, base?: string): string | undefined {\n if (!url.startsWith('pmtiles://')) return undefined;\n const inner = url.slice('pmtiles://'.length);\n const from = base ?? (globalThis as { location?: { href: string } }).location?.href;\n try {\n return from ? new URL(inner, from).href : inner;\n } catch {\n return inner;\n }\n}\n\n/** A tile URL `pmtiles://<archive>/{z}/{x}/{y}` (with its numbers in) read from its archive: its bytes, undefined\n * where there is none; undefined too (`false`) for a URL that is not one */\nexport function pmtilesTile(url: string, signal?: AbortSignal): Promise<Uint8Array | undefined> | false {\n const match = /^pmtiles:\\/\\/(.+)\\/(\\d+)\\/(\\d+)\\/(\\d+)$/.exec(url);\n if (!match) return false;\n const [, archive = '', z, x, y] = match;\n return pmtiles(archive).tile(Number(z), Number(x), Number(y), signal);\n}\n"]}
|
package/dist/pointclouds.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pointclouds.js","sourceRoot":"","sources":["../src/pointclouds.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAA0B,QAAQ,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACpE,OAAO,EAAgB,UAAU,EAAa,UAAU,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAsEpC;iCACiC;AACjC,MAAM,CAAC,MAAM,eAAe,GAA6D;IACvF,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE;IACtC,CAAC,EAAE,EAAE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ACF","sourcesContent":["/**\n * Point clouds: a COPC file (Cloud Optimized Point Cloud: LAZ 1.4 with an octree, read by HTTP range requests, as the\n * IGN distributes LiDAR HD) or a 3D Tiles point cloud (`.pnts`, glTF points), drawn by the engine with 3D Tiles. The\n * COPC file's CRS comes from its WKT (built-in CRSs, or registered ones: `registerCrs`) or the `crs` option; altitudes\n * in NGF-IGN69 (Lambert-93, the CC zones) are raised by the RAF20 geoid height onto the ellipsoid of the relief and\n * the 3D Tiles.\n */\nimport { type Crs, type CrsLike, epsgCode, getCrs } from './crs.ts';\nimport { type Feature, parseColor, type Ramp, rampTexels } from './features.ts';\nimport { Layer } from './layers.ts';\nimport type { LayerHost } from './types.ts';\nimport type {\n Engine,\n PointCloudCrs,\n PointCloudInfo,\n PointCloudPoint,\n PointCloudStats,\n Tiles3dStats,\n} from './wasm/isard.js';\n\n/** What the points are colored by */\nexport type PointColor = 'rgb' | 'classification' | 'elevation' | 'intensity';\n\n/** The look of a class of points */\nexport interface ClassStyle {\n /** CSS color */\n color?: string;\n /** false hides the class */\n visible?: boolean;\n}\n\nexport interface PointCloudStyle {\n /** By RGB (files with colors), class (the ASPRS palette, `classifications`), altitude (`elevationRamp` over\n * `elevationRange`) or intensity (grey over `intensityRange`). Default: RGB when the file has colors, else class */\n colorBy?: PointColor;\n /** CSS pixels: the size of the points, or the smallest with `sizeMode: 'adaptive'` (default 2) */\n pointSize: number;\n /** CSS pixels: the largest adaptive size (default 4) */\n maxPointSize: number;\n /** `'adaptive'` (default): the spacing of the points of the finest level drawn there, at their distance (the\n * nearer, the larger, no gap); `'fixed'`: `pointSize` everywhere */\n sizeMode: 'adaptive' | 'fixed';\n /** `'circle'` (default) or `'square'` */\n shape: 'circle' | 'square';\n /** Eye-Dome Lighting: points shaded by the depth of their neighbours on screen, their relief read without normals\n * nor colors (default false; `strength` 1, `radius` 1.4 CSS pixels) */\n edl: boolean | { strength?: number; radius?: number };\n /** Colors and visibility by class code, over the defaults (ASPRS, and IGN's LiDAR HD classes 64 to 67; the noise\n * 7 and 18 and the artefacts 65 hidden): `{ 2: { color: '#a0522d' }, 66: { visible: false } }` */\n classifications: Record<number, ClassStyle>;\n /** Altitudes (metres, the file's vertical datum) mapped onto the ramp; default the file's lowest and highest */\n elevationRange?: [min: number, max: number];\n /** Colors from the lowest altitude (0) to the highest (1) */\n elevationRamp: Ramp;\n /** Intensities mapped from black to white; default the bulk of the first node's (2nd to 98th percentile) */\n intensityRange?: [min: number, max: number];\n /** CSS pixels: a node is refined while the spacing of its points covers more on screen (default 1.5; lower is finer\n * and heavier). For 3D Tiles, their screen-space error (default 16) */\n maxScreenSpaceError: number;\n /** Points drawn at most, the nearest and the coarsest first (default 3 000 000) */\n pointBudget: number;\n}\n\nexport interface PointCloudOptions extends Partial<PointCloudStyle> {\n /** A COPC file (`.copc.laz`) or a 3D Tiles `tileset.json` of points */\n url: string;\n /** Default: `'3dtiles'` for a `.json` URL, else `'copc'` */\n format?: 'copc' | '3dtiles';\n /** The CRS of a COPC file without a WKT, or whose CRS is not built in (`proj4('EPSG:2992')`) */\n crs?: CrsLike;\n /** Its altitudes are above the geoid (NGF-IGN69), raised by the RAF20 geoid height; default for Lambert-93 and the\n * CC zones */\n geoid?: boolean;\n /** Metres of a unit of z; default the vertical unit of the WKT (a US survey foot…), else that of x and y */\n verticalScale?: number;\n /** Requests a second at most: 8 by default for the Géoplateforme (data.geopf.fr allows 10), no limit elsewhere */\n requestsPerSecond?: number;\n}\n\n/** The default classes: ASPRS LAS 1.4, then IGN's LiDAR HD (64 permanent structures, 65 artefacts, 66 virtual points,\n * 67 miscellaneous buildings) */\nexport const CLASSIFICATIONS: Readonly<Record<number, Readonly<Required<ClassStyle>>>> = {\n 0: { color: '#a6a6a6', visible: true },\n 1: { color: '#c8c8c8', visible: true },\n 2: { color: '#b08458', visible: true },\n 3: { color: '#9ccc65', visible: true },\n 4: { color: '#5aa83f', visible: true },\n 5: { color: '#2e7d32', visible: true },\n 6: { color: '#e57352', visible: true },\n 7: { color: '#ff00ff', visible: false },\n 8: { color: '#ff0000', visible: true },\n 9: { color: '#3d8fd6', visible: true },\n 10: { color: '#8e6bb0', visible: true },\n 11: { color: '#7a7a7a', visible: true },\n 12: { color: '#ffe680', visible: true },\n 13: { color: '#ffff00', visible: true },\n 14: { color: '#ffc800', visible: true },\n 15: { color: '#c89600', visible: true },\n 16: { color: '#ff9632', visible: true },\n 17: { color: '#b48cc8', visible: true },\n 18: { color: '#ff00ff', visible: false },\n 64: { color: '#8c6e5a', visible: true },\n 65: { color: '#ff00ff', visible: false },\n 66: { color: '#5a6ec8', visible: true },\n 67: { color: '#e6966e', visible: true },\n};\n\n/** The default ramp of the altitudes, low to high */\nexport const ELEVATION_RAMP: Ramp = [\n [0, '#2b83ba'],\n [0.25, '#abdda4'],\n [0.5, '#ffffbf'],\n [0.75, '#fdae61'],\n [1, '#d7191c'],\n];\n\n/** The colors of the 256 classes (RGBA, alpha 0 hides one) */\nexport function classPalette(overrides: Record<number, ClassStyle> = {}): Uint8Array {\n const out = new Uint8Array(256 * 4);\n for (let code = 0; code < 256; code += 1) {\n const base = CLASSIFICATIONS[code] ?? { color: '#c8c8c8', visible: true };\n const own = overrides[code] ?? {};\n const [r = 0, g = 0, b = 0] = parseColor(own.color ?? base.color);\n out.set([r * 255, g * 255, b * 255, (own.visible ?? base.visible) ? 255 : 0], code * 4);\n }\n return out;\n}\n\n/** The section of a WKT opening with one of `keywords` (`PROJCS[…]`), from its keyword to its closing bracket */\nfunction section(wkt: string, keywords: string[]): string | undefined {\n for (const keyword of keywords) {\n const start = wkt.indexOf(`${keyword}[`);\n if (start < 0) continue;\n let depth = 0;\n for (let i = start + keyword.length; i < wkt.length; i += 1) {\n if (wkt[i] === '[') depth += 1;\n else if (wkt[i] === ']' && --depth === 0) return wkt.slice(start, i + 1);\n }\n }\n return undefined;\n}\n\n/** The EPSG code a WKT section ends with (its own `AUTHORITY`, or `ID` in WKT2), the last of its nested ones */\nfunction lastCode(part: string): number | undefined {\n const codes = [...part.matchAll(/(?:AUTHORITY|ID)\\[\\s*\"EPSG\"\\s*,\\s*\"?(\\d+)\"?\\s*\\]/g)];\n const last = codes.at(-1)?.[1];\n return last === undefined ? undefined : Number(last);\n}\n\n/** The factor of the last `UNIT` (`LENGTHUNIT` in WKT2) of a WKT section */\nfunction lastUnit(part: string | undefined): number | undefined {\n const units = [...(part ?? '').matchAll(/(?:LENGTH)?UNIT\\[\\s*\"[^\"]*\"\\s*,\\s*([\\d.eE+-]+)/g)];\n const factor = Number(units.at(-1)?.[1]);\n return Number.isFinite(factor) && factor > 0 ? factor : undefined;\n}\n\n/** What a WKT says of a CRS: its EPSG code (projected first), the metres of a unit of z */\nexport function wktCrs(wkt: string): { code: number | undefined; verticalScale: number | undefined } {\n const projected = section(wkt, ['PROJCS', 'PROJCRS']);\n const geographic = section(wkt, ['GEOGCS', 'GEOGCRS']);\n let code = lastCode(projected ?? geographic ?? '');\n if (code === undefined && /Lambert[- ]93/i.test(wkt)) code = 2154;\n const vertical = section(wkt, ['VERT_CS', 'VERTCRS']);\n const verticalScale = lastUnit(vertical ?? projected);\n return { code, verticalScale };\n}\n\n/** Whether the altitudes of a CRS are NGF-IGN69 by default: Lambert-93 and the CC zones */\nconst FRENCH = (code: number | undefined) => code === 2154 || (code !== undefined && code >= 3942 && code <= 3950);\n\n/** The CRS of a COPC file for the engine, from its WKT and the options */\nexport function pointCloudCrs(\n wkt: string | undefined,\n options: Pick<PointCloudOptions, 'crs' | 'geoid' | 'verticalScale'>,\n): PointCloudCrs {\n const parsed = wkt ? wktCrs(wkt) : { code: undefined, verticalScale: undefined };\n let crs: Crs;\n let code = parsed.code;\n if (options.crs !== undefined) {\n crs = getCrs(options.crs);\n if (typeof options.crs === 'string') code = epsgCode(options.crs) ?? code;\n } else if (code !== undefined) {\n try {\n crs = getCrs(`EPSG:${code}`);\n } catch {\n throw new Error(`the CRS of the file, EPSG:${code}, is not built in: give it as \\`crs\\` (proj4('EPSG:${code}'))`);\n }\n } else {\n throw new Error('the file names no CRS: give it as `crs`');\n }\n const inverse = (xy: Float64Array) => {\n const out = new Float64Array(xy.length);\n for (let i = 0; i + 1 < xy.length; i += 2) {\n const [lon = Number.NaN, lat = Number.NaN] = crs.inverse([xy[i] as number, xy[i + 1] as number]);\n out[i] = lon;\n out[i + 1] = lat;\n }\n return out;\n };\n return {\n inverse,\n geoid: options.geoid ?? (FRENCH(code) || /IGN69|NGF/.test(wkt ?? '')),\n verticalScale: options.verticalScale ?? parsed.verticalScale ?? 1,\n };\n}\n\n/** The style numbers of the engine (`setPointCloudStyle`) */\nfunction styleNumbers(s: PointCloudStyle, rate: number): Float64Array {\n const colors: PointColor[] = ['rgb', 'classification', 'elevation', 'intensity'];\n let edl: { strength?: number; radius?: number } | undefined;\n if (s.edl) edl = s.edl === true ? {} : s.edl;\n const [emin = Number.NaN, emax = Number.NaN] = s.elevationRange ?? [];\n const [imin = Number.NaN, imax = Number.NaN] = s.intensityRange ?? [];\n return Float64Array.of(\n s.colorBy ? colors.indexOf(s.colorBy) : -1,\n s.pointSize,\n s.maxPointSize,\n s.sizeMode === 'fixed' ? 0 : 1,\n s.shape === 'square' ? 0 : 1,\n edl ? (edl.strength ?? 1) : 0,\n edl?.radius ?? 1.4,\n emin,\n emax,\n imin,\n imax,\n s.maxScreenSpaceError,\n s.pointBudget,\n rate,\n );\n}\n\n/** A point cloud (`GeoMap.addPointCloud`): COPC or 3D Tiles points; `pickFeature` gives a COPC point's attributes */\nexport class PointCloudLayer extends Layer {\n readonly url: string;\n readonly format: 'copc' | '3dtiles';\n private style: PointCloudStyle;\n private readonly options: PointCloudOptions;\n\n /** @internal */\n constructor(map: LayerHost, options: PointCloudOptions) {\n super(map);\n // Against the page: the decoding workers fetch it, and a relative URL would be theirs\n const base = typeof document === 'undefined' ? undefined : document.baseURI;\n this.url = base ? new URL(options.url, base).href : options.url;\n this.format = options.format ?? (/\\.json(?:[?#]|$)/i.test(options.url) ? '3dtiles' : 'copc');\n this.options = options;\n const tiles = this.format === '3dtiles';\n this.style = {\n ...(options.colorBy ? { colorBy: options.colorBy } : {}),\n pointSize: options.pointSize ?? 2,\n maxPointSize: options.maxPointSize ?? 4,\n sizeMode: options.sizeMode ?? 'adaptive',\n shape: options.shape ?? 'circle',\n edl: options.edl ?? false,\n classifications: options.classifications ?? {},\n ...(options.elevationRange ? { elevationRange: options.elevationRange } : {}),\n elevationRamp: options.elevationRamp ?? ELEVATION_RAMP,\n ...(options.intensityRange ? { intensityRange: options.intensityRange } : {}),\n maxScreenSpaceError: options.maxScreenSpaceError ?? (tiles ? 16 : 1.5),\n pointBudget: options.pointBudget ?? 3_000_000,\n };\n }\n\n /** @internal Drawn by the engine with 3D Tiles (the point cloud module loads with the first one) */\n override get needsFullEngine(): boolean {\n return true;\n }\n\n /** Changes the style, the rest kept */\n setStyle(style: Partial<PointCloudStyle>): void {\n this.style = { ...this.style, ...style };\n // Kept for its creation while the engine with 3D Tiles loads\n if (this.id < 0) return;\n this.apply(this.map.engine, this.id);\n this.map.requestRender();\n }\n\n getStyle(): Readonly<PointCloudStyle> {\n return this.style;\n }\n\n /** Loading counters; undefined once removed and while the engine with 3D Tiles loads */\n stats(): PointCloudStats | Tiles3dStats | undefined {\n if (this.id < 0) return undefined;\n return this.format === '3dtiles' ? this.map.engine.tiles3dStats(this.id) : this.map.engine.pointCloudStats(this.id);\n }\n\n /** What a COPC file says of itself (points, format, CRS, center, altitudes), once its head is read */\n info(): PointCloudInfo | undefined {\n return this.id < 0 || this.format === '3dtiles' ? undefined : this.map.engine.pointCloudInfo(this.id);\n }\n\n /** @internal The point picked (`pickFeature`, 'hoverfeature'): a Point at its longitude, latitude and height, its\n * attributes as properties */\n featureAt(index: number): Feature<PointCloudPoint> | undefined {\n if (this.id < 0 || this.format === '3dtiles') return undefined;\n const point = this.map.engine.pointCloudPoint(this.id, index);\n if (!point) return undefined;\n return {\n type: 'Feature',\n geometry: { type: 'Point', coordinates: [...point.lonLat, point.height] },\n properties: point,\n };\n }\n\n private apply(engine: Engine, id: number): void {\n const s = this.style;\n if (this.format === '3dtiles') {\n engine.setTiles3dStyle(id, s.maxScreenSpaceError, 1, s.pointSize, new Float32Array());\n return;\n }\n const rate = this.options.requestsPerSecond ?? (/^https?:\\/\\/data\\.geopf\\.fr\\//.test(this.url) ? 8 : 0);\n engine.setPointCloudStyle(\n id,\n styleNumbers(s, rate),\n classPalette(s.classifications),\n rampTexels(s.elevationRamp).rgba,\n );\n }\n\n /** @internal */\n protected create(engine: Engine): number {\n const id =\n this.format === '3dtiles'\n ? engine.addTiles3d(this.url, this.style.maxScreenSpaceError)\n : engine.addPointCloud(this.url, (wkt) => pointCloudCrs(wkt, this.options));\n this.apply(engine, id);\n return id;\n }\n}\n"]}
|
package/dist/protocol.js
DELETED
package/dist/protocol.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"","sourcesContent":["/** Messages between the main thread and the decoding workers */\nimport type { DecoderUrls } from './decoders.ts';\nimport type { HeaderRules } from './requests.ts';\nimport type { DecodedTile, TextureFormats } from './wasm/isard.js';\n\nexport type WorkerRequest =\n /** The page's request headers (`setRequestHeaders`) */\n | { type: 'headers'; rules: HeaderRules }\n | {\n type: 'init';\n module: WebAssembly.Module;\n decoders: DecoderUrls;\n formats: TextureFormats;\n /** URL of the point cloud module (`isard_points_bg.wasm`), loaded with the first COPC chunk */\n points: string;\n }\n | {\n type: 'load';\n id: number;\n url: string;\n transform: Float64Array;\n yUp: boolean;\n reload: boolean;\n priority?: 'high' | 'low';\n }\n | {\n type: 'points';\n id: number;\n url: string;\n offset: number;\n size: number;\n laz: Uint8Array;\n layout: Float64Array;\n grid: Float64Array;\n count: number;\n priority?: 'high' | 'low';\n }\n | { type: 'abort'; id: number };\n\nexport type WorkerReply =\n | { type: 'tile'; id: number; tile: DecodedTile }\n | { type: 'points'; id: number; vertices: Uint8Array<ArrayBuffer> }\n | { type: 'error'; id: number; error: string; aborted: boolean };\n"]}
|
package/dist/requests.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"requests.js","sourceRoot":"","sources":["../src/requests.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,IAAI,KAAK,GAAgB,EAAE,CAAC;AAC5B,MAAM,SAAS,GAAG,IAAI,GAAG,EAAgC,CAAC;AAE1D;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAc,EAAE,OAAgC;IAChF,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC;IACjD,IAAI,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC;QAAE,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC;IACpF,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;IAC7C,cAAc,CAAC,IAAI,CAAC,CAAC;IACrB,KAAK,MAAM,QAAQ,IAAI,SAAS;QAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;AACpD,CAAC;AAED,8BAA8B;AAC9B,MAAM,UAAU,WAAW;IACzB,OAAO,KAAK,CAAC;AACf,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,cAAc,CAAC,IAAiB;IAC9C,KAAK,GAAG,IAAI,CAAC;AACf,CAAC;AAED,sGAAsG;AACtG,MAAM,UAAU,aAAa,CAAC,QAAsC;IAClE,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACxB,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC1C,CAAC;AAED,+FAA+F;AAC/F,MAAM,UAAU,WAAW,CAAwB,GAAiB,EAAE,IAAQ;IAC5E,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IACzB,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IACrE,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,IAAK,EAAQ,CAAC;IACpD,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3C,KAAK,MAAM,CAAC,EAAE,GAAG,CAAC,IAAI,QAAQ;QAAE,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC;YAAE,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC1G,OAAO,EAAE,GAAG,CAAC,IAAI,IAAK,EAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;AAC7C,CAAC","sourcesContent":["/**\n * Headers added to the requests of the page by URL prefix: an access token for private sources (a Géoplateforme\n * private stream, a server behind single sign-on), on every request isard makes, from the page, its workers (vector\n * tiles, 3D Tiles and point clouds) and its engine (raster tiles, tilesets): `setRequestHeaders(prefix, headers)`,\n * again with a new token when it is renewed. The rules of a URL are merged, the longest prefix last (it wins).\n */\n\n/** Rules: a URL prefix and its headers, the shortest prefix first */\nexport type HeaderRules = [prefix: string, headers: Record<string, string>][];\n\nlet rules: HeaderRules = [];\nconst listeners = new Set<(rules: HeaderRules) => void>();\n\n/**\n * Adds `headers` to every request isard makes to a URL starting with `prefix` (in the page and its workers), or with\n * no headers, stops: `setRequestHeaders('https://data.geopf.fr/private/', { Authorization: 'Bearer …' })`. The\n * server must allow these headers (CORS). For the whole page: every map, the ones to come too\n */\nexport function setRequestHeaders(prefix: string, headers?: Record<string, string>): void {\n const kept = rules.filter(([p]) => p !== prefix);\n if (headers && Object.keys(headers).length > 0) kept.push([prefix, { ...headers }]);\n kept.sort(([p], [q]) => p.length - q.length);\n setHeaderRules(kept);\n for (const listener of listeners) listener(rules);\n}\n\n/** @internal The rules now */\nexport function headerRules(): HeaderRules {\n return rules;\n}\n\n/** @internal The rules, from the page (a worker's copy) */\nexport function setHeaderRules(next: HeaderRules): void {\n rules = next;\n}\n\n/** @internal Follows the rules (the workers and engines of a map); returns the function that stops */\nexport function onHeaderRules(listener: (rules: HeaderRules) => void): () => void {\n listeners.add(listener);\n return () => listeners.delete(listener);\n}\n\n/** @internal `init` with the headers of the rules matching `url` (unchanged when none does) */\nexport function withHeaders<T extends RequestInit>(url: string | URL, init?: T): T {\n const href = String(url);\n const matching = rules.filter(([prefix]) => href.startsWith(prefix));\n if (matching.length === 0) return init ?? ({} as T);\n const headers = new Headers(init?.headers);\n for (const [, set] of matching) for (const [name, value] of Object.entries(set)) headers.set(name, value);\n return { ...(init ?? ({} as T)), headers };\n}\n"]}
|
package/dist/resample.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resample.js","sourceRoot":"","sources":["../src/resample.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,wHAAwH;AACxH,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAuB/B;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CACtB,MAAyB,EACzB,KAAa,EACb,MAAc,EACd,IAAkB,EAClB,CAAS,EACT,IAAY;IAEZ,MAAM,GAAG,GAAG,IAAI,iBAAiB,CAAC,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC;IACnD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC;IACtB,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;gBAAS,CAAC;YACT,KAAK,MAAM,CAAC,EAAE,KAAK,CAAC,IAAI,OAAO;gBAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QAClD,CAAC;IACH,CAAC,CAAC;IACF,OAAO;QACL,IAAI;QACJ,KAAK;QACL,KAAK,EAAE,GAAG,EAAE;YACV,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE;gBAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YAChD,KAAK,CAAC,KAAK,EAAE,CAAC;QAChB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Raster reprojection, the drawing half: a Web Mercator tile drawn from the source images it spans (tiles of another\n * grid, or one image of a WMS), in a worker of the map (OffscreenCanvas) or in the page when the map has no workers.\n * The page plans each tile (`grid.ts`): which images, where they go in a mosaic, and a mesh of control points giving,\n * for the corners of 16 × 16 cells of the tile, the mosaic pixel under them. Here the images are fetched (kept for the\n * neighbouring tiles), drawn into the mosaic, and every pixel of the tile sampled from it, its source position\n * interpolated within its cell (bilinear), its color between the four nearest source pixels (bilinear, alpha\n * premultiplied). This code knows no projection.\n */\nimport { Lru } from './lru.ts';\nimport { withHeaders } from './requests.ts';\n\n/** Source images kept decoded (by the page, or shared by the workers of a pool): the neighbours of a tile share them */\nexport const SOURCE_CACHE = 96;\n\n/** A source image and the rectangle of the mosaic it covers (pixels) */\nexport interface Placed {\n url: string;\n x: number;\n y: number;\n w: number;\n h: number;\n}\n\n/** How to draw a Mercator tile of `size` pixels: the mosaic of the source images, and the mesh of `n` × `n` cells\n * ((n + 1)² points, rows from the north, x then y): the mosaic position of each corner, NaN where the source CRS has\n * none */\nexport interface Job {\n size: number;\n width: number;\n height: number;\n sources: Placed[];\n n: number;\n mesh: Float32Array;\n}\n\n/**\n * Samples the pixels of a `size` × `size` tile (RGBA, straight alpha) from a mosaic of `width` × `height` (RGBA,\n * straight alpha) through the mesh of a job. Pixels whose position falls outside the mosaic, or on a NaN, stay\n * transparent; the mosaic's edge fades over half a pixel\n */\nexport function resample(\n source: Uint8ClampedArray,\n width: number,\n height: number,\n mesh: Float32Array,\n n: number,\n size: number,\n): Uint8ClampedArray<ArrayBuffer> {\n const out = new Uint8ClampedArray(size * size * 4);\n const cell = size / n;\n const stride = n + 1;\n for (let row = 0; row < size; row += 1) {\n const fy = (row + 0.5) / cell;\n const j = Math.min(n - 1, Math.floor(fy));\n const ty = fy - j;\n for (let col = 0; col < size; col += 1) {\n const fx = (col + 0.5) / cell;\n const i = Math.min(n - 1, Math.floor(fx));\n const tx = fx - i;\n const a = 2 * (j * stride + i);\n const b = a + 2 * stride;\n // The corners of the cell, then the position in it\n const w00 = (1 - tx) * (1 - ty);\n const w10 = tx * (1 - ty);\n const w01 = (1 - tx) * ty;\n const w11 = tx * ty;\n const u =\n w00 * (mesh[a] as number) +\n w10 * (mesh[a + 2] as number) +\n w01 * (mesh[b] as number) +\n w11 * (mesh[b + 2] as number);\n const v =\n w00 * (mesh[a + 1] as number) +\n w10 * (mesh[a + 3] as number) +\n w01 * (mesh[b + 1] as number) +\n w11 * (mesh[b + 3] as number);\n // Pixel centers at half pixels: the four around (u, v)\n const sx = u - 0.5;\n const sy = v - 0.5;\n if (!(sx > -1 && sy > -1 && sx < width && sy < height)) continue;\n const x0 = Math.floor(sx);\n const y0 = Math.floor(sy);\n const kx = sx - x0;\n const ky = sy - y0;\n let r = 0;\n let g = 0;\n let bl = 0;\n let alpha = 0;\n for (let k = 0; k < 4; k += 1) {\n const x = x0 + (k & 1);\n const y = y0 + (k >> 1);\n if (x < 0 || y < 0 || x >= width || y >= height) continue;\n const p = 4 * (y * width + x);\n const wa = (k & 1 ? kx : 1 - kx) * (k >> 1 ? ky : 1 - ky) * (source[p + 3] as number);\n r += wa * (source[p] as number);\n g += wa * (source[p + 1] as number);\n bl += wa * (source[p + 2] as number);\n alpha += wa;\n }\n if (alpha <= 0) continue;\n const q = 4 * (row * size + col);\n out[q] = r / alpha;\n out[q + 1] = g / alpha;\n out[q + 2] = bl / alpha;\n out[q + 3] = alpha;\n }\n }\n return out;\n}\n\n/** Draws a planned tile: its image, null where the source has nothing; rejects on errors */\nexport type DrawJob = (job: Job, signal: AbortSignal) => Promise<ImageBitmap | null>;\n\n/**\n * Draws planned tiles, keeping `cached` source images decoded. A missing source image (404, 204, 410) leaves its part\n * empty; a tile with no source at all is missing; other errors reject (retried by the engine). In the page, or in a\n * worker of the map (`close` frees the images kept)\n */\nexport function resampler(cached = SOURCE_CACHE): { draw: DrawJob; close: () => void; cache: { capacity: number } } {\n type Image = Promise<ImageBitmap | null>;\n /** Tiles being drawn from each source image: an evicted one is closed once none is */\n const users = new Map<Image, number>();\n const evicted = new Set<Image>();\n const close = (image: Image) => {\n evicted.delete(image);\n image.then(\n (bitmap) => bitmap?.close(),\n () => undefined,\n );\n };\n /** Freed now, or once the tiles drawing from it are done */\n const drop = (image: Image) => {\n if (users.has(image)) evicted.add(image);\n else close(image);\n };\n // Source images by URL: a request is shared by the tiles that need it, its signal is not theirs\n const cache = new Lru<string, Image>(cached, drop);\n const release = (image: Image) => {\n const count = (users.get(image) ?? 1) - 1;\n if (count > 0) users.set(image, count);\n else {\n users.delete(image);\n if (evicted.has(image)) close(image);\n }\n };\n const fetchImage = (url: string): Image => {\n let image = cache.get(url);\n if (!image) {\n image = (async () => {\n const response = await fetch(url, withHeaders(url));\n if (response.status === 404 || response.status === 204 || response.status === 410) return null;\n if (!response.ok) throw new Error(`isard: ${response.status} for a raster to reproject`);\n return createImageBitmap(await response.blob());\n })();\n // A failure is not kept: the engine's retry fetches again\n image.catch(() => cache.delete(url));\n cache.set(url, image);\n }\n users.set(image, (users.get(image) ?? 0) + 1);\n return image;\n };\n const draw: DrawJob = async (job, signal) => {\n const pending = job.sources.map((s) => [s, fetchImage(s.url)] as const);\n try {\n const images = await Promise.all(pending.map(async ([s, image]) => [s, await image] as const));\n signal.throwIfAborted();\n if (!images.some(([, image]) => image)) return null;\n const canvas = new OffscreenCanvas(job.width, job.height);\n const context = canvas.getContext('2d', { willReadFrequently: true });\n if (!context) throw new Error('isard: no 2D canvas to reproject the tiles');\n for (const [s, image] of images) if (image) context.drawImage(image, s.x, s.y, s.w, s.h);\n const mosaic = context.getImageData(0, 0, job.width, job.height).data;\n const pixels = resample(mosaic, job.width, job.height, job.mesh, job.n, job.size);\n return createImageBitmap(new ImageData(pixels, job.size, job.size), { premultiplyAlpha: 'none' });\n } finally {\n for (const [, image] of pending) release(image);\n }\n };\n return {\n draw,\n cache,\n close: () => {\n for (const image of cache.values()) drop(image);\n cache.clear();\n },\n };\n}\n"]}
|
package/dist/style.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"style.js","sourceRoot":"","sources":["../src/style.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,GAAG,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmHX,CAAC;AAEF,MAAM,MAAM,GAAG,IAAI,OAAO,EAAY,CAAC;AAEvC,mHAAmH;AACnH,MAAM,UAAU,WAAW,CAAC,GAAa;IACvC,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC;QAAE,OAAO;IAC5B,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChB,MAAM,KAAK,GAAG,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACzC,KAAK,CAAC,OAAO,CAAC,KAAK,GAAG,EAAE,CAAC;IACzB,KAAK,CAAC,WAAW,GAAG,GAAG,CAAC;IACxB,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["/**\n * Styles of the DOM overlays (markers, popups, controls), injected once per document so the package needs no CSS\n * file. Colors are custom properties, defaults on the root with no specificity: an application restyles them on any\n * element around the map (its container's class may be replaced by a framework: nothing depends on it).\n */\n\nconst CSS = `\n:where(:root) {\n --isard-ctrl-bg: #fff;\n --isard-ctrl-fg: #333;\n --isard-ctrl-hover: rgb(0 0 0 / 0.05);\n --isard-ctrl-active: #1d2433;\n --isard-ctrl-active-fg: #fff;\n --isard-ctrl-border: #ddd;\n --isard-ctrl-shadow: 0 0 0 2px rgb(0 0 0 / 0.1);\n --isard-popup-bg: #fff;\n --isard-popup-fg: #1d2433;\n --isard-marker-color: #3a6fd8;\n --isard-attrib-bg: rgb(255 255 255 / 0.5);\n --isard-attrib-fg: rgb(0 0 0 / 0.75);\n --isard-focus: #3a6fd8;\n}\n.isard-canvas:focus { outline: none; }\n.isard-canvas:focus-visible { outline: 2px solid var(--isard-focus); outline-offset: -2px; }\n.isard-overlay { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }\n.isard-ctrl-top-left, .isard-ctrl-top-right, .isard-ctrl-bottom-left, .isard-ctrl-bottom-right {\n position: absolute; pointer-events: none; z-index: 2;\n}\n.isard-ctrl-top-left { top: 0; left: 0; }\n.isard-ctrl-top-right { top: 0; right: 0; }\n.isard-ctrl-bottom-left { bottom: 0; left: 0; }\n.isard-ctrl-bottom-right { bottom: 0; right: 0; }\n.isard-ctrl { clear: both; pointer-events: auto; transform: translate(0, 0); }\n.isard-ctrl-top-left .isard-ctrl { float: left; margin: 10px 0 0 10px; }\n.isard-ctrl-top-right .isard-ctrl { float: right; margin: 10px 10px 0 0; }\n.isard-ctrl-bottom-left .isard-ctrl { float: left; margin: 0 0 10px 10px; }\n.isard-ctrl-bottom-right .isard-ctrl { float: right; margin: 0 10px 10px 0; }\n.isard-ctrl-group { background: var(--isard-ctrl-bg); border-radius: 4px; box-shadow: var(--isard-ctrl-shadow); }\n.isard-ctrl-group button {\n display: block; width: 29px; height: 29px; padding: 0; margin: 0; border: 0; box-sizing: border-box;\n background: transparent; color: var(--isard-ctrl-fg); cursor: pointer; font: inherit;\n}\n.isard-ctrl-group button + button { border-top: 1px solid var(--isard-ctrl-border); }\n.isard-ctrl-group button:first-child { border-radius: 4px 4px 0 0; }\n.isard-ctrl-group button:last-child { border-radius: 0 0 4px 4px; }\n.isard-ctrl-group button:only-child { border-radius: inherit; }\n.isard-ctrl-group button:hover { background-color: var(--isard-ctrl-hover); }\n.isard-ctrl-group button:focus-visible { outline: 2px solid var(--isard-ctrl-active); outline-offset: -2px; }\n.isard-ctrl-group button.active { background: var(--isard-ctrl-active); color: var(--isard-ctrl-active-fg); }\n.isard-ctrl-group button svg { display: block; margin: auto; pointer-events: none; }\n.isard-ctrl-compass svg { transition: transform 0.05s; }\n.isard-marker { position: absolute; top: 0; left: 0; pointer-events: auto; will-change: transform; }\n.isard-marker-draggable { cursor: grab; touch-action: none; }\n.isard-marker-dragging { cursor: grabbing; }\n.isard-marker-stem { position: absolute; z-index: -1; width: 2px; margin-left: -1px; transform-origin: top center; background: var(--isard-marker-color); opacity: 0.8; pointer-events: none; }\n.isard-marker-stem::after { content: \"\"; position: absolute; bottom: -3px; left: -2px; width: 6px; height: 6px; border-radius: 50%; background: inherit; }\n.isard-marker-pin { display: block; color: var(--isard-marker-color); filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.35)); }\n.isard-panel { position: absolute; top: 0; left: 0; transform-origin: 0 0; pointer-events: auto; will-change: transform; }\n.isard-popup {\n position: absolute; top: 0; left: 0; display: flex; pointer-events: none; will-change: transform; z-index: 1;\n color: var(--isard-popup-fg);\n}\n.isard-popup-anchor-top, .isard-popup-anchor-top-left, .isard-popup-anchor-top-right { flex-direction: column; }\n.isard-popup-anchor-bottom, .isard-popup-anchor-bottom-left, .isard-popup-anchor-bottom-right {\n flex-direction: column-reverse;\n}\n.isard-popup-anchor-left { flex-direction: row; }\n.isard-popup-anchor-right { flex-direction: row-reverse; }\n.isard-popup-tip { width: 0; height: 0; border: 10px solid transparent; z-index: 1; }\n.isard-popup-anchor-top .isard-popup-tip { align-self: center; border-top: none; border-bottom-color: var(--isard-popup-bg); }\n.isard-popup-anchor-top-left .isard-popup-tip {\n align-self: flex-start; border-top: none; border-left: none; border-bottom-color: var(--isard-popup-bg);\n}\n.isard-popup-anchor-top-right .isard-popup-tip {\n align-self: flex-end; border-top: none; border-right: none; border-bottom-color: var(--isard-popup-bg);\n}\n.isard-popup-anchor-bottom .isard-popup-tip { align-self: center; border-bottom: none; border-top-color: var(--isard-popup-bg); }\n.isard-popup-anchor-bottom-left .isard-popup-tip {\n align-self: flex-start; border-bottom: none; border-left: none; border-top-color: var(--isard-popup-bg);\n}\n.isard-popup-anchor-bottom-right .isard-popup-tip {\n align-self: flex-end; border-bottom: none; border-right: none; border-top-color: var(--isard-popup-bg);\n}\n.isard-popup-anchor-left .isard-popup-tip { align-self: center; border-left: none; border-right-color: var(--isard-popup-bg); }\n.isard-popup-anchor-right .isard-popup-tip { align-self: center; border-right: none; border-left-color: var(--isard-popup-bg); }\n.isard-popup-content {\n position: relative; padding: 12px 14px; border-radius: 4px; background: var(--isard-popup-bg);\n box-shadow: 0 1px 4px rgb(0 0 0 / 0.2); pointer-events: auto; overflow-wrap: break-word;\n}\n.isard-popup-has-close .isard-popup-content { padding-right: 26px; }\n.isard-popup-anchor-top-left .isard-popup-content { border-top-left-radius: 0; }\n.isard-popup-anchor-top-right .isard-popup-content { border-top-right-radius: 0; }\n.isard-popup-anchor-bottom-left .isard-popup-content { border-bottom-left-radius: 0; }\n.isard-popup-anchor-bottom-right .isard-popup-content { border-bottom-right-radius: 0; }\n.isard-popup-close {\n position: absolute; top: 0; right: 0; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 0 4px 0 4px;\n background: transparent; color: inherit; font: 18px/22px system-ui, sans-serif; cursor: pointer;\n}\n.isard-popup-close:hover { background: rgb(0 0 0 / 0.05); }\n.isard-popup-close:focus-visible, .isard-attrib-button:focus-visible, .isard-attrib a:focus-visible {\n outline: 2px solid var(--isard-focus); outline-offset: -2px;\n}\n.isard-attrib {\n display: flex; align-items: center; gap: 4px; padding: 0 5px; border-radius: 4px; background: var(--isard-attrib-bg);\n color: var(--isard-attrib-fg); font: 12px/20px system-ui, sans-serif;\n}\n.isard-ctrl-bottom-right .isard-ctrl.isard-attrib, .isard-ctrl-bottom-left .isard-ctrl.isard-attrib { margin-bottom: 0; }\n.isard-ctrl-bottom-right .isard-ctrl.isard-attrib { margin-right: 0; border-radius: 4px 0 0 0; }\n.isard-ctrl-bottom-left .isard-ctrl.isard-attrib { margin-left: 0; border-radius: 0 4px 0 0; }\n.isard-attrib a { color: inherit; text-decoration: none; }\n.isard-attrib a:hover { text-decoration: underline; }\n.isard-attrib-button {\n display: none; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 12px; flex: none;\n background: var(--isard-ctrl-bg); color: var(--isard-ctrl-fg); cursor: pointer;\n}\n.isard-attrib-button svg { display: block; margin: auto; }\n.isard-ctrl.isard-attrib.isard-attrib-compact { min-height: 24px; padding: 2px; border-radius: 12px; margin: 0 10px 10px; }\n.isard-attrib-compact .isard-attrib-button { display: block; }\n.isard-attrib-compact .isard-attrib-inner { display: none; padding: 0 6px 0 2px; }\n.isard-attrib-compact.isard-attrib-open { background: var(--isard-ctrl-bg); }\n.isard-attrib-compact.isard-attrib-open .isard-attrib-inner { display: block; }\n`;\n\nconst styled = new WeakSet<Document>();\n\n/** Adds the overlay styles to a document, once; first in the head so application rules win at equal specificity */\nexport function injectStyle(doc: Document): void {\n if (styled.has(doc)) return;\n styled.add(doc);\n const style = doc.createElement('style');\n style.dataset.isard = '';\n style.textContent = CSS;\n doc.head.prepend(style);\n}\n"]}
|
package/dist/symbols.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"symbols.js","sourceRoot":"","sources":["../src/symbols.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,QAAQ,EAIR,UAAU,EAKV,UAAU,EAGV,KAAK,GACN,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EA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E,CAAC,CAAC;QAClB,UAAU,EAAE,CAAC;QACb,qBAAqB,EAAE,MAAM;QAC7B,WAAW,EAAE,KAAK;QAClB,YAAY,EAAE,KAAK;QACnB,WAAW,EAAE,MAAM;QACnB,kBAAkB,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QAChC,SAAS,EAAE,MAAM;QACjB,WAAW,EAAE,CAAC;QACd,GAAG,IAAI;KACR,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Text labels and icons from GeoJSON: at points, at the middle of lines, at the center of polygons. Shaped on the page,\n * placed by the engine every frame with collisions shared by all symbol layers (the top layer first, each layer in\n * data order), drawn with a halo, standing on the relief. The icons are the map's images (`map.addImage`, a vector\n * basemap's sprite), beside their text or stretched around it.\n */\nimport {\n evaluate,\n type Feature,\n type FeatureData,\n type FeatureLayerStyle,\n featuresOf,\n type Geometry,\n type Placement,\n type Position,\n type Properties,\n parseColor,\n type Size,\n type Styled,\n stops,\n} from './features.ts';\nimport { toMercator } from './geo.ts';\nimport { codes, DEFAULT_FONT, type Glyph, type Glyphs, type Shaping, shape, type TextPart } from './glyphs.ts';\nimport { type Icons, layoutIcon } from './icons.ts';\nimport { Layer } from './layers.ts';\nimport type { Anchor } from './overlay.ts';\nimport type { LayerHost } from './types.ts';\nimport type { Engine } from './wasm/isard.js';\n\nexport interface SymbolStyle<P = Properties> extends Omit<FeatureLayerStyle<P>, 'ramp'> {\n /** The text: a string (`\\n` breaks lines) or runs with their own scale and font; empty: no label */\n text: Styled<string | TextPart[], P>;\n /** A font of the map's glyphs (default `Noto Sans Regular`; also Bold and Italic with the default glyphs) */\n font: Styled<string, P>;\n /** CSS pixels, or zoom stops (default 12) */\n size: Styled<Size, P>;\n /** `'point'` (default): horizontal text; `'line'`: along the line at its middle, kept upright */\n placement: Styled<'point' | 'line', P>;\n color: Styled<string, P>;\n haloColor: Styled<string, P>;\n /** CSS pixels (default 0) */\n haloWidth: Styled<number, P>;\n /** Side of the text at the anchor (default `'center'`) */\n anchor: Styled<Anchor, P>;\n /** Shift, ems (default [0, 0]) */\n offset: Styled<[x: number, y: number], P>;\n /** Wrapping width, ems (default 10) */\n maxWidth: Styled<number, P>;\n /** Ems (default 1.2) */\n lineHeight: Styled<number, P>;\n /** Shown even where it overlaps other labels, and hiding none (MapLibre's allow-overlap and ignore-placement);\n * `'allow'`: shown even where it overlaps, still hiding the labels after it; `'ignore'`: shown only where it fits,\n * hiding none (default false) */\n overlap: Styled<Overlap, P>;\n /** Shown without its icon where the icon does not fit (default false) */\n textOptional: Styled<boolean, P>;\n /** An image of the map (`map.addImage`); empty: none (default) */\n icon: Styled<string, P>;\n /** Scale of the image, or zoom stops (default 1) */\n iconSize: Styled<Size, P>;\n /** Side of the icon at the anchor (default `'center'`) */\n iconAnchor: Styled<Anchor, P>;\n /** Shift, CSS pixels at size 1 (default [0, 0]) */\n iconOffset: Styled<[x: number, y: number], P>;\n /** Degrees, clockwise (default 0) */\n iconRotate: Styled<number, P>;\n /** `'viewport'`: facing the screen; `'map'`: turning with the map, along its line when placed on one; `'auto'`\n * (default): `'map'` with the `'line'` placement */\n iconRotationAlignment: Styled<'map' | 'viewport' | 'auto', P>;\n /** As `overlap`, for the icon (default false) */\n iconOverlap: Styled<Overlap, P>;\n /** Shown without its text where the text does not fit (default false) */\n iconOptional: Styled<boolean, P>;\n /** Stretched around its text: its width, its height, both (a road shield; `'none'` by default) */\n iconTextFit: Styled<'none' | 'width' | 'height' | 'both', P>;\n /** Room around the text of a fitted icon: top, right, bottom, left (CSS pixels, default 0) */\n iconTextFitPadding: Styled<[top: number, right: number, bottom: number, left: number], P>;\n /** Color of a signed distance field image (default black) */\n iconColor: Styled<string, P>;\n /** 0 to 1 (default 1) */\n iconOpacity: Styled<number, P>;\n}\n\n/** How a label's text or icon meets the others: `true` shown wherever and hiding none, `'allow'` shown wherever,\n * `'ignore'` hiding none, `false` neither (MapLibre's allow-overlap and ignore-placement) */\nexport type Overlap = boolean | 'allow' | 'ignore';\n\nexport interface SymbolOptions<P = Properties> extends Partial<SymbolStyle<P>>, Placement {\n data: FeatureData<P>;\n}\n\n/** Where a geometry is labelled: its points, the middle of its longest line (with the direction of the line there),\n * the centroid of its largest polygon */\nfunction anchors(geometry: Geometry | null): { at: Position; along?: [number, number] }[] {\n return points(geometry).map((p) => (p.length > 2 ? { at: [p[0], p[1]], along: [p[2] ?? 0, p[3] ?? 0] } : { at: p }));\n}\n\n/** Anchors as positions, a line's carrying the direction (lon, lat, dlon, dlat) */\nfunction points(geometry: Geometry | null): Position[] {\n if (!geometry) return [];\n switch (geometry.type) {\n case 'Point':\n return [geometry.coordinates];\n case 'MultiPoint':\n return geometry.coordinates;\n case 'LineString':\n case 'MultiLineString': {\n const lines = geometry.type === 'LineString' ? [geometry.coordinates] : geometry.coordinates;\n const length = (l: Position[]) =>\n l.slice(1).reduce((s, p, i) => s + Math.hypot(p[0] - (l[i]?.[0] ?? 0), p[1] - (l[i]?.[1] ?? 0)), 0);\n const line = lines.reduce((a, b) => (length(b) > length(a) ? b : a), lines[0] ?? []);\n let rest = length(line) / 2;\n for (let i = 1; i < line.length; i += 1) {\n const [a, b] = [line[i - 1], line[i]];\n if (!a || !b) continue;\n const d = Math.hypot(b[0] - a[0], b[1] - a[1]);\n if (d >= rest && d > 0) {\n return [[a[0] + ((b[0] - a[0]) * rest) / d, a[1] + ((b[1] - a[1]) * rest) / d, b[0] - a[0], b[1] - a[1]]];\n }\n rest -= d;\n }\n return line[0] ? [line[0]] : [];\n }\n case 'Polygon':\n case 'MultiPolygon': {\n const polygons = geometry.type === 'Polygon' ? [geometry.coordinates] : geometry.coordinates;\n let best: Position | undefined;\n let bestArea = 0;\n for (const p of polygons) {\n const ring = p[0] ?? [];\n let [a, cx, cy] = [0, 0, 0];\n for (let i = 0; i + 1 < ring.length; i += 1) {\n const [x0, y0] = ring[i] ?? [0, 0];\n const [x1, y1] = ring[i + 1] ?? [0, 0];\n const cross = x0 * y1 - x1 * y0;\n a += cross;\n cx += (x0 + x1) * cross;\n cy += (y0 + y1) * cross;\n }\n if (Math.abs(a) > bestArea) {\n bestArea = Math.abs(a);\n best = [cx / (3 * a), cy / (3 * a)];\n }\n }\n return best ? [best] : [];\n }\n case 'GeometryCollection':\n return geometry.geometries.flatMap(points);\n }\n}\n\n/** The map's glyphs and icons, for a layer */\nexport interface GlyphHost extends LayerHost {\n readonly glyphs: Glyphs;\n readonly icons: Icons;\n}\n\n/** Flags of a label for the engine (`flag` in symbols.rs) */\nconst FLAG = {\n textOverlap: 1,\n textIgnore: 2,\n iconOverlap: 4,\n iconIgnore: 8,\n textOptional: 16,\n iconOptional: 32,\n text: 64,\n icon: 128,\n textAlong: 256,\n iconAlong: 512,\n iconUpright: 1024,\n} as const;\n\n/** Flags of an overlap: allowed to overlap, ignored by the placement */\nfunction overlapFlags(overlap: Overlap, allow: number, ignore: number): number {\n if (overlap === true) return allow | ignore;\n if (overlap === 'allow') return allow;\n return overlap === 'ignore' ? ignore : 0;\n}\n\n/** Room around an icon's box, CSS pixels (MapLibre's default `icon-padding`) */\nconst ICON_PADDING = 2;\n\n/** Labels built for the engine: an anchor (Mercator x, y), a collision box, a style per label; glyph quads whose first\n * number is their label's index */\ninterface Labels {\n anchors: Float64Array;\n boxes: Float32Array;\n styles: Float32Array;\n quads: Float32Array;\n}\n\n/** Numbers per quad: its label's index, its place, its atlas coordinates, its scale (a glyph's; -1 or -2: an icon),\n * its turn */\nconst QUAD = 11;\n\n/** The labels of a group of features, kept while they stay valid: same style, the same index of the group's first\n * feature (unless the style reads no index), and their glyphs and icons complete or none added since */\ninterface Chunk extends Labels {\n count: number;\n style: number;\n base: number;\n glyphs: number;\n icons: number;\n complete: boolean;\n}\n\n/** Every character of a run has its glyph */\nfunction present(part: TextPart, loaded: Map<string, Map<number, Glyph>>): boolean {\n const glyphs = loaded.get(part.font ?? DEFAULT_FONT);\n if (!glyphs) return false;\n for (const ch of part.text) if (ch !== '\\n' && !glyphs.has(ch.codePointAt(0) ?? 32)) return false;\n return true;\n}\n\n/** The labels of chunks one after the other, the quads' label indices moved past those of the chunks before */\nfunction concat(chunks: readonly Chunk[]): Labels {\n if (chunks.length === 1 && chunks[0]) return chunks[0];\n const length = (key: keyof Labels) => chunks.reduce((n, c) => n + c[key].length, 0);\n const out: Labels = {\n anchors: new Float64Array(length('anchors')),\n boxes: new Float32Array(length('boxes')),\n styles: new Float32Array(length('styles')),\n quads: new Float32Array(length('quads')),\n };\n const at = { anchors: 0, boxes: 0, styles: 0, quads: 0 };\n let labels = 0;\n for (const c of chunks) {\n out.anchors.set(c.anchors, at.anchors);\n out.boxes.set(c.boxes, at.boxes);\n out.styles.set(c.styles, at.styles);\n out.quads.set(c.quads, at.quads);\n if (labels > 0)\n for (let q = at.quads; q < at.quads + c.quads.length; q += QUAD) out.quads[q] = (out.quads[q] ?? 0) + labels;\n at.anchors += c.anchors.length;\n at.boxes += c.boxes.length;\n at.styles += c.styles.length;\n at.quads += c.quads.length;\n labels += c.count;\n }\n return out;\n}\n\nexport class SymbolLayer<P = Properties> extends Layer {\n private list: Feature<P>[];\n /** The features in groups that do not change (`setGroups`): each group's labels kept between updates */\n private groups: readonly (readonly Feature<P>[])[] | undefined;\n private readonly chunks = new WeakMap<readonly Feature<P>[], Chunk>();\n /** Bumped by each change: a shaping that finished after a newer one began is dropped */\n private generation = 0;\n /** Bumped by each change of style: the labels kept are shaped again */\n private styleGeneration = 0;\n /** No style function takes the index of a feature: a group's labels do not depend on its place */\n private indexFree = true;\n private labels: Labels | undefined;\n\n /** @internal */\n constructor(\n private readonly host: GlyphHost,\n data: FeatureData<P>,\n private style: SymbolStyle<P>,\n ) {\n super(host);\n this.list = featuresOf(data);\n this.styled();\n }\n\n get features(): readonly Feature<P>[] {\n return this.list;\n }\n\n setData(data: FeatureData<P>): void {\n this.list = featuresOf(data);\n this.groups = undefined;\n void this.update();\n }\n\n /**\n * @internal The features as groups that are never changed once given (the labels of a vector tile and style layer),\n * in order: the labels of a group seen before are not shaped again\n */\n setGroups(groups: readonly (readonly Feature<P>[])[]): void {\n this.groups = groups;\n this.list = groups.flat();\n void this.update();\n }\n\n setStyle(style: Partial<SymbolStyle<P>>): void {\n this.style = { ...this.style, ...style };\n this.styled();\n void this.update();\n }\n\n setFilter(filter: ((properties: P, index: number) => boolean) | undefined): void {\n this.setStyle({ filter } as Partial<SymbolStyle<P>>);\n }\n\n setVisible(visible: boolean): void {\n this.style = { ...this.style, visible };\n this.sendLayer(this.map.engine, this.id);\n this.map.requestRender();\n }\n\n private styled(): void {\n this.styleGeneration += 1;\n // A function of one parameter reads the properties only\n this.indexFree = Object.values(this.style).every((v) => typeof v !== 'function' || v.length < 2);\n }\n\n /** The runs of text of each feature of a group (none for a feature filtered out) */\n private parts(group: readonly Feature<P>[], base: number): TextPart[][] {\n const { text, font, filter } = this.style;\n return group.map((f, k): TextPart[] => {\n const i = base + k;\n if (filter && !filter(f.properties, i)) return [];\n const t = evaluate(text, f.properties, i);\n const own = evaluate(font, f.properties, i);\n // Each run in its font, the feature's by default\n return (typeof t === 'string' ? [{ text: t }] : t).map((p) => ({ ...p, font: p.font ?? own }));\n });\n }\n\n /** Shapes the labels (loading their glyphs first) and sends them; the groups' labels still valid are kept */\n private async update(): Promise<void> {\n const generation = ++this.generation;\n const groups = this.groups ?? [this.list];\n const keep = this.groups !== undefined;\n const glyphs = this.host.glyphs;\n const todo: { group: readonly Feature<P>[]; base: number; parts: TextPart[][] }[] = [];\n let base = 0;\n for (const group of groups) {\n const c = keep ? this.chunks.get(group) : undefined;\n const valid =\n c !== undefined &&\n c.style === this.styleGeneration &&\n (c.base === base || this.indexFree) &&\n (c.complete || (c.glyphs === glyphs.version && c.icons === this.host.icons.version));\n if (!valid) todo.push({ group, base, parts: this.parts(group, base) });\n base += group.length;\n }\n const byFont = new Map<string, Set<number>>();\n for (const { parts } of todo) {\n for (const p of parts.flat()) {\n const key = p.font ?? DEFAULT_FONT;\n const set = byFont.get(key) ?? new Set<number>();\n for (const code of codes([p])) set.add(code);\n byFont.set(key, set);\n }\n }\n const loaded = new Map<string, Map<number, Glyph>>();\n await Promise.all(\n [...byFont].map(async ([f, set]) => {\n loaded.set(f, await glyphs.load(f, set));\n }),\n );\n if (generation !== this.generation) return;\n const built = new Map<readonly Feature<P>[], Chunk>();\n for (const { group, base: b, parts } of todo) {\n const chunk = this.build(group, b, parts, loaded);\n built.set(group, chunk);\n if (keep) this.chunks.set(group, chunk);\n }\n this.labels = concat(groups.map((g) => built.get(g) ?? (this.chunks.get(g) as Chunk)));\n // The icons packed for them\n this.host.icons.flush();\n this.send(this.map.engine, this.id);\n this.map.requestRender();\n }\n\n /** The labels of a group of features, `base` the index of its first feature */\n private build(\n group: readonly Feature<P>[],\n base: number,\n parts: TextPart[][],\n loaded: Map<string, Map<number, Glyph>>,\n ): Chunk {\n const { font, size, anchor, offset, maxWidth, lineHeight, color, haloColor, haloWidth, overlap, placement } =\n this.style;\n const st = this.style;\n const icons = this.host.icons;\n const anchorList: number[] = [];\n const boxes: number[] = [];\n const styles: number[] = [];\n const iconQuads: number[] = [];\n const textQuads: number[] = [];\n let count = 0;\n let complete = true;\n group.forEach((f, k) => {\n const i = base + k;\n const p = f.properties;\n const text = parts[k];\n const filtered = st.filter !== undefined && !st.filter(p, i);\n const hasText = !!text?.length && text.some((t) => t.text);\n const iconName = filtered ? '' : evaluate(st.icon, p, i);\n const icon = iconName ? icons.get(iconName) : undefined;\n // An image not added yet: laid out again once more are\n if (iconName && !icon) complete = false;\n if (!hasText && !icon) return;\n // Glyphs still missing: shaped again once more glyphs are loaded\n if (complete && text && !text.every((t) => present(t, loaded))) complete = false;\n // Shaped at its largest size; the engine scales by the zoom stops\n const shapedAt = (v: Size) => (typeof v === 'number' ? v : Math.max(...v.map(([, x]) => x), 1e-6));\n const scaleOf = (v: Size, at: number): Size =>\n typeof v === 'number' ? 1 : v.map(([z, x]): [number, number] => [z, x / at]);\n const s0 = evaluate(size, p, i);\n const shaped = shapedAt(s0);\n const scale = scaleOf(s0, shaped);\n let s: Shaping | undefined;\n if (hasText && text) {\n s = shape(text, (name) => loaded.get(name), {\n font: evaluate(font, p, i),\n size: shaped,\n maxWidth: evaluate(maxWidth, p, i),\n lineHeight: evaluate(lineHeight, p, i),\n anchor: evaluate(anchor, p, i),\n offset: evaluate(offset, p, i),\n });\n if (!s.quads.length) s = undefined;\n }\n if (!s && !icon) return;\n const along = evaluate(placement, p, i) === 'line';\n let flags = overlapFlags(evaluate(overlap, p, i), FLAG.textOverlap, FLAG.textIgnore);\n if (evaluate(st.textOptional, p, i)) flags |= FLAG.textOptional;\n if (s) flags |= FLAG.text;\n // The icon: beside its text, or stretched around it (then scaled and turned with it)\n let iconScale: Size = 1;\n let iconBox: [number, number, number, number] = [0, 0, 0, 0];\n let iconColor: [number, number, number, number] = [0, 0, 0, 0];\n let quads: number[][] = [];\n let iconTurns = false;\n let fitted = false;\n if (icon) {\n const fit = evaluate(st.iconTextFit, p, i);\n fitted = fit !== 'none' && s !== undefined;\n const i0 = evaluate(st.iconSize, p, i);\n const iconShaped = fitted ? 1 : shapedAt(i0);\n iconScale = fitted ? scale : scaleOf(i0, iconShaped);\n const laid = layoutIcon(icon, {\n size: iconShaped,\n anchor: evaluate(st.iconAnchor, p, i),\n offset: evaluate(st.iconOffset, p, i),\n rotate: evaluate(st.iconRotate, p, i),\n fit,\n padding: evaluate(st.iconTextFitPadding, p, i),\n text: s?.layout,\n });\n quads = laid.quads;\n if (quads.length) {\n flags |= FLAG.icon | overlapFlags(evaluate(st.iconOverlap, p, i), FLAG.iconOverlap, FLAG.iconIgnore);\n if (evaluate(st.iconOptional, p, i)) flags |= FLAG.iconOptional;\n const alignment = evaluate(st.iconRotationAlignment, p, i);\n if (fitted) flags |= FLAG.iconUpright;\n iconTurns = alignment === 'map' || (alignment === 'auto' && along);\n iconBox = [\n laid.box[0] - ICON_PADDING,\n laid.box[1] - ICON_PADDING,\n laid.box[2] + ICON_PADDING,\n laid.box[3] + ICON_PADDING,\n ];\n const [r, g, b, a] = parseColor(evaluate(st.iconColor, p, i));\n iconColor = [r, g, b, a * Math.max(0, Math.min(1, evaluate(st.iconOpacity, p, i)))];\n }\n }\n if (!(flags & (FLAG.text | FLAG.icon))) return;\n const halo = s ? evaluate(haloWidth, p, i) : 0;\n const fill = parseColor(evaluate(color, p, i));\n const haloRgba = parseColor(evaluate(haloColor, p, i));\n // The collision box: the ink, with the halo and a little room\n const pad = halo + 1;\n const textBox = s ? [s.box[0] - pad, s.box[1] - pad, s.box[2] + pad, s.box[3] + pad] : [0, 0, 0, 0];\n for (const { at, along: line } of anchors(f.geometry)) {\n const label = count++;\n const [x, y] = toMercator(at);\n anchorList.push(x, y);\n // The text along its line, kept upright; the icon turning with the map (along its line, or with the east at a\n // point), or with its text when fitted to it\n const textAlong = along && line !== undefined && s !== undefined;\n const iconAlong = (flags & FLAG.icon) !== 0 && (fitted ? textAlong : iconTurns);\n let labelFlags = flags | (textAlong ? FLAG.textAlong : 0) | (iconAlong ? FLAG.iconAlong : 0);\n // The direction of its line in Mercator (y towards the south)\n let direction: [number, number] = [0, 0];\n if (line && (textAlong || iconAlong)) {\n const [x1, y1] = toMercator([at[0] + line[0], at[1] + line[1]]);\n direction = [x1 - x, y1 - y];\n } else if (iconAlong) {\n direction = [1, 0];\n }\n if (direction[0] === 0 && direction[1] === 0) labelFlags &= ~(FLAG.textAlong | FLAG.iconAlong);\n boxes.push(...textBox);\n styles.push(\n ...fill,\n ...haloRgba,\n halo,\n labelFlags,\n ...direction,\n ...stops(scale),\n ...iconBox,\n ...iconColor,\n ...stops(iconScale),\n );\n for (const q of quads) iconQuads.push(label, ...q);\n if (s) for (const q of s.quads) textQuads.push(label, ...q, 0);\n }\n });\n return {\n anchors: Float64Array.from(anchorList),\n boxes: Float32Array.from(boxes),\n styles: Float32Array.from(styles),\n // The icons under the texts\n quads: Float32Array.from([...iconQuads, ...textQuads]),\n count,\n style: this.styleGeneration,\n base,\n glyphs: this.host.glyphs.version,\n icons: icons.version,\n complete,\n };\n }\n\n private send(engine: Engine, id: number): void {\n const l = this.labels;\n if (l) engine.setSymbols(id, l.anchors, l.boxes, l.styles, l.quads);\n this.sendLayer(engine, id);\n }\n\n private sendLayer(engine: Engine, id: number): void {\n const { opacity, minZoom, maxZoom, visible } = this.style;\n // The sizes are per label; the layer's own scale stays 1\n engine.setSymbolLayer(\n id,\n Float32Array.from(stops(1)),\n Float32Array.from(stops(opacity)),\n minZoom,\n maxZoom,\n visible,\n );\n }\n\n /** @internal */\n protected create(engine: Engine): number {\n const id = engine.addSymbols();\n if (this.labels) this.send(engine, id);\n else {\n this.sendLayer(engine, id);\n // The first shaping, once the id is known\n queueMicrotask(() => void this.update());\n }\n return id;\n }\n}\n\nexport function symbolStyle<P>(options: SymbolOptions<P>): SymbolStyle<P> {\n const { data: _, before: __, ...rest } = options;\n return {\n opacity: 1,\n minZoom: 0,\n maxZoom: 24,\n visible: true,\n filter: undefined,\n text: '',\n font: DEFAULT_FONT,\n size: 12,\n color: '#000',\n haloColor: '#fff',\n haloWidth: 0,\n anchor: 'center',\n placement: 'point',\n offset: [0, 0],\n maxWidth: 10,\n lineHeight: 1.2,\n overlap: false,\n textOptional: false,\n icon: '',\n iconSize: 1,\n iconAnchor: 'center',\n iconOffset: [0, 0],\n iconRotate: 0,\n iconRotationAlignment: 'auto',\n iconOverlap: false,\n iconOptional: false,\n iconTextFit: 'none',\n iconTextFitPadding: [0, 0, 0, 0],\n iconColor: '#000',\n iconOpacity: 1,\n ...rest,\n };\n}\n"]}
|
package/dist/terrain.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"terrain.js","sourceRoot":"","sources":["../src/terrain.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAK5C,MAAM,IAAI,GAAG,GAAG,CAAC;AAEjB,wGAAwG;AACxG,MAAM,UAAU,aAAa,CAC3B,IAAoC,EACpC,QAAqB,EAC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AAE,IAAI,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC/E,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;AACH,CAAC;AAWD;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAClC,GAAW,EACX,QAAqB,EACrB,KAAc,EACd,MAAsB;IAEtB,MAAM,OAAO,GAAY,EAAE,CAAC;IAC5B,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE;QACzB,MAAM,IAAI,GAAG,GAAG,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACxG,OAAO,MAAM,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,IAAI,YAAY,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACpH,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Altitudes encoded in the colors of PNG tiles, for the relief: Terrarium (Mapzen, the Terrain Tiles of AWS) and\n * Terrain-RGB (Mapbox, MapTiler). The engine reads raw floats only; a loader gives it the altitudes of each tile,\n * decoded in a worker of the map's pool (OffscreenCanvas), or in the page when the map has no workers.\n */\nimport { withHeaders } from './requests.ts';\n\n/** The encodings of altitudes in the colors of PNG tiles */\nexport type PngEncoding = 'terrarium' | 'mapbox';\n\nconst SIZE = 256;\n\n/** Altitudes (metres, rows from the north) of RGBA pixels in an encoding; below `floor` raised to it */\nexport function decodeHeights(\n rgba: Uint8ClampedArray | Uint8Array,\n encoding: PngEncoding,\n floor = Number.NEGATIVE_INFINITY,\n): Float32Array {\n const n = rgba.length >> 2;\n const out = new Float32Array(n);\n // A loop per encoding, without allocations: 65 536 pixels a tile\n if (encoding === 'terrarium') {\n for (let i = 0, j = 0; i < n; i += 1, j += 4) {\n const h = (rgba[j] as number) * 256 + (rgba[j + 1] as number) + (rgba[j + 2] as number) / 256 - 32768;\n out[i] = h > floor ? h : floor;\n }\n } else {\n for (let i = 0, j = 0; i < n; i += 1, j += 4) {\n const h = -10000 + ((rgba[j] as number) * 65536 + (rgba[j + 1] as number) * 256 + (rgba[j + 2] as number)) * 0.1;\n out[i] = h > floor ? h : floor;\n }\n }\n return out;\n}\n\n/** Where the tiles are drawn and read back, made on first use and kept (each tile drawn and read at once) */\nexport interface Surface {\n canvas?: OffscreenCanvas;\n}\n\n/**\n * The altitudes of the PNG tile at `url`: 256 × 256, null where the server has no tile; a network or server error\n * rejects (the engine retries). Where it runs: in a worker of the map, or in the page without workers\n */\nexport async function fetchHeights(\n url: string,\n encoding: PngEncoding,\n floor: number | undefined,\n signal: AbortSignal,\n surface: Surface,\n): Promise<Float32Array | null> {\n const response = await fetch(url, withHeaders(url, { signal }));\n if (response.status === 404 || response.status === 204 || response.status === 410) return null;\n if (!response.ok) throw new Error(`${response.url}: ${response.status}`);\n // The colors as stored: no color management, no premultiplied alpha\n const bitmap = await createImageBitmap(await response.blob(), {\n premultiplyAlpha: 'none',\n colorSpaceConversion: 'none',\n });\n try {\n surface.canvas ??= new OffscreenCanvas(SIZE, SIZE);\n const g = surface.canvas.getContext('2d', { willReadFrequently: true });\n if (!g) throw new Error('no 2D context');\n // Another size is resampled to the nearest pixel: an interpolated color is no altitude\n g.imageSmoothingEnabled = false;\n g.clearRect(0, 0, SIZE, SIZE);\n g.drawImage(bitmap, 0, 0, SIZE, SIZE);\n return decodeHeights(g.getImageData(0, 0, SIZE, SIZE).data, encoding, floor);\n } finally {\n bitmap.close();\n }\n}\n\n/** `fetchHeights` run in a worker for tile `z`/`x`/`y`; undefined when the map has no workers (run in the page) */\nexport type RemoteHeights = (\n url: string,\n encoding: PngEncoding,\n floor: number | undefined,\n tile: [z: number, x: number, y: number],\n signal: AbortSignal,\n) => Promise<Float32Array | null> | undefined;\n\n/**\n * A loader of the engine's relief for PNG tiles of `url` ({z}, {x}, {y}) in an encoding: 256 × 256 altitudes, null\n * where the server has no tile; a network or server error rejects (retried). `floor`: the lowest altitude kept (the\n * sea floor of a worldwide model flattened at sea level). `remote`: decodes in a worker when it can\n */\nexport function encodedTerrainLoader(\n url: string,\n encoding: PngEncoding,\n floor?: number,\n remote?: RemoteHeights,\n): (z: number, x: number, y: number, signal: AbortSignal) => Promise<Float32Array | null> {\n const surface: Surface = {};\n return (z, x, y, signal) => {\n const tile = url.replaceAll('{z}', String(z)).replaceAll('{x}', String(x)).replaceAll('{y}', String(y));\n return remote?.(tile, encoding, floor, [z, x, y], signal) ?? fetchHeights(tile, encoding, floor, signal, surface);\n };\n}\n"]}
|