mobility-toolbox-js 2.0.0-beta.52 → 2.0.0-beta.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -3
- package/api/RealtimeAPI.d.ts +79 -84
- package/api/RealtimeAPI.d.ts.map +1 -1
- package/api/RealtimeAPI.js +102 -266
- package/common/api/WebSocketAPI.d.ts +13 -15
- package/common/api/WebSocketAPI.d.ts.map +1 -1
- package/common/controls/ControlCommon.d.ts +1 -1
- package/common/controls/ControlCommon.d.ts.map +1 -1
- package/common/layers/LayerCommon.d.ts +1 -0
- package/common/layers/LayerCommon.d.ts.map +1 -1
- package/common/layers/LayerCommon.js +3 -0
- package/common/mixins/RealtimeLayerMixin.d.ts +5 -5
- package/common/mixins/RealtimeLayerMixin.d.ts.map +1 -1
- package/common/mixins/RealtimeLayerMixin.js +6 -6
- package/common/mixins/UserInteractionsLayerMixin.d.ts.map +1 -1
- package/common/mixins/UserInteractionsLayerMixin.js +7 -10
- package/common/styles/realtimeDefaultStyle.d.ts +2 -2
- package/common/styles/realtimeDefaultStyle.d.ts.map +1 -1
- package/common/styles/realtimeDelayStyle.d.ts +2 -2
- package/common/styles/realtimeDelayStyle.d.ts.map +1 -1
- package/common/styles/realtimeSimpleStyle.d.ts +2 -1
- package/common/styles/realtimeSimpleStyle.d.ts.map +1 -1
- package/common/typedefs.js +3 -3
- package/common/utils/{createTrackerFilters.d.ts → createRealtimeFilters.d.ts} +3 -3
- package/common/utils/createRealtimeFilters.d.ts.map +1 -0
- package/common/utils/{createTrackerFilters.js → createRealtimeFilters.js} +2 -2
- package/common/utils/debounceDeparturesMessages.d.ts +12 -0
- package/common/utils/debounceDeparturesMessages.d.ts.map +1 -0
- package/common/utils/debounceDeparturesMessages.js +24 -0
- package/common/utils/debounceWebsocketMessages.d.ts +11 -0
- package/common/utils/debounceWebsocketMessages.d.ts.map +1 -0
- package/common/utils/debounceWebsocketMessages.js +29 -0
- package/common/utils/getMapboxRender.d.ts +3 -3
- package/common/utils/getMapboxRender.d.ts.map +1 -1
- package/common/utils/getMapboxRender.js +2 -1
- package/common/utils/getMaplibreRender.d.ts +3 -1
- package/common/utils/getMaplibreRender.d.ts.map +1 -1
- package/common/utils/getMaplibreRender.js +4 -4
- package/common/utils/getRealtimeModeSuffix.d.ts +4 -2
- package/common/utils/getRealtimeModeSuffix.d.ts.map +1 -1
- package/common/utils/getUrlWithParams.d.ts +2 -2
- package/common/utils/getUrlWithParams.d.ts.map +1 -1
- package/common/utils/getVehiclePosition.d.ts +7 -5
- package/common/utils/getVehiclePosition.d.ts.map +1 -1
- package/common/utils/index.d.ts +5 -2
- package/common/utils/index.js +6 -3
- package/common/utils/realtimeConfig.d.ts +49 -0
- package/common/utils/realtimeConfig.d.ts.map +1 -0
- package/common/utils/{trackerConfig.js → realtimeConfig.js} +17 -17
- package/common/utils/sortAndFilterDepartures.d.ts +16 -0
- package/common/utils/sortAndFilterDepartures.d.ts.map +1 -0
- package/common/utils/sortAndFilterDepartures.js +58 -0
- package/common/utils/sortByDelay.d.ts +1 -1
- package/common/utils/sortByDelay.d.ts.map +1 -1
- package/common/utils/timeUtils.d.ts +23 -4
- package/common/utils/timeUtils.d.ts.map +1 -1
- package/common/utils/timeUtils.js +1 -1
- package/mapbox/layers/RealtimeLayer.d.ts +4 -4
- package/mbt.js +349 -410
- package/mbt.js.map +3 -3
- package/mbt.min.js +62 -62
- package/mbt.min.js.map +3 -3
- package/ol/controls/RoutingControl.d.ts +95 -91
- package/ol/controls/RoutingControl.d.ts.map +1 -1
- package/ol/controls/RoutingControl.js +100 -90
- package/ol/layers/Layer.d.ts +3 -2
- package/ol/layers/Layer.d.ts.map +1 -1
- package/ol/layers/Layer.js +2 -0
- package/ol/layers/MapGlLayer.d.ts.map +1 -1
- package/ol/layers/MapGlLayer.js +3 -5
- package/ol/layers/MapboxLayer.d.ts +1 -1
- package/ol/layers/MapboxLayer.d.ts.map +1 -1
- package/ol/layers/MapboxLayer.js +1 -0
- package/ol/layers/MapboxStyleLayer.js +4 -2
- package/ol/layers/MaplibreLayer.d.ts +2 -1
- package/ol/layers/MaplibreLayer.d.ts.map +1 -1
- package/ol/layers/RealtimeLayer.d.ts +8 -6
- package/ol/layers/RealtimeLayer.d.ts.map +1 -1
- package/ol/layers/RealtimeLayer.js +3 -3
- package/ol/layers/RoutingLayer.d.ts +15 -5
- package/ol/layers/RoutingLayer.d.ts.map +1 -1
- package/ol/layers/RoutingLayer.js +3 -2
- package/ol/styles/fullTrajectoryStyle.d.ts +2 -2
- package/ol/styles/fullTrajectoryStyle.d.ts.map +1 -1
- package/package.json +1 -1
- package/types/common.d.ts +6 -1
- package/types/realtime.d.ts +0 -2
- package/common/utils/cleanStopTime.d.ts +0 -8
- package/common/utils/cleanStopTime.d.ts.map +0 -1
- package/common/utils/cleanStopTime.js +0 -25
- package/common/utils/createTrackerFilters.d.ts.map +0 -1
- package/common/utils/trackerConfig.d.ts +0 -24
- package/common/utils/trackerConfig.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ControlCommon.d.ts","sourceRoot":"","sources":["../../../src/common/controls/ControlCommon.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ControlCommon.d.ts","sourceRoot":"","sources":["../../../src/common/controls/ControlCommon.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,EAAgB,MAAM,aAAa,CAAC;AAExD,oBAAY,oBAAoB,GAAG;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,cAAM,aAAc,SAAQ,UAAU;IACpC,MAAM,EAAE,OAAO,CAAC;IAEhB,GAAG,CAAC,EAAE,MAA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AEf,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAEtB,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC;IAEnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,UAAU,CAAC,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAM;IAEvC,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,MAAM,CAAC,EAAE,KAAK,CAAC;IAEf,OAAO,EAAE,kBAAkB,CAAM;IAEjC;;;;;;;;;;;;OAYG;gBACS,OAAO,GAAE,kBAAuB;IAoC5C;;;;OAIG;IACH,gBAAgB,CAAC,OAAO,GAAE,kBAAuB;IA2IjD;;;;OAIG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM;IAYvB;;OAEG;IAEH,aAAa;IAKb;;;;;;;OAOG;IAEH,0BAA0B,CACxB,UAAU,EAAE,MAAM,EAAE,EAEpB,OAAO,CAAC,EAAE,0BAA0B,GACnC,OAAO,CAAC,2BAA2B,CAAC;IAgBvC;;OAEG;IACH,IAAI;CAGL"}
|
|
@@ -36,10 +36,13 @@ export default class Layer extends BaseObject {
|
|
|
36
36
|
*/
|
|
37
37
|
constructor(options = {}) {
|
|
38
38
|
super();
|
|
39
|
+
this.properties = {};
|
|
40
|
+
this.options = {};
|
|
39
41
|
this.defineProperties(options);
|
|
40
42
|
if (options.properties) {
|
|
41
43
|
this.setProperties(options.properties);
|
|
42
44
|
}
|
|
45
|
+
this.options = options;
|
|
43
46
|
this.visible = options.visible === undefined ? true : !!options.visible;
|
|
44
47
|
this.group = options.group;
|
|
45
48
|
this.copyrights = options.copyrights;
|
|
@@ -6,7 +6,7 @@ import { RealtimeAPI } from '../../api';
|
|
|
6
6
|
import { AnyCanvas, AnyLayerClass, AnyMap, AnyRealtimeLayer, LayerGetFeatureInfoOptions, RealtimeGeneralizationLevel, RealtimeMode, RealtimeRenderState, RealtimeStyleFunction, RealtimeStyleOptions, RealtimeTenant, RealtimeTrainId, ViewState } from '../../types';
|
|
7
7
|
import { RealtimeTrajectory } from '../../api/typedefs';
|
|
8
8
|
import { WebSocketAPIMessageEventData } from '../api/WebSocketAPI';
|
|
9
|
-
import { OlLayerOptions } from '../../ol/layers/Layer';
|
|
9
|
+
import type { OlLayerOptions } from '../../ol/layers/Layer';
|
|
10
10
|
export declare type RealtimeLayerMixinOptions = OlLayerOptions & {
|
|
11
11
|
debug?: boolean;
|
|
12
12
|
mode?: RealtimeMode;
|
|
@@ -214,8 +214,8 @@ declare function RealtimeLayerMixin<T extends AnyLayerClass>(Base: T): {
|
|
|
214
214
|
* @return {Promise<{stopSequence: StopSequence, fullTrajectory: FullTrajectory>} A promise that will be resolved with the trajectory informations.
|
|
215
215
|
*/
|
|
216
216
|
getTrajectoryInfos(id: RealtimeTrainId): Promise<{
|
|
217
|
-
stopSequence:
|
|
218
|
-
fullTrajectory:
|
|
217
|
+
stopSequence: WebSocketAPIMessageEventData<import("../../types").RealtimeFullTrajectory> | WebSocketAPIMessageEventData<GeoJSONFeature[]>;
|
|
218
|
+
fullTrajectory: WebSocketAPIMessageEventData<import("../../types").RealtimeFullTrajectory> | WebSocketAPIMessageEventData<GeoJSONFeature[]>;
|
|
219
219
|
}>;
|
|
220
220
|
/**
|
|
221
221
|
* Determine if the trajectory is useless and should be removed from the list or not.
|
|
@@ -251,7 +251,7 @@ declare function RealtimeLayerMixin<T extends AnyLayerClass>(Base: T): {
|
|
|
251
251
|
*
|
|
252
252
|
* @private
|
|
253
253
|
*/
|
|
254
|
-
onTrajectoryMessage(data: WebSocketAPIMessageEventData): void;
|
|
254
|
+
onTrajectoryMessage(data: WebSocketAPIMessageEventData<RealtimeTrajectory>): void;
|
|
255
255
|
/**
|
|
256
256
|
* Callback on websocket's deleted_vehicles channel events.
|
|
257
257
|
* It removes the trajectory from the list.
|
|
@@ -259,7 +259,7 @@ declare function RealtimeLayerMixin<T extends AnyLayerClass>(Base: T): {
|
|
|
259
259
|
* @private
|
|
260
260
|
* @override
|
|
261
261
|
*/
|
|
262
|
-
onDeleteTrajectoryMessage(data: WebSocketAPIMessageEventData): void;
|
|
262
|
+
onDeleteTrajectoryMessage(data: WebSocketAPIMessageEventData<RealtimeTrainId>): void;
|
|
263
263
|
/**
|
|
264
264
|
* Callback when user moves the mouse/pointer over the map.
|
|
265
265
|
* It sets the layer's hoverVehicleId property with the current hovered vehicle's id.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RealtimeLayerMixin.d.ts","sourceRoot":"","sources":["../../../src/common/mixins/RealtimeLayerMixin.ts"],"names":[],"mappings":"AAOA,OAAO,OAAO,MAAM,mBAAmB,CAAC;AAIxC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAiB,MAAM,WAAW,CAAC;AAGvD,OAAO,EACL,SAAS,EACT,aAAa,EACb,MAAM,EACN,gBAAgB,EAChB,0BAA0B,EAC1B,2BAA2B,EAC3B,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,SAAS,EACV,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"RealtimeLayerMixin.d.ts","sourceRoot":"","sources":["../../../src/common/mixins/RealtimeLayerMixin.ts"],"names":[],"mappings":"AAOA,OAAO,OAAO,MAAM,mBAAmB,CAAC;AAIxC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAA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realtimeDefaultStyle';
|
|
13
13
|
import { RealtimeAPI, RealtimeModes } from '../../api';
|
|
14
14
|
import renderTrajectories from '../utils/renderTrajectories';
|
|
15
|
-
import * as
|
|
15
|
+
import * as realtimeConfig from '../utils/realtimeConfig';
|
|
16
16
|
/**
|
|
17
17
|
* RealtimeLayerInterface.
|
|
18
18
|
*/
|
|
@@ -128,7 +128,7 @@ function RealtimeLayerMixin(Base) {
|
|
|
128
128
|
* Custom options to pass as last parameter of the style function.
|
|
129
129
|
*/
|
|
130
130
|
styleOptions: {
|
|
131
|
-
value: Object.assign(Object.assign({},
|
|
131
|
+
value: Object.assign(Object.assign({}, realtimeConfig), (styleOptions || {})),
|
|
132
132
|
},
|
|
133
133
|
/**
|
|
134
134
|
* Speed of the wheel of time.
|
|
@@ -273,8 +273,8 @@ function RealtimeLayerMixin(Base) {
|
|
|
273
273
|
this.renderTrajectories();
|
|
274
274
|
this.startUpdateTime();
|
|
275
275
|
this.api.open();
|
|
276
|
-
this.api.subscribeTrajectory(this.mode, this.onTrajectoryMessage, this.isUpdateBboxOnMoveEnd);
|
|
277
|
-
this.api.subscribeDeletedVehicles(this.mode, this.onDeleteTrajectoryMessage, this.isUpdateBboxOnMoveEnd);
|
|
276
|
+
this.api.subscribeTrajectory(this.mode, this.onTrajectoryMessage, undefined, this.isUpdateBboxOnMoveEnd);
|
|
277
|
+
this.api.subscribeDeletedVehicles(this.mode, this.onDeleteTrajectoryMessage, undefined, this.isUpdateBboxOnMoveEnd);
|
|
278
278
|
if (this.isUpdateBboxOnMoveEnd) {
|
|
279
279
|
// Update the bbox on each move end
|
|
280
280
|
// @ts-ignore function without parameters defined by subclasses
|
|
@@ -421,8 +421,8 @@ function RealtimeLayerMixin(Base) {
|
|
|
421
421
|
return;
|
|
422
422
|
}
|
|
423
423
|
this.mode = mode;
|
|
424
|
-
this.api.subscribeTrajectory(this.mode, this.onTrajectoryMessage, this.isUpdateBboxOnMoveEnd);
|
|
425
|
-
this.api.subscribeDeletedVehicles(this.mode, this.onDeleteTrajectoryMessage, this.isUpdateBboxOnMoveEnd);
|
|
424
|
+
this.api.subscribeTrajectory(this.mode, this.onTrajectoryMessage, undefined, this.isUpdateBboxOnMoveEnd);
|
|
425
|
+
this.api.subscribeDeletedVehicles(this.mode, this.onDeleteTrajectoryMessage, undefined, this.isUpdateBboxOnMoveEnd);
|
|
426
426
|
}
|
|
427
427
|
/**
|
|
428
428
|
* Get the duration before the next update depending on zoom level.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserInteractionsLayerMixin.d.ts","sourceRoot":"","sources":["../../../src/common/mixins/UserInteractionsLayerMixin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UserInteractionsLayerMixin.d.ts","sourceRoot":"","sources":["../../../src/common/mixins/UserInteractionsLayerMixin.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAEhD,oBAAY,iCAAiC,GAAG;IAC9C,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,OAAO,CAAC,EAAE,uBAAuB,CAAC;IAClC,OAAO,CAAC,EAAE,uBAAuB,CAAC;CACnC,CAAC;AAEF;;GAEG;AACH,qBAAa,8BAA8B;gBAU7B,OAAO,KAAK;IAExB;;;;OAIG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM;IAEvB;;OAEG;IACH,aAAa;IAEb;;OAEG;IACH,wBAAwB;IAExB;;OAEG;IACH,0BAA0B;IAE1B;;OAEG;IACH,OAAO,CAAC,QAAQ,EAAE,uBAAuB;IAEzC;;OAEG;IACH,OAAO,CAAC,QAAQ,EAAE,uBAAuB;IAEzC;;OAEG;IACH,OAAO,CAAC,QAAQ,EAAE,uBAAuB;IAEzC;;OAEG;IACH,OAAO,CAAC,QAAQ,EAAE,uBAAuB;CAC1C;AAED;;;;;;GAMG;AACH,iBAAS,0BAA0B,CAAC,CAAC,SAAS,gBAAgB,EAC5D,IAAI,EAAE,CAAC,GACN,CAAC,GAAG,OAAO,WAAW,CAkQxB;AAED,eAAe,0BAA0B,CAAC"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
/* eslint-disable max-classes-per-file */
|
|
6
6
|
import { fromLonLat } from 'ol/proj';
|
|
7
7
|
import { unByKey } from 'ol/Observable';
|
|
8
|
+
import BaseEvent from 'ol/events/Event';
|
|
8
9
|
/**
|
|
9
10
|
* UserInteractionsLayerInterface.
|
|
10
11
|
*/
|
|
@@ -204,11 +205,9 @@ function UserInteractionsLayerMixin(Base) {
|
|
|
204
205
|
};
|
|
205
206
|
return this.getFeatureInfoAtCoordinate(coordinate)
|
|
206
207
|
.then((featureInfo) => {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
target: featureInfo,
|
|
211
|
-
});
|
|
208
|
+
const event = new BaseEvent('user:click');
|
|
209
|
+
event.target = featureInfo;
|
|
210
|
+
this.dispatchEvent(event);
|
|
212
211
|
return featureInfo;
|
|
213
212
|
})
|
|
214
213
|
.catch(() => emptyFeatureInfo);
|
|
@@ -228,11 +227,9 @@ function UserInteractionsLayerMixin(Base) {
|
|
|
228
227
|
};
|
|
229
228
|
return this.getFeatureInfoAtCoordinate(coordinate)
|
|
230
229
|
.then((featureInfo) => {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
target: featureInfo,
|
|
235
|
-
});
|
|
230
|
+
const event = new BaseEvent('user:hover');
|
|
231
|
+
event.target = featureInfo;
|
|
232
|
+
this.dispatchEvent(event);
|
|
236
233
|
return featureInfo;
|
|
237
234
|
})
|
|
238
235
|
.catch(() => emptyFeatureInfo);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { RealtimeStyleFunction } from '../../types';
|
|
2
2
|
/**
|
|
3
3
|
* Draw circle delay background
|
|
4
4
|
*
|
|
@@ -31,6 +31,6 @@ export declare const getTextCanvas: (text: string, origin: number, textSize: num
|
|
|
31
31
|
* @param {RealtimeStyleOptions} options Some options to change the rendering
|
|
32
32
|
* @return a canvas
|
|
33
33
|
*/
|
|
34
|
-
declare const realtimeDefaultStyle:
|
|
34
|
+
declare const realtimeDefaultStyle: RealtimeStyleFunction;
|
|
35
35
|
export default realtimeDefaultStyle;
|
|
36
36
|
//# sourceMappingURL=realtimeDefaultStyle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"realtimeDefaultStyle.d.ts","sourceRoot":"","sources":["../../../src/common/styles/realtimeDefaultStyle.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"realtimeDefaultStyle.d.ts","sourceRoot":"","sources":["../../../src/common/styles/realtimeDefaultStyle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAKV,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAMrB;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,WACnB,MAAM,UACN,MAAM,SACP,MAAM,2CAmBd,CAAC;AAKF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,UACtB,MAAM,QACP,MAAM,YACF,MAAM,QACV,MAAM,cACA,MAAM,sBACC,MAAM,eACb,MAAM,2CAuBnB,CAAC;AAKF;;;;GAIG;AACH,eAAO,MAAM,eAAe,WAClB,MAAM,UACN,MAAM,SACP,MAAM,aACF,OAAO,WACT,OAAO,cACJ,MAAM,2CAiCnB,CAAC;AAKF;;;;GAIG;AACH,eAAO,MAAM,aAAa,SAClB,MAAM,UACJ,MAAM,YACJ,MAAM,aACL,MAAM,eACJ,MAAM,aACR,OAAO,cACN,MAAM,2CAmCnB,CAAC;AAKF;;;;;;;GAOG;AACH,QAAA,MAAM,oBAAoB,EAAE,qBA8M3B,CAAC;AACF,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { RealtimeStyleFunction } from '../../types';
|
|
2
2
|
/**
|
|
3
3
|
* A tracker style that display the delay as backgroundColor.
|
|
4
4
|
*
|
|
@@ -7,6 +7,6 @@ import { RealtimeTrajectory, ViewState, RealtimeStyleOptions } from '../../types
|
|
|
7
7
|
* @param {*} options Some options to change the rendering
|
|
8
8
|
* @return a canvas
|
|
9
9
|
*/
|
|
10
|
-
declare const realtimeDelayStyle:
|
|
10
|
+
declare const realtimeDelayStyle: RealtimeStyleFunction;
|
|
11
11
|
export default realtimeDelayStyle;
|
|
12
12
|
//# sourceMappingURL=realtimeDelayStyle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"realtimeDelayStyle.d.ts","sourceRoot":"","sources":["../../../src/common/styles/realtimeDelayStyle.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"realtimeDelayStyle.d.ts","sourceRoot":"","sources":["../../../src/common/styles/realtimeDelayStyle.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAIV,qBAAqB,EACtB,MAAM,aAAa,CAAC;AACrB;;;;;;;GAOG;AACH,QAAA,MAAM,kBAAkB,EAAE,qBASzB,CAAC;AACF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"realtimeSimpleStyle.d.ts","sourceRoot":"","sources":["../../../src/common/styles/realtimeSimpleStyle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"realtimeSimpleStyle.d.ts","sourceRoot":"","sources":["../../../src/common/styles/realtimeSimpleStyle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAOzD,QAAA,MAAM,mBAAmB,EAAE,qBAiB1B,CAAC;AACF,eAAe,mBAAmB,CAAC"}
|
package/common/typedefs.js
CHANGED
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
*/
|
|
40
40
|
/**
|
|
41
41
|
* @typedef {Object} LayerCommonOptions
|
|
42
|
-
* @property {string} key Identifier of the layer. Must be unique.
|
|
42
|
+
* @property {string!} key Identifier of the layer. Must be unique.
|
|
43
43
|
* @property {string!} name Name of the layer.
|
|
44
44
|
* @property {string!} group Group of the layer.
|
|
45
|
-
* @property {string[]} copyrights List of copyrights.
|
|
46
|
-
* @property {Layer[]} children List of children layers.
|
|
45
|
+
* @property {string[]!} copyrights List of copyrights.
|
|
46
|
+
* @property {Layer[]!} children List of children layers.
|
|
47
47
|
* @property {boolean!} visible Define if the layer is currently display on the map.
|
|
48
48
|
* @property {boolean!} disabled Define if the layer is currently display on the map but can't be seen (extent, zoom ,data restrictions).
|
|
49
49
|
* @property {number!} hittolerance Hit-detection tolerance in css pixels. Pixels inside the radius around the given position will be checked for features.
|
|
@@ -8,6 +8,6 @@ import { RealtimeTrajectory } from '../../types';
|
|
|
8
8
|
* @param {Regexp} regexLine - A regex aplly of vehcile's name.
|
|
9
9
|
* @private
|
|
10
10
|
*/
|
|
11
|
-
declare const
|
|
12
|
-
export default
|
|
13
|
-
//# sourceMappingURL=
|
|
11
|
+
declare const createRealtimeFilters: (line: string | string[], route: string | string[], operator: string | string[], regexLine: string | string[]) => ((trajectory: RealtimeTrajectory) => boolean) | null;
|
|
12
|
+
export default createRealtimeFilters;
|
|
13
|
+
//# sourceMappingURL=createRealtimeFilters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRealtimeFilters.d.ts","sourceRoot":"","sources":["../../../src/common/utils/createRealtimeFilters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD;;;;;;;;GAQG;AACH,QAAA,MAAM,qBAAqB,SACnB,MAAM,GAAG,MAAM,EAAE,SAChB,MAAM,GAAG,MAAM,EAAE,YACd,MAAM,GAAG,MAAM,EAAE,aAChB,MAAM,GAAG,MAAM,EAAE,mBACb,kBAAkB,KAAK,OAAO,QA8E9C,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @param {Regexp} regexLine - A regex aplly of vehcile's name.
|
|
8
8
|
* @private
|
|
9
9
|
*/
|
|
10
|
-
const
|
|
10
|
+
const createRealtimeFilters = (line, route, operator, regexLine) => {
|
|
11
11
|
const filterList = [];
|
|
12
12
|
if (!line && !route && !operator && !regexLine) {
|
|
13
13
|
return null;
|
|
@@ -71,4 +71,4 @@ const createFilters = (line, route, operator, regexLine) => {
|
|
|
71
71
|
return true;
|
|
72
72
|
};
|
|
73
73
|
};
|
|
74
|
-
export default
|
|
74
|
+
export default createRealtimeFilters;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { RealtimeDeparture, RealtimeDepartureExtended } from '../../types';
|
|
2
|
+
import type { WebSocketAPIMessageCallback } from '../api/WebSocketAPI';
|
|
3
|
+
/**
|
|
4
|
+
* This function returns a WebSocket api callback, and call the onDeparturesUpdate function with the list of current departures to display.
|
|
5
|
+
* @param {function(departures: RealtimeDeparture[])} onDeparturesUpdate callback when list of departures changes, called after 100 ms
|
|
6
|
+
* @param {boolean} [sortByMinArrivalTime = true] Sort departures by arrival time
|
|
7
|
+
* @param {number} [maxDepartureAge = 30] max departure age of departures in minutes
|
|
8
|
+
* @param {number} [timeout = 100] debounce timeout in ms
|
|
9
|
+
*/
|
|
10
|
+
declare const debounceDeparturesMessages: (onDeparturesUpdate: (departures: RealtimeDepartureExtended[]) => {}, sortByMinArrivalTime?: boolean, maxDepartureAge?: number, timeout?: number) => WebSocketAPIMessageCallback<RealtimeDeparture>;
|
|
11
|
+
export default debounceDeparturesMessages;
|
|
12
|
+
//# sourceMappingURL=debounceDeparturesMessages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debounceDeparturesMessages.d.ts","sourceRoot":"","sources":["../../../src/common/utils/debounceDeparturesMessages.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,KAAK,EACV,2BAA2B,EAE5B,MAAM,qBAAqB,CAAC;AAG7B;;;;;;GAMG;AACH,QAAA,MAAM,0BAA0B,oCACG,yBAAyB,EAAE,KAAK,EAAE,iFAIlE,4BAA4B,iBAAiB,CAwB/C,CAAC;AAEF,eAAe,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import sortAndfilterDepartures from './sortAndFilterDepartures';
|
|
2
|
+
/**
|
|
3
|
+
* This function returns a WebSocket api callback, and call the onDeparturesUpdate function with the list of current departures to display.
|
|
4
|
+
* @param {function(departures: RealtimeDeparture[])} onDeparturesUpdate callback when list of departures changes, called after 100 ms
|
|
5
|
+
* @param {boolean} [sortByMinArrivalTime = true] Sort departures by arrival time
|
|
6
|
+
* @param {number} [maxDepartureAge = 30] max departure age of departures in minutes
|
|
7
|
+
* @param {number} [timeout = 100] debounce timeout in ms
|
|
8
|
+
*/
|
|
9
|
+
const debounceDeparturesMessages = (onDeparturesUpdate, sortByMinArrivalTime = true, maxDepartureAge = 30, timeout = 100) => {
|
|
10
|
+
const departureUpdateTimeout = {};
|
|
11
|
+
const departureObject = {};
|
|
12
|
+
return (data) => {
|
|
13
|
+
const { source, content: departure } = data;
|
|
14
|
+
if (departureUpdateTimeout[source]) {
|
|
15
|
+
window.clearTimeout(departureUpdateTimeout[source]);
|
|
16
|
+
}
|
|
17
|
+
departureObject[departure.call_id] = departure;
|
|
18
|
+
departureUpdateTimeout[source] = window.setTimeout(() => {
|
|
19
|
+
const departures = sortAndfilterDepartures(departureObject, sortByMinArrivalTime || false, maxDepartureAge);
|
|
20
|
+
onDeparturesUpdate(departures);
|
|
21
|
+
}, timeout);
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export default debounceDeparturesMessages;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { WebSocketAPIMessageCallback } from '../api/WebSocketAPI';
|
|
2
|
+
/**
|
|
3
|
+
* This function returns a WebSocket api callback, and call the onUpdate function with the list of of subscribed objects changes.
|
|
4
|
+
*
|
|
5
|
+
* @param {function(objects: any[])} onUpdate callback when list of subscribed objects changes, called after 100 ms
|
|
6
|
+
* @param {function(object: any)} [getObjectId = true] function returning the id of an object
|
|
7
|
+
* @param {number} [timeout = 100] debounce timeout in ms
|
|
8
|
+
*/
|
|
9
|
+
declare const debounceWebsocketMessages: (onUpdate: (objects: any[]) => void, getObjectId?: ((object: any) => string) | undefined, timeout?: number) => WebSocketAPIMessageCallback<any>;
|
|
10
|
+
export default debounceWebsocketMessages;
|
|
11
|
+
//# sourceMappingURL=debounceWebsocketMessages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debounceWebsocketMessages.d.ts","sourceRoot":"","sources":["../../../src/common/utils/debounceWebsocketMessages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2BAA2B,EAE5B,MAAM,qBAAqB,CAAC;AAE7B;;;;;;GAMG;AACH,QAAA,MAAM,yBAAyB,uBACT,GAAG,EAAE,KAAK,IAAI,0BACX,GAAG,KAAK,MAAM,oCAEpC,4BAA4B,GAAG,CA2BjC,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This function returns a WebSocket api callback, and call the onUpdate function with the list of of subscribed objects changes.
|
|
3
|
+
*
|
|
4
|
+
* @param {function(objects: any[])} onUpdate callback when list of subscribed objects changes, called after 100 ms
|
|
5
|
+
* @param {function(object: any)} [getObjectId = true] function returning the id of an object
|
|
6
|
+
* @param {number} [timeout = 100] debounce timeout in ms
|
|
7
|
+
*/
|
|
8
|
+
const debounceWebsocketMessages = (onUpdate, getObjectId, timeout = 100) => {
|
|
9
|
+
const updateTimeout = {};
|
|
10
|
+
const objectsById = {};
|
|
11
|
+
const objects = [];
|
|
12
|
+
return (data) => {
|
|
13
|
+
const { source, content } = data;
|
|
14
|
+
if (updateTimeout[source]) {
|
|
15
|
+
window.clearTimeout(updateTimeout[source]);
|
|
16
|
+
}
|
|
17
|
+
if (getObjectId) {
|
|
18
|
+
objectsById[getObjectId(content)] = content;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
objects.push(content);
|
|
22
|
+
}
|
|
23
|
+
updateTimeout[source] = window.setTimeout(() => {
|
|
24
|
+
const objectToReturn = getObjectId ? Object.values(objectsById) : objects;
|
|
25
|
+
onUpdate(objectToReturn);
|
|
26
|
+
}, timeout);
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export default debounceWebsocketMessages;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { MapboxLayer } from '../../ol';
|
|
1
|
+
import { RenderFunction } from 'ol/layer/Layer';
|
|
2
|
+
import type { MapboxLayer } from '../../ol';
|
|
3
3
|
/**
|
|
4
4
|
* Return the render function fo the olLayer of a MaplibreLayer
|
|
5
5
|
*/
|
|
6
|
-
export default function getMapboxRender(mapoxLayer: MapboxLayer):
|
|
6
|
+
export default function getMapboxRender(mapoxLayer: MapboxLayer): RenderFunction;
|
|
7
7
|
//# sourceMappingURL=getMapboxRender.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMapboxRender.d.ts","sourceRoot":"","sources":["../../../src/common/utils/getMapboxRender.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"getMapboxRender.d.ts","sourceRoot":"","sources":["../../../src/common/utils/getMapboxRender.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,UAAU,EAAE,WAAW,GACtB,cAAc,CAwFhB"}
|
|
@@ -3,10 +3,11 @@ import { toLonLat } from 'ol/proj';
|
|
|
3
3
|
* Return the render function fo the olLayer of a MaplibreLayer
|
|
4
4
|
*/
|
|
5
5
|
export default function getMapboxRender(mapoxLayer) {
|
|
6
|
+
const emptyDiv = document.createElement('div');
|
|
6
7
|
return (frameState) => {
|
|
7
8
|
const { map, mbMap, renderState, olLayer } = mapoxLayer;
|
|
8
9
|
if (!map || !mbMap) {
|
|
9
|
-
return
|
|
10
|
+
return emptyDiv;
|
|
10
11
|
}
|
|
11
12
|
let changed = false;
|
|
12
13
|
const canvas = mbMap.getCanvas();
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { RenderFunction } from 'ol/layer/Layer';
|
|
2
|
+
import type { MaplibreLayer } from '../../ol';
|
|
1
3
|
/**
|
|
2
4
|
* Return the render function fo the olLayer of a MaplibreLayer
|
|
3
5
|
*/
|
|
4
|
-
export default function getMaplibreRender(maplibreLayer:
|
|
6
|
+
export default function getMaplibreRender(maplibreLayer: MaplibreLayer): RenderFunction;
|
|
5
7
|
//# sourceMappingURL=getMaplibreRender.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMaplibreRender.d.ts","sourceRoot":"","sources":["../../../src/common/utils/getMaplibreRender.
|
|
1
|
+
{"version":3,"file":"getMaplibreRender.d.ts","sourceRoot":"","sources":["../../../src/common/utils/getMaplibreRender.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C;;GAEG;AAEH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,aAAa,EAAE,aAAa,GAC3B,cAAc,CAoChB"}
|
|
@@ -4,21 +4,21 @@ import { toDegrees } from 'ol/math';
|
|
|
4
4
|
* Return the render function fo the olLayer of a MaplibreLayer
|
|
5
5
|
*/
|
|
6
6
|
export default function getMaplibreRender(maplibreLayer) {
|
|
7
|
+
const emptyDiv = document.createElement('div');
|
|
7
8
|
return (frameState) => {
|
|
8
9
|
const { map, mbMap, olLayer } = maplibreLayer;
|
|
9
10
|
if (!map || !mbMap) {
|
|
10
|
-
return
|
|
11
|
+
return emptyDiv;
|
|
11
12
|
}
|
|
12
13
|
const canvas = mbMap.getCanvas();
|
|
13
14
|
const { viewState } = frameState;
|
|
14
|
-
const opacity = olLayer.getOpacity();
|
|
15
|
-
canvas.style.opacity = opacity
|
|
15
|
+
const opacity = (olLayer === null || olLayer === void 0 ? void 0 : olLayer.getOpacity()) || 1;
|
|
16
|
+
canvas.style.opacity = `${opacity}`;
|
|
16
17
|
// adjust view parameters in mapbox
|
|
17
18
|
mbMap.jumpTo({
|
|
18
19
|
center: toLonLat(viewState.center),
|
|
19
20
|
zoom: viewState.zoom - 1,
|
|
20
21
|
bearing: toDegrees(-viewState.rotation),
|
|
21
|
-
animate: false,
|
|
22
22
|
});
|
|
23
23
|
if (!canvas.isConnected) {
|
|
24
24
|
// The canvas is not connected to the DOM, request a map rendering at the next animation frame
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import type { RealtimeMode } from '../../types';
|
|
2
|
+
import type { RealtimeModesType } from '../../api/RealtimeAPI';
|
|
2
3
|
/**
|
|
3
4
|
* Get the websocket channel suffix, depending on the current mode.
|
|
4
5
|
* @param {String} mode Mode 'topographic' ou 'schematic'.
|
|
5
6
|
* @private
|
|
6
7
|
*/
|
|
7
|
-
declare
|
|
8
|
+
declare const getModeSuffix: (mode: RealtimeMode, modes: RealtimeModesType) => string;
|
|
9
|
+
export default getModeSuffix;
|
|
8
10
|
//# sourceMappingURL=getRealtimeModeSuffix.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRealtimeModeSuffix.d.ts","sourceRoot":"","sources":["../../../src/common/utils/getRealtimeModeSuffix.
|
|
1
|
+
{"version":3,"file":"getRealtimeModeSuffix.d.ts","sourceRoot":"","sources":["../../../src/common/utils/getRealtimeModeSuffix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D;;;;GAIG;AACH,QAAA,MAAM,aAAa,SAAU,YAAY,SAAS,iBAAiB,KAAG,MACxB,CAAC;AAE/C,eAAe,aAAa,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export default getUrlWithParams;
|
|
2
1
|
/**
|
|
3
2
|
* Return the styleUrl with apiKey parameters set.
|
|
4
3
|
* @param {string} url a url.
|
|
5
4
|
* @param {Object<String,String>} params a list of key/value pair to add to the url.
|
|
6
5
|
* @ignore
|
|
7
6
|
*/
|
|
8
|
-
declare
|
|
7
|
+
declare const getUrlWithParams: (url: string, params: Object) => URL;
|
|
8
|
+
export default getUrlWithParams;
|
|
9
9
|
//# sourceMappingURL=getUrlWithParams.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getUrlWithParams.d.ts","sourceRoot":"","sources":["../../../src/common/utils/getUrlWithParams.
|
|
1
|
+
{"version":3,"file":"getUrlWithParams.d.ts","sourceRoot":"","sources":["../../../src/common/utils/getUrlWithParams.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,QAAA,MAAM,gBAAgB,QAAS,MAAM,UAAU,MAAM,KAAG,GAYvD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { Coordinate } from 'ol/coordinate';
|
|
2
|
+
export declare type VehiclePosition = {
|
|
3
|
+
coord: Coordinate;
|
|
4
|
+
rotation: number;
|
|
5
|
+
};
|
|
2
6
|
/**
|
|
3
7
|
* Interpolate or not the vehicle position from a trajectory at a specific date.
|
|
4
8
|
*
|
|
@@ -7,8 +11,6 @@ export default getVehiclePosition;
|
|
|
7
11
|
* @param {boolean} noInterpolate If true, the vehicle position is not interpolated on each render but only once.
|
|
8
12
|
* @returns
|
|
9
13
|
*/
|
|
10
|
-
declare
|
|
11
|
-
|
|
12
|
-
rotation: any;
|
|
13
|
-
};
|
|
14
|
+
declare const getVehiclePosition: (now: number, trajectory: GeoJSONFeature, noInterpolate: boolean) => VehiclePosition;
|
|
15
|
+
export default getVehiclePosition;
|
|
14
16
|
//# sourceMappingURL=getVehiclePosition.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getVehiclePosition.d.ts","sourceRoot":"","sources":["../../../src/common/utils/getVehiclePosition.
|
|
1
|
+
{"version":3,"file":"getVehiclePosition.d.ts","sourceRoot":"","sources":["../../../src/common/utils/getVehiclePosition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,oBAAY,eAAe,GAAG;IAC5B,KAAK,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;;;GAOG;AACH,QAAA,MAAM,kBAAkB,QACjB,MAAM,6CAEI,OAAO,KACrB,eA2DF,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
package/common/utils/index.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
export { default as getUrlWithParams } from "./getUrlWithParams";
|
|
2
2
|
export { default as getMapboxMapCopyrights } from "./getMapboxMapCopyrights";
|
|
3
3
|
export { default as removeDuplicate } from "./removeDuplicate";
|
|
4
|
-
export { default as
|
|
4
|
+
export { default as createRealtimeFilters } from "./createRealtimeFilters";
|
|
5
5
|
export { default as getLayersAsFlatArray } from "./getLayersAsFlatArray";
|
|
6
6
|
export * from "./timeUtils";
|
|
7
7
|
export { default as sortByDelay } from "./sortByDelay";
|
|
8
8
|
export { default as renderTrajectories } from "./renderTrajectories";
|
|
9
9
|
export { default as getMaplibreRender } from "./getMaplibreRender";
|
|
10
10
|
export { default as getMapboxRender } from "./getMapboxRender";
|
|
11
|
-
export
|
|
11
|
+
export { default as debounceDeparturesMessages } from "./debounceDeparturesMessages";
|
|
12
|
+
export { default as debounceWebsocketMessages } from "./debounceWebsocketMessages";
|
|
13
|
+
export { default as sortAndFilterDepartures } from "./sortAndFilterDepartures";
|
|
14
|
+
export * as realtimeConfig from "./realtimeConfig";
|
|
12
15
|
//# sourceMappingURL=index.d.ts.map
|
package/common/utils/index.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
export { default as getUrlWithParams } from './getUrlWithParams';
|
|
2
2
|
export { default as getMapboxMapCopyrights } from './getMapboxMapCopyrights';
|
|
3
3
|
export { default as removeDuplicate } from './removeDuplicate';
|
|
4
|
-
export { default as
|
|
4
|
+
export { default as createRealtimeFilters } from './createRealtimeFilters';
|
|
5
5
|
export { default as getLayersAsFlatArray } from './getLayersAsFlatArray';
|
|
6
6
|
export * from './timeUtils';
|
|
7
7
|
export { default as sortByDelay } from './sortByDelay';
|
|
8
8
|
export { default as renderTrajectories } from './renderTrajectories';
|
|
9
9
|
export { default as getMaplibreRender } from './getMaplibreRender';
|
|
10
10
|
export { default as getMapboxRender } from './getMapboxRender';
|
|
11
|
-
|
|
12
|
-
export {
|
|
11
|
+
export { default as debounceDeparturesMessages } from './debounceDeparturesMessages';
|
|
12
|
+
export { default as debounceWebsocketMessages } from './debounceWebsocketMessages';
|
|
13
|
+
export { default as sortAndFilterDepartures } from './sortAndFilterDepartures';
|
|
14
|
+
import * as realtimeConfig_1 from './realtimeConfig';
|
|
15
|
+
export { realtimeConfig_1 as realtimeConfig };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { AnyCanvasContext, RealtimeMot } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Trajserv value: 'Tram', 'Subway / Metro / S-Bahn', 'Train', 'Bus', 'Ferry', 'Cable Car', 'Gondola', 'Funicular', 'Long distance bus', 'Rail',
|
|
4
|
+
* New endpoint use Rail instead of Train.
|
|
5
|
+
* New tracker values: null, "tram", "subway", "rail", "bus", "ferry", "cablecar", "gondola", "funicular", "coach".
|
|
6
|
+
*
|
|
7
|
+
* @ignore
|
|
8
|
+
*/
|
|
9
|
+
export declare const types: RegExp[];
|
|
10
|
+
/**
|
|
11
|
+
* @ignore
|
|
12
|
+
*/
|
|
13
|
+
export declare const bgColors: string[];
|
|
14
|
+
/**
|
|
15
|
+
* @ignore
|
|
16
|
+
*/
|
|
17
|
+
export declare const textColors: string[];
|
|
18
|
+
/**
|
|
19
|
+
* @ignore
|
|
20
|
+
*/
|
|
21
|
+
export declare const getTypeIndex: (type: RealtimeMot) => number;
|
|
22
|
+
/**
|
|
23
|
+
* @ignore
|
|
24
|
+
*/
|
|
25
|
+
export declare const getRadius: (type: RealtimeMot, zoom: number) => number;
|
|
26
|
+
/**
|
|
27
|
+
* @ignore
|
|
28
|
+
*/
|
|
29
|
+
export declare const getBgColor: (type: RealtimeMot) => string;
|
|
30
|
+
/**
|
|
31
|
+
* @ignore
|
|
32
|
+
*/
|
|
33
|
+
export declare const getTextColor: (type: RealtimeMot) => string;
|
|
34
|
+
/**
|
|
35
|
+
* @ignore
|
|
36
|
+
*/
|
|
37
|
+
export declare const getTextSize: (ctx: AnyCanvasContext, markerSize: number, text: string, fontSize: number) => number;
|
|
38
|
+
/**
|
|
39
|
+
* @ignore
|
|
40
|
+
* @param {number} delayInMs Delay in milliseconds.
|
|
41
|
+
* @param {boolean} cancelled true if the journey is cancelled.
|
|
42
|
+
* @param {boolean} isDelayText true if the color is used for delay text of the symbol.
|
|
43
|
+
*/
|
|
44
|
+
export declare const getDelayColor: (delayInMs: number, cancelled: boolean, isDelayText: boolean) => string;
|
|
45
|
+
/**
|
|
46
|
+
* @ignore
|
|
47
|
+
*/
|
|
48
|
+
export declare const getDelayText: (delayInMs: number, cancelled: boolean) => string;
|
|
49
|
+
//# sourceMappingURL=realtimeConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtimeConfig.d.ts","sourceRoot":"","sources":["../../../src/common/utils/realtimeConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAe5D;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,EAAE,MAAM,EAWzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,MAAM,EAW5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,MAAM,EAW9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,SAAU,WAAW,KAAG,MAKhD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,SAAU,WAAW,QAAQ,MAAM,KAAG,MAO3D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,SAAU,WAAW,KAAG,MAO9C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,SAAU,WAAW,KAAG,MAOhD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,QACjB,gBAAgB,cACT,MAAM,QACZ,MAAM,YACF,MAAM,KACf,MAkBF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,cACb,MAAM,aACN,OAAO,eACL,OAAO,KACnB,MAoBF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,cAAe,MAAM,aAAa,OAAO,KAAG,MAmBpE,CAAC"}
|