mobility-toolbox-js 3.0.0-beta.7 → 3.0.0-beta.9

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.
Files changed (88) hide show
  1. package/api/HttpAPI.d.ts +31 -0
  2. package/api/RealtimeAPI.d.ts +359 -0
  3. package/api/RealtimeAPI.js +96 -89
  4. package/api/RoutingAPI.d.ts +37 -0
  5. package/api/StopsAPI.d.ts +38 -0
  6. package/api/WebSocketAPI.d.ts +153 -0
  7. package/api/index.d.ts +3 -0
  8. package/api/typedefs.d.ts +178 -0
  9. package/common/controls/StopFinderControlCommon.d.ts +53 -0
  10. package/common/index.d.ts +2 -0
  11. package/common/mixins/RealtimeLayerMixin.d.ts +273 -0
  12. package/common/styles/index.d.ts +4 -0
  13. package/common/styles/realtimeDefaultStyle.d.ts +36 -0
  14. package/common/styles/realtimeDelayStyle.d.ts +12 -0
  15. package/common/styles/realtimeHeadingStyle.d.ts +12 -0
  16. package/common/styles/realtimeSimpleStyle.d.ts +4 -0
  17. package/common/typedefs.d.ts +212 -0
  18. package/common/utils/compareDepartures.d.ts +10 -0
  19. package/common/utils/constants.d.ts +5 -0
  20. package/common/utils/createCanvas.d.ts +10 -0
  21. package/common/utils/createDefaultCopyrightElt.d.ts +5 -0
  22. package/common/utils/createDefaultStopFinderElt.d.ts +5 -0
  23. package/common/utils/createRealtimeFilters.d.ts +12 -0
  24. package/common/utils/debounceDeparturesMessages.d.ts +12 -0
  25. package/common/utils/debounceWebsocketMessages.d.ts +11 -0
  26. package/common/utils/getLayersAsFlatArray.d.ts +3 -0
  27. package/common/utils/getLayersAsFlatArray.js +5 -1
  28. package/common/utils/getMapGlCopyrights.d.ts +17 -0
  29. package/common/utils/getRealtimeModeSuffix.d.ts +9 -0
  30. package/common/utils/getUrlWithParams.d.ts +8 -0
  31. package/common/utils/getVehiclePosition.d.ts +16 -0
  32. package/common/utils/index.d.ts +16 -0
  33. package/common/utils/realtimeConfig.d.ts +64 -0
  34. package/common/utils/removeDuplicate.d.ts +9 -0
  35. package/common/utils/renderTrajectories.d.ts +16 -0
  36. package/common/utils/sortAndFilterDepartures.d.ts +15 -0
  37. package/common/utils/sortByDelay.d.ts +3 -0
  38. package/common/utils/timeUtils.d.ts +23 -0
  39. package/common/utils/toMercatorExtent.d.ts +5 -0
  40. package/iife.d.ts +2 -0
  41. package/index.d.ts +9 -0
  42. package/maplibre/controls/CopyrightControl.d.ts +35 -0
  43. package/maplibre/controls/index.d.ts +1 -0
  44. package/maplibre/index.d.ts +5 -0
  45. package/maplibre/layers/Layer.d.ts +28 -0
  46. package/maplibre/layers/RealtimeLayer.d.ts +160 -0
  47. package/maplibre/layers/RealtimeLayer.js +2 -2
  48. package/maplibre/layers/index.d.ts +2 -0
  49. package/maplibre/utils/getMercatorResolution.d.ts +7 -0
  50. package/maplibre/utils/getSourceCoordinates.d.ts +7 -0
  51. package/maplibre/utils/index.d.ts +2 -0
  52. package/mbt.js +137 -114
  53. package/mbt.js.map +3 -3
  54. package/mbt.min.js +13 -13
  55. package/mbt.min.js.map +3 -3
  56. package/ol/controls/CopyrightControl.d.ts +31 -0
  57. package/ol/controls/CopyrightControl.js +18 -8
  58. package/ol/controls/RoutingControl.d.ts +209 -0
  59. package/ol/controls/RoutingControl.js +3 -0
  60. package/ol/controls/StopFinderControl.d.ts +37 -0
  61. package/ol/controls/StopFinderControl.js +3 -0
  62. package/ol/controls/index.d.ts +3 -0
  63. package/ol/index.d.ts +6 -0
  64. package/ol/layers/MapGlLayer.d.ts +144 -0
  65. package/ol/layers/MapGlLayer.js +3 -1
  66. package/ol/layers/MaplibreLayer.d.ts +63 -0
  67. package/ol/layers/MaplibreStyleLayer.d.ts +235 -0
  68. package/ol/layers/MaplibreStyleLayer.js +1 -1
  69. package/ol/layers/RealtimeLayer.d.ts +285 -0
  70. package/ol/layers/RealtimeLayer.js +13 -7
  71. package/ol/layers/index.d.ts +3 -0
  72. package/ol/mixins/MobilityLayerMixin.d.ts +98 -0
  73. package/ol/mixins/MobilityLayerMixin.js +1 -4
  74. package/ol/mixins/PropertiesLayerMixin.d.ts +127 -0
  75. package/ol/mixins/PropertiesLayerMixin.js +5 -4
  76. package/ol/renderers/MaplibreLayerRenderer.d.ts +20 -0
  77. package/ol/renderers/MaplibreStyleLayerRenderer.d.ts +20 -0
  78. package/ol/renderers/RealtimeLayerRenderer.d.ts +22 -0
  79. package/ol/renderers/RealtimeLayerRenderer.js +9 -9
  80. package/ol/styles/fullTrajectoryDelayStyle.d.ts +6 -0
  81. package/ol/styles/fullTrajectoryStyle.d.ts +5 -0
  82. package/ol/styles/index.d.ts +3 -0
  83. package/ol/styles/routingStyle.d.ts +4 -0
  84. package/ol/utils/getFeatureInfoAtCoordinate.d.ts +8 -0
  85. package/ol/utils/getFeatureInfoAtCoordinate.js +1 -1
  86. package/ol/utils/index.d.ts +1 -0
  87. package/package.json +1 -1
  88. package/setupTests.d.ts +1 -0
@@ -0,0 +1,17 @@
1
+ export interface Source {
2
+ attribution: string;
3
+ options: {
4
+ attribution: string;
5
+ };
6
+ }
7
+ export interface SourceCache {
8
+ used: boolean;
9
+ getSource: () => Source;
10
+ }
11
+ /**
12
+ * Return the copyright a Maplibre map.
13
+ * @param {maplibregl.Map} map A Maplibre map
14
+ * @private
15
+ */
16
+ declare const getMapGlCopyrights: (map: maplibregl.Map) => any[];
17
+ export default getMapGlCopyrights;
@@ -0,0 +1,9 @@
1
+ import type { RealtimeMode } from '../../types';
2
+ import type { RealtimeModesType } from '../../api/RealtimeAPI';
3
+ /**
4
+ * Get the websocket channel suffix, depending on the current mode.
5
+ * @param {String} mode Mode 'topographic' ou 'schematic'.
6
+ * @private
7
+ */
8
+ declare const getModeSuffix: (mode: RealtimeMode, modes: RealtimeModesType) => string;
9
+ export default getModeSuffix;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Return the styleUrl with apiKey parameters set.
3
+ * @param {string} url a url.
4
+ * @param {Object<String,String>} params a list of key/value pair to add to the url.
5
+ * @private
6
+ */
7
+ declare const getUrlWithParams: (url: string, params: Object) => URL;
8
+ export default getUrlWithParams;
@@ -0,0 +1,16 @@
1
+ import { Coordinate } from 'ol/coordinate';
2
+ export type VehiclePosition = {
3
+ coord: Coordinate;
4
+ rotation: number;
5
+ };
6
+ /**
7
+ * Interpolate or not the vehicle position from a trajectory at a specific date.
8
+ *
9
+ * @param {number} now Current date to interpolate a position with. In ms.
10
+ * @param {RealtimeTrajectory} trajectory The trajectory to interpolate.
11
+ * @param {boolean} noInterpolate If true, the vehicle position is not interpolated on each render but only once.
12
+ * @returns {VehiclePosition}
13
+ * @private
14
+ */
15
+ declare const getVehiclePosition: (now: number, trajectory: GeoJSONFeature, noInterpolate: boolean) => VehiclePosition;
16
+ export default getVehiclePosition;
@@ -0,0 +1,16 @@
1
+ export { default as getUrlWithParams } from "./getUrlWithParams";
2
+ export { default as getMapGlCopyrights } from "./getMapGlCopyrights";
3
+ export { default as removeDuplicate } from "./removeDuplicate";
4
+ export { default as createRealtimeFilters } from "./createRealtimeFilters";
5
+ export { default as getLayersAsFlatArray } from "./getLayersAsFlatArray";
6
+ export * from "./timeUtils";
7
+ export * from "./constants";
8
+ export { default as sortByDelay } from "./sortByDelay";
9
+ export { default as renderTrajectories } from "./renderTrajectories";
10
+ export { default as debounceDeparturesMessages } from "./debounceDeparturesMessages";
11
+ export { default as debounceWebsocketMessages } from "./debounceWebsocketMessages";
12
+ export { default as sortAndFilterDepartures } from "./sortAndFilterDepartures";
13
+ export { default as compareDepartures } from "./compareDepartures";
14
+ export { default as createCanvas } from "./createCanvas";
15
+ export { default as getVehiclePosition } from "./getVehiclePosition";
16
+ export * as realtimeConfig from "./realtimeConfig";
@@ -0,0 +1,64 @@
1
+ import { AnyCanvasContext, RealtimeMot } from '../../types';
2
+ /**
3
+ * @private
4
+ */
5
+ export declare const MOTS_ONLY_RAIL: RealtimeMot[];
6
+ /**
7
+ * @private
8
+ */
9
+ export declare const MOTS_WITH_CABLE: RealtimeMot[];
10
+ /**
11
+ * @private
12
+ */
13
+ export declare const MOTS_WITHOUT_CABLE: RealtimeMot[];
14
+ /**
15
+ * @private
16
+ */
17
+ export declare const MOTS_ALL: RealtimeMot[];
18
+ /**
19
+ * Trajserv value: 'Tram', 'Subway / Metro / S-Bahn', 'Train', 'Bus', 'Ferry', 'Cable Car', 'Gondola', 'Funicular', 'Long distance bus', 'Rail',
20
+ * New endpoint use Rail instead of Train.
21
+ * New tracker values: null, "tram", "subway", "rail", "bus", "ferry", "cablecar", "gondola", "funicular", "coach".
22
+ *
23
+ * @private
24
+ */
25
+ export declare const types: RegExp[];
26
+ /**
27
+ * @private
28
+ */
29
+ export declare const bgColors: string[];
30
+ /**
31
+ * @private
32
+ */
33
+ export declare const textColors: string[];
34
+ /**
35
+ * @private
36
+ */
37
+ export declare const getTypeIndex: (type: RealtimeMot) => number;
38
+ /**
39
+ * @private
40
+ */
41
+ export declare const getRadius: (type: RealtimeMot, zoom: number) => number;
42
+ /**
43
+ * @private
44
+ */
45
+ export declare const getBgColor: (type: RealtimeMot) => string;
46
+ /**
47
+ * @private
48
+ */
49
+ export declare const getTextColor: (type: RealtimeMot) => string;
50
+ /**
51
+ * @private
52
+ */
53
+ export declare const getTextSize: (ctx: AnyCanvasContext, markerSize: number, text: string, fontSize: number, getTextFont: (fontSize: number, text?: string) => string) => number;
54
+ /**
55
+ * @private
56
+ * @param {number} delayInMs Delay in milliseconds.
57
+ * @param {boolean} cancelled true if the journey is cancelled.
58
+ * @param {boolean} isDelayText true if the color is used for delay text of the symbol.
59
+ */
60
+ export declare const getDelayColor: (delayInMs: number | null, cancelled?: boolean, isDelayText?: boolean) => string;
61
+ /**
62
+ * @private
63
+ */
64
+ export declare const getDelayText: (delayInMs: number, cancelled: boolean) => string;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This function remove duplicates lower case string value of an array.
3
+ * It removes also null, undefined or non string values.
4
+ *
5
+ * @param {array} array Array of values.
6
+ * @private
7
+ */
8
+ declare const removeDuplicate: (array: any[]) => any[];
9
+ export default removeDuplicate;
@@ -0,0 +1,16 @@
1
+ import { AnyCanvas, RealtimeRenderState, RealtimeStyleFunction, RealtimeStyleOptions, RealtimeTrajectories, ViewState } from '../../types';
2
+ /**
3
+ * Draw all the trajectories available in a canvas.
4
+ * @param {HTMLCanvas|HTMLOffscreenCanvas} The canvas where to draw the trajectories.
5
+ * @param {ViewState} trajectories An array of trajectories.
6
+ * @param {Function} style A function that returns a canvas representing a vehicle of a specific trajectory.
7
+ * @param {ViewState} viewState The view state of the map.
8
+ * @param {boolean} options.hoverVehicleId The id of the vehicle to highlight.
9
+ * @param {boolean} options.selectedVehicleId The id of the vehicle to select.
10
+ * @param {boolean} options.noInterpolate If true trajectories are not interpolated but
11
+ * drawn at the last known coordinate. Use this for performance optimization
12
+ * during map navigation.
13
+ * @private
14
+ */
15
+ declare const renderTrajectories: (canvas: AnyCanvas, trajectories: RealtimeTrajectories, style: RealtimeStyleFunction, viewState: ViewState, options: RealtimeStyleOptions) => RealtimeRenderState;
16
+ export default renderTrajectories;
@@ -0,0 +1,15 @@
1
+ import { RealtimeAPIDeparturesById } from '../../api/RealtimeAPI';
2
+ import type { RealtimeDepartureExtended } from '../../types';
3
+ /**
4
+ * This function sort Departures by arrival time and filter out unwanted departures:
5
+ * - when dparture time is in the past
6
+ * - when departure are duplicated
7
+ * - when departure is not in the next 30 min
8
+ *
9
+ * @param {Object} depObject The object containing departures by id.
10
+ * @param {boolean} [sortByMinArrivalTime=false] If true sort departures by arrival time.
11
+ * @return {Array<Departure>} Return departures array.
12
+ * @private
13
+ */
14
+ declare const sortAndfilterDepartures: (depObject: RealtimeAPIDeparturesById, sortByMinArrivalTime?: boolean, maxDepartureAge?: number) => RealtimeDepartureExtended[];
15
+ export default sortAndfilterDepartures;
@@ -0,0 +1,3 @@
1
+ /** @private */
2
+ declare const sortByDelay: (traj1: GeoJSONFeature, traj2: GeoJSONFeature) => number;
3
+ export default sortByDelay;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Get a Date object as UTC date string .
3
+ * ex: 2019 09 01
4
+ * @private
5
+ */
6
+ export declare const getUTCDateString: (now?: Date) => string;
7
+ /**
8
+ * Get the UTC time string of Date object.
9
+ * ex: 09:05:01.123
10
+ * @private
11
+ */
12
+ export declare const getUTCTimeString: (date: Date) => string;
13
+ /**
14
+ * Returns a string representation of a number, with a zero if the number is lower than 10.
15
+ * @private
16
+ */
17
+ export declare const pad: (integer: number) => string;
18
+ /**
19
+ * Returns a 'hh:mm' string from a time in ms.
20
+ * @param {Number} timeInMs Time in milliseconds.
21
+ * @private
22
+ */
23
+ export declare const getHoursAndMinutes: (timeInMs: number) => string;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @private
3
+ */
4
+ declare const toMercatorExtent: (bounds: maplibregl.LngLatBounds) => import("ol/extent").Extent;
5
+ export default toMercatorExtent;
package/iife.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export default mbt;
2
+ import mbt from './index';
package/index.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ export * as ol from "./ol";
2
+ export * as maplibre from "./maplibre";
3
+ declare namespace _default {
4
+ export { ol };
5
+ export { maplibre };
6
+ }
7
+ export default _default;
8
+ import * as ol from './ol';
9
+ import * as maplibre from './maplibre';
@@ -0,0 +1,35 @@
1
+ import { ControlPosition, IControl } from 'maplibre-gl';
2
+ /**
3
+ * Display layer's copyrights.
4
+ *
5
+ * @example
6
+ * import { Map } from 'Maplibre-gl';
7
+ * import { CopyrightControl } from 'mobility-toolbox-js/Maplibre';
8
+ *
9
+ * const map = new Map({
10
+ * container: 'map',
11
+ * style: `https://maps.geops.io/styles/travic_v2/style.json?key=${window.apiKey}`,
12
+ * });
13
+ *
14
+ * const control = new CopyrightControl();
15
+ * map.addControl(control);
16
+ *
17
+ *
18
+ * @see <a href="/example/mb-copyright">Maplibre copyright example</a>
19
+ *
20
+ */
21
+ declare class CopyrightControl implements IControl {
22
+ map?: maplibregl.Map;
23
+ container?: HTMLElement;
24
+ content?: string;
25
+ options?: {
26
+ customAttribution?: string | string[];
27
+ separator?: string;
28
+ };
29
+ constructor(options?: {});
30
+ onAdd(map: maplibregl.Map): HTMLElement;
31
+ onRemove(): HTMLElement | undefined;
32
+ getDefaultPosition(): ControlPosition;
33
+ render(): void;
34
+ }
35
+ export default CopyrightControl;
@@ -0,0 +1 @@
1
+ export { default as CopyrightControl } from "./CopyrightControl";
@@ -0,0 +1,5 @@
1
+ export * from "../api";
2
+ export * from "../common";
3
+ export * from "./controls";
4
+ export * from "./layers";
5
+ export * from "./utils";
@@ -0,0 +1,28 @@
1
+ import { CustomLayerInterface, Evented } from 'maplibre-gl';
2
+ import type { AnyMapGlMap } from '../../types';
3
+ export type LayerOptions = {
4
+ id?: string;
5
+ };
6
+ /**
7
+ * A class representing a layer to display on an Maplibre map.
8
+ *
9
+ * @example
10
+ * import { Layer } from 'mobility-toolbox-js/Maplibre';
11
+ *
12
+ * const layer = new Layer({ id:'MyLayer' });
13
+ *
14
+ * @implements {maplibregl.CustomLayer}
15
+ * @extends {maplibregl.Evented}
16
+ * @private
17
+ */
18
+ declare class Layer extends Evented implements CustomLayerInterface {
19
+ id: string;
20
+ map: AnyMapGlMap | undefined;
21
+ options: LayerOptions;
22
+ type: 'custom';
23
+ constructor(options?: LayerOptions);
24
+ onAdd(map: AnyMapGlMap, gl: WebGLRenderingContext | WebGL2RenderingContext): void;
25
+ onRemove(map: AnyMapGlMap, gl: WebGLRenderingContext | WebGL2RenderingContext): void;
26
+ render(gl: WebGLRenderingContext | WebGL2RenderingContext): void;
27
+ }
28
+ export default Layer;
@@ -0,0 +1,160 @@
1
+ import { RealtimeLayerMixinOptions } from '../../common/mixins/RealtimeLayerMixin';
2
+ import Layer, { LayerOptions } from './Layer';
3
+ import type { AnyMapGlMap, ViewState } from '../../types';
4
+ import type { RealtimeTrajectory } from '../../api/typedefs';
5
+ export type RealtimeLayerOptions = LayerOptions & RealtimeLayerMixinOptions;
6
+ declare const RealtimeLayer_base: {
7
+ new (options: RealtimeLayerMixinOptions): {
8
+ [x: string]: any;
9
+ debug: boolean;
10
+ trajectories?: {
11
+ [key: string]: GeoJSONFeature;
12
+ } | undefined;
13
+ canvas?: import("../../types").AnyCanvas | undefined;
14
+ mode: import("../../types").RealtimeMode;
15
+ api: import("../../api/RealtimeAPI").default;
16
+ tenant: string;
17
+ bboxParameters?: {
18
+ [index: string]: string | number | boolean | string[] | number[] | boolean[];
19
+ } | undefined;
20
+ time?: Date | undefined;
21
+ live?: boolean | undefined;
22
+ speed?: number | undefined;
23
+ filter?: Function | undefined;
24
+ sort?: Function | undefined;
25
+ style?: import("../../types").RealtimeStyleFunction | undefined;
26
+ styleOptions?: import("../../types").RealtimeStyleOptions | undefined;
27
+ pixelRatio?: number | undefined;
28
+ minZoomInterpolation: number;
29
+ isUpdateBboxOnMoveEnd: boolean;
30
+ hoverVehicleId?: string | undefined;
31
+ selectedVehicleId?: string | undefined;
32
+ renderState?: import("../../types").RealtimeRenderState | undefined;
33
+ useRequestAnimationFrame?: boolean | undefined;
34
+ useDebounce?: boolean | undefined;
35
+ useThrottle?: boolean | undefined;
36
+ mots?: import("../../types").RealtimeMot[] | undefined;
37
+ motsByZoom: import("../../types").RealtimeMot[][];
38
+ generalizationLevel?: import("../../types").RealtimeGeneralizationLevel | undefined;
39
+ generalizationLevelByZoom: import("../../types").RealtimeGeneralizationLevel[];
40
+ renderTimeIntervalByZoom: number[];
41
+ format: import("ol/format/GeoJSON").default<typeof import("ol/Feature").default>;
42
+ requestId?: number | undefined;
43
+ updateTimeInterval?: number | undefined;
44
+ updateTimeDelay?: number | undefined;
45
+ visibilityRef: import("ol/events").EventsKey;
46
+ selectedVehicle: GeoJSONFeature;
47
+ getMotsByZoom: (zoom: number) => import("../../types").RealtimeMot[];
48
+ getGeneralizationLevelByZoom: (zoom: number) => import("../../types").RealtimeGeneralizationLevel;
49
+ getRenderTimeIntervalByZoom: (zoom: number) => number;
50
+ throttleRenderTrajectories: (viewState: ViewState, noInterpolate?: boolean | undefined) => void;
51
+ debounceRenderTrajectories: (viewState: ViewState, noInterpolate?: boolean | undefined) => void;
52
+ onStart?: ((realtimeLayer: any) => void) | undefined;
53
+ onStop?: ((realtimeLayer: any) => void) | undefined;
54
+ defineProperties(options: RealtimeLayerMixinOptions): void;
55
+ attachToMap(map: any): void;
56
+ detachFromMap(): void;
57
+ start(): void;
58
+ startUpdateTime(): void;
59
+ stop(): void;
60
+ stopUpdateTime(): void;
61
+ renderTrajectoriesInternal(viewState: ViewState, noInterpolate?: boolean): boolean;
62
+ renderTrajectories(viewState: ViewState | undefined, noInterpolate: boolean | undefined): void;
63
+ setBbox(extent: [number, number, number, number], zoom: number): void;
64
+ getRefreshTimeInMs(zoom?: number | undefined): number;
65
+ getVehicle(filterFc: Function): GeoJSONFeature[];
66
+ getFeatureInfoAtCoordinate(coordinate: import("ol/coordinate").Coordinate, options: import("../../types").LayerGetFeatureInfoOptions): Promise<import("../../types").LayerGetFeatureInfoResponse>;
67
+ getTrajectoryInfos(id: string): Promise<{
68
+ stopSequence: import("../../api/WebSocketAPI").WebSocketAPIMessageEventData<import("../../types").RealtimeFullTrajectory> | import("../../api/WebSocketAPI").WebSocketAPIMessageEventData<GeoJSONFeature[]>;
69
+ fullTrajectory: import("../../api/WebSocketAPI").WebSocketAPIMessageEventData<import("../../types").RealtimeFullTrajectory> | import("../../api/WebSocketAPI").WebSocketAPIMessageEventData<GeoJSONFeature[]>;
70
+ }>;
71
+ purgeOutOfDateTrajectories(): void;
72
+ purgeTrajectory(trajectory: GeoJSONFeature, extent: [number, number, number, number], zoom: number): boolean;
73
+ addTrajectory(trajectory: GeoJSONFeature): void;
74
+ removeTrajectory(trajectoryOrId: any): void;
75
+ onZoomEnd(): void;
76
+ onDocumentVisibilityChange(): void;
77
+ onTrajectoryMessage(data: import("../../api/WebSocketAPI").WebSocketAPIMessageEventData<GeoJSONFeature>): void;
78
+ onDeleteTrajectoryMessage(data: import("../../api/WebSocketAPI").WebSocketAPIMessageEventData<string>): void;
79
+ highlightVehicle(id: string): void;
80
+ selectVehicle(id: string): void;
81
+ };
82
+ } & typeof Layer;
83
+ /**
84
+ * Responsible for loading and display data from a geOps realtime API.
85
+ *
86
+ * @example
87
+ * import { RealtimeLayer } from 'mobility-toolbox-js/Maplibre';
88
+ *
89
+ * const layer = new RealtimeLayer({
90
+ * apiKey: "yourApiKey"
91
+ * // url: "wss://api.geops.io/tracker-ws/v1/",
92
+ * });
93
+ *
94
+ *
95
+ * @see <a href="/api/class/src/api/RealtimeAPI%20js~RealtimeAPI%20html">RealtimeAPI</a>
96
+ *
97
+ * @implements {maplibregl.CustomLayer}
98
+ * @extends {maplibregl.Evented}
99
+ * @public
100
+ */
101
+ declare class RealtimeLayer extends RealtimeLayer_base {
102
+ /**
103
+ * Constructor.
104
+ *
105
+ * @param {RealtimeLayerOptions} options
106
+ * @param {string} options.apiKey Access key for [geOps apis](https://developer.geops.io/).
107
+ * @param {string} [options.url="wss://api.geops.io/tracker-ws/v1/"] The geOps realtime API url.
108
+ *
109
+ */
110
+ constructor(options?: {});
111
+ /**
112
+ * Add sources, layers and listeners to the map.
113
+ */
114
+ onAdd(map: AnyMapGlMap, gl: WebGLRenderingContext | WebGL2RenderingContext): void;
115
+ /**
116
+ * Remove source, layers and listeners from the map.
117
+ */
118
+ onRemove(map: AnyMapGlMap, gl: WebGLRenderingContext | WebGL2RenderingContext): void;
119
+ onLoad(): void;
120
+ /**
121
+ * Start updating vehicles position.
122
+ *
123
+ * @public
124
+ */
125
+ start(): void;
126
+ /**
127
+ * Stop updating vehicles position.
128
+ *
129
+ * @public
130
+ */
131
+ stop(): void;
132
+ /**
133
+ * Render the trajectories using current map's size, resolution and rotation.
134
+ * @param {boolean} noInterpolate if true, renders the vehicles without interpolating theirs positions.
135
+ * @private
136
+ */
137
+ renderTrajectories(noInterpolate?: boolean): void;
138
+ /**
139
+ * Return the delay in ms before the next rendering.
140
+ */
141
+ getRefreshTimeInMs(): number;
142
+ /**
143
+ * Remove the trajectory form the list if necessary.
144
+ */
145
+ purgeTrajectory(trajectory: RealtimeTrajectory, extent: [number, number, number, number], zoom: number): boolean;
146
+ /**
147
+ * Send the current bbox to the websocket
148
+ */
149
+ setBbox(extent?: [number, number, number, number], zoom?: number): void;
150
+ renderTrajectoriesInternal(viewState: ViewState, noInterpolate?: boolean): boolean;
151
+ /**
152
+ * Callback on 'move' event.
153
+ */
154
+ onMove(): void;
155
+ /**
156
+ * Callback on 'moveend' event.
157
+ */
158
+ onMoveEnd(): void;
159
+ }
160
+ export default RealtimeLayer;
@@ -8,7 +8,7 @@ import Layer from './Layer';
8
8
  import { getSourceCoordinates } from '../utils';
9
9
  import toMercatorExtent from '../../common/utils/toMercatorExtent';
10
10
  /**
11
- * Responsible for loading and display data from a geOps Realtime API.
11
+ * Responsible for loading and display data from a geOps realtime API.
12
12
  *
13
13
  * @example
14
14
  * import { RealtimeLayer } from 'mobility-toolbox-js/Maplibre';
@@ -31,7 +31,7 @@ class RealtimeLayer extends RealtimeLayerMixin(Layer) {
31
31
  *
32
32
  * @param {RealtimeLayerOptions} options
33
33
  * @param {string} options.apiKey Access key for [geOps apis](https://developer.geops.io/).
34
- * @param {string} [options.url="wss://api.geops.io/tracker-ws/v1/"] The geOps Realtime API url.
34
+ * @param {string} [options.url="wss://api.geops.io/tracker-ws/v1/"] The geOps realtime API url.
35
35
  *
36
36
  */
37
37
  constructor(options = {}) {
@@ -0,0 +1,2 @@
1
+ export { default as Layer } from "./Layer";
2
+ export { default as RealtimeLayer } from "./RealtimeLayer";
@@ -0,0 +1,7 @@
1
+ import { AnyMapGlMap } from '../../types';
2
+ /**
3
+ * Get the current resolution of a Maplibre map.
4
+ * @param {maplibregl.Map} map A map object.
5
+ */
6
+ declare const getMercatorResolution: (map: AnyMapGlMap) => number;
7
+ export default getMercatorResolution;
@@ -0,0 +1,7 @@
1
+ import { AnyMapGlMap } from '../../types';
2
+ /**
3
+ * Get the canvas source coordinates of the current map's extent.
4
+ * @param {maplibregl.Map} map A map object.
5
+ */
6
+ export declare const getSourceCoordinates: (map: AnyMapGlMap, pixelRatio?: number) => number[][];
7
+ export default getSourceCoordinates;
@@ -0,0 +1,2 @@
1
+ export { default as getSourceCoordinates } from "./getSourceCoordinates";
2
+ export { default as getMercatorResolution } from "./getMercatorResolution";