isard 1.3.0 → 1.4.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.
Files changed (61) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +2 -0
  3. package/dist/basemap/basemaps.js +1 -0
  4. package/dist/basemap/basemaps.js.map +1 -1
  5. package/dist/basemap/vectortiles.d.ts +26 -0
  6. package/dist/basemap/vectortiles.js +125 -1
  7. package/dist/basemap/vectortiles.js.map +1 -1
  8. package/dist/basemap/workerpool.js +9 -0
  9. package/dist/basemap/workerpool.js.map +1 -1
  10. package/dist/basemap.worker.js +2 -2
  11. package/dist/basemap.worker.js.map +7 -4
  12. package/dist/bind/layers.js +10 -0
  13. package/dist/bind/layers.js.map +1 -1
  14. package/dist/decoder.worker.js +3 -3
  15. package/dist/decoder.worker.js.map +3 -3
  16. package/dist/engine-loader.d.ts +4 -1
  17. package/dist/engine-loader.js +9 -0
  18. package/dist/engine-loader.js.map +1 -1
  19. package/dist/grid-module.d.ts +44 -0
  20. package/dist/grid-module.js +63 -0
  21. package/dist/grid-module.js.map +1 -0
  22. package/dist/grids.d.ts +51 -0
  23. package/dist/grids.js +88 -0
  24. package/dist/grids.js.map +1 -0
  25. package/dist/index.d.ts +3 -0
  26. package/dist/index.js +2 -0
  27. package/dist/index.js.map +1 -1
  28. package/dist/isard_bg.wasm +0 -0
  29. package/dist/isard_core_bg.wasm +0 -0
  30. package/dist/isard_grid_bg.wasm +0 -0
  31. package/dist/layers/flow.d.ts +111 -0
  32. package/dist/layers/flow.js +222 -0
  33. package/dist/layers/flow.js.map +1 -0
  34. package/dist/layers/symbols.d.ts +2 -0
  35. package/dist/layers/symbols.js +2 -1
  36. package/dist/layers/symbols.js.map +1 -1
  37. package/dist/map/layer-spec.d.ts +4 -1
  38. package/dist/map/layer-spec.js +2 -0
  39. package/dist/map/layer-spec.js.map +1 -1
  40. package/dist/map/workers.d.ts +4 -0
  41. package/dist/map/workers.js +35 -0
  42. package/dist/map/workers.js.map +1 -1
  43. package/dist/map.d.ts +14 -0
  44. package/dist/map.js +19 -1
  45. package/dist/map.js.map +1 -1
  46. package/dist/react/Layer.d.ts +2 -0
  47. package/dist/react/Layer.js.map +1 -1
  48. package/dist/types.d.ts +7 -3
  49. package/dist/types.js.map +1 -1
  50. package/dist/wasm/isard.d.ts +42 -0
  51. package/dist/wasm/isard.js +91 -1
  52. package/dist/wasm/isard_core.d.ts +42 -0
  53. package/dist/wasm/isard_core.js +91 -1
  54. package/dist/wasm/isard_grid.d.ts +101 -0
  55. package/dist/wasm/isard_grid.js +375 -0
  56. package/dist/workers/basemap/street.d.ts +19 -0
  57. package/dist/workers/basemap.worker.d.ts +21 -0
  58. package/dist/workers/basemap.worker.js +23 -4
  59. package/dist/workers/basemap.worker.js.map +1 -1
  60. package/package.json +2 -1
  61. package/vite.js +3 -2
@@ -0,0 +1,222 @@
1
+ /**
2
+ * Flow layers: particles carried by a field of velocities (a wind's east and north components on a grid of longitudes
3
+ * and latitudes, m/s), their trails drawn on the globe and the relief and animated, colored by speed: wind maps,
4
+ * currents. The engine moves them (`stepFlow`), one step per animation frame while the layer plays.
5
+ */
6
+ import { parseColor } from "./features.js";
7
+ import { Layer } from "./layers.js";
8
+ /** Wind speeds (m/s) from calm to storm */
9
+ const COLORS = [
10
+ [0, '#3a6fb0'],
11
+ [4, '#4fa3c7'],
12
+ [8, '#7fc79a'],
13
+ [12, '#d6e27a'],
14
+ [16, '#f6c14e'],
15
+ [22, '#ef7d3c'],
16
+ [30, '#d2374a'],
17
+ [40, '#8e1f5c'],
18
+ ];
19
+ export class FlowLayer extends Layer {
20
+ /** The fields by time (one at time 0 for a single field), the time shown, the two sent to the engine */
21
+ fields;
22
+ time;
23
+ sent;
24
+ style;
25
+ particles;
26
+ trail;
27
+ #playing;
28
+ /** The animation frame asked for, and the time of the last step (ms) */
29
+ frame = 0;
30
+ last;
31
+ /** @internal */
32
+ constructor(map, options) {
33
+ super(map);
34
+ this.fields = timed(options);
35
+ this.time = options.time === undefined ? (this.fields[0]?.time ?? 0) : Number(options.time);
36
+ this.particles = options.particles ?? 16384;
37
+ this.trail = options.trail ?? 24;
38
+ this.style = {
39
+ colors: options.colors ?? COLORS,
40
+ width: options.width ?? 1.5,
41
+ opacity: options.opacity ?? 0.9,
42
+ height: options.height ?? 0,
43
+ speed: options.speed ?? 60,
44
+ density: options.density ?? 60,
45
+ };
46
+ this.#playing = options.playing ?? true;
47
+ if (this.#playing)
48
+ this.loop();
49
+ }
50
+ /** Whether the particles move */
51
+ get playing() {
52
+ return this.#playing;
53
+ }
54
+ /** The particles move, a step each animation frame */
55
+ play() {
56
+ if (this.#playing)
57
+ return;
58
+ this.#playing = true;
59
+ this.last = undefined;
60
+ this.loop();
61
+ }
62
+ /** The particles stop where they are (the map no longer drawn for them) */
63
+ pause() {
64
+ this.#playing = false;
65
+ cancelAnimationFrame(this.frame);
66
+ this.frame = 0;
67
+ }
68
+ /** Moving or not (`play`, `pause`) */
69
+ setPlaying(playing) {
70
+ if (playing)
71
+ this.play();
72
+ else
73
+ this.pause();
74
+ }
75
+ /** Moves the particles by `seconds` of the page's time, at once (a still image after so many steps; paused) */
76
+ step(seconds = 1 / 60) {
77
+ if (this.id < 0)
78
+ return;
79
+ this.map.engine.stepFlow(this.id, seconds);
80
+ this.map.requestRender();
81
+ }
82
+ /** A new field (on another grid, the trails start again) */
83
+ setField(field) {
84
+ this.setFields([{ time: 0, field }], 0);
85
+ }
86
+ /** New fields at their times (a model's hours), mixed at `time` (default the one shown) */
87
+ setFields(fields, time) {
88
+ this.fields = timed({ fields });
89
+ if (time !== undefined)
90
+ this.time = Number(time);
91
+ this.sent = undefined;
92
+ if (this.id >= 0)
93
+ this.sendField(this.map.engine, this.id);
94
+ this.map.requestRender();
95
+ }
96
+ /** The time the fields are mixed at: between two of the model's hours, the field goes linearly from one to the
97
+ * other (before the first and after the last, theirs); the particles go on */
98
+ setTime(time) {
99
+ this.time = Number(time);
100
+ if (this.id >= 0)
101
+ this.sendField(this.map.engine, this.id);
102
+ this.map.requestRender();
103
+ }
104
+ setStyle(style) {
105
+ this.style = { ...this.style, ...style };
106
+ if (this.id >= 0)
107
+ this.sendStyle(this.map.engine, this.id);
108
+ this.map.requestRender();
109
+ }
110
+ /** One step an animation frame while it plays, by the time since the last */
111
+ loop() {
112
+ const tick = (now) => {
113
+ if (!this.#playing)
114
+ return;
115
+ const seconds = this.last === undefined ? 1 / 60 : (now - this.last) / 1000;
116
+ this.last = now;
117
+ this.step(seconds);
118
+ this.frame = requestAnimationFrame(tick);
119
+ };
120
+ cancelAnimationFrame(this.frame);
121
+ this.frame = requestAnimationFrame(tick);
122
+ }
123
+ /** The two fields around the time and how far between them, the fields sent only when they change */
124
+ sendField(engine, id) {
125
+ const { fields, time } = this;
126
+ const [a, b] = around(fields, time);
127
+ if (!a)
128
+ return;
129
+ if (this.sent?.[0] !== a.field || this.sent?.[1] !== b?.field) {
130
+ const { width, height, u, v, bounds } = a.field;
131
+ engine.setFlowField(id, width, height, Float32Array.from(u), Float32Array.from(v), Float64Array.from(bounds));
132
+ engine.setFlowNext(id, Float32Array.from(b?.field.u ?? []), Float32Array.from(b?.field.v ?? []));
133
+ this.sent = [a.field, b?.field];
134
+ }
135
+ engine.setFlowBlend(id, b ? (time - a.time) / (b.time - a.time) : 0);
136
+ }
137
+ sendStyle(engine, id) {
138
+ const { colors, width, opacity, height, speed, density } = this.style;
139
+ const stops = colors.slice(0, 8);
140
+ engine.setFlowStyle(id, Float32Array.from(stops, ([s]) => s), Float32Array.from(stops.flatMap(([, c]) => parseColor(c))), width, opacity, height, speed, density);
141
+ }
142
+ /** @internal */
143
+ create(engine) {
144
+ const id = engine.addFlow(this.particles, this.trail);
145
+ // A new engine: everything sent again
146
+ this.sent = undefined;
147
+ this.sendField(engine, id);
148
+ this.sendStyle(engine, id);
149
+ return id;
150
+ }
151
+ remove() {
152
+ super.remove();
153
+ this.dispose();
154
+ }
155
+ /** @internal */
156
+ dispose() {
157
+ this.pause();
158
+ }
159
+ }
160
+ /** The fields around a time: the one before and the one after, or the first or last alone outside them */
161
+ const around = (fields, time) => {
162
+ const after = fields.findIndex((f) => f.time > time);
163
+ if (after < 0)
164
+ return [fields.at(-1), undefined];
165
+ if (after === 0)
166
+ return [fields[0], undefined];
167
+ return [fields[after - 1], fields[after]];
168
+ };
169
+ /** The fields of the options by time: `fields` sorted, or `field` alone (at time 0) */
170
+ const timed = ({ field, fields }) => {
171
+ if (fields?.length)
172
+ return fields.map((f) => ({ time: Number(f.time), field: f.field })).sort((a, b) => a.time - b.time);
173
+ if (field)
174
+ return [{ time: 0, field }];
175
+ throw new Error('isard: a flow layer needs a field or fields');
176
+ };
177
+ /**
178
+ * A field from an image (PNG, as wind maps ship them): the east component in red, the north in green, each scaled
179
+ * from 0-255 to its range (`u`, `v`, m/s), none where the image is transparent; its pixels the grid's points over
180
+ * `bounds`
181
+ */
182
+ export const flowFieldFromImage = async (url, options, init) => {
183
+ const [field] = await flowFieldsFromImage(url, { ...options, count: 1 }, init);
184
+ if (!field)
185
+ throw new Error(`isard: ${String(url)}: no field`);
186
+ return field;
187
+ };
188
+ /**
189
+ * The fields of an image holding `count` of them one under the other (a model's hours, the first at the top), each
190
+ * read as `flowFieldFromImage` reads one
191
+ */
192
+ export const flowFieldsFromImage = async (url, options, init) => {
193
+ const response = await fetch(url, init);
194
+ if (!response.ok)
195
+ throw new Error(`isard: ${String(url)}: ${response.status}`);
196
+ const bitmap = await createImageBitmap(await response.blob(), { colorSpaceConversion: 'none' });
197
+ const { width, height } = bitmap;
198
+ const canvas = new OffscreenCanvas(width, height);
199
+ const g = canvas.getContext('2d', { willReadFrequently: true });
200
+ if (!g)
201
+ throw new Error('isard: no 2D canvas to read the field');
202
+ g.drawImage(bitmap, 0, 0);
203
+ bitmap.close();
204
+ const { data } = g.getImageData(0, 0, width, height);
205
+ const [u0, u1] = options.u;
206
+ const [v0, v1] = options.v;
207
+ const count = Math.max(1, Math.floor(options.count));
208
+ const rows = Math.floor(height / count);
209
+ return Array.from({ length: count }, (_, k) => {
210
+ const u = new Float32Array(width * rows);
211
+ const v = new Float32Array(width * rows);
212
+ const first = k * rows * width;
213
+ for (let i = 0; i < width * rows; i++) {
214
+ const at = (first + i) * 4;
215
+ const none = (data[at + 3] ?? 0) < 128;
216
+ u[i] = none ? Number.NaN : u0 + ((data[at] ?? 0) / 255) * (u1 - u0);
217
+ v[i] = none ? Number.NaN : v0 + ((data[at + 1] ?? 0) / 255) * (v1 - v0);
218
+ }
219
+ return { width, height: rows, u, v, bounds: options.bounds };
220
+ });
221
+ };
222
+ //# sourceMappingURL=flow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flow.js","sourceRoot":"","sources":["../../src/layers/flow.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,UAAU,EAAa,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAqDpC,2CAA2C;AAC3C,MAAM,MAAM,GAAS;IACnB,CAAC,CAAC,EAAE,SAAS,CAAC;IACd,CAAC,CAAC,EAAE,SAAS,CAAC;IACd,CAAC,CAAC,EAAE,SAAS,CAAC;IACd,CAAC,EAAE,EAAE,SAAS,CAAC;IACf,CAAC,EAAE,EAAE,SAAS,CAAC;IACf,CAAC,EAAE,EAAE,SAAS,CAAC;IACf,CAAC,EAAE,EAAE,SAAS,CAAC;IACf,CAAC,EAAE,EAAE,SAAS,CAAC;CAChB,CAAC;AAEF,MAAM,OAAO,SAAU,SAAQ,KAAK;IAClC,wGAAwG;IAChG,MAAM,CAAuC;IAC7C,IAAI,CAAS;IACb,IAAI,CAAiD;IACrD,KAAK,CAAY;IACR,SAAS,CAAS;IAClB,KAAK,CAAS;IAC/B,QAAQ,CAAU;IAClB,wEAAwE;IAChE,KAAK,GAAG,CAAC,CAAC;IACV,IAAI,CAAqB;IAEjC,gBAAgB;IAChB,YAAY,GAAc,EAAE,OAAoB;QAC9C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C;QAED,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;IAC/D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["/**\n * Flow layers: particles carried by a field of velocities (a wind's east and north components on a grid of longitudes\n * and latitudes, m/s), their trails drawn on the globe and the relief and animated, colored by speed: wind maps,\n * currents. The engine moves them (`stepFlow`), one step per animation frame while the layer plays.\n */\n\nimport type { LayerHost } from '../types.ts';\nimport type { Engine } from '../wasm/isard.js';\nimport { parseColor, type Ramp } from './features.ts';\nimport { Layer } from './layers.ts';\n\n/**\n * A field of velocities: `width` × `height` points, from west to east and from north to south (row after row), the\n * east (`u`) and north (`v`) components at each (m/s; not a number: none there), the corner points at `bounds` (west,\n * south, east, north, degrees). A last column one step short of 360° goes round the world (a global model's grid)\n */\nexport interface FlowField {\n width: number;\n height: number;\n u: Float32Array | readonly number[];\n v: Float32Array | readonly number[];\n bounds: [west: number, south: number, east: number, north: number];\n}\n\nexport interface FlowStyle {\n /** The colors of the speeds (m/s), linear between them, up to 8 (default from calm blue to storm red) */\n colors: Ramp;\n /** Width of a trail, CSS pixels (default 1.5) */\n width: number;\n /** 0 to 1 (default 0.9) */\n opacity: number;\n /** Metres over the ground (default 0) */\n height: number;\n /** Speed on screen: pixels a second for 10 m/s, whatever the zoom (default 60) */\n speed: number;\n /** Particles moving for each 100 × 100 CSS pixels of the view, the screen as dense at any zoom (default 60; at most\n * `particles`) */\n density: number;\n}\n\n/** A field at a time: one of a model's hours */\nexport interface TimedField {\n time: Date | number;\n field: FlowField;\n}\n\nexport interface FlowOptions extends Partial<FlowStyle> {\n /** The field; or `fields`, at their times, mixed at `time` */\n field?: FlowField;\n /** Fields at their times, on one grid (a model's hours): the layer's field at `time` the mix of the two around it */\n fields?: readonly TimedField[];\n /** The time the fields are mixed at (default the first one's) */\n time?: Date | number;\n /** Particles moving, rounded up to a multiple of 4096 (default 16384) */\n particles?: number;\n /** Positions of a trail, one each 60th of a second (default 24): longer trails, more to draw */\n trail?: number;\n /** Moving from the start (default true); `play`, `pause` and `step` after */\n playing?: boolean;\n before?: Layer;\n}\n\n/** Wind speeds (m/s) from calm to storm */\nconst COLORS: Ramp = [\n [0, '#3a6fb0'],\n [4, '#4fa3c7'],\n [8, '#7fc79a'],\n [12, '#d6e27a'],\n [16, '#f6c14e'],\n [22, '#ef7d3c'],\n [30, '#d2374a'],\n [40, '#8e1f5c'],\n];\n\nexport class FlowLayer extends Layer {\n /** The fields by time (one at time 0 for a single field), the time shown, the two sent to the engine */\n private fields: { time: number; field: FlowField }[];\n private time: number;\n private sent: [FlowField, FlowField | undefined] | undefined;\n private style: FlowStyle;\n private readonly particles: number;\n private readonly trail: number;\n #playing: boolean;\n /** The animation frame asked for, and the time of the last step (ms) */\n private frame = 0;\n private last: number | undefined;\n\n /** @internal */\n constructor(map: LayerHost, options: FlowOptions) {\n super(map);\n this.fields = timed(options);\n this.time = options.time === undefined ? (this.fields[0]?.time ?? 0) : Number(options.time);\n this.particles = options.particles ?? 16384;\n this.trail = options.trail ?? 24;\n this.style = {\n colors: options.colors ?? COLORS,\n width: options.width ?? 1.5,\n opacity: options.opacity ?? 0.9,\n height: options.height ?? 0,\n speed: options.speed ?? 60,\n density: options.density ?? 60,\n };\n this.#playing = options.playing ?? true;\n if (this.#playing) this.loop();\n }\n\n /** Whether the particles move */\n get playing(): boolean {\n return this.#playing;\n }\n\n /** The particles move, a step each animation frame */\n play(): void {\n if (this.#playing) return;\n this.#playing = true;\n this.last = undefined;\n this.loop();\n }\n\n /** The particles stop where they are (the map no longer drawn for them) */\n pause(): void {\n this.#playing = false;\n cancelAnimationFrame(this.frame);\n this.frame = 0;\n }\n\n /** Moving or not (`play`, `pause`) */\n setPlaying(playing: boolean): void {\n if (playing) this.play();\n else this.pause();\n }\n\n /** Moves the particles by `seconds` of the page's time, at once (a still image after so many steps; paused) */\n step(seconds = 1 / 60): void {\n if (this.id < 0) return;\n this.map.engine.stepFlow(this.id, seconds);\n this.map.requestRender();\n }\n\n /** A new field (on another grid, the trails start again) */\n setField(field: FlowField): void {\n this.setFields([{ time: 0, field }], 0);\n }\n\n /** New fields at their times (a model's hours), mixed at `time` (default the one shown) */\n setFields(fields: readonly TimedField[], time?: Date | number): void {\n this.fields = timed({ fields });\n if (time !== undefined) this.time = Number(time);\n this.sent = undefined;\n if (this.id >= 0) this.sendField(this.map.engine, this.id);\n this.map.requestRender();\n }\n\n /** The time the fields are mixed at: between two of the model's hours, the field goes linearly from one to the\n * other (before the first and after the last, theirs); the particles go on */\n setTime(time: Date | number): void {\n this.time = Number(time);\n if (this.id >= 0) this.sendField(this.map.engine, this.id);\n this.map.requestRender();\n }\n\n setStyle(style: Partial<FlowStyle>): void {\n this.style = { ...this.style, ...style };\n if (this.id >= 0) this.sendStyle(this.map.engine, this.id);\n this.map.requestRender();\n }\n\n /** One step an animation frame while it plays, by the time since the last */\n private loop(): void {\n const tick = (now: number) => {\n if (!this.#playing) return;\n\n const seconds = this.last === undefined ? 1 / 60 : (now - this.last) / 1000;\n\n this.last = now;\n this.step(seconds);\n this.frame = requestAnimationFrame(tick);\n };\n\n cancelAnimationFrame(this.frame);\n this.frame = requestAnimationFrame(tick);\n }\n\n /** The two fields around the time and how far between them, the fields sent only when they change */\n private sendField(engine: Engine, id: number): void {\n const { fields, time } = this;\n const [a, b] = around(fields, time);\n\n if (!a) return;\n if (this.sent?.[0] !== a.field || this.sent?.[1] !== b?.field) {\n const { width, height, u, v, bounds } = a.field;\n\n engine.setFlowField(id, width, height, Float32Array.from(u), Float32Array.from(v), Float64Array.from(bounds));\n engine.setFlowNext(id, Float32Array.from(b?.field.u ?? []), Float32Array.from(b?.field.v ?? []));\n this.sent = [a.field, b?.field];\n }\n engine.setFlowBlend(id, b ? (time - a.time) / (b.time - a.time) : 0);\n }\n\n private sendStyle(engine: Engine, id: number): void {\n const { colors, width, opacity, height, speed, density } = this.style;\n const stops = colors.slice(0, 8);\n\n engine.setFlowStyle(\n id,\n Float32Array.from(stops, ([s]) => s),\n Float32Array.from(stops.flatMap(([, c]) => parseColor(c))),\n width,\n opacity,\n height,\n speed,\n density,\n );\n }\n\n /** @internal */\n protected create(engine: Engine): number {\n const id = engine.addFlow(this.particles, this.trail);\n\n // A new engine: everything sent again\n this.sent = undefined;\n this.sendField(engine, id);\n this.sendStyle(engine, id);\n\n return id;\n }\n\n override remove(): void {\n super.remove();\n this.dispose();\n }\n\n /** @internal */\n override dispose(): void {\n this.pause();\n }\n}\n\n/** The fields around a time: the one before and the one after, or the first or last alone outside them */\nconst around = <T extends { time: number }>(fields: readonly T[], time: number): [T | undefined, T | undefined] => {\n const after = fields.findIndex((f) => f.time > time);\n\n if (after < 0) return [fields.at(-1), undefined];\n if (after === 0) return [fields[0], undefined];\n\n return [fields[after - 1], fields[after]];\n};\n\n/** The fields of the options by time: `fields` sorted, or `field` alone (at time 0) */\nconst timed = ({ field, fields }: Pick<FlowOptions, 'field' | 'fields'>): { time: number; field: FlowField }[] => {\n if (fields?.length)\n return fields.map((f) => ({ time: Number(f.time), field: f.field })).sort((a, b) => a.time - b.time);\n if (field) return [{ time: 0, field }];\n throw new Error('isard: a flow layer needs a field or fields');\n};\n\n/**\n * A field from an image (PNG, as wind maps ship them): the east component in red, the north in green, each scaled\n * from 0-255 to its range (`u`, `v`, m/s), none where the image is transparent; its pixels the grid's points over\n * `bounds`\n */\nexport const flowFieldFromImage = async (\n url: string | URL,\n options: { bounds: FlowField['bounds']; u: [min: number, max: number]; v: [min: number, max: number] },\n init?: RequestInit,\n): Promise<FlowField> => {\n const [field] = await flowFieldsFromImage(url, { ...options, count: 1 }, init);\n\n if (!field) throw new Error(`isard: ${String(url)}: no field`);\n\n return field;\n};\n\n/**\n * The fields of an image holding `count` of them one under the other (a model's hours, the first at the top), each\n * read as `flowFieldFromImage` reads one\n */\nexport const flowFieldsFromImage = async (\n url: string | URL,\n options: {\n bounds: FlowField['bounds'];\n u: [min: number, max: number];\n v: [min: number, max: number];\n count: number;\n },\n init?: RequestInit,\n): Promise<FlowField[]> => {\n const response = await fetch(url, init);\n\n if (!response.ok) throw new Error(`isard: ${String(url)}: ${response.status}`);\n\n const bitmap = await createImageBitmap(await response.blob(), { colorSpaceConversion: 'none' });\n const { width, height } = bitmap;\n const canvas = new OffscreenCanvas(width, height);\n const g = canvas.getContext('2d', { willReadFrequently: true });\n\n if (!g) throw new Error('isard: no 2D canvas to read the field');\n g.drawImage(bitmap, 0, 0);\n bitmap.close();\n\n const { data } = g.getImageData(0, 0, width, height);\n const [u0, u1] = options.u;\n const [v0, v1] = options.v;\n const count = Math.max(1, Math.floor(options.count));\n const rows = Math.floor(height / count);\n\n return Array.from({ length: count }, (_, k) => {\n const u = new Float32Array(width * rows);\n const v = new Float32Array(width * rows);\n const first = k * rows * width;\n\n for (let i = 0; i < width * rows; i++) {\n const at = (first + i) * 4;\n const none = (data[at + 3] ?? 0) < 128;\n\n u[i] = none ? Number.NaN : u0 + ((data[at] ?? 0) / 255) * (u1 - u0);\n v[i] = none ? Number.NaN : v0 + ((data[at + 1] ?? 0) / 255) * (v1 - v0);\n }\n\n return { width, height: rows, u, v, bounds: options.bounds };\n });\n};\n"]}
@@ -11,6 +11,8 @@ import { type Glyphs, type TextPart } from './glyphs.ts';
11
11
  import { type Icons } from './icons.ts';
12
12
  import { Layer } from './layers.ts';
13
13
  export interface SymbolStyle<P = Properties> extends Omit<FeatureLayerStyle<P>, 'ramp'> {
14
+ /** Metres over the ground the label stands at (default 0): on a floor of a building, over a roof */
15
+ height: Styled<number, P>;
14
16
  /** The text: a string (`\n` breaks lines) or runs with their own scale and font; empty: no label */
15
17
  text: Styled<string | TextPart[], P>;
16
18
  /** A font of the map's glyphs (default `Noto Sans Regular`; also Bold and Italic with the default glyphs) */
@@ -373,7 +373,7 @@ export class SymbolLayer extends Layer {
373
373
  const alongFlags = (textAlong ? FLAG.textAlong : 0) | (iconAlong ? FLAG.iconAlong : 0);
374
374
  const labelFlags = flags | (direction[0] === 0 && direction[1] === 0 ? 0 : alongFlags);
375
375
  boxes.push(...textBox);
376
- styles.push(...fill, ...haloRgba, halo, labelFlags, ...direction, ...stops(scale), ...iconBox, ...iconColor, ...stops(iconScale));
376
+ styles.push(...fill, ...haloRgba, halo, labelFlags, ...direction, ...stops(scale), ...iconBox, ...iconColor, ...stops(iconScale), Math.max(0, Number(evaluate(st.height, p, i)) || 0));
377
377
  for (const q of quads)
378
378
  iconQuads.push(label, ...q);
379
379
  if (s)
@@ -427,6 +427,7 @@ export const symbolStyle = (options) => {
427
427
  maxZoom: 24,
428
428
  visible: true,
429
429
  filter: undefined,
430
+ height: 0,
430
431
  text: '',
431
432
  font: DEFAULT_FONT,
432
433
  size: 12,
@@ -1 +1 @@
1
- {"version":3,"file":"symbols.js","sourceRoot":"","sources":["../../src/layers/symbols.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EACL,QAAQ,EAIR,UAAU,EAKV,UAAU,EAGV,KAAK,GACN,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,EAAE,YAAY,EAAyC,KAAK,EAAiB,MAAM,aAAa,CAAC;AAC/G,OAAO,EAAc,UAAU,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAgEpC;yCACyC;AACzC,MAAM,OAAO,GAAG,CAAC,QAAyB,EAAgD,EAAE;IAC1F,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,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AS,EAAE,CAAC;QACZ,MAAM,EAAE,QAAQ;QAChB,SAAS,EAAE,OAAO;QAClB,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QACd,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,GAAG;QACf,OAAO,EAAE,KAAK;QACd,YAAY,EAAE,KAAK;QACnB,IAAI,EAAE,EAAE;QACR,QAAQ,EAAE,CAAC;QACX,UAAU,EAAE,QAAQ;QACpB,UAAU,EAAE,CAAC,CAAC,EAAE,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,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 */\n\nimport type { LayerHost } from '../types.ts';\nimport type { Anchor } from '../ui/overlay.ts';\nimport { toMercator } from '../util/geo.ts';\nimport type { Engine } from '../wasm/isard.js';\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 { 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';\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 */\nconst 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/** The icon of a label as packed: its scale, box, color, quads and flags */\ninterface LaidIcon {\n iconScale: Size;\n iconBox: [number, number, number, number];\n iconColor: [number, number, number, number];\n quads: number[][];\n iconTurns: boolean;\n fitted: boolean;\n iconFlags: number;\n}\n\n/** Anchors as positions, a line's carrying the direction (lon, lat, dlon, dlat) */\nconst 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\n for (let i = 1; i < line.length; i += 1) {\n const [a, b] = [line[i - 1], line[i]];\n\n if (!a || !b) continue;\n\n const d = Math.hypot(b[0] - a[0], b[1] - a[1]);\n\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\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\n for (const p of polygons) {\n const ring = p[0] ?? [];\n let [a, cx, cy] = [0, 0, 0];\n\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\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\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 */\nconst overlapFlags = (overlap: Overlap, allow: number, ignore: number): number => {\n if (overlap === true) return allow | ignore;\n if (overlap === 'allow') return allow;\n\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 */\nconst present = (part: TextPart, loaded: Map<string, Map<number, Glyph>>): boolean => {\n const glyphs = loaded.get(part.font ?? DEFAULT_FONT);\n\n if (!glyphs) return false;\n for (const ch of part.text) if (ch !== '\\n' && !glyphs.has(ch.codePointAt(0) ?? 32)) return false;\n\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 */\nconst concat = (chunks: readonly Chunk[]): Labels => {\n if (chunks.length === 1 && chunks[0]) return chunks[0];\n\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\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\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 });\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\n return group.map((f, k): TextPart[] => {\n const i = base + k;\n\n if (filter && !filter(f.properties, i)) return [];\n\n const t = evaluate(text, f.properties, i);\n const own = evaluate(font, f.properties, i);\n\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\n groups.reduce((base, group) => {\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\n if (!valid) todo.push({ group, base, parts: this.parts(group, base) });\n\n return base + group.length;\n }, 0);\n\n const byFont = new Map<string, Set<number>>();\n\n todo.forEach(({ parts }) => {\n parts.flat().forEach((p) => {\n const key = p.font ?? DEFAULT_FONT;\n const set = byFont.get(key) ?? new Set<number>();\n\n codes([p]).forEach((code) => {\n set.add(code);\n });\n byFont.set(key, set);\n });\n });\n\n const loaded = new Map<string, Map<number, Glyph>>();\n\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\n const built = new Map<readonly Feature<P>[], Chunk>();\n\n todo.forEach(({ group, base: b, parts }) => {\n const chunk = this.build(group, b, parts, loaded);\n\n built.set(group, chunk);\n if (keep) this.chunks.set(group, chunk);\n });\n this.labels = concat(\n groups.map((g) => built.get(g) ?? this.chunks.get(g)).filter((c): c is Chunk => c !== undefined),\n );\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\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\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\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 const shaping =\n hasText && text\n ? 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 : undefined;\n const s: Shaping | undefined = shaping?.quads.length ? shaping : undefined;\n\n if (!s && !icon) return;\n\n const along = evaluate(placement, p, i) === 'line';\n const textFlags =\n overlapFlags(evaluate(overlap, p, i), FLAG.textOverlap, FLAG.textIgnore) |\n (evaluate(st.textOptional, p, i) ? FLAG.textOptional : 0) |\n (s ? FLAG.text : 0);\n // The icon: beside its text, or stretched around it (then scaled and turned with it)\n const { iconScale, iconBox, iconColor, quads, iconTurns, fitted, iconFlags } = ((): LaidIcon => {\n const none: LaidIcon = {\n iconScale: 1,\n iconBox: [0, 0, 0, 0],\n iconColor: [0, 0, 0, 0],\n quads: [],\n iconTurns: false,\n fitted: false,\n iconFlags: 0,\n };\n\n if (!icon) return none;\n\n const fit = evaluate(st.iconTextFit, p, i);\n const fitted = fit !== 'none' && s !== undefined;\n const i0 = evaluate(st.iconSize, p, i);\n const iconShaped = fitted ? 1 : shapedAt(i0);\n const 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 const laidOut = { ...none, fitted, iconScale, quads: laid.quads };\n\n if (!laid.quads.length) return laidOut;\n\n const iconFlags =\n FLAG.icon |\n overlapFlags(evaluate(st.iconOverlap, p, i), FLAG.iconOverlap, FLAG.iconIgnore) |\n (evaluate(st.iconOptional, p, i) ? FLAG.iconOptional : 0);\n const alignment = evaluate(st.iconRotationAlignment, p, i);\n const [r, g, b, a] = parseColor(evaluate(st.iconColor, p, i));\n\n return {\n ...laidOut,\n iconFlags: iconFlags | (fitted ? FLAG.iconUpright : 0),\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 iconColor: [r, g, b, a * Math.max(0, Math.min(1, evaluate(st.iconOpacity, p, i)))],\n };\n })();\n const flags = textFlags | iconFlags;\n\n if (!(flags & (FLAG.text | FLAG.icon))) return;\n\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\n for (const { at, along: line } of anchors(f.geometry)) {\n const label = count++;\n const [x, y] = toMercator(at);\n\n anchorList.push(x, y);\n\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 // The direction of its line in Mercator (y towards the south)\n const end = line && (textAlong || iconAlong) ? toMercator([at[0] + line[0], at[1] + line[1]]) : undefined;\n const direction: [number, number] = end ? [end[0] - x, end[1] - y] : [iconAlong ? 1 : 0, 0];\n const alongFlags = (textAlong ? FLAG.textAlong : 0) | (iconAlong ? FLAG.iconAlong : 0);\n const labelFlags = flags | (direction[0] === 0 && direction[1] === 0 ? 0 : alongFlags);\n\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\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\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\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\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\n return id;\n }\n}\n\nexport const symbolStyle = <P>(options: SymbolOptions<P>): SymbolStyle<P> => {\n const { data: _, before: __, ...rest } = options;\n\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"]}
1
+ {"version":3,"file":"symbols.js","sourceRoot":"","sources":["../../src/layers/symbols.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EACL,QAAQ,EAIR,UAAU,EAKV,UAAU,EAGV,KAAK,GACN,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,EAAE,YAAY,EAAyC,KAAK,EAAiB,MAAM,aAAa,CAAC;AAC/G,OAAO,EAAc,UAAU,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAkEpC;yCACyC;AACzC,MAAM,OAAO,GAAG,CAAC,QAAyB,EAAgD,EAAE;IAC1F,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CA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MAAM,EAAE,CAAC;QACT,IAAI,EAAE,EAAE;QACR,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,EAAE;QACR,KAAK,EAAE,MAAM;QACb,SAAS,EAAE,MAAM;QACjB,SAAS,EAAE,CAAC;QACZ,MAAM,EAAE,QAAQ;QAChB,SAAS,EAAE,OAAO;QAClB,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QACd,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,GAAG;QACf,OAAO,EAAE,KAAK;QACd,YAAY,EAAE,KAAK;QACnB,IAAI,EAAE,EAAE;QACR,QAAQ,EAAE,CAAC;QACX,UAAU,EAAE,QAAQ;QACpB,UAAU,EAAE,CAAC,CAAC,EAAE,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,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 */\n\nimport type { LayerHost } from '../types.ts';\nimport type { Anchor } from '../ui/overlay.ts';\nimport { toMercator } from '../util/geo.ts';\nimport type { Engine } from '../wasm/isard.js';\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 { 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';\n\nexport interface SymbolStyle<P = Properties> extends Omit<FeatureLayerStyle<P>, 'ramp'> {\n /** Metres over the ground the label stands at (default 0): on a floor of a building, over a roof */\n height: Styled<number, P>;\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 */\nconst 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/** The icon of a label as packed: its scale, box, color, quads and flags */\ninterface LaidIcon {\n iconScale: Size;\n iconBox: [number, number, number, number];\n iconColor: [number, number, number, number];\n quads: number[][];\n iconTurns: boolean;\n fitted: boolean;\n iconFlags: number;\n}\n\n/** Anchors as positions, a line's carrying the direction (lon, lat, dlon, dlat) */\nconst 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\n for (let i = 1; i < line.length; i += 1) {\n const [a, b] = [line[i - 1], line[i]];\n\n if (!a || !b) continue;\n\n const d = Math.hypot(b[0] - a[0], b[1] - a[1]);\n\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\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\n for (const p of polygons) {\n const ring = p[0] ?? [];\n let [a, cx, cy] = [0, 0, 0];\n\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\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\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 */\nconst overlapFlags = (overlap: Overlap, allow: number, ignore: number): number => {\n if (overlap === true) return allow | ignore;\n if (overlap === 'allow') return allow;\n\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 */\nconst present = (part: TextPart, loaded: Map<string, Map<number, Glyph>>): boolean => {\n const glyphs = loaded.get(part.font ?? DEFAULT_FONT);\n\n if (!glyphs) return false;\n for (const ch of part.text) if (ch !== '\\n' && !glyphs.has(ch.codePointAt(0) ?? 32)) return false;\n\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 */\nconst concat = (chunks: readonly Chunk[]): Labels => {\n if (chunks.length === 1 && chunks[0]) return chunks[0];\n\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\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\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 });\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\n return group.map((f, k): TextPart[] => {\n const i = base + k;\n\n if (filter && !filter(f.properties, i)) return [];\n\n const t = evaluate(text, f.properties, i);\n const own = evaluate(font, f.properties, i);\n\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\n groups.reduce((base, group) => {\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\n if (!valid) todo.push({ group, base, parts: this.parts(group, base) });\n\n return base + group.length;\n }, 0);\n\n const byFont = new Map<string, Set<number>>();\n\n todo.forEach(({ parts }) => {\n parts.flat().forEach((p) => {\n const key = p.font ?? DEFAULT_FONT;\n const set = byFont.get(key) ?? new Set<number>();\n\n codes([p]).forEach((code) => {\n set.add(code);\n });\n byFont.set(key, set);\n });\n });\n\n const loaded = new Map<string, Map<number, Glyph>>();\n\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\n const built = new Map<readonly Feature<P>[], Chunk>();\n\n todo.forEach(({ group, base: b, parts }) => {\n const chunk = this.build(group, b, parts, loaded);\n\n built.set(group, chunk);\n if (keep) this.chunks.set(group, chunk);\n });\n this.labels = concat(\n groups.map((g) => built.get(g) ?? this.chunks.get(g)).filter((c): c is Chunk => c !== undefined),\n );\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\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\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\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 const shaping =\n hasText && text\n ? 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 : undefined;\n const s: Shaping | undefined = shaping?.quads.length ? shaping : undefined;\n\n if (!s && !icon) return;\n\n const along = evaluate(placement, p, i) === 'line';\n const textFlags =\n overlapFlags(evaluate(overlap, p, i), FLAG.textOverlap, FLAG.textIgnore) |\n (evaluate(st.textOptional, p, i) ? FLAG.textOptional : 0) |\n (s ? FLAG.text : 0);\n // The icon: beside its text, or stretched around it (then scaled and turned with it)\n const { iconScale, iconBox, iconColor, quads, iconTurns, fitted, iconFlags } = ((): LaidIcon => {\n const none: LaidIcon = {\n iconScale: 1,\n iconBox: [0, 0, 0, 0],\n iconColor: [0, 0, 0, 0],\n quads: [],\n iconTurns: false,\n fitted: false,\n iconFlags: 0,\n };\n\n if (!icon) return none;\n\n const fit = evaluate(st.iconTextFit, p, i);\n const fitted = fit !== 'none' && s !== undefined;\n const i0 = evaluate(st.iconSize, p, i);\n const iconShaped = fitted ? 1 : shapedAt(i0);\n const 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 const laidOut = { ...none, fitted, iconScale, quads: laid.quads };\n\n if (!laid.quads.length) return laidOut;\n\n const iconFlags =\n FLAG.icon |\n overlapFlags(evaluate(st.iconOverlap, p, i), FLAG.iconOverlap, FLAG.iconIgnore) |\n (evaluate(st.iconOptional, p, i) ? FLAG.iconOptional : 0);\n const alignment = evaluate(st.iconRotationAlignment, p, i);\n const [r, g, b, a] = parseColor(evaluate(st.iconColor, p, i));\n\n return {\n ...laidOut,\n iconFlags: iconFlags | (fitted ? FLAG.iconUpright : 0),\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 iconColor: [r, g, b, a * Math.max(0, Math.min(1, evaluate(st.iconOpacity, p, i)))],\n };\n })();\n const flags = textFlags | iconFlags;\n\n if (!(flags & (FLAG.text | FLAG.icon))) return;\n\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\n for (const { at, along: line } of anchors(f.geometry)) {\n const label = count++;\n const [x, y] = toMercator(at);\n\n anchorList.push(x, y);\n\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 // The direction of its line in Mercator (y towards the south)\n const end = line && (textAlong || iconAlong) ? toMercator([at[0] + line[0], at[1] + line[1]]) : undefined;\n const direction: [number, number] = end ? [end[0] - x, end[1] - y] : [iconAlong ? 1 : 0, 0];\n const alongFlags = (textAlong ? FLAG.textAlong : 0) | (iconAlong ? FLAG.iconAlong : 0);\n const labelFlags = flags | (direction[0] === 0 && direction[1] === 0 ? 0 : alongFlags);\n\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 Math.max(0, Number(evaluate(st.height, p, i)) || 0),\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\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\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\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\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\n return id;\n }\n}\n\nexport const symbolStyle = <P>(options: SymbolOptions<P>): SymbolStyle<P> => {\n const { data: _, before: __, ...rest } = options;\n\n return {\n opacity: 1,\n minZoom: 0,\n maxZoom: 24,\n visible: true,\n filter: undefined,\n height: 0,\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"]}
@@ -1,6 +1,7 @@
1
1
  /** A layer described by its type and options, as an application's configuration gives it, and the map adding it. */
2
2
  import type { ExtrusionOptions } from '../layers/extrusions.ts';
3
3
  import type { CircleOptions, FillOptions, LineOptions } from '../layers/features.ts';
4
+ import type { FlowOptions } from '../layers/flow.ts';
4
5
  import type { GroundOptions, Layer, ModelOptions } from '../layers/layers.ts';
5
6
  import type { PointCloudOptions } from '../layers/pointclouds.ts';
6
7
  import type { SymbolOptions } from '../layers/symbols.ts';
@@ -37,6 +38,8 @@ export type LayerSpec<P = Record<string, unknown>> = ({
37
38
  type: 'models';
38
39
  } & ModelOptions & {
39
40
  before?: Layer;
40
- });
41
+ }) | ({
42
+ type: 'flow';
43
+ } & FlowOptions);
41
44
  /** Adds the layer a description gives with the `add…` method of its type; an unknown type throws */
42
45
  export declare const addSpec: <P = Record<string, unknown>>(map: GeoMap, spec: LayerSpec<P>) => Layer;
@@ -24,6 +24,8 @@ export const addSpec = (map, spec) => {
24
24
  return map.addPointCloud(spec);
25
25
  case 'models':
26
26
  return map.addModels(spec);
27
+ case 'flow':
28
+ return map.addFlow(spec);
27
29
  default: {
28
30
  // Only from an application's configuration, untyped: the cases above cover every type
29
31
  const { type } = spec;
@@ -1 +1 @@
1
- {"version":3,"file":"layer-spec.js","sourceRoot":"","sources":["../../src/map/layer-spec.ts"],"names":[],"mappings":"AAAA,oHAAoH;AAwBpH,oGAAoG;AACpG,MAAM,CAAC,MAAM,OAAO,GAAG,CAA8B,GAAW,EAAE,IAAkB,EAAS,EAAE;IAC7F,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,OAAO;YACV,OAAO,GAAG,CAAC,QAAQ,CAAI,IAAI,CAAC,CAAC;QAC/B,KAAK,SAAS;YACZ,OAAO,GAAG,CAAC,UAAU,CAAI,IAAI,CAAC,CAAC;QACjC,KAAK,OAAO;YACV,OAAO,GAAG,CAAC,QAAQ,CAAI,IAAI,CAAC,CAAC;QAC/B,KAAK,SAAS;YACZ,OAAO,GAAG,CAAC,UAAU,CAAI,IAAI,CAAC,CAAC;QACjC,KAAK,YAAY;YACf,OAAO,GAAG,CAAC,aAAa,CAAI,IAAI,CAAC,CAAC;QACpC,KAAK,QAAQ;YACX,OAAO,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC7B,KAAK,QAAQ;YACX,OAAO,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC7B,KAAK,SAAS;YACZ,OAAO,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC9B,KAAK,SAAS;YACZ,OAAO,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC9B,KAAK,YAAY;YACf,OAAO,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QACjC,KAAK,QAAQ;YACX,OAAO,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC7B,OAAO,CAAC,CAAC,CAAC;YACR,sFAAsF;YACtF,MAAM,EAAE,IAAI,EAAE,GAAuB,IAAI,CAAC;YAE1C,MAAM,IAAI,KAAK,CAAC,2BAA2B,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;AACH,CAAC,CAAC","sourcesContent":["/** A layer described by its type and options, as an application's configuration gives it, and the map adding it. */\n\nimport type { ExtrusionOptions } from '../layers/extrusions.ts';\nimport type { CircleOptions, FillOptions, LineOptions } from '../layers/features.ts';\nimport type { GroundOptions, Layer, ModelOptions } from '../layers/layers.ts';\nimport type { PointCloudOptions } from '../layers/pointclouds.ts';\nimport type { SymbolOptions } from '../layers/symbols.ts';\nimport type { GeoMap } from '../map.ts';\nimport type { NetworkOptions, RasterOptions, Tiles3dOptions } from '../types.ts';\n\n/** A layer by its type and the options of its `add…` method (`GeoMap.add`) */\nexport type LayerSpec<P = Record<string, unknown>> =\n | ({ type: 'lines' } & LineOptions<P>)\n | ({ type: 'circles' } & CircleOptions<P>)\n | ({ type: 'fills' } & FillOptions<P>)\n | ({ type: 'symbols' } & SymbolOptions<P>)\n | ({ type: 'extrusions' } & ExtrusionOptions<P>)\n | ({ type: 'raster' } & RasterOptions & { before?: Layer })\n | ({ type: 'ground' } & GroundOptions & { before?: Layer })\n | ({ type: 'network' } & NetworkOptions)\n | ({ type: 'tiles3d' } & Tiles3dOptions)\n | ({ type: 'pointcloud' } & PointCloudOptions & { before?: Layer })\n | ({ type: 'models' } & ModelOptions & { before?: Layer });\n\n/** Adds the layer a description gives with the `add…` method of its type; an unknown type throws */\nexport const addSpec = <P = Record<string, unknown>>(map: GeoMap, spec: LayerSpec<P>): Layer => {\n switch (spec.type) {\n case 'lines':\n return map.addLines<P>(spec);\n case 'circles':\n return map.addCircles<P>(spec);\n case 'fills':\n return map.addFills<P>(spec);\n case 'symbols':\n return map.addSymbols<P>(spec);\n case 'extrusions':\n return map.addExtrusions<P>(spec);\n case 'raster':\n return map.addRaster(spec);\n case 'ground':\n return map.addGround(spec);\n case 'network':\n return map.addNetwork(spec);\n case 'tiles3d':\n return map.addTiles3d(spec);\n case 'pointcloud':\n return map.addPointCloud(spec);\n case 'models':\n return map.addModels(spec);\n default: {\n // Only from an application's configuration, untyped: the cases above cover every type\n const { type }: { type?: unknown } = spec;\n\n throw new Error(`isard: no layer of type ${String(type)}`);\n }\n }\n};\n"]}
1
+ {"version":3,"file":"layer-spec.js","sourceRoot":"","sources":["../../src/map/layer-spec.ts"],"names":[],"mappings":"AAAA,oHAAoH;AA0BpH,oGAAoG;AACpG,MAAM,CAAC,MAAM,OAAO,GAAG,CAA8B,GAAW,EAAE,IAAkB,EAAS,EAAE;IAC7F,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,OAAO;YACV,OAAO,GAAG,CAAC,QAAQ,CAAI,IAAI,CAAC,CAAC;QAC/B,KAAK,SAAS;YACZ,OAAO,GAAG,CAAC,UAAU,CAAI,IAAI,CAAC,CAAC;QACjC,KAAK,OAAO;YACV,OAAO,GAAG,CAAC,QAAQ,CAAI,IAAI,CAAC,CAAC;QAC/B,KAAK,SAAS;YACZ,OAAO,GAAG,CAAC,UAAU,CAAI,IAAI,CAAC,CAAC;QACjC,KAAK,YAAY;YACf,OAAO,GAAG,CAAC,aAAa,CAAI,IAAI,CAAC,CAAC;QACpC,KAAK,QAAQ;YACX,OAAO,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC7B,KAAK,QAAQ;YACX,OAAO,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC7B,KAAK,SAAS;YACZ,OAAO,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC9B,KAAK,SAAS;YACZ,OAAO,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC9B,KAAK,YAAY;YACf,OAAO,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QACjC,KAAK,QAAQ;YACX,OAAO,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC7B,KAAK,MAAM;YACT,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC3B,OAAO,CAAC,CAAC,CAAC;YACR,sFAAsF;YACtF,MAAM,EAAE,IAAI,EAAE,GAAuB,IAAI,CAAC;YAE1C,MAAM,IAAI,KAAK,CAAC,2BAA2B,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;AACH,CAAC,CAAC","sourcesContent":["/** A layer described by its type and options, as an application's configuration gives it, and the map adding it. */\n\nimport type { ExtrusionOptions } from '../layers/extrusions.ts';\nimport type { CircleOptions, FillOptions, LineOptions } from '../layers/features.ts';\nimport type { FlowOptions } from '../layers/flow.ts';\nimport type { GroundOptions, Layer, ModelOptions } from '../layers/layers.ts';\nimport type { PointCloudOptions } from '../layers/pointclouds.ts';\nimport type { SymbolOptions } from '../layers/symbols.ts';\nimport type { GeoMap } from '../map.ts';\nimport type { NetworkOptions, RasterOptions, Tiles3dOptions } from '../types.ts';\n\n/** A layer by its type and the options of its `add…` method (`GeoMap.add`) */\nexport type LayerSpec<P = Record<string, unknown>> =\n | ({ type: 'lines' } & LineOptions<P>)\n | ({ type: 'circles' } & CircleOptions<P>)\n | ({ type: 'fills' } & FillOptions<P>)\n | ({ type: 'symbols' } & SymbolOptions<P>)\n | ({ type: 'extrusions' } & ExtrusionOptions<P>)\n | ({ type: 'raster' } & RasterOptions & { before?: Layer })\n | ({ type: 'ground' } & GroundOptions & { before?: Layer })\n | ({ type: 'network' } & NetworkOptions)\n | ({ type: 'tiles3d' } & Tiles3dOptions)\n | ({ type: 'pointcloud' } & PointCloudOptions & { before?: Layer })\n | ({ type: 'models' } & ModelOptions & { before?: Layer })\n | ({ type: 'flow' } & FlowOptions);\n\n/** Adds the layer a description gives with the `add…` method of its type; an unknown type throws */\nexport const addSpec = <P = Record<string, unknown>>(map: GeoMap, spec: LayerSpec<P>): Layer => {\n switch (spec.type) {\n case 'lines':\n return map.addLines<P>(spec);\n case 'circles':\n return map.addCircles<P>(spec);\n case 'fills':\n return map.addFills<P>(spec);\n case 'symbols':\n return map.addSymbols<P>(spec);\n case 'extrusions':\n return map.addExtrusions<P>(spec);\n case 'raster':\n return map.addRaster(spec);\n case 'ground':\n return map.addGround(spec);\n case 'network':\n return map.addNetwork(spec);\n case 'tiles3d':\n return map.addTiles3d(spec);\n case 'pointcloud':\n return map.addPointCloud(spec);\n case 'models':\n return map.addModels(spec);\n case 'flow':\n return map.addFlow(spec);\n default: {\n // Only from an application's configuration, untyped: the cases above cover every type\n const { type }: { type?: unknown } = spec;\n\n throw new Error(`isard: no layer of type ${String(type)}`);\n }\n }\n};\n"]}
@@ -5,6 +5,7 @@
5
5
  import type { RemoteReprojection } from '../basemap/grid.ts';
6
6
  import { type PngEncoding } from '../basemap/terrain.ts';
7
7
  import { BasemapWorkers } from '../basemap/workerpool.ts';
8
+ import { type Grid } from '../grids.ts';
8
9
  import type { TerrainLoader } from '../settings.ts';
9
10
  import type { GeoMapOptions } from '../types.ts';
10
11
  /** The workers of a map, created on first use */
@@ -38,6 +39,9 @@ export declare class MapWorkers {
38
39
  /** The loader of the relief tiles of `url` in a PNG encoding (one per URL, encoding and floor) */
39
40
  readonly terrainLoader: (url: string, encoding: PngEncoding, floor?: number) => TerrainLoader;
40
41
  private readonly remoteHeights;
42
+ /** A GRIB2 or NetCDF file read into grids by the grid module (`module`), in a worker (in the page without them, or if
43
+ * the worker fails) */
44
+ readGrids(source: string | URL | ArrayBuffer | Uint8Array, module: string, signal?: AbortSignal): Promise<Grid[]>;
41
45
  /**
42
46
  * The workers decoding the relief and reprojecting rasters: the shared pool, unless the map has no workers
43
47
  * (`workers: false` or 0, or none in this browser): that is done in the page then