isard 1.4.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +220 -2
- package/README.md +23 -7
- package/dist/basemap/furniture.d.ts +8 -0
- package/dist/basemap/furniture.js +26 -0
- package/dist/basemap/furniture.js.map +1 -0
- package/dist/basemap/trees.d.ts +35 -8
- package/dist/basemap/trees.js +105 -52
- package/dist/basemap/trees.js.map +1 -1
- package/dist/basemap/vectorstyle.d.ts +9 -3
- package/dist/basemap/vectorstyle.js +5 -6
- package/dist/basemap/vectorstyle.js.map +1 -1
- package/dist/basemap/vectortiles/context.d.ts +46 -0
- package/dist/basemap/vectortiles/context.js +6 -0
- package/dist/basemap/vectortiles/context.js.map +1 -0
- package/dist/basemap/vectortiles/extrusions.d.ts +15 -0
- package/dist/basemap/vectortiles/extrusions.js +61 -0
- package/dist/basemap/vectortiles/extrusions.js.map +1 -0
- package/dist/basemap/vectortiles/labels.d.ts +25 -0
- package/dist/basemap/vectortiles/labels.js +250 -0
- package/dist/basemap/vectortiles/labels.js.map +1 -0
- package/dist/basemap/vectortiles/lamps.d.ts +23 -0
- package/dist/basemap/vectortiles/lamps.js +90 -0
- package/dist/basemap/vectortiles/lamps.js.map +1 -0
- package/dist/basemap/vectortiles/requests.d.ts +28 -0
- package/dist/basemap/vectortiles/requests.js +74 -0
- package/dist/basemap/vectortiles/requests.js.map +1 -0
- package/dist/basemap/vectortiles/street-wind.d.ts +19 -0
- package/dist/basemap/vectortiles/street-wind.js +133 -0
- package/dist/basemap/vectortiles/street-wind.js.map +1 -0
- package/dist/basemap/vectortiles/style.d.ts +47 -0
- package/dist/basemap/vectortiles/style.js +141 -0
- package/dist/basemap/vectortiles/style.js.map +1 -0
- package/dist/basemap/vectortiles/tiles.d.ts +34 -0
- package/dist/basemap/vectortiles/tiles.js +62 -0
- package/dist/basemap/vectortiles/tiles.js.map +1 -0
- package/dist/basemap/vectortiles/trees.d.ts +28 -0
- package/dist/basemap/vectortiles/trees.js +178 -0
- package/dist/basemap/vectortiles/trees.js.map +1 -0
- package/dist/basemap/vectortiles/vectors.d.ts +37 -0
- package/dist/basemap/vectortiles/vectors.js +231 -0
- package/dist/basemap/vectortiles/vectors.js.map +1 -0
- package/dist/basemap/vectortiles.d.ts +49 -96
- package/dist/basemap/vectortiles.js +99 -774
- package/dist/basemap/vectortiles.js.map +1 -1
- package/dist/basemap/workerpool.js +25 -6
- package/dist/basemap/workerpool.js.map +1 -1
- package/dist/basemap.worker.js +2 -2
- package/dist/basemap.worker.js.map +14 -12
- package/dist/bind/layers.js +1 -0
- package/dist/bind/layers.js.map +1 -1
- package/dist/data/collada.d.ts +19 -0
- package/dist/data/collada.js +319 -0
- package/dist/data/collada.js.map +1 -0
- package/dist/data/ifc.d.ts +100 -0
- package/dist/data/ifc.js +372 -0
- package/dist/data/ifc.js.map +1 -0
- package/dist/decoder.worker.js +5 -4
- package/dist/decoder.worker.js.map +8 -6
- package/dist/engine/decoders.d.ts +4 -8
- package/dist/engine/decoders.js +29 -2
- package/dist/engine/decoders.js.map +1 -1
- package/dist/formats.d.ts +7 -2
- package/dist/formats.js +7 -2
- package/dist/formats.js.map +1 -1
- package/dist/index.d.ts +15 -2
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/isard_bg.wasm +0 -0
- package/dist/isard_core_bg.wasm +0 -0
- package/dist/isard_grid_bg.wasm +0 -0
- package/dist/isard_tess_bg.wasm +0 -0
- package/dist/layers/extrusions.d.ts +10 -0
- package/dist/layers/extrusions.js +28 -2
- package/dist/layers/extrusions.js.map +1 -1
- package/dist/layers/flow.d.ts +9 -2
- package/dist/layers/flow.js +51 -10
- package/dist/layers/flow.js.map +1 -1
- package/dist/layers/layers.d.ts +12 -0
- package/dist/layers/layers.js +44 -1
- package/dist/layers/layers.js.map +1 -1
- package/dist/layers/panoramas.d.ts +2 -0
- package/dist/layers/panoramas.js +27 -6
- package/dist/layers/panoramas.js.map +1 -1
- package/dist/layers/photos.d.ts +48 -0
- package/dist/layers/photos.js +140 -0
- package/dist/layers/photos.js.map +1 -0
- package/dist/layers/symbols.d.ts +5 -1
- package/dist/layers/symbols.js +111 -32
- package/dist/layers/symbols.js.map +1 -1
- package/dist/layers/trees.d.ts +28 -0
- package/dist/layers/trees.js +51 -0
- package/dist/layers/trees.js.map +1 -0
- package/dist/layers/vectors.d.ts +28 -2
- package/dist/layers/vectors.js +81 -7
- package/dist/layers/vectors.js.map +1 -1
- package/dist/map/layer-spec.d.ts +3 -0
- package/dist/map/layer-spec.js +2 -0
- package/dist/map/layer-spec.js.map +1 -1
- package/dist/map/workers.js +3 -0
- package/dist/map/workers.js.map +1 -1
- package/dist/map.d.ts +8 -0
- package/dist/map.js +15 -2
- package/dist/map.js.map +1 -1
- package/dist/panoramax.d.ts +49 -0
- package/dist/panoramax.js +71 -0
- package/dist/panoramax.js.map +1 -0
- package/dist/react/Layer.d.ts +1 -0
- package/dist/react/Layer.js.map +1 -1
- package/dist/react/VectorGeometry.d.ts +5 -0
- package/dist/react/VectorGeometry.js +12 -4
- package/dist/react/VectorGeometry.js.map +1 -1
- package/dist/util/gltf.d.ts +9 -0
- package/dist/util/gltf.js +27 -0
- package/dist/util/gltf.js.map +1 -0
- package/dist/util/read.d.ts +4 -0
- package/dist/util/read.js +28 -0
- package/dist/util/read.js.map +1 -0
- package/dist/util/roofs.d.ts +10 -0
- package/dist/util/roofs.js +30 -0
- package/dist/util/roofs.js.map +1 -0
- package/dist/wasm/isard.d.ts +74 -22
- package/dist/wasm/isard.js +153 -22
- package/dist/wasm/isard_core.d.ts +62 -22
- package/dist/wasm/isard_core.js +129 -22
- package/dist/wasm/isard_tess.d.ts +6 -3
- package/dist/wasm/isard_tess.js +27 -4
- package/dist/workers/basemap/geometry.d.ts +38 -22
- package/dist/workers/basemap/labels.d.ts +14 -1
- package/dist/workers/basemap/lamps.d.ts +10 -0
- package/dist/workers/basemap/street.d.ts +1 -1
- package/dist/workers/basemap/trees.d.ts +3 -1
- package/dist/workers/basemap.worker.d.ts +43 -3
- package/dist/workers/basemap.worker.js +14 -2
- package/dist/workers/basemap.worker.js.map +1 -1
- package/package.json +1 -1
package/dist/layers/symbols.js
CHANGED
|
@@ -9,12 +9,50 @@ import { evaluate, featuresOf, parseColor, stops, } from "./features.js";
|
|
|
9
9
|
import { codes, DEFAULT_FONT, shape } from "./glyphs.js";
|
|
10
10
|
import { layoutIcon } from "./icons.js";
|
|
11
11
|
import { Layer } from "./layers.js";
|
|
12
|
-
/** Where a geometry is labelled: its points, the middle of its longest line (with the direction of the line there
|
|
13
|
-
* the centroid of its largest
|
|
12
|
+
/** Where a geometry is labelled: its points, the middle of its longest line (with the direction of the line there,
|
|
13
|
+
* and the line with that middle as one of its points, for a text that follows it), the centroid of its largest
|
|
14
|
+
* polygon */
|
|
14
15
|
const anchors = (geometry) => {
|
|
15
|
-
|
|
16
|
+
if (geometry?.type === 'LineString' || geometry?.type === 'MultiLineString') {
|
|
17
|
+
const lines = geometry.type === 'LineString' ? [geometry.coordinates] : geometry.coordinates;
|
|
18
|
+
const middle = lineMiddle(lines);
|
|
19
|
+
return middle ? [middle] : [];
|
|
20
|
+
}
|
|
21
|
+
return points(geometry).map((p) => ({ at: p }));
|
|
22
|
+
};
|
|
23
|
+
/** The middle of the longest of lines, measured in Mercator as the map draws them: the point, the direction of its
|
|
24
|
+
* segment (lon, lat), and the line with the point put in it */
|
|
25
|
+
const lineMiddle = (lines) => {
|
|
26
|
+
const lengths = lines.map((l) => {
|
|
27
|
+
const m = l.map((p) => toMercator(p));
|
|
28
|
+
return m.slice(1).map((p, i) => Math.hypot(p[0] - (m[i]?.[0] ?? 0), p[1] - (m[i]?.[1] ?? 0)));
|
|
29
|
+
});
|
|
30
|
+
const totals = lengths.map((d) => d.reduce((a, b) => a + b, 0));
|
|
31
|
+
const best = totals.reduce((b, t, i) => (t > (totals[b] ?? 0) ? i : b), 0);
|
|
32
|
+
const line = lines[best] ?? [];
|
|
33
|
+
const segments = lengths[best] ?? [];
|
|
34
|
+
let rest = (totals[best] ?? 0) / 2;
|
|
35
|
+
for (let i = 1; i < line.length; i += 1) {
|
|
36
|
+
const [a, b] = [line[i - 1], line[i]];
|
|
37
|
+
const d = segments[i - 1] ?? 0;
|
|
38
|
+
if (!a || !b)
|
|
39
|
+
continue;
|
|
40
|
+
if (d >= rest && d > 0) {
|
|
41
|
+
const t = rest / d;
|
|
42
|
+
const at = [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t];
|
|
43
|
+
return {
|
|
44
|
+
at,
|
|
45
|
+
along: [b[0] - a[0], b[1] - a[1]],
|
|
46
|
+
path: [...line.slice(0, i), at, ...line.slice(i)],
|
|
47
|
+
pathAnchor: i,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
rest -= d;
|
|
51
|
+
}
|
|
52
|
+
const first = line[0];
|
|
53
|
+
return first ? { at: first, along: [0, 0], path: [], pathAnchor: 0 } : undefined;
|
|
16
54
|
};
|
|
17
|
-
/**
|
|
55
|
+
/** The anchors of points, polygons and the lines of a collection (a line's own: `lineMiddle`) */
|
|
18
56
|
const points = (geometry) => {
|
|
19
57
|
if (!geometry)
|
|
20
58
|
return [];
|
|
@@ -25,21 +63,9 @@ const points = (geometry) => {
|
|
|
25
63
|
return geometry.coordinates;
|
|
26
64
|
case 'LineString':
|
|
27
65
|
case 'MultiLineString': {
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
let rest = length(line) / 2;
|
|
32
|
-
for (let i = 1; i < line.length; i += 1) {
|
|
33
|
-
const [a, b] = [line[i - 1], line[i]];
|
|
34
|
-
if (!a || !b)
|
|
35
|
-
continue;
|
|
36
|
-
const d = Math.hypot(b[0] - a[0], b[1] - a[1]);
|
|
37
|
-
if (d >= rest && d > 0) {
|
|
38
|
-
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]]];
|
|
39
|
-
}
|
|
40
|
-
rest -= d;
|
|
41
|
-
}
|
|
42
|
-
return line[0] ? [line[0]] : [];
|
|
66
|
+
// In a collection: the middle alone
|
|
67
|
+
const at = lineMiddle(geometry.type === 'LineString' ? [geometry.coordinates] : geometry.coordinates)?.at;
|
|
68
|
+
return at ? [at] : [];
|
|
43
69
|
}
|
|
44
70
|
case 'Polygon':
|
|
45
71
|
case 'MultiPolygon': {
|
|
@@ -70,6 +96,7 @@ const points = (geometry) => {
|
|
|
70
96
|
};
|
|
71
97
|
/** Flags of a label for the engine (`flag` in symbols.rs) */
|
|
72
98
|
const FLAG = {
|
|
99
|
+
textCurved: 2048,
|
|
73
100
|
textOverlap: 1,
|
|
74
101
|
textIgnore: 2,
|
|
75
102
|
iconOverlap: 4,
|
|
@@ -105,6 +132,13 @@ const present = (part, loaded) => {
|
|
|
105
132
|
return false;
|
|
106
133
|
return true;
|
|
107
134
|
};
|
|
135
|
+
/** The main thread's time a shaping takes before it lets a frame be drawn (ms): the labels of new tiles, thousands of
|
|
136
|
+
* features at the deeper zooms, are shaped over several frames instead of holding one */
|
|
137
|
+
const SLICE_MS = 6;
|
|
138
|
+
/** Features shaped between two looks at the time */
|
|
139
|
+
const SLICE_FEATURES = 128;
|
|
140
|
+
/** Lets the browser draw a frame and handle the events waiting */
|
|
141
|
+
const pause = () => new Promise((resolve) => setTimeout(resolve, 0));
|
|
108
142
|
/** The labels of chunks one after the other, the quads' label indices moved past those of the chunks before */
|
|
109
143
|
const concat = (chunks) => {
|
|
110
144
|
if (chunks.length === 1 && chunks[0])
|
|
@@ -115,14 +149,16 @@ const concat = (chunks) => {
|
|
|
115
149
|
boxes: new Float32Array(length('boxes')),
|
|
116
150
|
styles: new Float32Array(length('styles')),
|
|
117
151
|
quads: new Float32Array(length('quads')),
|
|
152
|
+
paths: new Float64Array(length('paths')),
|
|
118
153
|
};
|
|
119
|
-
const at = { anchors: 0, boxes: 0, styles: 0, quads: 0 };
|
|
154
|
+
const at = { anchors: 0, boxes: 0, styles: 0, quads: 0, paths: 0 };
|
|
120
155
|
let labels = 0;
|
|
121
156
|
for (const c of chunks) {
|
|
122
157
|
out.anchors.set(c.anchors, at.anchors);
|
|
123
158
|
out.boxes.set(c.boxes, at.boxes);
|
|
124
159
|
out.styles.set(c.styles, at.styles);
|
|
125
160
|
out.quads.set(c.quads, at.quads);
|
|
161
|
+
out.paths.set(c.paths, at.paths);
|
|
126
162
|
if (labels > 0)
|
|
127
163
|
for (let q = at.quads; q < at.quads + c.quads.length; q += QUAD)
|
|
128
164
|
out.quads[q] = (out.quads[q] ?? 0) + labels;
|
|
@@ -130,10 +166,23 @@ const concat = (chunks) => {
|
|
|
130
166
|
at.boxes += c.boxes.length;
|
|
131
167
|
at.styles += c.styles.length;
|
|
132
168
|
at.quads += c.quads.length;
|
|
169
|
+
at.paths += c.paths.length;
|
|
133
170
|
labels += c.count;
|
|
134
171
|
}
|
|
135
172
|
return out;
|
|
136
173
|
};
|
|
174
|
+
/** The pieces of a group's labels as one chunk, valid as long as its first piece (the glyphs and icons it saw) */
|
|
175
|
+
const joined = (first, rest) => {
|
|
176
|
+
if (rest.length === 0)
|
|
177
|
+
return first;
|
|
178
|
+
const pieces = [first, ...rest];
|
|
179
|
+
return {
|
|
180
|
+
...first,
|
|
181
|
+
...concat(pieces),
|
|
182
|
+
count: pieces.reduce((n, c) => n + c.count, 0),
|
|
183
|
+
complete: pieces.every((c) => c.complete),
|
|
184
|
+
};
|
|
185
|
+
};
|
|
137
186
|
export class SymbolLayer extends Layer {
|
|
138
187
|
host;
|
|
139
188
|
style;
|
|
@@ -239,20 +288,35 @@ export class SymbolLayer extends Layer {
|
|
|
239
288
|
if (generation !== this.generation)
|
|
240
289
|
return;
|
|
241
290
|
const built = new Map();
|
|
242
|
-
|
|
243
|
-
|
|
291
|
+
let since = performance.now();
|
|
292
|
+
// A slice of features at a time, a frame let through past `SLICE_MS`; a group shaped is kept even if a newer
|
|
293
|
+
// update began meanwhile (that one reuses it), the rest dropped
|
|
294
|
+
for (const { group, base: b, parts } of todo) {
|
|
295
|
+
const slice = (from) => this.build(group, b, parts, loaded, from, from + SLICE_FEATURES);
|
|
296
|
+
const first = slice(0);
|
|
297
|
+
const rest = [];
|
|
298
|
+
for (let from = SLICE_FEATURES; from < group.length; from += SLICE_FEATURES) {
|
|
299
|
+
if (performance.now() - since > SLICE_MS) {
|
|
300
|
+
await pause();
|
|
301
|
+
since = performance.now();
|
|
302
|
+
}
|
|
303
|
+
rest.push(slice(from));
|
|
304
|
+
}
|
|
305
|
+
const chunk = joined(first, rest);
|
|
244
306
|
built.set(group, chunk);
|
|
245
307
|
if (keep)
|
|
246
308
|
this.chunks.set(group, chunk);
|
|
247
|
-
|
|
309
|
+
if (generation !== this.generation)
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
248
312
|
this.labels = concat(groups.map((g) => built.get(g) ?? this.chunks.get(g)).filter((c) => c !== undefined));
|
|
249
313
|
// The icons packed for them
|
|
250
314
|
this.host.icons.flush();
|
|
251
315
|
this.send(this.map.engine, this.id);
|
|
252
316
|
this.map.requestRender();
|
|
253
317
|
}
|
|
254
|
-
/** The labels of a group
|
|
255
|
-
build(group, base, parts, loaded) {
|
|
318
|
+
/** The labels of a group's features `from` to `to` (excluded), `base` the index of the group's first feature */
|
|
319
|
+
build(group, base, parts, loaded, from, to) {
|
|
256
320
|
const { font, size, anchor, offset, maxWidth, lineHeight, color, haloColor, haloWidth, overlap, placement } = this.style;
|
|
257
321
|
const st = this.style;
|
|
258
322
|
const icons = this.host.icons;
|
|
@@ -261,9 +325,11 @@ export class SymbolLayer extends Layer {
|
|
|
261
325
|
const styles = [];
|
|
262
326
|
const iconQuads = [];
|
|
263
327
|
const textQuads = [];
|
|
328
|
+
const paths = [];
|
|
264
329
|
let count = 0;
|
|
265
330
|
let complete = true;
|
|
266
|
-
group.forEach((f,
|
|
331
|
+
group.slice(from, to).forEach((f, j) => {
|
|
332
|
+
const k = from + j;
|
|
267
333
|
const i = base + k;
|
|
268
334
|
const p = f.properties;
|
|
269
335
|
const text = parts[k];
|
|
@@ -289,7 +355,8 @@ export class SymbolLayer extends Layer {
|
|
|
289
355
|
? shape(text, (name) => loaded.get(name), {
|
|
290
356
|
font: evaluate(font, p, i),
|
|
291
357
|
size: shaped,
|
|
292
|
-
|
|
358
|
+
// Along a line, one line of text (MapLibre does not wrap it)
|
|
359
|
+
maxWidth: evaluate(placement, p, i) === 'line' ? Number.POSITIVE_INFINITY : evaluate(maxWidth, p, i),
|
|
293
360
|
lineHeight: evaluate(lineHeight, p, i),
|
|
294
361
|
anchor: evaluate(anchor, p, i),
|
|
295
362
|
offset: evaluate(offset, p, i),
|
|
@@ -359,7 +426,7 @@ export class SymbolLayer extends Layer {
|
|
|
359
426
|
// The collision box: the ink, with the halo and a little room
|
|
360
427
|
const pad = halo + 1;
|
|
361
428
|
const textBox = s ? [s.box[0] - pad, s.box[1] - pad, s.box[2] + pad, s.box[3] + pad] : [0, 0, 0, 0];
|
|
362
|
-
for (const { at, along: line } of anchors(f.geometry)) {
|
|
429
|
+
for (const { at, along: line, path, pathAnchor = 0 } of anchors(f.geometry)) {
|
|
363
430
|
const label = count++;
|
|
364
431
|
const [x, y] = toMercator(at);
|
|
365
432
|
anchorList.push(x, y);
|
|
@@ -370,8 +437,18 @@ export class SymbolLayer extends Layer {
|
|
|
370
437
|
// The direction of its line in Mercator (y towards the south)
|
|
371
438
|
const end = line && (textAlong || iconAlong) ? toMercator([at[0] + line[0], at[1] + line[1]]) : undefined;
|
|
372
439
|
const direction = end ? [end[0] - x, end[1] - y] : [iconAlong ? 1 : 0, 0];
|
|
373
|
-
|
|
440
|
+
// A text alone along its line follows its bends (with an icon, both stay straight)
|
|
441
|
+
const curved = textAlong && !(flags & FLAG.icon) && path !== undefined && path.length >= 2;
|
|
442
|
+
const alongFlags = (textAlong ? FLAG.textAlong : 0) | (iconAlong ? FLAG.iconAlong : 0) | (curved ? FLAG.textCurved : 0);
|
|
374
443
|
const labelFlags = flags | (direction[0] === 0 && direction[1] === 0 ? 0 : alongFlags);
|
|
444
|
+
if (curved && path) {
|
|
445
|
+
paths.push(path.length, pathAnchor);
|
|
446
|
+
for (const p of path)
|
|
447
|
+
paths.push(...toMercator(p));
|
|
448
|
+
}
|
|
449
|
+
else {
|
|
450
|
+
paths.push(0, 0);
|
|
451
|
+
}
|
|
375
452
|
boxes.push(...textBox);
|
|
376
453
|
styles.push(...fill, ...haloRgba, halo, labelFlags, ...direction, ...stops(scale), ...iconBox, ...iconColor, ...stops(iconScale), Math.max(0, Number(evaluate(st.height, p, i)) || 0));
|
|
377
454
|
for (const q of quads)
|
|
@@ -387,6 +464,7 @@ export class SymbolLayer extends Layer {
|
|
|
387
464
|
styles: Float32Array.from(styles),
|
|
388
465
|
// The icons under the texts
|
|
389
466
|
quads: Float32Array.from([...iconQuads, ...textQuads]),
|
|
467
|
+
paths: Float64Array.from(paths),
|
|
390
468
|
count,
|
|
391
469
|
style: this.styleGeneration,
|
|
392
470
|
base,
|
|
@@ -398,13 +476,13 @@ export class SymbolLayer extends Layer {
|
|
|
398
476
|
send(engine, id) {
|
|
399
477
|
const l = this.labels;
|
|
400
478
|
if (l)
|
|
401
|
-
engine.setSymbols(id, l.anchors, l.boxes, l.styles, l.quads);
|
|
479
|
+
engine.setSymbols(id, l.anchors, l.boxes, l.styles, l.quads, l.paths);
|
|
402
480
|
this.sendLayer(engine, id);
|
|
403
481
|
}
|
|
404
482
|
sendLayer(engine, id) {
|
|
405
|
-
const { opacity, minZoom, maxZoom, visible } = this.style;
|
|
483
|
+
const { opacity, minZoom, maxZoom, visible, occluded } = this.style;
|
|
406
484
|
// The sizes are per label; the layer's own scale stays 1
|
|
407
|
-
engine.setSymbolLayer(id, Float32Array.from(stops(1)), Float32Array.from(stops(opacity)), minZoom, maxZoom, visible);
|
|
485
|
+
engine.setSymbolLayer(id, Float32Array.from(stops(1)), Float32Array.from(stops(opacity)), minZoom, maxZoom, visible, occluded);
|
|
408
486
|
}
|
|
409
487
|
/** @internal */
|
|
410
488
|
create(engine) {
|
|
@@ -428,6 +506,7 @@ export const symbolStyle = (options) => {
|
|
|
428
506
|
visible: true,
|
|
429
507
|
filter: undefined,
|
|
430
508
|
height: 0,
|
|
509
|
+
occluded: false,
|
|
431
510
|
text: '',
|
|
432
511
|
font: DEFAULT_FONT,
|
|
433
512
|
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;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,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACvH,CAAC,CAAC;AAaF,mFAAmF;AACnF,MAAM,MAAM,GAAG,CAAC,QAAyB,EAAc,EAAE;IACvD,IAAI,CAAC,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,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
|
+
{"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;AAsEpC;;aAEa;AACb,MAAM,OAAO,GAAG,CACd,QAAyB,EAC6D,EAAE;IACxF,IAAI,QAAQ,EAAE,IAAI,KAAK,YAAY,IAAI,QAAQ,EAAE,IAAI,KAAK,iBAAiB,EAAE,CAAC;QAC5E,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC;QAC7F,MAAM,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,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IAEjD,OAAO;QACL,OAAO,EAAE,CAAC;QACV,OAAO,EAAE,CAAC;QACV,OAAO,EAAE,EAAE;QACX,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,CAAC;QACT,QAAQ,EAAE,KAAK;QACf,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 labels hidden by what stands before them on a flat map too: the buildings, trees and models (default false:\n * drawn over them; in relief, the hills hide them either way). A label in a building then needs its `height` on\n * its roof */\n occluded: boolean;\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 * and the line with that middle as one of its points, for a text that follows it), the centroid of its largest\n * polygon */\nconst anchors = (\n geometry: Geometry | null,\n): { at: Position; along?: [number, number]; path?: Position[]; pathAnchor?: number }[] => {\n if (geometry?.type === 'LineString' || geometry?.type === 'MultiLineString') {\n const lines = geometry.type === 'LineString' ? [geometry.coordinates] : geometry.coordinates;\n const middle = lineMiddle(lines);\n\n return middle ? [middle] : [];\n }\n\n return points(geometry).map((p) => ({ at: p }));\n};\n\n/** The middle of the longest of lines, measured in Mercator as the map draws them: the point, the direction of its\n * segment (lon, lat), and the line with the point put in it */\nconst lineMiddle = (\n lines: Position[][],\n): { at: Position; along: [number, number]; path: Position[]; pathAnchor: number } | undefined => {\n const lengths = lines.map((l) => {\n const m = l.map((p) => toMercator(p));\n\n return m.slice(1).map((p, i) => Math.hypot(p[0] - (m[i]?.[0] ?? 0), p[1] - (m[i]?.[1] ?? 0)));\n });\n const totals = lengths.map((d) => d.reduce((a, b) => a + b, 0));\n const best = totals.reduce((b, t, i) => (t > (totals[b] ?? 0) ? i : b), 0);\n const line = lines[best] ?? [];\n const segments = lengths[best] ?? [];\n let rest = (totals[best] ?? 0) / 2;\n\n for (let i = 1; i < line.length; i += 1) {\n const [a, b] = [line[i - 1], line[i]];\n const d = segments[i - 1] ?? 0;\n\n if (!a || !b) continue;\n if (d >= rest && d > 0) {\n const t = rest / d;\n const at: Position = [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t];\n\n return {\n at,\n along: [b[0] - a[0], b[1] - a[1]],\n path: [...line.slice(0, i), at, ...line.slice(i)],\n pathAnchor: i,\n };\n }\n rest -= d;\n }\n\n const first = line[0];\n\n return first ? { at: first, along: [0, 0], path: [], pathAnchor: 0 } : undefined;\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/** The anchors of points, polygons and the lines of a collection (a line's own: `lineMiddle`) */\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 // In a collection: the middle alone\n const at = lineMiddle(geometry.type === 'LineString' ? [geometry.coordinates] : geometry.coordinates)?.at;\n\n return at ? [at] : [];\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 textCurved: 2048,\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 /** For each label: its line's number of points, its anchor's index among them, then the points (Mercator); 0, 0\n * for a label whose text does not follow its line */\n paths: Float64Array;\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 main thread's time a shaping takes before it lets a frame be drawn (ms): the labels of new tiles, thousands of\n * features at the deeper zooms, are shaped over several frames instead of holding one */\nconst SLICE_MS = 6;\n/** Features shaped between two looks at the time */\nconst SLICE_FEATURES = 128;\n\n/** Lets the browser draw a frame and handle the events waiting */\nconst pause = (): Promise<void> => new Promise((resolve) => setTimeout(resolve, 0));\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 paths: new Float64Array(length('paths')),\n };\n const at = { anchors: 0, boxes: 0, styles: 0, quads: 0, paths: 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 out.paths.set(c.paths, at.paths);\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 at.paths += c.paths.length;\n labels += c.count;\n }\n\n return out;\n};\n\n/** The pieces of a group's labels as one chunk, valid as long as its first piece (the glyphs and icons it saw) */\nconst joined = (first: Chunk, rest: readonly Chunk[]): Chunk => {\n if (rest.length === 0) return first;\n\n const pieces = [first, ...rest];\n\n return {\n ...first,\n ...concat(pieces),\n count: pieces.reduce((n, c) => n + c.count, 0),\n complete: pieces.every((c) => c.complete),\n };\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 let since = performance.now();\n\n // A slice of features at a time, a frame let through past `SLICE_MS`; a group shaped is kept even if a newer\n // update began meanwhile (that one reuses it), the rest dropped\n for (const { group, base: b, parts } of todo) {\n const slice = (from: number) => this.build(group, b, parts, loaded, from, from + SLICE_FEATURES);\n const first = slice(0);\n const rest: Chunk[] = [];\n\n for (let from = SLICE_FEATURES; from < group.length; from += SLICE_FEATURES) {\n if (performance.now() - since > SLICE_MS) {\n await pause();\n since = performance.now();\n }\n rest.push(slice(from));\n }\n\n const chunk = joined(first, rest);\n\n built.set(group, chunk);\n if (keep) this.chunks.set(group, chunk);\n if (generation !== this.generation) return;\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's features `from` to `to` (excluded), `base` the index of the group's first feature */\n private build(\n group: readonly Feature<P>[],\n base: number,\n parts: TextPart[][],\n loaded: Map<string, Map<number, Glyph>>,\n from: number,\n to: number,\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 const paths: number[] = [];\n let count = 0;\n let complete = true;\n\n group.slice(from, to).forEach((f, j) => {\n const k = from + j;\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 // Along a line, one line of text (MapLibre does not wrap it)\n maxWidth: evaluate(placement, p, i) === 'line' ? Number.POSITIVE_INFINITY : 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, path, pathAnchor = 0 } 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 // A text alone along its line follows its bends (with an icon, both stay straight)\n const curved = textAlong && !(flags & FLAG.icon) && path !== undefined && path.length >= 2;\n const alongFlags =\n (textAlong ? FLAG.textAlong : 0) | (iconAlong ? FLAG.iconAlong : 0) | (curved ? FLAG.textCurved : 0);\n const labelFlags = flags | (direction[0] === 0 && direction[1] === 0 ? 0 : alongFlags);\n\n if (curved && path) {\n paths.push(path.length, pathAnchor);\n for (const p of path) paths.push(...toMercator(p));\n } else {\n paths.push(0, 0);\n }\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 paths: Float64Array.from(paths),\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, l.paths);\n this.sendLayer(engine, id);\n }\n\n private sendLayer(engine: Engine, id: number): void {\n const { opacity, minZoom, maxZoom, visible, occluded } = 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 occluded,\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 occluded: false,\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"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trees at the points of a source that has them (a city's open data of its street trees, OpenStreetMap's
|
|
3
|
+
* `natural=tree`), as the basemap's trees are drawn: a broadleaved model and a conifer, each on a layer in one instanced
|
|
4
|
+
* draw, scaled to the tree's height when the data gives it.
|
|
5
|
+
*/
|
|
6
|
+
import { type TreeColors } from '../basemap/trees.ts';
|
|
7
|
+
import { type FeatureData, type Properties } from './features.ts';
|
|
8
|
+
import type { Layer, ModelLayer, ModelOptions } from './layers.ts';
|
|
9
|
+
/** The kind of a tree */
|
|
10
|
+
export type TreeKind = 'broadleaved' | 'conifer';
|
|
11
|
+
/** The options of `GeoMap.addTrees` */
|
|
12
|
+
export interface TreeOptions<P = Properties> {
|
|
13
|
+
/** Points (and multipoints): a tree at each */
|
|
14
|
+
data: FeatureData<P>;
|
|
15
|
+
/** A tree's kind (default: its `leaf_type`, else a conifer if its genus is one: `genre`, `genus` or `species`
|
|
16
|
+
* starting with Pinus, Abies, Picea, Cedrus…) */
|
|
17
|
+
kind?: (properties: P) => TreeKind;
|
|
18
|
+
/** A tree's height, metres (default: its `height`, `hauteur` or `hauteurenm`, else 10) */
|
|
19
|
+
height?: (properties: P) => number;
|
|
20
|
+
colors?: Partial<TreeColors>;
|
|
21
|
+
before?: Layer;
|
|
22
|
+
}
|
|
23
|
+
/** A tree's kind from its data: OpenStreetMap's `leaf_type`, else its genus */
|
|
24
|
+
export declare const treeKind: (properties: Properties) => TreeKind;
|
|
25
|
+
/** The broadleaved trees' layer (`addModels`: the map's), the conifers' with it (`Layer.companions`) */
|
|
26
|
+
export declare const addTrees: <P = Properties>(addModels: (options: ModelOptions & {
|
|
27
|
+
before?: Layer;
|
|
28
|
+
}) => ModelLayer, options: TreeOptions<P>) => ModelLayer;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trees at the points of a source that has them (a city's open data of its street trees, OpenStreetMap's
|
|
3
|
+
* `natural=tree`), as the basemap's trees are drawn: a broadleaved model and a conifer, each on a layer in one instanced
|
|
4
|
+
* draw, scaled to the tree's height when the data gives it.
|
|
5
|
+
*/
|
|
6
|
+
import { coniferModel, treeModel } from "../basemap/trees.js";
|
|
7
|
+
import { featuresOf } from "./features.js";
|
|
8
|
+
/** The genera of conifers among street and park trees */
|
|
9
|
+
const CONIFERS = /^(pinus|abies|picea|cedrus|larix|taxus|pseudotsuga|cupressus|sequoia|sequoiadendron|metasequoia|thuja|juniperus|chamaecyparis|cryptomeria|tsuga|araucaria|taxodium|ginkgo)\b/i;
|
|
10
|
+
/** The heights of the models: what a tree's height scales them by */
|
|
11
|
+
const MODEL_METRES = { broadleaved: 10.2, conifer: 11 };
|
|
12
|
+
/** A tree's kind from its data: OpenStreetMap's `leaf_type`, else its genus */
|
|
13
|
+
export const treeKind = (properties) => {
|
|
14
|
+
if (properties.leaf_type === 'needleleaved')
|
|
15
|
+
return 'conifer';
|
|
16
|
+
if (properties.leaf_type === 'broadleaved')
|
|
17
|
+
return 'broadleaved';
|
|
18
|
+
const genus = [properties.genre, properties.genus, properties.species].find((v) => typeof v === 'string');
|
|
19
|
+
return typeof genus === 'string' && CONIFERS.test(genus.trim()) ? 'conifer' : 'broadleaved';
|
|
20
|
+
};
|
|
21
|
+
/** A tree's height from its data (metres), 10 without */
|
|
22
|
+
const treeHeight = (properties) => {
|
|
23
|
+
const height = Number(properties.height ?? properties.hauteur ?? properties.hauteurenm ?? Number.NaN);
|
|
24
|
+
return height > 0 ? height : 10;
|
|
25
|
+
};
|
|
26
|
+
/** The points of a geometry: a point's, a multipoint's, none of another */
|
|
27
|
+
const pointsOf = (geometry) => {
|
|
28
|
+
if (geometry?.type === 'Point')
|
|
29
|
+
return [geometry.coordinates];
|
|
30
|
+
return geometry?.type === 'MultiPoint' ? geometry.coordinates : [];
|
|
31
|
+
};
|
|
32
|
+
/** The broadleaved trees' layer (`addModels`: the map's), the conifers' with it (`Layer.companions`) */
|
|
33
|
+
export const addTrees = (addModels, options) => {
|
|
34
|
+
const kindOf = options.kind ?? ((p) => treeKind(p));
|
|
35
|
+
const heightOf = options.height ?? ((p) => treeHeight(p));
|
|
36
|
+
const instances = { broadleaved: [], conifer: [] };
|
|
37
|
+
featuresOf(options.data).forEach((f, i) => {
|
|
38
|
+
const points = pointsOf(f.geometry);
|
|
39
|
+
const kind = kindOf(f.properties);
|
|
40
|
+
const scale = heightOf(f.properties) / MODEL_METRES[kind];
|
|
41
|
+
points.forEach(([lon = 0, lat = 0]) => {
|
|
42
|
+
// Each turned its own way, the same each time
|
|
43
|
+
instances[kind].push({ lonLat: [lon, lat], heading: (i * 7919) % 360, scale });
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
const before = options.before ? { before: options.before } : {};
|
|
47
|
+
const layer = addModels({ data: treeModel(options.colors), instances: instances.broadleaved, ...before });
|
|
48
|
+
layer.companions.push(addModels({ data: coniferModel(options.colors), instances: instances.conifer, ...before }));
|
|
49
|
+
return layer;
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=trees.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trees.js","sourceRoot":"","sources":["../../src/layers/trees.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAmB,SAAS,EAAE,MAAM,qB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C;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAChE,MAAM,KAAK,GAAG,SAAS,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,WAAW,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;IAE1G,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,OAAO,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC;IAElH,OAAO,KAAK,CAAC;AACf,CAAC,CAAC","sourcesContent":["/**\n * Trees at the points of a source that has them (a city's open data of its street trees, OpenStreetMap's\n * `natural=tree`), as the basemap's trees are drawn: a broadleaved model and a conifer, each on a layer in one instanced\n * draw, scaled to the tree's height when the data gives it.\n */\n\nimport { coniferModel, type TreeColors, treeModel } from '../basemap/trees.ts';\nimport { type FeatureData, featuresOf, type Geometry, type Position, type Properties } from './features.ts';\nimport type { Layer, ModelInstance, ModelLayer, ModelOptions } from './layers.ts';\n\n/** The kind of a tree */\nexport type TreeKind = 'broadleaved' | 'conifer';\n\n/** The options of `GeoMap.addTrees` */\nexport interface TreeOptions<P = Properties> {\n /** Points (and multipoints): a tree at each */\n data: FeatureData<P>;\n /** A tree's kind (default: its `leaf_type`, else a conifer if its genus is one: `genre`, `genus` or `species`\n * starting with Pinus, Abies, Picea, Cedrus…) */\n kind?: (properties: P) => TreeKind;\n /** A tree's height, metres (default: its `height`, `hauteur` or `hauteurenm`, else 10) */\n height?: (properties: P) => number;\n colors?: Partial<TreeColors>;\n before?: Layer;\n}\n\n/** The genera of conifers among street and park trees */\nconst CONIFERS =\n /^(pinus|abies|picea|cedrus|larix|taxus|pseudotsuga|cupressus|sequoia|sequoiadendron|metasequoia|thuja|juniperus|chamaecyparis|cryptomeria|tsuga|araucaria|taxodium|ginkgo)\\b/i;\n\n/** The heights of the models: what a tree's height scales them by */\nconst MODEL_METRES: Record<TreeKind, number> = { broadleaved: 10.2, conifer: 11 };\n\n/** A tree's kind from its data: OpenStreetMap's `leaf_type`, else its genus */\nexport const treeKind = (properties: Properties): TreeKind => {\n if (properties.leaf_type === 'needleleaved') return 'conifer';\n if (properties.leaf_type === 'broadleaved') return 'broadleaved';\n\n const genus = [properties.genre, properties.genus, properties.species].find((v) => typeof v === 'string');\n\n return typeof genus === 'string' && CONIFERS.test(genus.trim()) ? 'conifer' : 'broadleaved';\n};\n\n/** A tree's height from its data (metres), 10 without */\nconst treeHeight = (properties: Properties): number => {\n const height = Number(properties.height ?? properties.hauteur ?? properties.hauteurenm ?? Number.NaN);\n\n return height > 0 ? height : 10;\n};\n\n/** The points of a geometry: a point's, a multipoint's, none of another */\nconst pointsOf = (geometry: Geometry | null): Position[] => {\n if (geometry?.type === 'Point') return [geometry.coordinates];\n\n return geometry?.type === 'MultiPoint' ? geometry.coordinates : [];\n};\n\n/** The broadleaved trees' layer (`addModels`: the map's), the conifers' with it (`Layer.companions`) */\nexport const addTrees = <P = Properties>(\n addModels: (options: ModelOptions & { before?: Layer }) => ModelLayer,\n options: TreeOptions<P>,\n): ModelLayer => {\n const kindOf = options.kind ?? ((p: P) => treeKind(p as Properties));\n const heightOf = options.height ?? ((p: P) => treeHeight(p as Properties));\n const instances: Record<TreeKind, ModelInstance[]> = { broadleaved: [], conifer: [] };\n\n featuresOf(options.data).forEach((f, i) => {\n const points = pointsOf(f.geometry);\n const kind = kindOf(f.properties);\n const scale = heightOf(f.properties) / MODEL_METRES[kind];\n\n points.forEach(([lon = 0, lat = 0]) => {\n // Each turned its own way, the same each time\n instances[kind].push({ lonLat: [lon, lat], heading: (i * 7919) % 360, scale });\n });\n });\n\n const before = options.before ? { before: options.before } : {};\n const layer = addModels({ data: treeModel(options.colors), instances: instances.broadleaved, ...before });\n\n layer.companions.push(addModels({ data: coniferModel(options.colors), instances: instances.conifer, ...before }));\n\n return layer;\n};\n"]}
|