@tangram.gl/basemap-layers 0.0.0-stage → 0.0.1

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 (105) hide show
  1. package/README.md +34 -2
  2. package/THIRD-PARTY-NOTICES.md +205 -0
  3. package/dist/geojson-worker.js +2160 -0
  4. package/dist/geojson-worker.js.map +6 -0
  5. package/dist/index.cjs +11388 -0
  6. package/dist/index.cjs.map +6 -0
  7. package/dist/index.js +11369 -0
  8. package/dist/index.js.map +6 -0
  9. package/dist/map-style.cjs +445 -0
  10. package/dist/map-style.cjs.map +6 -0
  11. package/dist/map-style.js +431 -0
  12. package/dist/map-style.js.map +6 -0
  13. package/dist/types/arabic-shaping.d.ts +7 -0
  14. package/dist/types/atmosphere-layer.d.ts +10 -0
  15. package/dist/types/basemap-layer.d.ts +150 -0
  16. package/dist/types/bidi.d.ts +8 -0
  17. package/dist/types/circle-layer.d.ts +49 -0
  18. package/dist/types/fill-extrusion-lighting-extension.d.ts +49 -0
  19. package/dist/types/fill-outline-extension.d.ts +22 -0
  20. package/dist/types/fill-pattern.d.ts +99 -0
  21. package/dist/types/fill-style-extensions.d.ts +100 -0
  22. package/dist/types/geojson-source.d.ts +29 -0
  23. package/dist/types/geojson-tiler.d.ts +48 -0
  24. package/dist/types/geojson-worker.d.ts +40 -0
  25. package/dist/types/globe-horizon-extension.d.ts +61 -0
  26. package/dist/types/globe-layers.d.ts +239 -0
  27. package/dist/types/globe-line-angle-extension.d.ts +37 -0
  28. package/dist/types/glyph-font-renderer.d.ts +37 -0
  29. package/dist/types/glyph-pbf.d.ts +37 -0
  30. package/dist/types/glyph-store.d.ts +103 -0
  31. package/dist/types/grid-index.d.ts +47 -0
  32. package/dist/types/hillshade-layer.d.ts +154 -0
  33. package/dist/types/index.d.ts +9 -0
  34. package/dist/types/is-globe-viewport.d.ts +2 -0
  35. package/dist/types/label-font-renderer.d.ts +18 -0
  36. package/dist/types/label-placement.d.ts +247 -0
  37. package/dist/types/label-text-layer.d.ts +231 -0
  38. package/dist/types/line-blur-extension.d.ts +73 -0
  39. package/dist/types/line-glyphs.d.ts +60 -0
  40. package/dist/types/line-placement.d.ts +93 -0
  41. package/dist/types/map-style-loader.d.ts +48 -0
  42. package/dist/types/map-style-schema.d.ts +72 -0
  43. package/dist/types/map-style.d.ts +6 -0
  44. package/dist/types/mapbox-style.d.ts +40 -0
  45. package/dist/types/mvt-label-layer.d.ts +923 -0
  46. package/dist/types/polylabel.d.ts +17 -0
  47. package/dist/types/raster-color-extension.d.ts +146 -0
  48. package/dist/types/shared-texture.d.ts +34 -0
  49. package/dist/types/sort-key.d.ts +10 -0
  50. package/dist/types/sprite.d.ts +82 -0
  51. package/dist/types/style-accessor.d.ts +45 -0
  52. package/dist/types/style-expression.d.ts +83 -0
  53. package/dist/types/style-resolver.d.ts +94 -0
  54. package/dist/types/text-font.d.ts +36 -0
  55. package/dist/types/text-halo-blur-extension.d.ts +55 -0
  56. package/dist/types/text-layout.d.ts +71 -0
  57. package/dist/types/util.d.ts +22 -0
  58. package/dist/types/zoom-paint-extension.d.ts +72 -0
  59. package/package.json +80 -3
  60. package/src/arabic-shaping.ts +366 -0
  61. package/src/atmosphere-layer.ts +19 -0
  62. package/src/basemap-layer.ts +533 -0
  63. package/src/bidi.ts +199 -0
  64. package/src/circle-layer.ts +191 -0
  65. package/src/fill-extrusion-lighting-extension.ts +206 -0
  66. package/src/fill-outline-extension.ts +70 -0
  67. package/src/fill-pattern.ts +400 -0
  68. package/src/fill-style-extensions.ts +177 -0
  69. package/src/geojson-source.ts +318 -0
  70. package/src/geojson-tiler.ts +185 -0
  71. package/src/geojson-worker.ts +98 -0
  72. package/src/globe-horizon-extension.ts +64 -0
  73. package/src/globe-layers.ts +3487 -0
  74. package/src/globe-line-angle-extension.ts +131 -0
  75. package/src/glyph-font-renderer.ts +173 -0
  76. package/src/glyph-pbf.ts +164 -0
  77. package/src/glyph-store.ts +326 -0
  78. package/src/grid-index.ts +177 -0
  79. package/src/hillshade-layer.ts +775 -0
  80. package/src/index.ts +18 -0
  81. package/src/is-globe-viewport.ts +24 -0
  82. package/src/label-font-renderer.ts +159 -0
  83. package/src/label-placement.ts +727 -0
  84. package/src/label-text-layer.ts +913 -0
  85. package/src/line-blur-extension.ts +237 -0
  86. package/src/line-glyphs.ts +364 -0
  87. package/src/line-placement.ts +446 -0
  88. package/src/map-style-loader.ts +56 -0
  89. package/src/map-style-schema.ts +83 -0
  90. package/src/map-style.ts +23 -0
  91. package/src/mapbox-style.ts +168 -0
  92. package/src/mvt-label-layer.ts +3744 -0
  93. package/src/polylabel.ts +312 -0
  94. package/src/raster-color-extension.ts +245 -0
  95. package/src/shared-texture.ts +153 -0
  96. package/src/sort-key.ts +63 -0
  97. package/src/sprite.ts +244 -0
  98. package/src/style-accessor.ts +95 -0
  99. package/src/style-expression.ts +327 -0
  100. package/src/style-resolver.ts +301 -0
  101. package/src/text-font.ts +150 -0
  102. package/src/text-halo-blur-extension.ts +115 -0
  103. package/src/text-layout.ts +441 -0
  104. package/src/util.ts +47 -0
  105. package/src/zoom-paint-extension.ts +207 -0
@@ -0,0 +1,923 @@
1
+ import { CompositeLayer } from '@deck.gl/core';
2
+ import type { DefaultProps, Layer, LayerContext, UpdateParameters, Viewport } from '@deck.gl/core';
3
+ import { LabelPlacement, type PlacementLayer, type PlacementSymbol, type SymbolPlacementRules } from "./label-placement.js";
4
+ import type { LabelTextJustify } from "./label-text-layer.js";
5
+ import { SharedTextureSet } from "./shared-texture.js";
6
+ import { type CompiledStyleProperty } from "./style-expression.js";
7
+ import type { ResolvedSpriteIcon, SpriteAtlas } from "./sprite.js";
8
+ import { GlobeLineAngleExtension } from "./globe-line-angle-extension.js";
9
+ import type { GlyphStore } from "./glyph-store.js";
10
+ import { type LabelLine, type LineGlyphs } from "./line-glyphs.js";
11
+ import type { WrapBudget } from "./text-layout.js";
12
+ import { type PoleSearchBudget } from "./polylabel.js";
13
+ import type { LabelFont, LabelFontFamily } from "./text-font.js";
14
+ import { type LineAnchorBudget } from "./line-placement.js";
15
+ type GeometryType = 'Point' | 'MultiPoint' | 'LineString' | 'MultiLineString' | 'Polygon' | 'MultiPolygon' | string;
16
+ type FeatureGeometry = {
17
+ type: GeometryType;
18
+ coordinates: any;
19
+ };
20
+ type FeatureLike = {
21
+ geometry: FeatureGeometry;
22
+ properties?: Record<string, any>;
23
+ };
24
+ type LabelRow = {
25
+ position: number[];
26
+ /** For labels along a line: the line's direction, in degrees counter-clockwise from east. */
27
+ angle?: number;
28
+ /** For labels along a line: the line, along which their glyphs are placed (see `getLineGlyphs`). */
29
+ line?: RowLine;
30
+ /**
31
+ * With `text-variable-anchor`, a point label has a row per anchor, in order, one after the other
32
+ * in `labelData`: the index of this row's anchor (0, the default, for the first row, which also
33
+ * draws the icon) and the number of anchors.
34
+ */
35
+ textAnchorIndex?: number;
36
+ textAnchorCount?: number;
37
+ };
38
+ /**
39
+ * The line a row's label is placed along: its vertices in pixels at the placement zoom (shared by
40
+ * every row on the line), where the anchor lies on it, and that zoom.
41
+ */
42
+ type RowLine = LabelLine & {
43
+ zoom: number;
44
+ };
45
+ type StyleLayerLike = {
46
+ layout?: Record<string, any>;
47
+ paint?: Record<string, any>;
48
+ };
49
+ type LabelConfig = {
50
+ labels?: boolean;
51
+ };
52
+ /**
53
+ * Props accepted by {@link MVTLabelLayer}.
54
+ */
55
+ export type MVTLabelLayerProps = {
56
+ /** Decoded vector-tile features or a feature-collection-like object. */
57
+ data?: {
58
+ features?: FeatureLike[];
59
+ } | FeatureLike[];
60
+ /** Label rendering enablement for the current basemap mode. */
61
+ config: LabelConfig;
62
+ /** Style layer that contributes label rules. */
63
+ styleLayer?: StyleLayerLike;
64
+ /** Zoom level used to evaluate style expressions. */
65
+ zoom?: number;
66
+ /** Text fill color. */
67
+ textColor?: number[];
68
+ /**
69
+ * `[min, max)`: this layer's band in its style. `BasemapLayer` gives each symbol style layer its
70
+ * own band, rising with style order; labels are placed from the highest band down (see
71
+ * `LabelPlacement`).
72
+ */
73
+ collisionPriorityRange?: [number, number];
74
+ /** Text size units forwarded to `TextLayer`. */
75
+ labelSizeUnits?: 'pixels' | 'meters' | 'common';
76
+ /**
77
+ * Overrides the font derived from the style layer's `text-font`: a CSS family list, or a
78
+ * function from the `text-font` names to a family list or {@link LabelFont} fields.
79
+ */
80
+ fontFamily?: LabelFontFamily | null;
81
+ /**
82
+ * The glyphs of the style's `glyphs` URL, which labels are drawn with, as in MapLibre GL JS. A
83
+ * tile's labels are placed once the glyphs of their text have loaded. Without it, labels are
84
+ * drawn with the browser's fonts that `text-font` maps to.
85
+ */
86
+ glyphs?: GlyphStore | null;
87
+ /** Enables billboard rendering in the text sublayer. */
88
+ billboard?: boolean;
89
+ /** When `true`, renders the source geometries for debugging. */
90
+ renderGeometry?: boolean;
91
+ /** Additional extension instances passed through to the text sublayer. */
92
+ extensions?: any[];
93
+ /** Active basemap mode. */
94
+ mode?: 'map' | 'globe';
95
+ /**
96
+ * The placement shared with the other label layers of the map, which decides which labels and
97
+ * icons are drawn (see {@link LabelPlacement}). Label layers without one share one per deck.
98
+ */
99
+ labelPlacement?: LabelPlacement | null;
100
+ /**
101
+ * Sprites loaded for the style; `icon-image` names resolve against them. `null` while they are
102
+ * loading: no icons are drawn, and text is placed as if each symbol had its icon, so labels do
103
+ * not change placement rules when the sprites arrive.
104
+ */
105
+ spriteAtlases?: SpriteAtlas[] | null;
106
+ /** Load options for the sprite atlas images, so they use the same fetch as the style. */
107
+ iconLoadOptions?: Record<string, unknown> | null;
108
+ /**
109
+ * The tile's own bounding box, as deck.gl's `TileLayer` reports it. In longitude/latitude (globe
110
+ * tiles), polygon labels outside it are dropped, so a polygon in two tiles' buffers is labelled
111
+ * by one tile. Tile-local coordinates always use the tile's `[0, 1)` square.
112
+ */
113
+ tileBoundingBox?: {
114
+ west: number;
115
+ south: number;
116
+ east: number;
117
+ north: number;
118
+ } | null;
119
+ /** The tile's zoom level, at which labels along lines are spaced. Default: the integer `zoom`. */
120
+ tileZoom?: number | null;
121
+ /** The tile's size in pixels at its own zoom. Default: 512. */
122
+ tileSize?: number | null;
123
+ /**
124
+ * The label features of several tiles, labelled together in one layer instead of `data`: each
125
+ * tile's anchors are placed as for a layer of its own (`tileBoundingBox`, `tileZoom` and
126
+ * `tileSize` per tile), then drawn in longitude/latitude. Pass the same array while the tiles do
127
+ * not change; a tile keeps its anchors while its features, and the inputs they depend on, do not
128
+ * change. See {@link LabelTile}.
129
+ */
130
+ tiles?: LabelTile[] | null;
131
+ };
132
+ /** The label features of one tile, for {@link MVTLabelLayerProps.tiles}. */
133
+ export type LabelTile = {
134
+ /** The tile's index, which places tile-local coordinates in the world. */
135
+ index: {
136
+ x: number;
137
+ y: number;
138
+ z: number;
139
+ };
140
+ /** The tile's features of the style layer. */
141
+ features: FeatureLike[];
142
+ tileBoundingBox?: {
143
+ west: number;
144
+ south: number;
145
+ east: number;
146
+ north: number;
147
+ } | null;
148
+ tileZoom?: number | null;
149
+ tileSize?: number | null;
150
+ /** Returned as `info.tile` when a label of the tile is picked. */
151
+ tile?: unknown;
152
+ };
153
+ /** The anchors of one tile of a {@link MVTLabelLayerProps.tiles} layer. */
154
+ type TileRows = {
155
+ features: FeatureLike[];
156
+ anchorKey: string;
157
+ /** The text and font the glyphs were loaded for (see `getGlyphKey`). */
158
+ glyphKey: string;
159
+ /** The tile the rows report when picked (see `LabelTile.tile`). */
160
+ tile: unknown;
161
+ rows: LabelRow[];
162
+ /** The font stacks of the rows' text, which the layer retains in its glyph store. */
163
+ fontStacks: ReadonlySet<string>;
164
+ /**
165
+ * The glyph store's `generation` when it refused to retain a font stack of the tile's text, whose
166
+ * labels are then left out of the rows; the rows are placed again once it has changed.
167
+ */
168
+ refusedGeneration?: number;
169
+ };
170
+ /**
171
+ * The rows of every tile of `tiles`, from `tileRows`, without those of a tile whose anchor lies in
172
+ * a deeper tile of the set: while a tile's children load, the tile is drawn in their place, and
173
+ * where a child has loaded, the child's labels replace the parent's. `geographic` says whether the
174
+ * rows are in longitude/latitude; otherwise they are already converted, see `getTileRowsInWorld`.
175
+ */
176
+ export declare function combineTileRows(tiles: LabelTile[], tileRows: LabelRow[][]): LabelRow[];
177
+ /** What placement needs of a label layer's rows that does not change with the view. */
178
+ type PlacementGeometry = {
179
+ key: unknown[];
180
+ rules: SymbolPlacementRules;
181
+ /**
182
+ * Indices into `labelData`, in placement order. A label with variable anchors is placed from its
183
+ * first row, and its other rows follow it (see `LabelRow.textAnchorIndex`).
184
+ */
185
+ order: number[];
186
+ textBoxes: Float64Array;
187
+ /** Each row's `text-offset` in pixels, `x, y`, which its text box includes. */
188
+ textOffsets: Float64Array;
189
+ iconBoxes: Float64Array;
190
+ textPadding: number;
191
+ /** See `getPlacementCommons`. */
192
+ commons?: {
193
+ kind: string;
194
+ positions: Float64Array;
195
+ };
196
+ };
197
+ /** A label anchor with variable anchors: the anchor, and its offset in ems of `text-size`. */
198
+ export type TextAnchorOffset = {
199
+ anchor: string;
200
+ offset: [number, number];
201
+ };
202
+ /**
203
+ * The offset of text at `anchor`, in ems, from `text-radial-offset` (`radial`) or from the size of
204
+ * `text-offset`, as MapLibre GL JS's `evaluateVariableOffset`: away from the anchor point, in the
205
+ * anchor's direction, with the vertical baseline shift.
206
+ */
207
+ export declare function getVariableAnchorOffset(anchor: string, offset: number[], radial: boolean): [number, number];
208
+ type MVTLabelLayerState = {
209
+ /** The placement this layer registered with, and its own when it has none from its props. */
210
+ placement?: LabelPlacement | null;
211
+ /**
212
+ * What the placement holds for this layer. deck.gl makes a new layer instance at each render
213
+ * and hands it the same state, so the placement holds this object, which points at the
214
+ * current instance.
215
+ */
216
+ placementHandle?: PlacementLayer & {
217
+ layer: MVTLabelLayer;
218
+ };
219
+ /** The deck whose shared placement this layer uses, without a `labelPlacement` prop. */
220
+ sharedPlacementKey?: object | null;
221
+ /** The shared placement of `sharedPlacementKey`. */
222
+ sharedPlacement?: LabelPlacement | null;
223
+ /** The first of this layer's placement slots, one per row in `getRows` order. */
224
+ placementSlotBase?: number;
225
+ /** Changes with every update, so a placement made before it is made again. */
226
+ placementRevision?: number;
227
+ /**
228
+ * Changes whenever the rows change, and with them the slot of each symbol, so that the placement
229
+ * places them at once (see `PlacementLayer.getPlacementSlotRevision`).
230
+ */
231
+ placementSlotRevision?: number;
232
+ /** The rows `placementSlotRevision` was counted for. */
233
+ placementSlotRows?: LabelRow[];
234
+ /** See `getPlacementGeometry`. */
235
+ placementGeometry?: PlacementGeometry;
236
+ placementRowBoxes?: {
237
+ key: unknown[];
238
+ boxes: WeakMap<LabelRow, Float64Array>;
239
+ };
240
+ placementCommons?: {
241
+ kind: string;
242
+ positions: WeakMap<LabelRow, number[]>;
243
+ };
244
+ /** The slot accessor of `getRows` from `placementSlotBase` (see `getPlacementSlotAccessor`). */
245
+ placementSlots?: {
246
+ rows: LabelRow[];
247
+ base: number;
248
+ accessor: (row: LabelRow) => number;
249
+ };
250
+ /** Flattened label rows generated from the current tile data. */
251
+ labelData?: LabelRow[];
252
+ /** `labelData` in reverse, the order every text and icon sublayer holds it in (see `getRows`). */
253
+ textRows?: {
254
+ source: LabelRow[];
255
+ rows: LabelRow[];
256
+ };
257
+ /** The non-data inputs `labelData` was computed with; a change recomputes it. */
258
+ anchorKey?: string;
259
+ /** The text and font `labelData`'s glyphs were loaded for (see `getGlyphKey`). */
260
+ glyphKey?: string;
261
+ /** The map bearing, in `BEARING_STEP` steps, that upright line labels were turned for. */
262
+ bearingStep?: number;
263
+ /** 1 while the layer waits for glyphs of the labels' text to load (see `hasLabelGlyphs`). */
264
+ glyphLoads?: number;
265
+ /** The glyph store the layer waits on while `glyphLoads` is 1. */
266
+ glyphLoadStore?: unknown;
267
+ /**
268
+ * The glyph store's `generation` when it refused a font stack of `labelData`'s text, for a
269
+ * layer of one tile's `data` (see `TileRows.refusedGeneration`).
270
+ */
271
+ refusedGeneration?: number;
272
+ /** The CSS font of labels along lines last seen loading; see `isLineTextFontLoading`. */
273
+ loadingFont?: string;
274
+ /**
275
+ * Each row's glyphs along its line, with what they were placed for, by the id of the view they
276
+ * were placed in, the first view placed in first (see `getLineGlyphs`).
277
+ */
278
+ lineGlyphs?: Map<string, WeakMap<LabelRow, {
279
+ key: string;
280
+ placements: RowGlyphPlacements | null;
281
+ }>>;
282
+ /** The halos of the label rows: one entry per distinct halo, and each row's entry index. */
283
+ halos?: LabelHalos;
284
+ /** The `labelData` and style inputs `halos` was computed with; a change recomputes it. */
285
+ haloKey?: [LabelRow[] | undefined, string];
286
+ /**
287
+ * Label text for the current text update trigger and label rows, per feature, and the wrap
288
+ * budget left for them. deck.gl reads each label's text several times per update; the cache
289
+ * keeps every read the same once the budget runs out, and wraps each label once.
290
+ */
291
+ labelText?: {
292
+ /** The text trigger, the rows and the font the text was wrapped for. */
293
+ key: [string, LabelRow[] | undefined, string];
294
+ budget: WrapBudget;
295
+ labels: WeakMap<FeatureLike, string | undefined>;
296
+ /** Per label row, whether it has text (see `getRowsWithText`). */
297
+ rowsWithText?: boolean[];
298
+ };
299
+ /** The sprite textures of the icon layers, shared with other label layers. */
300
+ iconTextures?: SharedTextureSet;
301
+ /**
302
+ * Style property values by compiled property, for the zoom step they were evaluated at, by
303
+ * feature (see `evaluateStyleProperty`).
304
+ */
305
+ styleValues?: WeakMap<CompiledStyleProperty, {
306
+ zoom: number;
307
+ values: WeakMap<FeatureLike, unknown>;
308
+ }>;
309
+ /** In a `tiles` layer: each tile's anchors, by tile index, and the tiles they were combined for. */
310
+ tileRows?: Map<string, TileRows>;
311
+ rowTiles?: LabelTile[];
312
+ };
313
+ /** A label halo as deck.gl `TextLayer` draws it: an SDF outline color, width and blur. */
314
+ export type LabelHalo = {
315
+ /** Halo color, RGBA with alpha in 0-255. */
316
+ outlineColor: number[];
317
+ /** `TextLayer` `outlineWidth` (see {@link getOutlineWidth}). */
318
+ outlineWidth: number;
319
+ /** `TextHaloBlurExtension` `textHaloBlurGamma` (see {@link getHaloBlurGamma}). */
320
+ outlineBlur: number;
321
+ };
322
+ type LabelHalos = {
323
+ /** Distinct halos, `null` for labels without one. */
324
+ halos: (LabelHalo | null)[];
325
+ /** For each label row, its index in `halos`. */
326
+ rowHalos: number[];
327
+ };
328
+ /**
329
+ * Font atlas settings for label text. Glyphs are drawn as signed distance fields, so `TextLayer`
330
+ * can outline them for `text-halo-*`. The distance field reaches as far as the widest halo:
331
+ * MapLibre caps `text-halo-width` at a quarter of the text size, 16 pixels of a 64-pixel glyph.
332
+ * `TextLayer` outlines no further out than `(0.75 - smoothing) * radius` pixels, 15.6 here, and
333
+ * its halo edge fades over another `smoothing * radius` pixels, which the `buffer` keeps.
334
+ * `TextLayer` draws the glyph edge at a fixed distance value, so a `cutoff` below the default 0.25
335
+ * moves the drawn edge `(0.25 - cutoff) * radius` pixels outward, and the halo with it. At 0.24,
336
+ * small text matches the stroke weight of a plain bitmap atlas more closely.
337
+ */
338
+ declare const LABEL_FONT_SETTINGS: {
339
+ sdf: boolean;
340
+ fontSize: number;
341
+ buffer: number;
342
+ radius: number;
343
+ cutoff: number;
344
+ smoothing: number;
345
+ };
346
+ /**
347
+ * Most halos one label layer draws, each with its own text sublayer. Labels without a halo get
348
+ * one more sublayer, and with more than one sublayer, another places the labels. Each sublayer
349
+ * holds every label row (see `renderLayers`), so the cap bounds the work per tile when every
350
+ * feature has its own halo.
351
+ */
352
+ export declare const MAX_HALO_SUBLAYERS = 8;
353
+ /**
354
+ * Converts a `text-halo-width`, in pixels, to `TextLayer`'s `outlineWidth` for text of `textSize`
355
+ * pixels, in an atlas of `fontSize` pixels per em. An atlas pixel is `textSize / fontSize` screen pixels, so the same halo needs a wider
356
+ * outline on smaller text. As in MapLibre, the halo is at most a quarter of the text size.
357
+ */
358
+ export declare function getOutlineWidth(haloWidth: number, textSize: number, fontSize?: number): number;
359
+ /**
360
+ * A row's glyphs along its line: `dx, dy, angle, mode` per character (see `LineGlyphPlacement`),
361
+ * and the path its collision circles follow, `x, y` pixels from the anchor, or null when the text
362
+ * does not fit on the line unturned. Text that must turn but does not fit turned keeps the unturned
363
+ * path, with every glyph hidden.
364
+ */
365
+ type RowLineGlyphs = {
366
+ glyphs: Float32Array;
367
+ path: number[] | null;
368
+ };
369
+ /**
370
+ * A row's glyphs along its line at one zoom step, both ways round: `layout` is the unturned
371
+ * placement (null when the text does not fit on the line), from which `getLineGlyphs` decides which
372
+ * way the label reads; `turned` is null when `text-keep-upright` never turns it.
373
+ */
374
+ type RowGlyphPlacements = {
375
+ count: number;
376
+ layout: LineGlyphs | null;
377
+ unturned: RowLineGlyphs;
378
+ turned: RowLineGlyphs | null;
379
+ };
380
+ /**
381
+ * Work done placing glyphs along lines, for benchmarks: rows placed, cached placements reused and
382
+ * collision paths taken to the screen.
383
+ */
384
+ export declare const LINE_GLYPH_STATS: {
385
+ rows: number;
386
+ cacheHits: number;
387
+ placementPaths: number;
388
+ };
389
+ /** The estimated length of `text` in ems: about square for wide characters, narrower for others. */
390
+ export declare function getTextLengthEms(text: string): number;
391
+ /**
392
+ * Turns `offset`, `[x, y]` in pixels with y pointing down, by `angle` degrees counter-clockwise,
393
+ * as deck.gl's `IconLayer` turns an icon by its `getAngle`.
394
+ */
395
+ export declare function rotatePixelOffset([x, y]: number[], angle: number): [number, number];
396
+ /**
397
+ * What the line placements of one tile and style layer share: how label text is measured, in ems,
398
+ * and the anchors placed so far per label text (see `isNearSameText`).
399
+ */
400
+ type LinePlacementContext = {
401
+ measureText: (text: string) => number;
402
+ placed: Map<string, number[][]>;
403
+ };
404
+ /** The rows whose `part` (text or icon) is drawn by the same sublayers, with the same collision. */
405
+ type SymbolPartGroup = {
406
+ /** Appended to the ids of the group's sublayers. */
407
+ idSuffix: string;
408
+ /** Per row, whether the row is in the group; `null` when every row is. */
409
+ rows: boolean[] | null;
410
+ };
411
+ /**
412
+ * Renders label text for decoded vector-tile features, with optional geometry
413
+ * passthrough for debugging.
414
+ */
415
+ export declare class MVTLabelLayer extends CompositeLayer<MVTLabelLayerProps> {
416
+ /** Deck.gl layer name. */
417
+ static layerName: string;
418
+ /** Default props for {@link MVTLabelLayer}. */
419
+ static defaultProps: DefaultProps<MVTLabelLayerProps>;
420
+ /** Current label-row state. */
421
+ state: MVTLabelLayerState;
422
+ /** Not loaded while the glyphs of its labels load: their tiles are not labelled yet. */
423
+ get isLoaded(): boolean;
424
+ /** The tile whose anchors are being placed, in a `tiles` layer; see `getTileProps`. */
425
+ private placingTile;
426
+ /** The tile props that anchors are placed with: the tile being placed, or this layer's. */
427
+ getTileProps(): Pick<MVTLabelLayerProps, 'tileBoundingBox' | 'tileZoom' | 'tileSize'>;
428
+ /** A picked label of a `tiles` layer reports its tile. */
429
+ getPickingInfo(params: any): any;
430
+ /**
431
+ * The image name `icon-image` gives a feature, with its tokens resolved: empty for none. While the
432
+ * sprites load, an `["image", ...]` expression still names its image, which is not available yet.
433
+ */
434
+ getIconImageName(feature: FeatureLike): string;
435
+ /**
436
+ * Resolves `icon-image` for a feature against the loaded sprites. Legacy `{token}` names are
437
+ * resolved as in `text-field`. Returns `null`, and warns once per name, when no sprite has it.
438
+ */
439
+ getIcon(feature: FeatureLike): ResolvedSpriteIcon | null;
440
+ /** On-screen icon height in pixels: the image's CSS-pixel height scaled by `icon-size`. */
441
+ getIconSize(feature: FeatureLike): number;
442
+ /**
443
+ * Icon color: `icon-color` for SDF images, white otherwise (deck.gl draws unmasked icons in
444
+ * their own colors), with `icon-opacity` as alpha.
445
+ */
446
+ getIconColor(feature: FeatureLike): number[];
447
+ /**
448
+ * Icon pixel offset: `icon-anchor` places that edge or corner of the icon on the point, and
449
+ * `icon-offset` shifts it by pixels scaled with `icon-size`, as in MapLibre.
450
+ */
451
+ getIconPixelOffset(feature: FeatureLike): [number, number];
452
+ /**
453
+ * Text pixel offset from `text-offset`, which is in ems of `text-size`, or from a non-zero
454
+ * `text-radial-offset`, which MapLibre GL JS takes instead, in the direction of `text-anchor`.
455
+ * A layer with variable anchors takes its offset from its anchor at placement, which MapLibre
456
+ * does only for point labels, so its line labels have none.
457
+ */
458
+ getLabelPixelOffset(feature: FeatureLike): [number, number];
459
+ /**
460
+ * The anchors a point label tries, in order, with their offsets in ems, from
461
+ * `text-variable-anchor-offset`, or from `text-variable-anchor` with `text-radial-offset` (when
462
+ * the layer sets it) or `text-offset`, as MapLibre GL JS's `getTextVariableAnchorOffset`; `null`
463
+ * without variable anchors or along lines.
464
+ */
465
+ getTextAnchors(feature: FeatureLike, placement?: string): TextAnchorOffset[] | null;
466
+ /** The variable anchor a row's label is drawn at (see `LabelRow.textAnchorIndex`), or `null`. */
467
+ getRowTextAnchor(row: LabelRow): TextAnchorOffset | null;
468
+ /** The `text-anchor` a row's label is drawn at: its variable anchor, or the feature's. */
469
+ getRowAnchor(row: LabelRow): string;
470
+ /** A row's text pixel offset: its variable anchor's, or the feature's (`getLabelPixelOffset`). */
471
+ getRowPixelOffset(row: LabelRow): [number, number];
472
+ /** `text-padding` at the stepped zoom, in pixels. */
473
+ getTextPadding(): number;
474
+ /**
475
+ * Update trigger for accessors that read `propertyNames`: the properties' style values, plus the
476
+ * stepped zoom when any of them depends on zoom. A value edited in place, or a new zoom step for a
477
+ * zoom-dependent value, re-evaluates the accessor; other zoom changes do not.
478
+ */
479
+ getStyleUpdateTrigger(...propertyNames: string[]): string;
480
+ /** Update triggers for the icon accessors (see `getStyleUpdateTrigger`). */
481
+ getIconUpdateTriggers(): Record<string, string>;
482
+ /**
483
+ * One `IconLayer` per sprite that this layer's icons come from. Each holds every label row, so
484
+ * an icon has the same row index, and so the same placement slot, as its own label. Rows whose
485
+ * icon is in another sprite, or in none, draw nothing.
486
+ *
487
+ * `icon-image` is evaluated once per row. Each sprite's layer evaluates the other style
488
+ * properties only for its own rows and gives every other row constants, so the style evaluation
489
+ * across all layers is linear in the rows. The instance count is rows times the sprites a tile
490
+ * uses (twice that when the rules differ), and only the style's `sprite` list adds sprites: tile
491
+ * data cannot.
492
+ */
493
+ renderIconLayers(icons?: (ResolvedSpriteIcon | null)[]): any[];
494
+ /**
495
+ * The label rows in the order every text and icon sublayer holds them: `labelData` in reverse.
496
+ * A symbol's placement slot follows its index here, so an icon and its label share it; every
497
+ * per-row array that these sublayers index (row icons, rows with text) is in this order.
498
+ * Placement walks `labelData`, in feature order (see `getPlacementSymbols`).
499
+ */
500
+ getRows(): LabelRow[];
501
+ /**
502
+ * Per label row, whether it has text (see `getLabel`). The result is kept with the label text
503
+ * cache, so it is evaluated once per text update trigger and label rows, not on every render.
504
+ */
505
+ getRowsWithText(): boolean[];
506
+ /**
507
+ * The texture of a sprite's image, shared by the icon layers of every label layer, or its URL
508
+ * while it is not decoded. deck.gl would otherwise upload the image for each icon layer.
509
+ */
510
+ getIconAtlas(atlas: SpriteAtlas): unknown;
511
+ /** Releases the sprite textures that the icon layers no longer draw from. */
512
+ retainIconAtlases(atlases: Set<SpriteAtlas>): void;
513
+ /**
514
+ * Each label row's icon, resolved against the loaded sprites (see `getIcon`), or all `null`
515
+ * while the layer has no `icon-image` or no sprites.
516
+ */
517
+ getRowIcons(): (ResolvedSpriteIcon | null)[];
518
+ /**
519
+ * The groups of rows each part is drawn by: one group of every row, since placement decides per
520
+ * symbol which parts draw (see `LabelPlacement`).
521
+ */
522
+ getSymbolPartGroups(_part: 'text' | 'icon', _hasOtherPart: () => boolean[]): SymbolPartGroup[];
523
+ /** Returns a compiled `layout` or `paint` property of the style layer, if it sets one. */
524
+ private getStyleProperty;
525
+ /**
526
+ * Evaluates a style property for a feature at the stepped zoom (`getZoomBucket`). The value is
527
+ * kept for the feature until the zoom step or the property changes: a `tiles` layer makes its
528
+ * rows again whenever a tile is shown or hidden, and the rows of the other tiles keep their
529
+ * features, so their values are not evaluated again.
530
+ */
531
+ private evaluateStyleProperty;
532
+ /**
533
+ * The CSS font of this layer's labels, from `text-font` at the stepped zoom, or the style
534
+ * spec's default font when the layer does not set it, with the `fontFamily` override applied.
535
+ * `TextLayer` takes one font per layer, so a data-driven `text-font` is evaluated for the first
536
+ * label feature only.
537
+ */
538
+ getFont(): LabelFont;
539
+ /**
540
+ * The `text-font` stack of a feature's label as glyph URLs name it, its fonts joined by commas:
541
+ * of the first label row's feature when none is given, as `getFont`.
542
+ */
543
+ getFontStack(feature?: FeatureLike): string;
544
+ /** `TextLayer`'s font atlas settings: of the style's glyphs, or of the browser's fonts. */
545
+ getFontSettings(): typeof LABEL_FONT_SETTINGS;
546
+ /** The advance of a character in ems, in the font or glyphs the labels are drawn with. */
547
+ getCharacterMeasurer(): (character: string) => number;
548
+ /**
549
+ * `TextLayer`'s font props: the style's glyphs of the layer's font stack, drawn by their own
550
+ * font renderer into an atlas of their own, or the CSS font.
551
+ */
552
+ getFontProps(font?: LabelFont): Record<string, unknown>;
553
+ /**
554
+ * What the label text is drawn with: the font stack of the style's glyph store, or the CSS font.
555
+ * A new store for the same URL may hold other glyphs, so text is measured again with it.
556
+ */
557
+ getFontKey(): string;
558
+ /**
559
+ * The inputs that choose the glyphs of the label text: the glyph store, as a new one for the same
560
+ * URL has none of the old one's glyphs loaded, the style's glyphs, and `text-field`,
561
+ * `text-transform` and `text-font`, with the stepped zoom when any of them depends on zoom.
562
+ * Point anchors do not depend on them, so rows kept for unchanged anchors check their glyphs
563
+ * again when this changes: a zoom step can change the text to another glyph range or font stack.
564
+ */
565
+ getGlyphKey(): string;
566
+ /**
567
+ * `features` without those whose label text is in a font stack of `refused` (see
568
+ * `hasLabelGlyphs`). Their rows are left out rather than drawn without glyphs: `TextLayer` would
569
+ * draw their characters into the font atlas as empty cells, and keep drawing them so once the
570
+ * store retains the font stack and its glyphs load.
571
+ */
572
+ withoutRefusedLabels(features: FeatureLike[], refused: ReadonlySet<string>): FeatureLike[];
573
+ /**
574
+ * Whether the glyphs of the label text of `features` have loaded, with the style's glyphs. When
575
+ * they have not, they are requested, and the layer updates once they have, as MapLibre GL JS
576
+ * places a tile's symbols once their glyphs have loaded.
577
+ *
578
+ * The layer retains the font stack of each feature's text in the store, before it loads any,
579
+ * and adds it to `fontStacks`: loading the glyphs of some font stacks then cannot drop those of
580
+ * others that the layer draws or waits for. A feature whose font stack the store will not
581
+ * retain (see `GlyphStore.retain`) is not waited for: its label is left undrawn, as that of a
582
+ * glyph range that fails to load, so that the labels of the other features settle. Its font
583
+ * stack is added to `refused`, and its row left out (see `withoutRefusedLabels`).
584
+ */
585
+ hasLabelGlyphs(features: FeatureLike[], fontStacks: Set<string>, refused?: Set<string>): boolean;
586
+ /**
587
+ * Extracts the visible label text for a decoded feature. Legacy `{token}` placeholders are
588
+ * resolved only in literal and zoom-function values, as in the style specification.
589
+ * Applies `text-transform` and Arabic shaping, balanced `text-max-width` wrapping for point
590
+ * labels, and the reordering of right-to-left text into the order it is drawn.
591
+ */
592
+ getLabel(feature: FeatureLike): string | undefined;
593
+ /**
594
+ * The label text of a feature as `getLabel` returns it, whatever its `text-size` at the map's
595
+ * zoom. Labels along lines are placed at the tile's zoom, where the text may be visible.
596
+ */
597
+ getLabelText(feature: FeatureLike): string | undefined;
598
+ /**
599
+ * A feature's label text, with `text-transform` and Arabic shaping applied, before wrapping and
600
+ * in logical order: its code points are those whose glyphs are drawn.
601
+ */
602
+ getUnwrappedLabelText(feature: FeatureLike): string | undefined;
603
+ /**
604
+ * `text-letter-spacing` of a feature's label `text`, in ems. As in MapLibre, text in a cursive
605
+ * script is not letter-spaced.
606
+ */
607
+ getLetterSpacing(feature: FeatureLike, text: string): number;
608
+ /**
609
+ * `text-justify` of a feature's label. MapLibre centers the lines of labels along lines.
610
+ */
611
+ getTextJustify(feature: FeatureLike): LabelTextJustify;
612
+ /**
613
+ * Returns the font size for a decoded feature label.
614
+ */
615
+ getLabelSize(feature: FeatureLike): number;
616
+ /**
617
+ * The font size a label's collision box is laid out at, as MapLibre GL JS lays it out: `text-size`
618
+ * at the zoom after the tile's, the integer zoom (its `layoutTextSize`). Where `text-size`
619
+ * changes with zoom, the box is that size and not the one drawn: at z3.6, a size that grows with
620
+ * zoom collides at its z4 size.
621
+ */
622
+ getCollisionLabelSize(feature: FeatureLike): number;
623
+ /**
624
+ * Returns the text color for a decoded feature label, from `text-color` and `text-opacity`.
625
+ * Falls back to the `textColor` prop, then to the style spec's default black, when the style
626
+ * layer does not set `text-color`.
627
+ */
628
+ getLabelColor(feature: FeatureLike): number[];
629
+ /**
630
+ * Returns the halo of a decoded feature label from `text-halo-color`, `text-halo-width` and
631
+ * `text-halo-blur`, or `null` when it has none: a width of 0 (the default) or a transparent color
632
+ * (the default). The color is faded by the same `text-opacity` as the text, so a hidden or faded
633
+ * label leaves no halo. Like the width, the blur is rounded to 0.25 px.
634
+ */
635
+ getLabelHalo(feature: FeatureLike): LabelHalo | null;
636
+ /**
637
+ * Groups the label rows by halo. `TextLayer` takes one outline color, width and blur per layer,
638
+ * so each distinct halo is drawn by its own text sublayer. At most `MAX_HALO_SUBLAYERS` halos are
639
+ * kept, the most common ones; labels with any other halo are drawn with the most common halo.
640
+ * Labels without a halo are not counted in the cap and never get one: a hidden label stays
641
+ * hidden. Kept halos are ordered by their first label, so sublayer ids stay stable.
642
+ */
643
+ getLabelHalos(rows: LabelRow[]): LabelHalos;
644
+ /**
645
+ * What the label text takes from `text-size`: a size of 0 hides the label (see `getLabel`). A size
646
+ * that depends on zoom but not on the feature re-evaluates the text only when it reaches or leaves
647
+ * 0, not at every zoom step, since the text and its wrapping do not depend on the size otherwise.
648
+ */
649
+ getLabelSizeTextTrigger(): string;
650
+ /** Update triggers for the text accessors (see `getStyleUpdateTrigger`). */
651
+ getLabelUpdateTriggers(): Record<string, string>;
652
+ /**
653
+ * The layer's `symbol-placement` at the stepped zoom. It is not data-driven, so it is evaluated
654
+ * once per style layer rather than per feature.
655
+ */
656
+ getSymbolPlacement(): string;
657
+ /**
658
+ * Line height in ems. It is not data-driven in the spec, so one value per style layer and
659
+ * zoom step is exact.
660
+ */
661
+ getLineHeight(): number;
662
+ /**
663
+ * The tile's own extent in feature coordinates: the `[0, 1)` square for tile-local coordinates,
664
+ * the tile's longitude/latitude box for globe tiles, or null when it is not known.
665
+ */
666
+ getTileBounds(geographic: boolean): number[] | null;
667
+ /**
668
+ * Extracts candidate label anchor positions from a feature geometry. Points are labelled where
669
+ * they are. Lines are labelled at the middle vertex of their first part here; with
670
+ * `symbol-placement: line` or `line-center`, `getLabelData` places them along the line instead
671
+ * (see `getLineLabelPlacements`). With `symbol-placement: point`, each polygon of a feature is
672
+ * labelled at its pole of inaccessibility, as in MapLibre, if that point lies in this tile;
673
+ * polygons are not labelled along their outline. `geographic` says whether coordinates are
674
+ * longitude/latitude (globe tiles) or tile-local. `budget` bounds the polygon searches; pass one
675
+ * budget for all features of a tile.
676
+ */
677
+ getLabelAnchors(feature: FeatureLike, geographic?: boolean, placement?: string, budget?: PoleSearchBudget): number[][];
678
+ /**
679
+ * The zoom at which labels along lines are placed, and the tile's size in pixels there. As in
680
+ * MapLibre, placement uses the tile's own zoom, so labels stay put while the map zooms within a
681
+ * tile; an overzoomed tile is placed at the integer map zoom. A tile's own zoom is the map zoom
682
+ * at which it is drawn `tileSize` pixels wide: one less than its tile zoom for 256 px tiles.
683
+ */
684
+ getLinePlacementScale(): {
685
+ zoom: number;
686
+ tileZoom: number;
687
+ tileSize: number;
688
+ };
689
+ /**
690
+ * Measures the text of labels along lines, in ems, with the font `TextLayer` draws it in. Without
691
+ * a canvas, or while that font is still loading (the browser would measure a fallback font), the
692
+ * length is estimated from the character count instead (`getTextLengthEms`), and the layer
693
+ * updates, placing the labels again, once the font has loaded.
694
+ */
695
+ getLineTextMeasurer(): (text: string) => number;
696
+ /**
697
+ * Whether the label font is still loading in the document. The first time it is seen loading,
698
+ * a load is requested, and the layer updates when it is done.
699
+ */
700
+ isLineTextFontLoading(font?: LabelFont): boolean;
701
+ /**
702
+ * Label anchors along the lines of a `LineString` or `MultiLineString` feature, for
703
+ * `symbol-placement: line` or `line-center`, with the direction of the line at each. Lines are
704
+ * measured in pixels at the tile's zoom (see `getLinePlacementScale`), where `symbol-spacing`,
705
+ * `text-max-angle` and the label's `text-letter-spacing` are evaluated. As in MapLibre, the label's length, the window its bends
706
+ * are summed in and the first label's offset come from `text-size` at zoom 18, the same for
707
+ * every tile; where that size is 0, the size at the tile's zoom is used. The text is measured by
708
+ * `context.measureText`. Anchors outside the tile's own extent are left to the neighbouring tile.
709
+ * With `line` placement, lines are clipped to the tile's extent first, as in MapLibre, and a
710
+ * label is dropped within half a `symbol-spacing` of an earlier label with the same text on the
711
+ * tile (`context.placed`); `line-center` measures the whole line. Each feature draws on the
712
+ * shared `budget`, at most `DEFAULT_LINE_ANCHOR_STEPS` of it.
713
+ */
714
+ getLineLabelPlacements(feature: FeatureLike, geographic: boolean, placement: string, budget?: LineAnchorBudget, context?: LinePlacementContext): {
715
+ position: number[];
716
+ angle: number;
717
+ line: RowLine;
718
+ }[];
719
+ /** What the line placements of one tile and style layer share; see `getLineLabelPlacements`. */
720
+ getLinePlacementContext(): LinePlacementContext;
721
+ /**
722
+ * For `symbol-placement: line`, the line features with the same label text whose ends meet,
723
+ * joined as MapLibre does (see `mergeLines`): per feature, the feature with the joined line to
724
+ * place labels along, `null` for a feature joined into another, or `undefined` to place the
725
+ * feature as it is. As in MapLibre, a `MultiLineString` joins by its first line only, and a
726
+ * feature joined into another is dropped whole, with any other lines it has: MapLibre's
727
+ * `mergeLines` takes each feature's `geometry[0]` and keeps the feature of the chain it joins.
728
+ */
729
+ getMergedLines(features: FeatureLike[]): (FeatureLike | null | undefined)[];
730
+ /**
731
+ * Label rows for every anchor of `features`: `symbol-placement` is evaluated once, and one
732
+ * search budget is shared by all polygons of the tile. With `line` or `line-center` placement,
733
+ * line features get rows along their lines, each with the line's direction.
734
+ */
735
+ getLabelData(features: FeatureLike[], geographic: boolean): LabelRow[];
736
+ /**
737
+ * The inputs besides the tile data that the anchors depend on: `symbol-placement`, the
738
+ * coordinate mode, the tile's extent and, for globe tiles, the search precision's zoom. Labels
739
+ * along lines also depend on the placement scale and on the style values that size and space
740
+ * them.
741
+ */
742
+ getAnchorKey(geographic: boolean): string;
743
+ /**
744
+ * The map bearing in `BEARING_STEP` steps, against which upright line labels are turned. Globe
745
+ * labels are billboards, drawn in screen space, so their bearing is 0.
746
+ */
747
+ getBearingStep(viewport?: {
748
+ bearing?: number;
749
+ projectionMode?: number;
750
+ } | undefined): number;
751
+ /**
752
+ * Labels along lines turn upright as the map rotates (`text-keep-upright`), so a layer of them
753
+ * updates when the bearing crosses a `BEARING_STEP`.
754
+ */
755
+ shouldUpdateState(params: UpdateParameters<this>): boolean;
756
+ /**
757
+ * Whether the text or icons of this layer turn with the lines they are placed along (see
758
+ * `getLineLabelProps` and `getIconAngleProps`). Only then do they depend on the bearing. Text
759
+ * needs a `text-field`, and icons an `icon-image` and loaded sprites.
760
+ */
761
+ turnsWithLines(): boolean;
762
+ /**
763
+ * Text layer props for labels along lines: each label is turned to its line, upright when
764
+ * `text-keep-upright` is set (the default). On a flat map they are drawn in the map plane, as
765
+ * MapLibre does with the `auto` `text-rotation-alignment` and `text-pitch-alignment` of line
766
+ * placement; on a globe they stay billboards, turned in screen space.
767
+ */
768
+ getLineLabelProps(): Record<string, unknown>;
769
+ /**
770
+ * Whether the glyphs of this layer's labels along lines are each placed on the line, as MapLibre
771
+ * draws them: text turned to lines on a flat map (where it is drawn in the map plane), sized in
772
+ * pixels, on WebGL. Otherwise labels are drawn straight, turned to their anchor's segment. On a
773
+ * globe, labels are billboards turned on screen, and stay straight.
774
+ */
775
+ curvesLineText(viewport?: any): boolean;
776
+ /** The zoom glyphs along lines are placed at: the viewport's, in `LINE_GLYPH_ZOOM_STEPS`. */
777
+ getGlyphZoom(viewport?: any): number;
778
+ /**
779
+ * The style inputs of glyphs along lines, besides the row's text and line: the style values,
780
+ * and the revision of the label font's advances (`getCharacterWidthsRevision`).
781
+ */
782
+ getLineGlyphStyleKey(): string;
783
+ /** The style values glyphs along lines are placed by. */
784
+ getLineGlyphStyleTrigger(): string;
785
+ /**
786
+ * The revision of the label font's advances, read when called: it changes once the font has
787
+ * loaded with other advances (`forgetCharacterWidths`), maybe as another layer found, without
788
+ * this layer updating.
789
+ */
790
+ getLineGlyphWidthsRevision(): () => number;
791
+ /**
792
+ * The text sublayers' `getLineGlyphs` and `getLineGlyphKey` (see `LabelTextLayer`), null when the
793
+ * layer draws its text straight, and the update trigger of the glyphs: the style. The glyphs also
794
+ * change with the view's zoom and bearing steps, and with the label font's advances, which the
795
+ * character layers check when they draw: placement reads the advances' revision anew, so the
796
+ * glyphs drawn follow the glyphs placed without this layer updating.
797
+ */
798
+ getLineGlyphProps(): {
799
+ getLineGlyphs: ((row: LabelRow, viewport: any) => Float32Array | null) | null;
800
+ getLineGlyphKey: ((viewport: any) => string) | null;
801
+ trigger: string;
802
+ };
803
+ /**
804
+ * Where each glyph of `row`'s label is drawn along its line at `viewport`'s zoom, as MapLibre GL
805
+ * JS's `placeGlyphsAlongLine`: each advance centre on the line, turned to the segment it lands on,
806
+ * the whole label turned around to read upright at `bearingStep` (from its first and last glyph,
807
+ * placed unturned). Null for a row drawn straight: not along a line, or multi-line text. The
808
+ * placements are cached per row for the zoom step and style, both ways round, so that every text
809
+ * sublayer and the placement share them, and a bearing step only checks which way each reads.
810
+ * Each view keeps its own, so that views at different zooms, as a main map and a minimap, do not
811
+ * place the glyphs again in turn.
812
+ */
813
+ getLineGlyphs(row: LabelRow, viewport: any, bearingStep: number, styleKey: string): RowLineGlyphs | null;
814
+ /**
815
+ * `row`'s glyphs placed along its line at `zoom` (see `getLineGlyphs`): unturned, and turned to
816
+ * read the other way when `text-keep-upright` may turn the label (null otherwise).
817
+ */
818
+ placeRowGlyphs(row: LabelRow, line: RowLine, feature: FeatureLike, text: string, zoom: number): RowGlyphPlacements;
819
+ /**
820
+ * The extensions that keep billboards along lines on their lines on a globe. A globe draws them
821
+ * in screen space, at angles taken from north up, so the shader turns them by the direction the
822
+ * view draws the line in, at every frame, and upright with `keepUpright`: there the bearing
823
+ * alone does not tell which way they read. A flat map draws them in the map plane. The shader
824
+ * keeps an angle upright only when it is the line's direction: icons turned by `icon-rotate` are
825
+ * kept upright from north up, by their angles. Text keeps its `text-offset` on its side of the
826
+ * line as it turns around.
827
+ */
828
+ getLineAngleExtensions(turnsWithLine: boolean, keepUpright: 'text-keep-upright' | 'icon-keep-upright', isLineDirection?: boolean): GlobeLineAngleExtension[];
829
+ /**
830
+ * Icon layer props that turn icons, and the angle each row's icon is turned by, counter-clockwise
831
+ * in degrees as deck.gl takes it (null when no icon turns). Icons along lines whose rotation is
832
+ * aligned to the map (`icon-rotation-alignment: map`, or `auto`) are turned to the line's
833
+ * direction, upright when `icon-keep-upright` is set (default false) as for text. Every icon then
834
+ * adds `icon-rotate`, clockwise. Icons aligned to the map are drawn flat on a flat map, so they
835
+ * turn with its bearing; the others are billboards, turned on screen. On a globe, icons stay
836
+ * billboards.
837
+ */
838
+ getIconAngleProps(): {
839
+ props: Record<string, unknown>;
840
+ getAngle: ((row: LabelRow) => number) | null;
841
+ extensions: GlobeLineAngleExtension[];
842
+ };
843
+ /**
844
+ * Forgets a font load in flight, so that its completion does not update a finalized layer, and
845
+ * releases the shared sprite textures.
846
+ */
847
+ finalizeState(context: LayerContext): void;
848
+ /**
849
+ * Recomputes label anchor rows when the source tile data, or an input the anchors depend on,
850
+ * changes.
851
+ */
852
+ updateState({ oldProps, changeFlags }: UpdateParameters<this>): void;
853
+ /** The rows of a layer of one tile's `data`. */
854
+ updateDataRows(data: NonNullable<MVTLabelLayerProps['data']>, geographic: boolean, dataChanged: boolean): void;
855
+ /**
856
+ * The rows of a `tiles` layer: each tile's anchors, placed as in a layer of the tile alone and
857
+ * kept while its features and anchor inputs do not change, in longitude/latitude, combined by
858
+ * `combineTileRows`. Tile-local anchors outside the tile's square are left out, as the tile's
859
+ * own layer clips them; on a globe, tiles keep the rows they have.
860
+ */
861
+ updateTileRows(tiles: LabelTile[], geographic: boolean): void;
862
+ /**
863
+ * Gives back the font stacks the layer retains in its glyph store other than `fontStacks`, those
864
+ * of the rows it keeps and of the tiles that wait for glyphs (see `GlyphStore.retain`).
865
+ */
866
+ retainGlyphs(fontStacks: ReadonlySet<string>, refused: boolean): void;
867
+ /**
868
+ * Renders the optional debug geometry and the text labels.
869
+ */
870
+ /** The placement this layer's labels take part in: its prop's, or its deck's shared one. */
871
+ getLabelPlacement(): LabelPlacement;
872
+ /** Registers with the placement, for the current rows. */
873
+ updatePlacement(): void;
874
+ /** Sublayer props that draw a part (0: text, 1: icons) where placement placed it. */
875
+ getPlacementProps(part: 0 | 1): Record<string, unknown>;
876
+ /**
877
+ * Each row's slot, by row: `TextLayer` does not hand its character layer the row's index in
878
+ * `data`, so the slot is found from the row itself.
879
+ */
880
+ getPlacementSlotAccessor(): ((row: LabelRow) => number) | number;
881
+ getPlacementOrder(): number;
882
+ getPlacementRevision(): number;
883
+ getPlacementSlotRevision(): number;
884
+ getPlacementSlotCount(): number;
885
+ /**
886
+ * `PlacementLayer.isDrawnIn`: whether deck.gl draws this layer in `viewport`, as its layers pass
887
+ * decides: the layer and its parents are visible, and each parent's `filterSubLayer` keeps it.
888
+ */
889
+ isDrawnIn(viewport: Viewport): boolean;
890
+ /**
891
+ * `PlacementLayer.getPlacementRoot`: the deck layer this layer is drawn under, and the deck's
892
+ * layers in draw order, so that the labels of a layer drawn over another (as a second
893
+ * `BasemapLayer`) are placed first.
894
+ */
895
+ getPlacementRoot(): {
896
+ root: Layer;
897
+ layers: readonly Layer[];
898
+ } | null;
899
+ /**
900
+ * What placement needs of each row that does not change with the view, kept until the rows, the
901
+ * label text, the sprites, the style's layout values, the font's measured widths or the zoom
902
+ * step change: the rules, the placement order, and per row (in `labelData` order) its text box
903
+ * (`x1, y1, w, h` in pixels from the anchor, before padding; `w` NaN without text) and its icon
904
+ * box (`x1, y1, x2, y2` padded, before any turn; `x1` NaN without an icon).
905
+ */
906
+ getPlacementGeometry(): PlacementGeometry | null;
907
+ /** `PlacementLayer.getPlacementSymbols`: this layer's symbols, in MapLibre's order. */
908
+ getPlacementSymbols(viewport: any, slotBase: number, out: PlacementSymbol[]): SymbolPlacementRules | null;
909
+ /**
910
+ * The common-space position of each `labelData` row (in longitude/latitude), for the kind of
911
+ * viewport: a globe's or a map's, which do not change with the view. Kept per row.
912
+ */
913
+ getPlacementCommons(viewport: any, geometry: PlacementGeometry): Float64Array;
914
+ /**
915
+ * Whether a common-space point on a globe's surface is beyond its horizon in `viewport`, as
916
+ * `GlobeHorizonExtension` tests it.
917
+ */
918
+ getHorizonTest(viewport: any): (x: number, y: number, z: number) => boolean;
919
+ /** Whether a longitude/latitude lies beyond the horizon of a globe viewport. */
920
+ isBeyondHorizon(viewport: any, position: number[]): boolean;
921
+ renderLayers(): any;
922
+ }
923
+ export {};