isard 0.2.1 → 0.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 (93) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/README.md +8 -4
  3. package/dist/animation.d.ts +18 -0
  4. package/dist/animation.js +84 -0
  5. package/dist/animation.js.map +1 -0
  6. package/dist/basemap.worker.d.ts +26 -4
  7. package/dist/basemap.worker.js +2 -2
  8. package/dist/basemap.worker.js.map +9 -5
  9. package/dist/crs.d.ts +72 -0
  10. package/dist/crs.js +243 -0
  11. package/dist/crs.js.map +1 -0
  12. package/dist/decoder.worker.js +4 -4
  13. package/dist/decoder.worker.js.map +4 -4
  14. package/dist/engine-loader.d.ts +28 -0
  15. package/dist/engine-loader.js +112 -0
  16. package/dist/engine-loader.js.map +1 -0
  17. package/dist/features.d.ts +8 -0
  18. package/dist/features.js +17 -10
  19. package/dist/features.js.map +1 -1
  20. package/dist/geo.d.ts +16 -0
  21. package/dist/geo.js +32 -0
  22. package/dist/geo.js.map +1 -0
  23. package/dist/geoplateforme.d.ts +21 -5
  24. package/dist/geoplateforme.js +47 -12
  25. package/dist/geoplateforme.js.map +1 -1
  26. package/dist/glyphs.d.ts +13 -3
  27. package/dist/glyphs.js +26 -4
  28. package/dist/glyphs.js.map +1 -1
  29. package/dist/gpx.d.ts +11 -0
  30. package/dist/gpx.js +74 -0
  31. package/dist/gpx.js.map +1 -0
  32. package/dist/grid.d.ts +81 -0
  33. package/dist/grid.js +270 -0
  34. package/dist/grid.js.map +1 -0
  35. package/dist/icons.d.ts +146 -0
  36. package/dist/icons.js +333 -0
  37. package/dist/icons.js.map +1 -0
  38. package/dist/index.d.ts +11 -4
  39. package/dist/index.js +6 -1
  40. package/dist/index.js.map +1 -1
  41. package/dist/interaction.d.ts +0 -4
  42. package/dist/interaction.js +8 -4
  43. package/dist/interaction.js.map +1 -1
  44. package/dist/isard_bg.wasm +0 -0
  45. package/dist/isard_core_bg.wasm +0 -0
  46. package/dist/kml.d.ts +12 -0
  47. package/dist/kml.js +159 -0
  48. package/dist/kml.js.map +1 -0
  49. package/dist/layers.d.ts +89 -2
  50. package/dist/layers.js +171 -15
  51. package/dist/layers.js.map +1 -1
  52. package/dist/lru.d.ts +22 -0
  53. package/dist/lru.js +52 -0
  54. package/dist/lru.js.map +1 -0
  55. package/dist/map.d.ts +45 -7
  56. package/dist/map.js +138 -310
  57. package/dist/map.js.map +1 -1
  58. package/dist/resample.d.ts +41 -0
  59. package/dist/resample.js +164 -0
  60. package/dist/resample.js.map +1 -0
  61. package/dist/settings.d.ts +39 -0
  62. package/dist/settings.js +104 -0
  63. package/dist/settings.js.map +1 -0
  64. package/dist/symbols.d.ts +54 -9
  65. package/dist/symbols.js +278 -55
  66. package/dist/symbols.js.map +1 -1
  67. package/dist/terrain.d.ts +19 -7
  68. package/dist/terrain.js +40 -28
  69. package/dist/terrain.js.map +1 -1
  70. package/dist/topojson.d.ts +29 -0
  71. package/dist/topojson.js +66 -0
  72. package/dist/topojson.js.map +1 -0
  73. package/dist/types.d.ts +14 -6
  74. package/dist/types.js.map +1 -1
  75. package/dist/vectorstyle.d.ts +32 -3
  76. package/dist/vectorstyle.js.map +1 -1
  77. package/dist/vectortiles.d.ts +19 -7
  78. package/dist/vectortiles.js +117 -69
  79. package/dist/vectortiles.js.map +1 -1
  80. package/dist/wasm/isard.d.ts +55 -7
  81. package/dist/wasm/isard.js +117 -6
  82. package/dist/wasm/isard_core.d.ts +29 -4
  83. package/dist/wasm/isard_core.js +84 -5
  84. package/dist/wmts.d.ts +14 -0
  85. package/dist/wmts.js +76 -0
  86. package/dist/wmts.js.map +1 -0
  87. package/dist/xml.d.ts +26 -0
  88. package/dist/xml.js +109 -0
  89. package/dist/xml.js.map +1 -0
  90. package/package.json +1 -1
  91. package/dist/equirectangular.d.ts +0 -35
  92. package/dist/equirectangular.js +0 -143
  93. package/dist/equirectangular.js.map +0 -1
package/dist/symbols.js CHANGED
@@ -1,10 +1,13 @@
1
1
  /**
2
- * Text labels from GeoJSON: at points, at the middle of lines, at the center of polygons. Shaped on the page, placed by
3
- * the engine every frame with collisions shared by all symbol layers (the top layer first, each layer in data order),
4
- * drawn with a halo, standing on the relief.
2
+ * Text labels and icons from GeoJSON: at points, at the middle of lines, at the center of polygons. Shaped on the page,
3
+ * placed by the engine every frame with collisions shared by all symbol layers (the top layer first, each layer in
4
+ * data order), drawn with a halo, standing on the relief. The icons are the map's images (`map.addImage`, a vector
5
+ * basemap's sprite), beside their text or stretched around it.
5
6
  */
6
7
  import { evaluate, featuresOf, parseColor, stops, } from "./features.js";
8
+ import { toMercator } from "./geo.js";
7
9
  import { codes, DEFAULT_FONT, shape } from "./glyphs.js";
10
+ import { layoutIcon } from "./icons.js";
8
11
  import { Layer } from "./layers.js";
9
12
  /** Where a geometry is labelled: its points, the middle of its longest line (with the direction of the line there),
10
13
  * the centroid of its largest polygon */
@@ -65,17 +68,85 @@ function points(geometry) {
65
68
  return geometry.geometries.flatMap(points);
66
69
  }
67
70
  }
68
- const MAX_LAT = 85.051128779806589;
69
- const merc = ([lon, lat]) => {
70
- const phi = (Math.max(-MAX_LAT, Math.min(MAX_LAT, lat)) * Math.PI) / 180;
71
- return [(lon + 180) / 360, 0.5 - Math.log(Math.tan(Math.PI / 4 + phi / 2)) / (2 * Math.PI)];
71
+ /** Flags of a label for the engine (`flag` in symbols.rs) */
72
+ const FLAG = {
73
+ textOverlap: 1,
74
+ textIgnore: 2,
75
+ iconOverlap: 4,
76
+ iconIgnore: 8,
77
+ textOptional: 16,
78
+ iconOptional: 32,
79
+ text: 64,
80
+ icon: 128,
81
+ textAlong: 256,
82
+ iconAlong: 512,
83
+ iconUpright: 1024,
72
84
  };
85
+ /** Flags of an overlap: allowed to overlap, ignored by the placement */
86
+ function overlapFlags(overlap, allow, ignore) {
87
+ if (overlap === true)
88
+ return allow | ignore;
89
+ if (overlap === 'allow')
90
+ return allow;
91
+ return overlap === 'ignore' ? ignore : 0;
92
+ }
93
+ /** Room around an icon's box, CSS pixels (MapLibre's default `icon-padding`) */
94
+ const ICON_PADDING = 2;
95
+ /** Numbers per quad: its label's index, its place, its atlas coordinates, its scale (a glyph's; -1 or -2: an icon),
96
+ * its turn */
97
+ const QUAD = 11;
98
+ /** Every character of a run has its glyph */
99
+ function present(part, loaded) {
100
+ const glyphs = loaded.get(part.font ?? DEFAULT_FONT);
101
+ if (!glyphs)
102
+ return false;
103
+ for (const ch of part.text)
104
+ if (ch !== '\n' && !glyphs.has(ch.codePointAt(0) ?? 32))
105
+ return false;
106
+ return true;
107
+ }
108
+ /** The labels of chunks one after the other, the quads' label indices moved past those of the chunks before */
109
+ function concat(chunks) {
110
+ if (chunks.length === 1 && chunks[0])
111
+ return chunks[0];
112
+ const length = (key) => chunks.reduce((n, c) => n + c[key].length, 0);
113
+ const out = {
114
+ anchors: new Float64Array(length('anchors')),
115
+ boxes: new Float32Array(length('boxes')),
116
+ styles: new Float32Array(length('styles')),
117
+ quads: new Float32Array(length('quads')),
118
+ };
119
+ const at = { anchors: 0, boxes: 0, styles: 0, quads: 0 };
120
+ let labels = 0;
121
+ for (const c of chunks) {
122
+ out.anchors.set(c.anchors, at.anchors);
123
+ out.boxes.set(c.boxes, at.boxes);
124
+ out.styles.set(c.styles, at.styles);
125
+ out.quads.set(c.quads, at.quads);
126
+ if (labels > 0)
127
+ for (let q = at.quads; q < at.quads + c.quads.length; q += QUAD)
128
+ out.quads[q] = (out.quads[q] ?? 0) + labels;
129
+ at.anchors += c.anchors.length;
130
+ at.boxes += c.boxes.length;
131
+ at.styles += c.styles.length;
132
+ at.quads += c.quads.length;
133
+ labels += c.count;
134
+ }
135
+ return out;
136
+ }
73
137
  export class SymbolLayer extends Layer {
74
138
  host;
75
139
  style;
76
140
  list;
141
+ /** The features in groups that do not change (`setGroups`): each group's labels kept between updates */
142
+ groups;
143
+ chunks = new WeakMap();
77
144
  /** Bumped by each change: a shaping that finished after a newer one began is dropped */
78
145
  generation = 0;
146
+ /** Bumped by each change of style: the labels kept are shaped again */
147
+ styleGeneration = 0;
148
+ /** No style function takes the index of a feature: a group's labels do not depend on its place */
149
+ indexFree = true;
79
150
  labels;
80
151
  /** @internal */
81
152
  constructor(host, data, style) {
@@ -83,16 +154,28 @@ export class SymbolLayer extends Layer {
83
154
  this.host = host;
84
155
  this.style = style;
85
156
  this.list = featuresOf(data);
157
+ this.styled();
86
158
  }
87
159
  get features() {
88
160
  return this.list;
89
161
  }
90
162
  setData(data) {
91
163
  this.list = featuresOf(data);
164
+ this.groups = undefined;
165
+ void this.update();
166
+ }
167
+ /**
168
+ * @internal The features as groups that are never changed once given (the labels of a vector tile and style layer),
169
+ * in order: the labels of a group seen before are not shaped again
170
+ */
171
+ setGroups(groups) {
172
+ this.groups = groups;
173
+ this.list = groups.flat();
92
174
  void this.update();
93
175
  }
94
176
  setStyle(style) {
95
177
  this.style = { ...this.style, ...style };
178
+ this.styled();
96
179
  void this.update();
97
180
  }
98
181
  setFilter(filter) {
@@ -103,11 +186,16 @@ export class SymbolLayer extends Layer {
103
186
  this.sendLayer(this.map.engine, this.id);
104
187
  this.map.requestRender();
105
188
  }
106
- /** Shapes the labels (loading their glyphs first) and sends them */
107
- async update() {
108
- const generation = ++this.generation;
189
+ styled() {
190
+ this.styleGeneration += 1;
191
+ // A function of one parameter reads the properties only
192
+ this.indexFree = Object.values(this.style).every((v) => typeof v !== 'function' || v.length < 2);
193
+ }
194
+ /** The runs of text of each feature of a group (none for a feature filtered out) */
195
+ parts(group, base) {
109
196
  const { text, font, filter } = this.style;
110
- const parts = this.list.map((f, i) => {
197
+ return group.map((f, k) => {
198
+ const i = base + k;
111
199
  if (filter && !filter(f.properties, i))
112
200
  return [];
113
201
  const t = evaluate(text, f.properties, i);
@@ -115,77 +203,199 @@ export class SymbolLayer extends Layer {
115
203
  // Each run in its font, the feature's by default
116
204
  return (typeof t === 'string' ? [{ text: t }] : t).map((p) => ({ ...p, font: p.font ?? own }));
117
205
  });
206
+ }
207
+ /** Shapes the labels (loading their glyphs first) and sends them; the groups' labels still valid are kept */
208
+ async update() {
209
+ const generation = ++this.generation;
210
+ const groups = this.groups ?? [this.list];
211
+ const keep = this.groups !== undefined;
212
+ const glyphs = this.host.glyphs;
213
+ const todo = [];
214
+ let base = 0;
215
+ for (const group of groups) {
216
+ const c = keep ? this.chunks.get(group) : undefined;
217
+ const valid = c !== undefined &&
218
+ c.style === this.styleGeneration &&
219
+ (c.base === base || this.indexFree) &&
220
+ (c.complete || (c.glyphs === glyphs.version && c.icons === this.host.icons.version));
221
+ if (!valid)
222
+ todo.push({ group, base, parts: this.parts(group, base) });
223
+ base += group.length;
224
+ }
118
225
  const byFont = new Map();
119
- for (const p of parts.flat()) {
120
- const key = p.font ?? DEFAULT_FONT;
121
- const set = byFont.get(key) ?? new Set();
122
- for (const code of codes([p]))
123
- set.add(code);
124
- byFont.set(key, set);
226
+ for (const { parts } of todo) {
227
+ for (const p of parts.flat()) {
228
+ const key = p.font ?? DEFAULT_FONT;
229
+ const set = byFont.get(key) ?? new Set();
230
+ for (const code of codes([p]))
231
+ set.add(code);
232
+ byFont.set(key, set);
233
+ }
125
234
  }
126
235
  const loaded = new Map();
127
236
  await Promise.all([...byFont].map(async ([f, set]) => {
128
- loaded.set(f, await this.host.glyphs.load(f, set));
237
+ loaded.set(f, await glyphs.load(f, set));
129
238
  }));
130
239
  if (generation !== this.generation)
131
240
  return;
132
- this.labels = this.build(parts, loaded);
241
+ const built = new Map();
242
+ for (const { group, base: b, parts } of todo) {
243
+ const chunk = this.build(group, b, parts, loaded);
244
+ built.set(group, chunk);
245
+ if (keep)
246
+ this.chunks.set(group, chunk);
247
+ }
248
+ this.labels = concat(groups.map((g) => built.get(g) ?? this.chunks.get(g)));
249
+ // The icons packed for them
250
+ this.host.icons.flush();
133
251
  this.send(this.map.engine, this.id);
134
252
  this.map.requestRender();
135
253
  }
136
- build(parts, loaded) {
254
+ /** The labels of a group of features, `base` the index of its first feature */
255
+ build(group, base, parts, loaded) {
137
256
  const { font, size, anchor, offset, maxWidth, lineHeight, color, haloColor, haloWidth, overlap, placement } = this.style;
257
+ const st = this.style;
258
+ const icons = this.host.icons;
138
259
  const anchorList = [];
139
260
  const boxes = [];
140
261
  const styles = [];
141
- const quads = [];
142
- const feature = [];
143
- this.list.forEach((f, i) => {
144
- const text = parts[i];
145
- if (!text?.length || text.every((p) => !p.text))
262
+ const iconQuads = [];
263
+ const textQuads = [];
264
+ let count = 0;
265
+ let complete = true;
266
+ group.forEach((f, k) => {
267
+ const i = base + k;
268
+ const p = f.properties;
269
+ const text = parts[k];
270
+ const filtered = st.filter !== undefined && !st.filter(p, i);
271
+ const hasText = !!text?.length && text.some((t) => t.text);
272
+ const iconName = filtered ? '' : evaluate(st.icon, p, i);
273
+ const icon = iconName ? icons.get(iconName) : undefined;
274
+ // An image not added yet: laid out again once more are
275
+ if (iconName && !icon)
276
+ complete = false;
277
+ if (!hasText && !icon)
146
278
  return;
279
+ // Glyphs still missing: shaped again once more glyphs are loaded
280
+ if (complete && text && !text.every((t) => present(t, loaded)))
281
+ complete = false;
147
282
  // Shaped at its largest size; the engine scales by the zoom stops
148
- const s0 = evaluate(size, f.properties, i);
149
- const shaped = typeof s0 === 'number' ? s0 : Math.max(...s0.map(([, v]) => v), 1);
150
- const scale = typeof s0 === 'number' ? 1 : s0.map(([z, v]) => [z, v / shaped]);
151
- const s = shape(text, (name) => loaded.get(name), {
152
- font: evaluate(font, f.properties, i),
153
- size: shaped,
154
- maxWidth: evaluate(maxWidth, f.properties, i),
155
- lineHeight: evaluate(lineHeight, f.properties, i),
156
- anchor: evaluate(anchor, f.properties, i),
157
- offset: evaluate(offset, f.properties, i),
158
- });
159
- if (!s.quads.length)
283
+ const shapedAt = (v) => (typeof v === 'number' ? v : Math.max(...v.map(([, x]) => x), 1e-6));
284
+ const scaleOf = (v, at) => typeof v === 'number' ? 1 : v.map(([z, x]) => [z, x / at]);
285
+ const s0 = evaluate(size, p, i);
286
+ const shaped = shapedAt(s0);
287
+ const scale = scaleOf(s0, shaped);
288
+ let s;
289
+ if (hasText && text) {
290
+ s = shape(text, (name) => loaded.get(name), {
291
+ font: evaluate(font, p, i),
292
+ size: shaped,
293
+ maxWidth: evaluate(maxWidth, p, i),
294
+ lineHeight: evaluate(lineHeight, p, i),
295
+ anchor: evaluate(anchor, p, i),
296
+ offset: evaluate(offset, p, i),
297
+ });
298
+ if (!s.quads.length)
299
+ s = undefined;
300
+ }
301
+ if (!s && !icon)
160
302
  return;
161
- const halo = evaluate(haloWidth, f.properties, i);
162
- const fill = parseColor(evaluate(color, f.properties, i));
163
- const haloRgba = parseColor(evaluate(haloColor, f.properties, i));
164
- for (const { at, along } of anchors(f.geometry)) {
165
- const label = feature.length;
166
- feature.push(i);
167
- const [x, y] = merc(at);
303
+ const along = evaluate(placement, p, i) === 'line';
304
+ let flags = overlapFlags(evaluate(overlap, p, i), FLAG.textOverlap, FLAG.textIgnore);
305
+ if (evaluate(st.textOptional, p, i))
306
+ flags |= FLAG.textOptional;
307
+ if (s)
308
+ flags |= FLAG.text;
309
+ // The icon: beside its text, or stretched around it (then scaled and turned with it)
310
+ let iconScale = 1;
311
+ let iconBox = [0, 0, 0, 0];
312
+ let iconColor = [0, 0, 0, 0];
313
+ let quads = [];
314
+ let iconTurns = false;
315
+ let fitted = false;
316
+ if (icon) {
317
+ const fit = evaluate(st.iconTextFit, p, i);
318
+ fitted = fit !== 'none' && s !== undefined;
319
+ const i0 = evaluate(st.iconSize, p, i);
320
+ const iconShaped = fitted ? 1 : shapedAt(i0);
321
+ iconScale = fitted ? scale : scaleOf(i0, iconShaped);
322
+ const laid = layoutIcon(icon, {
323
+ size: iconShaped,
324
+ anchor: evaluate(st.iconAnchor, p, i),
325
+ offset: evaluate(st.iconOffset, p, i),
326
+ rotate: evaluate(st.iconRotate, p, i),
327
+ fit,
328
+ padding: evaluate(st.iconTextFitPadding, p, i),
329
+ text: s?.layout,
330
+ });
331
+ quads = laid.quads;
332
+ if (quads.length) {
333
+ flags |= FLAG.icon | overlapFlags(evaluate(st.iconOverlap, p, i), FLAG.iconOverlap, FLAG.iconIgnore);
334
+ if (evaluate(st.iconOptional, p, i))
335
+ flags |= FLAG.iconOptional;
336
+ const alignment = evaluate(st.iconRotationAlignment, p, i);
337
+ if (fitted)
338
+ flags |= FLAG.iconUpright;
339
+ iconTurns = alignment === 'map' || (alignment === 'auto' && along);
340
+ iconBox = [
341
+ laid.box[0] - ICON_PADDING,
342
+ laid.box[1] - ICON_PADDING,
343
+ laid.box[2] + ICON_PADDING,
344
+ laid.box[3] + ICON_PADDING,
345
+ ];
346
+ const [r, g, b, a] = parseColor(evaluate(st.iconColor, p, i));
347
+ iconColor = [r, g, b, a * Math.max(0, Math.min(1, evaluate(st.iconOpacity, p, i)))];
348
+ }
349
+ }
350
+ if (!(flags & (FLAG.text | FLAG.icon)))
351
+ return;
352
+ const halo = s ? evaluate(haloWidth, p, i) : 0;
353
+ const fill = parseColor(evaluate(color, p, i));
354
+ const haloRgba = parseColor(evaluate(haloColor, p, i));
355
+ // The collision box: the ink, with the halo and a little room
356
+ const pad = halo + 1;
357
+ const textBox = s ? [s.box[0] - pad, s.box[1] - pad, s.box[2] + pad, s.box[3] + pad] : [0, 0, 0, 0];
358
+ for (const { at, along: line } of anchors(f.geometry)) {
359
+ const label = count++;
360
+ const [x, y] = toMercator(at);
168
361
  anchorList.push(x, y);
169
- // Along the line: its direction in Mercator (y towards the south)
362
+ // The text along its line, kept upright; the icon turning with the map (along its line, or with the east at a
363
+ // point), or with its text when fitted to it
364
+ const textAlong = along && line !== undefined && s !== undefined;
365
+ const iconAlong = (flags & FLAG.icon) !== 0 && (fitted ? textAlong : iconTurns);
366
+ let labelFlags = flags | (textAlong ? FLAG.textAlong : 0) | (iconAlong ? FLAG.iconAlong : 0);
367
+ // The direction of its line in Mercator (y towards the south)
170
368
  let direction = [0, 0];
171
- if (placement === 'line' && along) {
172
- const [x1, y1] = merc([at[0] + along[0], at[1] + along[1]]);
369
+ if (line && (textAlong || iconAlong)) {
370
+ const [x1, y1] = toMercator([at[0] + line[0], at[1] + line[1]]);
173
371
  direction = [x1 - x, y1 - y];
174
372
  }
175
- // The collision box: the ink, with the halo and a little room
176
- const pad = halo + 1;
177
- boxes.push(s.box[0] - pad, s.box[1] - pad, s.box[2] + pad, s.box[3] + pad);
178
- styles.push(...fill, ...haloRgba, halo, evaluate(overlap, f.properties, i) ? 1 : 0, ...direction, ...stops(scale));
179
- for (const q of s.quads)
180
- quads.push(label, ...q);
373
+ else if (iconAlong) {
374
+ direction = [1, 0];
375
+ }
376
+ if (direction[0] === 0 && direction[1] === 0)
377
+ labelFlags &= ~(FLAG.textAlong | FLAG.iconAlong);
378
+ boxes.push(...textBox);
379
+ styles.push(...fill, ...haloRgba, halo, labelFlags, ...direction, ...stops(scale), ...iconBox, ...iconColor, ...stops(iconScale));
380
+ for (const q of quads)
381
+ iconQuads.push(label, ...q);
382
+ if (s)
383
+ for (const q of s.quads)
384
+ textQuads.push(label, ...q, 0);
181
385
  }
182
386
  });
183
387
  return {
184
388
  anchors: Float64Array.from(anchorList),
185
389
  boxes: Float32Array.from(boxes),
186
390
  styles: Float32Array.from(styles),
187
- quads: Float32Array.from(quads),
188
- feature,
391
+ // The icons under the texts
392
+ quads: Float32Array.from([...iconQuads, ...textQuads]),
393
+ count,
394
+ style: this.styleGeneration,
395
+ base,
396
+ glyphs: this.host.glyphs.version,
397
+ icons: icons.version,
398
+ complete,
189
399
  };
190
400
  }
191
401
  send(engine, id) {
@@ -232,6 +442,19 @@ export function symbolStyle(options) {
232
442
  maxWidth: 10,
233
443
  lineHeight: 1.2,
234
444
  overlap: false,
445
+ textOptional: false,
446
+ icon: '',
447
+ iconSize: 1,
448
+ iconAnchor: 'center',
449
+ iconOffset: [0, 0],
450
+ iconRotate: 0,
451
+ iconRotationAlignment: 'auto',
452
+ iconOverlap: false,
453
+ iconOptional: false,
454
+ iconTextFit: 'none',
455
+ iconTextFitPadding: [0, 0, 0, 0],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AAM,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IACjD,OAAO;QACL,OAAO,EAAE,CAAC;QACV,OAAO,EAAE,CAAC;QACV,OAAO,EAAE,EAAE;QACX,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,SAAS;QACjB,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,GAAG,IAAI;KACR,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Text labels from GeoJSON: at points, at the middle of lines, at the center of polygons. Shaped on the page, placed by\n * the engine every frame with collisions shared by all symbol layers (the top layer first, each layer in data order),\n * drawn with a halo, standing on the relief.\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 { codes, DEFAULT_FONT, type Glyph, type Glyphs, shape, type TextPart } from './glyphs.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: 'point' | 'line';\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 * (default false) */\n overlap: Styled<boolean, P>;\n}\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\nconst MAX_LAT = 85.051128779806589;\nconst merc = ([lon, lat]: Position): [number, number] => {\n const phi = (Math.max(-MAX_LAT, Math.min(MAX_LAT, lat)) * Math.PI) / 180;\n return [(lon + 180) / 360, 0.5 - Math.log(Math.tan(Math.PI / 4 + phi / 2)) / (2 * Math.PI)];\n};\n\n/** The map's glyphs, for a layer */\nexport interface GlyphHost extends LayerHost {\n readonly glyphs: Glyphs;\n}\n\nexport class SymbolLayer<P = Properties> extends Layer {\n private list: Feature<P>[];\n /** Bumped by each change: a shaping that finished after a newer one began is dropped */\n private generation = 0;\n private labels:\n | { anchors: Float64Array; boxes: Float32Array; styles: Float32Array; quads: Float32Array; feature: number[] }\n | 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 }\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 void this.update();\n }\n\n setStyle(style: Partial<SymbolStyle<P>>): void {\n this.style = { ...this.style, ...style };\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 /** Shapes the labels (loading their glyphs first) and sends them */\n private async update(): Promise<void> {\n const generation = ++this.generation;\n const { text, font, filter } = this.style;\n const parts = this.list.map((f, i): TextPart[] => {\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 const byFont = new Map<string, Set<number>>();\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 const loaded = new Map<string, Map<number, Glyph>>();\n await Promise.all(\n [...byFont].map(async ([f, set]) => {\n loaded.set(f, await this.host.glyphs.load(f, set));\n }),\n );\n if (generation !== this.generation) return;\n this.labels = this.build(parts, loaded);\n this.send(this.map.engine, this.id);\n this.map.requestRender();\n }\n\n private build(parts: TextPart[][], loaded: Map<string, Map<number, Glyph>>) {\n const { font, size, anchor, offset, maxWidth, lineHeight, color, haloColor, haloWidth, overlap, placement } =\n this.style;\n const anchorList: number[] = [];\n const boxes: number[] = [];\n const styles: number[] = [];\n const quads: number[] = [];\n const feature: number[] = [];\n this.list.forEach((f, i) => {\n const text = parts[i];\n if (!text?.length || text.every((p) => !p.text)) return;\n // Shaped at its largest size; the engine scales by the zoom stops\n const s0 = evaluate(size, f.properties, i);\n const shaped = typeof s0 === 'number' ? s0 : Math.max(...s0.map(([, v]) => v), 1);\n const scale: Size = typeof s0 === 'number' ? 1 : s0.map(([z, v]): [number, number] => [z, v / shaped]);\n const s = shape(text, (name) => loaded.get(name), {\n font: evaluate(font, f.properties, i),\n size: shaped,\n maxWidth: evaluate(maxWidth, f.properties, i),\n lineHeight: evaluate(lineHeight, f.properties, i),\n anchor: evaluate(anchor, f.properties, i),\n offset: evaluate(offset, f.properties, i),\n });\n if (!s.quads.length) return;\n const halo = evaluate(haloWidth, f.properties, i);\n const fill = parseColor(evaluate(color, f.properties, i));\n const haloRgba = parseColor(evaluate(haloColor, f.properties, i));\n for (const { at, along } of anchors(f.geometry)) {\n const label = feature.length;\n feature.push(i);\n const [x, y] = merc(at);\n anchorList.push(x, y);\n // Along the line: its direction in Mercator (y towards the south)\n let direction: [number, number] = [0, 0];\n if (placement === 'line' && along) {\n const [x1, y1] = merc([at[0] + along[0], at[1] + along[1]]);\n direction = [x1 - x, y1 - y];\n }\n // The collision box: the ink, with the halo and a little room\n const pad = halo + 1;\n boxes.push(s.box[0] - pad, s.box[1] - pad, s.box[2] + pad, s.box[3] + pad);\n styles.push(\n ...fill,\n ...haloRgba,\n halo,\n evaluate(overlap, f.properties, i) ? 1 : 0,\n ...direction,\n ...stops(scale),\n );\n for (const q of s.quads) quads.push(label, ...q);\n }\n });\n return {\n anchors: Float64Array.from(anchorList),\n boxes: Float32Array.from(boxes),\n styles: Float32Array.from(styles),\n quads: Float32Array.from(quads),\n feature,\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 ...rest,\n };\n}\n"]}
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,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;AAmEpC;yCACyC;AACzC,SAAS,OAAO,CAAC,QAAyB;IACxC,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,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACvH,CAAC;AAED,mFAAmF;AACnF,SAAS,MAAM,CAAC,QAAyB;IACvC,IAAI,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O;QACL,OAAO,EAAE,CAAC;QACV,OAAO,EAAE,CAAC;QACV,OAAO,EAAE,EAAE;QACX,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,SAAS;QACjB,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","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.d.ts CHANGED
@@ -1,14 +1,26 @@
1
1
  /**
2
- * Altitudes encoded in the colors of PNG tiles, decoded in the page for the relief: Terrarium (Mapzen, the Terrain
3
- * Tiles of AWS) and Terrain-RGB (Mapbox, MapTiler). The engine reads raw floats only; a loader gives it the altitudes
4
- * of each tile.
2
+ * Altitudes encoded in the colors of PNG tiles, for the relief: Terrarium (Mapzen, the Terrain Tiles of AWS) and
3
+ * Terrain-RGB (Mapbox, MapTiler). The engine reads raw floats only; a loader gives it the altitudes of each tile,
4
+ * decoded in a worker of the map's pool (OffscreenCanvas), or in the page when the map has no workers.
5
5
  */
6
- import type { TerrainEncoding } from './types.ts';
6
+ /** The encodings of altitudes in the colors of PNG tiles */
7
+ export type PngEncoding = 'terrarium' | 'mapbox';
7
8
  /** Altitudes (metres, rows from the north) of RGBA pixels in an encoding; below `floor` raised to it */
8
- export declare function decodeHeights(rgba: Uint8ClampedArray | Uint8Array, encoding: Exclude<TerrainEncoding, 'float32'>, floor?: number): Float32Array;
9
+ export declare function decodeHeights(rgba: Uint8ClampedArray | Uint8Array, encoding: PngEncoding, floor?: number): Float32Array;
10
+ /** Where the tiles are drawn and read back, made on first use and kept (each tile drawn and read at once) */
11
+ export interface Surface {
12
+ canvas?: OffscreenCanvas;
13
+ }
14
+ /**
15
+ * The altitudes of the PNG tile at `url`: 256 × 256, null where the server has no tile; a network or server error
16
+ * rejects (the engine retries). Where it runs: in a worker of the map, or in the page without workers
17
+ */
18
+ export declare function fetchHeights(url: string, encoding: PngEncoding, floor: number | undefined, signal: AbortSignal, surface: Surface): Promise<Float32Array | null>;
19
+ /** `fetchHeights` run in a worker for tile `z`/`x`/`y`; undefined when the map has no workers (run in the page) */
20
+ export type RemoteHeights = (url: string, encoding: PngEncoding, floor: number | undefined, tile: [z: number, x: number, y: number], signal: AbortSignal) => Promise<Float32Array | null> | undefined;
9
21
  /**
10
22
  * A loader of the engine's relief for PNG tiles of `url` ({z}, {x}, {y}) in an encoding: 256 × 256 altitudes, null
11
23
  * where the server has no tile; a network or server error rejects (retried). `floor`: the lowest altitude kept (the
12
- * sea floor of a worldwide model flattened at sea level)
24
+ * sea floor of a worldwide model flattened at sea level). `remote`: decodes in a worker when it can
13
25
  */
14
- export declare function encodedTerrainLoader(url: string, encoding: Exclude<TerrainEncoding, 'float32'>, floor?: number): (z: number, x: number, y: number, signal: AbortSignal) => Promise<Float32Array | null>;
26
+ export declare function encodedTerrainLoader(url: string, encoding: PngEncoding, floor?: number, remote?: RemoteHeights): (z: number, x: number, y: number, signal: AbortSignal) => Promise<Float32Array | null>;