@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.
- package/README.md +34 -2
- package/THIRD-PARTY-NOTICES.md +205 -0
- package/dist/geojson-worker.js +2160 -0
- package/dist/geojson-worker.js.map +6 -0
- package/dist/index.cjs +11388 -0
- package/dist/index.cjs.map +6 -0
- package/dist/index.js +11369 -0
- package/dist/index.js.map +6 -0
- package/dist/map-style.cjs +445 -0
- package/dist/map-style.cjs.map +6 -0
- package/dist/map-style.js +431 -0
- package/dist/map-style.js.map +6 -0
- package/dist/types/arabic-shaping.d.ts +7 -0
- package/dist/types/atmosphere-layer.d.ts +10 -0
- package/dist/types/basemap-layer.d.ts +150 -0
- package/dist/types/bidi.d.ts +8 -0
- package/dist/types/circle-layer.d.ts +49 -0
- package/dist/types/fill-extrusion-lighting-extension.d.ts +49 -0
- package/dist/types/fill-outline-extension.d.ts +22 -0
- package/dist/types/fill-pattern.d.ts +99 -0
- package/dist/types/fill-style-extensions.d.ts +100 -0
- package/dist/types/geojson-source.d.ts +29 -0
- package/dist/types/geojson-tiler.d.ts +48 -0
- package/dist/types/geojson-worker.d.ts +40 -0
- package/dist/types/globe-horizon-extension.d.ts +61 -0
- package/dist/types/globe-layers.d.ts +239 -0
- package/dist/types/globe-line-angle-extension.d.ts +37 -0
- package/dist/types/glyph-font-renderer.d.ts +37 -0
- package/dist/types/glyph-pbf.d.ts +37 -0
- package/dist/types/glyph-store.d.ts +103 -0
- package/dist/types/grid-index.d.ts +47 -0
- package/dist/types/hillshade-layer.d.ts +154 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/is-globe-viewport.d.ts +2 -0
- package/dist/types/label-font-renderer.d.ts +18 -0
- package/dist/types/label-placement.d.ts +247 -0
- package/dist/types/label-text-layer.d.ts +231 -0
- package/dist/types/line-blur-extension.d.ts +73 -0
- package/dist/types/line-glyphs.d.ts +60 -0
- package/dist/types/line-placement.d.ts +93 -0
- package/dist/types/map-style-loader.d.ts +48 -0
- package/dist/types/map-style-schema.d.ts +72 -0
- package/dist/types/map-style.d.ts +6 -0
- package/dist/types/mapbox-style.d.ts +40 -0
- package/dist/types/mvt-label-layer.d.ts +923 -0
- package/dist/types/polylabel.d.ts +17 -0
- package/dist/types/raster-color-extension.d.ts +146 -0
- package/dist/types/shared-texture.d.ts +34 -0
- package/dist/types/sort-key.d.ts +10 -0
- package/dist/types/sprite.d.ts +82 -0
- package/dist/types/style-accessor.d.ts +45 -0
- package/dist/types/style-expression.d.ts +83 -0
- package/dist/types/style-resolver.d.ts +94 -0
- package/dist/types/text-font.d.ts +36 -0
- package/dist/types/text-halo-blur-extension.d.ts +55 -0
- package/dist/types/text-layout.d.ts +71 -0
- package/dist/types/util.d.ts +22 -0
- package/dist/types/zoom-paint-extension.d.ts +72 -0
- package/package.json +80 -3
- package/src/arabic-shaping.ts +366 -0
- package/src/atmosphere-layer.ts +19 -0
- package/src/basemap-layer.ts +533 -0
- package/src/bidi.ts +199 -0
- package/src/circle-layer.ts +191 -0
- package/src/fill-extrusion-lighting-extension.ts +206 -0
- package/src/fill-outline-extension.ts +70 -0
- package/src/fill-pattern.ts +400 -0
- package/src/fill-style-extensions.ts +177 -0
- package/src/geojson-source.ts +318 -0
- package/src/geojson-tiler.ts +185 -0
- package/src/geojson-worker.ts +98 -0
- package/src/globe-horizon-extension.ts +64 -0
- package/src/globe-layers.ts +3487 -0
- package/src/globe-line-angle-extension.ts +131 -0
- package/src/glyph-font-renderer.ts +173 -0
- package/src/glyph-pbf.ts +164 -0
- package/src/glyph-store.ts +326 -0
- package/src/grid-index.ts +177 -0
- package/src/hillshade-layer.ts +775 -0
- package/src/index.ts +18 -0
- package/src/is-globe-viewport.ts +24 -0
- package/src/label-font-renderer.ts +159 -0
- package/src/label-placement.ts +727 -0
- package/src/label-text-layer.ts +913 -0
- package/src/line-blur-extension.ts +237 -0
- package/src/line-glyphs.ts +364 -0
- package/src/line-placement.ts +446 -0
- package/src/map-style-loader.ts +56 -0
- package/src/map-style-schema.ts +83 -0
- package/src/map-style.ts +23 -0
- package/src/mapbox-style.ts +168 -0
- package/src/mvt-label-layer.ts +3744 -0
- package/src/polylabel.ts +312 -0
- package/src/raster-color-extension.ts +245 -0
- package/src/shared-texture.ts +153 -0
- package/src/sort-key.ts +63 -0
- package/src/sprite.ts +244 -0
- package/src/style-accessor.ts +95 -0
- package/src/style-expression.ts +327 -0
- package/src/style-resolver.ts +301 -0
- package/src/text-font.ts +150 -0
- package/src/text-halo-blur-extension.ts +115 -0
- package/src/text-layout.ts +441 -0
- package/src/util.ts +47 -0
- package/src/zoom-paint-extension.ts +207 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Runtime exports for `@deck.gl-community/basemap-layers`. */
|
|
2
|
+
export { BasemapLayer } from "./basemap-layer.js";
|
|
3
|
+
export { createDemTileset, getBasemapLayers, getGlobeBaseLayers, getGlobeTopLayers } from "./globe-layers.js";
|
|
4
|
+
export { getSpriteIconMapping, getSpriteSources, loadSpriteAtlases } from "./sprite.js";
|
|
5
|
+
export type { SpriteAtlas, SpriteIconMappingEntry, SpriteSource } from "./sprite.js";
|
|
6
|
+
export { getLabelFont } from "./text-font.js";
|
|
7
|
+
export type { LabelFont, LabelFontFamily } from "./text-font.js";
|
|
8
|
+
export { GlyphStore } from "./glyph-store.js";
|
|
9
|
+
export type { GlyphStoreOptions } from "./glyph-store.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { TextLayerProps } from '@deck.gl/layers';
|
|
2
|
+
type GetFontRenderer = NonNullable<TextLayerProps['_getFontRenderer']>;
|
|
3
|
+
type FontRenderer = ReturnType<GetFontRenderer>;
|
|
4
|
+
type FontSettings = Parameters<GetFontRenderer>[0];
|
|
5
|
+
/**
|
|
6
|
+
* The signed distance field font renderer of label text: `TextLayer`'s own, with the same TinySDF,
|
|
7
|
+
* but keeping the part of a glyph left of its origin. `TextLayer` takes a glyph's origin at the left
|
|
8
|
+
* edge of the distance field TinySDF draws: TinySDF 2.0 cuts off the left of `f`, `j`, `y` and other
|
|
9
|
+
* italic glyphs that reach behind their origin, and TinySDF 2.2 and later draw every glyph from the
|
|
10
|
+
* left edge of its ink (`glyphLeft`), which `TextLayer` then draws off its origin.
|
|
11
|
+
*
|
|
12
|
+
* `TextLayer` leaves `fontSettings.buffer` atlas pixels before each glyph's origin, so the distance
|
|
13
|
+
* field left of a glyph is cut by the length of its overhang: a glyph keeps all its ink, and a halo
|
|
14
|
+
* reaches `buffer` minus the overhang atlas pixels left of it (9 of 18 for Noto Sans Italic `j` in
|
|
15
|
+
* a 64 px atlas, 1.7 px on 12 px text).
|
|
16
|
+
*/
|
|
17
|
+
export declare function getLabelFontRenderer(settings: FontSettings): FontRenderer;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { LayerExtension } from '@deck.gl/core';
|
|
2
|
+
import type { Layer, Viewport } from '@deck.gl/core';
|
|
3
|
+
import type { Device, Texture } from '@luma.gl/core';
|
|
4
|
+
import { GridIndex, type OverlapMode } from "./grid-index.js";
|
|
5
|
+
/**
|
|
6
|
+
* Pixels around the viewport in which symbols are placed, so that a symbol just outside it still
|
|
7
|
+
* hides those it would overlap when it comes in: MapLibre GL JS's `viewportPadding`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const PLACEMENT_VIEWPORT_PADDING = 100;
|
|
10
|
+
/**
|
|
11
|
+
* Milliseconds between two placements while the view keeps changing, as MapLibre GL JS's default
|
|
12
|
+
* `fadeDuration`. The view the map comes to rest in is always placed.
|
|
13
|
+
*/
|
|
14
|
+
export declare const DEFAULT_PLACEMENT_INTERVAL = 300;
|
|
15
|
+
/**
|
|
16
|
+
* A symbol part's collision shape in grid pixels (screen pixels moved by
|
|
17
|
+
* `PLACEMENT_VIEWPORT_PADDING`): a box `[x1, y1, x2, y2]`, or circles `[x, y, radius, ...]` for
|
|
18
|
+
* text along a line.
|
|
19
|
+
*/
|
|
20
|
+
export type PlacementShape = {
|
|
21
|
+
box: number[];
|
|
22
|
+
circles?: undefined;
|
|
23
|
+
} | {
|
|
24
|
+
circles: number[];
|
|
25
|
+
box?: undefined;
|
|
26
|
+
};
|
|
27
|
+
/** One symbol to place: the slot its visibility is written to, and its parts' shapes. */
|
|
28
|
+
export type PlacementSymbol = {
|
|
29
|
+
slot: number;
|
|
30
|
+
/** `null` when the symbol draws no text. */
|
|
31
|
+
text: PlacementShape | null;
|
|
32
|
+
/** `null` when the symbol draws no icon. */
|
|
33
|
+
icon: PlacementShape | null;
|
|
34
|
+
/** Hidden whatever its collisions: beyond a globe's horizon. */
|
|
35
|
+
occluded?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Its icon is still loading. Unless the icon is optional, the symbol is not placed until it has
|
|
38
|
+
* loaded, as MapLibre GL JS lays out no symbol until its images have loaded: its text, placed
|
|
39
|
+
* alone, would hide when the icon arrives and collides.
|
|
40
|
+
*/
|
|
41
|
+
iconPending?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* With `text-variable-anchor`: the text's shape at each of its anchors, in the order they are
|
|
44
|
+
* tried, and the slot whose text is drawn at each. `text` is the first one's shape, and `key`
|
|
45
|
+
* names the symbol across placements, so that it keeps the anchor it was placed at while that
|
|
46
|
+
* still fits, as in MapLibre GL JS.
|
|
47
|
+
*/
|
|
48
|
+
textAnchors?: {
|
|
49
|
+
shapes: PlacementShape[];
|
|
50
|
+
slots: number[];
|
|
51
|
+
key: object;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
/** A symbol style layer's placement rules, from its layout, as MapLibre GL JS reads them. */
|
|
55
|
+
export type SymbolPlacementRules = {
|
|
56
|
+
textOverlap: OverlapMode;
|
|
57
|
+
iconOverlap: OverlapMode;
|
|
58
|
+
textIgnorePlacement: boolean;
|
|
59
|
+
iconIgnorePlacement: boolean;
|
|
60
|
+
textOptional: boolean;
|
|
61
|
+
iconOptional: boolean;
|
|
62
|
+
/** Whether the layer draws any text, and any icon (MapLibre's `hasTextData`/`hasIconData`). */
|
|
63
|
+
hasTextData: boolean;
|
|
64
|
+
hasIconData: boolean;
|
|
65
|
+
};
|
|
66
|
+
/** Visibility bits of a placed symbol. */
|
|
67
|
+
export declare const TEXT_VISIBLE = 1;
|
|
68
|
+
export declare const ICON_VISIBLE = 2;
|
|
69
|
+
/** `placeSymbol` returns the index of the anchor its text is placed at above the visibility bits. */
|
|
70
|
+
export declare const ANCHOR_SHIFT = 2;
|
|
71
|
+
/**
|
|
72
|
+
* Places one symbol in `grid`, as MapLibre GL JS's `Placement.placeLayerBucketPart` places a
|
|
73
|
+
* symbol instance: each part is placeable where it lies in the grid and overlaps nothing it may not
|
|
74
|
+
* overlap; a part that is not optional is placed only with the other part; placed parts are added
|
|
75
|
+
* to the grid unless they ignore placement. Text with variable anchors is placed at the first of
|
|
76
|
+
* them where it fits (see `getTextAnchor`); its icon stays where it is. Returns the visibility bits
|
|
77
|
+
* (`TEXT_VISIBLE`, `ICON_VISIBLE`), and the index of the text's anchor shifted by `ANCHOR_SHIFT`.
|
|
78
|
+
* A part that always overlaps, of a symbol whose other part does too or is optional or absent, is
|
|
79
|
+
* shown even outside the grid (MapLibre's `alwaysShowText`/`Icon`).
|
|
80
|
+
*/
|
|
81
|
+
export declare function placeSymbol(grid: GridIndex, symbol: PlacementSymbol, rules: SymbolPlacementRules, previousAnchor?: number): number;
|
|
82
|
+
/** A label layer that takes part in placement (`MVTLabelLayer`). */
|
|
83
|
+
export interface PlacementLayer {
|
|
84
|
+
/**
|
|
85
|
+
* The layer's place in the style: layers with a higher order are placed first, as MapLibre GL
|
|
86
|
+
* JS places style layers from the top down.
|
|
87
|
+
*/
|
|
88
|
+
getPlacementOrder(): number;
|
|
89
|
+
/** A value that changes whenever what the layer would place changes, other than the view. */
|
|
90
|
+
getPlacementRevision(): number;
|
|
91
|
+
/**
|
|
92
|
+
* A value that changes whenever the layer's symbols take other slots from its slot base, as when
|
|
93
|
+
* its rows change: the placement made before then holds the visibility of other symbols in
|
|
94
|
+
* those slots, or of none, so the layer is placed again at once, whether or not the view moves.
|
|
95
|
+
*/
|
|
96
|
+
getPlacementSlotRevision(): number;
|
|
97
|
+
/** The number of slots the layer's symbols use, `0..count-1` from its slot base. */
|
|
98
|
+
getPlacementSlotCount(): number;
|
|
99
|
+
/**
|
|
100
|
+
* Whether the layer is drawn in `viewport`: a hidden layer, or one of another view, has no say
|
|
101
|
+
* in what is placed there.
|
|
102
|
+
*/
|
|
103
|
+
isDrawnIn(viewport: Viewport): boolean;
|
|
104
|
+
/** Appends the layer's symbols in its placement order, for `viewport`, to `out`. */
|
|
105
|
+
getPlacementSymbols(viewport: Viewport, slotBase: number, out: PlacementSymbol[]): SymbolPlacementRules | null;
|
|
106
|
+
/** Requests another frame, while a placement waits for the throttle. */
|
|
107
|
+
setNeedsRedraw(): void;
|
|
108
|
+
/**
|
|
109
|
+
* The deck layer the layer is drawn under (its topmost parent, or itself), and the deck's layers
|
|
110
|
+
* in draw order. Of two layers under different deck layers, the one under the later deck layer
|
|
111
|
+
* is placed first, as MapLibre GL JS places the layers drawn over others first; the placement
|
|
112
|
+
* order decides only between layers under the same deck layer. Without it, the layer is placed
|
|
113
|
+
* by its placement order alone, after the layers that give one. Deck layers are told apart by
|
|
114
|
+
* their ids, which deck.gl keeps when it makes a new instance of a layer.
|
|
115
|
+
*/
|
|
116
|
+
getPlacementRoot?(): {
|
|
117
|
+
root: {
|
|
118
|
+
id: string;
|
|
119
|
+
};
|
|
120
|
+
layers: readonly PlacementDeckLayer[];
|
|
121
|
+
} | null;
|
|
122
|
+
}
|
|
123
|
+
/** What placement reads of a deck's layers (see `PlacementLayer.getPlacementRoot`). */
|
|
124
|
+
export type PlacementDeckLayer = {
|
|
125
|
+
id: string;
|
|
126
|
+
parent?: unknown;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Places the symbols of every registered label layer together, as MapLibre GL JS's `Placement`:
|
|
130
|
+
* greedily, style layers from the top down, each against the symbols placed before it in a grid
|
|
131
|
+
* over the viewport. Each symbol's text and icon visibility is written to a texture that the label
|
|
132
|
+
* sublayers read (`LabelPlacementExtension`), one per viewport id. Placement runs from the label
|
|
133
|
+
* sublayers' draw: at most every `interval` ms while the view keeps moving, and at once when the
|
|
134
|
+
* view is at rest and the labels or the view changed since the last placement.
|
|
135
|
+
*/
|
|
136
|
+
export declare class LabelPlacement {
|
|
137
|
+
interval: number;
|
|
138
|
+
/** Each layer's slots, and the allocation that gave them (see `getSlotLayout`). */
|
|
139
|
+
private readonly layers;
|
|
140
|
+
private readonly views;
|
|
141
|
+
private capacity;
|
|
142
|
+
/** Counts the slot allocations made. */
|
|
143
|
+
private allocations;
|
|
144
|
+
/** Changes when a layer joins, leaves or moves its slots. */
|
|
145
|
+
private version;
|
|
146
|
+
private readonly symbols;
|
|
147
|
+
/** Each layer's state at the frame being placed, in registration order (see `getRevision`). */
|
|
148
|
+
private readonly states;
|
|
149
|
+
/** The index of each top-level deck layer, by id, in the deck's layers last read. */
|
|
150
|
+
private rootIndices;
|
|
151
|
+
/**
|
|
152
|
+
* Adds a layer, or updates its slot count; returns its slot base. A layer that needs more slots
|
|
153
|
+
* than it has takes the first free ones that are enough, and gives up its own. No other layer
|
|
154
|
+
* moves: each draws from the slots it read at its last update, until it updates again.
|
|
155
|
+
*/
|
|
156
|
+
register(layer: PlacementLayer): number;
|
|
157
|
+
unregister(layer: PlacementLayer): void;
|
|
158
|
+
/** The slot base of a registered layer, or -1. */
|
|
159
|
+
getSlotBase(layer: PlacementLayer): number;
|
|
160
|
+
/**
|
|
161
|
+
* The first `count` slots that no layer but `growing` uses, past the last layer's slots when no
|
|
162
|
+
* gap between them is enough. The textures grow to hold them, keeping every slot's visibility.
|
|
163
|
+
*/
|
|
164
|
+
private allocate;
|
|
165
|
+
private getView;
|
|
166
|
+
/**
|
|
167
|
+
* The visibility texture for `viewport`, placing first when a placement is due. `frame` names the
|
|
168
|
+
* frame being drawn (deck.gl's timeline time; each call is a frame of its own without it): the
|
|
169
|
+
* label sublayers of a frame all draw with the placement decided at its first one. Picking passes
|
|
170
|
+
* read the last placement and never place.
|
|
171
|
+
*/
|
|
172
|
+
prepare(device: Device, viewport: Viewport, isPicking: boolean, now: number, frame?: number): Texture;
|
|
173
|
+
/**
|
|
174
|
+
* A value that changes whenever what would be placed in `viewport` changes, other than the view:
|
|
175
|
+
* a layer joins or leaves, its symbols change, it is drawn in the viewport or no longer is, or
|
|
176
|
+
* its deck layer moves among the deck's layers. Reads each layer's state for `place`.
|
|
177
|
+
*/
|
|
178
|
+
private getRevision;
|
|
179
|
+
/** The index of a layer's deck layer among the deck's layers, or -1. */
|
|
180
|
+
private getRootIndex;
|
|
181
|
+
/**
|
|
182
|
+
* A value that changes whenever a layer's symbols take other slots: the layer is given new ones,
|
|
183
|
+
* by an allocation of its own (a layer that takes the slots another left has another), or its
|
|
184
|
+
* rows change.
|
|
185
|
+
*/
|
|
186
|
+
private getSlotLayout;
|
|
187
|
+
private getTexture;
|
|
188
|
+
/** Places every registered layer's symbols for `viewport`. */
|
|
189
|
+
private place;
|
|
190
|
+
/**
|
|
191
|
+
* The layers drawn in the viewport of the last `getRevision`, in the order they are placed: under
|
|
192
|
+
* the later deck layer first, then by placement order, highest first (see
|
|
193
|
+
* `PlacementLayer.getPlacementRoot`). Layers that tie keep the order they registered in.
|
|
194
|
+
*/
|
|
195
|
+
private getPlacementOrder;
|
|
196
|
+
/** Releases the textures. */
|
|
197
|
+
destroy(): void;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Takes a use of the placement shared by the label layers of the deck that `key` names (its layer
|
|
201
|
+
* manager), made at the first use. Each use is given back with `releaseSharedLabelPlacement`.
|
|
202
|
+
*/
|
|
203
|
+
export declare function acquireSharedLabelPlacement(key: object): LabelPlacement;
|
|
204
|
+
/** Gives back a use of a deck's shared placement, which is released with its last use. */
|
|
205
|
+
export declare function releaseSharedLabelPlacement(key: object | null | undefined): void;
|
|
206
|
+
/** The key of the shared placement of a layer's deck: its layer manager. */
|
|
207
|
+
export declare function getSharedLabelPlacementKey(layer: {
|
|
208
|
+
context?: unknown;
|
|
209
|
+
}): object;
|
|
210
|
+
/** Props that `LabelPlacementExtension` adds to a label sublayer. */
|
|
211
|
+
export type LabelPlacementExtensionProps = {
|
|
212
|
+
/** The placement that decides which symbols are drawn; all are drawn without it. */
|
|
213
|
+
labelPlacement?: LabelPlacement | null;
|
|
214
|
+
/** The slot of each object; a negative slot is always drawn. */
|
|
215
|
+
getPlacementSlot?: (object: any, info: {
|
|
216
|
+
index: number;
|
|
217
|
+
}) => number;
|
|
218
|
+
/** Which visibility the sublayer draws by: its symbols' text (0) or icons (1). */
|
|
219
|
+
placementPart?: 0 | 1;
|
|
220
|
+
};
|
|
221
|
+
/**
|
|
222
|
+
* Draws a label sublayer's objects only where `labelPlacement` placed their part (text or icon):
|
|
223
|
+
* each object's slot is an attribute (`getPlacementSlot`), and the vertex shader reads its
|
|
224
|
+
* visibility from the placement's texture for the viewport being drawn. Added to a composite layer
|
|
225
|
+
* such as `TextLayer`, it reaches the character and background sublayers, so a hidden label is
|
|
226
|
+
* neither drawn nor picked. WebGL only.
|
|
227
|
+
*/
|
|
228
|
+
export declare class LabelPlacementExtension extends LayerExtension {
|
|
229
|
+
static extensionName: string;
|
|
230
|
+
static defaultProps: {
|
|
231
|
+
labelPlacement: {
|
|
232
|
+
type: string;
|
|
233
|
+
value: null;
|
|
234
|
+
compare: boolean;
|
|
235
|
+
};
|
|
236
|
+
getPlacementSlot: {
|
|
237
|
+
type: string;
|
|
238
|
+
value: number;
|
|
239
|
+
};
|
|
240
|
+
placementPart: number;
|
|
241
|
+
};
|
|
242
|
+
isEnabled(layer: Layer): boolean;
|
|
243
|
+
getShaders(this: Layer<LabelPlacementExtensionProps>, extension: this): any;
|
|
244
|
+
initializeState(this: Layer<LabelPlacementExtensionProps>, context: any, extension: this): void;
|
|
245
|
+
updateState(this: Layer<LabelPlacementExtensionProps>, params: any, extension: this): void;
|
|
246
|
+
draw(this: Layer<LabelPlacementExtensionProps>, params: any, extension: this): void;
|
|
247
|
+
}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { TextLayer, _MultiIconLayer as MultiIconLayer } from '@deck.gl/layers';
|
|
2
|
+
import type { TextLayerProps } from '@deck.gl/layers';
|
|
3
|
+
import type { Accessor, Attribute, DefaultProps, FilterContext } from '@deck.gl/core';
|
|
4
|
+
import { Buffer } from '@luma.gl/core';
|
|
5
|
+
import type { Texture } from '@luma.gl/core';
|
|
6
|
+
import { SharedTextureSet } from "./shared-texture.js";
|
|
7
|
+
/** `text-justify`: `auto` aligns the lines of a label by its text anchor, as `TextLayer` does. */
|
|
8
|
+
export type LabelTextJustify = 'auto' | 'left' | 'center' | 'right';
|
|
9
|
+
/** Where each character of a label is drawn, as `TextLayer`'s `transformParagraph` returns it. */
|
|
10
|
+
export type ParagraphLayout = {
|
|
11
|
+
/** Character positions in the row, in font atlas pixels. */
|
|
12
|
+
x: number[];
|
|
13
|
+
y: number[];
|
|
14
|
+
/** Width of each character's row. */
|
|
15
|
+
rowWidth: number[];
|
|
16
|
+
/** Width and height of the label box. */
|
|
17
|
+
size: [number, number];
|
|
18
|
+
};
|
|
19
|
+
type _LabelTextLayerProps<DataT> = {
|
|
20
|
+
/** Space added after each character but the last of a line, in ems of the text size. */
|
|
21
|
+
getLetterSpacing?: Accessor<DataT, number>;
|
|
22
|
+
/** How the lines of a label are aligned within its box. */
|
|
23
|
+
getTextJustify?: Accessor<DataT, LabelTextJustify>;
|
|
24
|
+
/**
|
|
25
|
+
* Where each glyph of a label along a line is drawn in a viewport (see {@link LineGlyphPlacement}),
|
|
26
|
+
* or null to draw the label straight, turned by `getAngle`. Null for every label draws them all
|
|
27
|
+
* straight. Its update trigger is `updateTriggers.getLineGlyphs`. WebGL only.
|
|
28
|
+
*/
|
|
29
|
+
getLineGlyphs?: ((object: DataT, viewport: any) => Float32Array | null) | null;
|
|
30
|
+
/**
|
|
31
|
+
* What `getLineGlyphs` depends on in the viewport: the glyphs are placed again when it changes,
|
|
32
|
+
* as the layer draws.
|
|
33
|
+
*/
|
|
34
|
+
getLineGlyphKey?: ((viewport: any) => string) | null;
|
|
35
|
+
/**
|
|
36
|
+
* Mip levels of the font atlas texture (see `LABEL_ATLAS_MIP_LEVELS`). 1 samples the atlas
|
|
37
|
+
* without mipmaps, as MapLibre GL JS samples its 24 px glyphs.
|
|
38
|
+
*/
|
|
39
|
+
atlasMipLevels?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Whether the glyph edge is smoothed no more than `fontSettings.smoothing`, which keeps small
|
|
42
|
+
* text from the 64 px label font atlas crisp. False smooths it as MapLibre GL JS smooths its
|
|
43
|
+
* 24 px glyphs, which is wider on small text.
|
|
44
|
+
*/
|
|
45
|
+
edgeGammaCapped?: boolean;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* `getLineGlyphs` of a label: 4 values per character, `dx, dy, angle, mode`. With mode 1 the
|
|
49
|
+
* character's advance centre is drawn `dx, dy` pixels from the label's position (y down), turned by
|
|
50
|
+
* `angle` degrees counter-clockwise, and `getPixelOffset` is not added; with mode -1 the label is not
|
|
51
|
+
* drawn; with mode 0 it is drawn straight.
|
|
52
|
+
*/
|
|
53
|
+
export type LineGlyphPlacement = Float32Array;
|
|
54
|
+
export type LabelTextLayerProps<DataT = unknown> = _LabelTextLayerProps<DataT> & TextLayerProps<DataT>;
|
|
55
|
+
/**
|
|
56
|
+
* Spaces and justifies the lines of a label laid out by `TextLayer`, as MapLibre shapes text:
|
|
57
|
+
* `spacing` atlas pixels follow each character of a line but the last, the label box widens to the
|
|
58
|
+
* widest line, and each line is placed at `justify` across the box (0 left, 0.5 center, 1 right).
|
|
59
|
+
* `TextLayer` places each line at the text anchor's position, `anchor`, so a line is shifted by
|
|
60
|
+
* `(justify - anchor)` times the space it leaves in the box. `layout` is returned as is when
|
|
61
|
+
* neither changes it.
|
|
62
|
+
*/
|
|
63
|
+
export declare function spaceParagraph(layout: ParagraphLayout, text: string, spacing: number, justify: number, anchor: number): ParagraphLayout;
|
|
64
|
+
/** A label's packed character definitions and the inputs they were made from. */
|
|
65
|
+
type CachedIconDefs = {
|
|
66
|
+
text: string;
|
|
67
|
+
offsets: number[];
|
|
68
|
+
iconAtlas: unknown;
|
|
69
|
+
iconMapping: unknown;
|
|
70
|
+
defs: Float32Array;
|
|
71
|
+
};
|
|
72
|
+
/** The glyphs along lines of a view other than the one the glyph attribute holds. */
|
|
73
|
+
type ViewLineGlyphs = {
|
|
74
|
+
/** The `getLineGlyphKey` they were placed for. */
|
|
75
|
+
key: string;
|
|
76
|
+
/** The glyph attribute revision they were placed at. */
|
|
77
|
+
revision: number;
|
|
78
|
+
values: Float32Array;
|
|
79
|
+
buffer: Buffer;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Half the width, in device pixels, over which MapLibre GL JS antialiases the edges of glyphs and
|
|
83
|
+
* of their halos: its symbol shader's `EDGE_GAMMA` (0.105 / device pixel ratio) of a distance
|
|
84
|
+
* field that falls by 1/8 per glyph pixel, scaled with the text.
|
|
85
|
+
*/
|
|
86
|
+
export declare const LABEL_EDGE_DEVICE_PIXELS = 0.84;
|
|
87
|
+
/**
|
|
88
|
+
* How much the view shortens screen y for the labels of a layer, against screen x: the cosine of a
|
|
89
|
+
* `MapView`'s pitch for labels that lie on the map, which it tilts about screen x, as MapLibre's
|
|
90
|
+
* `u_gamma_scale`. Billboards face the screen, and other views tilt otherwise (a `FirstPersonView`
|
|
91
|
+
* measures its pitch from the horizon): their labels are taken as unforeshortened, 1.
|
|
92
|
+
*/
|
|
93
|
+
export declare function getLabelForeshortening(viewport: unknown, billboard: boolean): number;
|
|
94
|
+
/**
|
|
95
|
+
* The character layer of a `LabelTextLayer`. `TextLayer` packs, for every character of every
|
|
96
|
+
* label, its place in the font atlas and its offset in the label, whenever the layer's data
|
|
97
|
+
* changes. The packed values of each label are kept, and reused while its text, character offsets
|
|
98
|
+
* and font atlas are the same, so the labels a layer held before are not packed again.
|
|
99
|
+
*
|
|
100
|
+
* On WebGL it antialiases glyph and halo edges as MapLibre GL JS (see `LABEL_SDF_EDGES`). The
|
|
101
|
+
* WebGPU shader is `MultiIconLayer`'s.
|
|
102
|
+
*/
|
|
103
|
+
/** @internal Exported for tests. */
|
|
104
|
+
export declare class LabelCharactersLayer extends MultiIconLayer<any> {
|
|
105
|
+
static layerName: string;
|
|
106
|
+
static defaultProps: DefaultProps<any>;
|
|
107
|
+
state: MultiIconLayer<any>['state'] & {
|
|
108
|
+
/** Each label's packed character definitions, by label object. */
|
|
109
|
+
iconDefs?: WeakMap<object, CachedIconDefs>;
|
|
110
|
+
/**
|
|
111
|
+
* The view whose glyphs along lines the glyph attribute holds, and the `getLineGlyphKey` they
|
|
112
|
+
* were placed for (null when some rows were placed for another).
|
|
113
|
+
*/
|
|
114
|
+
lineGlyphView?: {
|
|
115
|
+
id: string;
|
|
116
|
+
key: string | null;
|
|
117
|
+
};
|
|
118
|
+
/** Glyphs along lines of the other views drawn, by view id, least recently drawn first. */
|
|
119
|
+
lineGlyphViews?: Map<string, ViewLineGlyphs>;
|
|
120
|
+
/** Counts the glyph attribute's updates, after which the other views' glyphs are placed again. */
|
|
121
|
+
lineGlyphRevision?: number;
|
|
122
|
+
};
|
|
123
|
+
/** Whether characters can be placed along lines: on WebGL, whose shader this layer extends. */
|
|
124
|
+
drawsLineGlyphs(): boolean;
|
|
125
|
+
/** Glyph and halo edges as MapLibre GL JS, then, on WebGL, glyphs along lines. */
|
|
126
|
+
getShaders(): any;
|
|
127
|
+
initializeState(): void;
|
|
128
|
+
updateState(params: any): void;
|
|
129
|
+
/**
|
|
130
|
+
* Places the glyphs along lines again before drawing when the view has moved to another zoom or
|
|
131
|
+
* bearing step (`getLineGlyphKey`). The rows and every other attribute stay as they are. A layer
|
|
132
|
+
* drawn in several views, as a main map and a minimap, keeps the glyphs of each: the attribute
|
|
133
|
+
* holds one view's, the others are kept in buffers of their own, bound in their place as each
|
|
134
|
+
* view is drawn.
|
|
135
|
+
*/
|
|
136
|
+
draw(params: any): void;
|
|
137
|
+
/**
|
|
138
|
+
* The glyphs along lines of view `id`, which the glyph attribute does not hold: kept while its
|
|
139
|
+
* key and the attribute's rows are the same, placed again and uploaded otherwise.
|
|
140
|
+
*/
|
|
141
|
+
getViewLineGlyphs(attribute: Attribute, id: string, key: string): ViewLineGlyphs;
|
|
142
|
+
finalizeState(context: any): void;
|
|
143
|
+
/** Releases the glyphs along lines kept for views other than the attribute's. */
|
|
144
|
+
forgetViewLineGlyphs(): void;
|
|
145
|
+
/** Each character's `getLineGlyphs` values; a constant when no label is placed along a line. */
|
|
146
|
+
protected calculateInstanceLineGlyphs(attribute: Attribute, { startRow, endRow }: {
|
|
147
|
+
startRow: number;
|
|
148
|
+
endRow: number;
|
|
149
|
+
}): void;
|
|
150
|
+
/**
|
|
151
|
+
* Writes the `getLineGlyphs` values of rows `startRow` to `endRow` at the current viewport, into
|
|
152
|
+
* `output`, laid out as the attribute: by default, its value.
|
|
153
|
+
*/
|
|
154
|
+
fillLineGlyphs(attribute: Attribute, startRow: number, endRow: number, output?: Float32Array): void;
|
|
155
|
+
/**
|
|
156
|
+
* Each character's advance centre in the label, in font atlas pixels, about which a glyph along a
|
|
157
|
+
* line turns: its offset in the label, less its frame's anchor, plus half its advance.
|
|
158
|
+
*/
|
|
159
|
+
protected calculateInstanceGlyphCentres(attribute: Attribute, { startRow, endRow }: {
|
|
160
|
+
startRow: number;
|
|
161
|
+
endRow: number;
|
|
162
|
+
}): void;
|
|
163
|
+
protected calculateInstanceIconDefs(attribute: Attribute, { startRow, endRow }: {
|
|
164
|
+
startRow: number;
|
|
165
|
+
endRow: number;
|
|
166
|
+
}): void;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Glyph attribute work for benchmarks: rows filled and bytes written from `getLineGlyphs`, and
|
|
170
|
+
* refreshes of the whole attribute when the view crosses a zoom or bearing step.
|
|
171
|
+
*/
|
|
172
|
+
export declare const LINE_GLYPH_ATTRIBUTE_STATS: {
|
|
173
|
+
fills: number;
|
|
174
|
+
bytes: number;
|
|
175
|
+
refreshes: number;
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* A `TextLayer` with MapLibre's `text-letter-spacing` and `text-justify`. Both change where the
|
|
179
|
+
* characters are drawn and the label box, which the background, and so the collision box, covers.
|
|
180
|
+
* The box is recomputed when the `getText` (letter spacing) or `getTextAnchor` (justification)
|
|
181
|
+
* update triggers change.
|
|
182
|
+
*
|
|
183
|
+
* It draws its glyphs from a font atlas texture shared with every other label layer of the same
|
|
184
|
+
* atlas. `TextLayer` hands its glyph layer the atlas canvas, from which deck.gl creates and uploads
|
|
185
|
+
* a texture per layer: one per label sublayer of every tile.
|
|
186
|
+
*/
|
|
187
|
+
export declare class LabelTextLayer<DataT = any, ExtraPropsT extends {} = {}> extends TextLayer<DataT, ExtraPropsT & Required<_LabelTextLayerProps<DataT>>> {
|
|
188
|
+
static layerName: string;
|
|
189
|
+
static defaultProps: DefaultProps<LabelTextLayerProps<unknown>>;
|
|
190
|
+
state: TextLayer<DataT>['state'] & {
|
|
191
|
+
atlasTextures?: SharedTextureSet;
|
|
192
|
+
/** The shared texture of the current font atlas, which the glyph layer draws from. */
|
|
193
|
+
atlasTexture?: Texture;
|
|
194
|
+
/** Each label's layout, by label object (see `transformParagraph`). */
|
|
195
|
+
layouts?: WeakMap<object, CachedLayout>;
|
|
196
|
+
};
|
|
197
|
+
initializeState(): void;
|
|
198
|
+
renderLayers(): any;
|
|
199
|
+
/** Its characters are drawn by a `LabelCharactersLayer`. */
|
|
200
|
+
getSubLayerClass(subLayerId: string, DefaultLayerClass: any): any;
|
|
201
|
+
/**
|
|
202
|
+
* The glyph layer's props, with the shared texture in place of the atlas canvas, and the row's
|
|
203
|
+
* placement slot (see `LabelPlacementExtension`).
|
|
204
|
+
*/
|
|
205
|
+
getSubLayerProps(sublayerProps?: any): any;
|
|
206
|
+
/**
|
|
207
|
+
* A transparent background without a border draws nothing on screen: it only marks the labels in
|
|
208
|
+
* the collision map and the picking buffer. It is left out of the screen pass, which saves a draw
|
|
209
|
+
* per label layer and frame.
|
|
210
|
+
*/
|
|
211
|
+
filterSubLayer({ layer, renderPass, isPicking }: FilterContext): boolean;
|
|
212
|
+
/**
|
|
213
|
+
* Whether the background box is a constant transparent color without a border, no transition
|
|
214
|
+
* fades it out, and no highlight colors it.
|
|
215
|
+
*/
|
|
216
|
+
hasInvisibleBackground(): boolean;
|
|
217
|
+
finalizeState(context: any): void;
|
|
218
|
+
}
|
|
219
|
+
/** A label's layout and every input it was computed from (see `transformParagraph`). */
|
|
220
|
+
type CachedLayout = {
|
|
221
|
+
text: string;
|
|
222
|
+
letterSpacing: number;
|
|
223
|
+
justify: unknown;
|
|
224
|
+
anchor: unknown;
|
|
225
|
+
atlas: unknown;
|
|
226
|
+
lineHeight: number;
|
|
227
|
+
wordBreak: unknown;
|
|
228
|
+
maxWidth: number;
|
|
229
|
+
layout: ParagraphLayout;
|
|
230
|
+
};
|
|
231
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { LayerExtension } from '@deck.gl/core';
|
|
2
|
+
import type { Layer, UpdateParameters } from '@deck.gl/core';
|
|
3
|
+
import type { ShaderModule } from '@luma.gl/shadertools';
|
|
4
|
+
export type LineBlurExtensionOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* Reads `getBlur` per path, from an attribute. Otherwise `getBlur` must be a constant, which a
|
|
7
|
+
* uniform carries: a `PathLayer` with `PathStyleExtension`'s path dashes and offsets already
|
|
8
|
+
* uses all 16 vertex attributes that WebGL2 guarantees, and does not link with one more.
|
|
9
|
+
*/
|
|
10
|
+
perFeature: boolean;
|
|
11
|
+
};
|
|
12
|
+
type LineBlurProps = {
|
|
13
|
+
blur: number;
|
|
14
|
+
gapOffset: number;
|
|
15
|
+
gapSide: number;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Adds `getBlur` to the `PathLayer`s of a layer drawn with `antialiasing` (for a `GeoJsonLayer`,
|
|
19
|
+
* `lineAntialiasing`): per path, the CSS pixels over which the edges fade out, as MapLibre GL JS
|
|
20
|
+
* draws `line-blur`, and, with a blur of 0, every line's antialiasing. MapLibre fades each edge
|
|
21
|
+
* linearly from the edge, which its antialiasing moves out by half a device pixel, to `blur` plus
|
|
22
|
+
* one device pixel inside it. On deck.gl's antialiased stroke alone, that fade leaves a line
|
|
23
|
+
* narrower than a pixel too faint, so lines without an offset (which is measured in widths) are
|
|
24
|
+
* drawn half a device pixel wider on each side, with their dashes scaled back to the line's width,
|
|
25
|
+
* and faded from their own edge. The fade follows round caps and joins, as in MapLibre. Other
|
|
26
|
+
* sublayers, and
|
|
27
|
+
* layers drawn without `antialiasing`, are left unchanged. WebGL only; on WebGPU lines draw
|
|
28
|
+
* without blur.
|
|
29
|
+
*
|
|
30
|
+
* `blurGapSide` serves the two lines of a `line-gap-width`, drawn with `PathStyleExtension`'s
|
|
31
|
+
* offsets: 1 or -1, the side of the gap's center that this line is on (as `getLineOffset`'s
|
|
32
|
+
* `side`), with `blurGapOffset` the CSS pixels of the gap's center from the path (`line-offset`).
|
|
33
|
+
* The line draws nothing past the gap's center, so that where a blur wider than half the gap makes
|
|
34
|
+
* the two lines overlap, their fades do not draw over each other. MapLibre draws the gap as one
|
|
35
|
+
* stroke whose fade is symmetric about its center, so each line draws its half. The default 0
|
|
36
|
+
* clips nothing, and neither does a path whose gap is 0: its one line is centered on the gap's
|
|
37
|
+
* center (`getLineOffset`), which the shader tells per path from the offset and width it already
|
|
38
|
+
* has, so a gap that is 0 at a zoom or for a feature needs no attribute of its own.
|
|
39
|
+
*/
|
|
40
|
+
export declare class LineBlurExtension extends LayerExtension<LineBlurExtensionOptions> {
|
|
41
|
+
static extensionName: string;
|
|
42
|
+
static defaultProps: {
|
|
43
|
+
getBlur: {
|
|
44
|
+
type: string;
|
|
45
|
+
value: number;
|
|
46
|
+
};
|
|
47
|
+
blurGapSide: number;
|
|
48
|
+
blurGapOffset: number;
|
|
49
|
+
};
|
|
50
|
+
constructor({ perFeature }?: Partial<LineBlurExtensionOptions>);
|
|
51
|
+
initializeState(this: Layer, context: unknown, extension: this): void;
|
|
52
|
+
updateState(this: Layer<any>, params: UpdateParameters<Layer<any>>, extension: this): void;
|
|
53
|
+
getShaders(this: Layer, extension: this): {
|
|
54
|
+
modules?: undefined;
|
|
55
|
+
defines?: undefined;
|
|
56
|
+
} | {
|
|
57
|
+
modules: ShaderModule<LineBlurProps>[];
|
|
58
|
+
defines: {
|
|
59
|
+
LINE_BLUR_PER_FEATURE: boolean;
|
|
60
|
+
} | {
|
|
61
|
+
LINE_BLUR_PER_FEATURE?: undefined;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The width to draw each of a gap's two lines with, so that their fades fall where MapLibre's do:
|
|
67
|
+
* MapLibre draws the two lines as one stroke whose inner edges fade into the gap and whose outer
|
|
68
|
+
* edges fade inward, each over the same `blur`. Drawing each line `blur` wider, and `blur / 2`
|
|
69
|
+
* closer to the gap (see `getLineOffset`), turns that into a fade inward from both of the line's
|
|
70
|
+
* edges. Lines without a gap, or without width, keep their width.
|
|
71
|
+
*/
|
|
72
|
+
export declare function getBlurredLineWidth(width: number, gapWidth: number, blur: number): number;
|
|
73
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Glyphs of a label along a line, each placed on the line and turned to the segment it lands on,
|
|
3
|
+
* as MapLibre GL JS's `placeGlyphsAlongLine`, `placeFirstAndLastGlyph` and `placeGlyphAlongLine`
|
|
4
|
+
* (symbol/projection.ts) place them in the label plane. Here the label plane is the map plane at
|
|
5
|
+
* the current zoom: the line, measured in pixels at the placement zoom, is scaled about the anchor.
|
|
6
|
+
*
|
|
7
|
+
* Coordinates are pixels with y pointing down. Angles returned are counter-clockwise on screen, in
|
|
8
|
+
* degrees, as deck.gl's `getAngle` takes them.
|
|
9
|
+
*/
|
|
10
|
+
/** A line a label is placed along, and where on it the label's anchor lies. */
|
|
11
|
+
export type LabelLine = {
|
|
12
|
+
/** The line's vertices, `x, y` pairs in pixels at the placement zoom. */
|
|
13
|
+
points: ArrayLike<number>;
|
|
14
|
+
/** The segment the anchor lies on: from vertex `segment` to `segment + 1`. */
|
|
15
|
+
segment: number;
|
|
16
|
+
/** The anchor's position along that segment, from 0 to 1. */
|
|
17
|
+
t: number;
|
|
18
|
+
};
|
|
19
|
+
export type LineGlyphOptions = {
|
|
20
|
+
/**
|
|
21
|
+
* Each glyph's advance centre along the label, in pixels at the current zoom, from the anchor
|
|
22
|
+
* (MapLibre's `glyphOffsetArray` times the font scale).
|
|
23
|
+
*/
|
|
24
|
+
offsets: ArrayLike<number>;
|
|
25
|
+
/** The label's `text-offset` in pixels: along the line, and across it (MapLibre's `lineOffset`). */
|
|
26
|
+
lineOffsetX?: number;
|
|
27
|
+
lineOffsetY?: number;
|
|
28
|
+
/** Pixels at the current zoom per pixel of `line.points`. */
|
|
29
|
+
scale: number;
|
|
30
|
+
/** Whether the label reads against the line's direction (turned upright). */
|
|
31
|
+
flip: boolean;
|
|
32
|
+
};
|
|
33
|
+
/** Where each glyph of a label is drawn, from the anchor, and the path its collision follows. */
|
|
34
|
+
export type LineGlyphs = {
|
|
35
|
+
/** For each glyph: `dx, dy` in pixels from the anchor, and its angle. */
|
|
36
|
+
glyphs: Float32Array;
|
|
37
|
+
/**
|
|
38
|
+
* The path from the first glyph to the last along the line, `x, y` pairs in pixels from the
|
|
39
|
+
* anchor, as MapLibre builds the collision circles of a label along a line.
|
|
40
|
+
*/
|
|
41
|
+
path: number[];
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Places each glyph of a label along `line`, as MapLibre GL JS draws text along a line. Returns
|
|
45
|
+
* null when the first or the last glyph does not fit on the line: MapLibre then hides the label.
|
|
46
|
+
* `flip` is decided by the caller (see {@link needsFlip}); MapLibre's own flip test is on screen.
|
|
47
|
+
*/
|
|
48
|
+
export declare function placeLineGlyphs(line: LabelLine, options: LineGlyphOptions): LineGlyphs | null;
|
|
49
|
+
/**
|
|
50
|
+
* MapLibre's `requiresOrientationChange` for horizontal text: whether a label placed unflipped reads
|
|
51
|
+
* right to left on screen, its first glyph right of its last, on a flat map turned by `bearing`.
|
|
52
|
+
*/
|
|
53
|
+
export declare function needsFlip(unflipped: LineGlyphs, bearing: number): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Collision circles along a path on screen, as MapLibre GL JS's `placeCollisionCircles` lays them
|
|
56
|
+
* out with its `PathInterpolator`: the path's ends inset by a quarter radius, circles at most 2.5
|
|
57
|
+
* radii apart, and one circle on a path shorter than half a radius (or at the middle of the path
|
|
58
|
+
* for a radius of 0). Returns `x, y, radius` triples.
|
|
59
|
+
*/
|
|
60
|
+
export declare function getPathCircles(path: ArrayLike<number>, radius: number): number[];
|