@tomtom-org/maps-sdk-plugin-landmarks-3d 0.0.13 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -9
- package/THIRD_PARTY.txt +1 -1
- package/dist/THIRD_PARTY.txt +1 -1
- package/dist/basis_transcoder.js +19 -0
- package/dist/basis_transcoder.wasm +0 -0
- package/dist/bundledTranscoder-CUVU7Ihm.js +1 -0
- package/dist/index.d.ts +675 -68
- package/dist/index.es.js +1 -1
- package/dist/third-party.json +1 -1
- package/package.json +13 -12
- package/dist/bundledTranscoder-Dn27cuYm.js +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,24 +1,554 @@
|
|
|
1
|
-
import { TomTomMap } from "@tomtom-org/maps-sdk/map";
|
|
1
|
+
import { KnobConfigOf, KnobEntry, KnobRange, KnobValueOf, TomTomMap } from "@tomtom-org/maps-sdk/map";
|
|
2
2
|
import { CustomLayerInterface, CustomRenderMethodInput, Map } from "maplibre-gl";
|
|
3
|
-
import { AmbientLight, Camera, DirectionalLight, Group, Mesh, Scene, ShaderMaterial, Texture, WebGLRenderer } from "three";
|
|
4
|
-
//#region src/
|
|
3
|
+
import { AmbientLight, Camera, DirectionalLight, Group, IUniform, Mesh, Object3D, Scene, ShaderMaterial, Texture, Vector3, WebGLRenderer } from "three";
|
|
4
|
+
//#region src/buildings/buildingsKnobCatalogue.d.ts
|
|
5
5
|
/**
|
|
6
|
-
* How
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
|
|
6
|
+
* How the windows of a facade are laid out. `mixed` picks one per building, by its height: punched
|
|
7
|
+
* windows on low ones, office bands from about six storeys and glass curtain walls on towers.
|
|
8
|
+
*
|
|
9
|
+
* @group Buildings 3D
|
|
10
|
+
*/
|
|
11
|
+
export declare const facadePatterns: readonly ["mixed", "residential", "office", "glass", "plain"];
|
|
12
|
+
/**
|
|
13
|
+
* One of {@link facadePatterns}.
|
|
14
|
+
*
|
|
15
|
+
* @group Buildings 3D
|
|
16
|
+
*/
|
|
17
|
+
type FacadePattern = (typeof facadePatterns)[number];
|
|
18
|
+
/**
|
|
19
|
+
* The looks the unset knobs take: one per standard style, or `auto`, which follows the map's style.
|
|
20
|
+
*
|
|
21
|
+
* @group Buildings 3D
|
|
22
|
+
*/
|
|
23
|
+
export declare const buildingsPresets: readonly ["auto", "streetLight", "streetDark", "streetLightDriving", "streetDarkDriving", "monoLight", "monoDark", "streetSatellite"];
|
|
24
|
+
/**
|
|
25
|
+
* One of {@link buildingsPresets}.
|
|
26
|
+
*
|
|
27
|
+
* @group Buildings 3D
|
|
28
|
+
*/
|
|
29
|
+
type BuildingsPreset = (typeof buildingsPresets)[number];
|
|
30
|
+
declare const buildingsKnobDefinitions: {
|
|
31
|
+
readonly visible: {
|
|
32
|
+
readonly kind: "toggle";
|
|
33
|
+
readonly description: "The 3D buildings.";
|
|
34
|
+
readonly default: true;
|
|
35
|
+
};
|
|
36
|
+
readonly preset: {
|
|
37
|
+
readonly kind: "enum";
|
|
38
|
+
readonly description: "Look every unset knob takes: a standard style's, or auto, which follows the map's standard style.";
|
|
39
|
+
readonly options: readonly ["auto", "streetLight", "streetDark", "streetLightDriving", "streetDarkDriving", "monoLight", "monoDark", "streetSatellite"];
|
|
40
|
+
readonly default: "auto";
|
|
41
|
+
};
|
|
42
|
+
readonly opacity: {
|
|
43
|
+
readonly kind: "number";
|
|
44
|
+
readonly description: "Opacity of the buildings, and of the landmarks left unset among them, 0 to 1.";
|
|
45
|
+
readonly range: import("@tomtom-org/maps-sdk/map").KnobRange;
|
|
46
|
+
};
|
|
47
|
+
readonly minZoom: {
|
|
48
|
+
readonly kind: "number";
|
|
49
|
+
readonly description: "Lowest zoom the buildings are drawn at, and the landmarks left unset among them.";
|
|
50
|
+
readonly range: {
|
|
51
|
+
readonly min: 13;
|
|
52
|
+
readonly max: 22;
|
|
53
|
+
readonly step: 1;
|
|
54
|
+
readonly bounds: "hard";
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
readonly 'facade.pattern': {
|
|
58
|
+
readonly kind: "enum";
|
|
59
|
+
readonly description: "How windows are laid out: mixed (by building height), residential, office, glass (curtain walls) or plain (no windows).";
|
|
60
|
+
readonly options: readonly ["mixed", "residential", "office", "glass", "plain"];
|
|
61
|
+
};
|
|
62
|
+
readonly 'facade.intensity': {
|
|
63
|
+
readonly kind: "number";
|
|
64
|
+
readonly description: "How strongly the windows show on the walls, and the landmarks' own texture among the buildings while their texture is detail, 0 (plain walls) to 1.";
|
|
65
|
+
readonly range: import("@tomtom-org/maps-sdk/map").KnobRange;
|
|
66
|
+
};
|
|
67
|
+
readonly 'facade.floorHeightMeters': {
|
|
68
|
+
readonly kind: "number";
|
|
69
|
+
readonly description: "Height of one storey, which spaces the rows of windows. The ground floor is a third taller.";
|
|
70
|
+
readonly range: {
|
|
71
|
+
readonly min: 2.5;
|
|
72
|
+
readonly max: 6;
|
|
73
|
+
readonly step: 0.1;
|
|
74
|
+
readonly bounds: "hard-min";
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
readonly 'walls.color': {
|
|
78
|
+
readonly kind: "color";
|
|
79
|
+
readonly description: "Colour of the walls. Unset: the map style's 3D building colour of each kind of building, following the map colours that restyle them, and the colour of the buildings of no named kind is the one reported. Landmarks left unset among the buildings take it too.";
|
|
80
|
+
};
|
|
81
|
+
readonly 'roofs.color': {
|
|
82
|
+
readonly kind: "color";
|
|
83
|
+
readonly description: "Colour of the roofs. Unset: a shade darker than the walls of each building, and the colour reported is the walls' one.";
|
|
84
|
+
};
|
|
85
|
+
readonly 'windows.color': {
|
|
86
|
+
readonly kind: "color";
|
|
87
|
+
readonly description: "Colour of the window glass.";
|
|
88
|
+
};
|
|
89
|
+
readonly 'reflections.intensity': {
|
|
90
|
+
readonly kind: "number";
|
|
91
|
+
readonly description: "How much the window glass mirrors the street, the facades across it and the sky, and catches the sun, 0 (matte) to 1. Glass curtain walls reflect the most, landmarks a little; the sky's colour is the ambient light's.";
|
|
92
|
+
readonly range: import("@tomtom-org/maps-sdk/map").KnobRange;
|
|
93
|
+
};
|
|
94
|
+
readonly 'litWindows.color': {
|
|
95
|
+
readonly kind: "color";
|
|
96
|
+
readonly description: "Colour of the windows lit from inside.";
|
|
97
|
+
};
|
|
98
|
+
readonly 'litWindows.fraction': {
|
|
99
|
+
readonly kind: "number";
|
|
100
|
+
readonly description: "Share of the windows lit from inside, 0 to 1. The dark presets light some.";
|
|
101
|
+
readonly range: import("@tomtom-org/maps-sdk/map").KnobRange;
|
|
102
|
+
};
|
|
103
|
+
readonly 'litWindows.intensity': {
|
|
104
|
+
readonly kind: "number";
|
|
105
|
+
readonly description: "Brightness of the lit windows, 0 to 1. Pair it with the map effects bloom for a night glow.";
|
|
106
|
+
readonly range: import("@tomtom-org/maps-sdk/map").KnobRange;
|
|
107
|
+
};
|
|
108
|
+
readonly 'light.direction': {
|
|
109
|
+
readonly kind: "number";
|
|
110
|
+
readonly description: "Direction the light comes from, in degrees clockwise from north. Shadows fall the opposite way.";
|
|
111
|
+
readonly range: {
|
|
112
|
+
readonly min: 0;
|
|
113
|
+
readonly max: 359;
|
|
114
|
+
readonly step: 1;
|
|
115
|
+
readonly bounds: "hard";
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
readonly 'light.altitude': {
|
|
119
|
+
readonly kind: "number";
|
|
120
|
+
readonly description: "Height of the light above the horizon, in degrees (90 = overhead); lower casts longer shadows.";
|
|
121
|
+
readonly range: {
|
|
122
|
+
readonly min: 5;
|
|
123
|
+
readonly max: 90;
|
|
124
|
+
readonly step: 1;
|
|
125
|
+
readonly bounds: "hard";
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
readonly 'light.color': {
|
|
129
|
+
readonly kind: "color";
|
|
130
|
+
readonly description: "Colour of the light: the sun on light presets, the moon on dark ones.";
|
|
131
|
+
};
|
|
132
|
+
readonly 'light.intensity': {
|
|
133
|
+
readonly kind: "number";
|
|
134
|
+
readonly description: "Strength of the light, 0 to 1.";
|
|
135
|
+
readonly range: import("@tomtom-org/maps-sdk/map").KnobRange;
|
|
136
|
+
};
|
|
137
|
+
readonly 'ambientLight.color': {
|
|
138
|
+
readonly kind: "color";
|
|
139
|
+
readonly description: "Colour of the light from the sky, which also tints the reflections in the glass.";
|
|
140
|
+
};
|
|
141
|
+
readonly 'ambientLight.intensity': {
|
|
142
|
+
readonly kind: "number";
|
|
143
|
+
readonly description: "Strength of the light from the sky, 0 to 1, which lights the walls in shade.";
|
|
144
|
+
readonly range: import("@tomtom-org/maps-sdk/map").KnobRange;
|
|
145
|
+
};
|
|
146
|
+
readonly 'shadows.visible': {
|
|
147
|
+
readonly kind: "toggle";
|
|
148
|
+
readonly description: "Shadows the buildings and the landmarks among them cast, on each other and on the ground.";
|
|
149
|
+
};
|
|
150
|
+
readonly 'shadows.intensity': {
|
|
151
|
+
readonly kind: "number";
|
|
152
|
+
readonly description: "Darkness of the shadows, 0 to 1.";
|
|
153
|
+
readonly range: import("@tomtom-org/maps-sdk/map").KnobRange;
|
|
154
|
+
};
|
|
155
|
+
readonly 'roadLabels.occluded': {
|
|
156
|
+
readonly kind: "toggle";
|
|
157
|
+
readonly description: "Road names draw under the buildings: hidden wherever a building covers them, they give way to the labels above them.";
|
|
158
|
+
};
|
|
159
|
+
readonly 'pois.occluded': {
|
|
160
|
+
readonly kind: "toggle";
|
|
161
|
+
readonly description: "The style's POIs draw under the buildings: hidden wherever a building covers them, still keeping other labels off, they give way to the labels above them.";
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* The id of a buildings knob, as accepted by the SDK's `setKnob` and as a path into {@link Buildings3DConfig}.
|
|
166
|
+
*
|
|
167
|
+
* @group Buildings 3D
|
|
168
|
+
*/
|
|
169
|
+
type Buildings3DKnobId = keyof typeof buildingsKnobDefinitions;
|
|
170
|
+
type KindOf<ID extends Buildings3DKnobId> = (typeof buildingsKnobDefinitions)[ID]['kind'];
|
|
171
|
+
/**
|
|
172
|
+
* The value type a buildings knob takes.
|
|
173
|
+
*
|
|
174
|
+
* @group Buildings 3D
|
|
175
|
+
*/
|
|
176
|
+
type Buildings3DKnobValueOf<ID extends Buildings3DKnobId> = ID extends 'preset' ? BuildingsPreset : ID extends 'facade.pattern' ? FacadePattern : KnobValueOf<KindOf<ID>>;
|
|
177
|
+
/**
|
|
178
|
+
* One entry of {@link buildings3DKnobCatalogue}, with what a UI or a coding agent needs to offer the
|
|
179
|
+
* knob and validate a value for it. The SDK's `getKnob` reads the value in force.
|
|
180
|
+
*
|
|
181
|
+
* @group Buildings 3D
|
|
182
|
+
*/
|
|
183
|
+
type Buildings3DKnob = KnobEntry<Buildings3DKnobId>;
|
|
184
|
+
/**
|
|
185
|
+
* Every buildings knob with its kind, description, range or options and, for `visible` and `preset`,
|
|
186
|
+
* its default. It's static data, readable without a map.
|
|
187
|
+
*
|
|
188
|
+
* @remarks
|
|
189
|
+
* A knob is a plain value in {@link Buildings3DConfig}, at its id's path. Every knob but `visible` and
|
|
190
|
+
* `preset` takes the preset's value while unset, which the SDK's `getKnob` reports.
|
|
191
|
+
*
|
|
192
|
+
* @group Buildings 3D
|
|
193
|
+
*/
|
|
194
|
+
export declare const buildings3DKnobCatalogue: readonly Buildings3DKnob[];
|
|
195
|
+
/**
|
|
196
|
+
* Every buildings knob id, in catalogue order.
|
|
197
|
+
*
|
|
198
|
+
* @group Buildings 3D
|
|
199
|
+
*/
|
|
200
|
+
export declare const buildings3DKnobIds: readonly Buildings3DKnobId[];
|
|
201
|
+
//#endregion
|
|
202
|
+
//#region src/buildings/buildingsLook.d.ts
|
|
203
|
+
/**
|
|
204
|
+
* The building knobs an app sets, as {@link Buildings3D.getConfig} returns them. Each knob id is its
|
|
205
|
+
* path in here, so `light.direction` is `config.light.direction`. It's plain JSON.
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* ```typescript
|
|
209
|
+
* const config: Buildings3DConfig = { facade: { pattern: 'glass' }, shadows: { intensity: 0.6 } };
|
|
210
|
+
* ```
|
|
211
|
+
*
|
|
212
|
+
* @group Buildings 3D
|
|
213
|
+
*/
|
|
214
|
+
type Buildings3DConfig = KnobConfigOf<{ [ID in Buildings3DKnobId]: Buildings3DKnobValueOf<ID>; }>;
|
|
215
|
+
type Values = { [ID in Buildings3DKnobId]: Buildings3DKnobValueOf<ID>; };
|
|
216
|
+
/**
|
|
217
|
+
* Every knob resolved to the value the buildings are drawn with, plus the per-kind wall colours the
|
|
218
|
+
* walls take while `walls.color` is unset.
|
|
219
|
+
* @ignore
|
|
220
|
+
*/
|
|
221
|
+
type Buildings3DLook = Values & {
|
|
222
|
+
wallColorsByGroup: GroupColors;
|
|
223
|
+
roofsFollowWalls: boolean;
|
|
224
|
+
};
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region src/buildings/glass.d.ts
|
|
227
|
+
/**
|
|
228
|
+
* The scene's light as glass mirrors it, shared by the buildings' material and the landmarks' so both
|
|
229
|
+
* mirror one sky: `eyePosition` in scene metres, the sun's direction and colour, the sky's colour and
|
|
230
|
+
* intensity, and how much glass reflects.
|
|
231
|
+
* @ignore
|
|
232
|
+
*/
|
|
233
|
+
type GlassUniforms = Record<'eyePosition' | 'sunDirection' | 'sunColor' | 'skyColor', IUniform<Vector3>> & Record<'skyIntensity' | 'reflectivity', IUniform<number>>;
|
|
234
|
+
//#endregion
|
|
235
|
+
//#region src/basemapBuildings.d.ts
|
|
236
|
+
/**
|
|
237
|
+
* One colour per kind of {@link BUILDING_GROUPS}, in that order, then the one of every other building.
|
|
238
|
+
* @ignore
|
|
239
|
+
*/
|
|
240
|
+
type GroupColors = readonly string[];
|
|
241
|
+
/**
|
|
242
|
+
* Where the landmark tiles are, for a frame a `Buildings3D` draws them in.
|
|
243
|
+
* @ignore
|
|
244
|
+
*/
|
|
245
|
+
type LandmarksFrame = {
|
|
246
|
+
/** The origin of the tiles, in EPSG:3857 metres: they lie in metres east and north of it, z up. */
|
|
247
|
+
origin: {
|
|
248
|
+
x: number;
|
|
249
|
+
y: number;
|
|
250
|
+
};
|
|
251
|
+
/** Whether the landmarks are translucent, and need a depth prepass. */
|
|
252
|
+
translucent: boolean;
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* A pass a `Buildings3D` draws the landmarks in: in colour, depth only for a depth prepass, or
|
|
256
|
+
* casting their shadows and drawing nothing.
|
|
257
|
+
* @ignore
|
|
258
|
+
*/
|
|
259
|
+
type LandmarksPass = 'color' | 'depth' | 'shadows';
|
|
260
|
+
/**
|
|
261
|
+
* The landmarks of a `Landmarks3D`, as its map's `Buildings3D` draws them: in its own scene, so one
|
|
262
|
+
* sun lights both and each casts its shadows on the other.
|
|
263
|
+
* @ignore
|
|
264
|
+
*/
|
|
265
|
+
type LandmarksForBuildings = {
|
|
266
|
+
/** The landmark tiles. */
|
|
267
|
+
readonly tiles: Object3D;
|
|
268
|
+
/**
|
|
269
|
+
* Readies the tiles for a frame drawn through `mainMatrix`, mirroring a little of the buildings'
|
|
270
|
+
* `glass` light; `undefined` while they don't show.
|
|
271
|
+
*/
|
|
272
|
+
prepareForBuildings(mainMatrix: ArrayLike<number>, glass: GlassUniforms): LandmarksFrame | undefined;
|
|
273
|
+
/** Gives every landmark the materials of one pass. */
|
|
274
|
+
useMaterials(pass: LandmarksPass): void;
|
|
275
|
+
};
|
|
276
|
+
//#endregion
|
|
277
|
+
//#region src/buildings/BuildingsLayer.d.ts
|
|
278
|
+
/**
|
|
279
|
+
* MapLibre custom layer drawing the vector tiles' buildings with Three.js: extruded walls and roofs,
|
|
280
|
+
* procedural windows, a sun with soft shadows on the buildings and the ground, and sky light.
|
|
281
|
+
*
|
|
282
|
+
* It extrudes the buildings of the tiles MapLibre already loaded for the map, so it makes no requests
|
|
283
|
+
* of its own. After changing one of its fields yourself, call `triggerRepaint()` on the MapLibre map.
|
|
284
|
+
*
|
|
285
|
+
* @group Buildings 3D
|
|
286
|
+
*/
|
|
287
|
+
declare class BuildingsLayer implements CustomLayerInterface {
|
|
288
|
+
private readonly landmarksOf;
|
|
289
|
+
readonly id: string;
|
|
290
|
+
readonly type: "custom";
|
|
291
|
+
readonly renderingMode: "3d";
|
|
292
|
+
/** The vector source and source layer the buildings come from. */
|
|
293
|
+
source: {
|
|
294
|
+
id: string;
|
|
295
|
+
layer: string;
|
|
296
|
+
};
|
|
297
|
+
private map?;
|
|
298
|
+
private renderer?;
|
|
299
|
+
private look?;
|
|
300
|
+
private filter;
|
|
301
|
+
private origin?;
|
|
302
|
+
private frame;
|
|
303
|
+
private readonly scene;
|
|
304
|
+
private readonly camera;
|
|
305
|
+
private readonly buildings;
|
|
306
|
+
private readonly landmarks;
|
|
307
|
+
private readonly material;
|
|
308
|
+
private readonly depthOnly;
|
|
309
|
+
private readonly shadowsOnly;
|
|
310
|
+
private readonly sun;
|
|
311
|
+
private readonly sky;
|
|
312
|
+
private readonly groundReach;
|
|
313
|
+
private readonly ground;
|
|
314
|
+
private readonly tiles;
|
|
315
|
+
private pending;
|
|
316
|
+
private extrusion;
|
|
317
|
+
/**
|
|
318
|
+
* @param landmarksOf - The landmarks to draw among the buildings, asked every frame. The buildings
|
|
319
|
+
* they replace stay out in the frames that draw them.
|
|
320
|
+
*/
|
|
321
|
+
constructor(id: string, landmarksOf?: () => LandmarksForBuildings | undefined);
|
|
322
|
+
/** Draws the buildings with this look, from the next frame. */
|
|
323
|
+
setLook(look: Buildings3DLook): void;
|
|
324
|
+
onAdd(map: Map, gl: WebGLRenderingContext | WebGL2RenderingContext): void;
|
|
325
|
+
render(gl: WebGLRenderingContext | WebGL2RenderingContext, options: CustomRenderMethodInput): void;
|
|
326
|
+
private renderTranslucent;
|
|
327
|
+
private useBuildingsPass;
|
|
328
|
+
private placeLandmarks;
|
|
329
|
+
private toScene;
|
|
330
|
+
private updateOrigin;
|
|
331
|
+
private carryTiles;
|
|
332
|
+
private updateTiles;
|
|
333
|
+
private queueTiles;
|
|
334
|
+
private startExtrusion;
|
|
335
|
+
private addTileMesh;
|
|
336
|
+
private removeTileMesh;
|
|
337
|
+
private evictStaleTiles;
|
|
338
|
+
private eyePosition;
|
|
339
|
+
private groundMaterial;
|
|
340
|
+
private updateSun;
|
|
341
|
+
}
|
|
342
|
+
//#endregion
|
|
343
|
+
//#region src/buildings/Buildings3D.d.ts
|
|
344
|
+
/**
|
|
345
|
+
* Draws the base map's buildings in 3D with Three.js, with windows on their facades, a sun or moon
|
|
346
|
+
* that casts shadows on the buildings and the ground, and a look for every standard style.
|
|
347
|
+
*
|
|
348
|
+
* @remarks
|
|
349
|
+
* **[Public Preview](https://docs.tomtom.com/legal/public-preview)** until the plugin's 1.0.0 release.
|
|
350
|
+
*
|
|
351
|
+
* - It extrudes the buildings of the vector tiles the map already loads, and makes no requests of its own.
|
|
352
|
+
* - While it shows, it takes the place of the style's own 3D buildings, which it filters out of the
|
|
353
|
+
* `3D - Building` layer. It draws whether or not the `buildings3D` group of the `BaseMapModule` shows.
|
|
354
|
+
* - Its look is a set of knobs, listed in {@link buildings3DKnobCatalogue}. Each one you leave unset
|
|
355
|
+
* takes the preset's value. The `auto` preset follows the map style: the dark street and mono styles
|
|
356
|
+
* light windows from inside under a moon, the others get a sun and glass that mirrors the street and the sky.
|
|
357
|
+
* - Walls take the style's 3D building colour of each kind of building until you set `walls.color`,
|
|
358
|
+
* following the map colours that restyle them.
|
|
359
|
+
* - On a map with a {@link Landmarks3D}, it leaves out the buildings a landmark replaces and draws the
|
|
360
|
+
* landmarks among its buildings, under its sun and in its shadows, which they cast too. They take its
|
|
361
|
+
* wall colour, opacity and `minZoom` for their unset knobs.
|
|
362
|
+
* Unless their `texture` knob says otherwise, their own textures show as facade detail, as strong as
|
|
363
|
+
* `facade.intensity`. They mirror a little of the street and the sky, as much as `reflections.intensity` sets.
|
|
364
|
+
* - It draws at sea level, so on a 3D terrain hills cover the buildings' lower floors.
|
|
365
|
+
* - With `roadLabels.occluded` or `pois.occluded`, it moves those style layers under its own, so a
|
|
366
|
+
* building drawn over a label hides it. A hidden POI still keeps other labels off its place, and
|
|
367
|
+
* the moved labels give way to the labels above them where they collide.
|
|
368
|
+
*
|
|
369
|
+
* @example
|
|
370
|
+
* ```typescript
|
|
371
|
+
* import { Buildings3D } from '@tomtom-org/maps-sdk-plugin-landmarks-3d';
|
|
372
|
+
*
|
|
373
|
+
* const buildings = new Buildings3D(map, { facade: { pattern: 'glass' } });
|
|
374
|
+
* buildings.updateConfig({ light: { direction: 260, altitude: 15 } }); // a low evening sun
|
|
375
|
+
* ```
|
|
376
|
+
*
|
|
377
|
+
* @group Buildings 3D
|
|
378
|
+
*/
|
|
379
|
+
export declare class Buildings3D {
|
|
380
|
+
private readonly map;
|
|
381
|
+
private readonly buildingsLayer;
|
|
382
|
+
private config;
|
|
383
|
+
private renderedLook;
|
|
384
|
+
private styling;
|
|
385
|
+
private readonly occludedLabels;
|
|
386
|
+
private styleOrder;
|
|
387
|
+
/**
|
|
388
|
+
* Creates the buildings on a map, drawn as soon as the map is ready.
|
|
389
|
+
*
|
|
390
|
+
* @param map - The map to draw the buildings on.
|
|
391
|
+
* @param config - The knobs to start with.
|
|
392
|
+
*/
|
|
393
|
+
constructor(map: TomTomMap, config?: Buildings3DConfig);
|
|
394
|
+
/**
|
|
395
|
+
* The underlying MapLibre custom layer, for advanced use beyond this facade.
|
|
396
|
+
*/
|
|
397
|
+
get layer(): BuildingsLayer;
|
|
398
|
+
/**
|
|
399
|
+
* Returns the knobs set, as a plain serializable copy. The SDK's `getKnob` reads a knob's value
|
|
400
|
+
* in force, the preset's one when unset.
|
|
401
|
+
*/
|
|
402
|
+
getConfig(): Buildings3DConfig;
|
|
403
|
+
/**
|
|
404
|
+
* Replaces the whole configuration. An empty object has every knob take the `auto` preset's value.
|
|
405
|
+
*
|
|
406
|
+
* @remarks
|
|
407
|
+
* Use it, and {@link updateConfig}, for a look your code writes: the type is the check, and the
|
|
408
|
+
* values are not checked again. For values held as data, the SDK's `setKnobs` checks each against
|
|
409
|
+
* {@link buildings3DKnobCatalogue} and sets them by id.
|
|
410
|
+
*/
|
|
411
|
+
applyConfig(config: Buildings3DConfig): void;
|
|
412
|
+
/**
|
|
413
|
+
* Changes the given knobs and keeps the others, one level deep: a part you pass, such as `light`,
|
|
414
|
+
* replaces that part's values.
|
|
415
|
+
*
|
|
416
|
+
* @example
|
|
417
|
+
* ```typescript
|
|
418
|
+
* buildings.updateConfig({ preset: 'streetDark', litWindows: { fraction: 0.6 } });
|
|
419
|
+
* ```
|
|
420
|
+
*/
|
|
421
|
+
updateConfig(partial: Buildings3DConfig): void;
|
|
422
|
+
/**
|
|
423
|
+
* Unsets every knob, so the buildings show with the look of the map's style.
|
|
424
|
+
*/
|
|
425
|
+
resetConfig(): void;
|
|
426
|
+
/**
|
|
427
|
+
* Whether the buildings are set to be shown: the `visible` knob, `true` unless set.
|
|
428
|
+
*/
|
|
429
|
+
isVisible(): boolean;
|
|
430
|
+
/**
|
|
431
|
+
* Shows or hides the buildings. Stored as `visible` in the configuration. Hidden, they give the
|
|
432
|
+
* style's own 3D buildings their place back.
|
|
433
|
+
*/
|
|
434
|
+
setVisible(visible: boolean): void;
|
|
435
|
+
/**
|
|
436
|
+
* @ignore
|
|
437
|
+
*/
|
|
438
|
+
_knobValue(id: string): unknown;
|
|
439
|
+
/**
|
|
440
|
+
* @ignore
|
|
441
|
+
*/
|
|
442
|
+
_setKnobValues(values: Readonly<Record<string, unknown>>): void;
|
|
443
|
+
/**
|
|
444
|
+
* @ignore
|
|
445
|
+
*/
|
|
446
|
+
_resetKnobValue(id: string): void;
|
|
447
|
+
private install;
|
|
448
|
+
private look;
|
|
449
|
+
private render;
|
|
450
|
+
private placeLabels;
|
|
451
|
+
private restoreLabels;
|
|
452
|
+
private occludeLabels;
|
|
453
|
+
}
|
|
454
|
+
//#endregion
|
|
455
|
+
//#region src/knobCatalogue.d.ts
|
|
456
|
+
/**
|
|
457
|
+
* What a landmark's own texture gives its look, besides carving its silhouette:
|
|
458
|
+
*
|
|
459
|
+
* - `mask`: nothing more; the landmark is shaded in its `color`.
|
|
460
|
+
* - `detail`: its light and shade, over the `color`, as facade detail.
|
|
461
|
+
* - `color`: its colours, in place of the `color`.
|
|
462
|
+
*
|
|
463
|
+
* Whatever the use, the map's light shades the landmark.
|
|
464
|
+
*
|
|
465
|
+
* @group Landmarks 3D
|
|
466
|
+
*/
|
|
467
|
+
export declare const landmarkTextureUses: readonly ["mask", "detail", "color"];
|
|
468
|
+
/**
|
|
469
|
+
* One of {@link landmarkTextureUses}.
|
|
11
470
|
*
|
|
12
471
|
* @group Landmarks 3D
|
|
13
472
|
*/
|
|
14
|
-
type
|
|
473
|
+
type LandmarkTextureUse = (typeof landmarkTextureUses)[number];
|
|
474
|
+
declare const landmarks3DKnobDefinitions: {
|
|
475
|
+
readonly visible: {
|
|
476
|
+
readonly kind: "toggle";
|
|
477
|
+
readonly description: "The landmark models.";
|
|
478
|
+
readonly default: true;
|
|
479
|
+
};
|
|
480
|
+
readonly color: {
|
|
481
|
+
readonly kind: "color";
|
|
482
|
+
readonly description: "Colour the landmarks are shaded in. Unset: the base map's 3D buildings' colour, following the map colours that restyle them.";
|
|
483
|
+
};
|
|
484
|
+
readonly texture: {
|
|
485
|
+
readonly kind: "enum";
|
|
486
|
+
readonly description: "What the landmarks' textures add to their silhouette: mask (nothing), detail (their light and shade over the color) or color (their own colours, in place of the color). Unset: mask, or detail while a Buildings3D draws.";
|
|
487
|
+
readonly options: readonly ["mask", "detail", "color"];
|
|
488
|
+
};
|
|
489
|
+
readonly opacity: {
|
|
490
|
+
readonly kind: "number";
|
|
491
|
+
readonly description: "Opacity of the landmarks, 0 to 1. Unset: the base map's 3D buildings' opacity.";
|
|
492
|
+
readonly range: KnobRange;
|
|
493
|
+
};
|
|
494
|
+
readonly verticalGradient: {
|
|
495
|
+
readonly kind: "toggle";
|
|
496
|
+
readonly description: "Whether the landmarks' walls darken towards the ground. Unset: as the base map's 3D buildings do. No effect while a Buildings3D draws, whose walls have no gradient.";
|
|
497
|
+
};
|
|
498
|
+
readonly minZoom: {
|
|
499
|
+
readonly kind: "number";
|
|
500
|
+
readonly description: "Lowest zoom the landmarks are drawn at. Unset: the base map's 3D buildings' one.";
|
|
501
|
+
readonly range: KnobRange;
|
|
502
|
+
};
|
|
503
|
+
readonly maxZoom: {
|
|
504
|
+
readonly kind: "number";
|
|
505
|
+
readonly description: "Highest whole zoom level the landmarks are drawn at, up to the next one. Unset: the base map's 3D buildings' one, or 22 while a Buildings3D draws.";
|
|
506
|
+
readonly range: KnobRange;
|
|
507
|
+
};
|
|
508
|
+
};
|
|
509
|
+
/**
|
|
510
|
+
* The id of a landmarks knob, as accepted by the SDK's `setKnob` and as a key of {@link Landmarks3DConfig}.
|
|
511
|
+
*
|
|
512
|
+
* @group Landmarks 3D
|
|
513
|
+
*/
|
|
514
|
+
type Landmarks3DKnobId = keyof typeof landmarks3DKnobDefinitions;
|
|
515
|
+
/**
|
|
516
|
+
* The value type a landmarks knob takes.
|
|
517
|
+
*
|
|
518
|
+
* @group Landmarks 3D
|
|
519
|
+
*/
|
|
520
|
+
type Landmarks3DKnobValueOf<ID extends Landmarks3DKnobId> = ID extends 'texture' ? LandmarkTextureUse : KnobValueOf<(typeof landmarks3DKnobDefinitions)[ID]['kind']>;
|
|
521
|
+
/**
|
|
522
|
+
* One entry of {@link landmarks3DKnobCatalogue}, with what a UI or a coding agent needs to offer the knob
|
|
523
|
+
* and validate a value for it. The SDK's `getKnob` reads the value in force.
|
|
524
|
+
*
|
|
525
|
+
* @group Landmarks 3D
|
|
526
|
+
*/
|
|
527
|
+
type Landmarks3DKnob = KnobEntry<Landmarks3DKnobId>;
|
|
528
|
+
/**
|
|
529
|
+
* Every landmarks knob with its kind, description, range or options and, for `visible`, its default.
|
|
530
|
+
* It's static data, readable without a map.
|
|
531
|
+
*
|
|
532
|
+
* @remarks
|
|
533
|
+
* A knob is a plain value in {@link Landmarks3DConfig}, under its id. Every knob but `visible`
|
|
534
|
+
* follows the base map's 3D buildings while unset, which the SDK's `getKnob` reports.
|
|
535
|
+
*
|
|
536
|
+
* @group Landmarks 3D
|
|
537
|
+
*/
|
|
538
|
+
export declare const landmarks3DKnobCatalogue: readonly Landmarks3DKnob[];
|
|
539
|
+
/**
|
|
540
|
+
* Every landmarks knob id, in catalogue order.
|
|
541
|
+
*
|
|
542
|
+
* @group Landmarks 3D
|
|
543
|
+
*/
|
|
544
|
+
export declare const landmarks3DKnobIds: readonly Landmarks3DKnobId[];
|
|
15
545
|
//#endregion
|
|
16
546
|
//#region src/FillExtrusionMaterial.d.ts
|
|
17
547
|
/**
|
|
18
548
|
* Alpha mask carried over from a landmark mesh's as-authored texture.
|
|
19
549
|
*
|
|
20
550
|
* Landmark meshes are coarse hulls (e.g. a wall is one rectangle) whose realistic
|
|
21
|
-
* silhouette is carved out by the texture's alpha channel.
|
|
551
|
+
* silhouette is carved out by the texture's alpha channel. The shading must keep
|
|
22
552
|
* sampling that alpha and discard the carved-away fragments, otherwise the raw hull
|
|
23
553
|
* shape gets coloured in.
|
|
24
554
|
*
|
|
@@ -31,8 +561,9 @@ type FillExtrusionAlphaMask = {
|
|
|
31
561
|
cutoff: number;
|
|
32
562
|
};
|
|
33
563
|
/**
|
|
34
|
-
* Material that shades
|
|
35
|
-
*
|
|
564
|
+
* Material that shades landmark meshes exactly like maplibre-gl shades `fill-extrusion`
|
|
565
|
+
* buildings, so they blend in with the basemap building layer. A mesh given its texture
|
|
566
|
+
* can take that texture's detail or colours, as {@link FillExtrusionMaterial.setTextureUse} sets.
|
|
36
567
|
*
|
|
37
568
|
* Colour and opacity premultiply like maplibre's `v_color *= u_opacity`, paired with
|
|
38
569
|
* (ONE, ONE_MINUS_SRC_ALPHA) blending. Backfaces are culled like maplibre's extrusion
|
|
@@ -45,10 +576,15 @@ type FillExtrusionAlphaMask = {
|
|
|
45
576
|
declare class FillExtrusionMaterial extends ShaderMaterial {
|
|
46
577
|
constructor(alphaMask?: FillExtrusionAlphaMask);
|
|
47
578
|
/**
|
|
48
|
-
* Copies the shading uniforms (colour, light, layer opacity, vertical gradient) from
|
|
49
|
-
* instance, bringing a freshly created alpha-masked variant up to date with the shared material.
|
|
579
|
+
* Copies the shading uniforms (colour, texture use, light, layer opacity, vertical gradient) from
|
|
580
|
+
* another instance, bringing a freshly created alpha-masked variant up to date with the shared material.
|
|
50
581
|
*/
|
|
51
582
|
copyShadingFrom(source: FillExtrusionMaterial): void;
|
|
583
|
+
/**
|
|
584
|
+
* Sets what the mesh's texture gives its look besides its silhouette. Without a texture, the
|
|
585
|
+
* mesh takes the diffuse colour whatever the use.
|
|
586
|
+
*/
|
|
587
|
+
setTextureUse(use: LandmarkTextureUse): void;
|
|
52
588
|
/**
|
|
53
589
|
* Sets the building colour from a CSS colour string, stored as raw sRGB
|
|
54
590
|
* components, because maplibre shades paint colours in sRGB space, not linear.
|
|
@@ -115,8 +651,10 @@ interface ModelsSourceSpecification {
|
|
|
115
651
|
attribution?: string;
|
|
116
652
|
/**
|
|
117
653
|
* Base path of the Basis Universal transcoder (`basis_transcoder.js` and
|
|
118
|
-
* `basis_transcoder.wasm`)
|
|
119
|
-
*
|
|
654
|
+
* `basis_transcoder.wasm`) that decodes KTX2 textures, ending in `/`, such as `'/basis/'`.
|
|
655
|
+
* Set it to serve the transcoder from your own host. By default, the plugin loads the two
|
|
656
|
+
* files it ships beside its bundle, which Vite and webpack 5 emit with your build. A bundler
|
|
657
|
+
* that doesn't emit the files a `new URL('./file', import.meta.url)` names needs this path.
|
|
120
658
|
*/
|
|
121
659
|
transcoderPath?: string;
|
|
122
660
|
/**
|
|
@@ -146,6 +684,8 @@ export declare class ModelsSource {
|
|
|
146
684
|
tiles: Array<string>;
|
|
147
685
|
scene: Group;
|
|
148
686
|
loadedTiles: Set<string>;
|
|
687
|
+
/** Whether a tile came back 403 for want of Orbis 3D Landmarks access, so the key loads none. */
|
|
688
|
+
accessDenied: boolean;
|
|
149
689
|
/**
|
|
150
690
|
* EPSG:3857 origin subtracted from all mesh positions, because absolute coordinates (~6·10⁶ m)
|
|
151
691
|
* exceed float32 precision (~0.5 m), making landmark edges tremble while zooming. `null`
|
|
@@ -174,6 +714,12 @@ export declare class ModelsSource {
|
|
|
174
714
|
}
|
|
175
715
|
//#endregion
|
|
176
716
|
//#region src/ModelsLayer.d.ts
|
|
717
|
+
/**
|
|
718
|
+
* What the landmarks take from a `Buildings3D` on their map beside its sun and shadows: how strongly
|
|
719
|
+
* its facades show.
|
|
720
|
+
* @ignore
|
|
721
|
+
*/
|
|
722
|
+
type BuildingsLight = Pick<Buildings3DLook, 'facade.intensity'>;
|
|
177
723
|
/**
|
|
178
724
|
* MapLibre custom layer that renders tiled glTF/GLB models with Three.js.
|
|
179
725
|
*
|
|
@@ -206,6 +752,11 @@ export declare class ModelsLayer implements CustomLayerInterface {
|
|
|
206
752
|
private readonly fillExtrusionMaterial;
|
|
207
753
|
private readonly depthPrepassMaterial;
|
|
208
754
|
private readonly maskedFillExtrusionMaterials;
|
|
755
|
+
private readonly facadeMaterials;
|
|
756
|
+
private buildingsLight;
|
|
757
|
+
private glass;
|
|
758
|
+
private opacity;
|
|
759
|
+
private textureUse;
|
|
209
760
|
private readonly tilesMainMatrix;
|
|
210
761
|
private tilesStale;
|
|
211
762
|
private readonly markTilesStale;
|
|
@@ -214,6 +765,20 @@ export declare class ModelsLayer implements CustomLayerInterface {
|
|
|
214
765
|
setDirectionalLight(radius: number, phi: number, theta: number): void;
|
|
215
766
|
onAdd(map: Map, gl: WebGLRenderingContext | WebGL2RenderingContext): void;
|
|
216
767
|
render(_gl: WebGLRenderingContext | WebGL2RenderingContext, options: CustomRenderMethodInput): void;
|
|
768
|
+
/**
|
|
769
|
+
* Readies the landmark tiles for a `Buildings3D` to draw in its scene this frame.
|
|
770
|
+
* @returns Where they are, `undefined` while they don't show, the key has no access to them, or no
|
|
771
|
+
* `Buildings3D` lights them.
|
|
772
|
+
* @ignore
|
|
773
|
+
*/
|
|
774
|
+
prepareForBuildings(mainMatrix: ArrayLike<number>, glass: GlassUniforms): LandmarksFrame | undefined;
|
|
775
|
+
/**
|
|
776
|
+
* Gives every landmark the materials of one pass: its colour ones, its depth-only ones for the
|
|
777
|
+
* depth prepass of translucent shading, or its colour ones drawing nothing, to cast its shadows.
|
|
778
|
+
* @ignore
|
|
779
|
+
*/
|
|
780
|
+
useMaterials(pass: LandmarksPass): void;
|
|
781
|
+
private prepareFrame;
|
|
217
782
|
private updateTilesWhenStale;
|
|
218
783
|
private groundLandmarksOnTerrain;
|
|
219
784
|
private groundMeshOnTerrain;
|
|
@@ -221,48 +786,55 @@ export declare class ModelsLayer implements CustomLayerInterface {
|
|
|
221
786
|
private alignCameraToMap;
|
|
222
787
|
private get sceneOrigin();
|
|
223
788
|
private needsTranslucentPrepass;
|
|
224
|
-
private renderDepthPrepass;
|
|
225
789
|
setOpacity(value: number): void;
|
|
790
|
+
/**
|
|
791
|
+
* Hands the landmarks to a `Buildings3D`, which draws them in its scene under its sun and in its
|
|
792
|
+
* shadows, their textures used as {@link ModelsLayer.setTextureUse} sets. `undefined` draws them here
|
|
793
|
+
* again, shaded like the style's 3D buildings.
|
|
794
|
+
* @ignore
|
|
795
|
+
*/
|
|
796
|
+
setBuildingsLight(light: BuildingsLight | undefined): void;
|
|
226
797
|
/** Mirrors the basemap's fill-extrusion-vertical-gradient on the landmark shading. */
|
|
227
798
|
setVerticalGradient(enabled: boolean): void;
|
|
799
|
+
/**
|
|
800
|
+
* Sets what each landmark's own texture gives its look besides its silhouette, here and under a
|
|
801
|
+
* `Buildings3D`: nothing, its light and shade over `diffuseColor`, or its colours in place of it.
|
|
802
|
+
* The light shades it either way.
|
|
803
|
+
*/
|
|
804
|
+
setTextureUse(use: LandmarkTextureUse): void;
|
|
228
805
|
getMaterial(mesh: Mesh): FillExtrusionMaterial;
|
|
229
806
|
private maskedFillExtrusionVariant;
|
|
230
807
|
private forEachFillExtrusionMaterial;
|
|
231
808
|
private syncLighting;
|
|
232
809
|
private applyMaterials;
|
|
810
|
+
private facadeMaterialOf;
|
|
233
811
|
}
|
|
234
812
|
//#endregion
|
|
235
813
|
//#region src/Landmarks3D.d.ts
|
|
236
814
|
/**
|
|
237
|
-
*
|
|
815
|
+
* The landmark knobs an app sets, as {@link Landmarks3D.getConfig} returns them. Each knob id is its
|
|
816
|
+
* key in here, and it's plain JSON.
|
|
817
|
+
*
|
|
818
|
+
* - Every knob but `visible` follows the base map's 3D buildings while unset.
|
|
819
|
+
* - While a {@link Buildings3D} draws, the landmarks follow its buildings instead: `texture` is `detail`,
|
|
820
|
+
* there's no wall gradient, which `verticalGradient` can't turn on, and every zoom up to `maxZoom`.
|
|
821
|
+
*
|
|
822
|
+
* @example
|
|
823
|
+
* ```typescript
|
|
824
|
+
* const config: Landmarks3DConfig = { color: '#c8b28a', opacity: 0.9 };
|
|
825
|
+
* const authored: Landmarks3DConfig = { texture: 'color' }; // the landmarks' own colours
|
|
826
|
+
* ```
|
|
238
827
|
*
|
|
239
828
|
* @group Landmarks 3D
|
|
240
829
|
*/
|
|
241
|
-
type
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
* Whether the landmarks are initially visible. To change it at runtime, call
|
|
250
|
-
* {@link Landmarks3D.setVisible}.
|
|
251
|
-
* @defaultValue `true`
|
|
252
|
-
*/
|
|
253
|
-
visible?: boolean;
|
|
254
|
-
/**
|
|
255
|
-
* Minimum zoom at which landmarks are rendered.
|
|
256
|
-
* @defaultValue The basemap 3D building layer's minimum zoom, so landmarks appear together
|
|
257
|
-
* with it (falls back to `10` when that layer is absent).
|
|
258
|
-
*/
|
|
259
|
-
minZoom?: number;
|
|
260
|
-
/**
|
|
261
|
-
* Maximum zoom at which landmarks are rendered.
|
|
262
|
-
* @defaultValue The basemap 3D building layer's maximum zoom, so landmarks disappear together
|
|
263
|
-
* with it (falls back to `22` when that layer is absent).
|
|
264
|
-
*/
|
|
265
|
-
maxZoom?: number;
|
|
830
|
+
type Landmarks3DConfig = KnobConfigOf<{ [ID in Landmarks3DKnobId]: Landmarks3DKnobValueOf<ID>; }>;
|
|
831
|
+
/**
|
|
832
|
+
* What the {@link Landmarks3D} plugin starts with: its knobs, how it requests tiles, and where it
|
|
833
|
+
* loads the texture transcoder from.
|
|
834
|
+
*
|
|
835
|
+
* @group Landmarks 3D
|
|
836
|
+
*/
|
|
837
|
+
type Landmarks3DOptions = Landmarks3DConfig & Pick<ModelsSourceSpecification, 'transcoderPath'> & {
|
|
266
838
|
/**
|
|
267
839
|
* Whether each tile request sends `credentials: 'include'`, so a proxy session
|
|
268
840
|
* cookie travels with it. By default, this tracks the SDK's proxy config,
|
|
@@ -282,9 +854,15 @@ type Landmarks3DOptions = {
|
|
|
282
854
|
* across map style changes.
|
|
283
855
|
*
|
|
284
856
|
* @remarks
|
|
285
|
-
* It requires an API key with Orbis 3D Landmarks entitlements.
|
|
286
|
-
*
|
|
287
|
-
*
|
|
857
|
+
* It requires an API key with Orbis 3D Landmarks entitlements. Its look is a set of knobs, listed in
|
|
858
|
+
* {@link landmarks3DKnobCatalogue}.
|
|
859
|
+
*
|
|
860
|
+
* - Each knob you leave unset follows the base map's 3D buildings, through style changes and
|
|
861
|
+
* anything that restyles them, falling back to the `streetLight` style's look.
|
|
862
|
+
* - Whether those buildings show is the `buildings3D` group of the `BaseMapModule`, hidden in most
|
|
863
|
+
* standard styles; the plugin leaves it as it is.
|
|
864
|
+
* - A visible {@link Buildings3D} on the same map takes their place: the landmarks then follow its
|
|
865
|
+
* look and its light instead.
|
|
288
866
|
*
|
|
289
867
|
* @example
|
|
290
868
|
* ```typescript
|
|
@@ -293,7 +871,7 @@ type Landmarks3DOptions = {
|
|
|
293
871
|
* // assume `map` is your initialized TomTomMap instance
|
|
294
872
|
* const landmarks = new Landmarks3D(map);
|
|
295
873
|
*
|
|
296
|
-
*
|
|
874
|
+
* landmarks.updateConfig({ color: '#c8b28a' });
|
|
297
875
|
* ```
|
|
298
876
|
*
|
|
299
877
|
* @group Landmarks 3D
|
|
@@ -303,50 +881,79 @@ export declare class Landmarks3D {
|
|
|
303
881
|
private readonly layerID;
|
|
304
882
|
private readonly basemapBuildingLayerID;
|
|
305
883
|
private readonly modelsLayer;
|
|
306
|
-
private
|
|
307
|
-
private
|
|
308
|
-
private displayMode;
|
|
884
|
+
private config;
|
|
885
|
+
private renderedLook;
|
|
309
886
|
/**
|
|
310
887
|
* Creates the plugin bound to a TomTom map and starts rendering landmarks
|
|
311
888
|
* as soon as the map is ready.
|
|
312
889
|
*
|
|
313
890
|
* @param map - The TomTom map instance to render landmarks on.
|
|
891
|
+
* @param options - The knobs to start with, how to request tiles, and where to load the texture transcoder from.
|
|
314
892
|
*/
|
|
315
|
-
constructor(map: TomTomMap,
|
|
316
|
-
private installWhenReady;
|
|
893
|
+
constructor(map: TomTomMap, { withCredentials, transcoderPath, ...config }?: Landmarks3DOptions);
|
|
317
894
|
/**
|
|
318
895
|
* The underlying MapLibre custom layer, for advanced use beyond this facade.
|
|
319
896
|
*/
|
|
320
897
|
get layer(): ModelsLayer;
|
|
321
898
|
/**
|
|
322
|
-
* The
|
|
899
|
+
* Returns the knobs set, as a plain serializable copy. The SDK's `getKnob` reads a knob's value
|
|
900
|
+
* in force, the base map's one when unset.
|
|
323
901
|
*/
|
|
324
|
-
|
|
902
|
+
getConfig(): Landmarks3DConfig;
|
|
325
903
|
/**
|
|
326
|
-
*
|
|
904
|
+
* Replaces the whole configuration. An empty object has every knob follow the base map's 3D buildings.
|
|
905
|
+
*
|
|
906
|
+
* @remarks
|
|
907
|
+
* Use it, and {@link updateConfig}, for a look your code writes: as on a map module, the type is
|
|
908
|
+
* the check, and the values are not checked again. For values held as data, the SDK's `setKnobs`
|
|
909
|
+
* checks each against {@link landmarks3DKnobCatalogue} and sets them by id.
|
|
327
910
|
*
|
|
328
|
-
* @
|
|
329
|
-
*
|
|
911
|
+
* @example
|
|
912
|
+
* ```typescript
|
|
913
|
+
* landmarks.applyConfig({ color: '#c8b28a', opacity: 0.9 });
|
|
914
|
+
* ```
|
|
915
|
+
*/
|
|
916
|
+
applyConfig(config: Landmarks3DConfig): void;
|
|
917
|
+
/**
|
|
918
|
+
* Changes the given knobs and keeps the others.
|
|
919
|
+
*
|
|
920
|
+
* @example
|
|
921
|
+
* ```typescript
|
|
922
|
+
* landmarks.updateConfig({ opacity: 1 }); // the colour still follows the base map
|
|
923
|
+
* ```
|
|
924
|
+
*/
|
|
925
|
+
updateConfig(partial: Landmarks3DConfig): void;
|
|
926
|
+
/**
|
|
927
|
+
* Unsets every knob, so the landmarks are shown and look like the base map's 3D buildings.
|
|
330
928
|
*/
|
|
331
|
-
|
|
929
|
+
resetConfig(): void;
|
|
332
930
|
/**
|
|
333
|
-
* Whether the landmarks are
|
|
931
|
+
* Whether the landmarks are set to be shown: the `visible` knob, `true` unless set.
|
|
334
932
|
*/
|
|
335
933
|
isVisible(): boolean;
|
|
336
934
|
/**
|
|
337
|
-
* Shows or hides the landmarks
|
|
935
|
+
* Shows or hides the landmarks. Stored as `visible` in the configuration.
|
|
338
936
|
*
|
|
339
937
|
* @param visible - `true` to show landmarks, `false` to hide them.
|
|
340
|
-
* @returns A promise that resolves once the visibility has been applied.
|
|
341
938
|
*/
|
|
342
|
-
setVisible(visible: boolean):
|
|
939
|
+
setVisible(visible: boolean): void;
|
|
940
|
+
/**
|
|
941
|
+
* @ignore
|
|
942
|
+
*/
|
|
943
|
+
_knobValue(id: string): unknown;
|
|
944
|
+
/**
|
|
945
|
+
* @ignore
|
|
946
|
+
*/
|
|
947
|
+
_setKnobValues(values: Readonly<Record<string, unknown>>): void;
|
|
948
|
+
/**
|
|
949
|
+
* @ignore
|
|
950
|
+
*/
|
|
951
|
+
_resetKnobValue(id: string): void;
|
|
343
952
|
private install;
|
|
344
|
-
private landmarkInsertBeforeID;
|
|
345
|
-
private alignZoomRangeWithBasemapBuildings;
|
|
346
953
|
private excludeLandmarkBuildingsFromBasemap;
|
|
347
|
-
private
|
|
348
|
-
private
|
|
349
|
-
private
|
|
954
|
+
private readBuildingsLook;
|
|
955
|
+
private look;
|
|
956
|
+
private render;
|
|
350
957
|
}
|
|
351
958
|
//#endregion
|
|
352
959
|
//#region src/landmarksTileURL.d.ts
|
|
@@ -361,4 +968,4 @@ export declare class Landmarks3D {
|
|
|
361
968
|
*/
|
|
362
969
|
export declare const buildLandmarksTileURL: () => string;
|
|
363
970
|
//#endregion
|
|
364
|
-
export type {
|
|
971
|
+
export type { Buildings3DConfig, Buildings3DKnob, Buildings3DKnobId, Buildings3DKnobValueOf, BuildingsLayer, BuildingsPreset, FacadePattern, LandmarkTextureUse, Landmarks3DConfig, Landmarks3DKnob, Landmarks3DKnobId, Landmarks3DKnobValueOf, Landmarks3DOptions, ModelsLayerSpecification, ModelsSourceSpecification };
|