@tomtom-org/maps-sdk 0.54.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 +28 -0
- package/core/dist/core.es.js +1 -1
- package/core/dist/core.es.js.map +1 -1
- package/core/dist/index.d.ts +7 -7
- package/map/dist/index.d.ts +1349 -133
- 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 +1 -1
- package/services/dist/index.d.ts +79 -167
- 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.
|
|
@@ -3612,6 +3635,61 @@ export declare class CombinedEvents<T, CFG, TShown = never, WHERE_SCOPE = never>
|
|
|
3612
3635
|
off(type: EventType | 'config-change' | 'shown-features'): void;
|
|
3613
3636
|
}
|
|
3614
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
|
|
3615
3693
|
//#region src/shared/AbstractMapModule.d.ts
|
|
3616
3694
|
/**
|
|
3617
3695
|
* How a module builds user events over some of its sources.
|
|
@@ -3707,6 +3785,17 @@ export declare abstract class AbstractMapModule<SOURCES_WITH_LAYERS extends Sour
|
|
|
3707
3785
|
* @ignore
|
|
3708
3786
|
*/
|
|
3709
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;
|
|
3710
3799
|
/**
|
|
3711
3800
|
* Per-concrete-class instance counter. WeakMap-keyed so unloaded classes can be GC'd.
|
|
3712
3801
|
* @ignore
|
|
@@ -3725,6 +3814,14 @@ export declare abstract class AbstractMapModule<SOURCES_WITH_LAYERS extends Sour
|
|
|
3725
3814
|
* @param config Optional configuration to initialize directly as soon as the map is ready.
|
|
3726
3815
|
*/
|
|
3727
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;
|
|
3728
3825
|
/**
|
|
3729
3826
|
* Initializes the sources with layers of this module.
|
|
3730
3827
|
* @param config The optional configuration for the module.
|
|
@@ -3996,6 +4093,106 @@ export declare abstract class AbstractDataOwnedMapModule<SOURCES_WITH_LAYERS ext
|
|
|
3996
4093
|
*/
|
|
3997
4094
|
export declare abstract class AbstractStyleOwnedMapModule<SOURCES_WITH_LAYERS extends StyleSourcesWithLayers, CFG extends MapModuleCommonConfig | undefined = undefined> extends AbstractMapModule<SOURCES_WITH_LAYERS, CFG> {}
|
|
3998
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
|
|
3999
4196
|
//#region src/shared/layers/commonLayerProps.d.ts
|
|
4000
4197
|
/**
|
|
4001
4198
|
* Bold font face used in the TomTom map style.
|
|
@@ -6533,7 +6730,7 @@ export type MapStylePOICategory = keyof typeof mapDisplayPoiCategoryMappings;
|
|
|
6533
6730
|
/**
|
|
6534
6731
|
* @ignore
|
|
6535
6732
|
*/
|
|
6536
|
-
export declare const toBaseMapPOICategory: (category: POICategory) => string;
|
|
6733
|
+
export declare const toBaseMapPOICategory: (category: POICategory) => string | undefined;
|
|
6537
6734
|
/**
|
|
6538
6735
|
* The deduplicated set of base-map POI categories — the right-hand side of
|
|
6539
6736
|
* {@link completeMapDisplayPoiCategoryMappings}. Each value names the
|
|
@@ -8312,7 +8509,6 @@ type PoIsSourcesAndLayers = {
|
|
|
8312
8509
|
*/
|
|
8313
8510
|
export declare class POIsModule extends AbstractStyleOwnedMapModule<PoIsSourcesAndLayers, POIsModuleConfig> {
|
|
8314
8511
|
private categoriesFilter?;
|
|
8315
|
-
private originalFilter?;
|
|
8316
8512
|
/**
|
|
8317
8513
|
* Retrieves a POIsModule instance for the given map.
|
|
8318
8514
|
*
|
|
@@ -8504,7 +8700,282 @@ export declare class POIsModule extends AbstractStyleOwnedMapModule<PoIsSourcesA
|
|
|
8504
8700
|
get events(): CombinedEvents<POIsModuleFeature, POIsModuleConfig, never>;
|
|
8505
8701
|
}
|
|
8506
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
|
|
8507
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`;
|
|
8508
8979
|
/**
|
|
8509
8980
|
* Detailed configuration for the visual appearance of route layers on the map with the MapLibre specification.
|
|
8510
8981
|
*
|
|
@@ -8603,15 +9074,18 @@ type RouteLayersConfig = {
|
|
|
8603
9074
|
routeChargingStopSymbol?: Partial<ToBeAddedLayerSpecTemplate<SymbolLayerSpecification>>;
|
|
8604
9075
|
} & HasAdditionalLayersConfig;
|
|
8605
9076
|
/**
|
|
8606
|
-
* Layer specifications for
|
|
9077
|
+
* Layer specifications for route sections, keyed by section type.
|
|
8607
9078
|
*
|
|
8608
9079
|
* @remarks
|
|
8609
|
-
* 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.
|
|
8610
9084
|
*
|
|
8611
|
-
*
|
|
8612
|
-
*
|
|
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.
|
|
8613
9087
|
*/
|
|
8614
|
-
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; } & {
|
|
8615
9089
|
/**
|
|
8616
9090
|
* Ferry crossing section layers.
|
|
8617
9091
|
*
|
|
@@ -8640,7 +9114,7 @@ type RouteLayersConfig = {
|
|
|
8640
9114
|
* @remarks
|
|
8641
9115
|
* Highlights route segments affected by traffic incidents or disruptions.
|
|
8642
9116
|
*/
|
|
8643
|
-
|
|
9117
|
+
traffic?: {
|
|
8644
9118
|
/**
|
|
8645
9119
|
* Symbol layer used to mark the start of a jam on the route.
|
|
8646
9120
|
*
|
|
@@ -9017,73 +9491,283 @@ type RouteTheme = {
|
|
|
9017
9491
|
waypointSize?: RouteWaypointSize;
|
|
9018
9492
|
};
|
|
9019
9493
|
/**
|
|
9020
|
-
*
|
|
9494
|
+
* The icon drawn on a route section.
|
|
9021
9495
|
*
|
|
9022
9496
|
* @remarks
|
|
9023
|
-
*
|
|
9024
|
-
*
|
|
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.
|
|
9025
9499
|
*
|
|
9026
9500
|
* @group Routing
|
|
9027
9501
|
*/
|
|
9028
|
-
type
|
|
9502
|
+
type SectionIconConfig = {
|
|
9029
9503
|
/**
|
|
9030
|
-
*
|
|
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.
|
|
9031
9510
|
*
|
|
9032
9511
|
* @remarks
|
|
9033
|
-
*
|
|
9034
|
-
*
|
|
9512
|
+
* - `center`: one icon at the middle of each section.
|
|
9513
|
+
* - `along`: icons repeated along the section.
|
|
9035
9514
|
*
|
|
9036
|
-
*
|
|
9037
|
-
*
|
|
9038
|
-
* - `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.
|
|
9039
9517
|
*
|
|
9040
|
-
* @defaultValue `"
|
|
9518
|
+
* @defaultValue `"center"`
|
|
9041
9519
|
*/
|
|
9042
|
-
|
|
9520
|
+
placement?: 'center' | 'along';
|
|
9043
9521
|
/**
|
|
9044
|
-
*
|
|
9522
|
+
* Icon scale, where `1` is the sprite image's own size.
|
|
9045
9523
|
*
|
|
9046
|
-
* @
|
|
9047
|
-
* * Provides high-level styling options that affect the overall appearance of the route,
|
|
9048
|
-
* such as the primary color used for route lines and waypoints.
|
|
9049
|
-
* * Can be overwritten by more specific layer styling configurations.
|
|
9524
|
+
* @defaultValue 1
|
|
9050
9525
|
*/
|
|
9051
|
-
|
|
9526
|
+
size?: number;
|
|
9527
|
+
};
|
|
9528
|
+
type SectionKnobs = {
|
|
9052
9529
|
/**
|
|
9053
|
-
*
|
|
9530
|
+
* Whether the section is drawn at all.
|
|
9054
9531
|
*
|
|
9055
9532
|
* @remarks
|
|
9056
|
-
*
|
|
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.
|
|
9057
9539
|
*/
|
|
9058
|
-
|
|
9540
|
+
visible?: boolean;
|
|
9059
9541
|
/**
|
|
9060
|
-
*
|
|
9061
|
-
*
|
|
9062
|
-
* @remarks
|
|
9063
|
-
* Controls how charging stops source data and/or layer configs are processed to rendering them the map.
|
|
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.
|
|
9064
9544
|
*/
|
|
9065
|
-
|
|
9545
|
+
color?: string;
|
|
9066
9546
|
/**
|
|
9067
|
-
*
|
|
9068
|
-
*
|
|
9069
|
-
* @remarks
|
|
9070
|
-
* Summary bubbles show key route information (distance, duration, traffic delay)
|
|
9071
|
-
* as visual overlays positioned along the route.
|
|
9547
|
+
* Line opacity, 0 to 1. Sections default to partial opacity so the route line stays readable
|
|
9548
|
+
* underneath.
|
|
9072
9549
|
*/
|
|
9073
|
-
|
|
9074
|
-
/**
|
|
9075
|
-
* Controls the visibility of route summary bubbles on the map.
|
|
9076
|
-
*
|
|
9077
|
-
* @defaultValue true
|
|
9078
|
-
*/
|
|
9079
|
-
visible?: boolean;
|
|
9080
|
-
};
|
|
9550
|
+
opacity?: number;
|
|
9081
9551
|
/**
|
|
9082
|
-
*
|
|
9083
|
-
|
|
9084
|
-
|
|
9085
|
-
|
|
9086
|
-
*
|
|
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.
|
|
9728
|
+
*
|
|
9729
|
+
* @remarks
|
|
9730
|
+
* Controls how charging stops source data and/or layer configs are processed to rendering them the map.
|
|
9731
|
+
*/
|
|
9732
|
+
chargingStops?: ChargingStopsConfig;
|
|
9733
|
+
/**
|
|
9734
|
+
* Configuration for the route summary bubbles displayed on the map.
|
|
9735
|
+
*
|
|
9736
|
+
* @remarks
|
|
9737
|
+
* Summary bubbles show key route information (distance, duration, traffic delay)
|
|
9738
|
+
* as visual overlays positioned along the route.
|
|
9739
|
+
*/
|
|
9740
|
+
summaryBubbles?: {
|
|
9741
|
+
/**
|
|
9742
|
+
* Controls the visibility of route summary bubbles on the map.
|
|
9743
|
+
*
|
|
9744
|
+
* @defaultValue true
|
|
9745
|
+
*/
|
|
9746
|
+
visible?: boolean;
|
|
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;
|
|
9765
|
+
/**
|
|
9766
|
+
* Custom layer styling configuration.
|
|
9767
|
+
*
|
|
9768
|
+
* @remarks
|
|
9769
|
+
* * Overrides the default layer styling with custom specifications.
|
|
9770
|
+
* * You must provide complete layer specifications for any layers you wish to customize.
|
|
9087
9771
|
* * You can still reuse the default configurations if you want incremental changes. See: defaultRoutingLayers.
|
|
9088
9772
|
* * Any layer not specified will continue to use its default styling.
|
|
9089
9773
|
* * Use this only if you need fine MapLibre control on how some parts of the route are displayed.
|
|
@@ -9196,10 +9880,14 @@ export declare const getLineOutlineWidth: (size?: RouteWidth) => ExpressionSpeci
|
|
|
9196
9880
|
*/
|
|
9197
9881
|
export declare const getWaypointIconSize: (size?: RouteWaypointSize) => ExpressionSpecification;
|
|
9198
9882
|
/**
|
|
9199
|
-
* 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.
|
|
9200
9888
|
* @ignore
|
|
9201
9889
|
*/
|
|
9202
|
-
export declare const
|
|
9890
|
+
export declare const getSectionHaloWidth: (size?: RouteWidth) => ExpressionSpecification;
|
|
9203
9891
|
/**
|
|
9204
9892
|
* Returns the instruction line width expression for the given size preset.
|
|
9205
9893
|
* @ignore
|
|
@@ -9514,6 +10202,75 @@ type DisplayRouteSummary = Feature<Point, DisplayRouteSummaryProps>;
|
|
|
9514
10202
|
*/
|
|
9515
10203
|
type DisplayRouteSummaries = FeatureCollection<Point, DisplayRouteSummaryProps>;
|
|
9516
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
|
|
9517
10274
|
//#region src/routing/types/routeSections.d.ts
|
|
9518
10275
|
/**
|
|
9519
10276
|
* Display-ready section properties combining base section data with route context.
|
|
@@ -9677,62 +10434,6 @@ type DisplayTrafficSectionProps = DisplaySectionProps & TrafficSectionProps & {
|
|
|
9677
10434
|
title?: string;
|
|
9678
10435
|
};
|
|
9679
10436
|
//#endregion
|
|
9680
|
-
//#region src/routing/types/guidance.d.ts
|
|
9681
|
-
/**
|
|
9682
|
-
* @ignore
|
|
9683
|
-
*/
|
|
9684
|
-
type DisplayInstructionArrowProps = {
|
|
9685
|
-
lastPointBearingDegrees: number;
|
|
9686
|
-
};
|
|
9687
|
-
/**
|
|
9688
|
-
* @ignore
|
|
9689
|
-
*/
|
|
9690
|
-
type DisplayInstructionArrows = FeatureCollection<Point, Instruction & DisplayInstructionArrowProps & DisplayRouteRelatedProps>;
|
|
9691
|
-
/**
|
|
9692
|
-
* @ignore
|
|
9693
|
-
*/
|
|
9694
|
-
type DisplayInstruction = Feature<LineString, Instruction & DisplayRouteRelatedProps>;
|
|
9695
|
-
/**
|
|
9696
|
-
* @ignore
|
|
9697
|
-
*/
|
|
9698
|
-
type DisplayInstructions = FeatureCollection<LineString, Instruction & DisplayRouteRelatedProps>;
|
|
9699
|
-
//#endregion
|
|
9700
|
-
//#region src/routing/types/planningWaypoint.d.ts
|
|
9701
|
-
/**
|
|
9702
|
-
* Waypoint or placeholder for route planning.
|
|
9703
|
-
*
|
|
9704
|
-
* Represents a point along a route, which can be a full waypoint with position
|
|
9705
|
-
* and properties, or `null` for placeholder positions (e.g., unset waypoints in
|
|
9706
|
-
* a multi-stop route planner UI).
|
|
9707
|
-
*
|
|
9708
|
-
* @remarks
|
|
9709
|
-
* **Use Cases:**
|
|
9710
|
-
* - Route planning interfaces with add/remove waypoint functionality
|
|
9711
|
-
* - Multi-stop delivery route optimization
|
|
9712
|
-
* - Placeholder slots in waypoint arrays
|
|
9713
|
-
* - Optional intermediate stops
|
|
9714
|
-
*
|
|
9715
|
-
* **Waypoint Types:**
|
|
9716
|
-
* - `WaypointLike`: Full waypoint with coordinates and optional properties
|
|
9717
|
-
* - `null`: Placeholder for unset or removed waypoints
|
|
9718
|
-
*
|
|
9719
|
-
* @example
|
|
9720
|
-
* ```typescript
|
|
9721
|
-
* // Array of waypoints with some unset
|
|
9722
|
-
* const waypoints: PlanningWaypoint[] = [
|
|
9723
|
-
* { type: 'Feature', geometry: { type: 'Point', coordinates: [4.9, 52.3] } },
|
|
9724
|
-
* null, // Empty slot for user to add waypoint
|
|
9725
|
-
* { type: 'Feature', geometry: { type: 'Point', coordinates: [4.5, 51.9] } }
|
|
9726
|
-
* ];
|
|
9727
|
-
*
|
|
9728
|
-
* // Filter out null waypoints before routing
|
|
9729
|
-
* const validWaypoints = waypoints.filter(w => w !== null);
|
|
9730
|
-
* ```
|
|
9731
|
-
*
|
|
9732
|
-
* @group Routing
|
|
9733
|
-
*/
|
|
9734
|
-
type PlanningWaypoint = WaypointLike | null;
|
|
9735
|
-
//#endregion
|
|
9736
10437
|
//#region src/routing/types/waypointDisplayProps.d.ts
|
|
9737
10438
|
/**
|
|
9738
10439
|
* @group Routing
|
|
@@ -9870,13 +10571,13 @@ export declare const STOP_DISPLAY_INDEX = "stopDisplayIndex";
|
|
|
9870
10571
|
/**
|
|
9871
10572
|
* @ignore
|
|
9872
10573
|
*/
|
|
9873
|
-
type RoutingSourcesWithLayers = {
|
|
10574
|
+
type RoutingSourcesWithLayers = { [K in SectionSourceKey<GeneratedSectionType>]: GeoJSONSourceWithLayers<RouteSections>; } & {
|
|
9874
10575
|
mainLines: GeoJSONSourceWithLayers<Routes<DisplayRouteProps>>;
|
|
9875
10576
|
waypoints: GeoJSONSourceWithLayers<Waypoints<WaypointDisplayProps>>;
|
|
9876
10577
|
vehicleRestricted: GeoJSONSourceWithLayers<RouteSections>;
|
|
9877
10578
|
incidents: GeoJSONSourceWithLayers<RouteSections<DisplayTrafficSectionProps>>;
|
|
9878
10579
|
ferries: GeoJSONSourceWithLayers<RouteSections>;
|
|
9879
|
-
chargingStops: GeoJSONSourceWithLayers<
|
|
10580
|
+
chargingStops: GeoJSONSourceWithLayers<DisplayChargingStops>;
|
|
9880
10581
|
tollRoads: GeoJSONSourceWithLayers<RouteSections>;
|
|
9881
10582
|
tunnels: GeoJSONSourceWithLayers<RouteSections>;
|
|
9882
10583
|
instructionLines: GeoJSONSourceWithLayers<DisplayInstructions>;
|
|
@@ -9953,7 +10654,7 @@ export type RoutingShownFeatures = {
|
|
|
9953
10654
|
*
|
|
9954
10655
|
* @group Routing
|
|
9955
10656
|
*/
|
|
9956
|
-
export type RoutingEvents = CombinedEvents<MapGeoJSONFeature, RoutingModuleConfig, RoutingShownFeatures> & {
|
|
10657
|
+
export type RoutingEvents = CombinedEvents<MapGeoJSONFeature, RoutingModuleConfig, RoutingShownFeatures> & { [K in SectionSourceKey<GeneratedSectionType>]: UserEvents<RouteSection>; } & {
|
|
9957
10658
|
/** The route lines themselves. */
|
|
9958
10659
|
mainLines: UserEvents<Route<DisplayRouteProps>>;
|
|
9959
10660
|
/** Origin, destination and intermediate stops. */
|
|
@@ -10080,6 +10781,59 @@ export declare class RoutingModule extends AbstractDataOwnedMapModule<RoutingSou
|
|
|
10080
10781
|
* @ignore
|
|
10081
10782
|
*/
|
|
10082
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;
|
|
10083
10837
|
/** @ignore */
|
|
10084
10838
|
protected discardShownData(): void;
|
|
10085
10839
|
/**
|
|
@@ -10244,17 +10998,27 @@ export declare class RoutingModule extends AbstractDataOwnedMapModule<RoutingSou
|
|
|
10244
10998
|
* ```
|
|
10245
10999
|
*/
|
|
10246
11000
|
getShown(): {
|
|
10247
|
-
mainLines: Routes<DisplayRouteProps>;
|
|
10248
|
-
waypoints: Waypoints<WaypointDisplayProps>;
|
|
10249
|
-
incidents: RouteSections<DisplayTrafficSectionProps>;
|
|
10250
|
-
ferries: RouteSections;
|
|
10251
|
-
chargingStops: Waypoints;
|
|
10252
|
-
tollRoads: RouteSections;
|
|
10253
11001
|
tunnels: RouteSections;
|
|
10254
11002
|
vehicleRestricted: RouteSections;
|
|
10255
11003
|
instructionLines: DisplayInstructions;
|
|
10256
11004
|
instructionArrows: DisplayInstructionArrows;
|
|
10257
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;
|
|
10258
11022
|
};
|
|
10259
11023
|
/**
|
|
10260
11024
|
* Unified events interface for the routing module.
|
|
@@ -10288,6 +11052,460 @@ export declare class RoutingModule extends AbstractDataOwnedMapModule<RoutingSou
|
|
|
10288
11052
|
getLayerToRenderLinesUnder(): string;
|
|
10289
11053
|
}
|
|
10290
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
|
|
10291
11509
|
//#region src/traffic/types/trafficAreaAnalyticsConfig.d.ts
|
|
10292
11510
|
/**
|
|
10293
11511
|
* A single stop in an analytics color ramp.
|
|
@@ -11370,7 +12588,6 @@ type TrafficFlowSourcesWithLayers = {
|
|
|
11370
12588
|
* @group Traffic Flow
|
|
11371
12589
|
*/
|
|
11372
12590
|
export declare class TrafficFlowModule extends AbstractStyleOwnedMapModule<TrafficFlowSourcesWithLayers, FlowConfig> {
|
|
11373
|
-
private originalFilters;
|
|
11374
12591
|
/**
|
|
11375
12592
|
* Retrieves a TrafficFlowModule instance for the given map.
|
|
11376
12593
|
*
|
|
@@ -12124,7 +13341,6 @@ type TrafficIncidentsSourcesWithLayers = {
|
|
|
12124
13341
|
* @group Traffic Incidents
|
|
12125
13342
|
*/
|
|
12126
13343
|
export declare class TrafficIncidentsModule extends AbstractStyleOwnedMapModule<TrafficIncidentsSourcesWithLayers, IncidentsConfig> {
|
|
12127
|
-
private originalFilters;
|
|
12128
13344
|
/**
|
|
12129
13345
|
* Retrieves a TrafficIncidentsModule instance for the given map.
|
|
12130
13346
|
*
|
|
@@ -12448,4 +13664,4 @@ export declare const calculatePaddedCenter: (options: CalculateMapCenterOptions)
|
|
|
12448
13664
|
*/
|
|
12449
13665
|
export declare const calculateFittingBBox: (options: CalculateFittingBBoxOptions) => BBox | null;
|
|
12450
13666
|
//#endregion
|
|
12451
|
-
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 };
|