@tomtom-org/maps-sdk 1.0.0-rc.4 → 1.0.0-rc.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +112 -0
- package/README.md +4 -4
- package/core/dist/core.es.js +1 -1
- package/core/dist/index.d.ts +774 -981
- package/map/dist/index.d.ts +1115 -569
- package/map/dist/map.es.js +5 -3
- package/package.json +2 -1
- package/services/dist/index.d.ts +128 -210
- package/services/dist/services.es.js +1 -1
package/map/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,70 @@
|
|
|
1
|
-
import { AllLayoutProperties, AllPaintProperties, BackgroundLayerSpecification, CircleLayerSpecification, CustomLayerInterface, DataDrivenPropertyValueSpecification, ExpressionFilterSpecification, ExpressionSpecification, FillExtrusionLayerSpecification, FillLayerSpecification, FilterSpecification, GeoJSONSource, GeoJSONSourceSpecification, HeatmapLayerSpecification, LayerSpecification, LineLayerSpecification, LngLat, Map as Map$1, MapGeoJSONFeature, MapOptions, Point2D, RequestParameters, ResourceType, Source, SourceSpecification, StyleImageMetadata, StyleImageSource, StyleSpecification, SymbolLayerSpecification } from "maplibre-gl";
|
|
2
|
-
import { Anything, AreaAnalyticsMetricKey, AreaAnalyticsMetrics, BBox, CommonPlaceProps, CountrySectionProps, DelayMagnitude, DisplayUnits, DistanceDisplayUnits, EntryPoint, GeopoliticalView, GetPositionEntryPointOption, GlobalConfig, Instruction, Language, POICategory, Place, Places, PolygonFeature, PolygonFeatures, Route, RouteProps, Routes, SDKErrorCode, SectionProps, SectionType, SpeedLimitSectionProps, TimeDisplayUnits, TrafficAreaAnalytics, TrafficIncident, TrafficIncidentBaseProperties, TrafficIncidentCategory, TrafficIncidentDetails, TrafficIncidentTimeValidity, TrafficSectionProps, Waypoint, WaypointLike, Waypoints } from "@tomtom-org/maps-sdk/core";
|
|
1
|
+
import { AllLayoutProperties, AllPaintProperties, BackgroundLayerSpecification, CircleLayerSpecification, ControlPosition, CustomLayerInterface, DataDrivenPropertyValueSpecification, ExpressionFilterSpecification, ExpressionSpecification, FillExtrusionLayerSpecification, FillLayerSpecification, FilterSpecification, GeoJSONSource, GeoJSONSourceSpecification, HeatmapLayerSpecification, LayerSpecification, LineLayerSpecification, LngLat, Map as Map$1, MapGeoJSONFeature, MapOptions, Point2D, RequestParameters, ResourceType, Source, SourceSpecification, StyleImageMetadata, StyleImageSource, StyleSpecification, SymbolLayerSpecification } from "maplibre-gl";
|
|
2
|
+
import { APIErrorDetails, Anything, AreaAnalyticsMetricKey, AreaAnalyticsMetrics, BBox, CommonPlaceProps, CountrySectionProps, DelayMagnitude, DisplayUnits, DistanceDisplayUnits, EntryPoint, GeopoliticalView, GetPositionEntryPointOption, GlobalConfig, HasLngLat, Instruction, Language, POICategory, Place, Places, PolygonFeature, PolygonFeatures, PrivatePreviewAccess, Route, RouteProps, Routes, SDKErrorCode, SectionProps, SectionType, SpeedLimitSectionProps, TimeDisplayUnits, TrafficAreaAnalytics, TrafficIncident, TrafficIncidentBaseProperties, TrafficIncidentCategory, TrafficIncidentDetails, TrafficIncidentTimeValidity, TrafficSectionProps, Waypoint, WaypointLike, Waypoints } from "@tomtom-org/maps-sdk/core";
|
|
3
|
+
//#region src/shared/types/style.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* A light or dark theme.
|
|
6
|
+
*
|
|
7
|
+
* Use it to classify a map style as light or dark, or to apply light or dark configurations to the
|
|
8
|
+
* map modules that support them.
|
|
9
|
+
*
|
|
10
|
+
* @group Map Style
|
|
11
|
+
*/
|
|
12
|
+
type LightDark = 'light' | 'dark';
|
|
13
|
+
//#endregion
|
|
3
14
|
//#region src/attribution/types/attributionOptions.d.ts
|
|
4
15
|
/**
|
|
5
|
-
*
|
|
16
|
+
* Corner of the map the attribution is anchored to.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* These are MapLibre's own control corners, so the attribution stacks with any other
|
|
20
|
+
* control placed in the same corner.
|
|
21
|
+
*
|
|
22
|
+
* @see {@link AttributionOptions.position}
|
|
23
|
+
*
|
|
24
|
+
* @group Map
|
|
25
|
+
*/
|
|
26
|
+
type AttributionPosition = ControlPosition;
|
|
27
|
+
/**
|
|
28
|
+
* Distance in CSS pixels between the attribution and the map edges it is anchored to.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* A single number applies to both axes. The object form sets them apart: `horizontal` is
|
|
32
|
+
* the gap to the left or right edge, `vertical` the gap to the top or bottom edge. Which
|
|
33
|
+
* edges those are follows {@link AttributionOptions.position}.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* padding: 16 // 16px from both edges
|
|
38
|
+
* padding: { horizontal: 12, vertical: 8 } // the default
|
|
39
|
+
* padding: { vertical: 24 } // 24px from the anchored horizontal edge, default 12px in
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @see {@link AttributionOptions.padding}
|
|
43
|
+
*
|
|
44
|
+
* @group Map
|
|
45
|
+
*/
|
|
46
|
+
type AttributionPadding = number | {
|
|
47
|
+
horizontal?: number;
|
|
48
|
+
vertical?: number;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Where the map's attribution ("copyright") sits, the credits of your own it shows besides
|
|
52
|
+
* those of the map's data sources, and whether a backdrop sits behind it.
|
|
53
|
+
*
|
|
54
|
+
* @remarks
|
|
55
|
+
* The TomTom and OpenStreetMap credits show as logos, any other source's as text after them.
|
|
56
|
+
* Pass this as the `attribution` option of {@link TomTomMapParams} to move them clear of
|
|
57
|
+
* your own layout, or to credit data of your own.
|
|
58
|
+
*
|
|
59
|
+
* Attribution is a licensing requirement, so no option turns it off: wherever you move it,
|
|
60
|
+
* it has to stay visible, legible and uncovered over the map.
|
|
6
61
|
*
|
|
7
62
|
* @example
|
|
8
63
|
* ```typescript
|
|
9
64
|
* const map = new TomTomMap({
|
|
10
|
-
*
|
|
65
|
+
* apiKey: 'your-api-key',
|
|
66
|
+
* // Logos in the top-left, clear of a bottom bar of your own
|
|
67
|
+
* attribution: { position: 'top-left', padding: 16 },
|
|
11
68
|
* mapLibre: { container: 'map' },
|
|
12
69
|
* });
|
|
13
70
|
* ```
|
|
@@ -17,12 +74,24 @@ import { Anything, AreaAnalyticsMetricKey, AreaAnalyticsMetrics, BBox, CommonPla
|
|
|
17
74
|
* @group Map
|
|
18
75
|
*/
|
|
19
76
|
type AttributionOptions = {
|
|
77
|
+
/**
|
|
78
|
+
* Corner of the map the attribution is anchored to.
|
|
79
|
+
*
|
|
80
|
+
* @defaultValue `'bottom-right'`
|
|
81
|
+
*/
|
|
82
|
+
position?: AttributionPosition;
|
|
83
|
+
/**
|
|
84
|
+
* Distance in CSS pixels to the map edges the attribution is anchored to.
|
|
85
|
+
*
|
|
86
|
+
* @defaultValue `{ horizontal: 12, vertical: 8 }`
|
|
87
|
+
*/
|
|
88
|
+
padding?: AttributionPadding;
|
|
20
89
|
/**
|
|
21
90
|
* Your own credits, shown next to TomTom's and kept across style switches.
|
|
22
91
|
*
|
|
23
92
|
* @remarks
|
|
24
|
-
* Each credit is text or HTML, such as a link. A credit that
|
|
25
|
-
*
|
|
93
|
+
* Each credit is text or HTML, such as a link. A credit that repeats one the map already shows, such as
|
|
94
|
+
* `© OpenStreetMap`, shows once.
|
|
26
95
|
*
|
|
27
96
|
* @example
|
|
28
97
|
* ```typescript
|
|
@@ -30,8 +99,49 @@ type AttributionOptions = {
|
|
|
30
99
|
* ```
|
|
31
100
|
*/
|
|
32
101
|
credits?: string[];
|
|
102
|
+
/**
|
|
103
|
+
* Whether a soft, blurred backdrop sits behind the logos, so they stand out from the map's labels.
|
|
104
|
+
*
|
|
105
|
+
* @remarks
|
|
106
|
+
* It follows the style's theme, light over a light style and dark over a dark one, and fades out
|
|
107
|
+
* past the logos without moving them. Turn it off where your own UI already gives the attribution
|
|
108
|
+
* a calm background.
|
|
109
|
+
*
|
|
110
|
+
* @defaultValue `true`
|
|
111
|
+
*/
|
|
112
|
+
backdrop?: boolean;
|
|
33
113
|
};
|
|
34
114
|
//#endregion
|
|
115
|
+
//#region src/attribution/AttributionLogosControl.d.ts
|
|
116
|
+
/**
|
|
117
|
+
* Class on the element holding the attribution logos, `tomtom-attribution-logos`.
|
|
118
|
+
*
|
|
119
|
+
* @remarks
|
|
120
|
+
* Use it to tell the attribution apart from your own controls in a corner, never to hide it:
|
|
121
|
+
* the credits are a licensing requirement.
|
|
122
|
+
*
|
|
123
|
+
* @group Map
|
|
124
|
+
*/
|
|
125
|
+
export declare const ATTRIBUTION_LOGOS_CLASS = "tomtom-attribution-logos";
|
|
126
|
+
/**
|
|
127
|
+
* Class on each individual logo inside {@link ATTRIBUTION_LOGOS_CLASS}.
|
|
128
|
+
*
|
|
129
|
+
* @ignore
|
|
130
|
+
*/
|
|
131
|
+
export declare const ATTRIBUTION_LOGO_CLASS = "tomtom-attribution-logo";
|
|
132
|
+
/**
|
|
133
|
+
* Class on the credits no logo covers, set as text after the logos.
|
|
134
|
+
*
|
|
135
|
+
* @ignore
|
|
136
|
+
*/
|
|
137
|
+
export declare const ATTRIBUTION_CREDITS_CLASS = "tomtom-attribution-credits";
|
|
138
|
+
/**
|
|
139
|
+
* Class on the soft backdrop behind the marks.
|
|
140
|
+
*
|
|
141
|
+
* @ignore
|
|
142
|
+
*/
|
|
143
|
+
export declare const ATTRIBUTION_BACKDROP_CLASS = "tomtom-attribution-backdrop";
|
|
144
|
+
//#endregion
|
|
35
145
|
//#region src/shared/layers/layerIDs.d.ts
|
|
36
146
|
/**
|
|
37
147
|
* Key layer IDs from the vector map style for positioning custom layers.
|
|
@@ -67,9 +177,9 @@ type AttributionOptions = {
|
|
|
67
177
|
* beforeLayerConfig: 'lowestBuilding'
|
|
68
178
|
* });
|
|
69
179
|
*
|
|
70
|
-
* //
|
|
71
|
-
* const
|
|
72
|
-
* beforeLayerConfig: '
|
|
180
|
+
* // Per part: the fill under the roads, the border on top
|
|
181
|
+
* const fillUnderRoads = await GeometriesModule.create(map, {
|
|
182
|
+
* beforeLayerConfig: { fill: 'lowestRoadLine' }
|
|
73
183
|
* });
|
|
74
184
|
* ```
|
|
75
185
|
*
|
|
@@ -155,11 +265,12 @@ export declare const mapStyleLayerIDs: {
|
|
|
155
265
|
*/
|
|
156
266
|
readonly lowest3D: "3D - Building";
|
|
157
267
|
/**
|
|
158
|
-
* The
|
|
268
|
+
* The tunnel railway outlines, low among the road network's line layers: only the subway and
|
|
269
|
+
* railway fill tunnels sit below it.
|
|
159
270
|
*
|
|
160
271
|
* @remarks
|
|
161
|
-
*
|
|
162
|
-
*
|
|
272
|
+
* Use it to position content below the roads, such as base layers or features that should
|
|
273
|
+
* appear beneath transportation infrastructure.
|
|
163
274
|
*
|
|
164
275
|
* **Note:** Not available in the Satellite style.
|
|
165
276
|
*/
|
|
@@ -491,7 +602,9 @@ type IndexedFeature<F> = {
|
|
|
491
602
|
* carries all of it, next to what the style itself gave the layer.
|
|
492
603
|
*
|
|
493
604
|
* The snapshot and the contributions belong to the style they were taken from, so both are dropped
|
|
494
|
-
* when a new style arrives; every module re-registers what it still wants as it restores itself.
|
|
605
|
+
* when a new style arrives; every module re-registers what it still wants as it restores itself. A
|
|
606
|
+
* switch to the style already loaded reloads nothing, so both stay: the layers still carry what the
|
|
607
|
+
* composer wrote, and a module that withdraws its say gets the style's own value back.
|
|
495
608
|
*
|
|
496
609
|
* @ignore
|
|
497
610
|
*/
|
|
@@ -499,6 +612,11 @@ declare abstract class AbstractLayerComposer<CONTRIBUTIONS> {
|
|
|
499
612
|
protected readonly mapLibreMap: Map$1;
|
|
500
613
|
protected readonly byLayer: Map<string, CONTRIBUTIONS>;
|
|
501
614
|
protected constructor(tomtomMap: TomTomMap);
|
|
615
|
+
/** What the style itself gave the layer, with no contribution yet. */
|
|
616
|
+
protected abstract snapshot(layerId: string): CONTRIBUTIONS;
|
|
617
|
+
/** Writes the value the layer's contributions compose into. */
|
|
618
|
+
protected abstract write(layerId: string, contributions: CONTRIBUTIONS): void;
|
|
619
|
+
protected contribute(layerId: string, withdraws: boolean, register: (contributions: CONTRIBUTIONS) => void): void;
|
|
502
620
|
}
|
|
503
621
|
//#endregion
|
|
504
622
|
//#region src/shared/layers/layerVisibilityComposer.d.ts
|
|
@@ -511,9 +629,11 @@ type LayerVisibilityContributions = {
|
|
|
511
629
|
* The single owner of a style layer's `visibility`, for the layers more than one module shows or
|
|
512
630
|
* hides.
|
|
513
631
|
*
|
|
514
|
-
* A style-owned module shows or hides the style layers it owns, and a
|
|
515
|
-
*
|
|
516
|
-
*
|
|
632
|
+
* A style-owned module shows or hides the style layers it owns, and a part knob shows or hides a few
|
|
633
|
+
* layers nested among them, through {@link LayerPartToggles}: the POIs `microMarkers.visible` among
|
|
634
|
+
* the POIs, the base map's `roads.arrows.visible` among its roads. The styling module's
|
|
635
|
+
* `layers.query(...).setVisible` has a say in any of them too. If each wrote the layout property
|
|
636
|
+
* itself, the later write would undo the other.
|
|
517
637
|
*
|
|
518
638
|
* So a layer is hidden when any contributor hides it, shown when one shows it and none hides it,
|
|
519
639
|
* and left as the style shipped it when no contributor has a say.
|
|
@@ -533,6 +653,8 @@ declare class LayerVisibilityComposer extends AbstractLayerComposer<LayerVisibil
|
|
|
533
653
|
* @param visible - `true` to show the layer unless another contributor hides it, `false` to hide it.
|
|
534
654
|
*/
|
|
535
655
|
setVisible(layerId: string, contributor: string, visible: boolean | undefined): void;
|
|
656
|
+
protected snapshot(layerId: string): LayerVisibilityContributions;
|
|
657
|
+
protected write(layerId: string, layer: LayerVisibilityContributions): void;
|
|
536
658
|
}
|
|
537
659
|
//#endregion
|
|
538
660
|
//#region src/shared/TomTomMapSource.d.ts
|
|
@@ -582,12 +704,49 @@ export declare abstract class AbstractSourceWithLayers<SOURCE_SPEC extends Sourc
|
|
|
582
704
|
setLayersVisible(visible: boolean, filter?: LayerSpecFilter): void;
|
|
583
705
|
get sourceAndLayerIDs(): SourceWithLayerIDs;
|
|
584
706
|
}
|
|
707
|
+
/**
|
|
708
|
+
* A source that keeps the event states of its features itself, rather than in the features it shows:
|
|
709
|
+
* a custom layer's objects, a style source's features. The event proxy addresses each feature by the
|
|
710
|
+
* key read off it.
|
|
711
|
+
* @ignore
|
|
712
|
+
*/
|
|
713
|
+
type EventStateKeeper<KEY extends string | number = string | number> = {
|
|
714
|
+
/** The key of a rendered feature of this source; `undefined` for one it cannot address. */
|
|
715
|
+
eventStateKeyOf(feature: MapGeoJSONFeature): KEY | undefined;
|
|
716
|
+
eventStateOf(key: KEY): EventState | undefined;
|
|
717
|
+
/** The keys that have a state. */
|
|
718
|
+
keysWithEventState(): KEY[];
|
|
719
|
+
putEventState(key: KEY, state: EventState | undefined): void;
|
|
720
|
+
};
|
|
721
|
+
/**
|
|
722
|
+
* The id of a style source's feature, which feature state addresses it by.
|
|
723
|
+
* @ignore
|
|
724
|
+
*/
|
|
725
|
+
type FeatureId = string | number;
|
|
726
|
+
/**
|
|
727
|
+
* The features of a style source that take an event state as one, as the parts of a building do.
|
|
728
|
+
* @ignore
|
|
729
|
+
*/
|
|
730
|
+
type FeatureGroups = {
|
|
731
|
+
/** The id standing for the group of the feature with this id: its own, when it is in none. */
|
|
732
|
+
groupOf(sourceLayer: string | null, id: FeatureId): FeatureId;
|
|
733
|
+
/** The ids of the features of the group with this id. */
|
|
734
|
+
membersOf(sourceLayer: string | null, id: FeatureId): FeatureId[];
|
|
735
|
+
};
|
|
585
736
|
/**
|
|
586
737
|
* Source with layers which are coming from the downloaded TT map style.
|
|
587
738
|
* * Examples are parts of the base map, traffic, pois, and hillshade.
|
|
739
|
+
*
|
|
740
|
+
* It draws no features of its own to put an event state in, so it puts it on the style's features as
|
|
741
|
+
* the feature state `eventState`, for the style's paint to read with `['feature-state', 'eventState']`.
|
|
588
742
|
* @ignore
|
|
589
743
|
*/
|
|
590
|
-
export declare class StyleSourceWithLayers<SOURCE_SPEC extends SourceSpecification = SourceSpecification, RUNTIME_SOURCE extends Source = Source> extends AbstractSourceWithLayers<SOURCE_SPEC, RUNTIME_SOURCE> {
|
|
744
|
+
export declare class StyleSourceWithLayers<SOURCE_SPEC extends SourceSpecification = SourceSpecification, RUNTIME_SOURCE extends Source = Source> extends AbstractSourceWithLayers<SOURCE_SPEC, RUNTIME_SOURCE> implements EventStateKeeper<string> {
|
|
745
|
+
private readonly eventStates;
|
|
746
|
+
/** The features that take a state as one; each feature on its own without it. */
|
|
747
|
+
featureGroups?: FeatureGroups;
|
|
748
|
+
/** Feature state written with an event state, such as the look it shows in; `undefined` takes it off. */
|
|
749
|
+
eventStateLook?: (sourceLayer: string | null, state: EventState | undefined) => Record<string, unknown>;
|
|
591
750
|
constructor(map: Map$1, runtimeSource: RUNTIME_SOURCE, filter?: LayerSpecFilter);
|
|
592
751
|
/**
|
|
593
752
|
* Shows or hides the layers `filter` selects as `contributor`'s say in the map's
|
|
@@ -595,6 +754,26 @@ export declare class StyleSourceWithLayers<SOURCE_SPEC extends SourceSpecificati
|
|
|
595
754
|
* being overwritten.
|
|
596
755
|
*/
|
|
597
756
|
setLayersVisibleThrough(composer: LayerVisibilityComposer, contributor: string, visible: boolean, filter?: LayerSpecFilter): void;
|
|
757
|
+
/** `undefined` for a feature without an id, which feature state cannot address. */
|
|
758
|
+
eventStateKeyOf(feature: MapGeoJSONFeature): string | undefined;
|
|
759
|
+
eventStateOf(key: string): EventState | undefined;
|
|
760
|
+
keysWithEventState(): string[];
|
|
761
|
+
putEventState(key: string, state: EventState | undefined): void;
|
|
762
|
+
/** Takes over the states the keeper of the style before kept, putting each on this one's source. */
|
|
763
|
+
takeEventStatesFrom(previous: StyleSourceWithLayers): void;
|
|
764
|
+
/** Takes every state off, the map's feature state included. */
|
|
765
|
+
clearEventStates(): void;
|
|
766
|
+
/**
|
|
767
|
+
* Puts every state on its group again, onto the members found since it was put, and keys a state put
|
|
768
|
+
* on a feature before it joined a group by the group, so taking the group's state off takes it off.
|
|
769
|
+
*/
|
|
770
|
+
rewriteEventStates(): void;
|
|
771
|
+
/**
|
|
772
|
+
* Sets feature state on every feature of the group the feature with this id is in, removing each
|
|
773
|
+
* property whose value is `undefined`.
|
|
774
|
+
*/
|
|
775
|
+
writeFeatureState(sourceLayer: string | null, featureId: FeatureId, values: Readonly<Record<string, unknown>>): void;
|
|
776
|
+
private writeEventState;
|
|
598
777
|
}
|
|
599
778
|
/**
|
|
600
779
|
* Source with layers which originally is not in the map style, but it's to be added after the map is initialized.
|
|
@@ -638,6 +817,8 @@ type GeoJSONSourceClusterOptions = Pick<GeoJSONSourceSpecification, 'cluster' |
|
|
|
638
817
|
export declare class GeoJSONSourceWithLayers<T extends FeatureCollection = FeatureCollection> extends AddedSourceWithLayers<GeoJSONSourceSpecification, GeoJSONSource> {
|
|
639
818
|
shownFeatures: T;
|
|
640
819
|
private readonly showListeners;
|
|
820
|
+
private featuresById?;
|
|
821
|
+
private eventStatesUnshown;
|
|
641
822
|
constructor(map: Map$1, sourceId: string, layerSpecs: ToBeAddedLayerSpecWithoutSource[], addLayersToMap?: boolean, clusterOptions?: GeoJSONSourceClusterOptions);
|
|
642
823
|
show(featureCollection: T, { automaticVisibility }?: ShowOptions): void;
|
|
643
824
|
/**
|
|
@@ -646,14 +827,20 @@ export declare class GeoJSONSourceWithLayers<T extends FeatureCollection = Featu
|
|
|
646
827
|
onShow(listener: () => void): void;
|
|
647
828
|
/**
|
|
648
829
|
* Canonical id-based lookup into `shownFeatures.features`, by each feature's `properties.id`,
|
|
649
|
-
* otherwise its `id`. On duplicate ids, the first match wins. Returns `undefined` for
|
|
650
|
-
* or absent id.
|
|
830
|
+
* otherwise its `id`. On duplicate ids, the first match wins. Returns `undefined` for an absent id.
|
|
651
831
|
*/
|
|
652
832
|
findById(id: string | number | undefined): IndexedFeature<T['features'][number]> | undefined;
|
|
653
833
|
clear(): void;
|
|
834
|
+
/** Whether the source shows no feature. */
|
|
835
|
+
isEmpty(): boolean;
|
|
836
|
+
/** {@link show}, skipped where the source is empty and stays so: it isn't reloaded with nothing. */
|
|
837
|
+
showUnlessStillEmpty(featureCollection: T, options?: ShowOptions): void;
|
|
838
|
+
/** {@link clear}, skipped where the source is empty already. */
|
|
839
|
+
clearUnlessEmpty(): void;
|
|
654
840
|
private findFeature;
|
|
655
841
|
private showWithFeatures;
|
|
656
842
|
setEventState(options: SetEventStateOptions): void;
|
|
843
|
+
private showUnshownEventStates;
|
|
657
844
|
clearEventState(options: ClearEventStateOptions): void;
|
|
658
845
|
clearEventStates(options?: ClearEventStatesOptions): void;
|
|
659
846
|
/**
|
|
@@ -673,11 +860,14 @@ type CustomLayerHitCallbacks<HIT extends CustomLayerHit> = {
|
|
|
673
860
|
* itself, handing each change to the app's `setState`.
|
|
674
861
|
* @ignore
|
|
675
862
|
*/
|
|
676
|
-
export declare class CustomLayerSourceWithLayers<HIT extends CustomLayerHit = CustomLayerHit> {
|
|
863
|
+
export declare class CustomLayerSourceWithLayers<HIT extends CustomLayerHit = CustomLayerHit> implements EventStateKeeper<HIT['id']> {
|
|
677
864
|
readonly map: Map$1;
|
|
678
865
|
readonly layerId: string;
|
|
679
866
|
private readonly callbacks;
|
|
680
|
-
/**
|
|
867
|
+
/**
|
|
868
|
+
* A source id of its own: a custom layer has no source, and the handler index files by source id.
|
|
869
|
+
* Not its layer id, which a module's `sourceID` may equal, sharing its handlers and hovers.
|
|
870
|
+
*/
|
|
681
871
|
readonly source: {
|
|
682
872
|
readonly id: string;
|
|
683
873
|
};
|
|
@@ -692,9 +882,9 @@ export declare class CustomLayerSourceWithLayers<HIT extends CustomLayerHit = Cu
|
|
|
692
882
|
hitFeatures(point: Point2D): MapGeoJSONFeature[];
|
|
693
883
|
/** What the hit tester returned for a feature {@link hitFeatures} made. */
|
|
694
884
|
hitOf(feature: MapGeoJSONFeature): HIT;
|
|
885
|
+
eventStateKeyOf(feature: MapGeoJSONFeature): HIT['id'] | undefined;
|
|
695
886
|
eventStateOf(id: HIT['id']): EventState | undefined;
|
|
696
|
-
|
|
697
|
-
idsWithEventState(): HIT['id'][];
|
|
887
|
+
keysWithEventState(): HIT['id'][];
|
|
698
888
|
putEventState(id: HIT['id'], state: EventState | undefined): void;
|
|
699
889
|
/**
|
|
700
890
|
* Forgets every state, and hands none to the app from now on: the proxy can still hold this
|
|
@@ -910,6 +1100,11 @@ type HasAdditionalLayersConfig = {
|
|
|
910
1100
|
};
|
|
911
1101
|
//#endregion
|
|
912
1102
|
//#region src/shared/types/events.d.ts
|
|
1103
|
+
/**
|
|
1104
|
+
* The event states a click puts on a feature.
|
|
1105
|
+
* @ignore
|
|
1106
|
+
*/
|
|
1107
|
+
export declare const CLICK_EVENT_STATES: readonly ["click", "contextmenu"];
|
|
913
1108
|
/**
|
|
914
1109
|
* Subtype for click events.
|
|
915
1110
|
*
|
|
@@ -925,13 +1120,19 @@ type HasAdditionalLayersConfig = {
|
|
|
925
1120
|
*
|
|
926
1121
|
* @group User Interaction Events
|
|
927
1122
|
*/
|
|
928
|
-
type ClickEventType =
|
|
1123
|
+
export type ClickEventType = (typeof CLICK_EVENT_STATES)[number];
|
|
1124
|
+
/**
|
|
1125
|
+
* The event states the pointer puts on a feature it rests on. `recently-hovered` is not one of them.
|
|
1126
|
+
* @ignore
|
|
1127
|
+
*/
|
|
1128
|
+
export declare const HOVER_EVENT_STATES: readonly ["hover", "hover-move", "long-hover"];
|
|
929
1129
|
/**
|
|
930
1130
|
* Subtype for hover events with timing distinction.
|
|
931
1131
|
*
|
|
932
1132
|
* @remarks
|
|
933
1133
|
* - `hover`: Fires once when the cursor first enters a feature.
|
|
934
|
-
* - `hover-move`: Fires
|
|
1134
|
+
* - `hover-move`: Fires as the cursor moves while it stays over the same feature, at most once per
|
|
1135
|
+
* animation frame.
|
|
935
1136
|
* Use it for coordinates that follow the cursor along the feature, for example to move a tooltip
|
|
936
1137
|
* or snap to a route line.
|
|
937
1138
|
* - `long-hover`: Fires after the cursor stays over a feature for a configured duration (typically 300-800ms).
|
|
@@ -947,7 +1148,7 @@ type ClickEventType = 'click' | 'contextmenu';
|
|
|
947
1148
|
*
|
|
948
1149
|
* @group User Interaction Events
|
|
949
1150
|
*/
|
|
950
|
-
type HoverEventType =
|
|
1151
|
+
export type HoverEventType = (typeof HOVER_EVENT_STATES)[number];
|
|
951
1152
|
/**
|
|
952
1153
|
* Subtype for drag events, with the mouse or a single finger.
|
|
953
1154
|
*
|
|
@@ -972,7 +1173,7 @@ type HoverEventType = 'hover' | 'hover-move' | 'long-hover';
|
|
|
972
1173
|
*
|
|
973
1174
|
* @group User Interaction Events
|
|
974
1175
|
*/
|
|
975
|
-
type DragEventType = 'dragstart' | 'drag' | 'dragend';
|
|
1176
|
+
export type DragEventType = 'dragstart' | 'drag' | 'dragend';
|
|
976
1177
|
/**
|
|
977
1178
|
* A user event type the SDK supports beyond basic MapLibre events.
|
|
978
1179
|
*
|
|
@@ -989,7 +1190,7 @@ type DragEventType = 'dragstart' | 'drag' | 'dragend';
|
|
|
989
1190
|
*
|
|
990
1191
|
* @group User Interaction Events
|
|
991
1192
|
*/
|
|
992
|
-
type EventType = ClickEventType | HoverEventType | DragEventType;
|
|
1193
|
+
export type EventType = ClickEventType | HoverEventType | DragEventType;
|
|
993
1194
|
/**
|
|
994
1195
|
* The user event a feature is in, or `recently-hovered` for a moment after the pointer leaves it,
|
|
995
1196
|
* as stored in `properties.eventState`.
|
|
@@ -1003,12 +1204,12 @@ type EventType = ClickEventType | HoverEventType | DragEventType;
|
|
|
1003
1204
|
*
|
|
1004
1205
|
* @group User Interaction Events
|
|
1005
1206
|
*/
|
|
1006
|
-
type EventState = SetEventStateOptions['state'] | 'recently-hovered';
|
|
1207
|
+
export type EventState = SetEventStateOptions['state'] | 'recently-hovered';
|
|
1007
1208
|
/**
|
|
1008
1209
|
* Parameters to identify a shown feature by its ID or by its index.
|
|
1009
1210
|
* @group User Interaction Events
|
|
1010
1211
|
*/
|
|
1011
|
-
type ByIdOrIndex = {
|
|
1212
|
+
export type ByIdOrIndex = {
|
|
1012
1213
|
/**
|
|
1013
1214
|
* The feature's `properties.id`, otherwise its top-level `id`. This is the id the module's
|
|
1014
1215
|
* `getShown()` and event handlers return. You can't combine it with `index`.
|
|
@@ -1054,7 +1255,7 @@ type ByIdOrIndex = {
|
|
|
1054
1255
|
*
|
|
1055
1256
|
* @group User Interaction Events
|
|
1056
1257
|
*/
|
|
1057
|
-
type SetEventStateOptions = ByIdOrIndex & {
|
|
1258
|
+
export type SetEventStateOptions = ByIdOrIndex & {
|
|
1058
1259
|
/**
|
|
1059
1260
|
* The event state to set.
|
|
1060
1261
|
*
|
|
@@ -1124,7 +1325,7 @@ type SetEventStateOptions = ByIdOrIndex & {
|
|
|
1124
1325
|
*
|
|
1125
1326
|
* @group User Interaction Events
|
|
1126
1327
|
*/
|
|
1127
|
-
type ClearEventStateOptions = ByIdOrIndex & {
|
|
1328
|
+
export type ClearEventStateOptions = ByIdOrIndex & {
|
|
1128
1329
|
/**
|
|
1129
1330
|
* Whether to show the feature after clearing the event state.
|
|
1130
1331
|
*
|
|
@@ -1160,7 +1361,7 @@ type ClearEventStateOptions = ByIdOrIndex & {
|
|
|
1160
1361
|
*
|
|
1161
1362
|
* @group User Interaction Events
|
|
1162
1363
|
*/
|
|
1163
|
-
type ClearEventStatesOptions = {
|
|
1364
|
+
export type ClearEventStatesOptions = {
|
|
1164
1365
|
/**
|
|
1165
1366
|
* The event states to clear.
|
|
1166
1367
|
*
|
|
@@ -1206,7 +1407,7 @@ type ClearEventStatesOptions = {
|
|
|
1206
1407
|
*
|
|
1207
1408
|
* @group User Interaction Events
|
|
1208
1409
|
*/
|
|
1209
|
-
type EventStateIds = Partial<Record<EventState, (string | number)[]>>;
|
|
1410
|
+
export type EventStateIds = Partial<Record<EventState, (string | number)[]>>;
|
|
1210
1411
|
/**
|
|
1211
1412
|
* The properties part of an object that can have an event state.
|
|
1212
1413
|
*
|
|
@@ -1235,7 +1436,7 @@ type EventStateIds = Partial<Record<EventState, (string | number)[]>>;
|
|
|
1235
1436
|
*
|
|
1236
1437
|
* @group User Interaction Events
|
|
1237
1438
|
*/
|
|
1238
|
-
type SupportsEvents = {
|
|
1439
|
+
export type SupportsEvents = {
|
|
1239
1440
|
/**
|
|
1240
1441
|
* The feature's current event state.
|
|
1241
1442
|
*
|
|
@@ -1256,24 +1457,27 @@ type SupportsEvents = {
|
|
|
1256
1457
|
* The SDK calls it when a user interacts with features on the map, for example on click or hover.
|
|
1257
1458
|
* It receives the feature, the event location and all features at the event coordinates.
|
|
1258
1459
|
*
|
|
1259
|
-
* In GeoJSON modules (places, routes, geometries), `topFeature` is the
|
|
1260
|
-
*
|
|
1261
|
-
* feature
|
|
1460
|
+
* In GeoJSON modules (places, routes, geometries), `topFeature` is the feature as the module shows
|
|
1461
|
+
* it, with its dates and nested objects intact, but not the object you passed to `show()`. In
|
|
1462
|
+
* vector tile modules (POIs, traffic), `topFeature` comes from MapLibre's internal feature
|
|
1463
|
+
* representation.
|
|
1262
1464
|
*
|
|
1263
1465
|
* Depending on `MapEventsConfig.precisionMode`, the `lngLat` coordinates may be near the feature
|
|
1264
1466
|
* rather than exactly on it. In a drag event, `topFeature` and `allEventFeatures` are the ones
|
|
1265
1467
|
* pressed at `dragstart`, and `lngLat` is where the pointer is now.
|
|
1266
1468
|
*
|
|
1267
|
-
* `allEventFeatures` holds the
|
|
1469
|
+
* `allEventFeatures` holds the features at the event coordinates from the source that drew
|
|
1470
|
+
* `topFeature`, such as a route's waypoints but not its lines, each once even when
|
|
1268
1471
|
* drawn across several layers or tiles, in the same shape as `topFeature`, which is the first.
|
|
1269
|
-
*
|
|
1472
|
+
* A handler registered through `where()` gets only the ones in its scope: on its layers, and taken
|
|
1473
|
+
* by its predicate. To inspect every feature there across all modules, including the base map, project `lngLat` to
|
|
1270
1474
|
* a pixel and call `map.mapLibreMap.queryRenderedFeatures` around it.
|
|
1271
1475
|
*
|
|
1272
1476
|
* @typeParam T - The type of the top feature being interacted with
|
|
1273
1477
|
*
|
|
1274
1478
|
* @param topFeature - The event's primary target feature, positioned on top of any overlapping features.
|
|
1275
1479
|
* @param lngLat - The geographic coordinates where the event occurred
|
|
1276
|
-
* @param allEventFeatures - The features at the event coordinates, scoped to the
|
|
1480
|
+
* @param allEventFeatures - The features at the event coordinates, scoped to the source that drew `topFeature`.
|
|
1277
1481
|
* @param sourceWithLayers - The source and layer configuration to which the `topFeature` belongs
|
|
1278
1482
|
*
|
|
1279
1483
|
* @example
|
|
@@ -1289,7 +1493,7 @@ type SupportsEvents = {
|
|
|
1289
1493
|
* @example
|
|
1290
1494
|
* Hover handler for places with feature inspection:
|
|
1291
1495
|
* ```ts
|
|
1292
|
-
* placesModule.events.on('hover', (place, lngLat, allFeatures, source) => {
|
|
1496
|
+
* placesModule.events.places.on('hover', (place, lngLat, allFeatures, source) => {
|
|
1293
1497
|
* // Show tooltip with place information
|
|
1294
1498
|
* showTooltip({
|
|
1295
1499
|
* title: place.properties.poi?.name,
|
|
@@ -1308,19 +1512,19 @@ type SupportsEvents = {
|
|
|
1308
1512
|
*
|
|
1309
1513
|
* @group User Interaction Events
|
|
1310
1514
|
*/
|
|
1311
|
-
type UserEventHandler<T> = (topFeature: T, lngLat: LngLat, allEventFeatures: T[], sourceWithLayers: SourceWithLayers) => void;
|
|
1515
|
+
export type UserEventHandler<T> = (topFeature: T, lngLat: LngLat, allEventFeatures: T[], sourceWithLayers: SourceWithLayers) => void;
|
|
1312
1516
|
/**
|
|
1313
1517
|
* Allowed CSS cursor styles for map interactions.
|
|
1314
1518
|
*
|
|
1315
1519
|
* @group User Interaction Events
|
|
1316
1520
|
*/
|
|
1317
|
-
type CSSCursor = 'alias' | 'all-scroll' | 'auto' | 'cell' | 'context-menu' | 'col-resize' | 'copy' | 'crosshair' | 'default' | 'e-resize' | 'ew-resize' | 'grab' | 'grabbing' | 'help' | 'move' | 'n-resize' | 'ne-resize' | 'nesw-resize' | 'ns-resize' | 'nw-resize' | 'nwse-resize' | 'no-drop' | 'none' | 'not-allowed' | 'pointer' | 'progress' | 'row-resize' | 's-resize' | 'se-resize' | 'sw-resize' | 'text' | 'vertical-text' | 'w-resize' | 'wait' | 'zoom-in' | 'zoom-out';
|
|
1521
|
+
export type CSSCursor = 'alias' | 'all-scroll' | 'auto' | 'cell' | 'context-menu' | 'col-resize' | 'copy' | 'crosshair' | 'default' | 'e-resize' | 'ew-resize' | 'grab' | 'grabbing' | 'help' | 'move' | 'n-resize' | 'ne-resize' | 'nesw-resize' | 'ns-resize' | 'nw-resize' | 'nwse-resize' | 'no-drop' | 'none' | 'not-allowed' | 'pointer' | 'progress' | 'row-resize' | 's-resize' | 'se-resize' | 'sw-resize' | 'text' | 'vertical-text' | 'w-resize' | 'wait' | 'zoom-in' | 'zoom-out';
|
|
1318
1522
|
/**
|
|
1319
1523
|
* Event configuration options related to how the cursor appears during interactions.
|
|
1320
1524
|
*
|
|
1321
1525
|
* @group User Interaction Events
|
|
1322
1526
|
*/
|
|
1323
|
-
type EventHandlerCursorConfig = {
|
|
1527
|
+
export type EventHandlerCursorConfig = {
|
|
1324
1528
|
/**
|
|
1325
1529
|
* The cursor to show when hovering over interactive features, one of the CSS cursor keywords
|
|
1326
1530
|
* {@link CSSCursor} lists.
|
|
@@ -1355,7 +1559,7 @@ type EventHandlerCursorConfig = {
|
|
|
1355
1559
|
*
|
|
1356
1560
|
* @group User Interaction Events
|
|
1357
1561
|
*/
|
|
1358
|
-
type EventHandlerHoverConfig = {
|
|
1562
|
+
export type EventHandlerHoverConfig = {
|
|
1359
1563
|
/**
|
|
1360
1564
|
* How long, in milliseconds, a feature stays `recently-hovered` after the pointer leaves it.
|
|
1361
1565
|
* `0` clears its state at once.
|
|
@@ -1373,7 +1577,7 @@ type EventHandlerHoverConfig = {
|
|
|
1373
1577
|
*
|
|
1374
1578
|
* @group User Interaction Events
|
|
1375
1579
|
*/
|
|
1376
|
-
type EventHandlerConfig = EventHandlerCursorConfig & EventHandlerHoverConfig;
|
|
1580
|
+
export type EventHandlerConfig = EventHandlerCursorConfig & EventHandlerHoverConfig;
|
|
1377
1581
|
//#endregion
|
|
1378
1582
|
//#region src/shared/types/filters.d.ts
|
|
1379
1583
|
/**
|
|
@@ -1399,10 +1603,10 @@ export type FilterShowMode = (typeof filterShowModes)[number];
|
|
|
1399
1603
|
* @example
|
|
1400
1604
|
* ```typescript
|
|
1401
1605
|
* // Show only these categories
|
|
1402
|
-
* const
|
|
1606
|
+
* const onlyFilter: ValuesFilter<string> = { show: 'only', values: ['RESTAURANT', 'CAFE', 'BAR'] };
|
|
1403
1607
|
*
|
|
1404
1608
|
* // Hide these categories
|
|
1405
|
-
* const
|
|
1609
|
+
* const allExceptFilter: ValuesFilter<string> = { show: 'all-except', values: ['PARKING_GARAGE'] };
|
|
1406
1610
|
* ```
|
|
1407
1611
|
*
|
|
1408
1612
|
* @group Shared
|
|
@@ -1455,7 +1659,7 @@ type CustomImage<I extends string = string> = {
|
|
|
1455
1659
|
*/
|
|
1456
1660
|
id: I;
|
|
1457
1661
|
/**
|
|
1458
|
-
* The URL
|
|
1662
|
+
* The icon image: a URL, a data URI, SVG markup or an `img` element.
|
|
1459
1663
|
*
|
|
1460
1664
|
* @remarks
|
|
1461
1665
|
* To add a new icon to the sprite, set it. To reference an existing sprite icon, leave it out
|
|
@@ -1725,7 +1929,8 @@ export declare const MAP_ITALIC_FONT = "NotoSans-MediumItalic";
|
|
|
1725
1929
|
*/
|
|
1726
1930
|
export declare const DEFAULT_TEXT_SIZE: ExpressionSpecification;
|
|
1727
1931
|
/**
|
|
1728
|
-
*
|
|
1932
|
+
* The font faces of the TomTom map style a label can name. The style also draws some of its own
|
|
1933
|
+
* labels in the condensed `NotoSans-Condensed*` faces, which this list leaves out.
|
|
1729
1934
|
*
|
|
1730
1935
|
* @remarks
|
|
1731
1936
|
* Use it to select or validate fonts when creating custom layers. The `Noto-*` faces draw every
|
|
@@ -1755,11 +1960,10 @@ export declare const DEFAULT_TEXT_SIZE: ExpressionSpecification;
|
|
|
1755
1960
|
*/
|
|
1756
1961
|
export declare const mapFonts: readonly ["Noto-Regular", "NotoSans-MediumItalic", "Noto-Bold", "Noto-Medium", "NotoSans-RegularItalic", "NotoSans-BoldItalic", "NotoSerif-Regular", "NotoSerif-Medium", "NotoSerif-Bold", "NotoSerif-RegularItalic", "NotoSerif-MediumItalic", "NotoSerif-BoldItalic"];
|
|
1757
1962
|
/**
|
|
1758
|
-
* A font face
|
|
1963
|
+
* A font face of {@link mapFonts}.
|
|
1759
1964
|
*
|
|
1760
1965
|
* @remarks
|
|
1761
|
-
* Use it for type-safe font selection in text layers. It only accepts the
|
|
1762
|
-
* the map style.
|
|
1966
|
+
* Use it for type-safe font selection in text layers. It only accepts the faces {@link mapFonts} lists.
|
|
1763
1967
|
*
|
|
1764
1968
|
* @example
|
|
1765
1969
|
* ```typescript
|
|
@@ -1973,17 +2177,6 @@ type MapModuleCommonConfig = {
|
|
|
1973
2177
|
events?: EventHandlerConfig;
|
|
1974
2178
|
};
|
|
1975
2179
|
//#endregion
|
|
1976
|
-
//#region src/shared/types/style.d.ts
|
|
1977
|
-
/**
|
|
1978
|
-
* A light or dark theme.
|
|
1979
|
-
*
|
|
1980
|
-
* Use it to classify a map style as light or dark, or to apply light or dark configurations to the
|
|
1981
|
-
* map modules that support them.
|
|
1982
|
-
*
|
|
1983
|
-
* @group Map Style
|
|
1984
|
-
*/
|
|
1985
|
-
type LightDark = 'light' | 'dark';
|
|
1986
|
-
//#endregion
|
|
1987
2180
|
//#region src/shared/eventScope.d.ts
|
|
1988
2181
|
/**
|
|
1989
2182
|
* What `where()` accepts: a predicate over the feature type this surface exposes, or — where the
|
|
@@ -2013,9 +2206,10 @@ type ResolvedEventScope = {
|
|
|
2013
2206
|
*/
|
|
2014
2207
|
layerFilter?: LayerSpecFilter;
|
|
2015
2208
|
/**
|
|
2016
|
-
* Decides whether a rendered feature belongs to this scope. It receives the
|
|
2017
|
-
*
|
|
2018
|
-
*
|
|
2209
|
+
* Decides whether a rendered feature belongs to this scope. It receives the feature as shown:
|
|
2210
|
+
* from a GeoJSON source, the shown feature, with no `layer` or `source`, and from a vector tile
|
|
2211
|
+
* source the MapLibre feature. A module's `mapping` is composed into this function at `where()`
|
|
2212
|
+
* time, so the caller's predicate still sees the module's own feature type.
|
|
2019
2213
|
*/
|
|
2020
2214
|
featureMatches?: (feature: MapGeoJSONFeature) => boolean;
|
|
2021
2215
|
};
|
|
@@ -2103,8 +2297,9 @@ type HandlerEntry = {
|
|
|
2103
2297
|
type HandlerRegistration = Pick<HandlerEntry, 'config' | 'owner' | 'scope'>;
|
|
2104
2298
|
/**
|
|
2105
2299
|
* One event type's handlers, bucketed by the layer they listen to. Each bucket is in registration
|
|
2106
|
-
* order, and `findHandlers` lists the buckets in the order of its types, so
|
|
2107
|
-
*
|
|
2300
|
+
* order, and `findHandlers` lists the buckets in the order of its types, so its first entry, which
|
|
2301
|
+
* {@link AbstractEventProxy.firstHandler} finds alone, is the first one registered for the first type
|
|
2302
|
+
* that has one. That is what claims the hover cursor.
|
|
2108
2303
|
*
|
|
2109
2304
|
* @ignore
|
|
2110
2305
|
*/
|
|
@@ -2129,6 +2324,9 @@ type HandlersByLayer = Record<string, HandlerEntry[]>;
|
|
|
2129
2324
|
* contextmenu: {},
|
|
2130
2325
|
* 'hover-move': {},
|
|
2131
2326
|
* 'long-hover': {},
|
|
2327
|
+
* dragstart: {},
|
|
2328
|
+
* drag: {},
|
|
2329
|
+
* dragend: {},
|
|
2132
2330
|
* };
|
|
2133
2331
|
* ```
|
|
2134
2332
|
*
|
|
@@ -2139,9 +2337,9 @@ type EventHandlers = Record<EventType, HandlersByLayer>;
|
|
|
2139
2337
|
* @ignore
|
|
2140
2338
|
*/
|
|
2141
2339
|
declare abstract class AbstractEventProxy {
|
|
2142
|
-
protected interactiveLayerIDs: string[];
|
|
2143
|
-
protected handlers: EventHandlers;
|
|
2144
|
-
private registered;
|
|
2340
|
+
protected readonly interactiveLayerIDs: string[];
|
|
2341
|
+
protected readonly handlers: EventHandlers;
|
|
2342
|
+
private readonly registered;
|
|
2145
2343
|
/**
|
|
2146
2344
|
* Adds the given layers as interactive, so we'll listen to them for hover and click.
|
|
2147
2345
|
*
|
|
@@ -2155,12 +2353,13 @@ declare abstract class AbstractEventProxy {
|
|
|
2155
2353
|
private indexHandler;
|
|
2156
2354
|
private unindexHandlers;
|
|
2157
2355
|
/**
|
|
2158
|
-
* Detaches this source
|
|
2159
|
-
* layer none of the survivors still covers.
|
|
2356
|
+
* Detaches the handlers on this source id that the predicate matches, then stops listening to
|
|
2357
|
+
* any layer none of the survivors still covers.
|
|
2160
2358
|
*
|
|
2161
2359
|
* The source has to be part of the match: `UserEvents.on` registers one handler function
|
|
2162
2360
|
* across several sources and unsubscribes them one at a time, so the function alone does not
|
|
2163
|
-
* identify which registration to drop.
|
|
2361
|
+
* identify which registration to drop. It goes by id, which the source keeps across a style
|
|
2362
|
+
* change and across a config change that drops it and adds it back.
|
|
2164
2363
|
*/
|
|
2165
2364
|
private dropHandlers;
|
|
2166
2365
|
/**
|
|
@@ -2174,11 +2373,11 @@ declare abstract class AbstractEventProxy {
|
|
|
2174
2373
|
/**
|
|
2175
2374
|
* Removes a single handler function for the given source and event type.
|
|
2176
2375
|
* Other handlers registered for the same source and type are not affected.
|
|
2177
|
-
* @param
|
|
2376
|
+
* @param sourceId The id of the source whose handler should be removed.
|
|
2178
2377
|
* @param type The event type.
|
|
2179
2378
|
* @param handler The exact function reference to remove.
|
|
2180
2379
|
*/
|
|
2181
|
-
removeHandler(
|
|
2380
|
+
removeHandler(sourceId: string, type: EventType, handler: UserEventHandler<any>): void;
|
|
2182
2381
|
/**
|
|
2183
2382
|
* Removes every handler this owner registered for the given source and event type — what
|
|
2184
2383
|
* `events.off(type)` means. Scoped handlers go with the rest: a scope is a way of registering,
|
|
@@ -2187,20 +2386,16 @@ declare abstract class AbstractEventProxy {
|
|
|
2187
2386
|
* Matching is by owner rather than by layer set, because two modules can share one MapLibre
|
|
2188
2387
|
* source ID (POIs and the base map both use `vectorTiles`) and neither may drop the other's
|
|
2189
2388
|
* handlers.
|
|
2190
|
-
* @param
|
|
2389
|
+
* @param sourceId The id of the source whose handlers should go.
|
|
2191
2390
|
* @param type The event type to be removed.
|
|
2192
2391
|
* @param owner The module that registered them.
|
|
2193
2392
|
*/
|
|
2194
|
-
remove(
|
|
2393
|
+
remove(sourceId: string, type: EventType, owner: HandlerOwner): void;
|
|
2195
2394
|
/**
|
|
2196
2395
|
* Removes every handler of the source, of every event type, whoever registered it.
|
|
2197
2396
|
* @param sourceWithLayers The source going away.
|
|
2198
2397
|
*/
|
|
2199
2398
|
removeSource(sourceWithLayers: SourceWithLayers): void;
|
|
2200
|
-
/**
|
|
2201
|
-
* Removes all interactive sources and layers.
|
|
2202
|
-
*/
|
|
2203
|
-
removeAll(): void;
|
|
2204
2399
|
/**
|
|
2205
2400
|
* Whether any handler, of any event type, listens to this layer.
|
|
2206
2401
|
* @param layerId The layer id a rendered feature was drawn from.
|
|
@@ -2224,23 +2419,29 @@ declare abstract class AbstractEventProxy {
|
|
|
2224
2419
|
* A style change, and a layer added or removed afterwards, both leave the filed layer ids stale. MapLibre
|
|
2225
2420
|
* answers a rendered-features query that names a missing layer with nothing, so one stale id blanks every
|
|
2226
2421
|
* module's events.
|
|
2227
|
-
* @param sourcesWithLayers
|
|
2422
|
+
* @param sourcesWithLayers Every source the owner has now. A handler of the owner on a source missing from
|
|
2423
|
+
* them is filed under no layer, and comes back with the source, as a config change that drops a source and
|
|
2424
|
+
* then adds it again does.
|
|
2228
2425
|
* @param owner The module whose sources these are. Only its own handlers are refreshed: two
|
|
2229
2426
|
* modules can share one MapLibre source ID, so the ID alone cannot tell them apart.
|
|
2230
2427
|
* @returns Each source the owner's handlers pointed at, mapped to the one that replaced it.
|
|
2231
2428
|
*/
|
|
2232
2429
|
updateIfRegistered(sourcesWithLayers: SourcesWithLayers, owner: AnyMapModule): Map<SourceWithLayers, SourceWithLayers>;
|
|
2430
|
+
private handlersToRefile;
|
|
2233
2431
|
/**
|
|
2234
2432
|
* The handlers that should fire for a hit on `layerId`.
|
|
2235
2433
|
*
|
|
2236
2434
|
* The bucket *is* the layer, so no layer matching is needed here: a handler is filed under
|
|
2237
2435
|
* exactly the layers its scope selects, which is what keeps a click on a POI out of the base
|
|
2238
2436
|
* map's handler even though both register against the `vectorTiles` source.
|
|
2239
|
-
*
|
|
2240
|
-
* When a feature is supplied, handlers whose scope rejects it are dropped too — that is what
|
|
2241
|
-
* lets a feature-scoped handler drive its own hover cursor.
|
|
2242
2437
|
*/
|
|
2243
|
-
protected findHandlers: (types: EventType[], layerId: string | undefined
|
|
2438
|
+
protected findHandlers: (types: EventType[], layerId: string | undefined) => HandlerEntry[];
|
|
2439
|
+
/**
|
|
2440
|
+
* The first of {@link findHandlers} that accepts `feature`, without building the list: the pointer
|
|
2441
|
+
* path asks for it on every frame. A handler whose scope rejects the feature claims nothing, as a
|
|
2442
|
+
* press on a feature a drag handler rejects starts no drag.
|
|
2443
|
+
*/
|
|
2444
|
+
protected firstHandler(types: readonly EventType[], layerId: string | undefined, feature: MapGeoJSONFeature | undefined): HandlerEntry | undefined;
|
|
2244
2445
|
}
|
|
2245
2446
|
//#endregion
|
|
2246
2447
|
//#region src/init/types/mapEventsConfig.d.ts
|
|
@@ -2445,18 +2646,16 @@ type MapEventsConfig = EventHandlerConfig & {
|
|
|
2445
2646
|
* - Validate if a style ID is a standard style
|
|
2446
2647
|
* - Display available options to users
|
|
2447
2648
|
*
|
|
2448
|
-
* The array is declared
|
|
2449
|
-
* and to prevent modifications at runtime.
|
|
2649
|
+
* The array is declared `as const`, so the compiler treats it as read-only. Nothing freezes it at runtime.
|
|
2450
2650
|
*
|
|
2451
2651
|
* @example
|
|
2452
2652
|
* ```typescript
|
|
2453
2653
|
* import { standardStyleIDs } from '@tomtom-org/maps-sdk/map';
|
|
2454
2654
|
*
|
|
2455
2655
|
* // Build a dropdown menu with all standard styles
|
|
2456
|
-
* const styleSelector = document.
|
|
2656
|
+
* const styleSelector = document.querySelector<HTMLSelectElement>('#style-selector');
|
|
2457
2657
|
* standardStyleIDs.forEach((styleId) => {
|
|
2458
|
-
*
|
|
2459
|
-
* styleSelector.add(option);
|
|
2658
|
+
* styleSelector?.add(new Option(styleId));
|
|
2460
2659
|
* });
|
|
2461
2660
|
*
|
|
2462
2661
|
* // Check if a style ID is valid
|
|
@@ -2519,6 +2718,7 @@ type StandardStyle = {
|
|
|
2519
2718
|
id?: StandardStyleID;
|
|
2520
2719
|
/**
|
|
2521
2720
|
* Which {@link StylePart}s to load. Leave it out to load every part, or pass `[]` to load none.
|
|
2721
|
+
* Left out in a `setStyle` that carries state over, it keeps the previous style's parts.
|
|
2522
2722
|
*
|
|
2523
2723
|
* @default All style parts
|
|
2524
2724
|
*/
|
|
@@ -2652,7 +2852,29 @@ type TomTomMapParams = Partial<GlobalConfig> & {
|
|
|
2652
2852
|
*/
|
|
2653
2853
|
events?: MapEventsConfig;
|
|
2654
2854
|
/**
|
|
2655
|
-
*
|
|
2855
|
+
* Where the map's attribution ("copyright") for its data sources sits, your own credits in it,
|
|
2856
|
+
* and whether a backdrop sits behind it.
|
|
2857
|
+
*
|
|
2858
|
+
* The map always shows the TomTom and OpenStreetMap credits as logos, by default in the
|
|
2859
|
+
* bottom-right corner over a soft backdrop. Move them to another corner, change their
|
|
2860
|
+
* distance to the map edges, add credits of your own, or drop the backdrop.
|
|
2861
|
+
*
|
|
2862
|
+
* The attribution is a licensing requirement, so no option turns it off: wherever you
|
|
2863
|
+
* place it, keep it visible, readable and uncovered.
|
|
2864
|
+
*
|
|
2865
|
+
* @example
|
|
2866
|
+
* ```typescript
|
|
2867
|
+
* // Logos in the top-left, 16px from both edges
|
|
2868
|
+
* attribution: { position: 'top-left', padding: 16 }
|
|
2869
|
+
*
|
|
2870
|
+
* // Logos in the default corner, clear of a 64px bottom bar of your own
|
|
2871
|
+
* attribution: { padding: { horizontal: 12, vertical: 72 } }
|
|
2872
|
+
*
|
|
2873
|
+
* // Your own data's credit, after TomTom's
|
|
2874
|
+
* attribution: { credits: ['Weather data by Open-Meteo.com'] }
|
|
2875
|
+
* ```
|
|
2876
|
+
*
|
|
2877
|
+
* @see {@link AttributionOptions}
|
|
2656
2878
|
*/
|
|
2657
2879
|
attribution?: AttributionOptions;
|
|
2658
2880
|
/**
|
|
@@ -2737,12 +2959,14 @@ declare class EventsProxy extends AbstractEventProxy {
|
|
|
2737
2959
|
private hoveringFeature?;
|
|
2738
2960
|
private hoveringFeatures?;
|
|
2739
2961
|
private hoveringSourceWithLayers?;
|
|
2962
|
+
private hoveringHandler?;
|
|
2740
2963
|
private longHoverTimeoutHandlerID?;
|
|
2741
2964
|
private readonly recentHovers;
|
|
2742
2965
|
private firstDelayedHoverSinceMapMove;
|
|
2743
2966
|
private lastClickedFeature?;
|
|
2744
2967
|
private lastClickedSourceWithLayers?;
|
|
2745
2968
|
private lastCursorStyle;
|
|
2969
|
+
private mouseButtonDown;
|
|
2746
2970
|
private pendingMouseMove?;
|
|
2747
2971
|
private mouseMoveFrameRequested;
|
|
2748
2972
|
private lastHandledMouseMove?;
|
|
@@ -2775,7 +2999,6 @@ declare class EventsProxy extends AbstractEventProxy {
|
|
|
2775
2999
|
* extends Feature`).
|
|
2776
3000
|
*/
|
|
2777
3001
|
private toCallerFeatures;
|
|
2778
|
-
private callerFeaturesFor;
|
|
2779
3002
|
/**
|
|
2780
3003
|
* Hit-tests the custom layer's objects with the rendered features, while handlers listen to it.
|
|
2781
3004
|
*/
|
|
@@ -2791,15 +3014,16 @@ declare class EventsProxy extends AbstractEventProxy {
|
|
|
2791
3014
|
* hover states treat a custom layer's objects as any module's features.
|
|
2792
3015
|
*/
|
|
2793
3016
|
private withCustomLayerHits;
|
|
3017
|
+
private readonly isQueryable;
|
|
2794
3018
|
private queryRenderedFeatures;
|
|
2795
3019
|
private clearLongHoverTimeout;
|
|
2796
3020
|
private restartLongHoverTimeout;
|
|
2797
|
-
private handleLongHoverTimeout;
|
|
3021
|
+
private readonly handleLongHoverTimeout;
|
|
2798
3022
|
private claimsHover;
|
|
2799
3023
|
private claimingHandler;
|
|
2800
3024
|
private readonly sameClaim;
|
|
2801
3025
|
private rehover;
|
|
2802
|
-
private
|
|
3026
|
+
private onMoveStart;
|
|
2803
3027
|
private onMouseOut;
|
|
2804
3028
|
private onMouseDown;
|
|
2805
3029
|
private onMouseUp;
|
|
@@ -2807,7 +3031,6 @@ declare class EventsProxy extends AbstractEventProxy {
|
|
|
2807
3031
|
/**
|
|
2808
3032
|
* Holds a press on a draggable feature, and keeps MapLibre from panning the map under it. The
|
|
2809
3033
|
* top feature decides, as for every other event.
|
|
2810
|
-
* @returns Whether the press is on a draggable feature.
|
|
2811
3034
|
*/
|
|
2812
3035
|
private onPressStart;
|
|
2813
3036
|
private onPressMove;
|
|
@@ -2824,6 +3047,7 @@ declare class EventsProxy extends AbstractEventProxy {
|
|
|
2824
3047
|
* straight there.
|
|
2825
3048
|
*/
|
|
2826
3049
|
private onMouseMove;
|
|
3050
|
+
private readonly onMouseMoveFrame;
|
|
2827
3051
|
private handleMouseMove;
|
|
2828
3052
|
/**
|
|
2829
3053
|
* Handles the pointer arriving on a different feature: cursor, `eventState` marker, and the
|
|
@@ -2833,7 +3057,6 @@ declare class EventsProxy extends AbstractEventProxy {
|
|
|
2833
3057
|
private dispatchHoverEnter;
|
|
2834
3058
|
private dispatchHoverMove;
|
|
2835
3059
|
private dispatchToHandlers;
|
|
2836
|
-
private hoverGracePeriodFor;
|
|
2837
3060
|
private clearRecentHoverLater;
|
|
2838
3061
|
private updateHoverCursor;
|
|
2839
3062
|
private onMapClick;
|
|
@@ -2850,9 +3073,16 @@ export type UserEventsOptions<T, WHERE_SCOPE, SOURCE extends SourceWithLayers =
|
|
|
2850
3073
|
* The source(s) whose features this scope handles events for. Several sources back one scope
|
|
2851
3074
|
* when they carry the same data in different display modes — hexgrid, square and heatmap in
|
|
2852
3075
|
* {@link TrafficAreaAnalyticsModule}, clustered and unclustered places in {@link PlacesModule}.
|
|
2853
|
-
* Resolved on every `on` and
|
|
3076
|
+
* Resolved on every `on` and event-state call, and by `off` without {@link sourceIds}, since a
|
|
3077
|
+
* style switch or a config change replaces them.
|
|
2854
3078
|
*/
|
|
2855
3079
|
sourcesWithLayers: () => SOURCE[];
|
|
3080
|
+
/**
|
|
3081
|
+
* The ids of the sources this scope covers, the ones the module dropped for now included: a
|
|
3082
|
+
* handler on a dropped source waits in the event proxy for it to come back, so `off` has to
|
|
3083
|
+
* reach it there. Without it, `off` covers the current sources.
|
|
3084
|
+
*/
|
|
3085
|
+
sourceIds?: () => string[];
|
|
2856
3086
|
/**
|
|
2857
3087
|
* The module, or custom layer, that owns these sources. Kept with every handler so a
|
|
2858
3088
|
* style-change restore can tell handlers apart when two modules share one MapLibre source ID.
|
|
@@ -2866,7 +3096,8 @@ export type UserEventsOptions<T, WHERE_SCOPE, SOURCE extends SourceWithLayers =
|
|
|
2866
3096
|
*/
|
|
2867
3097
|
config?: () => EventHandlerConfig | undefined;
|
|
2868
3098
|
/**
|
|
2869
|
-
* Transforms
|
|
3099
|
+
* Transforms the feature as shown, the one {@link ResolvedEventScope.featureMatches} receives,
|
|
3100
|
+
* into the feature type `T` this scope exposes, so
|
|
2870
3101
|
* callers receive the module's own feature shape. Applied before handlers and before any
|
|
2871
3102
|
* {@link UserEvents.where} predicate, so a predicate also sees `T`.
|
|
2872
3103
|
*/
|
|
@@ -2900,13 +3131,14 @@ export type UserEventsOptions<T, WHERE_SCOPE, SOURCE extends SourceWithLayers =
|
|
|
2900
3131
|
*
|
|
2901
3132
|
* A handler has this signature:
|
|
2902
3133
|
* ```typescript
|
|
2903
|
-
* (feature: T, lngLat: LngLat, features: T[]) => void
|
|
3134
|
+
* (feature: T, lngLat: LngLat, features: T[], sourceWithLayers: SourceWithLayers) => void
|
|
2904
3135
|
* ```
|
|
2905
3136
|
*
|
|
2906
3137
|
* It receives:
|
|
2907
3138
|
* - `feature` - The primary feature under the cursor.
|
|
2908
3139
|
* - `lngLat` - The geographic coordinates of the event.
|
|
2909
3140
|
* - `features` - All features at this location, when several overlap.
|
|
3141
|
+
* - `sourceWithLayers` - The source, with its layers, the feature was found in.
|
|
2910
3142
|
*
|
|
2911
3143
|
* The SDK manages the cursor (pointer on hover) and handles overlapping features. Hover delays
|
|
2912
3144
|
* are configurable, and removing handlers cleans up memory safely.
|
|
@@ -2955,12 +3187,12 @@ export type UserEventsOptions<T, WHERE_SCOPE, SOURCE extends SourceWithLayers =
|
|
|
2955
3187
|
* const places = await PlacesModule.create(map);
|
|
2956
3188
|
*
|
|
2957
3189
|
* // Show title on hover
|
|
2958
|
-
* places.events.on('hover', (place) => {
|
|
3190
|
+
* const offHover = places.events.places.on('hover', (place) => {
|
|
2959
3191
|
* tooltip.show(place.properties.title);
|
|
2960
3192
|
* });
|
|
2961
3193
|
*
|
|
2962
3194
|
* // Show details on click
|
|
2963
|
-
* places.events.on('click', (place, lngLat) => {
|
|
3195
|
+
* const offClick = places.events.places.on('click', (place, lngLat) => {
|
|
2964
3196
|
* sidebar.show({
|
|
2965
3197
|
* title: place.properties.title,
|
|
2966
3198
|
* address: place.properties.address.freeformAddress,
|
|
@@ -2968,10 +3200,10 @@ export type UserEventsOptions<T, WHERE_SCOPE, SOURCE extends SourceWithLayers =
|
|
|
2968
3200
|
* });
|
|
2969
3201
|
* });
|
|
2970
3202
|
*
|
|
2971
|
-
* // Cleanup on component unmount
|
|
3203
|
+
* // Cleanup on component unmount: only these handlers, not other code's
|
|
2972
3204
|
* onUnmount(() => {
|
|
2973
|
-
*
|
|
2974
|
-
*
|
|
3205
|
+
* offHover();
|
|
3206
|
+
* offClick();
|
|
2975
3207
|
* });
|
|
2976
3208
|
* ```
|
|
2977
3209
|
*
|
|
@@ -3003,7 +3235,7 @@ export declare class UserEvents<T = MapGeoJSONFeature, WHERE_SCOPE = never> {
|
|
|
3003
3235
|
* this one, but two feature predicates read better as a single `a(f) && b(f)`.
|
|
3004
3236
|
*
|
|
3005
3237
|
* @param scope A predicate over this scope's feature type or, where the module supports one, a
|
|
3006
|
-
* scope object such as `{ layerGroups }`.
|
|
3238
|
+
* scope object such as `{ layerGroups }`.
|
|
3007
3239
|
* @param config The event configuration for handlers registered through the returned instance.
|
|
3008
3240
|
* Each scope can carry its own, which is how two parts of one module get different hover
|
|
3009
3241
|
* cursors. Defaults to the configuration this instance already uses.
|
|
@@ -3040,8 +3272,9 @@ export declare class UserEvents<T = MapGeoJSONFeature, WHERE_SCOPE = never> {
|
|
|
3040
3272
|
* The handler receives:
|
|
3041
3273
|
* - `feature` - The primary feature that triggered the event.
|
|
3042
3274
|
* - `lngLat` - The geographic coordinates of the event, as a MapLibre `LngLat` (`lngLat.lng`, `lngLat.lat`).
|
|
3043
|
-
* - `features` -
|
|
3044
|
-
*
|
|
3275
|
+
* - `features` - The features at the event location from the source that drew `feature`,
|
|
3276
|
+
* de-duplicated across its layers. Under {@link where}, only the ones in its scope: on its
|
|
3277
|
+
* layers, and taken by its predicate. To inspect features across all modules, query
|
|
3045
3278
|
* `map.mapLibreMap.queryRenderedFeatures(...)` directly, as {@link UserEventHandler} shows.
|
|
3046
3279
|
*
|
|
3047
3280
|
* Note that:
|
|
@@ -3104,24 +3337,23 @@ export declare class UserEvents<T = MapGeoJSONFeature, WHERE_SCOPE = never> {
|
|
|
3104
3337
|
/**
|
|
3105
3338
|
* Removes all event handlers for an event type.
|
|
3106
3339
|
*
|
|
3107
|
-
* This stops further event notifications for that type
|
|
3108
|
-
* leaks and unwanted behaviour.
|
|
3340
|
+
* This stops further event notifications for that type, from every handler of it.
|
|
3109
3341
|
*
|
|
3110
3342
|
* @param type The event type to stop listening for.
|
|
3111
3343
|
*
|
|
3112
3344
|
* @remarks
|
|
3113
|
-
* - It removes **all** of this module's handlers for the event type on the
|
|
3345
|
+
* - It removes **all** of this module's handlers for the event type on the sources these events
|
|
3114
3346
|
* cover, whichever of the module's events objects registered them. So
|
|
3115
3347
|
* `places.events.places.off('click')` also takes a `places.events.on('click', …)` handler off the
|
|
3116
3348
|
* pins, while that handler keeps firing on connections.
|
|
3117
|
-
* - To remove a single handler, call the unsubscribe function {@link on} returns.
|
|
3349
|
+
* - To remove a single handler, call the unsubscribe function {@link on} returns. That is how a
|
|
3350
|
+
* component cleans up on unmount, since `off` also removes the handlers other code put on the
|
|
3351
|
+
* module, such as a plugin's.
|
|
3118
3352
|
* - Other event types and other modules' handlers stay active. It also resets this module's cursor
|
|
3119
3353
|
* behaviour, and you can safely call it more than once, even when no handler exists.
|
|
3120
3354
|
*
|
|
3121
|
-
*
|
|
3122
|
-
*
|
|
3123
|
-
* handler by calling `off()` and then `on()`. Remove handlers before you remove features from
|
|
3124
|
-
* the map.
|
|
3355
|
+
* Use it to switch between interaction modes, to disable interactions temporarily, or to replace
|
|
3356
|
+
* a handler by calling `off()` and then `on()`.
|
|
3125
3357
|
*
|
|
3126
3358
|
* @example
|
|
3127
3359
|
* ```typescript
|
|
@@ -3143,14 +3375,13 @@ export declare class UserEvents<T = MapGeoJSONFeature, WHERE_SCOPE = never> {
|
|
|
3143
3375
|
* ```typescript
|
|
3144
3376
|
* // React component cleanup, with `pois` from `await POIsModule.get(map)`
|
|
3145
3377
|
* useEffect(() => {
|
|
3146
|
-
*
|
|
3147
|
-
*
|
|
3148
|
-
*
|
|
3149
|
-
*
|
|
3150
|
-
*
|
|
3151
|
-
*
|
|
3152
|
-
*
|
|
3153
|
-
* };
|
|
3378
|
+
* const unsubscribes = [
|
|
3379
|
+
* pois.events.on('click', handlePoiClick),
|
|
3380
|
+
* pois.events.on('hover', handlePoiHover),
|
|
3381
|
+
* ];
|
|
3382
|
+
*
|
|
3383
|
+
* // Cleanup on unmount, leaving other code's handlers in place
|
|
3384
|
+
* return () => unsubscribes.forEach((unsubscribe) => unsubscribe());
|
|
3154
3385
|
* }, [pois]);
|
|
3155
3386
|
* ```
|
|
3156
3387
|
*
|
|
@@ -3220,7 +3451,6 @@ export declare class CustomLayer<HIT extends CustomLayerHit = CustomLayerHit> {
|
|
|
3220
3451
|
* Takes the layer off the map, stops placing it after style changes, and drops its event handlers.
|
|
3221
3452
|
*/
|
|
3222
3453
|
remove(): void;
|
|
3223
|
-
private placeOnceReady;
|
|
3224
3454
|
private place;
|
|
3225
3455
|
private anchorLayerID;
|
|
3226
3456
|
}
|
|
@@ -3306,7 +3536,13 @@ type StylingFoundationsKnob = KnobEntry<StylingFoundationsKnobId, StylingFoundat
|
|
|
3306
3536
|
* @group Map Styling
|
|
3307
3537
|
*/
|
|
3308
3538
|
type StylingFoundationsModuleConfig = MapModuleCommonConfig & KnobConfigOf<{ [ID in StylingFoundationsKnobId]: StylingFoundationsKnobValueOf<ID>; }> & {
|
|
3309
|
-
labels?:
|
|
3539
|
+
labels?: {
|
|
3540
|
+
/**
|
|
3541
|
+
* A typeface of your own font files for every map label, which the SDK's own labels follow
|
|
3542
|
+
* unless their module sets a typeface of its own. While set, it wins over the `labels.typeface` knob.
|
|
3543
|
+
*/
|
|
3544
|
+
customTypeface?: NonNullable<LabelConfig['customTypeface']>;
|
|
3545
|
+
};
|
|
3310
3546
|
};
|
|
3311
3547
|
//#endregion
|
|
3312
3548
|
//#region src/styling/knobCatalogue.d.ts
|
|
@@ -3322,7 +3558,6 @@ type KnobDefinitionOf<KIND extends StylingFoundationsKnobKind> = Omit<KnobEntry<
|
|
|
3322
3558
|
*
|
|
3323
3559
|
* Ids are public API — additive only. Ranges follow the validated grammar of TomTom's style editor (factors
|
|
3324
3560
|
* 0.5–1.5 in 0.1 steps) so a value that looks right in the designer's tool looks right here.
|
|
3325
|
-
* @ignore
|
|
3326
3561
|
*/
|
|
3327
3562
|
declare const knobDefinitions: {
|
|
3328
3563
|
readonly 'colors.accent': {
|
|
@@ -3575,10 +3810,10 @@ export type BaseMapLayerGroupName = (typeof baseMapLayerGroupNames)[number];
|
|
|
3575
3810
|
*
|
|
3576
3811
|
* @example
|
|
3577
3812
|
* ```typescript
|
|
3578
|
-
* //
|
|
3813
|
+
* // Roads and borders alone
|
|
3579
3814
|
* const roadsOnly: BaseMapLayerGroups = { show: 'only', values: ['roads', 'roadLabels', 'borders'] };
|
|
3580
3815
|
*
|
|
3581
|
-
* //
|
|
3816
|
+
* // Everything but the buildings
|
|
3582
3817
|
* const noBuildings: BaseMapLayerGroups = { show: 'all-except', values: ['buildings2D', 'buildings3D'] };
|
|
3583
3818
|
* ```
|
|
3584
3819
|
*
|
|
@@ -3587,8 +3822,8 @@ export type BaseMapLayerGroupName = (typeof baseMapLayerGroupNames)[number];
|
|
|
3587
3822
|
export type BaseMapLayerGroups = ValuesFilter<BaseMapLayerGroupName>;
|
|
3588
3823
|
/**
|
|
3589
3824
|
* The road parts {@link BaseMapModule} shows or hides on their own, finer than the layer groups.
|
|
3590
|
-
* TomTom's style designers chose this granularity as toggle-worthy. An unset part
|
|
3591
|
-
* style ships it
|
|
3825
|
+
* TomTom's style designers chose this granularity as toggle-worthy. An unset part follows its group,
|
|
3826
|
+
* and is drawn as the style ships it while nothing sets the group or `visible`.
|
|
3592
3827
|
*
|
|
3593
3828
|
* @group Base Map
|
|
3594
3829
|
*/
|
|
@@ -3610,6 +3845,44 @@ export type BaseMapRoadsConfig = {
|
|
|
3610
3845
|
visible?: boolean;
|
|
3611
3846
|
};
|
|
3612
3847
|
};
|
|
3848
|
+
/**
|
|
3849
|
+
* How far a 3D building under one event state turns towards a colour.
|
|
3850
|
+
*
|
|
3851
|
+
* @group Base Map
|
|
3852
|
+
*/
|
|
3853
|
+
export type BaseMapBuildingStateLook = {
|
|
3854
|
+
/** The colour the building turns towards, as a CSS colour. Unset, the building stays as drawn. */
|
|
3855
|
+
color?: string;
|
|
3856
|
+
/** How far it turns, 0 (not at all) to 1 (fully). */
|
|
3857
|
+
intensity?: number;
|
|
3858
|
+
};
|
|
3859
|
+
/**
|
|
3860
|
+
* How the base map's 3D buildings look while hovered or clicked.
|
|
3861
|
+
*
|
|
3862
|
+
* @remarks
|
|
3863
|
+
* A building takes the event state while a handler of {@link BaseMapModule.events} reaches it, such
|
|
3864
|
+
* as one scoped to the `buildings3D` layer group. The click state stays until the next click lands
|
|
3865
|
+
* elsewhere.
|
|
3866
|
+
*
|
|
3867
|
+
* @example
|
|
3868
|
+
* ```typescript
|
|
3869
|
+
* const baseMap = await BaseMapModule.get(map, {
|
|
3870
|
+
* groups: { buildings3D: { visible: true } },
|
|
3871
|
+
* buildings3D: { hover: { color: '#f3a712' }, click: { color: '#e4572e', intensity: 0.8 } },
|
|
3872
|
+
* });
|
|
3873
|
+
* baseMap.events
|
|
3874
|
+
* .where({ layerGroups: { show: 'only', values: ['buildings3D'] } })
|
|
3875
|
+
* .on('click', (building) => console.log(building.id, building.properties));
|
|
3876
|
+
* ```
|
|
3877
|
+
*
|
|
3878
|
+
* @group Base Map
|
|
3879
|
+
*/
|
|
3880
|
+
export type BaseMapBuildings3DConfig = {
|
|
3881
|
+
/** The hovered building. Its intensity is `0.35` when unset. */
|
|
3882
|
+
hover?: BaseMapBuildingStateLook;
|
|
3883
|
+
/** The clicked building. Its intensity is `0.7` when unset. */
|
|
3884
|
+
click?: BaseMapBuildingStateLook;
|
|
3885
|
+
};
|
|
3613
3886
|
/**
|
|
3614
3887
|
* The configuration of the BaseMapModule, at initialization or at runtime.
|
|
3615
3888
|
*
|
|
@@ -3665,6 +3938,10 @@ export type BaseMapModuleConfig = MapModuleCommonConfig & {
|
|
|
3665
3938
|
* The visibility of road parts on their own. A part never shows while its group is hidden.
|
|
3666
3939
|
*/
|
|
3667
3940
|
roads?: BaseMapRoadsConfig;
|
|
3941
|
+
/**
|
|
3942
|
+
* How the 3D buildings look while hovered or clicked. Their visibility is `groups.buildings3D`.
|
|
3943
|
+
*/
|
|
3944
|
+
buildings3D?: BaseMapBuildings3DConfig;
|
|
3668
3945
|
};
|
|
3669
3946
|
//#endregion
|
|
3670
3947
|
//#region src/styling/styleLayerGroups.d.ts
|
|
@@ -3806,6 +4083,7 @@ export declare class LayerSelection {
|
|
|
3806
4083
|
/**
|
|
3807
4084
|
* Replaces the filter the style gave every matched layer. The filters other modules add, such as
|
|
3808
4085
|
* POI categories and traffic filters, still narrow it, and so do the clauses of {@link addFilterClause}.
|
|
4086
|
+
* `undefined` draws the layers unfiltered; {@link reset} gives them the style's filter back.
|
|
3809
4087
|
*/
|
|
3810
4088
|
setFilter(filter: FilterSpecification | undefined): this;
|
|
3811
4089
|
/**
|
|
@@ -3849,6 +4127,7 @@ declare class LayerOverrides {
|
|
|
3849
4127
|
private readonly filters;
|
|
3850
4128
|
private readonly clauses;
|
|
3851
4129
|
private readonly visibility;
|
|
4130
|
+
private contributed;
|
|
3852
4131
|
constructor(mapLibreMap: Map$1, filterComposer: LayerFilterComposer, visibilityComposer: LayerVisibilityComposer, warn: (key: string, message: string) => void);
|
|
3853
4132
|
/**
|
|
3854
4133
|
* Points the registry at the loaded style; overrides are kept and re-applied by {@link reapply}.
|
|
@@ -3856,22 +4135,31 @@ declare class LayerOverrides {
|
|
|
3856
4135
|
* the style already loaded does, so what they replaced still holds.
|
|
3857
4136
|
*/
|
|
3858
4137
|
index(layers: LayerSpecification[], sources: StyleSources, newStyle: boolean): void;
|
|
3859
|
-
/**
|
|
3860
|
-
|
|
4138
|
+
/**
|
|
4139
|
+
* Forgets every override (a clean style switch).
|
|
4140
|
+
* `layersKept` is true when MapLibre kept the layers the overrides were made on, as a `setStyle` to
|
|
4141
|
+
* the style already loaded does: what the paint and layout overrides replaced is written back first,
|
|
4142
|
+
* where the layer still holds the edit, and the filters, clauses and visibility leave the composers,
|
|
4143
|
+
* which drop contributions only on a new style. Elsewhere a reset ran first, such as the style knobs'.
|
|
4144
|
+
*/
|
|
4145
|
+
clear(layersKept: boolean): void;
|
|
3861
4146
|
resolve(query: LayerQuery): string[];
|
|
3862
|
-
override(query: LayerQuery,
|
|
4147
|
+
override(query: LayerQuery, overrides: PropertyOverride[]): void;
|
|
3863
4148
|
addFilterClause(query: LayerQuery, clause: ExpressionFilterSpecification): void;
|
|
3864
4149
|
removeFilterClause(query: LayerQuery, clause: ExpressionFilterSpecification): void;
|
|
3865
4150
|
overrideFilter(query: LayerQuery, filter: FilterSpecification | undefined): void;
|
|
3866
4151
|
overrideVisibility(query: LayerQuery, visible: boolean): void;
|
|
3867
4152
|
reset(query: LayerQuery): void;
|
|
3868
4153
|
/**
|
|
3869
|
-
* Lands every override again on top of the current style
|
|
3870
|
-
*
|
|
3871
|
-
* value equals the override, and else only where a knob wrote under it since; a
|
|
3872
|
-
* carrying the override
|
|
4154
|
+
* Lands every override again on top of the current style where the value it replaces moved, a
|
|
4155
|
+
* derivation worked out again from it. That value is re-read after a new style is indexed, even where
|
|
4156
|
+
* that style's own value equals the override, and else only where a knob wrote under it since; a
|
|
4157
|
+
* layer still carrying the override is left as it is. The filters, clauses and visibility go back to
|
|
4158
|
+
* the composers once per indexed style.
|
|
3873
4159
|
*/
|
|
3874
4160
|
reapply(): void;
|
|
4161
|
+
private withdrawFromKeptLayers;
|
|
4162
|
+
private landOrWarn;
|
|
3875
4163
|
private resolveToEdit;
|
|
3876
4164
|
private read;
|
|
3877
4165
|
private land;
|
|
@@ -3886,7 +4174,7 @@ declare class LayerOverrides {
|
|
|
3886
4174
|
*
|
|
3887
4175
|
* | Name | Theme label | Reaches |
|
|
3888
4176
|
* |---|---|---|
|
|
3889
|
-
* | `land` | Land (base) | Map background and other bare-land features. On the mono styles, every map colour left unset derives from it, borders and labels included. |
|
|
4177
|
+
* | `land` | Land (base) | Map background and other bare-land features. On the mono styles, every map colour left unset derives from it, borders and labels included, and `roadMajor` and `roadOutline` from a given `road` too. |
|
|
3890
4178
|
* | `water` | Water | Waterbodies, waterways and other water features. Also influences glaciers, water labels and ferry lines. |
|
|
3891
4179
|
* | `vegetation` | Vegetation | Forests and other land cover such as grass and shrubland. Also influences earth cover vegetation at smaller scales. |
|
|
3892
4180
|
* | `park` | Park & Recreation | City parks and sport/recreation grounds. Also influences National Parks and other protected areas at smaller scales. |
|
|
@@ -3905,6 +4193,8 @@ declare class LayerOverrides {
|
|
|
3905
4193
|
type MapColorName = 'land' | 'water' | 'vegetation' | 'park' | 'artificial' | 'roadMajor' | 'road' | 'roadOutline' | 'label' | 'labelHalo' | 'accent';
|
|
3906
4194
|
/**
|
|
3907
4195
|
* The colours that recolour base-map layers, which are every {@link MapColorName} but `accent`.
|
|
4196
|
+
*
|
|
4197
|
+
* @group Map Styling
|
|
3908
4198
|
*/
|
|
3909
4199
|
type BaseMapColorName = Exclude<MapColorName, 'accent'>;
|
|
3910
4200
|
/**
|
|
@@ -3926,6 +4216,8 @@ type MapColors = Partial<Record<MapColorName, string>>;
|
|
|
3926
4216
|
type PaintColorProperty = 'fill-color' | 'fill-outline-color' | 'line-color' | 'text-color' | 'text-halo-color' | 'fill-extrusion-color' | 'background-color' | 'hillshade-shadow-color' | 'hillshade-highlight-color' | 'hillshade-accent-color';
|
|
3927
4217
|
/**
|
|
3928
4218
|
* Every {@link BaseMapColorName}, in the themes' Foundations order, to build a base-map colour picker from.
|
|
4219
|
+
*
|
|
4220
|
+
* @group Map Styling
|
|
3929
4221
|
*/
|
|
3930
4222
|
export declare const baseMapColorNames: readonly BaseMapColorName[];
|
|
3931
4223
|
/**
|
|
@@ -3934,6 +4226,58 @@ export declare const baseMapColorNames: readonly BaseMapColorName[];
|
|
|
3934
4226
|
* @group Map Styling
|
|
3935
4227
|
*/
|
|
3936
4228
|
export declare const mapColorNames: readonly MapColorName[];
|
|
4229
|
+
/**
|
|
4230
|
+
* Whether a caller-supplied key names one of the map colours.
|
|
4231
|
+
* @ignore
|
|
4232
|
+
*/
|
|
4233
|
+
export declare const isMapColorName: (name: string) => name is MapColorName;
|
|
4234
|
+
/**
|
|
4235
|
+
* The id of a map colour's knob.
|
|
4236
|
+
* @ignore
|
|
4237
|
+
*/
|
|
4238
|
+
export declare const mapColorKnobId: <NAME extends MapColorName>(name: NAME) => `colors.${NAME}`;
|
|
4239
|
+
//#endregion
|
|
4240
|
+
//#region src/styling/mapLight.d.ts
|
|
4241
|
+
/**
|
|
4242
|
+
* Where the map's light comes from, as a compass: the light the styling module's `view.light.*` knobs
|
|
4243
|
+
* set, which the 3D buildings of the style and the plugins drawing their own lit surfaces share.
|
|
4244
|
+
*
|
|
4245
|
+
* @group Map Styling
|
|
4246
|
+
*/
|
|
4247
|
+
type MapLight = {
|
|
4248
|
+
/**
|
|
4249
|
+
* The compass direction the light comes from, in degrees clockwise from north, whatever the map's
|
|
4250
|
+
* bearing.
|
|
4251
|
+
*/
|
|
4252
|
+
direction: number;
|
|
4253
|
+
/**
|
|
4254
|
+
* How high the light stands, in degrees above the horizon: 90 is straight overhead.
|
|
4255
|
+
*/
|
|
4256
|
+
altitude: number;
|
|
4257
|
+
};
|
|
4258
|
+
/**
|
|
4259
|
+
* Gets where the map's light comes from right now, so a layer drawing its own lit surfaces can share
|
|
4260
|
+
* it. A light aligned with the viewport turns with the map, so read it again after the camera moves.
|
|
4261
|
+
*
|
|
4262
|
+
* @remarks
|
|
4263
|
+
* The standard styles place no light of their own, so this returns `undefined` until one is set,
|
|
4264
|
+
* through the styling module's `view.light.direction` or `view.light.altitude` knob, MapLibre's
|
|
4265
|
+
* `setLight`, or a style that declares a light. The 3D buildings and the textured surfaces of the
|
|
4266
|
+
* landmarks-3d plugin follow it while their own light knobs are unset.
|
|
4267
|
+
*
|
|
4268
|
+
* @returns The light's direction and altitude, or `undefined` while the map has no light placed, or
|
|
4269
|
+
* places it with an expression, such as one that moves it with the zoom, that no one direction
|
|
4270
|
+
* stands for. The plugins then light their surfaces from their presets.
|
|
4271
|
+
*
|
|
4272
|
+
* @example
|
|
4273
|
+
* ```typescript
|
|
4274
|
+
* await StylingFoundationsModule.get(map, { view: { light: { direction: 250, altitude: 20 } } });
|
|
4275
|
+
* const light = getMapLight(map); // { direction: 250, altitude: 20 } at bearing 0
|
|
4276
|
+
* ```
|
|
4277
|
+
*
|
|
4278
|
+
* @group Map Styling
|
|
4279
|
+
*/
|
|
4280
|
+
export declare const getMapLight: (map: TomTomMap) => MapLight | undefined;
|
|
3937
4281
|
//#endregion
|
|
3938
4282
|
//#region src/shared/knobs.d.ts
|
|
3939
4283
|
/**
|
|
@@ -3944,16 +4288,17 @@ export declare const mapColorNames: readonly MapColorName[];
|
|
|
3944
4288
|
* learned one catalogue can read the other.
|
|
3945
4289
|
*
|
|
3946
4290
|
* - `toggle`: `true`/`false`, e.g. whether an overlay is drawn.
|
|
3947
|
-
* - `factor`: a multiplier over
|
|
4291
|
+
* - `factor`: a multiplier over the default, the style's or the module's own (`1` = unchanged).
|
|
3948
4292
|
* - `number`: an absolute number with a range.
|
|
3949
|
-
* - `offset`: an `[x, y]` displacement on screen, x to the right and y down, each
|
|
3950
|
-
* knob's range. The description gives the unit.
|
|
3951
|
-
* - `color`: a CSS colour
|
|
4293
|
+
* - `offset`: an `[x, y]` displacement on screen, x to the right and y down, each checked against
|
|
4294
|
+
* the knob's range as far as its `bounds` say. The description gives the unit.
|
|
4295
|
+
* - `color`: a CSS colour in hex, `rgb()`, `hsl()` or a colour name, the syntaxes a map style paints.
|
|
3952
4296
|
* - `enum`: one of the knob's `options`.
|
|
3953
4297
|
* - `enums`: a list of the knob's `options`, e.g. the categories a filter shows. The description
|
|
3954
4298
|
* says when the order matters.
|
|
3955
|
-
* - `colors`: a list of colours, each a
|
|
3956
|
-
* are names the module resolves to colours, such as styling knob ids.
|
|
4299
|
+
* - `colors`: a list of colours, each a `color` knob's value or one of the knob's `options`, which
|
|
4300
|
+
* are names the module resolves to colours, such as styling knob ids. The description says what an
|
|
4301
|
+
* empty list does.
|
|
3957
4302
|
* - `image`: the id of an image in the loaded style's sprite, e.g. `poi-toll_plaza`.
|
|
3958
4303
|
* - `text`: any string, e.g. the label written after a distance.
|
|
3959
4304
|
* @group Shared
|
|
@@ -4054,12 +4399,13 @@ type ValuesFilterKnobId<PATH extends string> = `${PATH}.${keyof ValuesFilter<unk
|
|
|
4054
4399
|
* `groups.water.visible`. See {@link baseMapKnobCatalogue} for what each one does.
|
|
4055
4400
|
*
|
|
4056
4401
|
* @remarks
|
|
4057
|
-
* Every {@link BaseMapLayerGroupName} contributes one `groups.<group>.visible` id,
|
|
4058
|
-
* part of {@link BaseMapRoadsConfig} one `roads.<part>.visible` id
|
|
4402
|
+
* Every {@link BaseMapLayerGroupName} contributes one `groups.<group>.visible` id, every road
|
|
4403
|
+
* part of {@link BaseMapRoadsConfig} one `roads.<part>.visible` id, and the hover and click looks
|
|
4404
|
+
* of {@link BaseMapBuildings3DConfig} a `color` and an `intensity` id each.
|
|
4059
4405
|
*
|
|
4060
4406
|
* @group Base Map
|
|
4061
4407
|
*/
|
|
4062
|
-
type BaseMapKnobId = 'visible' | `groups.${BaseMapLayerGroupName}.visible` | `roads.${keyof BaseMapRoadsConfig}.visible`;
|
|
4408
|
+
type BaseMapKnobId = 'visible' | `groups.${BaseMapLayerGroupName}.visible` | `roads.${keyof BaseMapRoadsConfig}.visible` | `buildings3D.${keyof BaseMapBuildings3DConfig}.${keyof BaseMapBuildingStateLook}`;
|
|
4063
4409
|
/**
|
|
4064
4410
|
* The value type of a base-map knob, the plain value its path holds in {@link BaseMapModuleConfig}.
|
|
4065
4411
|
*
|
|
@@ -4068,12 +4414,13 @@ type BaseMapKnobId = 'visible' | `groups.${BaseMapLayerGroupName}.visible` | `ro
|
|
|
4068
4414
|
type BaseMapKnobValueOf<ID extends BaseMapKnobId> = KnobPlainValue<ValueAt<BaseMapModuleConfig, ID>>;
|
|
4069
4415
|
/**
|
|
4070
4416
|
* One entry of {@link baseMapKnobCatalogue}. The value in force is the one at its path in
|
|
4071
|
-
* {@link BaseMapModule.getConfig}. Without one,
|
|
4072
|
-
*
|
|
4417
|
+
* {@link BaseMapModule.getConfig}. Without one, its layers follow `visible` and any other group that
|
|
4418
|
+
* reaches them, and the style where nothing does. For a road part, {@link getKnob} reports whether the
|
|
4419
|
+
* style ships it shown.
|
|
4073
4420
|
*
|
|
4074
4421
|
* @group Base Map
|
|
4075
4422
|
*/
|
|
4076
|
-
type BaseMapKnob = KnobEntry<BaseMapKnobId, 'toggle'>;
|
|
4423
|
+
type BaseMapKnob = KnobEntry<BaseMapKnobId, 'toggle' | 'color' | 'number'>;
|
|
4077
4424
|
//#endregion
|
|
4078
4425
|
//#region src/pois/util/poiCategoryMapping.d.ts
|
|
4079
4426
|
/**
|
|
@@ -4104,13 +4451,15 @@ type MapStylePOICategory = POICategory;
|
|
|
4104
4451
|
* - `circle-icon` - Simple circular markers.
|
|
4105
4452
|
* - `base-map` - Mimics the map's built-in POI layer style with category icons, combining the `main`,
|
|
4106
4453
|
* `selected` and `micro` layers. To render only `micro`, hide `main` with
|
|
4107
|
-
* `layers.main.layout.visibility = 'none'`.
|
|
4454
|
+
* `layers.main.layout.visibility = 'none'`. `main` starts at zoom 10, so below it the places not
|
|
4455
|
+
* hovered or clicked draw only as `micro` dots; `layers.main.minzoom` lowers that floor.
|
|
4108
4456
|
* - `pin-clustered` - The same teardrop pins as `pin` for unclustered places, with nearby
|
|
4109
4457
|
* places aggregated into a single icon. A single-category cluster shows the matching
|
|
4110
4458
|
* base-map POI sprite with a small count badge in the top-right. A mixed-category
|
|
4111
4459
|
* cluster shows a larger centred count circle instead of the icon. Cluster features
|
|
4112
4460
|
* expose `clusterBaseMapIconIDs` (comma-separated, deduplicated) on their properties.
|
|
4113
|
-
* {@link PlacesModuleConfig.cluster} configures both.
|
|
4461
|
+
* {@link PlacesModuleConfig.cluster} configures both. The `micro` layer also draws every place,
|
|
4462
|
+
* clustered or not, as a base-map micro dot.
|
|
4114
4463
|
*
|
|
4115
4464
|
* @group Places
|
|
4116
4465
|
*/
|
|
@@ -4312,8 +4661,8 @@ type PlaceLayersConfig = {
|
|
|
4312
4661
|
* The main place marker layer specification.
|
|
4313
4662
|
*
|
|
4314
4663
|
* @remarks
|
|
4315
|
-
* It sets the look of
|
|
4316
|
-
*
|
|
4664
|
+
* It sets the look of the places that are not highlighted or selected. The `selected`
|
|
4665
|
+
* layer draws those, and takes its own override.
|
|
4317
4666
|
*/
|
|
4318
4667
|
main?: Partial<ToBeAddedLayerSpecTemplate<SymbolLayerSpecification>>;
|
|
4319
4668
|
/**
|
|
@@ -4335,7 +4684,7 @@ type PlaceLayersConfig = {
|
|
|
4335
4684
|
* It sets the look of places when they are highlighted or selected, such as on hover
|
|
4336
4685
|
* or click. It renders on top of the main layer, so selected places are always visible.
|
|
4337
4686
|
*
|
|
4338
|
-
* This layer
|
|
4687
|
+
* This layer draws the places in any event state but `recently-hovered`.
|
|
4339
4688
|
*/
|
|
4340
4689
|
selected?: Partial<ToBeAddedLayerSpecTemplate<SymbolLayerSpecification>>;
|
|
4341
4690
|
/**
|
|
@@ -4377,8 +4726,8 @@ type PlaceLayersConfig = {
|
|
|
4377
4726
|
* @remarks
|
|
4378
4727
|
* It replaces the cluster icon entirely when a cluster spans multiple POI
|
|
4379
4728
|
* categories. The count circle takes the centre, with {@link clusterMixedCount}
|
|
4380
|
-
* rendered on top.
|
|
4381
|
-
*
|
|
4729
|
+
* rendered on top. It draws only the clusters whose places span more than one
|
|
4730
|
+
* category, so single-category clusters use {@link cluster} and
|
|
4382
4731
|
* {@link clusterBadge} instead.
|
|
4383
4732
|
*/
|
|
4384
4733
|
clusterMixedBadge?: Partial<ToBeAddedLayerSpecTemplate<CircleLayerSpecification>>;
|
|
@@ -4532,7 +4881,8 @@ type PlaceConnectionLabelConfig = {
|
|
|
4532
4881
|
* Appearance of the cluster count badge under the `pin-clustered` marker type.
|
|
4533
4882
|
*
|
|
4534
4883
|
* @remarks
|
|
4535
|
-
* Each field applies to single-category and mixed-category clusters alike
|
|
4884
|
+
* Each field applies to single-category and mixed-category clusters alike, but for `radius`, set
|
|
4885
|
+
* per kind, and `offset`, which mixed-category clusters ignore. The matching
|
|
4536
4886
|
* {@link PlaceLayersConfig} entry (`clusterBadge`, `clusterCount`, `clusterMixedBadge`,
|
|
4537
4887
|
* `clusterMixedCount`) overrides it for the paint and layout properties it names.
|
|
4538
4888
|
*
|
|
@@ -4652,7 +5002,7 @@ type PlacesClusterConfig = {
|
|
|
4652
5002
|
*/
|
|
4653
5003
|
type PlacesClusterSourceConfig = {
|
|
4654
5004
|
/**
|
|
4655
|
-
* How near places merge into one cluster, in pixels.
|
|
5005
|
+
* How near places merge into one cluster, in pixels. MapLibre reads `0` as `50`.
|
|
4656
5006
|
*
|
|
4657
5007
|
* @default 60
|
|
4658
5008
|
*/
|
|
@@ -4660,6 +5010,10 @@ type PlacesClusterSourceConfig = {
|
|
|
4660
5010
|
/**
|
|
4661
5011
|
* Highest zoom that clusters places; past it every place is drawn on its own.
|
|
4662
5012
|
*
|
|
5013
|
+
* @remarks
|
|
5014
|
+
* Takes `1` to `17`. MapLibre reads `0` as `17`, and its place data stops at zoom 18, so `18` or
|
|
5015
|
+
* more never splits a cluster.
|
|
5016
|
+
*
|
|
4663
5017
|
* @default 17
|
|
4664
5018
|
*/
|
|
4665
5019
|
maxZoom?: number;
|
|
@@ -4702,8 +5056,8 @@ type PlaceEntryPointsShowFor = 'all' | 'selected' | 'clicked';
|
|
|
4702
5056
|
*
|
|
4703
5057
|
* @remarks
|
|
4704
5058
|
* Each layer ID derives from the PlacesModule instance prefix:
|
|
4705
|
-
* - `point` -
|
|
4706
|
-
* - `line` -
|
|
5059
|
+
* - `point` - `<prefix>-entry-point`, a circle on each entry point, larger for a `main` one than for the rest.
|
|
5060
|
+
* - `line` - `<prefix>-entry-point-line`, a dotted line from the place to each of its entry points.
|
|
4707
5061
|
*
|
|
4708
5062
|
* @group Places
|
|
4709
5063
|
*/
|
|
@@ -4800,7 +5154,7 @@ type PlacesBeforeLayerConfig = PartsBeforeLayerConfig<'places' | 'connections'>;
|
|
|
4800
5154
|
* };
|
|
4801
5155
|
*
|
|
4802
5156
|
* // Advanced configuration with custom properties
|
|
4803
|
-
* const
|
|
5157
|
+
* const baseMapConfig: PlacesModuleConfig = {
|
|
4804
5158
|
* markerType: 'base-map',
|
|
4805
5159
|
* icon: {
|
|
4806
5160
|
* categoryIcons: [
|
|
@@ -4831,7 +5185,7 @@ type PlacesModuleConfig<P extends CommonPlaceProps = CommonPlaceProps> = MapModu
|
|
|
4831
5185
|
*
|
|
4832
5186
|
* @remarks
|
|
4833
5187
|
* {@link PlaceIconConfig.categoryIcons} replace its icon for the categories they name, under
|
|
4834
|
-
* every marker type.
|
|
5188
|
+
* every marker type. The `micro` dots and the `pin-clustered` cluster pin keep the style's sprites.
|
|
4835
5189
|
*
|
|
4836
5190
|
* @default 'pin'
|
|
4837
5191
|
*/
|
|
@@ -5059,7 +5413,7 @@ export declare const placesKnobIds: readonly PlacesKnobId[];
|
|
|
5059
5413
|
* the main layer's `icon-image` expression binds to with `['get', 'iconID']`.
|
|
5060
5414
|
* The base map's POI-Micro-like layer inherits the style's `['get','group']`
|
|
5061
5415
|
* expression verbatim, so custom `PlaceIconConfig.categoryIcons` sprites apply
|
|
5062
|
-
* only to the `main`
|
|
5416
|
+
* only to the `main` and `selected` layers.
|
|
5063
5417
|
* - The `base-map` and `pin-clustered` marker types also populate
|
|
5064
5418
|
* {@link PlaceDisplayProps.category | category} and
|
|
5065
5419
|
* {@link PlaceDisplayProps.group | group}, so the base map style's own
|
|
@@ -5092,9 +5446,9 @@ export type PlaceDisplayProps = {
|
|
|
5092
5446
|
* The unique ID of the place feature.
|
|
5093
5447
|
*
|
|
5094
5448
|
* @remarks
|
|
5095
|
-
*
|
|
5096
|
-
*
|
|
5097
|
-
*
|
|
5449
|
+
* The place's own `id`, or one the SDK generates when it has none. The SDK copies it to
|
|
5450
|
+
* `properties.id`, which identifies the feature on every source, clustered ones included, in
|
|
5451
|
+
* events, hit-testing and data updates.
|
|
5098
5452
|
*
|
|
5099
5453
|
* @example
|
|
5100
5454
|
* ```typescript
|
|
@@ -5128,7 +5482,7 @@ export type PlaceDisplayProps = {
|
|
|
5128
5482
|
* sprite, so its ID carries that sprite's namespace.
|
|
5129
5483
|
* - `circle-icon` and `base-map` pick the base map's `poi-<category>` image.
|
|
5130
5484
|
* - A custom `PlaceIconConfig.categoryIcons` entry overrides the default for
|
|
5131
|
-
* the main
|
|
5485
|
+
* the main and selected layers on any marker type.
|
|
5132
5486
|
*
|
|
5133
5487
|
* @example
|
|
5134
5488
|
* ```typescript
|
|
@@ -5143,9 +5497,8 @@ export type PlaceDisplayProps = {
|
|
|
5143
5497
|
*
|
|
5144
5498
|
* @remarks
|
|
5145
5499
|
* Populated only for the `base-map` and `pin-clustered` marker types. Values are the lowercased
|
|
5146
|
-
* IDs the base map style uses, derived
|
|
5147
|
-
*
|
|
5148
|
-
* POI-like layers.
|
|
5500
|
+
* IDs the base map style uses, derived from the place's POI category. The style expressions the
|
|
5501
|
+
* POI-like layers inherit read it, such as their `text-color`.
|
|
5149
5502
|
*
|
|
5150
5503
|
* @example
|
|
5151
5504
|
* ```typescript
|
|
@@ -5159,9 +5512,9 @@ export type PlaceDisplayProps = {
|
|
|
5159
5512
|
* The base map style POI group the place belongs to.
|
|
5160
5513
|
*
|
|
5161
5514
|
* @remarks
|
|
5162
|
-
* Populated only for the `base-map` and `pin-clustered` marker types.
|
|
5163
|
-
* `text-color`
|
|
5164
|
-
*
|
|
5515
|
+
* Populated only for the `base-map` and `pin-clustered` marker types. The style expressions the
|
|
5516
|
+
* POI-like layers inherit read it, such as their `text-color` and the `POI - Micro` `icon-image`.
|
|
5517
|
+
* Values are the base map style's groups, such as
|
|
5165
5518
|
* `eat_and_drink`, `lodging`, `driving`, `transport`, `shopping`,
|
|
5166
5519
|
* `healthcare`, `finance`, `cultural`, `leisure`, `sport`, `outdoor`,
|
|
5167
5520
|
* `protected`, `public`, `religion`, `military`, `business`, `education`,
|
|
@@ -5181,8 +5534,10 @@ export type PlaceDisplayProps = {
|
|
|
5181
5534
|
* poi: {
|
|
5182
5535
|
* name: 'Central Station',
|
|
5183
5536
|
* categories: ['RAILWAY_STATION'],
|
|
5537
|
+
* localizedCategories: ['railway station'],
|
|
5184
5538
|
* },
|
|
5185
5539
|
* address: {
|
|
5540
|
+
* freeformAddress: 'Stationsplein, 1012 AB Amsterdam',
|
|
5186
5541
|
* streetName: 'Damrak',
|
|
5187
5542
|
* municipalitySubdivision: 'Amsterdam',
|
|
5188
5543
|
* countryCode: 'NL',
|
|
@@ -5245,8 +5600,8 @@ type PlaceEntryPointFeature = Feature<Point, PlaceEntryPointProps & {
|
|
|
5245
5600
|
*/
|
|
5246
5601
|
type ConnectionFeatureProps = {
|
|
5247
5602
|
id: string;
|
|
5248
|
-
fromId
|
|
5249
|
-
toId
|
|
5603
|
+
fromId: string;
|
|
5604
|
+
toId: string;
|
|
5250
5605
|
label: string;
|
|
5251
5606
|
} & SupportsEvents;
|
|
5252
5607
|
/**
|
|
@@ -5325,7 +5680,7 @@ export type PlacesEvents = CombinedEvents<MapGeoJSONFeature, PlacesModuleConfig,
|
|
|
5325
5680
|
* `cluster: true`, `cluster_id` and `point_count` in its properties.
|
|
5326
5681
|
*/
|
|
5327
5682
|
places: UserEventsWithStates<Place<DisplayPlaceProps>>;
|
|
5328
|
-
/** The lines and labels
|
|
5683
|
+
/** The lines and labels between pairs of places, when connections are shown. */
|
|
5329
5684
|
connections: UserEventsWithStates<MapGeoJSONFeature>;
|
|
5330
5685
|
/** The entry points of places, when {@link PlacesModuleConfig.entryPoints} draws them. */
|
|
5331
5686
|
entryPoints: UserEventsWithStates<PlaceEntryPointFeature>;
|
|
@@ -5370,12 +5725,12 @@ export type PlacesEvents = CombinedEvents<MapGeoJSONFeature, PlacesModuleConfig,
|
|
|
5370
5725
|
* // Display places from search
|
|
5371
5726
|
* await placesModule.show(searchResults);
|
|
5372
5727
|
*
|
|
5373
|
-
* // Handle clicks
|
|
5374
|
-
* placesModule.events.on('click', (feature) => {
|
|
5728
|
+
* // Handle clicks on places, leaving out clusters, connections and entry points
|
|
5729
|
+
* placesModule.events.places.on('click', (feature) => {
|
|
5375
5730
|
* console.log('Clicked:', feature.properties);
|
|
5376
5731
|
* });
|
|
5377
5732
|
*
|
|
5378
|
-
* placesModule.events.on('hover', (feature) => {
|
|
5733
|
+
* placesModule.events.places.on('hover', (feature) => {
|
|
5379
5734
|
* showTooltip(feature.properties.poi?.name);
|
|
5380
5735
|
* });
|
|
5381
5736
|
* ```
|
|
@@ -5388,7 +5743,7 @@ export declare class PlacesModule extends AbstractDataOwnedMapModule<PlacesSourc
|
|
|
5388
5743
|
private layerSpecs;
|
|
5389
5744
|
private connectionLayerSpecs;
|
|
5390
5745
|
private entryPointLayerSpecs;
|
|
5391
|
-
private
|
|
5746
|
+
private entryPointsRefreshHeld;
|
|
5392
5747
|
private currentClusterOptions?;
|
|
5393
5748
|
private sourceID;
|
|
5394
5749
|
private unclusteredSourceID;
|
|
@@ -5469,8 +5824,11 @@ export declare class PlacesModule extends AbstractDataOwnedMapModule<PlacesSourc
|
|
|
5469
5824
|
private showPlaces;
|
|
5470
5825
|
private updateConnectionsData;
|
|
5471
5826
|
private updateEntryPointsData;
|
|
5827
|
+
private withoutEntryPointsRefresh;
|
|
5472
5828
|
private applyVisibilityTo;
|
|
5473
5829
|
private applyPlacesVisibility;
|
|
5830
|
+
private applyConnectionsVisibility;
|
|
5831
|
+
private applyEntryPointsVisibility;
|
|
5474
5832
|
private setupImages;
|
|
5475
5833
|
private updateData;
|
|
5476
5834
|
/**
|
|
@@ -5487,13 +5845,13 @@ export declare class PlacesModule extends AbstractDataOwnedMapModule<PlacesSourc
|
|
|
5487
5845
|
* Places that carry `properties.eventState`, such as `getShown().places`, keep theirs.
|
|
5488
5846
|
* - Drops the shown connections (see {@link PlaceConnectionDisplay}).
|
|
5489
5847
|
* - Applies the current module styling configuration.
|
|
5490
|
-
* -
|
|
5848
|
+
* - Labels each place with its title, which `label.title` replaces.
|
|
5491
5849
|
* - Waits for the module to be ready before displaying.
|
|
5492
5850
|
*
|
|
5493
5851
|
* Data sources:
|
|
5494
5852
|
* - TomTom Search API results
|
|
5495
5853
|
* - Custom place objects matching the Place interface
|
|
5496
|
-
* - GeoJSON Point features
|
|
5854
|
+
* - GeoJSON Point features with an `id` and a `properties.type`
|
|
5497
5855
|
*
|
|
5498
5856
|
* {@link ShownPlaces} names the places services whose results are not places, and what shows them.
|
|
5499
5857
|
*
|
|
@@ -5511,10 +5869,16 @@ export declare class PlacesModule extends AbstractDataOwnedMapModule<PlacesSourc
|
|
|
5511
5869
|
* ```typescript
|
|
5512
5870
|
* await placesModule.show({
|
|
5513
5871
|
* type: 'Feature',
|
|
5872
|
+
* id: 'amsterdam-central',
|
|
5514
5873
|
* geometry: { type: 'Point', coordinates: [4.9041, 52.3676] },
|
|
5515
5874
|
* properties: {
|
|
5875
|
+
* type: 'POI',
|
|
5516
5876
|
* address: { freeformAddress: 'Amsterdam' },
|
|
5517
|
-
* poi: {
|
|
5877
|
+
* poi: {
|
|
5878
|
+
* name: 'Amsterdam Central',
|
|
5879
|
+
* categories: ['RAILWAY_STATION'],
|
|
5880
|
+
* localizedCategories: ['railway station']
|
|
5881
|
+
* }
|
|
5518
5882
|
* }
|
|
5519
5883
|
* });
|
|
5520
5884
|
* ```
|
|
@@ -5563,7 +5927,7 @@ export declare class PlacesModule extends AbstractDataOwnedMapModule<PlacesSourc
|
|
|
5563
5927
|
* label: { title: (c) => `${c.distanceMeters} m` }
|
|
5564
5928
|
* }
|
|
5565
5929
|
* });
|
|
5566
|
-
* await places.show([station, ...cafes]);
|
|
5930
|
+
* await places.show([station, ...cafes.features]);
|
|
5567
5931
|
* await places.showConnections(
|
|
5568
5932
|
* cafes.features.map((cafe) => ({
|
|
5569
5933
|
* from: station.id,
|
|
@@ -5611,8 +5975,8 @@ export declare class PlacesModule extends AbstractDataOwnedMapModule<PlacesSourc
|
|
|
5611
5975
|
//#endregion
|
|
5612
5976
|
//#region src/places/utils/preparePlacesForDisplay.d.ts
|
|
5613
5977
|
/**
|
|
5614
|
-
* Returns the POI name, otherwise the free-form address,
|
|
5615
|
-
* place when {@link PlaceLabelConfig.title} is not a function.
|
|
5978
|
+
* Returns the POI name, otherwise the free-form address, otherwise an empty string, as the label
|
|
5979
|
+
* {@link PlacesModule} gives a place when {@link PlaceLabelConfig.title} is not a function.
|
|
5616
5980
|
*
|
|
5617
5981
|
* @example
|
|
5618
5982
|
* ```typescript
|
|
@@ -5738,21 +6102,6 @@ export declare const poiCategoryGroups: {
|
|
|
5738
6102
|
* Each group contains multiple {@link MapStylePOICategory} values that share a common theme.
|
|
5739
6103
|
* With a group, a single filter value shows or hides multiple related POI types.
|
|
5740
6104
|
*
|
|
5741
|
-
* Available groups:
|
|
5742
|
-
* - `FOOD_DRINKS_GROUP` - Restaurants, cafes, fast food, wineries, etc.
|
|
5743
|
-
* - `SHOPPING_GROUP` - Stores, malls, markets, supermarkets, etc.
|
|
5744
|
-
* - `TRANSPORTATION_GROUP` - Airports, train stations, bus stops, ferry terminals, etc.
|
|
5745
|
-
* - `HEALTH_GROUP` - Hospitals, clinics, pharmacies, doctors, dentists, etc.
|
|
5746
|
-
* - `PARKING_GROUP` - Parking garages and open parking areas
|
|
5747
|
-
* - `HOLIDAY_TOURISM_GROUP` - Tourist attractions, museums, beaches, scenic views, etc.
|
|
5748
|
-
* - `EV_CHARGING_STATIONS_GROUP` - Electric vehicle charging stations
|
|
5749
|
-
* - `GAS_STATIONS_GROUP` - Gas and petrol stations
|
|
5750
|
-
* - `ACCOMMODATION_GROUP` - Hotels, motels, camping grounds, etc.
|
|
5751
|
-
* - `ENTERTAINMENT_GROUP` - Cinemas, theaters, nightlife, casinos, etc.
|
|
5752
|
-
* - `SPORTS_LEISURE_GROUP` - Stadiums, sports centers, swimming pools, golf courses, etc.
|
|
5753
|
-
* - `EDUCATION_GROUP` - Schools, universities, libraries, cultural centers
|
|
5754
|
-
* - `GOVERNMENT_GROUP` - Government offices, courthouses, embassies, police, fire stations
|
|
5755
|
-
*
|
|
5756
6105
|
* @example
|
|
5757
6106
|
* Filter to show only food-related POIs:
|
|
5758
6107
|
* ```ts
|
|
@@ -5815,7 +6164,8 @@ type POIIconConfig = {
|
|
|
5815
6164
|
* - The map style knows fewer categories than search does. `CAFE` and `CAFE_PUB` are one category
|
|
5816
6165
|
* on the map, so an entry for either reaches both POIs, and the first entry listed wins.
|
|
5817
6166
|
* - The image is scaled with the style's own icons, `sizeFactor` included, so one the size
|
|
5818
|
-
* of a style POI icon keeps the map's density. `offsetX`
|
|
6167
|
+
* of a style POI icon keeps the map's density. A non-zero `offsetX` or `offsetY` replaces the
|
|
6168
|
+
* style's own icon offset; without one, the image takes the style's.
|
|
5819
6169
|
* - Entries without an `image` change no POI.
|
|
5820
6170
|
* - The micro markers of minor POIs keep the style's dots.
|
|
5821
6171
|
*/
|
|
@@ -6066,74 +6416,57 @@ type PresetDefinition = {
|
|
|
6066
6416
|
* The map presets the SDK ships: named bundles of knob settings for common intents, across the
|
|
6067
6417
|
* modules that hold the look of the map. Each is data over the knob catalogues, so a preset is
|
|
6068
6418
|
* exactly as durable as the knobs it sets, and an app can start from one and adjust.
|
|
6069
|
-
* @ignore
|
|
6070
6419
|
*/
|
|
6071
|
-
declare const
|
|
6420
|
+
declare const presetSettings: {
|
|
6072
6421
|
readonly 'data-viz': {
|
|
6073
|
-
readonly
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
readonly
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
readonly pois: {
|
|
6086
|
-
readonly 'microMarkers.visible': false;
|
|
6087
|
-
readonly minZoom: 14;
|
|
6088
|
-
};
|
|
6422
|
+
readonly stylingFoundations: {
|
|
6423
|
+
readonly 'labels.sizeFactor': 0.9;
|
|
6424
|
+
readonly 'symbols.sizeFactor': 0.9;
|
|
6425
|
+
readonly 'roads.widthFactor': 0.8;
|
|
6426
|
+
};
|
|
6427
|
+
readonly baseMap: {
|
|
6428
|
+
readonly 'roads.exitNumbers.visible': false;
|
|
6429
|
+
readonly 'roads.arrows.visible': false;
|
|
6430
|
+
};
|
|
6431
|
+
readonly pois: {
|
|
6432
|
+
readonly 'microMarkers.visible': false;
|
|
6433
|
+
readonly minZoom: 14;
|
|
6089
6434
|
};
|
|
6090
6435
|
};
|
|
6091
6436
|
readonly 'night-driving': {
|
|
6092
|
-
readonly
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
readonly
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
readonly pois: {
|
|
6105
|
-
readonly 'microMarkers.visible': false;
|
|
6106
|
-
readonly minZoom: 13;
|
|
6107
|
-
};
|
|
6437
|
+
readonly stylingFoundations: {
|
|
6438
|
+
readonly 'labels.sizeFactor': 1.2;
|
|
6439
|
+
readonly 'symbols.sizeFactor': 1.2;
|
|
6440
|
+
readonly 'roads.widthFactor': 1.2;
|
|
6441
|
+
};
|
|
6442
|
+
readonly baseMap: {
|
|
6443
|
+
readonly 'roads.exitNumbers.visible': true;
|
|
6444
|
+
readonly 'roads.arrows.visible': true;
|
|
6445
|
+
};
|
|
6446
|
+
readonly pois: {
|
|
6447
|
+
readonly 'microMarkers.visible': false;
|
|
6448
|
+
readonly minZoom: 13;
|
|
6108
6449
|
};
|
|
6109
6450
|
};
|
|
6110
6451
|
readonly minimal: {
|
|
6111
|
-
readonly
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
readonly
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
readonly pois: {
|
|
6124
|
-
readonly 'microMarkers.visible': false;
|
|
6125
|
-
readonly minZoom: 16;
|
|
6126
|
-
};
|
|
6452
|
+
readonly stylingFoundations: {
|
|
6453
|
+
readonly 'labels.sizeFactor': 0.9;
|
|
6454
|
+
};
|
|
6455
|
+
readonly baseMap: {
|
|
6456
|
+
readonly 'roads.exitNumbers.visible': false;
|
|
6457
|
+
readonly 'roads.arrows.visible': false;
|
|
6458
|
+
readonly 'roads.restricted.visible': false;
|
|
6459
|
+
readonly 'roads.underConstruction.visible': false;
|
|
6460
|
+
};
|
|
6461
|
+
readonly pois: {
|
|
6462
|
+
readonly 'microMarkers.visible': false;
|
|
6463
|
+
readonly minZoom: 16;
|
|
6127
6464
|
};
|
|
6128
6465
|
};
|
|
6129
6466
|
readonly globe: {
|
|
6130
|
-
readonly
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
readonly stylingFoundations: {
|
|
6134
|
-
readonly 'view.projection': "globe";
|
|
6135
|
-
readonly 'view.sky.visible': true;
|
|
6136
|
-
};
|
|
6467
|
+
readonly stylingFoundations: {
|
|
6468
|
+
readonly 'view.projection': "globe";
|
|
6469
|
+
readonly 'view.sky.visible': true;
|
|
6137
6470
|
};
|
|
6138
6471
|
};
|
|
6139
6472
|
};
|
|
@@ -6142,7 +6475,7 @@ declare const mapPresets: {
|
|
|
6142
6475
|
*
|
|
6143
6476
|
* @group Map Styling
|
|
6144
6477
|
*/
|
|
6145
|
-
type MapPresetId = keyof typeof
|
|
6478
|
+
type MapPresetId = keyof typeof presetSettings;
|
|
6146
6479
|
/**
|
|
6147
6480
|
* A named bundle of knob settings, TomTom's cartographic opinions in code, across the modules that
|
|
6148
6481
|
* hold the look of the map. Apply one with {@link applyMapPreset}.
|
|
@@ -6212,9 +6545,12 @@ export type StylingFoundationsEvents = CombinedEvents<MapGeoJSONFeature, Styling
|
|
|
6212
6545
|
* @remarks
|
|
6213
6546
|
* The catalogue's `appliesTo` says which styles a knob works on. `any-style` knobs (sizes, widths)
|
|
6214
6547
|
* scale whatever the style already does, so they survive style-version bumps. A zoom ramp has each
|
|
6215
|
-
* stop's output scaled, and any other expression `E` becomes `["*", 1.3, E]
|
|
6216
|
-
*
|
|
6217
|
-
*
|
|
6548
|
+
* stop's output scaled, and any other expression `E` becomes `["*", 1.3, E]`, unless a `zoom` sits
|
|
6549
|
+
* inside it, where no wrapper may go: that value stays as the style has it, with a warning.
|
|
6550
|
+
*
|
|
6551
|
+
* `tomtom-styles` knobs (the map colours) reach their layers through the TomTom styles this SDK
|
|
6552
|
+
* version is verified against. On a style layer they do not recognise, setting one warns once and
|
|
6553
|
+
* does nothing.
|
|
6218
6554
|
*
|
|
6219
6555
|
* After every `setStyle` that carries state over, the settings are re-applied on top of whatever the
|
|
6220
6556
|
* other modules restored. A clean switch (`resetState: true`) drops them.
|
|
@@ -6311,7 +6647,8 @@ export declare class StylingFoundationsModule extends AbstractStyleOwnedMapModul
|
|
|
6311
6647
|
* The ten are the style themes' Foundations palette, each listed with what it reaches under
|
|
6312
6648
|
* {@link MapColorName}. Partial objects are fine. The colours you leave out stay as they are,
|
|
6313
6649
|
* except on the mono styles, which derive the other nine from `land` as their theme does. There,
|
|
6314
|
-
* the theme's own formulas re-derive them from the given `land
|
|
6650
|
+
* the theme's own formulas re-derive them from the given `land`, and `roadMajor` and `roadOutline`
|
|
6651
|
+
* from a given `road` too.
|
|
6315
6652
|
*
|
|
6316
6653
|
* @remarks
|
|
6317
6654
|
* Each colour re-derives every shade the style built from it, such as a trunk variant, an outline
|
|
@@ -6343,7 +6680,8 @@ export declare class StylingFoundationsModule extends AbstractStyleOwnedMapModul
|
|
|
6343
6680
|
* It includes whatever the SDK's data modules (places, routes) have on the map. Its tile URLs
|
|
6344
6681
|
* carry the API key the map was created with, so strip or rotate the key before publishing.
|
|
6345
6682
|
* Labels set in a `customTypeface` come out in the style's own Noto faces, since only the SDK can
|
|
6346
|
-
* draw font files beside the glyph service.
|
|
6683
|
+
* draw font files beside the glyph service. `view.space.color` paints the map's container, which no
|
|
6684
|
+
* style specification carries.
|
|
6347
6685
|
*/
|
|
6348
6686
|
exportStyle(): StyleSpecification;
|
|
6349
6687
|
/**
|
|
@@ -6665,8 +7003,8 @@ type StyleKnobId = keyof StyleKnobDefinitions;
|
|
|
6665
7003
|
type StyleKnobValueOf<ID extends StyleKnobId> = KnobValueOf<StyleKnobDefinitions[ID]['kind']>;
|
|
6666
7004
|
/**
|
|
6667
7005
|
* The map-wide id of a style colour knob, for every colour of the loaded style a module's knob sets.
|
|
6668
|
-
* These are the ten map colours and the accent, the sky
|
|
6669
|
-
* hillshade tones. {@link getStyleColor} reads the one in force. The light's colour is not one: no
|
|
7006
|
+
* These are the ten map colours and the accent, the sky and the space around a globe, the POI labels,
|
|
7007
|
+
* the traffic levels and the hillshade tones. {@link getStyleColor} reads the one in force. The light's colour is not one: no
|
|
6670
7008
|
* pixel is drawn in it.
|
|
6671
7009
|
*
|
|
6672
7010
|
* @group Map Styling
|
|
@@ -6694,7 +7032,7 @@ export declare const styleColorKnobIds: readonly StyleColorKnobId[];
|
|
|
6694
7032
|
*
|
|
6695
7033
|
* @param id - The colour's map-wide id, from {@link styleColorKnobIds}.
|
|
6696
7034
|
* @returns The colour, or `undefined` where the style draws it with an expression no single colour
|
|
6697
|
-
* stands for,
|
|
7035
|
+
* stands for, has no layer for it, or is still loading.
|
|
6698
7036
|
*
|
|
6699
7037
|
* @example
|
|
6700
7038
|
* ```typescript
|
|
@@ -6713,7 +7051,8 @@ export declare const getStyleColor: (map: TomTomMap, id: StyleColorKnobId) => st
|
|
|
6713
7051
|
* - The constructor throws one with `WEBGL_UNSUPPORTED` when the browser cannot create a WebGL2 context, or
|
|
6714
7052
|
* `INSECURE_BASE_URL` when `commonBaseURL` is neither `https:` nor `http:` on a loopback address.
|
|
6715
7053
|
* - Every failure after construction reaches the handlers {@link TomTomMap.addErrorHandler} registers.
|
|
6716
|
-
* These are a style, tile, sprite or glyph that failed to load,
|
|
7054
|
+
* These are a style, tile, sprite or glyph that failed to load, a plugin's data that failed to load, such as
|
|
7055
|
+
* the Landmarks 3D tiles, and a lost WebGL context.
|
|
6717
7056
|
* {@link TomTomMap.setStyle} also rejects with a style that fails to load, and so do module creation and
|
|
6718
7057
|
* the module calls that wait for the map, until a later switch loads a style.
|
|
6719
7058
|
*
|
|
@@ -6721,13 +7060,15 @@ export declare const getStyleColor: (map: TomTomMap, id: StyleColorKnobId) => st
|
|
|
6721
7060
|
* ```typescript
|
|
6722
7061
|
* map.addErrorHandler((error) => {
|
|
6723
7062
|
* if (error.code === 'INVALID_CREDENTIALS') showMessage('The map could not load: check the API key');
|
|
6724
|
-
* else if (error.
|
|
7063
|
+
* else if (error.privatePreviewAccess) showMessage(`Request access to ${error.privatePreviewAccess.product}: ${error.privatePreviewAccess.requestAccessURL}`);
|
|
7064
|
+
* else if (error.apiErrorCode === 'InvalidReferer') showMessage('The map could not load: add this domain to the API key');
|
|
7065
|
+
* else if (error.code === 'INSUFFICIENT_PERMISSIONS') showMessage('The map could not load: check the APIs the key allows');
|
|
6725
7066
|
* });
|
|
6726
7067
|
* ```
|
|
6727
7068
|
*
|
|
6728
7069
|
* @group Map
|
|
6729
7070
|
*/
|
|
6730
|
-
export declare class TomTomMapError extends Error {
|
|
7071
|
+
export declare class TomTomMapError extends Error implements APIErrorDetails {
|
|
6731
7072
|
/**
|
|
6732
7073
|
* What went wrong. Branch on it, not on the message.
|
|
6733
7074
|
*/
|
|
@@ -6745,17 +7086,34 @@ export declare class TomTomMapError extends Error {
|
|
|
6745
7086
|
* The HTTP status of the request that failed, when a response came back.
|
|
6746
7087
|
*/
|
|
6747
7088
|
readonly status?: number;
|
|
7089
|
+
readonly apiErrorCode?: string;
|
|
7090
|
+
readonly privatePreviewAccess?: PrivatePreviewAccess;
|
|
6748
7091
|
/**
|
|
6749
7092
|
* The map source whose tiles or data failed to load, when the failure was one of a source's.
|
|
6750
7093
|
*/
|
|
6751
7094
|
readonly sourceId?: string;
|
|
6752
|
-
constructor(message: string, options: {
|
|
7095
|
+
constructor(message: string, options: APIErrorDetails & {
|
|
6753
7096
|
code: SDKErrorCode;
|
|
6754
7097
|
status?: number;
|
|
6755
7098
|
sourceId?: string;
|
|
6756
7099
|
cause?: unknown;
|
|
6757
7100
|
});
|
|
6758
7101
|
}
|
|
7102
|
+
/**
|
|
7103
|
+
* The {@link TomTomMapError} a request failed with, for a map source that fetches its own data: pass the response
|
|
7104
|
+
* it got, or what `fetch` threw when none arrived. Fire it as the `error` of a MapLibre `error` event with the
|
|
7105
|
+
* source's `sourceId`, and the map's error handlers get it.
|
|
7106
|
+
* @param options.privatePreviewAccess The access the source's API needs, for one in Private Preview.
|
|
7107
|
+
* @ignore
|
|
7108
|
+
*/
|
|
7109
|
+
export declare const toTomTomMapRequestError: (failure: {
|
|
7110
|
+
response: Response;
|
|
7111
|
+
} | {
|
|
7112
|
+
fetchError: unknown;
|
|
7113
|
+
}, options: {
|
|
7114
|
+
sourceId: string;
|
|
7115
|
+
privatePreviewAccess?: PrivatePreviewAccess;
|
|
7116
|
+
}) => Promise<TomTomMapError>;
|
|
6759
7117
|
//#endregion
|
|
6760
7118
|
//#region src/TomTomMap.d.ts
|
|
6761
7119
|
/**
|
|
@@ -6764,8 +7122,8 @@ export declare class TomTomMapError extends Error {
|
|
|
6764
7122
|
* @remarks
|
|
6765
7123
|
* The SDK calls them when the map style changes through {@link TomTomMap.setStyle}. Use them to clean
|
|
6766
7124
|
* up or reinitialize custom map features when the style switches. For example, save and restore
|
|
6767
|
-
* custom layers or sources,
|
|
6768
|
-
*
|
|
7125
|
+
* custom layers or sources, update UI components for the new style, or clean up resources tied to
|
|
7126
|
+
* the previous style. The SDK modules restore or reset themselves in handlers of their own.
|
|
6769
7127
|
*
|
|
6770
7128
|
* The lifecycle is:
|
|
6771
7129
|
* 1. `onStyleAboutToChange` runs before the new style is applied.
|
|
@@ -6801,7 +7159,8 @@ export type StyleChangeHandler = {
|
|
|
6801
7159
|
* @remarks
|
|
6802
7160
|
* Use it to clean up or save state before the current style is removed. It can be synchronous
|
|
6803
7161
|
* or asynchronous. The SDK awaits it before handing the new style to MapLibre, so nothing of the
|
|
6804
|
-
* old style is torn down while it runs.
|
|
7162
|
+
* old style is torn down while it runs. A {@link TomTomMap.setStyle} called while it still runs
|
|
7163
|
+
* calls it again, before the first call settles.
|
|
6805
7164
|
*
|
|
6806
7165
|
* @param context - What kind of switch is happening. See {@link StyleChangeContext}.
|
|
6807
7166
|
* @returns void or a Promise that resolves when preparation is complete
|
|
@@ -6816,6 +7175,11 @@ export type StyleChangeHandler = {
|
|
|
6816
7175
|
* {@link StyleChangeHandler.priority}, and the promise {@link TomTomMap.setStyle} returns resolves
|
|
6817
7176
|
* only once the last one has finished.
|
|
6818
7177
|
*
|
|
7178
|
+
* A switch whose style fails to load runs none for its own style, and the map keeps the style it
|
|
7179
|
+
* had: undo what `onStyleAboutToChange` did from a {@link TomTomMap.addErrorHandler} handler. When
|
|
7180
|
+
* that style had loaded for a switch the failed one superseded, they run for it instead, with its
|
|
7181
|
+
* context.
|
|
7182
|
+
*
|
|
6819
7183
|
* @param context - What kind of switch is happening. See {@link StyleChangeContext}.
|
|
6820
7184
|
* @returns void or a Promise that resolves when reinitialization is complete
|
|
6821
7185
|
*/
|
|
@@ -6870,7 +7234,8 @@ export type SetStyleOptions = {
|
|
|
6870
7234
|
* - `false` (default): module data and configuration, filters and the style parts of the
|
|
6871
7235
|
* previous style (traffic, terrain) are restored onto the new style.
|
|
6872
7236
|
* - `true`: a clean switch. Modules re-bind to the new style with default configuration and
|
|
6873
|
-
* nothing shown, and only the style parts
|
|
7237
|
+
* nothing shown, and only the style parts the new style input asks for are loaded, every part
|
|
7238
|
+
* for one that names none.
|
|
6874
7239
|
*
|
|
6875
7240
|
* The map language and geopolitical view are not SDK state, so both survive either case. Only
|
|
6876
7241
|
* {@link TomTomMap.setLanguage} and {@link TomTomMap.setGeopoliticalView} change them.
|
|
@@ -6956,8 +7321,8 @@ export declare class TomTomMap {
|
|
|
6956
7321
|
* @example
|
|
6957
7322
|
* ```typescript
|
|
6958
7323
|
* if (map.mapReady) {
|
|
6959
|
-
* //
|
|
6960
|
-
* const
|
|
7324
|
+
* // The style is loaded, so its layers can be read
|
|
7325
|
+
* const layerIds = map.mapLibreMap.getStyle().layers.map((layer) => layer.id);
|
|
6961
7326
|
* }
|
|
6962
7327
|
* ```
|
|
6963
7328
|
*/
|
|
@@ -7007,7 +7372,7 @@ export declare class TomTomMap {
|
|
|
7007
7372
|
*/
|
|
7008
7373
|
_params: InternalTomTomMapParams;
|
|
7009
7374
|
/**
|
|
7010
|
-
* Whether the
|
|
7375
|
+
* Whether the map's style, the one {@link getStyleInput} returns, draws a light or a dark map.
|
|
7011
7376
|
*
|
|
7012
7377
|
* @remarks
|
|
7013
7378
|
* The SDK's own overlays read it to pick text and halo colours that stay legible over the
|
|
@@ -7078,16 +7443,19 @@ export declare class TomTomMap {
|
|
|
7078
7443
|
private readonly styleChangeHandlers;
|
|
7079
7444
|
private readonly errorHandlers;
|
|
7080
7445
|
private failStyleLoadInFlight;
|
|
7446
|
+
private pendingError;
|
|
7081
7447
|
private styleLoadError;
|
|
7082
7448
|
private readonly styleLoadFailureHandlers;
|
|
7083
7449
|
private vectorTilesReloadPending;
|
|
7084
7450
|
private incidentTilesReloadPending;
|
|
7085
7451
|
private styleGivenToMapLibre;
|
|
7452
|
+
private loadedStyleInput;
|
|
7086
7453
|
private styleRequestSequence;
|
|
7087
7454
|
private styleLoadInFlight;
|
|
7088
7455
|
private styleLayerIds;
|
|
7089
7456
|
private styleLoads;
|
|
7090
|
-
private
|
|
7457
|
+
private styleDataUnannounced;
|
|
7458
|
+
private unfinishedStyle;
|
|
7091
7459
|
private readonly moduleSourcesAndLayers;
|
|
7092
7460
|
/**
|
|
7093
7461
|
* Constructs a new TomTom Map instance and attaches it to a DOM element.
|
|
@@ -7178,13 +7546,15 @@ export declare class TomTomMap {
|
|
|
7178
7546
|
* @param options - Options for the style change behaviour. See {@link SetStyleOptions}.
|
|
7179
7547
|
* @returns A promise that resolves once the new style is loaded and every registered
|
|
7180
7548
|
* {@link StyleChangeHandler} has finished, including the SDK modules restoring themselves.
|
|
7181
|
-
* Awaiting it is optional
|
|
7549
|
+
* Awaiting it is optional, but a call you don't await needs a `.catch` for a style that fails to
|
|
7550
|
+
* load. Once it resolves, the map is safe to read and draw on again.
|
|
7182
7551
|
* @throws A {@link TomTomMapError} if the style itself fails to load, leaving {@link mapReady} `false`
|
|
7183
|
-
* and the map on the style it had
|
|
7552
|
+
* and the map on the style it had, which {@link getStyleInput} and {@link styleLightDarkTheme} answer with
|
|
7553
|
+
* again: the code of the HTTP status it got, `NETWORK_NOT_AVAILABLE` when no response
|
|
7184
7554
|
* arrived, else `STYLE_LOAD_FAILED`. The error handlers get it too, and module creation and the module calls
|
|
7185
7555
|
* that wait for the map reject with it until a later switch loads a style. A tile or source that fails to load
|
|
7186
|
-
* does not fail the switch. Called before the map's first style loaded, a
|
|
7187
|
-
* that style instead, and {@link mapReady} turns `true`.
|
|
7556
|
+
* does not fail the switch. Called before the map's first style loaded, or once the style of a switch it
|
|
7557
|
+
* superseded has loaded, a failed switch finishes that style instead, and {@link mapReady} turns `true`.
|
|
7188
7558
|
*
|
|
7189
7559
|
* @remarks
|
|
7190
7560
|
* By default, the switch carries state over. It merges the previous style's parts with the new
|
|
@@ -7203,7 +7573,8 @@ export declare class TomTomMap {
|
|
|
7203
7573
|
* - Once the style has loaded, {@link mapReady} is back to `true` and the SDK awaits every
|
|
7204
7574
|
* `onStyleChanged` handler by {@link StyleChangeHandler.priority}.
|
|
7205
7575
|
* - A `setStyle` call made while another one is still in flight supersedes it. No `onStyleChanged`
|
|
7206
|
-
* handler runs for the older call
|
|
7576
|
+
* handler runs for the older call unless the newer one fails once the older style has loaded, and
|
|
7577
|
+
* its promise resolves. A load it had already started ends
|
|
7207
7578
|
* first, so MapLibre can draw that style briefly; if it fails, only the error handlers hear of it.
|
|
7208
7579
|
* - Passing the style already loaded runs the whole lifecycle without reloading it. This is how
|
|
7209
7580
|
* `resetState: true` doubles as a reset of the SDK modules over the current style.
|
|
@@ -7234,7 +7605,7 @@ export declare class TomTomMap {
|
|
|
7234
7605
|
* @example
|
|
7235
7606
|
* Clean style switch without state preservation:
|
|
7236
7607
|
* ```typescript
|
|
7237
|
-
* //
|
|
7608
|
+
* // Clean switch - the modules re-bind with their default configuration and nothing shown
|
|
7238
7609
|
* map.setStyle('streetDark', { resetState: true });
|
|
7239
7610
|
* ```
|
|
7240
7611
|
*
|
|
@@ -7260,8 +7631,10 @@ export declare class TomTomMap {
|
|
|
7260
7631
|
*/
|
|
7261
7632
|
setStyle: (style: StyleInput, options?: SetStyleOptions) => Promise<void>;
|
|
7262
7633
|
private applyStyle;
|
|
7634
|
+
private settleFailedLoad;
|
|
7263
7635
|
private loadIntoMapLibre;
|
|
7264
7636
|
private isSuperseded;
|
|
7637
|
+
private restoreLoadedStyleInput;
|
|
7265
7638
|
private fitCanvasToContainer;
|
|
7266
7639
|
private recordStyleLayers;
|
|
7267
7640
|
/**
|
|
@@ -7277,9 +7650,11 @@ export declare class TomTomMap {
|
|
|
7277
7650
|
get _styleLoads(): number;
|
|
7278
7651
|
private notifyHandlers;
|
|
7279
7652
|
/**
|
|
7280
|
-
* The {@link StyleInput} the map was last given, through its parameters or
|
|
7653
|
+
* The {@link StyleInput} in force: the one the map was last given, through its parameters or
|
|
7654
|
+
* {@link setStyle}, with the previous style's parts merged in unless the switch was clean. After a
|
|
7655
|
+
* switch whose style failed to load, it is the style the map kept.
|
|
7281
7656
|
*
|
|
7282
|
-
* It is
|
|
7657
|
+
* It is a style input, not the resolved style specification. For that, use
|
|
7283
7658
|
* {@link StylingFoundationsModule.exportStyle} or `mapLibreMap.getStyle()`.
|
|
7284
7659
|
*
|
|
7285
7660
|
* @example
|
|
@@ -7310,9 +7685,11 @@ export declare class TomTomMap {
|
|
|
7310
7685
|
* @param language The language for map translations.
|
|
7311
7686
|
*
|
|
7312
7687
|
* @remarks
|
|
7313
|
-
* It updates all localizable map
|
|
7314
|
-
* name where the language is unavailable.
|
|
7315
|
-
*
|
|
7688
|
+
* It updates all localizable labels of the map style to the language, and falls back to the default
|
|
7689
|
+
* label name where the language is unavailable. The labels of SDK modules and of your own layers keep
|
|
7690
|
+
* the text they were given. You can call it before or after the map has fully
|
|
7691
|
+
* loaded. While the map is not ready, it applies once a style loads: after a switch whose style
|
|
7692
|
+
* failed to load, that is the next {@link setStyle} that loads one.
|
|
7316
7693
|
*
|
|
7317
7694
|
* The {@link TrafficIncidentsModuleFeature} descriptions follow it too, so it reloads the
|
|
7318
7695
|
* incident tiles when their language changes.
|
|
@@ -7364,7 +7741,9 @@ export declare class TomTomMap {
|
|
|
7364
7741
|
* the map is viewed from. Set it at construction through {@link core!GlobalConfig.geopoliticalView}.
|
|
7365
7742
|
*
|
|
7366
7743
|
* @remarks
|
|
7367
|
-
* - The visible tiles reload in place, and the view persists across every style change.
|
|
7744
|
+
* - The visible tiles reload in place, and the view persists across every style change. While the
|
|
7745
|
+
* map is not ready, they reload once a style loads: after a switch whose style failed to load,
|
|
7746
|
+
* that is the next {@link setStyle} that loads one.
|
|
7368
7747
|
* - Applies to the TomTom Orbis vector tiles. The tiles do not serve `CN` and `RU`, which leave
|
|
7369
7748
|
* the default view. See {@link core!GeopoliticalView}.
|
|
7370
7749
|
* - Services keep the view of the global configuration, or of each call.
|
|
@@ -7446,14 +7825,7 @@ export declare class TomTomMap {
|
|
|
7446
7825
|
* (`module.events.on(...)`) return.
|
|
7447
7826
|
*
|
|
7448
7827
|
* @remarks
|
|
7449
|
-
*
|
|
7450
|
-
* application responds to style switches (e.g. light/dark mode transitions), when you save and
|
|
7451
|
-
* restore state during style changes, or when map modules need to reinitialize on style changes.
|
|
7452
|
-
*
|
|
7453
|
-
* The handler lifecycle is:
|
|
7454
|
-
* 1. `onStyleAboutToChange()` runs before the style change begins.
|
|
7455
|
-
* 2. The style changes.
|
|
7456
|
-
* 3. `onStyleChanged()` runs after the new style has fully loaded.
|
|
7828
|
+
* {@link StyleChangeHandler} says when each callback runs, and what to use them for.
|
|
7457
7829
|
*
|
|
7458
7830
|
* You can register several handlers. They run by {@link StyleChangeHandler.priority}, lowest first,
|
|
7459
7831
|
* and in registration order where it is equal. The SDK awaits
|
|
@@ -7547,12 +7919,7 @@ export declare class TomTomMap {
|
|
|
7547
7919
|
* },
|
|
7548
7920
|
* onStyleChanged: () => {
|
|
7549
7921
|
* document.body.classList.remove('style-changing');
|
|
7550
|
-
*
|
|
7551
|
-
* if (typeof style === 'string' && style.includes('Dark')) {
|
|
7552
|
-
* document.body.classList.add('dark-mode');
|
|
7553
|
-
* } else {
|
|
7554
|
-
* document.body.classList.remove('dark-mode');
|
|
7555
|
-
* }
|
|
7922
|
+
* document.body.classList.toggle('dark-mode', map.styleLightDarkTheme === 'dark');
|
|
7556
7923
|
* }
|
|
7557
7924
|
* });
|
|
7558
7925
|
* ```
|
|
@@ -7614,19 +7981,22 @@ export declare class TomTomMap {
|
|
|
7614
7981
|
* - A tile, sprite or glyph that fails to load gets the code of the HTTP status, `NETWORK_NOT_AVAILABLE` when
|
|
7615
7982
|
* no response arrived, otherwise `INTERNAL`. A tile's source is in `sourceId`. A tile answered with `404`
|
|
7616
7983
|
* isn't reported.
|
|
7984
|
+
* - A plugin's data that fails to load, such as the Landmarks 3D tiles, gets its codes the same way, under
|
|
7985
|
+
* the plugin's source.
|
|
7617
7986
|
* - A lost WebGL context gets `WEBGL_CONTEXT_LOST`.
|
|
7618
7987
|
* - While no handler is registered, each failure is logged with `console.error` instead.
|
|
7619
7988
|
* - The constructor throws its own failures, `WEBGL_UNSUPPORTED` and `INSECURE_BASE_URL`, since no
|
|
7620
7989
|
* handler exists yet.
|
|
7621
7990
|
*
|
|
7991
|
+
* {@link TomTomMapError} has what each error carries, and how to read a refused API key.
|
|
7992
|
+
*
|
|
7622
7993
|
* @returns A function that unregisters the handler.
|
|
7623
7994
|
*
|
|
7624
7995
|
* @example
|
|
7625
7996
|
* ```typescript
|
|
7626
7997
|
* const removeHandler = map.addErrorHandler((error) => {
|
|
7627
|
-
* if (error.code === '
|
|
7628
|
-
* else
|
|
7629
|
-
* else if (error.code === 'WEBGL_CONTEXT_LOST') showMessage('The map stopped drawing: reload the page');
|
|
7998
|
+
* if (error.code === 'WEBGL_CONTEXT_LOST') showMessage('The map stopped drawing: reload the page');
|
|
7999
|
+
* else console.warn(error);
|
|
7630
8000
|
* });
|
|
7631
8001
|
* ```
|
|
7632
8002
|
*/
|
|
@@ -7649,8 +8019,8 @@ export type ShownFeaturesType<TShownFeatures> = [TShownFeatures] extends [never]
|
|
|
7649
8019
|
* It offers one API for subscribing to module-level events that aren't tied to user
|
|
7650
8020
|
* interaction with map features. It supports two event types:
|
|
7651
8021
|
*
|
|
7652
|
-
* - `config-change`: emitted
|
|
7653
|
-
*
|
|
8022
|
+
* - `config-change`: emitted after every change to the module's configuration, which
|
|
8023
|
+
* [What triggers `config-change`](https://docs.tomtom.com/maps-sdk-js/guides/map/module-events#what-triggers-config-change) lists.
|
|
7654
8024
|
* - `shown-features`: emitted by modules that have a `show` method, immediately after
|
|
7655
8025
|
* features are displayed on the map.
|
|
7656
8026
|
*
|
|
@@ -7658,8 +8028,8 @@ export type ShownFeaturesType<TShownFeatures> = [TShownFeatures] extends [never]
|
|
|
7658
8028
|
* without clearing the entire listener list.
|
|
7659
8029
|
*
|
|
7660
8030
|
* @typeParam TConfig - The module's configuration type.
|
|
7661
|
-
* @typeParam TShownFeatures -
|
|
7662
|
-
* modules that have no `show` method.
|
|
8031
|
+
* @typeParam TShownFeatures - What the module hands its `shown-features` handlers. Use `never`
|
|
8032
|
+
* for modules that have no `show` method.
|
|
7663
8033
|
*
|
|
7664
8034
|
* @example
|
|
7665
8035
|
* ```typescript
|
|
@@ -7685,8 +8055,8 @@ export declare class ModuleEvents<TConfig, TShownFeatures = never> {
|
|
|
7685
8055
|
/**
|
|
7686
8056
|
* Subscribes to config-change events.
|
|
7687
8057
|
*
|
|
7688
|
-
* The handler receives the module's full current configuration right after
|
|
7689
|
-
*
|
|
8058
|
+
* The handler receives the module's full current configuration right after every change to it,
|
|
8059
|
+
* which [What triggers `config-change`](https://docs.tomtom.com/maps-sdk-js/guides/map/module-events#what-triggers-config-change) lists.
|
|
7690
8060
|
*
|
|
7691
8061
|
* @param type - `'config-change'`
|
|
7692
8062
|
* @param handler - Receives the module's config, or `undefined` when the config is cleared.
|
|
@@ -7711,14 +8081,16 @@ export declare class ModuleEvents<TConfig, TShownFeatures = never> {
|
|
|
7711
8081
|
* the map with new data. Only modules that have a `show` method offer it.
|
|
7712
8082
|
*
|
|
7713
8083
|
* @param type - `'shown-features'`
|
|
7714
|
-
* @param handler - Receives the
|
|
8084
|
+
* @param handler - Receives what the module shows: the data passed to `show()`, or, from a module
|
|
8085
|
+
* that shows several kinds, an object naming which, such as `PlacesModule`'s `{ places }`
|
|
8086
|
+
* or `{ connections }`.
|
|
7715
8087
|
* @returns An unsubscribe function. Call it to remove **only this handler**, leaving the
|
|
7716
8088
|
* other handlers for the same event type registered.
|
|
7717
8089
|
*
|
|
7718
8090
|
* @example
|
|
7719
8091
|
* ```typescript
|
|
7720
|
-
* const unsubscribe = places.events.on('shown-features', (
|
|
7721
|
-
* fitMapToResults(
|
|
8092
|
+
* const unsubscribe = places.events.on('shown-features', (shown) => {
|
|
8093
|
+
* if ('places' in shown) fitMapToResults(shown.places);
|
|
7722
8094
|
* });
|
|
7723
8095
|
*
|
|
7724
8096
|
* // Later:
|
|
@@ -7729,9 +8101,9 @@ export declare class ModuleEvents<TConfig, TShownFeatures = never> {
|
|
|
7729
8101
|
/**
|
|
7730
8102
|
* Removes **all** handlers for the given event type at once.
|
|
7731
8103
|
*
|
|
7732
|
-
* To remove a single handler, call the unsubscribe function that {@link on} returns instead
|
|
7733
|
-
*
|
|
7734
|
-
*
|
|
8104
|
+
* To remove a single handler, call the unsubscribe function that {@link on} returns instead,
|
|
8105
|
+
* which is also how a component cleans up on unmount: `off` also removes the handlers other
|
|
8106
|
+
* code put on the module, such as a plugin's.
|
|
7735
8107
|
*
|
|
7736
8108
|
* @param type - The event type whose handlers should all be cleared. A module takes
|
|
7737
8109
|
* `'shown-features'` only if it has a `show` method.
|
|
@@ -7801,11 +8173,11 @@ export declare class CombinedEvents<T, CFG, TShown = never, WHERE_SCOPE = never>
|
|
|
7801
8173
|
* Narrows these events to part of what they cover, as {@link UserEvents.where} does.
|
|
7802
8174
|
*
|
|
7803
8175
|
* @param scope A predicate over this module's feature type or, where the module supports one,
|
|
7804
|
-
* a scope object such as `{ layerGroups }` on {@link BaseMapModule}.
|
|
8176
|
+
* a scope object such as `{ layerGroups }` on {@link BaseMapModule}.
|
|
7805
8177
|
* @param config Event configuration for handlers registered through the returned instance, so
|
|
7806
8178
|
* each scope can have its own hover cursor.
|
|
7807
8179
|
* @returns A {@link UserEvents} covering only the narrowed set. Lifecycle events stay on the
|
|
7808
|
-
* module
|
|
8180
|
+
* module.
|
|
7809
8181
|
*
|
|
7810
8182
|
* @example
|
|
7811
8183
|
* ```typescript
|
|
@@ -7819,8 +8191,9 @@ export declare class CombinedEvents<T, CFG, TShown = never, WHERE_SCOPE = never>
|
|
|
7819
8191
|
* `dragstart`, `drag`, `dragend`).
|
|
7820
8192
|
*
|
|
7821
8193
|
* @param type - The user event type.
|
|
7822
|
-
* @param handler - Called with the feature, click/hover coordinates,
|
|
7823
|
-
*
|
|
8194
|
+
* @param handler - Called with the feature, click/hover coordinates, the features at the point
|
|
8195
|
+
* from the source that drew it (under `where()`, the ones in its scope), and that source with
|
|
8196
|
+
* its layers.
|
|
7824
8197
|
* @returns An unsubscribe function. Call it to remove **only this handler**.
|
|
7825
8198
|
*
|
|
7826
8199
|
* @example
|
|
@@ -7835,8 +8208,8 @@ export declare class CombinedEvents<T, CFG, TShown = never, WHERE_SCOPE = never>
|
|
|
7835
8208
|
/**
|
|
7836
8209
|
* Subscribes to config-change events.
|
|
7837
8210
|
*
|
|
7838
|
-
* It fires after
|
|
7839
|
-
*
|
|
8211
|
+
* It fires after every change to the module's configuration, which [What triggers `config-change`](https://docs.tomtom.com/maps-sdk-js/guides/map/module-events#what-triggers-config-change)
|
|
8212
|
+
* lists. The handler receives the module's full updated configuration.
|
|
7840
8213
|
*
|
|
7841
8214
|
* @param type - `'config-change'`
|
|
7842
8215
|
* @param handler - Receives the module's config, or `undefined` when the config is cleared.
|
|
@@ -7858,13 +8231,15 @@ export declare class CombinedEvents<T, CFG, TShown = never, WHERE_SCOPE = never>
|
|
|
7858
8231
|
* the map. Only modules that have a `show` method offer it.
|
|
7859
8232
|
*
|
|
7860
8233
|
* @param type - `'shown-features'`
|
|
7861
|
-
* @param handler - Receives the
|
|
8234
|
+
* @param handler - Receives what the module shows: the data passed to `show()`, or, from a module
|
|
8235
|
+
* that shows several kinds, an object naming which, such as `PlacesModule`'s `{ places }`
|
|
8236
|
+
* or `{ connections }`.
|
|
7862
8237
|
* @returns An unsubscribe function. Call it to remove **only this handler**.
|
|
7863
8238
|
*
|
|
7864
8239
|
* @example
|
|
7865
8240
|
* ```typescript
|
|
7866
|
-
* const unsubscribe = places.events.on('shown-features', (
|
|
7867
|
-
* fitMapToResults(
|
|
8241
|
+
* const unsubscribe = places.events.on('shown-features', (shown) => {
|
|
8242
|
+
* if ('places' in shown) fitMapToResults(shown.places);
|
|
7868
8243
|
* });
|
|
7869
8244
|
* unsubscribe();
|
|
7870
8245
|
* ```
|
|
@@ -7877,9 +8252,9 @@ export declare class CombinedEvents<T, CFG, TShown = never, WHERE_SCOPE = never>
|
|
|
7877
8252
|
* `dragstart`, `drag`, `dragend`) and
|
|
7878
8253
|
* module lifecycle types (`config-change`, and `shown-features` on a module that has a `show` method).
|
|
7879
8254
|
*
|
|
7880
|
-
* To remove a single handler, call the unsubscribe function that {@link on} returns instead
|
|
7881
|
-
*
|
|
7882
|
-
*
|
|
8255
|
+
* To remove a single handler, call the unsubscribe function that {@link on} returns instead,
|
|
8256
|
+
* which is also how a component cleans up on unmount: `off` also removes the handlers other
|
|
8257
|
+
* code put on the module, such as a plugin's.
|
|
7883
8258
|
*
|
|
7884
8259
|
* @param type - The event type whose handlers should all be cleared.
|
|
7885
8260
|
*
|
|
@@ -7927,8 +8302,9 @@ export declare class LayerFilterComposer extends AbstractLayerComposer<LayerFilt
|
|
|
7927
8302
|
* the other contributors.
|
|
7928
8303
|
*
|
|
7929
8304
|
* @param layerId - The style layer whose filter is rewritten.
|
|
7930
|
-
* @param contributor - A key unique to the contributor, e.g. `'
|
|
7931
|
-
* @param transform - Receives the
|
|
8305
|
+
* @param contributor - A key unique to the contributor, e.g. `'styleKnobs.zoomShift'`.
|
|
8306
|
+
* @param transform - Receives the filter as the style and the transforms registered before it
|
|
8307
|
+
* left it, and returns the filter to use instead.
|
|
7932
8308
|
*/
|
|
7933
8309
|
setTransform(layerId: string, contributor: string, transform: LayerFilterTransform | undefined): void;
|
|
7934
8310
|
/**
|
|
@@ -7940,8 +8316,8 @@ export declare class LayerFilterComposer extends AbstractLayerComposer<LayerFilt
|
|
|
7940
8316
|
* @param clause - The clause to add, in expression syntax.
|
|
7941
8317
|
*/
|
|
7942
8318
|
setClause(layerId: string, contributor: string, clause: ExpressionFilterSpecification | undefined): void;
|
|
7943
|
-
|
|
7944
|
-
|
|
8319
|
+
protected snapshot(layerId: string): LayerFilterContributions;
|
|
8320
|
+
protected write(layerId: string, contributions: LayerFilterContributions): void;
|
|
7945
8321
|
}
|
|
7946
8322
|
//#endregion
|
|
7947
8323
|
//#region src/shared/AbstractMapModule.d.ts
|
|
@@ -7949,14 +8325,7 @@ export declare class LayerFilterComposer extends AbstractLayerComposer<LayerFilt
|
|
|
7949
8325
|
* How a module builds user events over some of its sources.
|
|
7950
8326
|
* @ignore
|
|
7951
8327
|
*/
|
|
7952
|
-
type EventScopeOptions<T, WHERE_SCOPE> =
|
|
7953
|
-
/** Turns a raw MapLibre feature into the feature type this scope exposes. */
|
|
7954
|
-
mapping?: (feature: MapGeoJSONFeature) => T;
|
|
7955
|
-
/** Resolves a module-specific scope object, such as BaseMapModule's `{ layerGroups }`. */
|
|
7956
|
-
scopeResolver?: (scope: WHERE_SCOPE) => ResolvedEventScope;
|
|
7957
|
-
/** Leaves out part of what the sources draw, as a `where()` would. A `where()` on top narrows within it. */
|
|
7958
|
-
scope?: ResolvedEventScope;
|
|
7959
|
-
};
|
|
8328
|
+
type EventScopeOptions<T, WHERE_SCOPE> = Pick<UserEventsOptions<T, WHERE_SCOPE>, 'mapping' | 'scopeResolver' | 'scope'>;
|
|
7960
8329
|
/**
|
|
7961
8330
|
* Base class for all Maps SDK map modules.
|
|
7962
8331
|
*
|
|
@@ -7989,7 +8358,12 @@ type EventScopeOptions<T, WHERE_SCOPE> = {
|
|
|
7989
8358
|
* @example
|
|
7990
8359
|
* ```typescript
|
|
7991
8360
|
* class CustomModule extends AbstractDataOwnedMapModule<MySourcesWithLayers, MyConfig> {
|
|
7992
|
-
*
|
|
8361
|
+
* static async create(tomtomMap: TomTomMap, config?: MyConfig): Promise<CustomModule> {
|
|
8362
|
+
* // Wait for the map's style first, as the SDK's own factories do.
|
|
8363
|
+
* return new CustomModule(tomtomMap, config);
|
|
8364
|
+
* }
|
|
8365
|
+
*
|
|
8366
|
+
* private constructor(tomtomMap: TomTomMap, config?: MyConfig) {
|
|
7993
8367
|
* super(tomtomMap, config);
|
|
7994
8368
|
* }
|
|
7995
8369
|
* // Implement abstract methods...
|
|
@@ -8015,6 +8389,7 @@ export declare abstract class AbstractMapModule<SOURCES_WITH_LAYERS extends Sour
|
|
|
8015
8389
|
* @ignore
|
|
8016
8390
|
*/
|
|
8017
8391
|
protected sourcesWithLayers: SOURCES_WITH_LAYERS;
|
|
8392
|
+
private readonly sourceIdsByName;
|
|
8018
8393
|
/**
|
|
8019
8394
|
* @ignore
|
|
8020
8395
|
*/
|
|
@@ -8048,21 +8423,21 @@ export declare abstract class AbstractMapModule<SOURCES_WITH_LAYERS extends Sour
|
|
|
8048
8423
|
* dropping another's work, and what holds the filter the style itself shipped. A module may
|
|
8049
8424
|
* still set the filter of a layer it added and owns alone.
|
|
8050
8425
|
*
|
|
8051
|
-
*
|
|
8052
|
-
*
|
|
8426
|
+
* A getter rather than a field, so the composer is created only for the modules that use it,
|
|
8427
|
+
* and is already there for `_initSourcesWithLayers` and `applyConfig`, which this constructor runs.
|
|
8053
8428
|
* @ignore
|
|
8054
8429
|
*/
|
|
8055
|
-
protected
|
|
8430
|
+
protected get filterComposer(): LayerFilterComposer;
|
|
8056
8431
|
/**
|
|
8057
|
-
*
|
|
8432
|
+
* Whether this module is bound to the current style: `false` while it adds its sources and layers, when it might not function properly.
|
|
8058
8433
|
* @see waitUntilModuleReady
|
|
8059
8434
|
* @private
|
|
8060
8435
|
*/
|
|
8061
8436
|
private moduleReady;
|
|
8062
8437
|
/**
|
|
8063
8438
|
* Builds this module on a Maps SDK map.
|
|
8064
|
-
* @param tomtomMap The map
|
|
8065
|
-
* @param config Optional configuration that the module initializes with
|
|
8439
|
+
* @param tomtomMap The map, with its style loaded: the `get` and `create` factories wait for it.
|
|
8440
|
+
* @param config Optional configuration that the module initializes with.
|
|
8066
8441
|
*/
|
|
8067
8442
|
protected constructor(tomtomMap: TomTomMap, config?: CFG);
|
|
8068
8443
|
/**
|
|
@@ -8187,8 +8562,8 @@ export declare abstract class AbstractMapModule<SOURCES_WITH_LAYERS extends Sour
|
|
|
8187
8562
|
private resetOnNewStyle;
|
|
8188
8563
|
/**
|
|
8189
8564
|
* Forgets whatever this module remembers beyond its configuration, so that a clean style
|
|
8190
|
-
* switch does not bring it back. The sources are rebuilt
|
|
8191
|
-
* nothing to clear on the map.
|
|
8565
|
+
* switch does not bring it back. The sources are rebuilt right after, empty, and the event
|
|
8566
|
+
* states come off any style source the switch keeps, so there is nothing to clear on the map.
|
|
8192
8567
|
*
|
|
8193
8568
|
* A data-owned module always remembers something, so {@link AbstractDataOwnedMapModule} makes
|
|
8194
8569
|
* this abstract. A style-owned module overrides it only when it keeps state of its own, such
|
|
@@ -8352,7 +8727,7 @@ export declare abstract class AbstractMapModule<SOURCES_WITH_LAYERS extends Sour
|
|
|
8352
8727
|
* const { hover: hoveredStops = [] } = routing.events.waypoints.getEventStates();
|
|
8353
8728
|
* ```
|
|
8354
8729
|
*
|
|
8355
|
-
* @group
|
|
8730
|
+
* @group Events
|
|
8356
8731
|
*/
|
|
8357
8732
|
export declare class UserEventsWithStates<T = MapGeoJSONFeature> extends UserEvents<T> {
|
|
8358
8733
|
private readonly eventStates;
|
|
@@ -8449,7 +8824,8 @@ export declare abstract class AbstractDataOwnedMapModule<SOURCES_WITH_LAYERS ext
|
|
|
8449
8824
|
*/
|
|
8450
8825
|
protected userEventsWithStates<T = MapGeoJSONFeature>(sourceNames: (keyof SOURCES_WITH_LAYERS)[], options?: Pick<UserEventsOptions<T, never>, 'mapping' | 'scope'>): UserEventsWithStates<T>;
|
|
8451
8826
|
/**
|
|
8452
|
-
* Puts an event state on one of the shown features,
|
|
8827
|
+
* Puts an event state on one of the shown features, replacing the one it had: unlike a user's
|
|
8828
|
+
* hover, this one replaces a click.
|
|
8453
8829
|
*
|
|
8454
8830
|
* @remarks
|
|
8455
8831
|
* The state is what the module's own layers draw (place pins and entry points, route outlines,
|
|
@@ -8463,7 +8839,8 @@ export declare abstract class AbstractDataOwnedMapModule<SOURCES_WITH_LAYERS ext
|
|
|
8463
8839
|
* // Select a feature from a list, as a click would
|
|
8464
8840
|
* module.setEventState({ id: feature.properties.id, state: 'click' });
|
|
8465
8841
|
*
|
|
8466
|
-
* // Hover a second one without taking the hover off the first
|
|
8842
|
+
* // Hover one, then a second one without taking the hover off the first
|
|
8843
|
+
* module.setEventState({ index: 1, state: 'hover' });
|
|
8467
8844
|
* module.setEventState({ index: 2, state: 'hover', mode: 'add' });
|
|
8468
8845
|
* ```
|
|
8469
8846
|
*/
|
|
@@ -8516,8 +8893,8 @@ export declare abstract class AbstractDataOwnedMapModule<SOURCES_WITH_LAYERS ext
|
|
|
8516
8893
|
//#endregion
|
|
8517
8894
|
//#region src/shared/AbstractStyleOwnedMapModule.d.ts
|
|
8518
8895
|
/**
|
|
8519
|
-
* Base class for the base map, POIs, traffic tiles and
|
|
8520
|
-
* layers the loaded map style already provides under fixed global IDs.
|
|
8896
|
+
* Base class for the base map, POIs, traffic tiles, terrain and styling foundations modules, which
|
|
8897
|
+
* control sources and layers the loaded map style already provides under fixed global IDs.
|
|
8521
8898
|
*
|
|
8522
8899
|
* @remarks
|
|
8523
8900
|
* The style owns the data, so such a module brings no data of its own and shows nothing by
|
|
@@ -8537,8 +8914,8 @@ export declare abstract class AbstractDataOwnedMapModule<SOURCES_WITH_LAYERS ext
|
|
|
8537
8914
|
*/
|
|
8538
8915
|
export declare abstract class AbstractStyleOwnedMapModule<SOURCES_WITH_LAYERS extends StyleSourcesWithLayers, CFG extends MapModuleCommonConfig | undefined = undefined> extends AbstractMapModule<SOURCES_WITH_LAYERS, CFG> {
|
|
8539
8916
|
/**
|
|
8540
|
-
* The map's single owner of the visibility of a style layer that a
|
|
8541
|
-
* as well as its owning module. A getter rather than a field: the base constructor already runs
|
|
8917
|
+
* The map's single owner of the visibility of a style layer that a part knob or the styling
|
|
8918
|
+
* module's layer edits show or hide as well as its owning module. A getter rather than a field: the base constructor already runs
|
|
8542
8919
|
* `applyConfig`, which writes through it.
|
|
8543
8920
|
* @ignore
|
|
8544
8921
|
*/
|
|
@@ -8551,7 +8928,8 @@ export declare abstract class AbstractStyleOwnedMapModule<SOURCES_WITH_LAYERS ex
|
|
|
8551
8928
|
* `bounds` hold.
|
|
8552
8929
|
*
|
|
8553
8930
|
* @remarks
|
|
8554
|
-
* A `color` must
|
|
8931
|
+
* A `color` must be a CSS colour in hex, `rgb()`, `hsl()` or a colour name. An `image` or `text` value
|
|
8932
|
+
* need only be a string. Only a
|
|
8555
8933
|
* loaded map knows whether the sprite has the image.
|
|
8556
8934
|
*
|
|
8557
8935
|
* @param knob - The knob's entry in its catalogue.
|
|
@@ -8594,7 +8972,9 @@ export declare const knobValueIn: (config: unknown, id: string) => unknown;
|
|
|
8594
8972
|
*/
|
|
8595
8973
|
export declare const configWithKnobs: <CONFIG extends object>(config: CONFIG, values: Readonly<Record<string, unknown>>) => CONFIG;
|
|
8596
8974
|
/**
|
|
8597
|
-
* The configuration without the value at a knob id's path,
|
|
8975
|
+
* The configuration without the value at a knob id's path, each object along the path copied and each
|
|
8976
|
+
* one it leaves empty dropped, so a value set and then removed leaves the configuration as it was. A
|
|
8977
|
+
* knob that is not set returns the configuration itself.
|
|
8598
8978
|
* @ignore
|
|
8599
8979
|
*/
|
|
8600
8980
|
export declare const configWithoutKnob: <CONFIG extends object>(config: CONFIG, id: string) => CONFIG;
|
|
@@ -8687,14 +9067,15 @@ export declare const setKnob: <CONFIG, ID extends string, KNOB extends ID>(modul
|
|
|
8687
9067
|
*/
|
|
8688
9068
|
export declare const setKnobs: <CONFIG, ID extends string>(module: KnobTarget<CONFIG>, catalogue: readonly KnobEntry<ID>[], values: KnobValues<CONFIG, ID>) => void;
|
|
8689
9069
|
/**
|
|
8690
|
-
* Returns the value set for a knob, otherwise the module's own value where it knows it
|
|
8691
|
-
*
|
|
9070
|
+
* Returns the value set for a knob, otherwise the module's own value where it knows it (a style-owned
|
|
9071
|
+
* module's look knob reads the loaded style), otherwise the catalogue's default.
|
|
8692
9072
|
*
|
|
8693
9073
|
* @param module - A map module, or a plugin with knobs, such as `MapEffects`.
|
|
8694
9074
|
* @param catalogue - Its knob catalogue.
|
|
8695
9075
|
* @param id - The knob's id.
|
|
8696
9076
|
* @returns The value, or `undefined` for a knob with no default or a style value that is a
|
|
8697
|
-
* data-driven expression.
|
|
9077
|
+
* data-driven expression. A data-driven expression the module's configuration holds comes back as
|
|
9078
|
+
* it is, which {@link setKnob} refuses.
|
|
8698
9079
|
* @throws `Error` for an id the catalogue lacks.
|
|
8699
9080
|
*
|
|
8700
9081
|
* @example
|
|
@@ -8707,7 +9088,7 @@ export declare const setKnobs: <CONFIG, ID extends string>(module: KnobTarget<CO
|
|
|
8707
9088
|
export declare const getKnob: <CONFIG, ID extends string, KNOB extends ID>(module: KnobTarget<CONFIG>, catalogue: readonly KnobEntry<ID>[], id: KNOB) => KnobOutput<CONFIG, KNOB>;
|
|
8708
9089
|
/**
|
|
8709
9090
|
* Unsets one knob, so the module is back at its own value for it, as {@link getKnob} reads it.
|
|
8710
|
-
* To unset every knob, use the module's `resetConfig
|
|
9091
|
+
* To unset every knob, use the module's `resetConfig`, which resets the rest of its configuration too.
|
|
8711
9092
|
*
|
|
8712
9093
|
* @param module - A map module, or a plugin with knobs, such as `MapEffects`.
|
|
8713
9094
|
* @param catalogue - Its knob catalogue.
|
|
@@ -8723,6 +9104,19 @@ export declare const getKnob: <CONFIG, ID extends string, KNOB extends ID>(modul
|
|
|
8723
9104
|
*/
|
|
8724
9105
|
export declare const resetKnob: <CONFIG, ID extends string, KNOB extends ID>(module: KnobTarget<CONFIG>, catalogue: readonly KnobEntry<ID>[], id: KNOB) => void;
|
|
8725
9106
|
//#endregion
|
|
9107
|
+
//#region src/shared/layers/expressionTransforms.d.ts
|
|
9108
|
+
/** @ignore */
|
|
9109
|
+
export declare const mentionsZoom: (value: unknown) => boolean;
|
|
9110
|
+
/**
|
|
9111
|
+
* The style's own value with `wrap` around it, or around every stop's output of a top-level zoom
|
|
9112
|
+
* ramp, where a wrapper around the ramp would be illegal.
|
|
9113
|
+
*
|
|
9114
|
+
* Returns `undefined` for a legacy `{ stops }` function, or an expression that holds `zoom` anywhere
|
|
9115
|
+
* else, so the caller can leave the style's value untouched.
|
|
9116
|
+
* @ignore
|
|
9117
|
+
*/
|
|
9118
|
+
export declare const wrapZoomFreeParts: (value: unknown, wrap: (part: unknown) => unknown) => unknown;
|
|
9119
|
+
//#endregion
|
|
8726
9120
|
//#region src/shared/layers/sourcesIDs.d.ts
|
|
8727
9121
|
/**
|
|
8728
9122
|
* Source identifier for base map vector tiles.
|
|
@@ -8787,6 +9181,35 @@ export declare const TRAFFIC_INCIDENTS_SOURCE_ID = "vectorTilesIncidents";
|
|
|
8787
9181
|
*/
|
|
8788
9182
|
export declare const TRAFFIC_FLOW_SOURCE_ID = "vectorTilesFlow";
|
|
8789
9183
|
//#endregion
|
|
9184
|
+
//#region src/shared/mapUtils.d.ts
|
|
9185
|
+
/**
|
|
9186
|
+
* Runs `run` at once on a ready map, else once it is ready. A style that fails to load runs nothing:
|
|
9187
|
+
* that failure is the map's error to report, and the next style comes through a style change handler.
|
|
9188
|
+
* @ignore
|
|
9189
|
+
*/
|
|
9190
|
+
export declare const runWhenMapIsReady: (tomtomMap: TomTomMap, run: () => void) => void;
|
|
9191
|
+
/**
|
|
9192
|
+
* Returns `beforeLayerID` when the current style has that layer, else the anchor it falls back to
|
|
9193
|
+
* when the style has that one, else undefined — the top of the layer stack.
|
|
9194
|
+
*
|
|
9195
|
+
* MapLibre refuses both `addLayer` and `moveLayer` against a layer the style does not have: it
|
|
9196
|
+
* fires an `ErrorEvent` and gives up, so the layer is either never added or left where it was. Not
|
|
9197
|
+
* every anchor in the map style layer IDs exists in every style — the satellite style has none of
|
|
9198
|
+
* `lowestRoadLine`, `lowestBuilding` and `lowest3D` — so a layer positioned against one has to check
|
|
9199
|
+
* first. The top of the stack is the documented fallback for a missing reference layer, and the
|
|
9200
|
+
* POIs for a missing `lowest3D`.
|
|
9201
|
+
*
|
|
9202
|
+
* @ignore
|
|
9203
|
+
* @param map MapLibre map
|
|
9204
|
+
* @param beforeLayerID The wanted anchor layer, if any.
|
|
9205
|
+
*/
|
|
9206
|
+
export declare const existingAnchorLayerID: (map: Map$1, beforeLayerID: string | undefined) => string | undefined;
|
|
9207
|
+
/**
|
|
9208
|
+
* The standard style a style input loads: the default one when the input names none.
|
|
9209
|
+
* @ignore
|
|
9210
|
+
*/
|
|
9211
|
+
export declare const standardStyleIdOf: (styleInput?: StyleInput) => StandardStyleID;
|
|
9212
|
+
//#endregion
|
|
8790
9213
|
//#region src/base/BaseMapModule.d.ts
|
|
8791
9214
|
type BaseSourceAndLayers = {
|
|
8792
9215
|
vectorTiles: StyleSourceWithLayers;
|
|
@@ -8829,7 +9252,9 @@ export type BaseMapEvents = CombinedEvents<MapGeoJSONFeature, BaseMapModuleConfi
|
|
|
8829
9252
|
*
|
|
8830
9253
|
* @remarks
|
|
8831
9254
|
* This module owns whether each base-map layer group is shown, and the road parts within them
|
|
8832
|
-
* (`roads.arrows.visible`, `roads.exitNumbers.visible`, …), which never show in a group it hides.
|
|
9255
|
+
* (`roads.arrows.visible`, `roads.exitNumbers.visible`, …), which never show in a group it hides. It
|
|
9256
|
+
* also owns how the 3D buildings react to hover and click (`buildings3D.hover`, `buildings3D.click`),
|
|
9257
|
+
* and the colours of the ones {@link BaseMapModule.setBuildingColors} picks by id.
|
|
8833
9258
|
* {@link StylingFoundationsModule} knobs set how the base map looks. See [Who owns what](https://docs.tomtom.com/maps-sdk-js/guides/map/modules#who-owns-what).
|
|
8834
9259
|
* {@link baseMapKnobCatalogue} lists every setting of its configuration.
|
|
8835
9260
|
*
|
|
@@ -8852,6 +9277,7 @@ export type BaseMapEvents = CombinedEvents<MapGeoJSONFeature, BaseMapModuleConfi
|
|
|
8852
9277
|
* - Show only specific layer groups, such as roads only.
|
|
8853
9278
|
* - Create custom map appearances by hiding certain elements.
|
|
8854
9279
|
* - Build overlay maps with selective base layers.
|
|
9280
|
+
* - Light up the 3D buildings on hover and click, and colour the ones you pick.
|
|
8855
9281
|
*
|
|
8856
9282
|
* @example
|
|
8857
9283
|
* Basic usage:
|
|
@@ -8913,6 +9339,11 @@ export type BaseMapEvents = CombinedEvents<MapGeoJSONFeature, BaseMapModuleConfi
|
|
|
8913
9339
|
export declare class BaseMapModule extends AbstractStyleOwnedMapModule<BaseSourceAndLayers, BaseMapModuleConfig> {
|
|
8914
9340
|
private layersByGroup?;
|
|
8915
9341
|
private roadParts;
|
|
9342
|
+
private buildingParts;
|
|
9343
|
+
private buildingLayerIds;
|
|
9344
|
+
private buildingColors;
|
|
9345
|
+
private writtenBuildingColors;
|
|
9346
|
+
private buildingLooks;
|
|
8916
9347
|
/**
|
|
8917
9348
|
* Asynchronously retrieves a BaseMapModule instance for the given map.
|
|
8918
9349
|
*
|
|
@@ -8964,6 +9395,14 @@ export declare class BaseMapModule extends AbstractStyleOwnedMapModule<BaseSourc
|
|
|
8964
9395
|
* @ignore
|
|
8965
9396
|
*/
|
|
8966
9397
|
protected _applyConfig(config: BaseMapModuleConfig | undefined): BaseMapModuleConfig | undefined;
|
|
9398
|
+
/**
|
|
9399
|
+
* @ignore
|
|
9400
|
+
*/
|
|
9401
|
+
protected restoreDataAndConfigImpl(): void;
|
|
9402
|
+
/**
|
|
9403
|
+
* @ignore
|
|
9404
|
+
*/
|
|
9405
|
+
protected discardShownData(): void;
|
|
8967
9406
|
/**
|
|
8968
9407
|
* @ignore
|
|
8969
9408
|
*/
|
|
@@ -9020,8 +9459,8 @@ export declare class BaseMapModule extends AbstractStyleOwnedMapModule<BaseSourc
|
|
|
9020
9459
|
* - Showing `all-except` them: Affects every layer outside those groups, which stay as they were
|
|
9021
9460
|
* - Changes apply immediately if the map is ready
|
|
9022
9461
|
*
|
|
9023
|
-
* Every call is kept in the configuration's `groups` or `visible
|
|
9024
|
-
* all of them. The road parts, such as `roads.arrows.visible`, stay set.
|
|
9462
|
+
* Every call is kept in the configuration's `groups` or `visible` (a call without `layerGroups`
|
|
9463
|
+
* replaces the `groups` record with `visible`), so a style change restores all of them. The road parts, such as `roads.arrows.visible`, stay set.
|
|
9025
9464
|
*
|
|
9026
9465
|
* The available groups are the {@link BaseMapLayerGroupName} values.
|
|
9027
9466
|
*
|
|
@@ -9043,7 +9482,7 @@ export declare class BaseMapModule extends AbstractStyleOwnedMapModule<BaseSourc
|
|
|
9043
9482
|
* }
|
|
9044
9483
|
* });
|
|
9045
9484
|
*
|
|
9046
|
-
* // Show everything
|
|
9485
|
+
* // Show everything but the place labels, leaving them as they are
|
|
9047
9486
|
* baseMap.setVisible(true, {
|
|
9048
9487
|
* layerGroups: {
|
|
9049
9488
|
* show: 'all-except',
|
|
@@ -9062,6 +9501,57 @@ export declare class BaseMapModule extends AbstractStyleOwnedMapModule<BaseSourc
|
|
|
9062
9501
|
setVisible(visible: boolean, options?: {
|
|
9063
9502
|
layerGroups?: BaseMapLayerGroups;
|
|
9064
9503
|
}): void;
|
|
9504
|
+
/**
|
|
9505
|
+
* Gives single 3D buildings a colour of their own, by feature id, in place of the colours given before.
|
|
9506
|
+
*
|
|
9507
|
+
* @param colors - CSS colours by the id of the building's feature, the `id` a handler of
|
|
9508
|
+
* {@link events} receives on it. Pass `{}` to give every building the style's colour back.
|
|
9509
|
+
*
|
|
9510
|
+
* @remarks
|
|
9511
|
+
* The ids are the map data's own, the same across tiles and zoom levels, so you can colour a building
|
|
9512
|
+
* before it loads. The map data splits a building of several heights into parts, each with an id
|
|
9513
|
+
* of its own: the id of any part colours the whole building, and the building lights up as one on
|
|
9514
|
+
* hover and click. A hovered or clicked building turns from its colour towards the one
|
|
9515
|
+
* `buildings3D.hover` or `buildings3D.click` sets. The colours stay through a style change that keeps
|
|
9516
|
+
* state.
|
|
9517
|
+
*
|
|
9518
|
+
* @example
|
|
9519
|
+
* ```typescript
|
|
9520
|
+
* baseMap.events
|
|
9521
|
+
* .where({ layerGroups: { show: 'only', values: ['buildings3D'] } })
|
|
9522
|
+
* .on('click', (building) => {
|
|
9523
|
+
* baseMap.setBuildingColors({ ...baseMap.getBuildingColors(), [String(building.id)]: '#e4572e' });
|
|
9524
|
+
* });
|
|
9525
|
+
* ```
|
|
9526
|
+
*/
|
|
9527
|
+
setBuildingColors(colors: Readonly<Record<string, string>>): void;
|
|
9528
|
+
/**
|
|
9529
|
+
* The colours {@link setBuildingColors} gave, by feature id.
|
|
9530
|
+
*/
|
|
9531
|
+
getBuildingColors(): Record<string, string>;
|
|
9532
|
+
/**
|
|
9533
|
+
* The id of the 3D building standing at a position, to colour with {@link setBuildingColors}. For a
|
|
9534
|
+
* building the map data splits into parts, the id of its whole outline.
|
|
9535
|
+
*
|
|
9536
|
+
* @param position - A point inside the building's footprint.
|
|
9537
|
+
*
|
|
9538
|
+
* @returns `undefined` where no building stands, or until the tiles holding it have loaded: wait
|
|
9539
|
+
* until the map is idle with the place in view.
|
|
9540
|
+
*
|
|
9541
|
+
* @remarks
|
|
9542
|
+
* A geocoded address can sit on the street in front of its building rather than inside it, so
|
|
9543
|
+
* use a point within the footprint, such as a place's own position.
|
|
9544
|
+
*
|
|
9545
|
+
* @example
|
|
9546
|
+
* ```typescript
|
|
9547
|
+
* if (!map.mapLibreMap.loaded()) await map.mapLibreMap.once('idle');
|
|
9548
|
+
* const empireState = baseMap.getBuildingIdAt([-73.98566, 40.74844]);
|
|
9549
|
+
* if (empireState !== undefined) baseMap.setBuildingColors({ [empireState]: '#e4572e' });
|
|
9550
|
+
* ```
|
|
9551
|
+
*/
|
|
9552
|
+
getBuildingIdAt(position: HasLngLat): string | number | undefined;
|
|
9553
|
+
private regroupBuildings;
|
|
9554
|
+
private writeBuildingColors;
|
|
9065
9555
|
private writeVisibility;
|
|
9066
9556
|
private layerSettings;
|
|
9067
9557
|
/**
|
|
@@ -9104,7 +9594,7 @@ export declare class BaseMapModule extends AbstractStyleOwnedMapModule<BaseSourc
|
|
|
9104
9594
|
* The unified events interface of this module, for both user interactions and module
|
|
9105
9595
|
* lifecycle events.
|
|
9106
9596
|
*
|
|
9107
|
-
* User interaction events are `click`, `contextmenu`, `hover` and `long-hover`:
|
|
9597
|
+
* User interaction events are every {@link EventType}, such as `click`, `contextmenu`, `hover` and `long-hover`:
|
|
9108
9598
|
* ```typescript
|
|
9109
9599
|
* const unsub = baseMap.events.on('click', (feature, lngLat) => {
|
|
9110
9600
|
* console.log('Clicked on:', feature.properties);
|
|
@@ -9126,12 +9616,13 @@ export declare class BaseMapModule extends AbstractStyleOwnedMapModule<BaseSourc
|
|
|
9126
9616
|
//#region src/base/knobCatalogue.d.ts
|
|
9127
9617
|
/**
|
|
9128
9618
|
* Every base-map knob with its kind and description: `visible`, then one toggle per layer group in
|
|
9129
|
-
* {@link baseMapLayerGroupNames} order, then one per road part
|
|
9130
|
-
* map loaded.
|
|
9619
|
+
* {@link baseMapLayerGroupNames} order, then one per road part, then the colour and intensity of
|
|
9620
|
+
* a hovered and a clicked 3D building. It is static data, readable with no map loaded.
|
|
9131
9621
|
*
|
|
9132
9622
|
* @remarks
|
|
9133
|
-
* A knob is a plain display value in {@link BaseMapModuleConfig}, at the path its id names.
|
|
9134
|
-
*
|
|
9623
|
+
* A knob is a plain display value in {@link BaseMapModuleConfig}, at the path its id names. Only
|
|
9624
|
+
* the intensities carry a `default`. Unset layers draw as the style ships them, and some groups
|
|
9625
|
+
* ship hidden.
|
|
9135
9626
|
*
|
|
9136
9627
|
* Not knobs: `events`.
|
|
9137
9628
|
*
|
|
@@ -9180,7 +9671,7 @@ export type CustomGeoJSONImageSpec = {
|
|
|
9180
9671
|
* module added.
|
|
9181
9672
|
*
|
|
9182
9673
|
* @remarks
|
|
9183
|
-
* If no layer on the map has the `layerID`, the layer goes on top
|
|
9674
|
+
* If no layer on the map has the `layerID`, the layer goes on top.
|
|
9184
9675
|
*
|
|
9185
9676
|
* @example
|
|
9186
9677
|
* ```typescript
|
|
@@ -9276,7 +9767,7 @@ export type CustomGeoJSONSourceSpec = {
|
|
|
9276
9767
|
*/
|
|
9277
9768
|
export type CustomGeoJSONModuleConfig<TSources extends Record<string, FeatureCollection> = Record<string, FeatureCollection>> = MapModuleCommonConfig & {
|
|
9278
9769
|
/**
|
|
9279
|
-
* The sources, keyed by
|
|
9770
|
+
* The sources, keyed by a user-defined name other than `on`, `off` and `where`, that this module manages.
|
|
9280
9771
|
*
|
|
9281
9772
|
* @remarks
|
|
9282
9773
|
* The set of source names is fixed at module creation time, as is each source's `sourceID`.
|
|
@@ -9328,7 +9819,7 @@ export type CustomGeoJSONModuleConfig<TSources extends Record<string, FeatureCol
|
|
|
9328
9819
|
*
|
|
9329
9820
|
* @remarks
|
|
9330
9821
|
* A shown source draws its layers while it holds features. `show()` and `clear()` never change
|
|
9331
|
-
* this. A hidden module keeps its data
|
|
9822
|
+
* this. A hidden module keeps its data, and draws it again when {@link CustomGeoJSONModule.setVisible} shows it.
|
|
9332
9823
|
*
|
|
9333
9824
|
* @default true
|
|
9334
9825
|
*/
|
|
@@ -9461,7 +9952,8 @@ export declare class CustomGeoJSONModule<TSources extends Record<string, Feature
|
|
|
9461
9952
|
* them on one map.
|
|
9462
9953
|
*
|
|
9463
9954
|
* @param config The module configuration. `sources` is required and must contain at
|
|
9464
|
-
* least one entry, and each entry must have at least one layer.
|
|
9955
|
+
* least one entry, and each entry must have at least one layer. A source can't be named `on`, `off`
|
|
9956
|
+
* or `where`.
|
|
9465
9957
|
*/
|
|
9466
9958
|
static create<TSources extends Record<string, FeatureCollection> = Record<string, FeatureCollection>>(tomtomMap: TomTomMap, config: CustomGeoJSONModuleConfig<TSources>): Promise<CustomGeoJSONModule<TSources>>;
|
|
9467
9959
|
private constructor();
|
|
@@ -9478,6 +9970,7 @@ export declare class CustomGeoJSONModule<TSources extends Record<string, Feature
|
|
|
9478
9970
|
*/
|
|
9479
9971
|
protected _applyConfig(config: CustomGeoJSONModuleConfig<TSources> | undefined): CustomGeoJSONModuleConfig<TSources> | undefined;
|
|
9480
9972
|
private updateLayersForExistingSources;
|
|
9973
|
+
private stackAddedInArrayOrder;
|
|
9481
9974
|
/** @ignore */
|
|
9482
9975
|
protected applyVisibility(config: CustomGeoJSONModuleConfig<TSources> | undefined): void;
|
|
9483
9976
|
private applySourceVisibility;
|
|
@@ -9515,8 +10008,7 @@ export declare class CustomGeoJSONModule<TSources extends Record<string, Feature
|
|
|
9515
10008
|
/**
|
|
9516
10009
|
* Returns the feature collection currently shown on each source.
|
|
9517
10010
|
*
|
|
9518
|
-
* A source that was never shown, or was cleared, returns
|
|
9519
|
-
* collection that `GeoJSONSourceWithLayers` keeps as initial state.
|
|
10011
|
+
* A source that was never shown, or was cleared, returns an empty feature collection.
|
|
9520
10012
|
*/
|
|
9521
10013
|
getShown(): { [K in keyof TSources]: TSources[K]; };
|
|
9522
10014
|
/**
|
|
@@ -9525,6 +10017,7 @@ export declare class CustomGeoJSONModule<TSources extends Record<string, Feature
|
|
|
9525
10017
|
* @ignore
|
|
9526
10018
|
*/
|
|
9527
10019
|
protected eventStateSources(): Array<keyof TSources>;
|
|
10020
|
+
private sourceNames;
|
|
9528
10021
|
/**
|
|
9529
10022
|
* The events of every source, with one named scope per source in
|
|
9530
10023
|
* {@link CustomGeoJSONModuleConfig.sources}.
|
|
@@ -9549,8 +10042,8 @@ export declare class CustomGeoJSONModule<TSources extends Record<string, Feature
|
|
|
9549
10042
|
* {@link customGeoJSONKnobCatalogue} for what each one does.
|
|
9550
10043
|
*
|
|
9551
10044
|
* @remarks
|
|
9552
|
-
* It covers every setting but `sources`, `images` and `
|
|
9553
|
-
* layers, source options, images
|
|
10045
|
+
* It covers every setting but `sources`, `images`, `beforeLayerConfig` and `events`, which hold the caller's own
|
|
10046
|
+
* MapLibre layers, source options, images, layer placement and handlers rather than plain values.
|
|
9554
10047
|
*
|
|
9555
10048
|
* @group Custom
|
|
9556
10049
|
*/
|
|
@@ -9604,9 +10097,12 @@ export declare const geometryFillStyles: readonly ["filled", "outline", "inverte
|
|
|
9604
10097
|
* How {@link GeometriesModule} fills a polygon.
|
|
9605
10098
|
*
|
|
9606
10099
|
* - `'filled'` — Coloured fill with thin border (default)
|
|
9607
|
-
* - `'outline'` — Transparent fill with thick
|
|
10100
|
+
* - `'outline'` — Transparent fill with thick border
|
|
9608
10101
|
* - `'inverted'` — Colours the area **outside** the polygon (donut geometry)
|
|
9609
10102
|
*
|
|
10103
|
+
* In {@link GeometriesModule}, `'outline'` only sets defaults: an explicit `fill.opacity`,
|
|
10104
|
+
* `line.width` or `line.opacity` still wins over its look, and any configured colour over its grey border.
|
|
10105
|
+
*
|
|
9610
10106
|
* Set it in config with {@link GeometryFillConfig.style | fill.style}, or per-feature in
|
|
9611
10107
|
* `properties.fillStyle`.
|
|
9612
10108
|
*
|
|
@@ -9655,11 +10151,11 @@ export type GeometryPaletteMode = (typeof geometryPaletteModes)[number];
|
|
|
9655
10151
|
*/
|
|
9656
10152
|
export type GeometryFillConfig = {
|
|
9657
10153
|
/**
|
|
9658
|
-
* How every feature shown by this module is filled
|
|
10154
|
+
* How every feature shown by this module is filled, one of the {@link GeometryFillStyle} values,
|
|
10155
|
+
* `'filled'` by default.
|
|
9659
10156
|
*
|
|
9660
|
-
*
|
|
9661
|
-
*
|
|
9662
|
-
* - `'inverted'` — Colours the area **outside** the polygon (donut geometry)
|
|
10157
|
+
* `'outline'` only sets the defaults of `fill.opacity`, `line.width` and `line.opacity`: leave
|
|
10158
|
+
* those unset to see its transparent fill and thick border.
|
|
9663
10159
|
*
|
|
9664
10160
|
* Individual features can override this by setting `fillStyle` in their properties.
|
|
9665
10161
|
*
|
|
@@ -9675,11 +10171,12 @@ export type GeometryFillConfig = {
|
|
|
9675
10171
|
style?: GeometryFillStyle;
|
|
9676
10172
|
/**
|
|
9677
10173
|
* The fill colour, as a CSS colour string (`'#FF5733'`) or a MapLibre expression for data-driven
|
|
9678
|
-
* styling, like `['get', '
|
|
10174
|
+
* styling, like `['get', 'zoneColor']`.
|
|
9679
10175
|
*
|
|
9680
10176
|
* @remarks
|
|
9681
10177
|
* Overrides {@link GeometryFillConfig.palette | palette} and the top-level
|
|
9682
10178
|
* {@link GeometriesModuleConfig.color}, for the fill and the border. The latter lists the full order.
|
|
10179
|
+
* A feature an expression yields no colour for takes the top-level `color`, never the palette.
|
|
9683
10180
|
*/
|
|
9684
10181
|
color?: string | ExpressionSpecification;
|
|
9685
10182
|
/**
|
|
@@ -9709,7 +10206,7 @@ export type GeometryFillConfig = {
|
|
|
9709
10206
|
/**
|
|
9710
10207
|
* Fill opacity, 0 (transparent) to 1 (opaque). Also accepts a MapLibre expression.
|
|
9711
10208
|
*
|
|
9712
|
-
* @default 0.15
|
|
10209
|
+
* @default 0.15, or 0 under the `'outline'` fill style
|
|
9713
10210
|
*/
|
|
9714
10211
|
opacity?: DataDrivenPropertyValueSpecification<number>;
|
|
9715
10212
|
};
|
|
@@ -9717,6 +10214,10 @@ export type GeometryFillConfig = {
|
|
|
9717
10214
|
* The label drawn at the center of each geometry: its text, and how it looks.
|
|
9718
10215
|
*
|
|
9719
10216
|
* @remarks
|
|
10217
|
+
* A geometry draws it at its `placeCoordinates` property, else a MultiPolygon on its longest outer
|
|
10218
|
+
* ring. A Polygon without `placeCoordinates`, and a geometry of the `'inverted'` fill style without
|
|
10219
|
+
* them, draws none.
|
|
10220
|
+
*
|
|
9720
10221
|
* Unset fields keep the defaults: the feature's `title` as text, size 15, bold font, and
|
|
9721
10222
|
* theme-adaptive colours, `'#333333'` text with a `'#FFFFFF'` halo on light map styles and the
|
|
9722
10223
|
* reverse on dark.
|
|
@@ -9777,7 +10278,7 @@ export type GeometryLabelConfig = LabelConfig & {
|
|
|
9777
10278
|
* // Data-driven border
|
|
9778
10279
|
* const line: GeometryLineConfig = {
|
|
9779
10280
|
* color: ['get', 'borderColor'],
|
|
9780
|
-
* width: ['case', ['get', 'selected'], 4, 2],
|
|
10281
|
+
* width: ['case', ['==', ['get', 'selected'], true], 4, 2],
|
|
9781
10282
|
* };
|
|
9782
10283
|
* ```
|
|
9783
10284
|
*
|
|
@@ -9796,14 +10297,14 @@ export type GeometryLineConfig = {
|
|
|
9796
10297
|
/**
|
|
9797
10298
|
* Border opacity, 0 (transparent) to 1 (opaque). Also accepts a MapLibre expression.
|
|
9798
10299
|
*
|
|
9799
|
-
* @default 1
|
|
10300
|
+
* @default 1, or 0.9 under the `'outline'` fill style
|
|
9800
10301
|
*/
|
|
9801
10302
|
opacity?: DataDrivenPropertyValueSpecification<number>;
|
|
9802
10303
|
/**
|
|
9803
10304
|
* Border width in pixels. Also accepts a MapLibre expression, such as
|
|
9804
|
-
* `['case', ['get', 'selected'], 4, 2]`.
|
|
10305
|
+
* `['case', ['==', ['get', 'selected'], true], 4, 2]`.
|
|
9805
10306
|
*
|
|
9806
|
-
* @default 2
|
|
10307
|
+
* @default 2, or 5 under the `'outline'` fill style
|
|
9807
10308
|
*/
|
|
9808
10309
|
width?: DataDrivenPropertyValueSpecification<number>;
|
|
9809
10310
|
/**
|
|
@@ -9847,10 +10348,9 @@ export type GeometryLayersConfig = {
|
|
|
9847
10348
|
* How a hovered or clicked geometry is drawn, with a denser fill and a wider border in its own colours.
|
|
9848
10349
|
*
|
|
9849
10350
|
* @remarks
|
|
9850
|
-
* The factors multiply the fill opacity and border width in force,
|
|
9851
|
-
*
|
|
9852
|
-
*
|
|
9853
|
-
* once a handler covers them, or {@link GeometriesModule.setEventState} puts one.
|
|
10351
|
+
* The factors multiply the fill opacity and border width in force, configured or default. A
|
|
10352
|
+
* `fill-opacity` in the `layers.fill` override, or a `line-width` in `layers.line`, is drawn as given. The geometries draw their event
|
|
10353
|
+
* states once a handler covers them, or the module's `setEventState` puts one.
|
|
9854
10354
|
*
|
|
9855
10355
|
* @example
|
|
9856
10356
|
* ```typescript
|
|
@@ -9867,7 +10367,7 @@ export type GeometryHighlightConfig = {
|
|
|
9867
10367
|
* Multiplier on the fill opacity, at most opaque. `1` draws the fill as on any other geometry.
|
|
9868
10368
|
* Clamped to 1 to 4.
|
|
9869
10369
|
*
|
|
9870
|
-
* @default
|
|
10370
|
+
* @default 2
|
|
9871
10371
|
*/
|
|
9872
10372
|
opacityFactor?: number;
|
|
9873
10373
|
};
|
|
@@ -9876,7 +10376,7 @@ export type GeometryHighlightConfig = {
|
|
|
9876
10376
|
/**
|
|
9877
10377
|
* Multiplier on the border width. `1` draws the border as on any other geometry. Clamped to 1 to 3.
|
|
9878
10378
|
*
|
|
9879
|
-
* @default
|
|
10379
|
+
* @default 1.75
|
|
9880
10380
|
*/
|
|
9881
10381
|
widthFactor?: number;
|
|
9882
10382
|
};
|
|
@@ -9942,7 +10442,7 @@ export type GeometryLineLabelConfig = GeometryLabelConfig & {
|
|
|
9942
10442
|
* Controls where geometry layers are placed in the map's layer stack.
|
|
9943
10443
|
*
|
|
9944
10444
|
* @remarks
|
|
9945
|
-
* A single {@link BeforeLayerConfig} (`'top'` or a
|
|
10445
|
+
* A single {@link BeforeLayerConfig} (`'top'` or a {@link MapStyleLayerID}) positions **all** geometry layers
|
|
9946
10446
|
* together. The record form positions the parts independently, `all` covering any it doesn't name:
|
|
9947
10447
|
* - `fill` — the fill layer.
|
|
9948
10448
|
* - `line` — the border/outline, with its line labels.
|
|
@@ -9998,7 +10498,7 @@ export type GeometryBeforeLayerConfig = PartsBeforeLayerConfig<'fill' | 'line'>;
|
|
|
9998
10498
|
* opacity: 0.4
|
|
9999
10499
|
* },
|
|
10000
10500
|
* line: {
|
|
10001
|
-
* color: '#000000', width: ['case', ['get', 'highlighted'], 4, 2],
|
|
10501
|
+
* color: '#000000', width: ['case', ['==', ['get', 'highlighted'], true], 4, 2],
|
|
10002
10502
|
* },
|
|
10003
10503
|
* label: {
|
|
10004
10504
|
* title: ['concat', ['get', 'name'], '\n', ['get', 'area'], ' km²']
|
|
@@ -10145,7 +10645,7 @@ type GeometrySourcesWithLayers = {
|
|
|
10145
10645
|
export type GeometriesEvents<CFG = GeometriesModuleConfig> = CombinedEvents<MapGeoJSONFeature, CFG, PolygonFeatures> & {
|
|
10146
10646
|
/** The fills, their borders and the labels along the borders, all drawn from the same features. */
|
|
10147
10647
|
geometry: UserEventsWithStates<MapGeoJSONFeature>;
|
|
10148
|
-
/** The title points, one per
|
|
10648
|
+
/** The title points, one per geometry the title can be placed on, that `getShown()` lists under `geometryLabel`. */
|
|
10149
10649
|
geometryLabel: UserEventsWithStates<MapGeoJSONFeature>;
|
|
10150
10650
|
};
|
|
10151
10651
|
/**
|
|
@@ -10463,8 +10963,11 @@ export declare class GeometriesModule extends AbstractGeometriesModule<Geometrie
|
|
|
10463
10963
|
*
|
|
10464
10964
|
* Feature properties:
|
|
10465
10965
|
* - `title`: The text of the center and border labels, unless `label.title` or `lineLabel.title` sets
|
|
10466
|
-
* theirs. Without one, a text `label.title`, then `address.freeformAddress`, fills it in
|
|
10467
|
-
*
|
|
10966
|
+
* theirs. Without one, a text `label.title`, then `address.freeformAddress`, fills it in. A Polygon
|
|
10967
|
+
* draws its center label only with `placeCoordinates`
|
|
10968
|
+
* - `placeCoordinates`: The `[longitude, latitude]` of the center label, which a MultiPolygon
|
|
10969
|
+
* otherwise places on its longest outer ring
|
|
10970
|
+
* - `color`: Override the fill and border colour per feature; `line.color` still wins for the border
|
|
10468
10971
|
* - `fillStyle`: Override the module's `fill.style` per feature
|
|
10469
10972
|
* - `id`: The id that event states and event handlers use, generated when missing. A feature's
|
|
10470
10973
|
* top-level `id` isn't read, so the top-level id of a geometry data result matches nothing
|
|
@@ -10566,7 +11069,7 @@ type GeometryLabelKnobLeaf = Exclude<keyof LabelConfig, 'customTypeface'>;
|
|
|
10566
11069
|
*
|
|
10567
11070
|
* @group Geometries
|
|
10568
11071
|
*/
|
|
10569
|
-
type GeometriesKnobId = 'color' | 'visible' | `fill.${keyof GeometryFillConfig}` | `line.${keyof GeometryLineConfig}` | `highlight.${LeafPathOf<GeometryHighlightConfig>}` | `label.${
|
|
11072
|
+
type GeometriesKnobId = 'color' | 'visible' | `fill.${keyof GeometryFillConfig}` | `line.${keyof GeometryLineConfig}` | `highlight.${LeafPathOf<GeometryHighlightConfig>}` | `label.${GeometryLabelKnobLeaf}` | `lineLabel.${Exclude<keyof GeometryLineLabelConfig, 'title' | 'customTypeface'>}`;
|
|
10570
11073
|
/**
|
|
10571
11074
|
* The value type of a geometries knob, the plain value its path holds in
|
|
10572
11075
|
* {@link GeometriesModuleConfig}. The MapLibre expressions the config also takes there are not knob
|
|
@@ -10619,7 +11122,9 @@ export type ReachableRangesModuleConfig = MapModuleCommonConfig & {
|
|
|
10619
11122
|
*
|
|
10620
11123
|
* @remarks
|
|
10621
11124
|
* `show()` and `clear()` never change it. A hidden module keeps its ranges until
|
|
10622
|
-
* {@link ReachableRangesModule.setVisible} shows it again.
|
|
11125
|
+
* {@link ReachableRangesModule.setVisible} shows it again. A layer hidden through its
|
|
11126
|
+
* {@link ReachableRangesModuleConfig.layers | layers} entry's `layout.visibility` stays hidden while
|
|
11127
|
+
* the module is shown.
|
|
10623
11128
|
*
|
|
10624
11129
|
* @default true
|
|
10625
11130
|
*/
|
|
@@ -10649,6 +11154,11 @@ export type ReachableRangesModuleConfig = MapModuleCommonConfig & {
|
|
|
10649
11154
|
beforeLayerConfig?: GeometryBeforeLayerConfig;
|
|
10650
11155
|
/**
|
|
10651
11156
|
* MapLibre overrides for the band, border and label layers.
|
|
11157
|
+
*
|
|
11158
|
+
* @remarks
|
|
11159
|
+
* `label`, the centre label, draws only for a range that is a MultiPolygon or carries
|
|
11160
|
+
* `placeCoordinates`. The Polygons `calculateReachableRanges` returns are neither, so their titles
|
|
11161
|
+
* show along their borders alone.
|
|
10652
11162
|
*/
|
|
10653
11163
|
layers?: GeometryLayersConfig;
|
|
10654
11164
|
};
|
|
@@ -10697,8 +11207,8 @@ export type ReachableRangeFillConfig = {
|
|
|
10697
11207
|
* the innermost one, drawn at the full opacity, so the bands fade out away from the origin.
|
|
10698
11208
|
*
|
|
10699
11209
|
* @remarks
|
|
10700
|
-
* With `'inverted'`, the world beyond the largest range is the outermost band.
|
|
10701
|
-
* outermost band too, so it takes the factor.
|
|
11210
|
+
* With `'inverted'`, the world beyond the largest range is the outermost band. When no origin has
|
|
11211
|
+
* more than one range, each range is the outermost band too, so it takes the factor.
|
|
10702
11212
|
*
|
|
10703
11213
|
* @default 1
|
|
10704
11214
|
*/
|
|
@@ -10899,11 +11409,11 @@ export declare class ReachableRangesModule extends AbstractGeometriesModule<Reac
|
|
|
10899
11409
|
* @remarks
|
|
10900
11410
|
* Use cases:
|
|
10901
11411
|
* - Search result boundaries (e.g., city limits, postal codes)
|
|
10902
|
-
* - Reachable range polygons
|
|
10903
11412
|
* - Delivery zones
|
|
10904
11413
|
* - Custom area highlights
|
|
10905
11414
|
*
|
|
10906
|
-
* These properties override default styling and allow per-feature customization.
|
|
11415
|
+
* These properties override default styling and allow per-feature customization. The reachable
|
|
11416
|
+
* ranges module sets `title`, `color` and `fillStyle` itself.
|
|
10907
11417
|
*
|
|
10908
11418
|
* @example
|
|
10909
11419
|
* ```typescript
|
|
@@ -10947,10 +11457,10 @@ export type ExtraGeometryDisplayProps = {
|
|
|
10947
11457
|
*/
|
|
10948
11458
|
title?: string;
|
|
10949
11459
|
/**
|
|
10950
|
-
* The geometry's fill colour.
|
|
11460
|
+
* The geometry's fill and border colour.
|
|
10951
11461
|
*
|
|
10952
11462
|
* @remarks
|
|
10953
|
-
* Overrides the
|
|
11463
|
+
* Overrides the module configuration's colours, but `line.color` still wins for the border.
|
|
10954
11464
|
* Accepts any valid CSS colour value.
|
|
10955
11465
|
*
|
|
10956
11466
|
* Colour formats:
|
|
@@ -10982,7 +11492,6 @@ export type ExtraGeometryDisplayProps = {
|
|
|
10982
11492
|
* @remarks
|
|
10983
11493
|
* The GeometriesModule uses them to render:
|
|
10984
11494
|
* - Search API geometry results
|
|
10985
|
-
* - Reachable range polygons
|
|
10986
11495
|
* - Custom polygon overlays
|
|
10987
11496
|
* - Administrative boundaries
|
|
10988
11497
|
*
|
|
@@ -10991,11 +11500,12 @@ export type ExtraGeometryDisplayProps = {
|
|
|
10991
11500
|
* @example
|
|
10992
11501
|
* ```typescript
|
|
10993
11502
|
* const geometry: DisplayGeometryProps = {
|
|
10994
|
-
* type: '
|
|
11503
|
+
* type: 'Geography',
|
|
10995
11504
|
* id: 'geom-123',
|
|
10996
11505
|
* title: 'Amsterdam',
|
|
10997
11506
|
* color: '#0080FF',
|
|
10998
11507
|
* address: {
|
|
11508
|
+
* freeformAddress: 'Amsterdam',
|
|
10999
11509
|
* municipalitySubdivision: 'Amsterdam',
|
|
11000
11510
|
* countryCode: 'NL'
|
|
11001
11511
|
* }
|
|
@@ -11106,7 +11616,7 @@ type POIsModuleFeature = Feature<Point, {
|
|
|
11106
11616
|
/**
|
|
11107
11617
|
* The source and layer IDs of the POIs module.
|
|
11108
11618
|
*/
|
|
11109
|
-
type
|
|
11619
|
+
type POIsSourcesAndLayers = {
|
|
11110
11620
|
/**
|
|
11111
11621
|
* The places of interest with their layer ids.
|
|
11112
11622
|
*/
|
|
@@ -11218,11 +11728,10 @@ type PoIsSourcesAndLayers = {
|
|
|
11218
11728
|
*
|
|
11219
11729
|
* @group POIs
|
|
11220
11730
|
*/
|
|
11221
|
-
export declare class POIsModule extends AbstractStyleOwnedMapModule<
|
|
11222
|
-
private categoriesFilter?;
|
|
11223
|
-
private idsFilter?;
|
|
11731
|
+
export declare class POIsModule extends AbstractStyleOwnedMapModule<POIsSourcesAndLayers, POIsModuleConfig> {
|
|
11224
11732
|
private addedIcons;
|
|
11225
11733
|
private microMarkers;
|
|
11734
|
+
private appliedFilters;
|
|
11226
11735
|
/**
|
|
11227
11736
|
* Retrieves a POIsModule instance for the given map.
|
|
11228
11737
|
*
|
|
@@ -11325,7 +11834,10 @@ export declare class POIsModule extends AbstractStyleOwnedMapModule<PoIsSourcesA
|
|
|
11325
11834
|
* - `click`: User clicks on a POI
|
|
11326
11835
|
* - `contextmenu`: User right-clicks on a POI
|
|
11327
11836
|
* - `hover`: Mouse enters a POI
|
|
11837
|
+
* - `hover-move`: Mouse moves over a POI
|
|
11328
11838
|
* - `long-hover`: Mouse hovers over POI for extended time
|
|
11839
|
+
* - `dragstart`, `drag` and `dragend`: a handler for any of them makes POIs draggable ({@link DragEventType})
|
|
11840
|
+
* - `config-change`: The module's config changed
|
|
11329
11841
|
*
|
|
11330
11842
|
* Event feature properties:
|
|
11331
11843
|
* - `id`: Unique POI identifier
|
|
@@ -11357,14 +11869,14 @@ type UndrawnSectionType = 'country' | 'distinct' | 'lanes' | 'leg' | 'roadShield
|
|
|
11357
11869
|
*
|
|
11358
11870
|
* @remarks
|
|
11359
11871
|
* It covers every section type the API can return, except the ones nothing draws. It derives from
|
|
11360
|
-
* the core {@link SectionType} vocabulary, and
|
|
11872
|
+
* the core {@link SectionType} vocabulary, and the module's section registry is keyed by it. So a section
|
|
11361
11873
|
* type added to core must be registered there, or named undrawn above, before this package compiles.
|
|
11362
11874
|
*
|
|
11363
11875
|
* @group Routing
|
|
11364
11876
|
*/
|
|
11365
11877
|
type DrawnSectionType = Exclude<SectionType, UndrawnSectionType>;
|
|
11366
11878
|
/**
|
|
11367
|
-
* The section types whose layers are generated from
|
|
11879
|
+
* The section types whose layers are generated from the module's section registry.
|
|
11368
11880
|
*
|
|
11369
11881
|
* @remarks
|
|
11370
11882
|
* They are plain line overlays over the route, or a sign along it, one registration each. The
|
|
@@ -11537,7 +12049,6 @@ declare const SECTION_REGISTRY: {
|
|
|
11537
12049
|
readonly sourceKey: "incidents";
|
|
11538
12050
|
readonly visible: true;
|
|
11539
12051
|
readonly style: "inline";
|
|
11540
|
-
readonly pattern: "solid";
|
|
11541
12052
|
readonly knobs: readonly ["visible", "opacity", "widthPreset", "widthFactor", "style"];
|
|
11542
12053
|
};
|
|
11543
12054
|
readonly tunnel: {
|
|
@@ -11559,7 +12070,7 @@ declare const SECTION_REGISTRY: {
|
|
|
11559
12070
|
* The knobs one section type answers to.
|
|
11560
12071
|
*
|
|
11561
12072
|
* @remarks
|
|
11562
|
-
* Read off
|
|
12073
|
+
* Read off the module's section registry, so `sections.traffic.color` is a compile error rather than a
|
|
11563
12074
|
* setting that draws nothing, since `traffic` colours its line by `magnitudeOfDelay`.
|
|
11564
12075
|
*
|
|
11565
12076
|
* @group Routing
|
|
@@ -11614,7 +12125,7 @@ export declare const sectionDrawsByDefault: (type: DrawnSectionType) => boolean;
|
|
|
11614
12125
|
* A generated type whose presentation is a road sign carrying the section's own value.
|
|
11615
12126
|
*
|
|
11616
12127
|
* @remarks
|
|
11617
|
-
* Derived from the
|
|
12128
|
+
* Derived from the registry's `knobs`, so offering `sign` and being drawn as one are the same fact.
|
|
11618
12129
|
* @ignore
|
|
11619
12130
|
*/
|
|
11620
12131
|
type SignPostingSectionType = { [T in GeneratedSectionType]: 'sign' extends SectionKnobOf<T> ? T : never; }[GeneratedSectionType];
|
|
@@ -11687,7 +12198,7 @@ type RouteStateProps = {
|
|
|
11687
12198
|
* @example
|
|
11688
12199
|
* ```typescript
|
|
11689
12200
|
* const routeProps: DisplayRouteRelatedProps = {
|
|
11690
|
-
* id: '
|
|
12201
|
+
* id: 'section-3',
|
|
11691
12202
|
* routeState: 'selected',
|
|
11692
12203
|
* routeIndex: 0 // First route shown
|
|
11693
12204
|
* };
|
|
@@ -11730,7 +12241,7 @@ type DisplayRouteRelatedProps = RouteStateProps & {
|
|
|
11730
12241
|
* @example
|
|
11731
12242
|
* ```typescript
|
|
11732
12243
|
* const summary: DisplayRouteSummaryProps = {
|
|
11733
|
-
* id: 'route-0
|
|
12244
|
+
* id: 'route-0',
|
|
11734
12245
|
* routeIndex: 0,
|
|
11735
12246
|
* routeState: 'selected',
|
|
11736
12247
|
* formattedDistance: '15 km',
|
|
@@ -11763,6 +12274,7 @@ type DisplayRouteSummaryProps = DisplayRouteRelatedProps & {
|
|
|
11763
12274
|
*
|
|
11764
12275
|
* @remarks
|
|
11765
12276
|
* Human-readable travel time with appropriate units:
|
|
12277
|
+
* - Under half a minute: "< 1 min"
|
|
11766
12278
|
* - Short: "15 min"
|
|
11767
12279
|
* - Medium: "1 hr 30 min"
|
|
11768
12280
|
* - Long: "2 hr 15 min"
|
|
@@ -11810,8 +12322,9 @@ type DisplayRouteSummaryProps = DisplayRouteRelatedProps & {
|
|
|
11810
12322
|
* `+6 min` or `-3 min`.
|
|
11811
12323
|
*
|
|
11812
12324
|
* @remarks
|
|
11813
|
-
* Absent on the selected route,
|
|
11814
|
-
* difference of the rounded durations, so it matches the
|
|
12325
|
+
* Absent on the selected route, on every route while none is selected, and where both durations
|
|
12326
|
+
* round to the same minute. It is the difference of the rounded durations, so it matches the
|
|
12327
|
+
* durations the bubbles show.
|
|
11815
12328
|
*/
|
|
11816
12329
|
formattedDurationDifference?: string;
|
|
11817
12330
|
/**
|
|
@@ -11862,7 +12375,7 @@ type DisplayRouteProps = RouteProps & RouteStateProps & SupportsEvents;
|
|
|
11862
12375
|
* coordinates: [4.9, 52.3]
|
|
11863
12376
|
* },
|
|
11864
12377
|
* properties: {
|
|
11865
|
-
* id: 'route-0
|
|
12378
|
+
* id: 'route-0',
|
|
11866
12379
|
* routeIndex: 0,
|
|
11867
12380
|
* routeState: 'selected',
|
|
11868
12381
|
* formattedDistance: '15 km',
|
|
@@ -11889,7 +12402,7 @@ type DisplayRouteSummary = Feature<Point, DisplayRouteSummaryProps>;
|
|
|
11889
12402
|
* type: 'Feature',
|
|
11890
12403
|
* geometry: { type: 'Point', coordinates: [4.9, 52.3] },
|
|
11891
12404
|
* properties: {
|
|
11892
|
-
* id: 'route-0
|
|
12405
|
+
* id: 'route-0',
|
|
11893
12406
|
* routeIndex: 0,
|
|
11894
12407
|
* routeState: 'selected',
|
|
11895
12408
|
* formattedDistance: '15 km',
|
|
@@ -11900,7 +12413,7 @@ type DisplayRouteSummary = Feature<Point, DisplayRouteSummaryProps>;
|
|
|
11900
12413
|
* type: 'Feature',
|
|
11901
12414
|
* geometry: { type: 'Point', coordinates: [4.85, 52.35] },
|
|
11902
12415
|
* properties: {
|
|
11903
|
-
* id: 'route-1
|
|
12416
|
+
* id: 'route-1',
|
|
11904
12417
|
* routeIndex: 1,
|
|
11905
12418
|
* routeState: 'deselected',
|
|
11906
12419
|
* formattedDistance: '19 km',
|
|
@@ -11996,10 +12509,10 @@ type WaypointIndexType = typeof START_INDEX | typeof MIDDLE_INDEX | typeof FINIS
|
|
|
11996
12509
|
* including route position and stop numbering.
|
|
11997
12510
|
*
|
|
11998
12511
|
* @remarks
|
|
11999
|
-
* Waypoints display differently by their position:
|
|
12000
|
-
* - Start:
|
|
12001
|
-
* - Middle:
|
|
12002
|
-
* - Finish:
|
|
12512
|
+
* Waypoints display differently by their position, each pin in the route colour unless configured:
|
|
12513
|
+
* - Start: the origin pin, with its own glyph
|
|
12514
|
+
* - Middle: a stop pin carrying its stop mark, a number from 1 or, under `stopNumbering: 'letters'`, a letter from A
|
|
12515
|
+
* - Finish: the destination pin, with its own glyph
|
|
12003
12516
|
*
|
|
12004
12517
|
* @example
|
|
12005
12518
|
* ```typescript
|
|
@@ -12075,7 +12588,8 @@ type WaypointDisplayProps = Omit<PlaceDisplayProps, 'id'> & {
|
|
|
12075
12588
|
*
|
|
12076
12589
|
* @remarks
|
|
12077
12590
|
* Stops are the waypoints between origin and destination, numbered from 1. It is
|
|
12078
|
-
* present only for middle waypoints.
|
|
12591
|
+
* present only for middle waypoints. A `null` placeholder among them still counts, so the
|
|
12592
|
+
* stops after it keep their numbers.
|
|
12079
12593
|
*
|
|
12080
12594
|
* Display behaviour:
|
|
12081
12595
|
* - Start waypoint: undefined
|
|
@@ -12107,7 +12621,8 @@ type WaypointDisplayProps = Omit<PlaceDisplayProps, 'id'> & {
|
|
|
12107
12621
|
*
|
|
12108
12622
|
* @remarks
|
|
12109
12623
|
* Taken from {@link WaypointProps.pauseDurationSeconds} and rendered on the stop's label by
|
|
12110
|
-
* default (e.g. `30 min`). Absent when the waypoint carries no wait
|
|
12624
|
+
* default (e.g. `30 min`). Absent when the waypoint carries no wait, or one under 30 seconds,
|
|
12625
|
+
* which rounds to no minutes.
|
|
12111
12626
|
*
|
|
12112
12627
|
* @example
|
|
12113
12628
|
* ```typescript
|
|
@@ -12121,30 +12636,36 @@ type WaypointDisplayProps = Omit<PlaceDisplayProps, 'id'> & {
|
|
|
12121
12636
|
* `waypoints.label.title` receive it, with the properties it was given (a place's, when it was a
|
|
12122
12637
|
* search result) and its {@link WaypointDisplayProps}.
|
|
12123
12638
|
*
|
|
12639
|
+
* @remarks
|
|
12640
|
+
* `waypoints.label.title` runs first, so it sees neither the mapped icon nor the `stopDisplayLabel`;
|
|
12641
|
+
* `waypoints.icon.mapping` sees the title.
|
|
12642
|
+
*
|
|
12124
12643
|
* @group Routing
|
|
12125
12644
|
*/
|
|
12126
12645
|
type DisplayWaypoint = Waypoint<WaypointDisplayProps & Partial<CommonPlaceProps>>;
|
|
12127
12646
|
//#endregion
|
|
12128
12647
|
//#region src/routing/types/routeModuleConfig.d.ts
|
|
12129
12648
|
/**
|
|
12130
|
-
* The
|
|
12649
|
+
* The name of a generated section's line layer: its key under `layers.sections.<type>`.
|
|
12131
12650
|
*
|
|
12132
12651
|
* @remarks
|
|
12133
|
-
* Derived from the section type, so `motorway` is drawn by `routeSectionMotorwayLine`.
|
|
12652
|
+
* Derived from the section type, so `motorway` is drawn by `routeSectionMotorwayLine`. Each module
|
|
12653
|
+
* instance prefixes it into the MapLibre layer id, which `sourceAndLayerIDs` lists.
|
|
12134
12654
|
* @group Routing
|
|
12135
12655
|
*/
|
|
12136
12656
|
type SectionLineLayerName<T extends GeneratedSectionType = GeneratedSectionType> = `routeSection${Capitalize<T>}Line`;
|
|
12137
12657
|
/**
|
|
12138
|
-
* The
|
|
12658
|
+
* The name of a section's icon layer, before the instance prefix of its MapLibre layer id.
|
|
12139
12659
|
*
|
|
12140
12660
|
* @remarks
|
|
12141
|
-
* Added to a generated section
|
|
12661
|
+
* Added to a generated section once `sections.<type>.icon.image` is set, so `motorway` draws
|
|
12142
12662
|
* its icon through `routeSectionMotorwaySymbol`.
|
|
12143
12663
|
* @group Routing
|
|
12144
12664
|
*/
|
|
12145
12665
|
type SectionSymbolLayerName<T extends GeneratedSectionType = GeneratedSectionType> = `routeSection${Capitalize<T>}Symbol`;
|
|
12146
12666
|
/**
|
|
12147
|
-
* The
|
|
12667
|
+
* The name of the layer drawing the signs of one generated section type, before the instance
|
|
12668
|
+
* prefix of its MapLibre layer id.
|
|
12148
12669
|
*
|
|
12149
12670
|
* @remarks
|
|
12150
12671
|
* Present for the types that post their own value on a sign, so `speedLimit` draws its signs
|
|
@@ -12153,8 +12674,8 @@ type SectionSymbolLayerName<T extends GeneratedSectionType = GeneratedSectionTyp
|
|
|
12153
12674
|
*/
|
|
12154
12675
|
type SectionSignLayerName<T extends GeneratedSectionType = GeneratedSectionType> = `routeSection${Capitalize<T>}Sign`;
|
|
12155
12676
|
/**
|
|
12156
|
-
* The
|
|
12157
|
-
* line.
|
|
12677
|
+
* The name of the layer of the kerb stripes a generated section draws over its tight sections'
|
|
12678
|
+
* line, before the instance prefix of its MapLibre layer id.
|
|
12158
12679
|
*
|
|
12159
12680
|
* @remarks
|
|
12160
12681
|
* Present for the types that take a `kerb`, so `curve` draws its kerb through
|
|
@@ -12462,12 +12983,13 @@ type RouteLayersConfig = {
|
|
|
12462
12983
|
/**
|
|
12463
12984
|
* Line layer ringing each focused section of the selected route, drawn with a
|
|
12464
12985
|
* `line-gap-width` as wide as the widest line along the route, so the route and its
|
|
12465
|
-
* sections show through.
|
|
12986
|
+
* sections show through. It sits under the route's own lines, which cover it where the
|
|
12987
|
+
* road doubles back and where focused sections meet.
|
|
12466
12988
|
*/
|
|
12467
12989
|
routeSectionFocusOutline?: Partial<ToBeAddedLayerSpecTemplate<LineLayerSpecification>>;
|
|
12468
12990
|
/**
|
|
12469
|
-
* Line layer ringing each focused section of a deselected route, under
|
|
12470
|
-
* route where they cross.
|
|
12991
|
+
* Line layer ringing each focused section of a deselected route, under that route's own
|
|
12992
|
+
* lines and so under the selected route where they cross.
|
|
12471
12993
|
*/
|
|
12472
12994
|
routeDeselectedSectionFocusOutline?: Partial<ToBeAddedLayerSpecTemplate<LineLayerSpecification>>;
|
|
12473
12995
|
} & HasAdditionalLayersConfig;
|
|
@@ -12488,7 +13010,11 @@ type RouteLayersConfig = {
|
|
|
12488
13010
|
* start: { style: { fillColor: '#1B7A43' } },
|
|
12489
13011
|
* finish: { image: { image: '/flag.svg', pixelRatio: 2 } },
|
|
12490
13012
|
* // Stops that are charging stations look like the map's charging stations:
|
|
12491
|
-
* mapping: {
|
|
13013
|
+
* mapping: {
|
|
13014
|
+
* to: 'poiCategory',
|
|
13015
|
+
* fn: (waypoint) =>
|
|
13016
|
+
* waypoint.properties.poi?.categories?.includes('CHARGING_LOCATION') ? 'CHARGING_LOCATION' : undefined,
|
|
13017
|
+
* },
|
|
12492
13018
|
* };
|
|
12493
13019
|
* ```
|
|
12494
13020
|
*
|
|
@@ -12515,9 +13041,8 @@ type WaypointIconConfig = {
|
|
|
12515
13041
|
* Images for `mapping` to pick by id.
|
|
12516
13042
|
*
|
|
12517
13043
|
* @remarks
|
|
12518
|
-
* Each is added under its own `id`, so `mapping` returns that id.
|
|
12519
|
-
*
|
|
12520
|
-
* entry naming a sprite icon by `id` alone ignores them.
|
|
13044
|
+
* Each is added under its own `id`, so `mapping` returns that id. Its offsets follow
|
|
13045
|
+
* {@link CustomImage}.
|
|
12521
13046
|
*/
|
|
12522
13047
|
customIcons?: CustomImage[];
|
|
12523
13048
|
/**
|
|
@@ -12723,6 +13248,9 @@ type SectionKnobs = {
|
|
|
12723
13248
|
* them off here, and so does `speedLimit`, which posts a sign per section rather than banding
|
|
12724
13249
|
* the route. The rest draw only when you ask. `motorway` and `urban` each run nearly a route's
|
|
12725
13250
|
* whole length, so a band drawn for them buries the route line.
|
|
13251
|
+
*
|
|
13252
|
+
* `curve` and `curvyStretch` also need the route request to ask for them, with
|
|
13253
|
+
* `sectionTypes: [...defaultSectionTypes, 'curve', 'curvyStretch']`.
|
|
12726
13254
|
*/
|
|
12727
13255
|
visible?: boolean;
|
|
12728
13256
|
/**
|
|
@@ -12788,7 +13316,7 @@ type SectionKnobs = {
|
|
|
12788
13316
|
*
|
|
12789
13317
|
* @example
|
|
12790
13318
|
* ```typescript
|
|
12791
|
-
* //
|
|
13319
|
+
* // On a route calculated with `sectionTypes: [...defaultSectionTypes, 'curve']`: blue curves with yellow kerbs
|
|
12792
13320
|
* sections: { curve: { visible: true, color: '#0057B8', kerb: { color: '#FFD700' } } }
|
|
12793
13321
|
* // One plain line
|
|
12794
13322
|
* sections: { curve: { visible: true, kerb: { visible: false } } }
|
|
@@ -12821,9 +13349,8 @@ type SectionSignUnit = 'km/h' | 'mph';
|
|
|
12821
13349
|
* Where a section's signs are posted along the stretch they belong to.
|
|
12822
13350
|
*
|
|
12823
13351
|
* @remarks
|
|
12824
|
-
* - `atChange` - The default. One sign stands
|
|
12825
|
-
*
|
|
12826
|
-
* two consecutive ones carry the same value, so every section boundary is a change.
|
|
13352
|
+
* - `atChange` - The default. One sign stands at the start of each section and none along it. A
|
|
13353
|
+
* section mostly starts where the value changes, which is where the road posts its own.
|
|
12827
13354
|
* - `along` - The sign repeats down the stretch at a fixed screen spacing, so a reader zoomed into
|
|
12828
13355
|
* the middle of a long one still sees the value in force. A stretch too short on screen to fit a
|
|
12829
13356
|
* sign draws none.
|
|
@@ -12867,8 +13394,8 @@ type SectionSignPriority = 'belowMapLabels' | 'belowRouteIcons' | 'aboveRouteIco
|
|
|
12867
13394
|
* entry posts the white disc in km/h.
|
|
12868
13395
|
*
|
|
12869
13396
|
* Where mph is posted, the number is converted and rounded to the step signs come in. Without
|
|
12870
|
-
* `country` sections, the display units decide the face and the unit
|
|
12871
|
-
* overrides
|
|
13397
|
+
* `country` sections, the display units decide the face and the unit. An explicit {@link unit}
|
|
13398
|
+
* overrides the unit wherever it came from, and leaves the face alone.
|
|
12872
13399
|
*
|
|
12873
13400
|
* A sign stands where the limit changes, and {@link placement} repeats it down the stretch instead.
|
|
12874
13401
|
* Signs scale with the zoom, as the ferry and toll-road icons do, a tenth smaller than the tunnel
|
|
@@ -12929,7 +13456,8 @@ type SectionSignConfig = {
|
|
|
12929
13456
|
*
|
|
12930
13457
|
* @example
|
|
12931
13458
|
* ```typescript
|
|
12932
|
-
*
|
|
13459
|
+
* // `country` is among the default section types.
|
|
13460
|
+
* const routes = await calculateRoute({ locations });
|
|
12933
13461
|
* await routing.showRoutes(routes);
|
|
12934
13462
|
* ```
|
|
12935
13463
|
*
|
|
@@ -12981,7 +13509,8 @@ type CountryCrossingLabelConfig = {
|
|
|
12981
13509
|
* - `duration` - The travel time, traffic included.
|
|
12982
13510
|
* - `distance` - The route's length, in the display units.
|
|
12983
13511
|
* - `durationDifference` - How much longer or shorter the route takes than the selected one, such
|
|
12984
|
-
* as `+6 min`. Only the other routes show it,
|
|
13512
|
+
* as `+6 min`. Only the other routes show it, only while a route is selected, and only when the
|
|
13513
|
+
* difference rounds to a minute.
|
|
12985
13514
|
* - `trafficDelay` - The summary's `trafficDelayInSeconds`, the delay of the traffic events along
|
|
12986
13515
|
* the route, on a line of its own beside an icon coloured by the worst delay along the route.
|
|
12987
13516
|
* Only a route with a delay shows it.
|
|
@@ -13006,8 +13535,8 @@ type SummaryBubbleRoutes = 'all' | 'selected' | 'alternatives';
|
|
|
13006
13535
|
* @remarks
|
|
13007
13536
|
* The bubble is the text's background, so the text takes no halo. A `title` replaces the text
|
|
13008
13537
|
* {@link SummaryBubblesConfig.fields} builds. A function title is called for each route when the
|
|
13009
|
-
* routes are shown, when another is selected
|
|
13010
|
-
* an empty string for gets no bubble.
|
|
13538
|
+
* routes are shown, when another is selected, when the display units or the `title` itself change
|
|
13539
|
+
* and when the bubbles turn visible again. A route it returns an empty string for gets no bubble.
|
|
13011
13540
|
*
|
|
13012
13541
|
* @example
|
|
13013
13542
|
* ```typescript
|
|
@@ -13419,8 +13948,9 @@ type RoutingKnob = KnobEntry<RoutingKnobId, Exclude<KnobKind, 'offset' | 'colors
|
|
|
13419
13948
|
*
|
|
13420
13949
|
* @remarks
|
|
13421
13950
|
* Knobs are plain display values in {@link RoutingModuleConfig}, at the paths their ids name.
|
|
13422
|
-
* `layers`, `beforeLayerConfig`, the waypoint images, icon mapping
|
|
13423
|
-
* structured, function or MapLibre values, and `events`
|
|
13951
|
+
* `layers`, `beforeLayerConfig`, the waypoint images, icon mapping, label title and
|
|
13952
|
+
* `customTypeface`, which take structured, function or MapLibre values or font files, and `events`
|
|
13953
|
+
* aren't knobs. A `displayUnits` knob left
|
|
13424
13954
|
* unset follows the global config.
|
|
13425
13955
|
*
|
|
13426
13956
|
* @group Routing
|
|
@@ -13439,9 +13969,10 @@ export declare const routingKnobIds: readonly RoutingKnobId[];
|
|
|
13439
13969
|
* theme or knob has recoloured.
|
|
13440
13970
|
*
|
|
13441
13971
|
* @remarks
|
|
13442
|
-
* It covers
|
|
13443
|
-
*
|
|
13444
|
-
* to
|
|
13972
|
+
* It covers the route lines, waypoints, sections, guidance lines, summary bubbles, border crossings
|
|
13973
|
+
* and the section focus rings. A generated section type's icon layer is not among them: it exists only
|
|
13974
|
+
* once `sections.<type>.icon.image` is set. Read it to find a layer's name and what it paints by
|
|
13975
|
+
* default, not to spread into {@link RoutingModuleConfig.layers}, which says why.
|
|
13445
13976
|
*
|
|
13446
13977
|
* The module builds its own layers per map, so on a dark style, under a theme or with a map
|
|
13447
13978
|
* typeface, the colours and fonts it draws differ from these.
|
|
@@ -13473,7 +14004,11 @@ type DisplayInstructionArrowProps = {
|
|
|
13473
14004
|
/**
|
|
13474
14005
|
* @ignore
|
|
13475
14006
|
*/
|
|
13476
|
-
type
|
|
14007
|
+
type DisplayInstructionArrow = Feature<Point, Instruction & DisplayInstructionArrowProps & DisplayRouteRelatedProps>;
|
|
14008
|
+
/**
|
|
14009
|
+
* @ignore
|
|
14010
|
+
*/
|
|
14011
|
+
type DisplayInstructionArrows = FeatureCollection<Point, DisplayInstructionArrow['properties']>;
|
|
13477
14012
|
/**
|
|
13478
14013
|
* @ignore
|
|
13479
14014
|
*/
|
|
@@ -13481,7 +14016,7 @@ type DisplayInstruction = Feature<LineString, Instruction & DisplayRouteRelatedP
|
|
|
13481
14016
|
/**
|
|
13482
14017
|
* @ignore
|
|
13483
14018
|
*/
|
|
13484
|
-
type DisplayInstructions = FeatureCollection<LineString,
|
|
14019
|
+
type DisplayInstructions = FeatureCollection<LineString, DisplayInstruction['properties']>;
|
|
13485
14020
|
//#endregion
|
|
13486
14021
|
//#region src/routing/types/planningWaypoint.d.ts
|
|
13487
14022
|
/**
|
|
@@ -13501,6 +14036,9 @@ type DisplayInstructions = FeatureCollection<LineString, Instruction & DisplayRo
|
|
|
13501
14036
|
* - `WaypointLike`: Full waypoint with coordinates and optional properties
|
|
13502
14037
|
* - `null`: Placeholder for unset or removed waypoints
|
|
13503
14038
|
*
|
|
14039
|
+
* `showWaypoints` draws no pin for a placeholder, but it keeps its position, so the stops after it
|
|
14040
|
+
* keep their numbers.
|
|
14041
|
+
*
|
|
13504
14042
|
* @example
|
|
13505
14043
|
* ```typescript
|
|
13506
14044
|
* // Array of waypoints with some unset
|
|
@@ -13511,7 +14049,7 @@ type DisplayInstructions = FeatureCollection<LineString, Instruction & DisplayRo
|
|
|
13511
14049
|
* ];
|
|
13512
14050
|
*
|
|
13513
14051
|
* // Filter out null waypoints before routing
|
|
13514
|
-
* const validWaypoints = waypoints.filter(
|
|
14052
|
+
* const validWaypoints = waypoints.filter((waypoint) => waypoint !== null);
|
|
13515
14053
|
* ```
|
|
13516
14054
|
*
|
|
13517
14055
|
* @group Routing
|
|
@@ -13687,7 +14225,7 @@ type DisplayTrafficSectionProps = DisplaySectionProps & TrafficSectionProps & {
|
|
|
13687
14225
|
*
|
|
13688
14226
|
* @remarks
|
|
13689
14227
|
* `whiteDisc` is the white disc with a red ring used across most of Europe and in the United Kingdom,
|
|
13690
|
-
* `yellowDisc` the same shape as
|
|
14228
|
+
* `yellowDisc` the same shape as Sweden, Finland and Iceland post it, and `plaque` the upright rectangle reading
|
|
13691
14229
|
* `SPEED LIMIT` used in the United States.
|
|
13692
14230
|
* @ignore
|
|
13693
14231
|
*/
|
|
@@ -13717,15 +14255,11 @@ type DisplaySpeedLimitSectionProps = DisplaySectionProps & SpeedLimitSectionProp
|
|
|
13717
14255
|
/**
|
|
13718
14256
|
* @ignore
|
|
13719
14257
|
*/
|
|
13720
|
-
type RoutingSourcesWithLayers = { [K in SectionSourceKey<BandedSectionType
|
|
14258
|
+
type RoutingSourcesWithLayers = { [K in SectionSourceKey<BandedSectionType | Exclude<BespokeSectionType, 'traffic'>>]: GeoJSONSourceWithLayers<RouteSections>; } & {
|
|
13721
14259
|
speedLimitSections: GeoJSONSourceWithLayers<RouteSections<DisplaySpeedLimitSectionProps>>;
|
|
13722
14260
|
mainLines: GeoJSONSourceWithLayers<Routes<DisplayRouteProps>>;
|
|
13723
14261
|
waypoints: GeoJSONSourceWithLayers<Waypoints<WaypointDisplayProps>>;
|
|
13724
|
-
vehicleRestricted: GeoJSONSourceWithLayers<RouteSections>;
|
|
13725
14262
|
incidents: GeoJSONSourceWithLayers<RouteSections<DisplayTrafficSectionProps>>;
|
|
13726
|
-
ferries: GeoJSONSourceWithLayers<RouteSections>;
|
|
13727
|
-
tollRoads: GeoJSONSourceWithLayers<RouteSections>;
|
|
13728
|
-
tunnels: GeoJSONSourceWithLayers<RouteSections>;
|
|
13729
14263
|
instructionLines: GeoJSONSourceWithLayers<DisplayInstructions>;
|
|
13730
14264
|
instructionArrows: GeoJSONSourceWithLayers<DisplayInstructionArrows>;
|
|
13731
14265
|
summaryBubbles: GeoJSONSourceWithLayers<DisplayRouteSummaries>;
|
|
@@ -13770,7 +14304,8 @@ type ShowRoutesOptions = {
|
|
|
13770
14304
|
* @remarks
|
|
13771
14305
|
* It is zero-based, matching the position in the routes array. The selected route
|
|
13772
14306
|
* displays with full colour and prominence, and the other routes are dimmed to show
|
|
13773
|
-
* they are alternatives.
|
|
14307
|
+
* they are alternatives. An index outside the routes selects none, so every route draws
|
|
14308
|
+
* deselected.
|
|
13774
14309
|
*
|
|
13775
14310
|
* @default 0 (the first route is shown as selected)
|
|
13776
14311
|
*
|
|
@@ -13950,8 +14485,8 @@ export declare class RoutingModule extends AbstractDataOwnedMapModule<RoutingSou
|
|
|
13950
14485
|
*/
|
|
13951
14486
|
private addConfiguredImages;
|
|
13952
14487
|
/**
|
|
13953
|
-
* Draws the shown waypoints again when a
|
|
13954
|
-
* read in changed: the icon, stop mark and title each waypoint draws are on the feature.
|
|
14488
|
+
* Draws the shown waypoints again when a setting their features carry or the time unit their stop
|
|
14489
|
+
* durations read in changed: the icon, stop mark and title each waypoint draws are on the feature.
|
|
13955
14490
|
*/
|
|
13956
14491
|
private reshowWaypoints;
|
|
13957
14492
|
private displayWaypointsOf;
|
|
@@ -13975,27 +14510,26 @@ export declare class RoutingModule extends AbstractDataOwnedMapModule<RoutingSou
|
|
|
13975
14510
|
* units and what a `title` function returned for it. Every other setting is the layer's.
|
|
13976
14511
|
*/
|
|
13977
14512
|
private reshowSummaryBubbles;
|
|
13978
|
-
/** What {@link applySummaryBubbleColors} last painted the bubbles with; see {@link
|
|
14513
|
+
/** What {@link applySummaryBubbleColors} last painted the bubbles with; see {@link appliedCrossingFill}. */
|
|
13979
14514
|
private appliedSummaryBubbleColors;
|
|
13980
14515
|
/**
|
|
13981
14516
|
* Paints the summary bubbles' images in the colours their config and the map's theme resolve to.
|
|
13982
14517
|
*
|
|
13983
14518
|
* @remarks
|
|
13984
|
-
* The
|
|
13985
|
-
*
|
|
14519
|
+
* The two bubbles and the major and unknown delay icons are images, so a new colour replaces the
|
|
14520
|
+
* one it draws into, and only that one. The text colours are in the layer spec, which every config
|
|
14521
|
+
* change and restore rebuilds.
|
|
13986
14522
|
*/
|
|
13987
14523
|
private applySummaryBubbleColors;
|
|
13988
|
-
/** The colours the crossings draw with, which follow the map's theme unless configured. */
|
|
13989
|
-
private crossingColors;
|
|
13990
14524
|
/**
|
|
13991
|
-
*
|
|
14525
|
+
* The colour {@link applyCountryCrossingConfig} last painted the crossing bubble in.
|
|
13992
14526
|
*
|
|
13993
14527
|
* @remarks
|
|
13994
14528
|
* Tracked here rather than re-derived from `this.config`, because the theme is an input the
|
|
13995
14529
|
* config cannot see: a style or a map colour knob moves the resolved colours while the config
|
|
13996
14530
|
* says the same thing. Cleared when the sources are rebuilt, so a restored style repaints from scratch.
|
|
13997
14531
|
*/
|
|
13998
|
-
private
|
|
14532
|
+
private appliedCrossingFill;
|
|
13999
14533
|
/**
|
|
14000
14534
|
* Brings the border crossings in line with a changed configuration.
|
|
14001
14535
|
*
|
|
@@ -14003,9 +14537,8 @@ export declare class RoutingModule extends AbstractDataOwnedMapModule<RoutingSou
|
|
|
14003
14537
|
* The source is gated on `visible`, as the summary bubbles' is, so switching them back on
|
|
14004
14538
|
* re-derives the features: a layer spec cannot put back data the source does not hold.
|
|
14005
14539
|
*
|
|
14006
|
-
*
|
|
14007
|
-
*
|
|
14008
|
-
* that built the layer cannot know about after a style change.
|
|
14540
|
+
* The bubble is an image, so a new colour replaces it here; the label's colour is in the layer
|
|
14541
|
+
* spec, which every config change and restore rebuilds.
|
|
14009
14542
|
*/
|
|
14010
14543
|
private applyCountryCrossingConfig;
|
|
14011
14544
|
/**
|
|
@@ -14022,15 +14555,16 @@ export declare class RoutingModule extends AbstractDataOwnedMapModule<RoutingSou
|
|
|
14022
14555
|
* only while its `sections.<type>.visible` is on as well.
|
|
14023
14556
|
*
|
|
14024
14557
|
* @remarks
|
|
14025
|
-
* "Has features" alone is not enough for sections. Almost every route has urban
|
|
14026
|
-
*
|
|
14027
|
-
*
|
|
14558
|
+
* "Has features" alone is not enough for sections. Almost every route has urban or motorway
|
|
14559
|
+
* stretches somewhere along it, so it would draw every drawn type the route carries the moment it
|
|
14560
|
+
* is shown, whatever the caller asked for.
|
|
14028
14561
|
*
|
|
14029
14562
|
* This runs right after anything that shows features and after any config change, in the same
|
|
14030
14563
|
* tick, so nothing renders in between.
|
|
14031
14564
|
* @ignore
|
|
14032
14565
|
*/
|
|
14033
14566
|
protected applyVisibility(config: RoutingModuleConfig | undefined): void;
|
|
14567
|
+
private applySourcesVisibility;
|
|
14034
14568
|
/** The id of the layer posting this type's signs, for a type that posts them. */
|
|
14035
14569
|
private signLayerID;
|
|
14036
14570
|
/**
|
|
@@ -14393,7 +14927,7 @@ type HillshadeColors = {
|
|
|
14393
14927
|
shaded?: string;
|
|
14394
14928
|
/** The slopes facing the light. */
|
|
14395
14929
|
lit?: string;
|
|
14396
|
-
/** The steepest terrain, whichever way it faces. */
|
|
14930
|
+
/** The steepest terrain, whichever way it faces. Used by the `standard` method only. */
|
|
14397
14931
|
steep?: string;
|
|
14398
14932
|
};
|
|
14399
14933
|
/**
|
|
@@ -14448,12 +14982,13 @@ type TerrainElevationConfig = {
|
|
|
14448
14982
|
/**
|
|
14449
14983
|
* Whether the map surface is raised in 3D or flat.
|
|
14450
14984
|
*
|
|
14451
|
-
* @default Flat, unless MapLibre code raised a terrain of its own.
|
|
14985
|
+
* @default Flat, unless the style or your MapLibre code raised a terrain of its own.
|
|
14452
14986
|
*/
|
|
14453
14987
|
visible?: boolean;
|
|
14454
14988
|
/**
|
|
14455
|
-
* Vertical scaling of the surface. `1` is true elevation. Higher values emphasise
|
|
14456
|
-
* It stays while `visible` is off, so turning it back on restores it.
|
|
14989
|
+
* Vertical scaling of the surface this module raises. `1` is true elevation. Higher values emphasise
|
|
14990
|
+
* the relief. It stays while `visible` is off, so turning it back on restores it. With `visible`
|
|
14991
|
+
* unset, a terrain the style or your MapLibre code raised keeps its own.
|
|
14457
14992
|
*
|
|
14458
14993
|
* @default 1
|
|
14459
14994
|
*/
|
|
@@ -14596,6 +15131,7 @@ export declare class TerrainModule extends AbstractStyleOwnedMapModule<TerrainSo
|
|
|
14596
15131
|
protected _initSourcesWithLayers(): {
|
|
14597
15132
|
hillshade: StyleSourceWithLayers<import("maplibre-gl").SourceSpecification, import("maplibre-gl").Source>;
|
|
14598
15133
|
};
|
|
15134
|
+
private captureMapTerrain;
|
|
14599
15135
|
/**
|
|
14600
15136
|
* @ignore
|
|
14601
15137
|
*/
|
|
@@ -14702,7 +15238,7 @@ type AreaAnalyticsScaleMode = 'predefinedRange' | 'currentRange' | 'raw';
|
|
|
14702
15238
|
* @example
|
|
14703
15239
|
* ```typescript
|
|
14704
15240
|
* // Stops whose values are actual congestion-level values (0–100)
|
|
14705
|
-
* const
|
|
15241
|
+
* const rawStops: AreaAnalyticsColorStopsConfig = {
|
|
14706
15242
|
* scaleMode: 'raw',
|
|
14707
15243
|
* stops: [
|
|
14708
15244
|
* { value: 0, color: '#2dc653' },
|
|
@@ -14712,7 +15248,7 @@ type AreaAnalyticsScaleMode = 'predefinedRange' | 'currentRange' | 'raw';
|
|
|
14712
15248
|
* };
|
|
14713
15249
|
*
|
|
14714
15250
|
* // Stops as 0–100 % of the predefined metric range (speed: 0–120 km/h)
|
|
14715
|
-
* const
|
|
15251
|
+
* const predefinedRangeStops: AreaAnalyticsColorStopsConfig = {
|
|
14716
15252
|
* scaleMode: 'predefinedRange',
|
|
14717
15253
|
* stops: [
|
|
14718
15254
|
* { value: 0, color: '#e03030' }, // 0 km/h
|
|
@@ -14722,7 +15258,7 @@ type AreaAnalyticsScaleMode = 'predefinedRange' | 'currentRange' | 'raw';
|
|
|
14722
15258
|
* };
|
|
14723
15259
|
*
|
|
14724
15260
|
* // Stops as 0–100 % of the live data range (maximum contrast regardless of absolute values)
|
|
14725
|
-
* const
|
|
15261
|
+
* const currentRangeStops: AreaAnalyticsColorStopsConfig = {
|
|
14726
15262
|
* scaleMode: 'currentRange',
|
|
14727
15263
|
* stops: [
|
|
14728
15264
|
* { value: 0, color: '#2dc653' }, // 0% = loaded minimum
|
|
@@ -14785,7 +15321,8 @@ type AreaAnalyticsHeightConfig = {
|
|
|
14785
15321
|
scaleMode?: Exclude<AreaAnalyticsScaleMode, 'raw'>;
|
|
14786
15322
|
/**
|
|
14787
15323
|
* True visual maximum extrusion height in meters.
|
|
14788
|
-
* A cell at the top of the range reaches this height, and none rises above it
|
|
15324
|
+
* A cell at the top of the range reaches this height, and none rises above it unless
|
|
15325
|
+
* `minMeters` is higher, which every cell then rises to.
|
|
14789
15326
|
*
|
|
14790
15327
|
* @defaultValue 1000
|
|
14791
15328
|
*/
|
|
@@ -14859,10 +15396,10 @@ type AreaAnalyticsMetricConfig = {
|
|
|
14859
15396
|
* @example
|
|
14860
15397
|
* ```typescript
|
|
14861
15398
|
* // Every mode on top of the map
|
|
14862
|
-
* const
|
|
15399
|
+
* const onTop: TrafficAreaAnalyticsModuleConfig = { beforeLayerConfig: 'top' };
|
|
14863
15400
|
*
|
|
14864
15401
|
* // Flat modes below labels, extrusions below place labels
|
|
14865
|
-
* const
|
|
15402
|
+
* const split: TrafficAreaAnalyticsModuleConfig = {
|
|
14866
15403
|
* beforeLayerConfig: { all: 'lowestLabel', 'hexgrid-3d': 'lowestPlaceLabel', 'square-3d': 'lowestPlaceLabel' },
|
|
14867
15404
|
* };
|
|
14868
15405
|
* ```
|
|
@@ -14937,7 +15474,9 @@ type AreaAnalyticsRegionLineConfig = {
|
|
|
14937
15474
|
width?: number;
|
|
14938
15475
|
};
|
|
14939
15476
|
/**
|
|
14940
|
-
* Default values for
|
|
15477
|
+
* Default values for the {@link TrafficAreaAnalyticsModuleConfig} options with a fixed default.
|
|
15478
|
+
* The region colour follows the map's theme, each display mode has its own default place in the
|
|
15479
|
+
* layer stack, and a raw height's `metersPerUnit` defaults to 1.
|
|
14941
15480
|
*
|
|
14942
15481
|
* Use these as a reference for what the module applies when a property is omitted,
|
|
14943
15482
|
* or spread them as a base when constructing a config programmatically.
|
|
@@ -15250,6 +15789,7 @@ export type TrafficCommonFilter = {
|
|
|
15250
15789
|
* @remarks
|
|
15251
15790
|
* Provides finer-grained control for street and service roads.
|
|
15252
15791
|
* Applies to sub-categories of {@link StreetRoadSubCategory} and {@link ServiceRoadSubCategory}.
|
|
15792
|
+
* Roads with no sub-category, such as motorways, match none of the values, so `show: 'only'` drops them.
|
|
15253
15793
|
*
|
|
15254
15794
|
* @example
|
|
15255
15795
|
* ```ts
|
|
@@ -15267,7 +15807,8 @@ export type TrafficCommonFilter = {
|
|
|
15267
15807
|
*/
|
|
15268
15808
|
export type FiltersWithAlternatives<FILTER> = FILTER & {
|
|
15269
15809
|
/**
|
|
15270
|
-
* Further filters, each an alternative a feature may match instead of the one set beside them.
|
|
15810
|
+
* Further filters, each an alternative a feature may match instead of the one set beside them. An
|
|
15811
|
+
* alternative with no field set adds none, rather than matching every feature.
|
|
15271
15812
|
*/
|
|
15272
15813
|
any?: FILTER[];
|
|
15273
15814
|
};
|
|
@@ -15304,7 +15845,9 @@ export type TrafficFlowFilter = TrafficCommonFilter & {
|
|
|
15304
15845
|
* The filters deciding which roads show traffic flow, alternatives in `any` included.
|
|
15305
15846
|
*
|
|
15306
15847
|
* @remarks
|
|
15307
|
-
* A road shows when it matches the filter the fields set here, or one of `any`.
|
|
15848
|
+
* A road shows when it matches the filter the fields set here, or one of `any`. A filter with no field
|
|
15849
|
+
* set adds no alternative, so with no field set here only `any` decides, and with neither every road
|
|
15850
|
+
* shows. The knobs of
|
|
15308
15851
|
* {@link trafficFlowKnobCatalogue} set the fields here, while `any` is config only.
|
|
15309
15852
|
*
|
|
15310
15853
|
* @example
|
|
@@ -15436,7 +15979,7 @@ export type IncidentHighlightConfig = {
|
|
|
15436
15979
|
*/
|
|
15437
15980
|
export type IncidentLineConfig = {
|
|
15438
15981
|
/**
|
|
15439
|
-
* Opacity of the incident lines, from 0 to 1. The markers and the outline of a highlighted
|
|
15982
|
+
* Opacity of the incident lines, from 0 to 1, a value outside it clamped. The markers and the outline of a highlighted
|
|
15440
15983
|
* incident stay opaque, so a focused incident still stands out.
|
|
15441
15984
|
*
|
|
15442
15985
|
* @defaultValue `1`
|
|
@@ -15475,11 +16018,14 @@ export type TrafficIncidentDetailsLayersConfig = {
|
|
|
15475
16018
|
innerChevron?: Partial<ToBeAddedLayerSpecTemplate<LineLayerSpecification>>;
|
|
15476
16019
|
/** The patterned stripe of the `unknown` (no delay) and `indefinite` (road closed) incidents. */
|
|
15477
16020
|
innerPattern?: Partial<ToBeAddedLayerSpecTemplate<LineLayerSpecification>>;
|
|
15478
|
-
/**
|
|
16021
|
+
/**
|
|
16022
|
+
* The category icon of every incident whose delay is not `indefinite`, but jams, closed roads,
|
|
16023
|
+
* animals on the road and narrow lanes.
|
|
16024
|
+
*/
|
|
15479
16025
|
incidentMarker?: Partial<ToBeAddedLayerSpecTemplate<SymbolLayerSpecification>>;
|
|
15480
16026
|
/** The jam icon with its delay text. */
|
|
15481
16027
|
jamMarker?: Partial<ToBeAddedLayerSpecTemplate<SymbolLayerSpecification>>;
|
|
15482
|
-
/** The closed-road icon. */
|
|
16028
|
+
/** The closed-road icon, on every incident with an `indefinite` delay, whatever its category. */
|
|
15483
16029
|
closedRoadMarker?: Partial<ToBeAddedLayerSpecTemplate<SymbolLayerSpecification>>;
|
|
15484
16030
|
};
|
|
15485
16031
|
/**
|
|
@@ -15498,8 +16044,8 @@ export type TrafficIncidentDetailsModuleConfig = MapModuleCommonConfig & {
|
|
|
15498
16044
|
* The map-style layer to position incident layers before. Pass `'top'` to
|
|
15499
16045
|
* pin them above every other layer. Defaults to `'lowestLabel'`, which
|
|
15500
16046
|
* keeps incidents below map labels (roads, places, POIs) so labels stay
|
|
15501
|
-
* readable. The routing module and the flat area analytics
|
|
15502
|
-
* same default.
|
|
16047
|
+
* readable. The routing module's route lines and the flat area analytics
|
|
16048
|
+
* layers use the same default.
|
|
15503
16049
|
*/
|
|
15504
16050
|
beforeLayerConfig?: BeforeLayerConfig;
|
|
15505
16051
|
/**
|
|
@@ -15624,7 +16170,9 @@ export type TrafficIncidentsFilter = TrafficCommonFilter & {
|
|
|
15624
16170
|
* The filters deciding which incidents are shown, alternatives in `any` included.
|
|
15625
16171
|
*
|
|
15626
16172
|
* @remarks
|
|
15627
|
-
* An incident shows when it matches the filter the fields set here, or one of `any`.
|
|
16173
|
+
* An incident shows when it matches the filter the fields set here, or one of `any`. A filter with no
|
|
16174
|
+
* field set adds no alternative, so with no field set here only `any` decides, and with neither every
|
|
16175
|
+
* incident shows. The knobs of
|
|
15628
16176
|
* {@link trafficIncidentsKnobCatalogue} set the fields here, while `any` is config only.
|
|
15629
16177
|
*
|
|
15630
16178
|
* @example
|
|
@@ -15660,7 +16208,7 @@ export type IncidentIconsConfig = {
|
|
|
15660
16208
|
* The colours of the incident lines, per delay magnitude.
|
|
15661
16209
|
*
|
|
15662
16210
|
* @remarks
|
|
15663
|
-
* If unset, a magnitude keeps the loaded style's colour. The incident details
|
|
16211
|
+
* If unset, a magnitude keeps the loaded style's colour. The incident details lines, the route
|
|
15664
16212
|
* traffic sections and bloom's `only` scope read these, so a recoloured magnitude stays recoloured
|
|
15665
16213
|
* there too.
|
|
15666
16214
|
*
|
|
@@ -15673,7 +16221,7 @@ export type TrafficIncidentColors = {
|
|
|
15673
16221
|
moderate?: string;
|
|
15674
16222
|
/** Major delays. */
|
|
15675
16223
|
major?: string;
|
|
15676
|
-
/**
|
|
16224
|
+
/** The outline of indefinite delays, meaning closed roads. */
|
|
15677
16225
|
closed?: string;
|
|
15678
16226
|
};
|
|
15679
16227
|
/**
|
|
@@ -15758,7 +16306,8 @@ type TrafficFlowKnobId = 'visible' | ValuesFilterKnobId<`filters.${Exclude<keyof
|
|
|
15758
16306
|
type TrafficFlowKnobValueOf<ID extends TrafficFlowKnobId> = KnobPlainValue<ValueAt<TrafficFlowModuleConfig, ID>>;
|
|
15759
16307
|
/**
|
|
15760
16308
|
* One entry of {@link trafficFlowKnobCatalogue}. The value in force is the one at its path in
|
|
15761
|
-
* {@link TrafficFlowModule.getConfig}, otherwise its `default`.
|
|
16309
|
+
* {@link TrafficFlowModule.getConfig}, otherwise its `default`. With neither, a colour is the loaded
|
|
16310
|
+
* style's own, and any other entry says what it follows.
|
|
15762
16311
|
*
|
|
15763
16312
|
* @group Traffic Flow
|
|
15764
16313
|
*/
|
|
@@ -15806,11 +16355,16 @@ type TrafficIncidentDetailsKnobValueOf<ID extends TrafficIncidentDetailsKnobId>
|
|
|
15806
16355
|
/**
|
|
15807
16356
|
* One entry of {@link trafficIncidentDetailsKnobCatalogue}. The value in force is the one at its
|
|
15808
16357
|
* path in {@link TrafficIncidentDetailsModule.getConfig}, otherwise its `default`. With neither, the
|
|
15809
|
-
* map's light/dark theme decides.
|
|
16358
|
+
* map's light/dark theme decides. Under `highlight: false`, a `highlight.*` knob reads its
|
|
16359
|
+
* `default` though nothing draws it, and setting one turns the highlight back on.
|
|
15810
16360
|
*
|
|
15811
16361
|
* @group Traffic Incident Details
|
|
15812
16362
|
*/
|
|
15813
16363
|
type TrafficIncidentDetailsKnob = KnobEntry<TrafficIncidentDetailsKnobId, TrafficKnobKind>;
|
|
16364
|
+
/**
|
|
16365
|
+
* An area analytics knob's path below `metrics.<metric>.`, whichever metric takes it.
|
|
16366
|
+
* @ignore
|
|
16367
|
+
*/
|
|
15814
16368
|
type AreaAnalyticsMetricKnobLeaf = 'palette' | `height.${KeyOfEither<AreaAnalyticsHeightConfig>}` | `filters.${keyof AreaAnalyticsMetricFilter}`;
|
|
15815
16369
|
/**
|
|
15816
16370
|
* The id of an area analytics knob, its path into {@link TrafficAreaAnalyticsModuleConfig}, e.g.
|
|
@@ -15822,7 +16376,7 @@ type AreaAnalyticsMetricKnobLeaf = 'palette' | `height.${KeyOfEither<AreaAnalyti
|
|
|
15822
16376
|
*
|
|
15823
16377
|
* @group Traffic Area Analytics
|
|
15824
16378
|
*/
|
|
15825
|
-
type TrafficAreaAnalyticsKnobId = 'visible' | 'displayMode' | 'activeMetric' |
|
|
16379
|
+
type TrafficAreaAnalyticsKnobId = 'visible' | 'displayMode' | 'activeMetric' | `regionPolygon.${LeafPathOf<AreaAnalyticsRegionPolygonConfig>}` | `metrics.${AreaAnalyticsMetricKey}.${AreaAnalyticsMetricKnobLeaf}`;
|
|
15826
16380
|
/**
|
|
15827
16381
|
* The value type of an area analytics knob, the plain value its path holds in
|
|
15828
16382
|
* {@link TrafficAreaAnalyticsModuleConfig}.
|
|
@@ -15846,8 +16400,8 @@ type TrafficAreaAnalyticsKnob = KnobEntry<TrafficAreaAnalyticsKnobId, TrafficKno
|
|
|
15846
16400
|
*
|
|
15847
16401
|
* @remarks
|
|
15848
16402
|
* The module owns whether flow is shown, which roads show it and how the flow lines look
|
|
15849
|
-
* (`colors.*`, `widthFactor`). The `filters.*` knobs set the fields of `filters`. Its
|
|
15850
|
-
* further filters a road may match instead, is config only, as are `events`.
|
|
16403
|
+
* (`colors.*`, `widthFactor`, `opacityFactor`). The `filters.*` knobs set the fields of `filters`. Its
|
|
16404
|
+
* `any`, the further filters a road may match instead, is config only, as are `events`.
|
|
15851
16405
|
*
|
|
15852
16406
|
* @group Traffic Flow
|
|
15853
16407
|
*/
|
|
@@ -15864,8 +16418,8 @@ export declare const trafficFlowKnobIds: readonly TrafficFlowKnobId[];
|
|
|
15864
16418
|
*
|
|
15865
16419
|
* @remarks
|
|
15866
16420
|
* The module owns whether incidents are shown, which, and how their lines look (`colors.*`,
|
|
15867
|
-
* `widthFactor`). The `filters.*` knobs set the fields of `filters`. Its `any`, the
|
|
15868
|
-
* filters an incident may match instead, is config only, as are `events`.
|
|
16421
|
+
* `widthFactor`, `opacityFactor`). The `filters.*` knobs set the fields of `filters`. Its `any`, the
|
|
16422
|
+
* further filters an incident may match instead, is config only, as are `events`.
|
|
15869
16423
|
*
|
|
15870
16424
|
* @group Traffic Incidents
|
|
15871
16425
|
*/
|
|
@@ -15916,7 +16470,7 @@ export declare const trafficAreaAnalyticsKnobIds: readonly TrafficAreaAnalyticsK
|
|
|
15916
16470
|
//#region src/traffic/layers/areaAnalyticsLayers.d.ts
|
|
15917
16471
|
/**
|
|
15918
16472
|
* Returns a metric's cell colour stops. These are its `colorStops` if they hold a stop, otherwise its
|
|
15919
|
-
* `palette` (
|
|
16473
|
+
* `palette` (its {@link AREA_ANALYTICS_DEFAULTS} one when unset) spread evenly from 0 to 100 % of the metric's range, as
|
|
15920
16474
|
* {@link AreaAnalyticsMetricConfig.palette} describes.
|
|
15921
16475
|
*
|
|
15922
16476
|
* @group Traffic Area Analytics
|
|
@@ -15928,7 +16482,7 @@ export declare const resolveColorStops: (metric: AreaAnalyticsMetricKey, metricC
|
|
|
15928
16482
|
* Properties attached to each area analytics display feature.
|
|
15929
16483
|
*
|
|
15930
16484
|
* @remarks
|
|
15931
|
-
* They include
|
|
16485
|
+
* They include every metric, a metric the API response lacks reading 0, a stable `id` that
|
|
15932
16486
|
* MapLibre's `promoteId` uses for event state tracking, and `eventState` (from
|
|
15933
16487
|
* `SupportsEvents`), which drives hover/click styling.
|
|
15934
16488
|
*
|
|
@@ -15983,6 +16537,8 @@ type AreaAnalyticsSourcesWithLayers = {
|
|
|
15983
16537
|
* await module.show(analytics);
|
|
15984
16538
|
* ```
|
|
15985
16539
|
*
|
|
16540
|
+
* @see [Traffic Area Analytics Module Guide](https://docs.tomtom.com/maps-sdk-js/guides/map/traffic-area-analytics-module)
|
|
16541
|
+
*
|
|
15986
16542
|
* @group Traffic Area Analytics
|
|
15987
16543
|
*/
|
|
15988
16544
|
export declare class TrafficAreaAnalyticsModule extends AbstractDataOwnedMapModule<AreaAnalyticsSourcesWithLayers, TrafficAreaAnalyticsModuleConfig> {
|
|
@@ -16005,7 +16561,8 @@ export declare class TrafficAreaAnalyticsModule extends AbstractDataOwnedMapModu
|
|
|
16005
16561
|
* All configuration properties are optional. Built-in defaults fill every field that `config`
|
|
16006
16562
|
* omits, or all of them if you omit `config`. After `create()` resolves,
|
|
16007
16563
|
* {@link TrafficAreaAnalyticsModule.getConfig} returns the display mode, the active metric and
|
|
16008
|
-
* every metric's
|
|
16564
|
+
* every metric's `palette` and `height` with defaults filled in, so you don't need to reference
|
|
16565
|
+
* them. A `height` you pass replaces the default one whole, its unset fields left out. A field
|
|
16009
16566
|
* you clear by passing `undefined` to its setter is left out until the next `applyConfig`,
|
|
16010
16567
|
* `updateConfig` or knob write, which fills its default in again.
|
|
16011
16568
|
*
|
|
@@ -16267,11 +16824,11 @@ type TrafficFlowSourcesWithLayers = {
|
|
|
16267
16824
|
* - Real-time traffic data from vector tiles
|
|
16268
16825
|
* - Filter road closures
|
|
16269
16826
|
*
|
|
16270
|
-
* The colours:
|
|
16827
|
+
* The standard styles' colours, which `colors.*` can change:
|
|
16271
16828
|
* - Green: Free-flowing traffic
|
|
16272
16829
|
* - Yellow/Orange: Slow traffic
|
|
16273
16830
|
* - Red: Heavy congestion
|
|
16274
|
-
* -
|
|
16831
|
+
* - Red outline: Road closures
|
|
16275
16832
|
*
|
|
16276
16833
|
* @example
|
|
16277
16834
|
* Basic usage:
|
|
@@ -16320,6 +16877,7 @@ type TrafficFlowSourcesWithLayers = {
|
|
|
16320
16877
|
* @group Traffic Flow
|
|
16321
16878
|
*/
|
|
16322
16879
|
export declare class TrafficFlowModule extends AbstractStyleOwnedMapModule<TrafficFlowSourcesWithLayers, TrafficFlowModuleConfig> {
|
|
16880
|
+
private appliedFilters;
|
|
16323
16881
|
/**
|
|
16324
16882
|
* Retrieves a TrafficFlowModule instance for the given map.
|
|
16325
16883
|
*
|
|
@@ -16337,7 +16895,9 @@ export declare class TrafficFlowModule extends AbstractStyleOwnedMapModule<Traff
|
|
|
16337
16895
|
*
|
|
16338
16896
|
* {@link trafficFlowKnobCatalogue} lists the plain-valued settings as data.
|
|
16339
16897
|
*
|
|
16340
|
-
* If the style lacks traffic flow, `get()` reloads it with the `trafficFlow` part included.
|
|
16898
|
+
* If the style lacks traffic flow, `get()` reloads it with the `trafficFlow` part included. A later
|
|
16899
|
+
* `get()` on the same map returns the same instance, and a config passed to it replaces the one it
|
|
16900
|
+
* holds, as `applyConfig` does.
|
|
16341
16901
|
*
|
|
16342
16902
|
* @example
|
|
16343
16903
|
* Default initialization:
|
|
@@ -16360,12 +16920,6 @@ export declare class TrafficFlowModule extends AbstractStyleOwnedMapModule<Traff
|
|
|
16360
16920
|
* }
|
|
16361
16921
|
* });
|
|
16362
16922
|
* ```
|
|
16363
|
-
*
|
|
16364
|
-
* @remarks
|
|
16365
|
-
* `TrafficFlowModule` controls the traffic-flow source and layers the map style already
|
|
16366
|
-
* provides, under fixed global IDs. Every instance is another handle on that shared state, so
|
|
16367
|
-
* visibility and filters you apply through one show through all of them. A config passed to a
|
|
16368
|
-
* later `get()` replaces the one it holds, as `applyConfig` does.
|
|
16369
16923
|
*/
|
|
16370
16924
|
static get(map: TomTomMap, config?: TrafficFlowModuleConfig): Promise<TrafficFlowModule>;
|
|
16371
16925
|
private constructor();
|
|
@@ -16410,25 +16964,24 @@ export declare class TrafficFlowModule extends AbstractStyleOwnedMapModule<Traff
|
|
|
16410
16964
|
* @remarks
|
|
16411
16965
|
* This is the only way to read live flow values, because Orbis traffic flow is vector tiles, with
|
|
16412
16966
|
* no service for a road, a point or an area. Results cover what is drawn in the current viewport and zoom, so a
|
|
16413
|
-
* hidden module returns none
|
|
16967
|
+
* hidden module returns none. A segment appears once per layer drawing it, its outline included, and once per
|
|
16968
|
+
* tile it crosses, so the results do not count segments. See {@link TrafficFlowModuleFeature} for what each carries.
|
|
16414
16969
|
*
|
|
16415
16970
|
* @example
|
|
16416
16971
|
* ```typescript
|
|
16417
16972
|
* const rendered = trafficFlow.getRenderedFeatures();
|
|
16418
|
-
* console.log(`Visible flow segments: ${rendered.trafficFlow.length}`);
|
|
16419
16973
|
* rendered.trafficFlow.forEach(segment => {
|
|
16420
16974
|
* console.log('Road segment:', segment.properties);
|
|
16421
16975
|
* });
|
|
16422
16976
|
* ```
|
|
16423
16977
|
*
|
|
16424
16978
|
* @example
|
|
16425
|
-
*
|
|
16979
|
+
* Check the viewport for congestion:
|
|
16426
16980
|
* ```typescript
|
|
16427
16981
|
* const rendered = trafficFlow.getRenderedFeatures();
|
|
16428
|
-
* const congested = rendered.trafficFlow.
|
|
16982
|
+
* const congested = rendered.trafficFlow.some(
|
|
16429
16983
|
* segment => segment.properties.relativeSpeed < 0.5
|
|
16430
16984
|
* );
|
|
16431
|
-
* console.log(`Congested segments: ${congested.length}`);
|
|
16432
16985
|
* ```
|
|
16433
16986
|
*/
|
|
16434
16987
|
getRenderedFeatures(): {
|
|
@@ -16534,15 +17087,14 @@ type Sources = {
|
|
|
16534
17087
|
* @group Traffic Incident Details
|
|
16535
17088
|
*/
|
|
16536
17089
|
export declare class TrafficIncidentDetailsModule extends AbstractDataOwnedMapModule<Sources, TrafficIncidentDetailsModuleConfig> {
|
|
16537
|
-
private lastFeatureIds;
|
|
16538
17090
|
private lastFocusIds;
|
|
16539
17091
|
private readonly shownFeaturesHandlers;
|
|
16540
17092
|
/**
|
|
16541
17093
|
* Creates a new module instance on the given map, once the map is ready.
|
|
16542
17094
|
*
|
|
16543
|
-
* `TrafficIncidentDetailsModule` owns the sources
|
|
16544
|
-
*
|
|
16545
|
-
* one map.
|
|
17095
|
+
* `TrafficIncidentDetailsModule` owns the sources and layers it adds, all suffixed per instance,
|
|
17096
|
+
* and shares only its direction chevron image. So every call returns a new, independent instance,
|
|
17097
|
+
* and you can stack several on one map.
|
|
16546
17098
|
*
|
|
16547
17099
|
* {@link trafficIncidentDetailsKnobCatalogue} lists the plain-valued settings of `config` as data.
|
|
16548
17100
|
*
|
|
@@ -16573,12 +17125,8 @@ export declare class TrafficIncidentDetailsModule extends AbstractDataOwnedMapMo
|
|
|
16573
17125
|
*/
|
|
16574
17126
|
clear(): Promise<void>;
|
|
16575
17127
|
/**
|
|
16576
|
-
* Returns the currently shown incidents, which are the exact data passed to {@link show}
|
|
16577
|
-
*
|
|
16578
|
-
* It reads the module's client-side cache (`shownFeatures`), like the other GeoJSON modules
|
|
16579
|
-
* (`PlacesModule`, `TrafficAreaAnalyticsModule`, `GeometriesModule`). It does not hit-test the
|
|
16580
|
-
* viewport. The proxy already scopes and de-duplicates the `allEventFeatures` it dispatches to
|
|
16581
|
-
* click handlers, so no caller needs viewport-level de-duplication here.
|
|
17128
|
+
* Returns the currently shown incidents, which are the exact data passed to {@link show}, not
|
|
17129
|
+
* what the viewport hit-tests.
|
|
16582
17130
|
*/
|
|
16583
17131
|
getShown(): {
|
|
16584
17132
|
incidents: TrafficIncidentDetails;
|
|
@@ -16752,6 +17300,7 @@ type TrafficIncidentsSourcesWithLayers = {
|
|
|
16752
17300
|
* @group Traffic Incidents
|
|
16753
17301
|
*/
|
|
16754
17302
|
export declare class TrafficIncidentsModule extends AbstractStyleOwnedMapModule<TrafficIncidentsSourcesWithLayers, TrafficIncidentsModuleConfig> {
|
|
17303
|
+
private appliedFilters;
|
|
16755
17304
|
/**
|
|
16756
17305
|
* Retrieves a TrafficIncidentsModule instance for the given map.
|
|
16757
17306
|
*
|
|
@@ -16772,6 +17321,8 @@ export declare class TrafficIncidentsModule extends AbstractStyleOwnedMapModule<
|
|
|
16772
17321
|
* {@link trafficIncidentsKnobCatalogue} lists the plain-valued settings as data.
|
|
16773
17322
|
*
|
|
16774
17323
|
* When the style lacks traffic incidents, `get()` reloads it with the `trafficIncidents` part included.
|
|
17324
|
+
* A later `get()` on the same map returns the same instance, and a config passed to it replaces the
|
|
17325
|
+
* one it holds, as `applyConfig` does.
|
|
16775
17326
|
*
|
|
16776
17327
|
* @example
|
|
16777
17328
|
* Default initialization:
|
|
@@ -16795,12 +17346,6 @@ export declare class TrafficIncidentsModule extends AbstractStyleOwnedMapModule<
|
|
|
16795
17346
|
* }
|
|
16796
17347
|
* });
|
|
16797
17348
|
* ```
|
|
16798
|
-
*
|
|
16799
|
-
* @remarks
|
|
16800
|
-
* `TrafficIncidentsModule` controls the traffic-incident source and layers the map style already
|
|
16801
|
-
* provides, under fixed global IDs. Every instance is another handle on that shared state, so
|
|
16802
|
-
* visibility and filters you apply through one show through all of them. A config passed to a
|
|
16803
|
-
* later `get()` replaces the one it holds, as `applyConfig` does.
|
|
16804
17349
|
*/
|
|
16805
17350
|
static get(map: TomTomMap, config?: TrafficIncidentsModuleConfig): Promise<TrafficIncidentsModule>;
|
|
16806
17351
|
private constructor();
|
|
@@ -16892,26 +17437,25 @@ export declare class TrafficIncidentsModule extends AbstractStyleOwnedMapModule<
|
|
|
16892
17437
|
*
|
|
16893
17438
|
* @remarks
|
|
16894
17439
|
* It returns all incident features currently rendered in the visible map area,
|
|
16895
|
-
* including both incident areas/lines and icon markers.
|
|
16896
|
-
*
|
|
17440
|
+
* including both incident areas/lines and icon markers. An incident appears once per layer
|
|
17441
|
+
* drawing it, its outline, line and icon each, and once per tile it crosses, so the results do
|
|
17442
|
+
* not count incidents. See {@link TrafficIncidentsModuleFeature} for what each carries.
|
|
16897
17443
|
*
|
|
16898
17444
|
* @example
|
|
16899
17445
|
* ```typescript
|
|
16900
17446
|
* const rendered = incidents.getRenderedFeatures();
|
|
16901
|
-
* console.log(`Visible incidents: ${rendered.trafficIncidents.length}`);
|
|
16902
17447
|
* rendered.trafficIncidents.forEach(incident => {
|
|
16903
17448
|
* console.log('Incident:', incident.properties);
|
|
16904
17449
|
* });
|
|
16905
17450
|
* ```
|
|
16906
17451
|
*
|
|
16907
17452
|
* @example
|
|
16908
|
-
*
|
|
17453
|
+
* Check the viewport for accidents:
|
|
16909
17454
|
* ```typescript
|
|
16910
17455
|
* const rendered = incidents.getRenderedFeatures();
|
|
16911
|
-
* const
|
|
17456
|
+
* const accidentInView = rendered.trafficIncidents.some(
|
|
16912
17457
|
* incident => incident.properties.category === 'accident'
|
|
16913
17458
|
* );
|
|
16914
|
-
* console.log(`Accidents in view: ${accidents.length}`);
|
|
16915
17459
|
* ```
|
|
16916
17460
|
*/
|
|
16917
17461
|
getRenderedFeatures(): {
|
|
@@ -16970,8 +17514,8 @@ export declare const hueDistance: ({ h: hue }: HslColor, { h: otherHue }: HslCol
|
|
|
16970
17514
|
* - `mercatorMeters` - EPSG:3857 (Web Mercator) metres, which stretch ground metres by 1/cos(latitude):
|
|
16971
17515
|
* the frame of geometry authored in that coordinate system, such as 3D tiles.
|
|
16972
17516
|
*
|
|
16973
|
-
* Its metres are EPSG:3857's, on the WGS84 equator's radius, which makes them 0.11%
|
|
16974
|
-
* metres of MapLibre's `MercatorCoordinate
|
|
17517
|
+
* Its metres are EPSG:3857's, on the WGS84 equator's radius, which makes them 0.11% shorter than the
|
|
17518
|
+
* metres of MapLibre's `MercatorCoordinate`, on its mean Earth radius.
|
|
16975
17519
|
*
|
|
16976
17520
|
* @group Utils
|
|
16977
17521
|
*/
|
|
@@ -17106,8 +17650,10 @@ export declare const calculatePaddedCenter: (options: CalculateMapCenterOptions)
|
|
|
17106
17650
|
* portion of the map (the area UI components don't cover). The function returns a larger bounding
|
|
17107
17651
|
* box that accounts for the space the UI elements take.
|
|
17108
17652
|
*
|
|
17109
|
-
*
|
|
17110
|
-
*
|
|
17653
|
+
* It expands the latitudes in Web Mercator, as `fitBounds` frames them, and they stay within its ±85.051129.
|
|
17654
|
+
* The returned longitudes can pass ±180, as `fitBounds` takes them: east always does for a
|
|
17655
|
+
* `toBeContainedBBox` across the antimeridian, with west greater than east, and either one does when
|
|
17656
|
+
* the expansion reaches past it.
|
|
17111
17657
|
*
|
|
17112
17658
|
* @returns The expanded bounding box as [west, south, east, north], or null if the visible area is too small
|
|
17113
17659
|
*
|
|
@@ -17115,4 +17661,4 @@ export declare const calculatePaddedCenter: (options: CalculateMapCenterOptions)
|
|
|
17115
17661
|
*/
|
|
17116
17662
|
export declare const calculateFittingBBox: (options: CalculateFittingBBoxOptions) => BBox | null;
|
|
17117
17663
|
//#endregion
|
|
17118
|
-
export type { AreaAnalyticsBeforeLayerConfig, AreaAnalyticsColorStop, AreaAnalyticsColorStopsConfig, AreaAnalyticsDisplayMode, AreaAnalyticsHeightConfig, AreaAnalyticsMetricConfig, AreaAnalyticsMetricFilter, AreaAnalyticsPalette, AreaAnalyticsRegionFillConfig, AreaAnalyticsRegionLineConfig, AreaAnalyticsRegionPolygonConfig, AreaAnalyticsScaleMode, AttributionOptions, BaseMapColorName, BaseMapKnob, BaseMapKnobId, BaseMapKnobValueOf, BeforeLayerConfig, BespokeSectionType,
|
|
17664
|
+
export type { AreaAnalyticsBeforeLayerConfig, AreaAnalyticsColorStop, AreaAnalyticsColorStopsConfig, AreaAnalyticsDisplayMode, AreaAnalyticsHeightConfig, AreaAnalyticsMetricConfig, AreaAnalyticsMetricFilter, AreaAnalyticsPalette, AreaAnalyticsRegionFillConfig, AreaAnalyticsRegionLineConfig, AreaAnalyticsRegionPolygonConfig, AreaAnalyticsScaleMode, AttributionOptions, AttributionPadding, AttributionPosition, BaseMapColorName, BaseMapKnob, BaseMapKnobId, BaseMapKnobValueOf, BeforeLayerConfig, BespokeSectionType, CountryCrossingConfig, CountryCrossingFeature, CountryCrossingLabelConfig, CustomGeoJSONKnob, CustomGeoJSONKnobId, CustomGeoJSONKnobValueOf, CustomImage, CustomLayerEventsOptions, CustomLayerHit, CustomLayerHitTest, CustomLayerOptions, CustomTypeface, CustomTypefaceFile, DefaultPlaceIconConfig, DisplayCountryCrossing, DisplayCountryCrossingProps, DisplayCountryCrossings, DisplayRouteProps, DisplayRouteRelatedProps, DisplayRouteSummaries, DisplayRouteSummary, DisplayRouteSummaryProps, DisplayWaypoint, DrawnSectionType, EventScope, ExtraFeatureProp, FeatureLabelConfig, FeaturePropValue, FilterablePOICategory, GeneratedSectionType, GeoJSONSourceClusterOptions, GeoJSONSourcesWithLayers, GeometriesKnob, GeometriesKnobId, GeometriesKnobValueOf, HasAdditionalLayersConfig, HasBeforeID, HillshadeColors, HillshadeLightAlignment, HillshadeLightConfig, HillshadeMethod, HslColor, IconMapping, IndexedFeature, LabelConfig, LayerPropertyDerivation, LayerPropertyValues, LayerQuery, LayerSpecFilter, LayerSpecTemplate, LayerSpecWithSource, LightDark, MapColorName, MapColors, MapEventsConfig, MapFont, MapLibreOptions, MapLight, MapModuleCommonConfig, MapPreset, MapPresetId, MapPresetSettings, MapRequestTransform, MapStyleLayerID, MapStylePOICategory, MapTypeface, POIIconConfig, POILabelConfig, POIsKnob, POIsKnobId, POIsKnobValueOf, POIsModuleConfig, POIsModuleFeature, POIsModuleSerializableConfig, PartsBeforeLayerConfig, PinIconConfig, PlaceClusterBadgeConfig, PlaceConnectionDisplay, PlaceConnectionLabelConfig, PlaceConnectionLayerName, PlaceConnectionsConfig, PlaceConnectionsLayersConfig, PlaceEntryPointFeature, PlaceEntryPointProps, PlaceEntryPointsConfig, PlaceEntryPointsLayersConfig, PlaceEntryPointsShowFor, PlaceIconConfig, PlaceLabelConfig, PlaceLayerName, PlaceLayersConfig, PlacesBeforeLayerConfig, PlacesClusterConfig, PlacesClusterSourceConfig, PlacesKnob, PlacesKnobId, PlacesKnobValueOf, PlacesMarkerType, PlacesModuleConfig, PlacesModuleSerializableConfig, PlanningWaypoint, RGBAColor, ReachableRangesKnob, ReachableRangesKnobId, ReachableRangesKnobValueOf, RenderedRef, ResolvedEventScope, RouteHighlightConfig, RouteLayersConfig, RouteStateProps, RouteWaypointSize, RouteWidth, RoutingBeforeLayerConfig, RoutingKnob, RoutingKnobId, RoutingKnobValueOf, RoutingModuleConfig, RoutingModuleSerializableConfig, SVGIconStyleOptions, SectionDisplayConfig, SectionDrawStyle, SectionIconConfig, SectionIconPlacement, SectionKerbConfig, SectionKerbLayerName, SectionKnobName, SectionKnobOf, SectionLineLayerName, SectionSignConfig, SectionSignLayerName, SectionSignPlacement, SectionSignPriority, SectionSignUnit, SectionSourceKey, SectionSymbolLayerName, SectionTypeWithKnob, SectionsDisplayConfig, SerializableCustomImage, SerializableFeatureLabelConfig, SerializablePinIconConfig, ShowOptions, SourceWithLayerIDs, SourceWithLayers, SourcesWithLayers, StandardStyle, StandardStyleID, StyleColorKnobId, StyleInput, StyleKnobId, StyleKnobValueOf, StyleLayerGroupName, StyleModuleLayerGroupName, StylePart, StyleSourcesWithLayers, StylingFoundationsKnob, StylingFoundationsKnobAppliesTo, StylingFoundationsKnobId, StylingFoundationsKnobKind, StylingFoundationsKnobRange, StylingFoundationsKnobValue, StylingFoundationsKnobValueOf, StylingFoundationsModuleConfig, SummaryBubbleField, SummaryBubbleLabelConfig, SummaryBubbleRoutes, SummaryBubblesConfig, TerrainElevationConfig, TerrainHillshadeConfig, TerrainKnob, TerrainKnobId, TerrainKnobValueOf, TerrainModuleConfig, ToBeAddedLayerSpec, ToBeAddedLayerSpecTemplate, ToBeAddedLayerSpecWithoutSource, TomTomMapParams, TrafficAreaAnalyticsKnob, TrafficAreaAnalyticsKnobId, TrafficAreaAnalyticsKnobValueOf, TrafficAreaAnalyticsLayersConfig, TrafficAreaAnalyticsModuleConfig, TrafficFlowKnob, TrafficFlowKnobId, TrafficFlowKnobValueOf, TrafficIncidentDetailsKnob, TrafficIncidentDetailsKnobId, TrafficIncidentDetailsKnobValueOf, TrafficIncidentsKnob, TrafficIncidentsKnobId, TrafficIncidentsKnobValueOf, WaypointDisplayProps, WaypointHighlightConfig, WaypointIconConfig, WaypointIndexType, WaypointLabelConfig, WaypointStopNumbering, WaypointsConfig };
|