@tomtom-org/maps-sdk 0.53.0 → 0.55.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -0
- package/core/dist/core.es.js +1 -1
- package/core/dist/core.es.js.map +1 -1
- package/core/dist/index.d.ts +150 -8
- package/map/dist/index.d.ts +1381 -119
- package/map/dist/map.es.js +1 -1
- package/map/dist/map.es.js.map +1 -1
- package/map/package.json +1 -0
- package/package.json +29 -25
- package/services/dist/index.d.ts +252 -206
- package/services/dist/services.es.js +1 -1
- package/services/dist/services.es.js.map +1 -1
package/map/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
import { BackgroundLayerSpecification, CircleLayerSpecification, DataDrivenPropertyValueSpecification, ExpressionSpecification, GeoJSONSource, GeoJSONSourceSpecification, LayerSpecification, LineLayerSpecification, LngLat, Map, MapGeoJSONFeature, MapOptions, Source, SourceSpecification, StyleImageInterface, StyleImageMetadata, StyleSpecification, SymbolLayerSpecification } from "maplibre-gl";
|
|
2
|
-
import { Anything, AreaAnalyticsMetricKey, AreaAnalyticsMetrics, BBox, ChargingSpeed, ChargingStop, CommonPlaceProps, DelayMagnitude, DisplayUnits, GetPositionEntryPointOption, GlobalConfig, Instruction, Language, POICategory, Place, Places, PolygonFeature, PolygonFeatures, Route, RouteProps, Routes, SectionProps, TrafficAreaAnalytics, TrafficIncident, TrafficIncidentBaseProperties, TrafficIncidentCategory, TrafficIncidentDetails, TrafficIncidentTimeValidity, TrafficSectionProps, Waypoint, WaypointLike, Waypoints } from "@tomtom-org/maps-sdk/core";
|
|
1
|
+
import { BackgroundLayerSpecification, CircleLayerSpecification, DataDrivenPropertyValueSpecification, ExpressionFilterSpecification, ExpressionSpecification, GeoJSONSource, GeoJSONSourceSpecification, LayerSpecification, LineLayerSpecification, LngLat, Map, MapGeoJSONFeature, MapOptions, Source, SourceSpecification, StyleImageInterface, StyleImageMetadata, StyleSpecification, SymbolLayerSpecification } from "maplibre-gl";
|
|
2
|
+
import { Anything, AreaAnalyticsMetricKey, AreaAnalyticsMetrics, BBox, ChargingSpeed, ChargingStop, ChargingStopProps, CommonPlaceProps, DelayMagnitude, DisplayUnits, GetPositionEntryPointOption, GlobalConfig, Instruction, Language, POICategory, Place, Places, PolygonFeature, PolygonFeatures, Route, RouteProps, Routes, SectionProps, SectionType, 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
|
+
* Indicator of a light or dark theme.
|
|
6
|
+
* * Can be used to classify a map style as light or dark, or to apply light or dark configurations to map modules if they support it.
|
|
7
|
+
*
|
|
8
|
+
* @group Map Style
|
|
9
|
+
*/
|
|
10
|
+
type LightDark = 'light' | 'dark';
|
|
11
|
+
//#endregion
|
|
3
12
|
//#region src/init/types/mapEventsConfig.d.ts
|
|
4
13
|
/**
|
|
5
14
|
* Configuration options for map user event handling.
|
|
@@ -192,15 +201,6 @@ type MapEventsConfig = EventHandlerCursorConfig & {
|
|
|
192
201
|
longHoverDelayOnStillMapMS?: number;
|
|
193
202
|
};
|
|
194
203
|
//#endregion
|
|
195
|
-
//#region src/shared/types/style.d.ts
|
|
196
|
-
/**
|
|
197
|
-
* Indicator of a light or dark theme.
|
|
198
|
-
* * Can be used to classify a map style as light or dark, or to apply light or dark configurations to map modules if they support it.
|
|
199
|
-
*
|
|
200
|
-
* @group Map Style
|
|
201
|
-
*/
|
|
202
|
-
type LightDark = 'light' | 'dark';
|
|
203
|
-
//#endregion
|
|
204
204
|
//#region src/init/types/mapInit.d.ts
|
|
205
205
|
/**
|
|
206
206
|
* Array of all available standard style identifiers.
|
|
@@ -601,6 +601,20 @@ export type TomTomMapParams = Partial<GlobalConfig> & {
|
|
|
601
601
|
*/
|
|
602
602
|
export type InternalTomTomMapParams = GlobalConfig & TomTomMapParams;
|
|
603
603
|
//#endregion
|
|
604
|
+
//#region src/init/styleInputBuilder.d.ts
|
|
605
|
+
/**
|
|
606
|
+
* The version of the TomTom Orbis map styles the SDK loads when {@link StandardStyle.version} is not
|
|
607
|
+
* given. Everything in the SDK that relies on the structure of a standard style — the base-map
|
|
608
|
+
* layer groups, the styling knobs — is curated and verified against this version, so a bump here is
|
|
609
|
+
* a bump of those tables too.
|
|
610
|
+
*
|
|
611
|
+
* Exported so the tooling that curates against it — the style-fixture refresh script — reads the
|
|
612
|
+
* same value, rather than restating it.
|
|
613
|
+
*
|
|
614
|
+
* @ignore
|
|
615
|
+
*/
|
|
616
|
+
export declare const DEFAULT_STYLE_VERSION = "0.6.0-0";
|
|
617
|
+
//#endregion
|
|
604
618
|
//#region src/TomTomMap.d.ts
|
|
605
619
|
/**
|
|
606
620
|
* Handler interface for responding to map style changes.
|
|
@@ -668,6 +682,15 @@ export type StyleChangeHandler = {
|
|
|
668
682
|
* @returns void or a Promise that resolves when reinitialization is complete
|
|
669
683
|
*/
|
|
670
684
|
onStyleChanged?: (context: StyleChangeContext) => void | Promise<void>;
|
|
685
|
+
/**
|
|
686
|
+
* Where this handler runs relative to the others: lower values run first, equal values run in
|
|
687
|
+
* registration order. Defaults to `0`, which is also what the SDK's data and visibility modules
|
|
688
|
+
* use; the SDK's {@link StylingModule} runs at `100` so semantic styling always lands on top of
|
|
689
|
+
* whatever the modules restored.
|
|
690
|
+
*
|
|
691
|
+
* @default 0
|
|
692
|
+
*/
|
|
693
|
+
priority?: number;
|
|
671
694
|
};
|
|
672
695
|
/**
|
|
673
696
|
* What a {@link StyleChangeHandler} is told about the style switch it is reacting to.
|
|
@@ -2605,6 +2628,46 @@ type CustomImage<I extends string = string> = {
|
|
|
2605
2628
|
* ```
|
|
2606
2629
|
*/
|
|
2607
2630
|
availabilityLevel?: AvailabilityLevel;
|
|
2631
|
+
/**
|
|
2632
|
+
* Horizontal offset of the icon from its anchor point, in pixels.
|
|
2633
|
+
*
|
|
2634
|
+
* @remarks
|
|
2635
|
+
* Positive values shift the icon right, negative values shift it left.
|
|
2636
|
+
* The offset is applied before `icon-size` scaling, matching the
|
|
2637
|
+
* MapLibre `icon-offset` convention.
|
|
2638
|
+
*
|
|
2639
|
+
* Only takes effect when `image` is also provided — an icon referencing an
|
|
2640
|
+
* existing sprite icon by `id` alone ignores `offsetX`/`offsetY`.
|
|
2641
|
+
*
|
|
2642
|
+
* @default 0
|
|
2643
|
+
*
|
|
2644
|
+
* @example
|
|
2645
|
+
* ```typescript
|
|
2646
|
+
* // Shift the icon 10px to the right of its coordinate
|
|
2647
|
+
* offsetX: 10
|
|
2648
|
+
* ```
|
|
2649
|
+
*/
|
|
2650
|
+
offsetX?: number;
|
|
2651
|
+
/**
|
|
2652
|
+
* Vertical offset of the icon from its anchor point, in pixels.
|
|
2653
|
+
*
|
|
2654
|
+
* @remarks
|
|
2655
|
+
* Positive values shift the icon down, negative values shift it up.
|
|
2656
|
+
* The offset is applied before `icon-size` scaling, matching the
|
|
2657
|
+
* MapLibre `icon-offset` convention.
|
|
2658
|
+
*
|
|
2659
|
+
* Only takes effect when `image` is also provided — an icon referencing an
|
|
2660
|
+
* existing sprite icon by `id` alone ignores `offsetX`/`offsetY`.
|
|
2661
|
+
*
|
|
2662
|
+
* @default 0
|
|
2663
|
+
*
|
|
2664
|
+
* @example
|
|
2665
|
+
* ```typescript
|
|
2666
|
+
* // Shift the icon 10px above its coordinate
|
|
2667
|
+
* offsetY: -10
|
|
2668
|
+
* ```
|
|
2669
|
+
*/
|
|
2670
|
+
offsetY?: number;
|
|
2608
2671
|
};
|
|
2609
2672
|
/**
|
|
2610
2673
|
* Options to style SDK SVG icons with custom colors and opacity.
|
|
@@ -3572,6 +3635,61 @@ export declare class CombinedEvents<T, CFG, TShown = never, WHERE_SCOPE = never>
|
|
|
3572
3635
|
off(type: EventType | 'config-change' | 'shown-features'): void;
|
|
3573
3636
|
}
|
|
3574
3637
|
//#endregion
|
|
3638
|
+
//#region src/shared/layers/layerFilterComposer.d.ts
|
|
3639
|
+
/**
|
|
3640
|
+
* A rewrite of the filter a style gave one of its layers: the whole filter in, the whole filter out.
|
|
3641
|
+
* @ignore
|
|
3642
|
+
*/
|
|
3643
|
+
export type LayerFilterTransform = (filter: unknown) => unknown;
|
|
3644
|
+
/**
|
|
3645
|
+
* The single owner of a style layer's `filter`.
|
|
3646
|
+
*
|
|
3647
|
+
* Several modules narrow the same layer: {@link POIsModule.filterCategories} adds a category clause
|
|
3648
|
+
* to the POI layer, and the styling knob `pois.zoomShift` rewrites the density term inside that same
|
|
3649
|
+
* layer's filter. Each rebuilding the filter from its own snapshot of the style means whichever
|
|
3650
|
+
* writes last drops the other's work, with nothing to show that it happened.
|
|
3651
|
+
*
|
|
3652
|
+
* So no module writes a style layer's filter itself. Each registers what it wants under a key of its
|
|
3653
|
+
* own, and the composer writes the one filter that carries all of it: the filter the style shipped,
|
|
3654
|
+
* run through every **transform**, then narrowed by every **clause**.
|
|
3655
|
+
*
|
|
3656
|
+
* The snapshot and the contributions belong to the style they were taken from, so both are dropped
|
|
3657
|
+
* when a new style arrives; every module re-registers what it still wants as it restores itself.
|
|
3658
|
+
*
|
|
3659
|
+
* @ignore
|
|
3660
|
+
*/
|
|
3661
|
+
export declare class LayerFilterComposer {
|
|
3662
|
+
private readonly mapLibreMap;
|
|
3663
|
+
private readonly byLayer;
|
|
3664
|
+
private constructor();
|
|
3665
|
+
/**
|
|
3666
|
+
* The composer of this map, created on first use. One per map: it is the shared state the
|
|
3667
|
+
* contributors write through.
|
|
3668
|
+
*/
|
|
3669
|
+
static for(tomtomMap: TomTomMap): LayerFilterComposer;
|
|
3670
|
+
/**
|
|
3671
|
+
* Registers a rewrite of the filter the style gave this layer, replacing the one this
|
|
3672
|
+
* contributor registered before. Pass `undefined` to withdraw it and leave the filter to
|
|
3673
|
+
* the other contributors.
|
|
3674
|
+
*
|
|
3675
|
+
* @param layerId - The style layer whose filter is rewritten.
|
|
3676
|
+
* @param contributor - A key unique to the contributor, e.g. `'styling.zoomShift'`.
|
|
3677
|
+
* @param transform - Receives the style's own filter, returns the filter to use instead.
|
|
3678
|
+
*/
|
|
3679
|
+
setTransform(layerId: string, contributor: string, transform: LayerFilterTransform | undefined): void;
|
|
3680
|
+
/**
|
|
3681
|
+
* Registers a clause that narrows this layer further, `and`-ed with the style's own filter and
|
|
3682
|
+
* with every other contributor's clause. Pass `undefined` to withdraw it.
|
|
3683
|
+
*
|
|
3684
|
+
* @param layerId - The style layer to narrow.
|
|
3685
|
+
* @param contributor - A key unique to the contributor, e.g. `'pois.categories'`.
|
|
3686
|
+
* @param clause - The clause to add, in expression syntax.
|
|
3687
|
+
*/
|
|
3688
|
+
setClause(layerId: string, contributor: string, clause: ExpressionFilterSpecification | undefined): void;
|
|
3689
|
+
private contribute;
|
|
3690
|
+
private apply;
|
|
3691
|
+
}
|
|
3692
|
+
//#endregion
|
|
3575
3693
|
//#region src/shared/AbstractMapModule.d.ts
|
|
3576
3694
|
/**
|
|
3577
3695
|
* How a module builds user events over some of its sources.
|
|
@@ -3667,6 +3785,17 @@ export declare abstract class AbstractMapModule<SOURCES_WITH_LAYERS extends Sour
|
|
|
3667
3785
|
* @ignore
|
|
3668
3786
|
*/
|
|
3669
3787
|
protected readonly instanceIndex: number;
|
|
3788
|
+
/**
|
|
3789
|
+
* The map's single owner of a **style** layer's `filter`. Several modules narrow the same style
|
|
3790
|
+
* layer, so none of them calls `setFilter` on one directly: the composer is what keeps one from
|
|
3791
|
+
* dropping another's work, and what holds the filter the style itself shipped. A module may
|
|
3792
|
+
* still set the filter of a layer it added and owns alone.
|
|
3793
|
+
*
|
|
3794
|
+
* Assigned in this constructor, which already runs `_initSourcesWithLayers` and `applyConfig`,
|
|
3795
|
+
* so a subclass field would be assigned too late for either to use it.
|
|
3796
|
+
* @ignore
|
|
3797
|
+
*/
|
|
3798
|
+
protected readonly filterComposer: LayerFilterComposer;
|
|
3670
3799
|
/**
|
|
3671
3800
|
* Per-concrete-class instance counter. WeakMap-keyed so unloaded classes can be GC'd.
|
|
3672
3801
|
* @ignore
|
|
@@ -3685,6 +3814,14 @@ export declare abstract class AbstractMapModule<SOURCES_WITH_LAYERS extends Sour
|
|
|
3685
3814
|
* @param config Optional configuration to initialize directly as soon as the map is ready.
|
|
3686
3815
|
*/
|
|
3687
3816
|
protected constructor(tomtomMap: TomTomMap, config?: CFG);
|
|
3817
|
+
/**
|
|
3818
|
+
* Where this module restores itself in the style-change sequence (see
|
|
3819
|
+
* {@link StyleChangeHandler.priority}). Data and visibility modules keep the default; a module
|
|
3820
|
+
* whose work must land on top of theirs returns a higher value.
|
|
3821
|
+
* @protected
|
|
3822
|
+
* @ignore
|
|
3823
|
+
*/
|
|
3824
|
+
protected styleChangePriority(): number;
|
|
3688
3825
|
/**
|
|
3689
3826
|
* Initializes the sources with layers of this module.
|
|
3690
3827
|
* @param config The optional configuration for the module.
|
|
@@ -3956,6 +4093,106 @@ export declare abstract class AbstractDataOwnedMapModule<SOURCES_WITH_LAYERS ext
|
|
|
3956
4093
|
*/
|
|
3957
4094
|
export declare abstract class AbstractStyleOwnedMapModule<SOURCES_WITH_LAYERS extends StyleSourcesWithLayers, CFG extends MapModuleCommonConfig | undefined = undefined> extends AbstractMapModule<SOURCES_WITH_LAYERS, CFG> {}
|
|
3958
4095
|
//#endregion
|
|
4096
|
+
//#region src/shared/knobs.d.ts
|
|
4097
|
+
/**
|
|
4098
|
+
* The kind of value a display knob takes.
|
|
4099
|
+
*
|
|
4100
|
+
* @remarks
|
|
4101
|
+
* One vocabulary for every knob catalogue in the SDK — map styling and any module that describes
|
|
4102
|
+
* its display as knobs draw from the same set, so an agent that learned one catalogue can read the
|
|
4103
|
+
* other.
|
|
4104
|
+
*
|
|
4105
|
+
* - `toggle`: `true`/`false`, e.g. whether an overlay is drawn.
|
|
4106
|
+
* - `factor`: a multiplier over what the style already does (`1` = unchanged).
|
|
4107
|
+
* - `number`: an absolute number with a range.
|
|
4108
|
+
* - `color`: a CSS colour string.
|
|
4109
|
+
* - `enum`: one of the knob's `options`.
|
|
4110
|
+
* @group Shared
|
|
4111
|
+
*/
|
|
4112
|
+
export type KnobKind = 'toggle' | 'factor' | 'number' | 'color' | 'enum';
|
|
4113
|
+
/**
|
|
4114
|
+
* Inclusive bounds for a `factor` or `number` knob. `step` is what a slider would use; some ranges
|
|
4115
|
+
* (e.g. opacity 0–1) have no natural step and omit it.
|
|
4116
|
+
*
|
|
4117
|
+
* @group Shared
|
|
4118
|
+
*/
|
|
4119
|
+
export type KnobRange = {
|
|
4120
|
+
min: number;
|
|
4121
|
+
max: number;
|
|
4122
|
+
step?: number;
|
|
4123
|
+
};
|
|
4124
|
+
/**
|
|
4125
|
+
* A single, machine-readable description of one display knob.
|
|
4126
|
+
*
|
|
4127
|
+
* @remarks
|
|
4128
|
+
* The point of describing knobs as data is that a caller — increasingly a coding agent rather than
|
|
4129
|
+
* a person reading docs — can ask what a module actually exposes instead of guessing layer ids from
|
|
4130
|
+
* training data. Three things follow from having it:
|
|
4131
|
+
*
|
|
4132
|
+
* - **ground before generating** — write against what the module exposes, not what you remember;
|
|
4133
|
+
* - **validate** — ranges and allowed values arrive as data, so a bad value is caught before it
|
|
4134
|
+
* is rendered;
|
|
4135
|
+
* - **report and diff** — the paired settings object is plain and serializable, so a display change
|
|
4136
|
+
* is reviewable in a pull request.
|
|
4137
|
+
*
|
|
4138
|
+
* A visual editor cannot do any of those: it cannot be read, diffed, or put in a pull request.
|
|
4139
|
+
*
|
|
4140
|
+
* Modules narrow this shape with their own descriptor type — e.g. `StylingKnobDescriptor` requires
|
|
4141
|
+
* `available` and `appliesTo`, while a module whose knobs are always applicable omits them.
|
|
4142
|
+
*
|
|
4143
|
+
* @group Shared
|
|
4144
|
+
*/
|
|
4145
|
+
export type KnobDescriptor<T = unknown> = {
|
|
4146
|
+
/**
|
|
4147
|
+
* Stable, dotted identifier, e.g. `labels.sizeFactor`. Treat these as public API: they are what
|
|
4148
|
+
* a caller stores, diffs and passes back.
|
|
4149
|
+
*/
|
|
4150
|
+
id: string;
|
|
4151
|
+
/** What kind of value the knob takes. */
|
|
4152
|
+
kind: KnobKind;
|
|
4153
|
+
/** One-line description of what turning this knob does. */
|
|
4154
|
+
description: string;
|
|
4155
|
+
/** The value in force when nothing has been configured. */
|
|
4156
|
+
default: T;
|
|
4157
|
+
/** The value in force now. */
|
|
4158
|
+
current: T;
|
|
4159
|
+
/** Whether {@link KnobDescriptor.current} came from configuration rather than the default. */
|
|
4160
|
+
overridden: boolean;
|
|
4161
|
+
/** Inclusive bounds, for `factor` and `number` knobs. */
|
|
4162
|
+
range?: KnobRange;
|
|
4163
|
+
/** The allowed values, for `enum` knobs. */
|
|
4164
|
+
options?: readonly string[];
|
|
4165
|
+
/**
|
|
4166
|
+
* Whether the knob has anything to work on in the loaded style. Omitted by modules whose knobs
|
|
4167
|
+
* are always applicable; set to `false` by modules where a knob can be present in the catalogue
|
|
4168
|
+
* but do nothing on the current style.
|
|
4169
|
+
*/
|
|
4170
|
+
available?: boolean;
|
|
4171
|
+
/**
|
|
4172
|
+
* Which styles or contexts the knob works in. A string rather than a fixed union so each
|
|
4173
|
+
* module can choose its own vocabulary — styling uses `'any-style' | 'tomtom-styles'`.
|
|
4174
|
+
*/
|
|
4175
|
+
appliesTo?: string;
|
|
4176
|
+
};
|
|
4177
|
+
/**
|
|
4178
|
+
* Builds one knob descriptor, working out `overridden` from whether a configured value was given.
|
|
4179
|
+
* Pass `available` / `appliesTo` / `range` / `options` through `extra` when the module uses them.
|
|
4180
|
+
* @ignore
|
|
4181
|
+
*/
|
|
4182
|
+
export declare const knob: <T, ID extends string, KIND extends KnobKind, Extra extends object = Record<string, never>>(id: ID, kind: KIND, description: string, defaultValue: T, configured: T | undefined, extra?: Extra) => KnobDescriptor<T> & {
|
|
4183
|
+
id: ID;
|
|
4184
|
+
kind: KIND;
|
|
4185
|
+
} & Extra;
|
|
4186
|
+
/**
|
|
4187
|
+
* Reduces a knob catalogue to a plain, serializable object of the values in force.
|
|
4188
|
+
*
|
|
4189
|
+
* @remarks
|
|
4190
|
+
* Only knobs whose value was configured are included, so the result is a diff against the defaults
|
|
4191
|
+
* rather than a dump of everything — which is what makes it reviewable.
|
|
4192
|
+
* @ignore
|
|
4193
|
+
*/
|
|
4194
|
+
export declare const knobSettings: (knobs: KnobDescriptor[]) => Record<string, unknown>;
|
|
4195
|
+
//#endregion
|
|
3959
4196
|
//#region src/shared/layers/commonLayerProps.d.ts
|
|
3960
4197
|
/**
|
|
3961
4198
|
* Bold font face used in the TomTom map style.
|
|
@@ -6493,7 +6730,7 @@ export type MapStylePOICategory = keyof typeof mapDisplayPoiCategoryMappings;
|
|
|
6493
6730
|
/**
|
|
6494
6731
|
* @ignore
|
|
6495
6732
|
*/
|
|
6496
|
-
export declare const toBaseMapPOICategory: (category: POICategory) => string;
|
|
6733
|
+
export declare const toBaseMapPOICategory: (category: POICategory) => string | undefined;
|
|
6497
6734
|
/**
|
|
6498
6735
|
* The deduplicated set of base-map POI categories — the right-hand side of
|
|
6499
6736
|
* {@link completeMapDisplayPoiCategoryMappings}. Each value names the
|
|
@@ -8272,7 +8509,6 @@ type PoIsSourcesAndLayers = {
|
|
|
8272
8509
|
*/
|
|
8273
8510
|
export declare class POIsModule extends AbstractStyleOwnedMapModule<PoIsSourcesAndLayers, POIsModuleConfig> {
|
|
8274
8511
|
private categoriesFilter?;
|
|
8275
|
-
private originalFilter?;
|
|
8276
8512
|
/**
|
|
8277
8513
|
* Retrieves a POIsModule instance for the given map.
|
|
8278
8514
|
*
|
|
@@ -8464,7 +8700,282 @@ export declare class POIsModule extends AbstractStyleOwnedMapModule<PoIsSourcesA
|
|
|
8464
8700
|
get events(): CombinedEvents<POIsModuleFeature, POIsModuleConfig, never>;
|
|
8465
8701
|
}
|
|
8466
8702
|
//#endregion
|
|
8703
|
+
//#region src/routing/layers/sectionRegistry.d.ts
|
|
8704
|
+
type UndrawnSectionType = 'country' | 'lanes' | 'leg' | 'roadShields' | 'toll';
|
|
8705
|
+
/**
|
|
8706
|
+
* A section type the module draws, and therefore one the caller can configure.
|
|
8707
|
+
*
|
|
8708
|
+
* @remarks
|
|
8709
|
+
* Every section type the API can return, less the ones nothing draws. Derived from the core
|
|
8710
|
+
* {@link SectionType} vocabulary, and {@link SECTION_REGISTRY} is keyed by it, so a section type
|
|
8711
|
+
* added to core has to be registered there or named undrawn above before this package compiles.
|
|
8712
|
+
*
|
|
8713
|
+
* @group Routing
|
|
8714
|
+
*/
|
|
8715
|
+
type DrawnSectionType = Exclude<SectionType, UndrawnSectionType>;
|
|
8716
|
+
/**
|
|
8717
|
+
* The section types whose layers are generated from {@link SECTION_REGISTRY}.
|
|
8718
|
+
*
|
|
8719
|
+
* @remarks
|
|
8720
|
+
* Plain line overlays over the route, one registration each. The remaining drawn types
|
|
8721
|
+
* ({@link bespokeSectionTypes}) carry type-specific icons or data-driven colours, so they keep
|
|
8722
|
+
* hand-written layers — but they take the same {@link SectionDisplayConfig} knobs.
|
|
8723
|
+
*
|
|
8724
|
+
* @group Routing
|
|
8725
|
+
*/
|
|
8726
|
+
export declare const generatedSectionTypes: readonly ["carpool", "carTrain", "importantRoadStretch", "lowEmissionZone", "motorway", "pedestrian", "speedLimit", "tollVignette", "unpaved", "urban"];
|
|
8727
|
+
/**
|
|
8728
|
+
* The drawn section types whose layers are hand-written rather than generated.
|
|
8729
|
+
*
|
|
8730
|
+
* @group Routing
|
|
8731
|
+
*/
|
|
8732
|
+
export declare const bespokeSectionTypes: readonly ["ferry", "tollRoad", "traffic", "tunnel", "vehicleRestricted"];
|
|
8733
|
+
/**
|
|
8734
|
+
* A section type whose layers are generated from the registry.
|
|
8735
|
+
* @group Routing
|
|
8736
|
+
*/
|
|
8737
|
+
type GeneratedSectionType = (typeof generatedSectionTypes)[number];
|
|
8738
|
+
/**
|
|
8739
|
+
* A drawn section type with hand-written layers.
|
|
8740
|
+
* @group Routing
|
|
8741
|
+
*/
|
|
8742
|
+
type BespokeSectionType = (typeof bespokeSectionTypes)[number];
|
|
8743
|
+
/**
|
|
8744
|
+
* Every drawn section type, generated ones first.
|
|
8745
|
+
* @group Routing
|
|
8746
|
+
*/
|
|
8747
|
+
export declare const drawnSectionTypes: readonly ["carpool", "carTrain", "importantRoadStretch", "lowEmissionZone", "motorway", "pedestrian", "speedLimit", "tollVignette", "unpaved", "urban", "ferry", "tollRoad", "traffic", "tunnel", "vehicleRestricted"];
|
|
8748
|
+
/**
|
|
8749
|
+
* How a section's line relates to the route line it marks — both where it sits in the layer order
|
|
8750
|
+
* and how wide it is drawn, since neither reads as intended without the other.
|
|
8751
|
+
*
|
|
8752
|
+
* @remarks
|
|
8753
|
+
* - `halo`: beneath the route's own lines and wider than its outline, so the section shows as a
|
|
8754
|
+
* band hugging the route on both sides. The route keeps its own colour.
|
|
8755
|
+
* - `inline`: above the route line at the route's own width, so the route itself appears in the
|
|
8756
|
+
* section's colour along that stretch. This is how `tunnel` and `ferry` draw.
|
|
8757
|
+
*
|
|
8758
|
+
* Every section defaults to whichever of the two it has always been drawn as.
|
|
8759
|
+
*
|
|
8760
|
+
* @group Routing
|
|
8761
|
+
*/
|
|
8762
|
+
type SectionDrawStyle = 'halo' | 'inline';
|
|
8763
|
+
/**
|
|
8764
|
+
* The line pattern of a section.
|
|
8765
|
+
* @group Routing
|
|
8766
|
+
*/
|
|
8767
|
+
type SectionLinePattern = 'solid' | 'dashed' | 'dotted';
|
|
8768
|
+
/**
|
|
8769
|
+
* One of the uniform knobs {@link SectionDisplayConfig} offers.
|
|
8770
|
+
* @group Routing
|
|
8771
|
+
*/
|
|
8772
|
+
type SectionKnobName = 'visible' | 'color' | 'opacity' | 'width' | 'style' | 'pattern' | 'icon' | 'sign';
|
|
8773
|
+
/**
|
|
8774
|
+
* The key one section type's source, events scope and `getShown()` entry are filed under.
|
|
8775
|
+
*
|
|
8776
|
+
* @remarks
|
|
8777
|
+
* `routing.events[sectionSourceKey('lowEmissionZone')]` and
|
|
8778
|
+
* `routing.getShown()[sectionSourceKey('tunnel')]` both reach the section named by the type.
|
|
8779
|
+
*
|
|
8780
|
+
* @group Routing
|
|
8781
|
+
*/
|
|
8782
|
+
type SectionSourceKey<T extends DrawnSectionType = DrawnSectionType> = (typeof SECTION_REGISTRY)[T]['sourceKey'];
|
|
8783
|
+
/**
|
|
8784
|
+
* What every drawn section type is, and which knobs it answers to.
|
|
8785
|
+
*
|
|
8786
|
+
* @remarks
|
|
8787
|
+
* The single table the section tier is built from: the layer specs, the per-type sources, the
|
|
8788
|
+
* visibility rules and the knob catalogue all read it, so none of them can drift from the others.
|
|
8789
|
+
* @ignore
|
|
8790
|
+
*/
|
|
8791
|
+
declare const SECTION_REGISTRY: {
|
|
8792
|
+
readonly carpool: {
|
|
8793
|
+
readonly sourceKey: "carpoolSections";
|
|
8794
|
+
readonly visible: false;
|
|
8795
|
+
readonly style: "halo";
|
|
8796
|
+
readonly pattern: "solid";
|
|
8797
|
+
readonly knobs: readonly ["visible", "color", "opacity", "width", "style", "pattern", "icon"];
|
|
8798
|
+
};
|
|
8799
|
+
readonly carTrain: {
|
|
8800
|
+
readonly sourceKey: "carTrainSections";
|
|
8801
|
+
readonly visible: true;
|
|
8802
|
+
readonly style: "halo";
|
|
8803
|
+
readonly pattern: "dashed";
|
|
8804
|
+
readonly knobs: readonly ["visible", "color", "opacity", "width", "style", "pattern", "icon"];
|
|
8805
|
+
};
|
|
8806
|
+
readonly importantRoadStretch: {
|
|
8807
|
+
readonly sourceKey: "importantRoadStretchSections";
|
|
8808
|
+
readonly visible: false;
|
|
8809
|
+
readonly style: "halo";
|
|
8810
|
+
readonly pattern: "solid";
|
|
8811
|
+
readonly knobs: readonly ["visible", "color", "opacity", "width", "style", "pattern", "icon"];
|
|
8812
|
+
};
|
|
8813
|
+
readonly lowEmissionZone: {
|
|
8814
|
+
readonly sourceKey: "lowEmissionZoneSections";
|
|
8815
|
+
readonly visible: true;
|
|
8816
|
+
readonly style: "halo";
|
|
8817
|
+
readonly pattern: "solid";
|
|
8818
|
+
readonly knobs: readonly ["visible", "color", "opacity", "width", "style", "pattern", "icon"];
|
|
8819
|
+
};
|
|
8820
|
+
readonly motorway: {
|
|
8821
|
+
readonly sourceKey: "motorwaySections";
|
|
8822
|
+
readonly visible: false;
|
|
8823
|
+
readonly style: "halo";
|
|
8824
|
+
readonly pattern: "solid";
|
|
8825
|
+
readonly knobs: readonly ["visible", "color", "opacity", "width", "style", "pattern", "icon"];
|
|
8826
|
+
};
|
|
8827
|
+
readonly pedestrian: {
|
|
8828
|
+
readonly sourceKey: "pedestrianSections";
|
|
8829
|
+
readonly visible: false;
|
|
8830
|
+
readonly style: "halo";
|
|
8831
|
+
readonly pattern: "dashed";
|
|
8832
|
+
readonly knobs: readonly ["visible", "color", "opacity", "width", "style", "pattern", "icon"];
|
|
8833
|
+
};
|
|
8834
|
+
readonly speedLimit: {
|
|
8835
|
+
readonly sourceKey: "speedLimitSections";
|
|
8836
|
+
readonly visible: true;
|
|
8837
|
+
readonly knobs: readonly ["visible", "sign"];
|
|
8838
|
+
};
|
|
8839
|
+
readonly tollVignette: {
|
|
8840
|
+
readonly sourceKey: "tollVignetteSections";
|
|
8841
|
+
readonly visible: true;
|
|
8842
|
+
readonly style: "halo";
|
|
8843
|
+
readonly pattern: "dashed";
|
|
8844
|
+
readonly knobs: readonly ["visible", "color", "opacity", "width", "style", "pattern", "icon"];
|
|
8845
|
+
};
|
|
8846
|
+
readonly unpaved: {
|
|
8847
|
+
readonly sourceKey: "unpavedSections";
|
|
8848
|
+
readonly visible: false;
|
|
8849
|
+
readonly style: "halo";
|
|
8850
|
+
readonly pattern: "dashed";
|
|
8851
|
+
readonly knobs: readonly ["visible", "color", "opacity", "width", "style", "pattern", "icon"];
|
|
8852
|
+
};
|
|
8853
|
+
readonly urban: {
|
|
8854
|
+
readonly sourceKey: "urbanSections";
|
|
8855
|
+
readonly visible: false;
|
|
8856
|
+
readonly style: "halo";
|
|
8857
|
+
readonly pattern: "solid";
|
|
8858
|
+
readonly knobs: readonly ["visible", "color", "opacity", "width", "style", "pattern", "icon"];
|
|
8859
|
+
};
|
|
8860
|
+
readonly ferry: {
|
|
8861
|
+
readonly sourceKey: "ferries";
|
|
8862
|
+
readonly visible: true;
|
|
8863
|
+
readonly style: "inline";
|
|
8864
|
+
readonly pattern: "solid";
|
|
8865
|
+
readonly knobs: readonly ["visible", "color", "opacity", "width", "style", "pattern", "icon"];
|
|
8866
|
+
};
|
|
8867
|
+
readonly tollRoad: {
|
|
8868
|
+
readonly sourceKey: "tollRoads";
|
|
8869
|
+
readonly visible: true;
|
|
8870
|
+
readonly style: "halo";
|
|
8871
|
+
readonly pattern: "solid";
|
|
8872
|
+
readonly knobs: readonly ["visible", "color", "opacity", "width", "style", "pattern", "icon"];
|
|
8873
|
+
};
|
|
8874
|
+
readonly traffic: {
|
|
8875
|
+
readonly sourceKey: "incidents";
|
|
8876
|
+
readonly visible: true;
|
|
8877
|
+
readonly style: "inline";
|
|
8878
|
+
readonly pattern: "solid";
|
|
8879
|
+
readonly knobs: readonly ["visible", "opacity", "width", "style"];
|
|
8880
|
+
};
|
|
8881
|
+
readonly tunnel: {
|
|
8882
|
+
readonly sourceKey: "tunnels";
|
|
8883
|
+
readonly visible: true;
|
|
8884
|
+
readonly style: "inline";
|
|
8885
|
+
readonly pattern: "solid";
|
|
8886
|
+
readonly knobs: readonly ["visible", "color", "opacity", "width", "style", "pattern", "icon"];
|
|
8887
|
+
};
|
|
8888
|
+
readonly vehicleRestricted: {
|
|
8889
|
+
readonly sourceKey: "vehicleRestricted";
|
|
8890
|
+
readonly visible: true;
|
|
8891
|
+
readonly style: "inline";
|
|
8892
|
+
readonly pattern: "dotted";
|
|
8893
|
+
readonly knobs: readonly ["visible", "color", "opacity", "width", "style", "pattern", "icon"];
|
|
8894
|
+
};
|
|
8895
|
+
};
|
|
8896
|
+
/**
|
|
8897
|
+
* The knobs one section type answers to.
|
|
8898
|
+
*
|
|
8899
|
+
* @remarks
|
|
8900
|
+
* Read off {@link SECTION_REGISTRY}, so `sections.traffic.color` is a compile error rather than a
|
|
8901
|
+
* setting that draws nothing: `traffic` colours its line by `magnitudeOfDelay`.
|
|
8902
|
+
*
|
|
8903
|
+
* @group Routing
|
|
8904
|
+
*/
|
|
8905
|
+
type SectionKnobOf<T extends DrawnSectionType = DrawnSectionType> = (typeof SECTION_REGISTRY)[T]['knobs'][number];
|
|
8906
|
+
/**
|
|
8907
|
+
* Whether the given type answers to the given knob.
|
|
8908
|
+
*
|
|
8909
|
+
* @remarks
|
|
8910
|
+
* What a panel of section controls asks to decide which controls to render — the type system says
|
|
8911
|
+
* the same thing through {@link SectionKnobOf}, but only a value can be looped over.
|
|
8912
|
+
*
|
|
8913
|
+
* @example
|
|
8914
|
+
* ```typescript
|
|
8915
|
+
* for (const knobName of ['color', 'opacity', 'pattern'] as const) {
|
|
8916
|
+
* if (sectionSupportsKnob(type, knobName)) renderControl(type, knobName);
|
|
8917
|
+
* }
|
|
8918
|
+
* ```
|
|
8919
|
+
*
|
|
8920
|
+
* @group Routing
|
|
8921
|
+
*/
|
|
8922
|
+
export declare const sectionSupportsKnob: (type: DrawnSectionType, knobName: SectionKnobName) => boolean;
|
|
8923
|
+
/**
|
|
8924
|
+
* Whether the given type draws itself when `sections` says nothing about it.
|
|
8925
|
+
*
|
|
8926
|
+
* @remarks
|
|
8927
|
+
* The answer a panel of section controls needs to show which switches start on. Asking the map
|
|
8928
|
+
* instead cannot answer it: a type draws no layer for a route carrying none of its sections, so an
|
|
8929
|
+
* absent layer reads the same as a type switched off.
|
|
8930
|
+
*
|
|
8931
|
+
* @example
|
|
8932
|
+
* ```typescript
|
|
8933
|
+
* const [drawn, optIn] = partition(drawnSectionTypes, sectionDrawsByDefault);
|
|
8934
|
+
* ```
|
|
8935
|
+
*
|
|
8936
|
+
* @group Routing
|
|
8937
|
+
*/
|
|
8938
|
+
export declare const sectionDrawsByDefault: (type: DrawnSectionType) => boolean;
|
|
8939
|
+
/**
|
|
8940
|
+
* The key the given section type's source, events scope and `getShown()` entry are filed under.
|
|
8941
|
+
*
|
|
8942
|
+
* @example
|
|
8943
|
+
* ```typescript
|
|
8944
|
+
* routing.events[sectionSourceKey('lowEmissionZone')].on('click', (section) => { … });
|
|
8945
|
+
* const tunnels = routing.getShown()[sectionSourceKey('tunnel')];
|
|
8946
|
+
* ```
|
|
8947
|
+
*
|
|
8948
|
+
* @group Routing
|
|
8949
|
+
*/
|
|
8950
|
+
export declare const sectionSourceKey: <T extends DrawnSectionType>(type: T) => SectionSourceKey<T>;
|
|
8951
|
+
//#endregion
|
|
8467
8952
|
//#region src/routing/types/routeModuleConfig.d.ts
|
|
8953
|
+
/**
|
|
8954
|
+
* The MapLibre layer id of a generated section's line layer.
|
|
8955
|
+
*
|
|
8956
|
+
* @remarks
|
|
8957
|
+
* Derived from the section type, so `motorway` is drawn by `routeSectionMotorwayLine`.
|
|
8958
|
+
* @group Routing
|
|
8959
|
+
*/
|
|
8960
|
+
type SectionLineLayerName<T extends GeneratedSectionType = GeneratedSectionType> = `routeSection${Capitalize<T>}Line`;
|
|
8961
|
+
/**
|
|
8962
|
+
* The MapLibre layer id of a section's icon layer.
|
|
8963
|
+
*
|
|
8964
|
+
* @remarks
|
|
8965
|
+
* Added to a generated section as soon as `sections.<type>.icon` asks for one, so `motorway` draws
|
|
8966
|
+
* its icon through `routeSectionMotorwaySymbol`.
|
|
8967
|
+
* @group Routing
|
|
8968
|
+
*/
|
|
8969
|
+
type SectionSymbolLayerName<T extends GeneratedSectionType = GeneratedSectionType> = `routeSection${Capitalize<T>}Symbol`;
|
|
8970
|
+
/**
|
|
8971
|
+
* The MapLibre layer id drawing the signs of one generated section type.
|
|
8972
|
+
*
|
|
8973
|
+
* @remarks
|
|
8974
|
+
* Present for the types that post their own value on a sign, so `speedLimit` draws its signs
|
|
8975
|
+
* through `routeSectionSpeedLimitSign`.
|
|
8976
|
+
* @group Routing
|
|
8977
|
+
*/
|
|
8978
|
+
type SectionSignLayerName<T extends GeneratedSectionType = GeneratedSectionType> = `routeSection${Capitalize<T>}Sign`;
|
|
8468
8979
|
/**
|
|
8469
8980
|
* Detailed configuration for the visual appearance of route layers on the map with the MapLibre specification.
|
|
8470
8981
|
*
|
|
@@ -8563,15 +9074,18 @@ type RouteLayersConfig = {
|
|
|
8563
9074
|
routeChargingStopSymbol?: Partial<ToBeAddedLayerSpecTemplate<SymbolLayerSpecification>>;
|
|
8564
9075
|
} & HasAdditionalLayersConfig;
|
|
8565
9076
|
/**
|
|
8566
|
-
* Layer specifications for
|
|
9077
|
+
* Layer specifications for route sections, keyed by section type.
|
|
8567
9078
|
*
|
|
8568
9079
|
* @remarks
|
|
8569
|
-
* Each section is a subset of the route path
|
|
9080
|
+
* Each section is a subset of the route path, and every type the module draws has an entry
|
|
9081
|
+
* here — the same vocabulary as the semantic `sections` config, one tier down. This is the
|
|
9082
|
+
* escape hatch: use it when the knobs on `sections` are not enough and you need full MapLibre
|
|
9083
|
+
* control over the layers a section is drawn with.
|
|
8570
9084
|
*
|
|
8571
|
-
*
|
|
8572
|
-
*
|
|
9085
|
+
* The generated types carry a line layer, and an icon layer once `sections.<type>.icon` asks
|
|
9086
|
+
* for one. The remaining five draw themselves with the hand-written layers documented below.
|
|
8573
9087
|
*/
|
|
8574
|
-
sections?: {
|
|
9088
|
+
sections?: { [T in GeneratedSectionType]?: { [K in SectionLineLayerName<T>]?: Partial<ToBeAddedLayerSpecTemplate<LineLayerSpecification>>; } & { [K in SectionSymbolLayerName<T>]?: Partial<ToBeAddedLayerSpecTemplate<SymbolLayerSpecification>>; } & { [K in SectionSignLayerName<T>]?: Partial<ToBeAddedLayerSpecTemplate<SymbolLayerSpecification>>; } & HasAdditionalLayersConfig; } & {
|
|
8575
9089
|
/**
|
|
8576
9090
|
* Ferry crossing section layers.
|
|
8577
9091
|
*
|
|
@@ -8600,7 +9114,7 @@ type RouteLayersConfig = {
|
|
|
8600
9114
|
* @remarks
|
|
8601
9115
|
* Highlights route segments affected by traffic incidents or disruptions.
|
|
8602
9116
|
*/
|
|
8603
|
-
|
|
9117
|
+
traffic?: {
|
|
8604
9118
|
/**
|
|
8605
9119
|
* Symbol layer used to mark the start of a jam on the route.
|
|
8606
9120
|
*
|
|
@@ -8631,24 +9145,26 @@ type RouteLayersConfig = {
|
|
|
8631
9145
|
routeIncidentDashedLine?: Partial<ToBeAddedLayerSpecTemplate<LineLayerSpecification>>;
|
|
8632
9146
|
} & HasAdditionalLayersConfig;
|
|
8633
9147
|
/**
|
|
8634
|
-
*
|
|
9148
|
+
* Layers for the `tollRoad` section type.
|
|
8635
9149
|
*
|
|
8636
9150
|
* @remarks
|
|
8637
|
-
*
|
|
9151
|
+
* Marks the stretches of the route that cost money to drive, by any charging scheme:
|
|
9152
|
+
* per-use tolls, motorways that need a vignette, and urban road-charge zones.
|
|
8638
9153
|
*/
|
|
8639
9154
|
tollRoad?: {
|
|
8640
9155
|
/**
|
|
8641
|
-
* Symbol layer
|
|
9156
|
+
* Symbol layer marking the charged stretches with an icon.
|
|
8642
9157
|
*
|
|
8643
9158
|
* @remarks
|
|
8644
|
-
*
|
|
9159
|
+
* Defaults to the toll-plaza icon, which is the closest the base-map sprite offers to
|
|
9160
|
+
* a generic road-charge icon. Override it to distinguish the schemes yourself.
|
|
8645
9161
|
*/
|
|
8646
9162
|
routeTollRoadSymbol?: Partial<ToBeAddedLayerSpecTemplate<SymbolLayerSpecification>>;
|
|
8647
9163
|
/**
|
|
8648
|
-
* Line layer used to outline
|
|
9164
|
+
* Line layer used to outline the charged stretches.
|
|
8649
9165
|
*
|
|
8650
9166
|
* @remarks
|
|
8651
|
-
* Typically styled to visually differentiate
|
|
9167
|
+
* Typically styled to visually differentiate charged stretches from regular roads.
|
|
8652
9168
|
*/
|
|
8653
9169
|
routeTollRoadOutline?: Partial<ToBeAddedLayerSpecTemplate<LineLayerSpecification>>;
|
|
8654
9170
|
} & HasAdditionalLayersConfig;
|
|
@@ -8783,6 +9299,10 @@ type ChargingStopIconConfig = {
|
|
|
8783
9299
|
* @remarks
|
|
8784
9300
|
* These icons can be referenced in the `mapping` configuration to customize
|
|
8785
9301
|
* the appearance of charging stop markers based on specific criteria.
|
|
9302
|
+
*
|
|
9303
|
+
* An entry's `offsetX`/`offsetY` shift that icon from the charging stop's coordinate.
|
|
9304
|
+
* They only take effect when the same entry also provides an `image`; an entry naming an
|
|
9305
|
+
* existing sprite icon by `id` alone ignores them.
|
|
8786
9306
|
*/
|
|
8787
9307
|
customIcons?: CustomImage[];
|
|
8788
9308
|
/**
|
|
@@ -8971,47 +9491,240 @@ type RouteTheme = {
|
|
|
8971
9491
|
waypointSize?: RouteWaypointSize;
|
|
8972
9492
|
};
|
|
8973
9493
|
/**
|
|
8974
|
-
*
|
|
9494
|
+
* The icon drawn on a route section.
|
|
8975
9495
|
*
|
|
8976
9496
|
* @remarks
|
|
8977
|
-
*
|
|
8978
|
-
*
|
|
9497
|
+
* Backed by a symbol layer over the section's own source: the generated section types get one
|
|
9498
|
+
* added, and the types that already draw an icon (`ferry`, `tollRoad`) have theirs replaced.
|
|
8979
9499
|
*
|
|
8980
9500
|
* @group Routing
|
|
8981
9501
|
*/
|
|
8982
|
-
type
|
|
9502
|
+
type SectionIconConfig = {
|
|
8983
9503
|
/**
|
|
8984
|
-
*
|
|
9504
|
+
* The id of an image in the loaded style's sprite, e.g. `poi-toll_plaza`. An id the sprite does
|
|
9505
|
+
* not carry draws nothing.
|
|
9506
|
+
*/
|
|
9507
|
+
image: string;
|
|
9508
|
+
/**
|
|
9509
|
+
* Where the icon sits on the section.
|
|
8985
9510
|
*
|
|
8986
9511
|
* @remarks
|
|
8987
|
-
*
|
|
8988
|
-
*
|
|
9512
|
+
* - `center`: one icon at the middle of each section.
|
|
9513
|
+
* - `along`: icons repeated along the section.
|
|
8989
9514
|
*
|
|
8990
|
-
*
|
|
8991
|
-
*
|
|
8992
|
-
* - `imperial` - Miles and feet
|
|
9515
|
+
* A section is a stretch of line, so there is no placement at its start: MapLibre places
|
|
9516
|
+
* symbols on a line either once at its centre or repeatedly along it.
|
|
8993
9517
|
*
|
|
8994
|
-
* @defaultValue `"
|
|
9518
|
+
* @defaultValue `"center"`
|
|
8995
9519
|
*/
|
|
8996
|
-
|
|
9520
|
+
placement?: 'center' | 'along';
|
|
8997
9521
|
/**
|
|
8998
|
-
*
|
|
9522
|
+
* Icon scale, where `1` is the sprite image's own size.
|
|
8999
9523
|
*
|
|
9000
|
-
* @
|
|
9001
|
-
* * Provides high-level styling options that affect the overall appearance of the route,
|
|
9002
|
-
* such as the primary color used for route lines and waypoints.
|
|
9003
|
-
* * Can be overwritten by more specific layer styling configurations.
|
|
9524
|
+
* @defaultValue 1
|
|
9004
9525
|
*/
|
|
9005
|
-
|
|
9526
|
+
size?: number;
|
|
9527
|
+
};
|
|
9528
|
+
type SectionKnobs = {
|
|
9006
9529
|
/**
|
|
9007
|
-
*
|
|
9530
|
+
* Whether the section is drawn at all.
|
|
9008
9531
|
*
|
|
9009
9532
|
* @remarks
|
|
9010
|
-
*
|
|
9533
|
+
* The default is per type, on one rule: a type draws itself when its stretches are sparse
|
|
9534
|
+
* along a route and consequential for the driver. `carTrain`, `ferry`, `lowEmissionZone`,
|
|
9535
|
+
* `tollRoad`, `tollVignette`, `traffic`, `tunnel` and `vehicleRestricted` do, until switched
|
|
9536
|
+
* off here, and so does `speedLimit`, which posts a sign per section rather than banding the
|
|
9537
|
+
* route. The rest wait to be asked — `motorway`, `urban` and `country` each run nearly a
|
|
9538
|
+
* route's whole length, so a band drawn for them buries the route line.
|
|
9011
9539
|
*/
|
|
9012
|
-
|
|
9540
|
+
visible?: boolean;
|
|
9013
9541
|
/**
|
|
9014
|
-
*
|
|
9542
|
+
* Line colour, as any CSS colour string. Each section type has its own default; on a type
|
|
9543
|
+
* drawn with more than one line, this sets the principal one and the rest are derived from it.
|
|
9544
|
+
*/
|
|
9545
|
+
color?: string;
|
|
9546
|
+
/**
|
|
9547
|
+
* Line opacity, 0 to 1. Sections default to partial opacity so the route line stays readable
|
|
9548
|
+
* underneath.
|
|
9549
|
+
*/
|
|
9550
|
+
opacity?: number;
|
|
9551
|
+
/**
|
|
9552
|
+
* Line width preset. Defaults to the route's own width.
|
|
9553
|
+
*/
|
|
9554
|
+
width?: RouteWidth;
|
|
9555
|
+
/**
|
|
9556
|
+
* Whether the section bands the route (`halo`) or stands in for the route line along its own
|
|
9557
|
+
* stretch (`inline`). This decides both where the section's line sits in the layer order and
|
|
9558
|
+
* how wide it is drawn. Each type defaults to the one it has always been drawn as.
|
|
9559
|
+
*/
|
|
9560
|
+
style?: SectionDrawStyle;
|
|
9561
|
+
/**
|
|
9562
|
+
* Line pattern. Each type has its own default — the ones that mark a legal rather than a
|
|
9563
|
+
* physical property of the road are dashed, and `vehicleRestricted` is dotted.
|
|
9564
|
+
*/
|
|
9565
|
+
pattern?: SectionLinePattern;
|
|
9566
|
+
/**
|
|
9567
|
+
* An icon drawn on the section. None of the generated types draws one by default.
|
|
9568
|
+
*/
|
|
9569
|
+
icon?: SectionIconConfig;
|
|
9570
|
+
/**
|
|
9571
|
+
* The sign a section posts its own value on, for the one type whose information is a number
|
|
9572
|
+
* rather than a stretch: `speedLimit`.
|
|
9573
|
+
*/
|
|
9574
|
+
sign?: SectionSignConfig;
|
|
9575
|
+
};
|
|
9576
|
+
/**
|
|
9577
|
+
* The unit a speed limit sign reads in.
|
|
9578
|
+
*
|
|
9579
|
+
* @group Routing
|
|
9580
|
+
*/
|
|
9581
|
+
type SectionSignUnit = 'km/h' | 'mph';
|
|
9582
|
+
/**
|
|
9583
|
+
* What a section's signs give way to when two symbols want the same spot.
|
|
9584
|
+
*
|
|
9585
|
+
* @remarks
|
|
9586
|
+
* MapLibre resolves symbol collisions from the topmost layer down, so the layer underneath is the
|
|
9587
|
+
* one that gives way.
|
|
9588
|
+
*
|
|
9589
|
+
* - `belowMapLabels` — the signs give way to everything, the base map's own labels included, so a
|
|
9590
|
+
* sign never lands on a street or place name. Sparse maps, and the price of a tidy one: in a city
|
|
9591
|
+
* the labels take most of the room. Affordable because a sign repeats along its stretch, so one
|
|
9592
|
+
* dropped where a label sits reappears further along.
|
|
9593
|
+
* - `belowRouteIcons` — the signs give way to the route's own icons, each of which says something
|
|
9594
|
+
* the road cannot, but take precedence over the base map's labels.
|
|
9595
|
+
* - `aboveRouteIcons` — the signs give way to nothing, for a map whose subject is the limits.
|
|
9596
|
+
*
|
|
9597
|
+
* @group Routing
|
|
9598
|
+
*/
|
|
9599
|
+
type SectionSignPriority = 'belowMapLabels' | 'belowRouteIcons' | 'aboveRouteIcons';
|
|
9600
|
+
/**
|
|
9601
|
+
* The sign a section type posts its own value on.
|
|
9602
|
+
*
|
|
9603
|
+
* @remarks
|
|
9604
|
+
* `speedLimit` is the one type that takes this, and a sign is the whole of what it draws — there
|
|
9605
|
+
* is no line along the stretch, because a line would mark every stretch that carries a limit
|
|
9606
|
+
* without ever saying what the limit is. {@link SectionDisplayConfig.visible} switches the signs
|
|
9607
|
+
* themselves.
|
|
9608
|
+
*
|
|
9609
|
+
* The sign follows the road rather than the reader. Where the route also carries `country`
|
|
9610
|
+
* sections, each sign takes the face, the unit and the numeral colour of the country its stretch
|
|
9611
|
+
* runs through: the white disc most of Europe posts on, the yellow one Sweden, Finland and Iceland
|
|
9612
|
+
* use, the `SPEED LIMIT` plaque of the United States, and Japan's blue numerals. A country with no
|
|
9613
|
+
* entry posts the white disc in km/h.
|
|
9614
|
+
*
|
|
9615
|
+
* Where mph is posted the number is converted and rounded to the step signs come in. Without
|
|
9616
|
+
* `country` sections the display units decide the face and the unit, and an explicit {@link unit}
|
|
9617
|
+
* overrides both.
|
|
9618
|
+
*
|
|
9619
|
+
* Signs scale with the zoom, as the ferry and toll-road icons do; {@link minzoom} decides how early
|
|
9620
|
+
* they appear at all.
|
|
9621
|
+
*
|
|
9622
|
+
* @group Routing
|
|
9623
|
+
*/
|
|
9624
|
+
type SectionSignConfig = {
|
|
9625
|
+
/**
|
|
9626
|
+
* The lowest zoom the signs are drawn at.
|
|
9627
|
+
*
|
|
9628
|
+
* @defaultValue 9, the zoom at which a sign is about a stretch of road a reader can see. Over
|
|
9629
|
+
* a whole country the stretches fall in the same few pixels, so the few signs that survive the
|
|
9630
|
+
* collision are an arbitrary sample rather than the limits of the drive.
|
|
9631
|
+
*/
|
|
9632
|
+
minzoom?: number;
|
|
9633
|
+
/**
|
|
9634
|
+
* Whether a sign gives way to the other icons the route draws, or takes precedence over them.
|
|
9635
|
+
*
|
|
9636
|
+
* @defaultValue `'belowRouteIcons'`
|
|
9637
|
+
*/
|
|
9638
|
+
priority?: SectionSignPriority;
|
|
9639
|
+
/**
|
|
9640
|
+
* The unit every sign reads in, whatever the road posts.
|
|
9641
|
+
*
|
|
9642
|
+
* @remarks
|
|
9643
|
+
* Left out, each sign follows its own country, or the display units where the route carries no
|
|
9644
|
+
* `country` sections.
|
|
9645
|
+
*/
|
|
9646
|
+
unit?: SectionSignUnit;
|
|
9647
|
+
};
|
|
9648
|
+
/**
|
|
9649
|
+
* Appearance of one route section type.
|
|
9650
|
+
*
|
|
9651
|
+
* @remarks
|
|
9652
|
+
* The semantic tier for sections: enough to draw, recolour, resize or mute any section type the
|
|
9653
|
+
* module draws, without writing a MapLibre layer spec — see {@link DrawnSectionType} for the
|
|
9654
|
+
* types, and `layers.sections` for anything these knobs cannot express.
|
|
9655
|
+
*
|
|
9656
|
+
* Which knobs a type takes is part of its type. `traffic` colours its line by `magnitudeOfDelay`
|
|
9657
|
+
* and takes its icons from the incident data, so `sections.traffic.color` does not compile rather
|
|
9658
|
+
* than compiling and drawing nothing. {@link sectionSupportsKnob} answers the same question at
|
|
9659
|
+
* runtime, for a UI that builds its controls from the type.
|
|
9660
|
+
*
|
|
9661
|
+
* @example
|
|
9662
|
+
* ```typescript
|
|
9663
|
+
* const config: RoutingModuleConfig = {
|
|
9664
|
+
* sections: {
|
|
9665
|
+
* // Opt in to two of the sections nothing draws by default:
|
|
9666
|
+
* urban: { visible: true },
|
|
9667
|
+
* lowEmissionZone: { visible: true, color: '#1B7A43', opacity: 0.8 },
|
|
9668
|
+
* // Restyle two that are drawn already:
|
|
9669
|
+
* tunnel: { color: '#402060', style: 'halo' },
|
|
9670
|
+
* tollRoad: { icon: { image: 'poi-toll_plaza', placement: 'along' } },
|
|
9671
|
+
* // And drop one:
|
|
9672
|
+
* traffic: { visible: false },
|
|
9673
|
+
* },
|
|
9674
|
+
* };
|
|
9675
|
+
* ```
|
|
9676
|
+
*
|
|
9677
|
+
* @group Routing
|
|
9678
|
+
*/
|
|
9679
|
+
type SectionDisplayConfig<T extends DrawnSectionType = DrawnSectionType> = Pick<SectionKnobs, SectionKnobOf<T>>;
|
|
9680
|
+
/**
|
|
9681
|
+
* Appearance of every route section type, keyed by type.
|
|
9682
|
+
*
|
|
9683
|
+
* @group Routing
|
|
9684
|
+
*/
|
|
9685
|
+
type SectionsDisplayConfig = { [T in DrawnSectionType]?: SectionDisplayConfig<T>; };
|
|
9686
|
+
/**
|
|
9687
|
+
* Configuration options for the routing module.
|
|
9688
|
+
*
|
|
9689
|
+
* @remarks
|
|
9690
|
+
* Provides customization options for route visualization and behavior,
|
|
9691
|
+
* including display units, waypoint handling, and layer styling.
|
|
9692
|
+
*
|
|
9693
|
+
* @group Routing
|
|
9694
|
+
*/
|
|
9695
|
+
type RoutingModuleConfig = MapModuleCommonConfig & {
|
|
9696
|
+
/**
|
|
9697
|
+
* Units for displaying distances in route summaries and instructions.
|
|
9698
|
+
*
|
|
9699
|
+
* @remarks
|
|
9700
|
+
* Overrides the global configuration setting for display units.
|
|
9701
|
+
* Affects distance values shown in route summaries and turn-by-turn instructions.
|
|
9702
|
+
*
|
|
9703
|
+
* Available options:
|
|
9704
|
+
* - `metric` - Kilometers and meters
|
|
9705
|
+
* - `imperial` - Miles and feet
|
|
9706
|
+
*
|
|
9707
|
+
* @defaultValue `"metric"`
|
|
9708
|
+
*/
|
|
9709
|
+
displayUnits?: DisplayUnits;
|
|
9710
|
+
/**
|
|
9711
|
+
* Main styling configuration for the route visualization.
|
|
9712
|
+
*
|
|
9713
|
+
* @remarks
|
|
9714
|
+
* * Provides high-level styling options that affect the overall appearance of the route,
|
|
9715
|
+
* such as the primary color used for route lines and waypoints.
|
|
9716
|
+
* * Can be overwritten by more specific layer styling configurations.
|
|
9717
|
+
*/
|
|
9718
|
+
theme?: RouteTheme;
|
|
9719
|
+
/**
|
|
9720
|
+
* Configuration for the waypoints source and layers to display them on the map.
|
|
9721
|
+
*
|
|
9722
|
+
* @remarks
|
|
9723
|
+
* Controls how waypoint source data and/or layer configs are processed to rendering them the map.
|
|
9724
|
+
*/
|
|
9725
|
+
waypoints?: WaypointsConfig;
|
|
9726
|
+
/**
|
|
9727
|
+
* Configuration for the charging stops source and layers to display them on the map.
|
|
9015
9728
|
*
|
|
9016
9729
|
* @remarks
|
|
9017
9730
|
* Controls how charging stops source data and/or layer configs are processed to rendering them the map.
|
|
@@ -9032,6 +9745,23 @@ type RoutingModuleConfig = MapModuleCommonConfig & {
|
|
|
9032
9745
|
*/
|
|
9033
9746
|
visible?: boolean;
|
|
9034
9747
|
};
|
|
9748
|
+
/**
|
|
9749
|
+
* Appearance of the route sections, keyed by section type.
|
|
9750
|
+
*
|
|
9751
|
+
* @remarks
|
|
9752
|
+
* Covers every section type the module draws, on the same knobs: draw it or not, its colour,
|
|
9753
|
+
* opacity, width, whether it bands the route or stands in for its line, its line pattern and
|
|
9754
|
+
* its icon.
|
|
9755
|
+
*
|
|
9756
|
+
* The types whose stretches are sparse and consequential draw themselves — `carTrain`,
|
|
9757
|
+
* `ferry`, `lowEmissionZone`, `tollRoad`, `tollVignette`, `traffic`, `tunnel` and
|
|
9758
|
+
* `vehicleRestricted` — and switch off with `{ visible: false }`. The rest switch on with
|
|
9759
|
+
* `{ visible: true }`: a type covering most of a route buries the route line.
|
|
9760
|
+
*
|
|
9761
|
+
* `layers.sections` takes full MapLibre layer specs for the same types, for anything these
|
|
9762
|
+
* knobs cannot express.
|
|
9763
|
+
*/
|
|
9764
|
+
sections?: SectionsDisplayConfig;
|
|
9035
9765
|
/**
|
|
9036
9766
|
* Custom layer styling configuration.
|
|
9037
9767
|
*
|
|
@@ -9150,10 +9880,14 @@ export declare const getLineOutlineWidth: (size?: RouteWidth) => ExpressionSpeci
|
|
|
9150
9880
|
*/
|
|
9151
9881
|
export declare const getWaypointIconSize: (size?: RouteWaypointSize) => ExpressionSpecification;
|
|
9152
9882
|
/**
|
|
9153
|
-
* Returns the
|
|
9883
|
+
* Returns the width expression of a section halo for the given size preset.
|
|
9884
|
+
*
|
|
9885
|
+
* @remarks
|
|
9886
|
+
* Wider than {@link getLineOutlineWidth} at every zoom, which is what makes a section drawn
|
|
9887
|
+
* beneath the route show as a band around it rather than disappear under the route's own outline.
|
|
9154
9888
|
* @ignore
|
|
9155
9889
|
*/
|
|
9156
|
-
export declare const
|
|
9890
|
+
export declare const getSectionHaloWidth: (size?: RouteWidth) => ExpressionSpecification;
|
|
9157
9891
|
/**
|
|
9158
9892
|
* Returns the instruction line width expression for the given size preset.
|
|
9159
9893
|
* @ignore
|
|
@@ -9468,6 +10202,75 @@ type DisplayRouteSummary = Feature<Point, DisplayRouteSummaryProps>;
|
|
|
9468
10202
|
*/
|
|
9469
10203
|
type DisplayRouteSummaries = FeatureCollection<Point, DisplayRouteSummaryProps>;
|
|
9470
10204
|
//#endregion
|
|
10205
|
+
//#region src/routing/types/guidance.d.ts
|
|
10206
|
+
/**
|
|
10207
|
+
* @ignore
|
|
10208
|
+
*/
|
|
10209
|
+
type DisplayInstructionArrowProps = {
|
|
10210
|
+
lastPointBearingDegrees: number;
|
|
10211
|
+
};
|
|
10212
|
+
/**
|
|
10213
|
+
* @ignore
|
|
10214
|
+
*/
|
|
10215
|
+
type DisplayInstructionArrows = FeatureCollection<Point, Instruction & DisplayInstructionArrowProps & DisplayRouteRelatedProps>;
|
|
10216
|
+
/**
|
|
10217
|
+
* @ignore
|
|
10218
|
+
*/
|
|
10219
|
+
type DisplayInstruction = Feature<LineString, Instruction & DisplayRouteRelatedProps>;
|
|
10220
|
+
/**
|
|
10221
|
+
* @ignore
|
|
10222
|
+
*/
|
|
10223
|
+
type DisplayInstructions = FeatureCollection<LineString, Instruction & DisplayRouteRelatedProps>;
|
|
10224
|
+
//#endregion
|
|
10225
|
+
//#region src/routing/util/displayChargingStops.d.ts
|
|
10226
|
+
type DisplayChargingStopProps = PlaceDisplayProps & ChargingStopProps & DisplayRouteRelatedProps & {
|
|
10227
|
+
chargingDuration: string;
|
|
10228
|
+
chargingPower: string;
|
|
10229
|
+
stopDuration?: string;
|
|
10230
|
+
};
|
|
10231
|
+
/**
|
|
10232
|
+
* The charging stops as displayed on the map, carrying the route state and index so a selection
|
|
10233
|
+
* change can restyle them in place.
|
|
10234
|
+
* @ignore
|
|
10235
|
+
*/
|
|
10236
|
+
type DisplayChargingStops = FeatureCollection<Point, DisplayChargingStopProps>;
|
|
10237
|
+
//#endregion
|
|
10238
|
+
//#region src/routing/types/planningWaypoint.d.ts
|
|
10239
|
+
/**
|
|
10240
|
+
* Waypoint or placeholder for route planning.
|
|
10241
|
+
*
|
|
10242
|
+
* Represents a point along a route, which can be a full waypoint with position
|
|
10243
|
+
* and properties, or `null` for placeholder positions (e.g., unset waypoints in
|
|
10244
|
+
* a multi-stop route planner UI).
|
|
10245
|
+
*
|
|
10246
|
+
* @remarks
|
|
10247
|
+
* **Use Cases:**
|
|
10248
|
+
* - Route planning interfaces with add/remove waypoint functionality
|
|
10249
|
+
* - Multi-stop delivery route optimization
|
|
10250
|
+
* - Placeholder slots in waypoint arrays
|
|
10251
|
+
* - Optional intermediate stops
|
|
10252
|
+
*
|
|
10253
|
+
* **Waypoint Types:**
|
|
10254
|
+
* - `WaypointLike`: Full waypoint with coordinates and optional properties
|
|
10255
|
+
* - `null`: Placeholder for unset or removed waypoints
|
|
10256
|
+
*
|
|
10257
|
+
* @example
|
|
10258
|
+
* ```typescript
|
|
10259
|
+
* // Array of waypoints with some unset
|
|
10260
|
+
* const waypoints: PlanningWaypoint[] = [
|
|
10261
|
+
* { type: 'Feature', geometry: { type: 'Point', coordinates: [4.9, 52.3] } },
|
|
10262
|
+
* null, // Empty slot for user to add waypoint
|
|
10263
|
+
* { type: 'Feature', geometry: { type: 'Point', coordinates: [4.5, 51.9] } }
|
|
10264
|
+
* ];
|
|
10265
|
+
*
|
|
10266
|
+
* // Filter out null waypoints before routing
|
|
10267
|
+
* const validWaypoints = waypoints.filter(w => w !== null);
|
|
10268
|
+
* ```
|
|
10269
|
+
*
|
|
10270
|
+
* @group Routing
|
|
10271
|
+
*/
|
|
10272
|
+
type PlanningWaypoint = WaypointLike | null;
|
|
10273
|
+
//#endregion
|
|
9471
10274
|
//#region src/routing/types/routeSections.d.ts
|
|
9472
10275
|
/**
|
|
9473
10276
|
* Display-ready section properties combining base section data with route context.
|
|
@@ -9631,62 +10434,6 @@ type DisplayTrafficSectionProps = DisplaySectionProps & TrafficSectionProps & {
|
|
|
9631
10434
|
title?: string;
|
|
9632
10435
|
};
|
|
9633
10436
|
//#endregion
|
|
9634
|
-
//#region src/routing/types/guidance.d.ts
|
|
9635
|
-
/**
|
|
9636
|
-
* @ignore
|
|
9637
|
-
*/
|
|
9638
|
-
type DisplayInstructionArrowProps = {
|
|
9639
|
-
lastPointBearingDegrees: number;
|
|
9640
|
-
};
|
|
9641
|
-
/**
|
|
9642
|
-
* @ignore
|
|
9643
|
-
*/
|
|
9644
|
-
type DisplayInstructionArrows = FeatureCollection<Point, Instruction & DisplayInstructionArrowProps & DisplayRouteRelatedProps>;
|
|
9645
|
-
/**
|
|
9646
|
-
* @ignore
|
|
9647
|
-
*/
|
|
9648
|
-
type DisplayInstruction = Feature<LineString, Instruction & DisplayRouteRelatedProps>;
|
|
9649
|
-
/**
|
|
9650
|
-
* @ignore
|
|
9651
|
-
*/
|
|
9652
|
-
type DisplayInstructions = FeatureCollection<LineString, Instruction & DisplayRouteRelatedProps>;
|
|
9653
|
-
//#endregion
|
|
9654
|
-
//#region src/routing/types/planningWaypoint.d.ts
|
|
9655
|
-
/**
|
|
9656
|
-
* Waypoint or placeholder for route planning.
|
|
9657
|
-
*
|
|
9658
|
-
* Represents a point along a route, which can be a full waypoint with position
|
|
9659
|
-
* and properties, or `null` for placeholder positions (e.g., unset waypoints in
|
|
9660
|
-
* a multi-stop route planner UI).
|
|
9661
|
-
*
|
|
9662
|
-
* @remarks
|
|
9663
|
-
* **Use Cases:**
|
|
9664
|
-
* - Route planning interfaces with add/remove waypoint functionality
|
|
9665
|
-
* - Multi-stop delivery route optimization
|
|
9666
|
-
* - Placeholder slots in waypoint arrays
|
|
9667
|
-
* - Optional intermediate stops
|
|
9668
|
-
*
|
|
9669
|
-
* **Waypoint Types:**
|
|
9670
|
-
* - `WaypointLike`: Full waypoint with coordinates and optional properties
|
|
9671
|
-
* - `null`: Placeholder for unset or removed waypoints
|
|
9672
|
-
*
|
|
9673
|
-
* @example
|
|
9674
|
-
* ```typescript
|
|
9675
|
-
* // Array of waypoints with some unset
|
|
9676
|
-
* const waypoints: PlanningWaypoint[] = [
|
|
9677
|
-
* { type: 'Feature', geometry: { type: 'Point', coordinates: [4.9, 52.3] } },
|
|
9678
|
-
* null, // Empty slot for user to add waypoint
|
|
9679
|
-
* { type: 'Feature', geometry: { type: 'Point', coordinates: [4.5, 51.9] } }
|
|
9680
|
-
* ];
|
|
9681
|
-
*
|
|
9682
|
-
* // Filter out null waypoints before routing
|
|
9683
|
-
* const validWaypoints = waypoints.filter(w => w !== null);
|
|
9684
|
-
* ```
|
|
9685
|
-
*
|
|
9686
|
-
* @group Routing
|
|
9687
|
-
*/
|
|
9688
|
-
type PlanningWaypoint = WaypointLike | null;
|
|
9689
|
-
//#endregion
|
|
9690
10437
|
//#region src/routing/types/waypointDisplayProps.d.ts
|
|
9691
10438
|
/**
|
|
9692
10439
|
* @group Routing
|
|
@@ -9824,13 +10571,13 @@ export declare const STOP_DISPLAY_INDEX = "stopDisplayIndex";
|
|
|
9824
10571
|
/**
|
|
9825
10572
|
* @ignore
|
|
9826
10573
|
*/
|
|
9827
|
-
type RoutingSourcesWithLayers = {
|
|
10574
|
+
type RoutingSourcesWithLayers = { [K in SectionSourceKey<GeneratedSectionType>]: GeoJSONSourceWithLayers<RouteSections>; } & {
|
|
9828
10575
|
mainLines: GeoJSONSourceWithLayers<Routes<DisplayRouteProps>>;
|
|
9829
10576
|
waypoints: GeoJSONSourceWithLayers<Waypoints<WaypointDisplayProps>>;
|
|
9830
10577
|
vehicleRestricted: GeoJSONSourceWithLayers<RouteSections>;
|
|
9831
10578
|
incidents: GeoJSONSourceWithLayers<RouteSections<DisplayTrafficSectionProps>>;
|
|
9832
10579
|
ferries: GeoJSONSourceWithLayers<RouteSections>;
|
|
9833
|
-
chargingStops: GeoJSONSourceWithLayers<
|
|
10580
|
+
chargingStops: GeoJSONSourceWithLayers<DisplayChargingStops>;
|
|
9834
10581
|
tollRoads: GeoJSONSourceWithLayers<RouteSections>;
|
|
9835
10582
|
tunnels: GeoJSONSourceWithLayers<RouteSections>;
|
|
9836
10583
|
instructionLines: GeoJSONSourceWithLayers<DisplayInstructions>;
|
|
@@ -9907,7 +10654,7 @@ export type RoutingShownFeatures = {
|
|
|
9907
10654
|
*
|
|
9908
10655
|
* @group Routing
|
|
9909
10656
|
*/
|
|
9910
|
-
export type RoutingEvents = CombinedEvents<MapGeoJSONFeature, RoutingModuleConfig, RoutingShownFeatures> & {
|
|
10657
|
+
export type RoutingEvents = CombinedEvents<MapGeoJSONFeature, RoutingModuleConfig, RoutingShownFeatures> & { [K in SectionSourceKey<GeneratedSectionType>]: UserEvents<RouteSection>; } & {
|
|
9911
10658
|
/** The route lines themselves. */
|
|
9912
10659
|
mainLines: UserEvents<Route<DisplayRouteProps>>;
|
|
9913
10660
|
/** Origin, destination and intermediate stops. */
|
|
@@ -10034,6 +10781,59 @@ export declare class RoutingModule extends AbstractDataOwnedMapModule<RoutingSou
|
|
|
10034
10781
|
* @ignore
|
|
10035
10782
|
*/
|
|
10036
10783
|
protected _applyConfig(config?: RoutingModuleConfig): RoutingModuleConfig;
|
|
10784
|
+
/**
|
|
10785
|
+
* Shows the speed limit sections, each carrying the sign that posts it.
|
|
10786
|
+
*
|
|
10787
|
+
* @remarks
|
|
10788
|
+
* `speedLimit` is the one type drawn from its own number rather than its extent, so the number,
|
|
10789
|
+
* the face and the numeral colour are derived here and ride on the feature. That makes the unit
|
|
10790
|
+
* in force an input to the data rather than to the paint, which is why a change to it re-runs
|
|
10791
|
+
* this instead of restyling the layer in place.
|
|
10792
|
+
*/
|
|
10793
|
+
private showSpeedLimitSections;
|
|
10794
|
+
/**
|
|
10795
|
+
* Re-derives the posted signs when the unit they read in changed.
|
|
10796
|
+
*
|
|
10797
|
+
* @remarks
|
|
10798
|
+
* No paint property can restate a number, so `sign.unit` and `displayUnits` are the two knobs
|
|
10799
|
+
* that have to reach the features rather than the layers — the summary bubbles are re-shown for
|
|
10800
|
+
* the same reason. Runs before the visibility pass, so the re-shown source goes through it.
|
|
10801
|
+
*/
|
|
10802
|
+
private reshowSpeedLimitSigns;
|
|
10803
|
+
/**
|
|
10804
|
+
* Applies the `sections.<type>.visible` knob to every section type.
|
|
10805
|
+
*
|
|
10806
|
+
* @remarks
|
|
10807
|
+
* Every other source here follows one rule — its layers are visible whenever it holds features
|
|
10808
|
+
* — and for sections that rule is not enough. Almost every route has urban stretches, a tunnel
|
|
10809
|
+
* or a country crossing somewhere along it, so "has features" would draw all sixteen types the
|
|
10810
|
+
* moment a route is shown, whatever the caller asked for. This runs right after anything that
|
|
10811
|
+
* shows features and after any config change, in the same tick, so nothing renders in between.
|
|
10812
|
+
*/
|
|
10813
|
+
private applySectionVisibility;
|
|
10814
|
+
/** The id of the layer posting this type's signs, for a type that posts them. */
|
|
10815
|
+
private signLayerID;
|
|
10816
|
+
/**
|
|
10817
|
+
* Settles which icons a section's signs give way to.
|
|
10818
|
+
*
|
|
10819
|
+
* @remarks
|
|
10820
|
+
* MapLibre resolves symbol collisions from the topmost layer down, so this is a matter of where
|
|
10821
|
+
* the sign layer sits — and it cannot be a `beforeID`, because the layers a sign yields to are
|
|
10822
|
+
* added when the features that need them are shown: a route with no waypoints shown has no
|
|
10823
|
+
* waypoint layer to anchor to, and an anchor that is not on the map costs the sign layer
|
|
10824
|
+
* itself. So the stacking is settled here instead, after each show and each config change.
|
|
10825
|
+
*/
|
|
10826
|
+
private applySignPriority;
|
|
10827
|
+
/**
|
|
10828
|
+
* The layer a section's signs are moved under, for what they are configured to give way to.
|
|
10829
|
+
*
|
|
10830
|
+
* @remarks
|
|
10831
|
+
* `aboveRouteIcons` anchors to nothing, which puts the layer on top. The other two differ only
|
|
10832
|
+
* in where the search starts: under the base map's labels for `belowMapLabels`, and at them for
|
|
10833
|
+
* `belowRouteIcons`, since a section's own icon layer is pinned below the labels and a sign
|
|
10834
|
+
* sent under that would give way to every place name on the way.
|
|
10835
|
+
*/
|
|
10836
|
+
private signAnchorLayerID;
|
|
10037
10837
|
/** @ignore */
|
|
10038
10838
|
protected discardShownData(): void;
|
|
10039
10839
|
/**
|
|
@@ -10062,7 +10862,7 @@ export declare class RoutingModule extends AbstractDataOwnedMapModule<RoutingSou
|
|
|
10062
10862
|
* **Route Features:**
|
|
10063
10863
|
* - Main route lines (selected and deselected styles)
|
|
10064
10864
|
* - Traffic sections with delays
|
|
10065
|
-
* - Ferry, tunnel, and
|
|
10865
|
+
* - Ferry, tunnel, and charged-road (`tollRoad`) sections
|
|
10066
10866
|
* - EV charging stations (for EV routes)
|
|
10067
10867
|
* - Turn-by-turn instruction lines and arrows
|
|
10068
10868
|
* - Summary bubbles with distance/time/traffic info
|
|
@@ -10171,7 +10971,7 @@ export declare class RoutingModule extends AbstractDataOwnedMapModule<RoutingSou
|
|
|
10171
10971
|
* - `incidents`: Traffic incidents on routes
|
|
10172
10972
|
* - `ferries`: Ferry sections
|
|
10173
10973
|
* - `chargingStops`: EV charging stations
|
|
10174
|
-
* - `tollRoads`:
|
|
10974
|
+
* - `tollRoads`: Sections that cost money to drive — the `tollRoad` section type
|
|
10175
10975
|
* - `tunnels`: Tunnel sections
|
|
10176
10976
|
* - `vehicleRestricted`: Vehicle-restricted sections
|
|
10177
10977
|
* - `instructionLines`: Turn-by-turn instruction lines
|
|
@@ -10198,17 +10998,27 @@ export declare class RoutingModule extends AbstractDataOwnedMapModule<RoutingSou
|
|
|
10198
10998
|
* ```
|
|
10199
10999
|
*/
|
|
10200
11000
|
getShown(): {
|
|
10201
|
-
mainLines: Routes<DisplayRouteProps>;
|
|
10202
|
-
waypoints: Waypoints<WaypointDisplayProps>;
|
|
10203
|
-
incidents: RouteSections<DisplayTrafficSectionProps>;
|
|
10204
|
-
ferries: RouteSections;
|
|
10205
|
-
chargingStops: Waypoints;
|
|
10206
|
-
tollRoads: RouteSections;
|
|
10207
11001
|
tunnels: RouteSections;
|
|
10208
11002
|
vehicleRestricted: RouteSections;
|
|
10209
11003
|
instructionLines: DisplayInstructions;
|
|
10210
11004
|
instructionArrows: DisplayInstructionArrows;
|
|
10211
11005
|
summaryBubbles: DisplayRouteSummaries;
|
|
11006
|
+
carpoolSections: RouteSections | undefined;
|
|
11007
|
+
carTrainSections: RouteSections | undefined;
|
|
11008
|
+
importantRoadStretchSections: RouteSections | undefined;
|
|
11009
|
+
lowEmissionZoneSections: RouteSections | undefined;
|
|
11010
|
+
motorwaySections: RouteSections | undefined;
|
|
11011
|
+
pedestrianSections: RouteSections | undefined;
|
|
11012
|
+
speedLimitSections: RouteSections | undefined;
|
|
11013
|
+
tollVignetteSections: RouteSections | undefined;
|
|
11014
|
+
unpavedSections: RouteSections | undefined;
|
|
11015
|
+
urbanSections: RouteSections | undefined;
|
|
11016
|
+
mainLines: Routes<DisplayRouteProps>;
|
|
11017
|
+
waypoints: Waypoints<WaypointDisplayProps>;
|
|
11018
|
+
incidents: RouteSections<DisplayTrafficSectionProps>;
|
|
11019
|
+
ferries: RouteSections;
|
|
11020
|
+
chargingStops: DisplayChargingStops;
|
|
11021
|
+
tollRoads: RouteSections;
|
|
10212
11022
|
};
|
|
10213
11023
|
/**
|
|
10214
11024
|
* Unified events interface for the routing module.
|
|
@@ -10242,6 +11052,460 @@ export declare class RoutingModule extends AbstractDataOwnedMapModule<RoutingSou
|
|
|
10242
11052
|
getLayerToRenderLinesUnder(): string;
|
|
10243
11053
|
}
|
|
10244
11054
|
//#endregion
|
|
11055
|
+
//#region src/shared/layers/layerSelector.d.ts
|
|
11056
|
+
/**
|
|
11057
|
+
* Picks style layers by the taxonomy TomTom ships with the style rather than by their (unstable)
|
|
11058
|
+
* ids: `metadata.group` first, then optional narrowing by layer type, source layer and
|
|
11059
|
+
* case-insensitive id fragments. Every constraint given must hold.
|
|
11060
|
+
*
|
|
11061
|
+
* This is the one matching rule behind the base-map layer groups and the styling knobs, so a
|
|
11062
|
+
* curated map is a small data table rather than code, and a style-version bump is checked by
|
|
11063
|
+
* running the same tables against the new style.
|
|
11064
|
+
*
|
|
11065
|
+
* @ignore
|
|
11066
|
+
*/
|
|
11067
|
+
type LayerSelector = {
|
|
11068
|
+
/** Values of `metadata.group` the layer may carry. Omit to accept any group. */
|
|
11069
|
+
metadataGroups?: string[];
|
|
11070
|
+
/** Layer types the layer may have. */
|
|
11071
|
+
layerTypes?: LayerSpecification['type'][];
|
|
11072
|
+
/** Sources the layer must draw from. */
|
|
11073
|
+
sources?: string[];
|
|
11074
|
+
/**
|
|
11075
|
+
* Source types (`vector`, `raster`, `geojson`…) the layer's source may have. Needs the style's
|
|
11076
|
+
* sources to be passed along when matching; without them this constraint cannot hold.
|
|
11077
|
+
*/
|
|
11078
|
+
sourceTypes?: string[];
|
|
11079
|
+
/** Source layers (vector tile layers) the layer must draw from. */
|
|
11080
|
+
sourceLayers?: string[];
|
|
11081
|
+
/** The layer id must contain at least one of these fragments (case-insensitive). */
|
|
11082
|
+
idIncludes?: string[];
|
|
11083
|
+
/** The layer id must contain none of these fragments (case-insensitive). */
|
|
11084
|
+
idExcludes?: string[];
|
|
11085
|
+
};
|
|
11086
|
+
//#endregion
|
|
11087
|
+
//#region src/styling/types/stylingTypes.d.ts
|
|
11088
|
+
/**
|
|
11089
|
+
* What kind of value a styling knob takes — a subset of the shared {@link KnobKind} vocabulary.
|
|
11090
|
+
*
|
|
11091
|
+
* - `factor`: a multiplier over what the style already does (`1` = unchanged), e.g. label size.
|
|
11092
|
+
* - `number`: an absolute number with a range, e.g. a minimum zoom.
|
|
11093
|
+
* - `toggle`: `true`/`false`, e.g. whether exit numbers are shown.
|
|
11094
|
+
* - `color`: a CSS colour string (`#rrggbb`, `hsl(…)`, `rgb(…)`, a named colour).
|
|
11095
|
+
*
|
|
11096
|
+
* @group Map Styling
|
|
11097
|
+
*/
|
|
11098
|
+
export declare const stylingKnobKinds: readonly ["factor", "number", "toggle", "color"];
|
|
11099
|
+
/**
|
|
11100
|
+
* @group Map Styling
|
|
11101
|
+
*/
|
|
11102
|
+
type StylingKnobKind = (typeof stylingKnobKinds)[number];
|
|
11103
|
+
/**
|
|
11104
|
+
* Which styles a knob works on.
|
|
11105
|
+
*
|
|
11106
|
+
* - `any-style`: every style, including a custom one of your own.
|
|
11107
|
+
* - `tomtom-styles`: the TomTom styles this SDK version is verified against. On any other style the
|
|
11108
|
+
* knob reports itself unavailable instead of doing nothing silently.
|
|
11109
|
+
*
|
|
11110
|
+
* @group Map Styling
|
|
11111
|
+
*/
|
|
11112
|
+
export declare const stylingKnobAppliesTo: readonly ["any-style", "tomtom-styles"];
|
|
11113
|
+
/**
|
|
11114
|
+
* @group Map Styling
|
|
11115
|
+
*/
|
|
11116
|
+
type StylingKnobAppliesTo = (typeof stylingKnobAppliesTo)[number];
|
|
11117
|
+
/**
|
|
11118
|
+
* A value a styling knob can hold; which one depends on the knob's {@link StylingKnobKind}.
|
|
11119
|
+
*
|
|
11120
|
+
* @group Map Styling
|
|
11121
|
+
*/
|
|
11122
|
+
type StylingKnobValue = number | boolean | string;
|
|
11123
|
+
/**
|
|
11124
|
+
* The valid range of a numeric knob, in the units of the knob (`factor` knobs are unitless).
|
|
11125
|
+
* Styling always ships a slider `step`; the shared {@link KnobRange} leaves it optional.
|
|
11126
|
+
*
|
|
11127
|
+
* @group Map Styling
|
|
11128
|
+
*/
|
|
11129
|
+
type StylingKnobRange = KnobRange & {
|
|
11130
|
+
step: number;
|
|
11131
|
+
};
|
|
11132
|
+
/**
|
|
11133
|
+
* One entry of the styling catalogue returned by {@link StylingModule.describe}: everything a UI or
|
|
11134
|
+
* an agent needs to offer the knob, validate a value for it and show its state.
|
|
11135
|
+
*
|
|
11136
|
+
* @remarks
|
|
11137
|
+
* Narrows the shared {@link KnobDescriptor}: styling ids and value types are known, `range.step` is
|
|
11138
|
+
* always given, and `available` / `appliesTo` are required — every styling knob answers both.
|
|
11139
|
+
*
|
|
11140
|
+
* @group Map Styling
|
|
11141
|
+
*/
|
|
11142
|
+
type StylingKnobDescriptor = KnobDescriptor & {
|
|
11143
|
+
/** The knob's id, as accepted by {@link StylingModule.set}. */
|
|
11144
|
+
id: StylingKnobId;
|
|
11145
|
+
kind: StylingKnobKind;
|
|
11146
|
+
/**
|
|
11147
|
+
* The value the loaded style ships with. `undefined` when the style defines it as a data-driven
|
|
11148
|
+
* expression that no single value stands for; `reset` still restores it exactly.
|
|
11149
|
+
*/
|
|
11150
|
+
default: StylingKnobValue | undefined;
|
|
11151
|
+
/** The value in effect right now: the override if there is one, otherwise the default. */
|
|
11152
|
+
current: StylingKnobValue | undefined;
|
|
11153
|
+
/** The range of valid values, for `factor` and `number` knobs. */
|
|
11154
|
+
range?: StylingKnobRange;
|
|
11155
|
+
/**
|
|
11156
|
+
* Whether the knob has anything to work on in the loaded style. `false` means setting it would
|
|
11157
|
+
* do nothing — the SDK also warns once in the console when that happens. Check this before
|
|
11158
|
+
* offering the knob in a UI or to an agent.
|
|
11159
|
+
*/
|
|
11160
|
+
available: boolean;
|
|
11161
|
+
/** Which styles the knob works on; see {@link stylingKnobAppliesTo}. */
|
|
11162
|
+
appliesTo: StylingKnobAppliesTo;
|
|
11163
|
+
};
|
|
11164
|
+
/**
|
|
11165
|
+
* The machine-readable styling catalogue: what can be styled on the loaded style, with defaults,
|
|
11166
|
+
* ranges and current values. Additive across SDK minor versions; knob ids are public API.
|
|
11167
|
+
*
|
|
11168
|
+
* @group Map Styling
|
|
11169
|
+
*/
|
|
11170
|
+
type StylingCatalogue = {
|
|
11171
|
+
knobs: StylingKnobDescriptor[];
|
|
11172
|
+
};
|
|
11173
|
+
/**
|
|
11174
|
+
* A serializable set of styling knob values — what {@link StylingModule.getConfig} returns and
|
|
11175
|
+
* {@link StylingModule.applyConfig} accepts. Persist it, put it in a pull request, or ship it as a
|
|
11176
|
+
* preset: re-applying it on a later SDK version keeps working for as long as the knob ids do.
|
|
11177
|
+
*
|
|
11178
|
+
* @example
|
|
11179
|
+
* ```typescript
|
|
11180
|
+
* const settings: StylingSettings = {
|
|
11181
|
+
* 'labels.sizeFactor': 1.2,
|
|
11182
|
+
* 'roads.exitNumbers': false,
|
|
11183
|
+
* 'traffic.flow.slowColor': '#f59e0b',
|
|
11184
|
+
* };
|
|
11185
|
+
* styling.applyConfig(settings);
|
|
11186
|
+
* ```
|
|
11187
|
+
*
|
|
11188
|
+
* @group Map Styling
|
|
11189
|
+
*/
|
|
11190
|
+
type StylingSettings = MapModuleCommonConfig & { [K in StylingKnobId]?: StylingKnobValueOf<K>; };
|
|
11191
|
+
//#endregion
|
|
11192
|
+
//#region src/styling/knobCatalogue.d.ts
|
|
11193
|
+
/** @ignore */
|
|
11194
|
+
type ScalableProperty = 'text-size' | 'icon-size' | 'line-width';
|
|
11195
|
+
/** @ignore */
|
|
11196
|
+
type ColorProperty = 'line-color' | 'text-color' | 'text-halo-color';
|
|
11197
|
+
/**
|
|
11198
|
+
* How a knob reaches the style. A knob may use several (e.g. text and icon size together).
|
|
11199
|
+
* @ignore
|
|
11200
|
+
*/
|
|
11201
|
+
type KnobMechanism =
|
|
11202
|
+
/** M1 — multiplies the property's own value on every matched layer (works on any style). */
|
|
11203
|
+
{
|
|
11204
|
+
type: 'scale';
|
|
11205
|
+
property: ScalableProperty;
|
|
11206
|
+
layers: LayerSelector[];
|
|
11207
|
+
} |
|
|
11208
|
+
/** M2 — shows/hides the matched layers. */
|
|
11209
|
+
{
|
|
11210
|
+
type: 'visibility';
|
|
11211
|
+
layers: LayerSelector[];
|
|
11212
|
+
} |
|
|
11213
|
+
/**
|
|
11214
|
+
* M2 — sets a colour literal on the matched layers; `shades` are layers whose colour the style
|
|
11215
|
+
* derived from it (an outline, a tunnel variant) and that are re-derived by the same HSL offset.
|
|
11216
|
+
*/
|
|
11217
|
+
{
|
|
11218
|
+
type: 'color';
|
|
11219
|
+
property: ColorProperty;
|
|
11220
|
+
layers: LayerSelector[];
|
|
11221
|
+
shades?: LayerSelector[];
|
|
11222
|
+
} |
|
|
11223
|
+
/** Sets the minimum zoom of the matched layers. */
|
|
11224
|
+
{
|
|
11225
|
+
type: 'minZoom';
|
|
11226
|
+
layers: LayerSelector[];
|
|
11227
|
+
} |
|
|
11228
|
+
/** Shifts the `["-", ["zoom"], offset]` density term inside the matched layers' filters. */
|
|
11229
|
+
{
|
|
11230
|
+
type: 'zoomOffset';
|
|
11231
|
+
layers: LayerSelector[];
|
|
11232
|
+
};
|
|
11233
|
+
/** @ignore */
|
|
11234
|
+
type KnobDefinition = {
|
|
11235
|
+
kind: StylingKnobKind;
|
|
11236
|
+
description: string;
|
|
11237
|
+
range?: StylingKnobRange;
|
|
11238
|
+
appliesTo: StylingKnobAppliesTo;
|
|
11239
|
+
mechanisms: KnobMechanism[];
|
|
11240
|
+
};
|
|
11241
|
+
/**
|
|
11242
|
+
* The styling knob catalogue: what the SDK can restyle on a TomTom standard style, and how.
|
|
11243
|
+
*
|
|
11244
|
+
* Ids are public API — additive only. Ranges follow TomTom Map Maker's validated grammar (factors
|
|
11245
|
+
* 0.5–1.5 in 0.1 steps) so a value that looks right in the designer's tool looks right here.
|
|
11246
|
+
* @ignore
|
|
11247
|
+
*/
|
|
11248
|
+
declare const knobDefinitions: {
|
|
11249
|
+
readonly 'labels.sizeFactor': KnobDefinition;
|
|
11250
|
+
readonly 'symbols.sizeFactor': KnobDefinition;
|
|
11251
|
+
readonly 'roads.widthFactor': KnobDefinition;
|
|
11252
|
+
readonly 'pois.sizeFactor': KnobDefinition;
|
|
11253
|
+
readonly 'pois.minZoom': {
|
|
11254
|
+
readonly kind: "number";
|
|
11255
|
+
readonly description: "Zoom level from which base-map POIs appear (the style default is 6).";
|
|
11256
|
+
readonly range: {
|
|
11257
|
+
readonly min: 3;
|
|
11258
|
+
readonly max: 18;
|
|
11259
|
+
readonly step: 1;
|
|
11260
|
+
};
|
|
11261
|
+
readonly appliesTo: "tomtom-styles";
|
|
11262
|
+
readonly mechanisms: [{
|
|
11263
|
+
readonly type: "minZoom";
|
|
11264
|
+
readonly layers: [{
|
|
11265
|
+
readonly idExcludes: ["micro"];
|
|
11266
|
+
readonly metadataGroups?: string[];
|
|
11267
|
+
readonly layerTypes?: import("maplibre-gl").LayerSpecification["type"][];
|
|
11268
|
+
readonly sources?: string[];
|
|
11269
|
+
readonly sourceTypes?: string[];
|
|
11270
|
+
readonly sourceLayers?: string[];
|
|
11271
|
+
readonly idIncludes?: string[];
|
|
11272
|
+
}];
|
|
11273
|
+
}];
|
|
11274
|
+
};
|
|
11275
|
+
readonly 'pois.zoomShift': {
|
|
11276
|
+
readonly kind: "number";
|
|
11277
|
+
readonly description: "Shifts the zoom at which each POI appears: positive = later and sparser, negative = earlier and denser.";
|
|
11278
|
+
readonly range: {
|
|
11279
|
+
readonly min: -3;
|
|
11280
|
+
readonly max: 3;
|
|
11281
|
+
readonly step: 1;
|
|
11282
|
+
};
|
|
11283
|
+
readonly appliesTo: "tomtom-styles";
|
|
11284
|
+
readonly mechanisms: [{
|
|
11285
|
+
readonly type: "zoomOffset";
|
|
11286
|
+
readonly layers: [LayerSelector];
|
|
11287
|
+
}];
|
|
11288
|
+
};
|
|
11289
|
+
readonly 'pois.labelColor': KnobDefinition;
|
|
11290
|
+
readonly 'pois.labelOutlineColor': KnobDefinition;
|
|
11291
|
+
readonly 'pois.microMarkers': KnobDefinition;
|
|
11292
|
+
readonly 'roads.exitNumbers': KnobDefinition;
|
|
11293
|
+
readonly 'roads.shields': KnobDefinition;
|
|
11294
|
+
readonly 'roads.arrows': KnobDefinition;
|
|
11295
|
+
readonly 'roads.restricted': KnobDefinition;
|
|
11296
|
+
readonly 'roads.underConstruction': KnobDefinition;
|
|
11297
|
+
readonly 'buildings.footprints': KnobDefinition;
|
|
11298
|
+
readonly 'buildings.3d': KnobDefinition;
|
|
11299
|
+
readonly 'traffic.flow.freeColor': KnobDefinition;
|
|
11300
|
+
readonly 'traffic.flow.slowColor': KnobDefinition;
|
|
11301
|
+
readonly 'traffic.flow.queueingColor': KnobDefinition;
|
|
11302
|
+
readonly 'traffic.flow.stationaryColor': KnobDefinition;
|
|
11303
|
+
readonly 'traffic.flow.closedColor': KnobDefinition;
|
|
11304
|
+
readonly 'traffic.flow.widthFactor': KnobDefinition;
|
|
11305
|
+
readonly 'traffic.incidents.minorColor': KnobDefinition;
|
|
11306
|
+
readonly 'traffic.incidents.moderateColor': KnobDefinition;
|
|
11307
|
+
readonly 'traffic.incidents.majorColor': KnobDefinition;
|
|
11308
|
+
readonly 'traffic.incidents.closedColor': KnobDefinition;
|
|
11309
|
+
readonly 'traffic.incidents.widthFactor': KnobDefinition;
|
|
11310
|
+
};
|
|
11311
|
+
/**
|
|
11312
|
+
* The id of a styling knob — see {@link StylingModule.describe} for what each one does.
|
|
11313
|
+
*
|
|
11314
|
+
* @group Map Styling
|
|
11315
|
+
*/
|
|
11316
|
+
type StylingKnobId = keyof typeof knobDefinitions;
|
|
11317
|
+
/**
|
|
11318
|
+
* Every styling knob id, in catalogue order.
|
|
11319
|
+
*
|
|
11320
|
+
* @group Map Styling
|
|
11321
|
+
*/
|
|
11322
|
+
export declare const stylingKnobIds: StylingKnobId[];
|
|
11323
|
+
type ValueOfKind<KIND extends StylingKnobKind> = KIND extends 'toggle' ? boolean : KIND extends 'color' ? string : number;
|
|
11324
|
+
/**
|
|
11325
|
+
* The value type a given styling knob takes.
|
|
11326
|
+
*
|
|
11327
|
+
* @group Map Styling
|
|
11328
|
+
*/
|
|
11329
|
+
type StylingKnobValueOf<ID extends StylingKnobId> = ValueOfKind<(typeof knobDefinitions)[ID]['kind']>;
|
|
11330
|
+
//#endregion
|
|
11331
|
+
//#region src/styling/StylingModule.d.ts
|
|
11332
|
+
/**
|
|
11333
|
+
* Event surface of {@link StylingModule}: it owns no map features, so only the lifecycle half is
|
|
11334
|
+
* live — `config-change` fires with the full {@link StylingSettings} after every knob change.
|
|
11335
|
+
*
|
|
11336
|
+
* @group Map Styling
|
|
11337
|
+
*/
|
|
11338
|
+
export type StylingEvents = CombinedEvents<MapGeoJSONFeature, StylingSettings, never>;
|
|
11339
|
+
/**
|
|
11340
|
+
* Semantic styling of the base map, traffic and POIs — the tier between hiding a layer group and
|
|
11341
|
+
* hand-editing MapLibre layers.
|
|
11342
|
+
*
|
|
11343
|
+
* Every adjustable thing is a **knob** with a stable id, a kind, a range and a default read from the
|
|
11344
|
+
* loaded style. {@link describe} returns that catalogue as data, so a UI or an AI agent can build
|
|
11345
|
+
* controls, validate values and diff state without knowing anything about the style's layers.
|
|
11346
|
+
*
|
|
11347
|
+
* @remarks
|
|
11348
|
+
* **Which styles a knob works on** is `appliesTo` in the catalogue. `any-style` knobs (sizes,
|
|
11349
|
+
* widths) wrap whatever the style already does — `text-size: E` becomes `["*", 1.3, E]` — so they
|
|
11350
|
+
* work on a custom style too. `tomtom-styles` knobs (toggles, colours) reach their layers through
|
|
11351
|
+
* the TomTom styles this SDK version is verified against; on any other style they report
|
|
11352
|
+
* `available: false`, warn once and do nothing rather than failing silently.
|
|
11353
|
+
*
|
|
11354
|
+
* **Style changes.** Settings are re-applied after every `setStyle` that carries state over, on top of
|
|
11355
|
+
* whatever the other modules restored, and dropped on a clean switch (`resetState: true`).
|
|
11356
|
+
*
|
|
11357
|
+
* **Interplay with other modules.** Toggles set layer visibility, as {@link BaseMapModule} and
|
|
11358
|
+
* {@link POIsModule} do for whole groups; the later call wins. `pois.zoomShift` rewrites the POI
|
|
11359
|
+
* layer filters, which {@link POIsModule.filterCategories} also narrows: the two compose, so either
|
|
11360
|
+
* can be set at any time and neither drops the other.
|
|
11361
|
+
*
|
|
11362
|
+
* @example
|
|
11363
|
+
* ```typescript
|
|
11364
|
+
* import { StylingModule } from '@tomtom-org/maps-sdk/map';
|
|
11365
|
+
*
|
|
11366
|
+
* const styling = await StylingModule.get(map);
|
|
11367
|
+
* styling.set('labels.sizeFactor', 1.2);
|
|
11368
|
+
* styling.set('roads.exitNumbers', false);
|
|
11369
|
+
* styling.set('traffic.flow.slowColor', '#f59e0b');
|
|
11370
|
+
*
|
|
11371
|
+
* // Everything a control panel or an agent needs, as data:
|
|
11372
|
+
* for (const knob of styling.describe().knobs) {
|
|
11373
|
+
* console.log(knob.id, knob.kind, knob.range, knob.current);
|
|
11374
|
+
* }
|
|
11375
|
+
*
|
|
11376
|
+
* // Serializable, diffable, re-applicable:
|
|
11377
|
+
* const saved = styling.getConfig();
|
|
11378
|
+
* styling.resetConfig();
|
|
11379
|
+
* styling.applyConfig(saved);
|
|
11380
|
+
* ```
|
|
11381
|
+
*
|
|
11382
|
+
* @see [Map Styling Guide](https://docs.tomtom.com/maps-sdk-js/guides/map/styling)
|
|
11383
|
+
*
|
|
11384
|
+
* @group Map Styling
|
|
11385
|
+
*/
|
|
11386
|
+
export declare class StylingModule extends AbstractStyleOwnedMapModule<Record<string, never>, StylingSettings> {
|
|
11387
|
+
private originalValues;
|
|
11388
|
+
private styleSources;
|
|
11389
|
+
private resolved;
|
|
11390
|
+
private scaleKnobsByTarget;
|
|
11391
|
+
private warned;
|
|
11392
|
+
/**
|
|
11393
|
+
* Retrieves the styling module of the given map, creating it on first use.
|
|
11394
|
+
*
|
|
11395
|
+
* @param map - The TomTomMap instance to style.
|
|
11396
|
+
* @param settings - Optional knob values to apply right away, e.g. restored from storage.
|
|
11397
|
+
* @returns A promise that resolves once the map style is loaded and the settings are applied.
|
|
11398
|
+
*
|
|
11399
|
+
* @remarks
|
|
11400
|
+
* **Instances:** the module styles the sources and layers the map style already provides, so
|
|
11401
|
+
* every map has exactly one — a second `get()` returns the same instance, with the given
|
|
11402
|
+
* settings applied on top of what it already holds.
|
|
11403
|
+
*
|
|
11404
|
+
* @example
|
|
11405
|
+
* ```typescript
|
|
11406
|
+
* const styling = await StylingModule.get(map, { 'labels.sizeFactor': 1.2 });
|
|
11407
|
+
* ```
|
|
11408
|
+
*/
|
|
11409
|
+
static get(map: TomTomMap, settings?: StylingSettings): Promise<StylingModule>;
|
|
11410
|
+
private constructor();
|
|
11411
|
+
/**
|
|
11412
|
+
* @ignore
|
|
11413
|
+
*/
|
|
11414
|
+
protected styleChangePriority(): number;
|
|
11415
|
+
/**
|
|
11416
|
+
* @ignore
|
|
11417
|
+
*/
|
|
11418
|
+
protected _initSourcesWithLayers(): Record<string, never>;
|
|
11419
|
+
/**
|
|
11420
|
+
* @ignore
|
|
11421
|
+
*/
|
|
11422
|
+
protected _applyConfig(settings: StylingSettings | undefined): StylingSettings | undefined;
|
|
11423
|
+
/**
|
|
11424
|
+
* The styling catalogue for the loaded style: every knob with its kind, range, default, current
|
|
11425
|
+
* value and how many layers it reaches.
|
|
11426
|
+
*
|
|
11427
|
+
* @remarks
|
|
11428
|
+
* Meant to be consumed as data — build a control panel from it, hand it to an agent, or diff two
|
|
11429
|
+
* calls. Knob ids and the shape of the entries are public API and change additively only.
|
|
11430
|
+
*
|
|
11431
|
+
* @example
|
|
11432
|
+
* ```typescript
|
|
11433
|
+
* const { knobs } = styling.describe();
|
|
11434
|
+
* const sliders = knobs.filter((knob) => knob.kind === 'factor' && knob.available);
|
|
11435
|
+
* ```
|
|
11436
|
+
*/
|
|
11437
|
+
describe(): StylingCatalogue;
|
|
11438
|
+
/**
|
|
11439
|
+
* The value a knob currently has: the override if one is set, otherwise the style's own default.
|
|
11440
|
+
*
|
|
11441
|
+
* @param id - The knob to read.
|
|
11442
|
+
* @returns The current value, or `undefined` when the style defines it as a data-driven
|
|
11443
|
+
* expression that no single value stands for.
|
|
11444
|
+
*
|
|
11445
|
+
* @example
|
|
11446
|
+
* ```typescript
|
|
11447
|
+
* styling.get('labels.sizeFactor'); // 1 until set
|
|
11448
|
+
* ```
|
|
11449
|
+
*/
|
|
11450
|
+
get<ID extends StylingKnobId>(id: ID): StylingKnobValueOf<ID> | undefined;
|
|
11451
|
+
/**
|
|
11452
|
+
* Sets one knob. The value is validated against the knob's kind and range before anything is
|
|
11453
|
+
* touched, and applied to every layer the knob reaches.
|
|
11454
|
+
*
|
|
11455
|
+
* @param id - The knob to set; see {@link describe} for the catalogue.
|
|
11456
|
+
* @param value - A number for `factor`/`number` knobs (within `range`), a boolean for `toggle`
|
|
11457
|
+
* knobs, a CSS colour string for `color` knobs.
|
|
11458
|
+
* @throws `RangeError` when the value is not valid for the knob; `Error` for an unknown id.
|
|
11459
|
+
*
|
|
11460
|
+
* @example
|
|
11461
|
+
* ```typescript
|
|
11462
|
+
* styling.set('roads.widthFactor', 1.3);
|
|
11463
|
+
* styling.set('buildings.3d', true);
|
|
11464
|
+
* styling.set('traffic.flow.stationaryColor', 'hsl(0, 100%, 40%)');
|
|
11465
|
+
* ```
|
|
11466
|
+
*/
|
|
11467
|
+
set<ID extends StylingKnobId>(id: ID, value: StylingKnobValueOf<ID>): void;
|
|
11468
|
+
/**
|
|
11469
|
+
* Restores the style's own values for one knob, or for all of them.
|
|
11470
|
+
*
|
|
11471
|
+
* @param id - The knob to reset; omit to reset every knob (same as {@link resetConfig}).
|
|
11472
|
+
*
|
|
11473
|
+
* @example
|
|
11474
|
+
* ```typescript
|
|
11475
|
+
* styling.reset('labels.sizeFactor');
|
|
11476
|
+
* styling.reset(); // back to the style as shipped
|
|
11477
|
+
* ```
|
|
11478
|
+
*/
|
|
11479
|
+
reset(id?: StylingKnobId): void;
|
|
11480
|
+
/**
|
|
11481
|
+
* Lifecycle events of this module. The module owns no map features, so there are no user
|
|
11482
|
+
* interaction events; `config-change` fires with the full settings after every knob change.
|
|
11483
|
+
*
|
|
11484
|
+
* @example
|
|
11485
|
+
* ```typescript
|
|
11486
|
+
* styling.events.on('config-change', (settings) => localStorage.setItem('styling', JSON.stringify(settings)));
|
|
11487
|
+
* ```
|
|
11488
|
+
*/
|
|
11489
|
+
get events(): StylingEvents;
|
|
11490
|
+
private indexStyle;
|
|
11491
|
+
private resolveMechanism;
|
|
11492
|
+
private capture;
|
|
11493
|
+
private originalValueOf;
|
|
11494
|
+
private refreshKnob;
|
|
11495
|
+
private refreshMechanism;
|
|
11496
|
+
private refreshVisibility;
|
|
11497
|
+
private refreshMinZoom;
|
|
11498
|
+
private refreshZoomOffset;
|
|
11499
|
+
private refreshScaledProperty;
|
|
11500
|
+
private refreshColor;
|
|
11501
|
+
private setProperty;
|
|
11502
|
+
private describeKnob;
|
|
11503
|
+
private defaultOf;
|
|
11504
|
+
private assertKnob;
|
|
11505
|
+
private validate;
|
|
11506
|
+
private warnOnce;
|
|
11507
|
+
}
|
|
11508
|
+
//#endregion
|
|
10245
11509
|
//#region src/traffic/types/trafficAreaAnalyticsConfig.d.ts
|
|
10246
11510
|
/**
|
|
10247
11511
|
* A single stop in an analytics color ramp.
|
|
@@ -11324,7 +12588,6 @@ type TrafficFlowSourcesWithLayers = {
|
|
|
11324
12588
|
* @group Traffic Flow
|
|
11325
12589
|
*/
|
|
11326
12590
|
export declare class TrafficFlowModule extends AbstractStyleOwnedMapModule<TrafficFlowSourcesWithLayers, FlowConfig> {
|
|
11327
|
-
private originalFilters;
|
|
11328
12591
|
/**
|
|
11329
12592
|
* Retrieves a TrafficFlowModule instance for the given map.
|
|
11330
12593
|
*
|
|
@@ -12078,7 +13341,6 @@ type TrafficIncidentsSourcesWithLayers = {
|
|
|
12078
13341
|
* @group Traffic Incidents
|
|
12079
13342
|
*/
|
|
12080
13343
|
export declare class TrafficIncidentsModule extends AbstractStyleOwnedMapModule<TrafficIncidentsSourcesWithLayers, IncidentsConfig> {
|
|
12081
|
-
private originalFilters;
|
|
12082
13344
|
/**
|
|
12083
13345
|
* Retrieves a TrafficIncidentsModule instance for the given map.
|
|
12084
13346
|
*
|
|
@@ -12402,4 +13664,4 @@ export declare const calculatePaddedCenter: (options: CalculateMapCenterOptions)
|
|
|
12402
13664
|
*/
|
|
12403
13665
|
export declare const calculateFittingBBox: (options: CalculateFittingBBoxOptions) => BBox | null;
|
|
12404
13666
|
//#endregion
|
|
12405
|
-
export type { AREA_ANALYTICS_DEFAULTS, AreaAnalyticsBeforeLayerConfig, AreaAnalyticsColorStop, AreaAnalyticsColorStopsConfig, AreaAnalyticsColorTheme, AreaAnalyticsDisplayMode, AreaAnalyticsHeightConfig, AreaAnalyticsMetricConfig, AreaAnalyticsMetricFilter, AreaAnalyticsRegionPolygonConfig, AreaAnalyticsValueType, AvailabilityLevel, BeforeLayerConfig, ByIdOrIndex, CSSCursor, ChargingSpeedIconMapping, ChargingStopIconConfig, ChargingStopIconMapping, ChargingStopTextConfig, ChargingStopsConfig, CleanEventStateOptions, CleanEventStatesOptions, ClickEventType, CustomImage, DefaultPlaceIconConfig, DisplayRouteProps, DisplayRouteRelatedProps, DisplayRouteSummaries, DisplayRouteSummary, DisplayRouteSummaryProps, EVAvailabilityConfig, EventHandlerConfig, EventHandlerCursorConfig, EventType, FilterShowMode, FilterablePOICategory, GeoJSONSourcesWithLayers, HasAdditionalLayersConfig, HasBeforeID, HillshadeModuleConfig, HoverEventType, IncidentFocusStyle, LayerSpecFilter, LayerSpecTemplate, LayerSpecWithSource, LightDark, MapEventsConfig, MapFont, MapModuleCommonConfig, MapStyleLayerID, POIsModuleConfig, POIsModuleFeature, PlaceConnectionDisplay, PlaceConnectionLayerName, PlaceConnectionsConfig, PlaceConnectionsLayersConfig, PlaceIconConfig, PlaceLayerName, PlaceLayersConfig, PlaceTextConfig, PlacesModuleConfig, PlacesTheme, PlanningWaypoint, PutEventStateOptions, RouteLayersConfig, RouteStateProps, RouteTheme, RouteWaypointSize, RouteWidth, RoutingModuleConfig, SVGIconStyleOptions, SourceWithLayerIDs, SourceWithLayers, SourcesWithLayers, StyleSourcesWithLayers, SupportsEvents, SymbolLayerSpecWithoutSource, ToBeAddedLayerSpec, ToBeAddedLayerSpecTemplate, ToBeAddedLayerSpecWithoutSource, TrafficAreaAnalyticsConfig, TrafficIncidentOverlayConfig, UserEventHandler, ValuesFilter, WaypointsConfig };
|
|
13667
|
+
export type { AREA_ANALYTICS_DEFAULTS, AreaAnalyticsBeforeLayerConfig, AreaAnalyticsColorStop, AreaAnalyticsColorStopsConfig, AreaAnalyticsColorTheme, AreaAnalyticsDisplayMode, AreaAnalyticsHeightConfig, AreaAnalyticsMetricConfig, AreaAnalyticsMetricFilter, AreaAnalyticsRegionPolygonConfig, AreaAnalyticsValueType, AvailabilityLevel, BeforeLayerConfig, BespokeSectionType, ByIdOrIndex, CSSCursor, ChargingSpeedIconMapping, ChargingStopIconConfig, ChargingStopIconMapping, ChargingStopTextConfig, ChargingStopsConfig, CleanEventStateOptions, CleanEventStatesOptions, ClickEventType, CustomImage, DefaultPlaceIconConfig, DisplayRouteProps, DisplayRouteRelatedProps, DisplayRouteSummaries, DisplayRouteSummary, DisplayRouteSummaryProps, DrawnSectionType, EVAvailabilityConfig, EventHandlerConfig, EventHandlerCursorConfig, EventType, FilterShowMode, FilterablePOICategory, GeneratedSectionType, GeoJSONSourcesWithLayers, HasAdditionalLayersConfig, HasBeforeID, HillshadeModuleConfig, HoverEventType, IncidentFocusStyle, LayerSpecFilter, LayerSpecTemplate, LayerSpecWithSource, LightDark, MapEventsConfig, MapFont, MapModuleCommonConfig, MapStyleLayerID, POIsModuleConfig, POIsModuleFeature, PlaceConnectionDisplay, PlaceConnectionLayerName, PlaceConnectionsConfig, PlaceConnectionsLayersConfig, PlaceIconConfig, PlaceLayerName, PlaceLayersConfig, PlaceTextConfig, PlacesModuleConfig, PlacesTheme, PlanningWaypoint, PutEventStateOptions, RouteLayersConfig, RouteStateProps, RouteTheme, RouteWaypointSize, RouteWidth, RoutingModuleConfig, SVGIconStyleOptions, SectionDisplayConfig, SectionDrawStyle, SectionIconConfig, SectionKnobName, SectionKnobOf, SectionLineLayerName, SectionLinePattern, SectionSignConfig, SectionSignLayerName, SectionSignPriority, SectionSignUnit, SectionSourceKey, SectionSymbolLayerName, SectionsDisplayConfig, SourceWithLayerIDs, SourceWithLayers, SourcesWithLayers, StyleSourcesWithLayers, StylingCatalogue, StylingKnobAppliesTo, StylingKnobDescriptor, StylingKnobId, StylingKnobKind, StylingKnobRange, StylingKnobValue, StylingKnobValueOf, StylingSettings, SupportsEvents, SymbolLayerSpecWithoutSource, ToBeAddedLayerSpec, ToBeAddedLayerSpecTemplate, ToBeAddedLayerSpecWithoutSource, TrafficAreaAnalyticsConfig, TrafficIncidentOverlayConfig, UserEventHandler, ValuesFilter, WaypointsConfig };
|