mobility-toolbox-js 2.0.0-beta.55 → 2.0.0-beta.57
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/api/RealtimeAPI.d.ts +5 -5
- package/api/RealtimeAPI.d.ts.map +1 -1
- package/api/RealtimeAPI.js +20 -16
- package/common/mixins/RealtimeLayerMixin.d.ts +0 -1
- package/common/mixins/RealtimeLayerMixin.d.ts.map +1 -1
- package/common/mixins/RealtimeLayerMixin.js +12 -4
- package/common/utils/debounceDeparturesMessages.js +3 -3
- package/common/utils/getRealtimeModeSuffix.d.ts +3 -3
- package/common/utils/getRealtimeModeSuffix.d.ts.map +1 -1
- package/common/utils/getRealtimeModeSuffix.js +8 -2
- package/common/utils/index.d.ts +1 -0
- package/common/utils/index.js +1 -0
- package/mapbox/layers/RealtimeLayer.d.ts +5 -1
- package/mapbox/layers/RealtimeLayer.d.ts.map +1 -1
- package/mbt.js +41 -19
- package/mbt.js.map +2 -2
- package/mbt.min.js +17 -17
- package/mbt.min.js.map +2 -2
- package/ol/layers/RealtimeLayer.d.ts +3 -1
- package/ol/layers/RealtimeLayer.d.ts.map +1 -1
- package/ol/layers/RealtimeLayer.js +6 -1
- package/package.json +1 -1
package/api/RealtimeAPI.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import WebSocketAPI, { WebSocketAPIMessageCallback, WebSocketAPIMessageEventData } from '../common/api/WebSocketAPI';
|
|
2
|
-
import { RealtimeMode, RealtimeDeparture, RealtimeNews, RealtimeStation, RealtimeExtraGeom, RealtimeTrainId, RealtimeGeneralizationLevel, RealtimeFullTrajectory, RealtimeTrajectoryResponse, RealtimeStationId } from '../types';
|
|
2
|
+
import { RealtimeMode, RealtimeDeparture, RealtimeNews, RealtimeStation, RealtimeExtraGeom, RealtimeTrainId, RealtimeGeneralizationLevel, RealtimeFullTrajectory, RealtimeTrajectoryResponse, RealtimeStationId, RealtimeTenant } from '../types';
|
|
3
3
|
import { StopSequence } from './typedefs';
|
|
4
4
|
export declare type RealtimeAPIOptions = {
|
|
5
5
|
url?: string;
|
|
6
6
|
apiKey?: string;
|
|
7
|
-
|
|
7
|
+
tenant?: RealtimeTenant;
|
|
8
8
|
projection?: string;
|
|
9
9
|
bbox?: (number | string)[];
|
|
10
10
|
buffer?: number[];
|
|
@@ -57,7 +57,7 @@ declare class RealtimeAPI {
|
|
|
57
57
|
projection?: string;
|
|
58
58
|
bbox?: (number | string)[];
|
|
59
59
|
buffer?: number[];
|
|
60
|
-
|
|
60
|
+
tenant?: RealtimeTenant;
|
|
61
61
|
pingInterval: number;
|
|
62
62
|
pingIntervalMs: number;
|
|
63
63
|
reconnectTimeout?: number;
|
|
@@ -68,7 +68,7 @@ declare class RealtimeAPI {
|
|
|
68
68
|
* @param {Object|string} options A string representing the url of the service or an object containing the url and the apiKey.
|
|
69
69
|
* @param {string} options.url Url to the [geOps realtime api](https://developer.geops.io/apis/realtime/).
|
|
70
70
|
* @param {string} options.apiKey Access key for [geOps apis](https://developer.geops.io/).
|
|
71
|
-
* @param {string} [options.
|
|
71
|
+
* @param {string} [options.tenant=''] Tenant of the provider. Use to limitate some subscriptions to a specfic provider (it is used by schematic channels and newsticker).
|
|
72
72
|
* @param {string} [options.projection] The epsg code of the projection for features. Default to EPSG:3857.
|
|
73
73
|
* @param {number[4]} [options.bbox=[minX, minY, maxX, maxY, zoom, tenant] The bounding box to receive data from.
|
|
74
74
|
*/
|
|
@@ -151,7 +151,7 @@ declare class RealtimeAPI {
|
|
|
151
151
|
*/
|
|
152
152
|
getStation(uic: RealtimeStationId, mode: RealtimeMode): Promise<WebSocketAPIMessageEventData<RealtimeStation>>;
|
|
153
153
|
/**
|
|
154
|
-
* Get the list of
|
|
154
|
+
* Get the list of stations available for a specifc mode. The promise is resolved every 100ms
|
|
155
155
|
* @param {RealtimeMode} mode Realtime mode.
|
|
156
156
|
* @param {number} timeout = 100 Duration in ms between each promise resolve calls.
|
|
157
157
|
* @return {Promise<RealtimeStation[]>} An array of stations.
|
package/api/RealtimeAPI.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RealtimeAPI.d.ts","sourceRoot":"","sources":["../../src/api/RealtimeAPI.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,EAAE,EACnB,2BAA2B,EAC3B,4BAA4B,EAC7B,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,2BAA2B,EAC3B,sBAAsB,EACtB,0BAA0B,EAC1B,iBAAiB,
|
|
1
|
+
{"version":3,"file":"RealtimeAPI.d.ts","sourceRoot":"","sources":["../../src/api/RealtimeAPI.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,EAAE,EACnB,2BAA2B,EAC3B,4BAA4B,EAC7B,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,2BAA2B,EAC3B,sBAAsB,EACtB,0BAA0B,EAC1B,iBAAiB,EACjB,cAAc,EACf,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,oBAAY,kBAAkB,GAAG;IAC/B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,CAAC,OAAO,MAAM,yBAAyB,GAAG;IAC9C,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB,CAA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,SAAS,EAAE,2BAA2B,CAAC,MAAM,CAAC,EAC9C,OAAO,GAAE,aAAwB,EACjC,KAAK,GAAE,OAAe;IAKxB;;;OAGG;IACH,sBAAsB,CAAC,SAAS,CAAC,EAAE,2BAA2B,CAAC,MAAM,CAAC;CAGvE;AACD,eAAe,WAAW,CAAC"}
|
package/api/RealtimeAPI.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import WebSocketAPI from '../common/api/WebSocketAPI';
|
|
2
2
|
import debounceWebsocketMessages from '../common/utils/debounceWebsocketMessages';
|
|
3
|
-
import
|
|
3
|
+
import getRealtimeModeSuffix from '../common/utils/getRealtimeModeSuffix';
|
|
4
4
|
/**
|
|
5
5
|
* Enum for Realtime modes.
|
|
6
6
|
* @readonly
|
|
@@ -38,14 +38,14 @@ class RealtimeAPI {
|
|
|
38
38
|
* @param {Object|string} options A string representing the url of the service or an object containing the url and the apiKey.
|
|
39
39
|
* @param {string} options.url Url to the [geOps realtime api](https://developer.geops.io/apis/realtime/).
|
|
40
40
|
* @param {string} options.apiKey Access key for [geOps apis](https://developer.geops.io/).
|
|
41
|
-
* @param {string} [options.
|
|
41
|
+
* @param {string} [options.tenant=''] Tenant of the provider. Use to limitate some subscriptions to a specfic provider (it is used by schematic channels and newsticker).
|
|
42
42
|
* @param {string} [options.projection] The epsg code of the projection for features. Default to EPSG:3857.
|
|
43
43
|
* @param {number[4]} [options.bbox=[minX, minY, maxX, maxY, zoom, tenant] The bounding box to receive data from.
|
|
44
44
|
*/
|
|
45
45
|
constructor(options = {}) {
|
|
46
46
|
this.defineProperties(options);
|
|
47
47
|
/** @ignore */
|
|
48
|
-
this.
|
|
48
|
+
this.tenant = options.tenant;
|
|
49
49
|
/** @ignore */
|
|
50
50
|
this.onOpen = this.onOpen.bind(this);
|
|
51
51
|
}
|
|
@@ -219,9 +219,9 @@ class RealtimeAPI {
|
|
|
219
219
|
* @private
|
|
220
220
|
*/
|
|
221
221
|
unsubscribe(channel, suffix = '', onMessage) {
|
|
222
|
-
const
|
|
223
|
-
const suffixTopographic =
|
|
224
|
-
this.wsApi.unsubscribe(`${channel}${
|
|
222
|
+
const suffixSchematic = getRealtimeModeSuffix(RealtimeModes.SCHEMATIC, RealtimeModes, this.tenant);
|
|
223
|
+
const suffixTopographic = getRealtimeModeSuffix(RealtimeModes.TOPOGRAPHIC, RealtimeModes, this.tenant);
|
|
224
|
+
this.wsApi.unsubscribe(`${channel}${suffixSchematic}${suffix || ''}`, onMessage);
|
|
225
225
|
this.wsApi.unsubscribe(`${channel}${suffixTopographic}${suffix || ''}`, onMessage);
|
|
226
226
|
}
|
|
227
227
|
/**
|
|
@@ -252,7 +252,8 @@ class RealtimeAPI {
|
|
|
252
252
|
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
253
253
|
*/
|
|
254
254
|
subscribeDisruptions(onMessage, onError = () => { }, quiet = false) {
|
|
255
|
-
this.
|
|
255
|
+
const channel = [this.tenant, 'newsticker'];
|
|
256
|
+
this.subscribe(channel.join('_'), onMessage, onError, quiet);
|
|
256
257
|
}
|
|
257
258
|
/**
|
|
258
259
|
* Unsubscribe disruptions.
|
|
@@ -260,7 +261,8 @@ class RealtimeAPI {
|
|
|
260
261
|
* @param {function(data: { content: RealtimeNews[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
261
262
|
*/
|
|
262
263
|
unsubscribeDisruptions(onMessage) {
|
|
263
|
-
this.
|
|
264
|
+
const channel = [this.tenant, 'newsticker'];
|
|
265
|
+
this.unsubscribe(channel.join('_'), '', onMessage);
|
|
264
266
|
}
|
|
265
267
|
/**
|
|
266
268
|
* Return a station with a given uic number and a mode.
|
|
@@ -271,7 +273,7 @@ class RealtimeAPI {
|
|
|
271
273
|
*/
|
|
272
274
|
getStation(uic, mode) {
|
|
273
275
|
const params = {
|
|
274
|
-
channel: `station${
|
|
276
|
+
channel: `station${getRealtimeModeSuffix(mode, RealtimeModes, this.tenant)}`,
|
|
275
277
|
args: uic,
|
|
276
278
|
};
|
|
277
279
|
return new Promise((resolve, reject) => {
|
|
@@ -279,7 +281,7 @@ class RealtimeAPI {
|
|
|
279
281
|
});
|
|
280
282
|
}
|
|
281
283
|
/**
|
|
282
|
-
* Get the list of
|
|
284
|
+
* Get the list of stations available for a specifc mode. The promise is resolved every 100ms
|
|
283
285
|
* @param {RealtimeMode} mode Realtime mode.
|
|
284
286
|
* @param {number} timeout = 100 Duration in ms between each promise resolve calls.
|
|
285
287
|
* @return {Promise<RealtimeStation[]>} An array of stations.
|
|
@@ -287,7 +289,7 @@ class RealtimeAPI {
|
|
|
287
289
|
getStations(mode, timeout = 100) {
|
|
288
290
|
return new Promise((resolve) => {
|
|
289
291
|
this.wsApi.get({
|
|
290
|
-
channel: `station${
|
|
292
|
+
channel: `station${getRealtimeModeSuffix(mode, RealtimeModes, this.tenant)}`,
|
|
291
293
|
}, debounceWebsocketMessages(resolve, undefined, timeout));
|
|
292
294
|
});
|
|
293
295
|
}
|
|
@@ -301,7 +303,7 @@ class RealtimeAPI {
|
|
|
301
303
|
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
302
304
|
*/
|
|
303
305
|
subscribeStations(mode, onMessage, onError = () => { }, quiet = false) {
|
|
304
|
-
this.subscribe(`station${
|
|
306
|
+
this.subscribe(`station${getRealtimeModeSuffix(mode, RealtimeModes, this.tenant)}`, onMessage, onError, quiet);
|
|
305
307
|
}
|
|
306
308
|
/**
|
|
307
309
|
* Unsubscribe to stations channel.
|
|
@@ -337,7 +339,7 @@ class RealtimeAPI {
|
|
|
337
339
|
*/
|
|
338
340
|
subscribeTrajectory(mode, onMessage, onError = () => { }, quiet = false) {
|
|
339
341
|
this.unsubscribeTrajectory(onMessage);
|
|
340
|
-
this.subscribe(`trajectory${
|
|
342
|
+
this.subscribe(`trajectory${getRealtimeModeSuffix(mode, RealtimeModes, this.tenant)}`, onMessage, onError, quiet);
|
|
341
343
|
}
|
|
342
344
|
/**
|
|
343
345
|
* Unsubscribe to trajectory channels.
|
|
@@ -356,7 +358,7 @@ class RealtimeAPI {
|
|
|
356
358
|
*/
|
|
357
359
|
subscribeDeletedVehicles(mode, onMessage, onError = () => { }, quiet = false) {
|
|
358
360
|
this.unsubscribeDeletedVehicles(onMessage);
|
|
359
|
-
this.subscribe(`deleted_vehicles${
|
|
361
|
+
this.subscribe(`deleted_vehicles${getRealtimeModeSuffix(mode, RealtimeModes, this.tenant)}`, onMessage, onError, quiet);
|
|
360
362
|
}
|
|
361
363
|
/**
|
|
362
364
|
* Unsubscribe to deleted_vhicles channels.
|
|
@@ -374,7 +376,9 @@ class RealtimeAPI {
|
|
|
374
376
|
* @return {Promise<{ data: { content: FullTrajectory } }>} Return a full trajectory.
|
|
375
377
|
*/
|
|
376
378
|
getFullTrajectory(id, mode, generalizationLevel) {
|
|
377
|
-
const channel = [
|
|
379
|
+
const channel = [
|
|
380
|
+
`full_trajectory${getRealtimeModeSuffix(mode, RealtimeModes)}`,
|
|
381
|
+
];
|
|
378
382
|
if (id) {
|
|
379
383
|
channel.push(id);
|
|
380
384
|
}
|
|
@@ -398,7 +402,7 @@ class RealtimeAPI {
|
|
|
398
402
|
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
399
403
|
*/
|
|
400
404
|
subscribeFullTrajectory(id, mode, onMessage, onError = () => { }, quiet = false) {
|
|
401
|
-
this.subscribe(`full_trajectory${
|
|
405
|
+
this.subscribe(`full_trajectory${getRealtimeModeSuffix(mode, RealtimeModes)}_${id}`, onMessage, onError, quiet);
|
|
402
406
|
}
|
|
403
407
|
/**
|
|
404
408
|
* Unsubscribe from full_trajectory channel
|
|
@@ -36,7 +36,6 @@ export declare type RealtimeLayerMixinOptions = OlLayerOptions & {
|
|
|
36
36
|
getRenderTimeIntervalByZoom?: (zoom: number, renderTimeIntervalByZoom: number[]) => number;
|
|
37
37
|
url?: string;
|
|
38
38
|
apiKey?: string;
|
|
39
|
-
prefix?: string;
|
|
40
39
|
projection?: string;
|
|
41
40
|
bbox?: (number | string)[];
|
|
42
41
|
buffer?: number[];
|
|
@@ -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,WAAW,EACX,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,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,oBAAY,yBAAyB,GAAG,cAAc,GAAG;IACvD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,GAAG,CAAC,EAAE,WAAW,CAAC;IAClB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,UAAU,CAAC,EAAE,WAAW,EAAE,EAAE,CAAC;IAC7B,yBAAyB,CAAC,EAAE,2BAA2B,EAAE,CAAC;IAC1D,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;IACpC,KAAK,CAAC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) {
|
|
65
65
|
super(Object.assign({ hitTolerance: 10 }, options));
|
|
66
|
+
this.minZoomInterpolation = 8;
|
|
66
67
|
this.debug = options.debug || false;
|
|
67
68
|
this.mode = options.mode || RealtimeModes.TOPOGRAPHIC;
|
|
68
69
|
this.api = options.api || new RealtimeAPI(options);
|
|
69
70
|
this.tenant = options.tenant || ''; // sbb,sbh or sbm
|
|
70
|
-
|
|
71
|
+
if (!Number.isNaN(options.minZoomInterpolation)) {
|
|
72
|
+
this.minZoomInterpolation = options.minZoomInterpolation || 0; // Min zoom level from which trains positions are not interpolated.
|
|
73
|
+
}
|
|
71
74
|
this.format = new GeoJSON();
|
|
72
75
|
// MOTs by zoom
|
|
73
76
|
const allMots = [
|
|
@@ -133,6 +136,7 @@ function RealtimeLayerMixin(Base) {
|
|
|
133
136
|
const { style, speed, pixelRatio, hoverVehicleId, selectedVehicleId, filter, sort, time, live, canvas, styleOptions, } = options;
|
|
134
137
|
let currSpeed = speed || 1;
|
|
135
138
|
let currTime = time || new Date();
|
|
139
|
+
let currStyle = style || realtimeDefaultStyle;
|
|
136
140
|
super.defineProperties(options);
|
|
137
141
|
Object.defineProperties(this, {
|
|
138
142
|
isTrackerLayer: { value: true },
|
|
@@ -143,7 +147,12 @@ function RealtimeLayerMixin(Base) {
|
|
|
143
147
|
* Style function used to render a vehicle.
|
|
144
148
|
*/
|
|
145
149
|
style: {
|
|
146
|
-
|
|
150
|
+
get: () => currStyle,
|
|
151
|
+
set: (newStyle) => {
|
|
152
|
+
currStyle = newStyle;
|
|
153
|
+
// @ts-ignore function without parameters is defined in subclasses
|
|
154
|
+
this.renderTrajectories();
|
|
155
|
+
},
|
|
147
156
|
},
|
|
148
157
|
/**
|
|
149
158
|
* Custom options to pass as last parameter of the style function.
|
|
@@ -553,10 +562,9 @@ function RealtimeLayerMixin(Base) {
|
|
|
553
562
|
* @ignore
|
|
554
563
|
*/
|
|
555
564
|
purgeTrajectory(trajectory, extent, zoom) {
|
|
556
|
-
var _a;
|
|
557
565
|
const { type, bounds } = trajectory.properties;
|
|
558
566
|
if (!intersects(extent, bounds) ||
|
|
559
|
-
|
|
567
|
+
(this.mots && !this.mots.includes(type)) ||
|
|
560
568
|
(type !== 'rail' && zoom < 9) // zoom 9 is defined by the backend
|
|
561
569
|
) {
|
|
562
570
|
this.removeTrajectory(trajectory);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import sortAndFilterDepartures from './sortAndFilterDepartures';
|
|
2
2
|
/**
|
|
3
3
|
* This function returns a WebSocket api callback, and call the onDeparturesUpdate function with the list of current departures to display.
|
|
4
4
|
* @param {function(departures: RealtimeDeparture[])} onDeparturesUpdate callback when list of departures changes, called after 100 ms
|
|
@@ -6,7 +6,7 @@ import sortAndfilterDepartures from './sortAndFilterDepartures';
|
|
|
6
6
|
* @param {number} [maxDepartureAge = 30] max departure age of departures in minutes
|
|
7
7
|
* @param {number} [timeout = 100] debounce timeout in ms
|
|
8
8
|
*/
|
|
9
|
-
const debounceDeparturesMessages = (onDeparturesUpdate, sortByMinArrivalTime =
|
|
9
|
+
const debounceDeparturesMessages = (onDeparturesUpdate, sortByMinArrivalTime = false, maxDepartureAge = 30, timeout = 100) => {
|
|
10
10
|
const departureUpdateTimeout = {};
|
|
11
11
|
const departureObject = {};
|
|
12
12
|
return (data) => {
|
|
@@ -16,7 +16,7 @@ const debounceDeparturesMessages = (onDeparturesUpdate, sortByMinArrivalTime = t
|
|
|
16
16
|
}
|
|
17
17
|
departureObject[departure.call_id] = departure;
|
|
18
18
|
departureUpdateTimeout[source] = window.setTimeout(() => {
|
|
19
|
-
const departures =
|
|
19
|
+
const departures = sortAndFilterDepartures(departureObject, sortByMinArrivalTime || false, maxDepartureAge);
|
|
20
20
|
onDeparturesUpdate(departures);
|
|
21
21
|
}, timeout);
|
|
22
22
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { RealtimeMode } from '../../types';
|
|
1
|
+
import type { RealtimeMode, RealtimeTenant } from '../../types';
|
|
2
2
|
import type { RealtimeModesType } from '../../api/RealtimeAPI';
|
|
3
3
|
/**
|
|
4
4
|
* Get the websocket channel suffix, depending on the current mode.
|
|
5
5
|
* @param {String} mode Mode 'topographic' ou 'schematic'.
|
|
6
6
|
* @private
|
|
7
7
|
*/
|
|
8
|
-
declare const
|
|
9
|
-
export default
|
|
8
|
+
declare const getRealtimeModeSuffix: (mode: RealtimeMode, modes: RealtimeModesType, tenant?: RealtimeTenant) => string;
|
|
9
|
+
export default getRealtimeModeSuffix;
|
|
10
10
|
//# sourceMappingURL=getRealtimeModeSuffix.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
1
|
+
{"version":3,"file":"getRealtimeModeSuffix.d.ts","sourceRoot":"","sources":["../../../src/common/utils/getRealtimeModeSuffix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D;;;;GAIG;AACH,QAAA,MAAM,qBAAqB,SACnB,YAAY,SACX,iBAAiB,WACf,cAAc,KACtB,MAQF,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -3,5 +3,11 @@
|
|
|
3
3
|
* @param {String} mode Mode 'topographic' ou 'schematic'.
|
|
4
4
|
* @private
|
|
5
5
|
*/
|
|
6
|
-
const
|
|
7
|
-
|
|
6
|
+
const getRealtimeModeSuffix = (mode, modes, tenant) => {
|
|
7
|
+
const schematicSuffix = ['', 'schematic'];
|
|
8
|
+
if (tenant) {
|
|
9
|
+
schematicSuffix.push(tenant);
|
|
10
|
+
}
|
|
11
|
+
return mode === modes.SCHEMATIC ? schematicSuffix.join('_') : '';
|
|
12
|
+
};
|
|
13
|
+
export default getRealtimeModeSuffix;
|
package/common/utils/index.d.ts
CHANGED
|
@@ -11,5 +11,6 @@ export { default as getMapboxRender } from "./getMapboxRender";
|
|
|
11
11
|
export { default as debounceDeparturesMessages } from "./debounceDeparturesMessages";
|
|
12
12
|
export { default as debounceWebsocketMessages } from "./debounceWebsocketMessages";
|
|
13
13
|
export { default as sortAndFilterDepartures } from "./sortAndFilterDepartures";
|
|
14
|
+
export { default as compareDepartures } from "./compareDepartures";
|
|
14
15
|
export * as realtimeConfig from "./realtimeConfig";
|
|
15
16
|
//# sourceMappingURL=index.d.ts.map
|
package/common/utils/index.js
CHANGED
|
@@ -11,5 +11,6 @@ export { default as getMapboxRender } from './getMapboxRender';
|
|
|
11
11
|
export { default as debounceDeparturesMessages } from './debounceDeparturesMessages';
|
|
12
12
|
export { default as debounceWebsocketMessages } from './debounceWebsocketMessages';
|
|
13
13
|
export { default as sortAndFilterDepartures } from './sortAndFilterDepartures';
|
|
14
|
+
export { default as compareDepartures } from './compareDepartures';
|
|
14
15
|
import * as realtimeConfig_1 from './realtimeConfig';
|
|
15
16
|
export { realtimeConfig_1 as realtimeConfig };
|
|
@@ -12,7 +12,11 @@ declare const RealtimeLayer_base: {
|
|
|
12
12
|
[key: string]: GeoJSONFeature;
|
|
13
13
|
} | undefined;
|
|
14
14
|
canvas?: import("../../types").AnyCanvas | undefined;
|
|
15
|
-
mode: import("../../types").RealtimeMode;
|
|
15
|
+
mode: import("../../types").RealtimeMode; /**
|
|
16
|
+
* Render the trajectories using current map's size, resolution and rotation.
|
|
17
|
+
* @param {boolean} noInterpolate if true, renders the vehicles without interpolating theirs positions.
|
|
18
|
+
* @overrides
|
|
19
|
+
*/
|
|
16
20
|
api: import("../../api/RealtimeAPI").default;
|
|
17
21
|
tenant: string;
|
|
18
22
|
time?: Date | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RealtimeLayer.d.ts","sourceRoot":"","sources":["../../../src/mapbox/layers/RealtimeLayer.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAE7B,OAAO,KAAK,MAAM,SAAS,CAAC;AAE5B,OAAO,EACL,YAAY,EACZ,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC
|
|
1
|
+
{"version":3,"file":"RealtimeLayer.d.ts","sourceRoot":"","sources":["../../../src/mapbox/layers/RealtimeLayer.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAE7B,OAAO,KAAK,MAAM,SAAS,CAAC;AAE5B,OAAO,EACL,YAAY,EACZ,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;;;;;;;;;kDAiKtD;;;;WAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAnKL;;;;;;;;;;;;;;;;GAgBG;AAEH,cAAM,aAAc,SAAQ,kBAAY;gBAC1B,OAAO,KAAK;IAqBxB;;;;;;OAMG;IAEH,WAAW,CAAC,GAAG,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM;IAuC/C;;OAEG;IACH,aAAa;IAkBb;;;;;;OAMG;IACH,KAAK;IAQL;;;;OAIG;IACH,IAAI;IASJ,MAAM;IASN;;;OAGG;IACH,kBAAkB,CAChB,GAAG,EAAE,QAAQ,CAAC,kBAAkB,GAAG,UAAU,CAAC,aAAa;IAQ7D;;;;OAIG;IAEH,kBAAkB,CAAC,aAAa,CAAC,EAAE,OAAe;IAuDlD;;OAEG;IACH,kBAAkB;IAIlB,0BAA0B,CACxB,UAAU,EAAE,UAAU,EACtB,OAAO,KAAK,GACX,OAAO,CAAC,2BAA2B,CAAC;IAQvC,kBAAkB;IAclB;;;;OAIG;IACH,eAAe,CACb,UAAU,EAAE,kBAAkB,EAC9B,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EACxC,IAAI,EAAE,MAAM;IASd;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM;IAUhE;;;;OAIG;IACH,MAAM;IAIN,0BAA0B,CACxB,SAAS,EAAE,SAAS,EACpB,aAAa,GAAE,OAAe;IAahC;;;;;OAKG;IACH,SAAS;IAQT;;;;;OAKG;IACH,cAAc,CACZ,QAAQ,EAAE,OAAO,EAAE,EACnB,KAAK,EAAE,aAAa,EACpB,UAAU,EAAE,UAAU;CAOzB;AAED,eAAe,aAAa,CAAC"}
|
package/mbt.js
CHANGED
|
@@ -33293,6 +33293,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
33293
33293
|
StopsAPI: () => StopsAPI_default,
|
|
33294
33294
|
VectorLayer: () => VectorLayer_default2,
|
|
33295
33295
|
WMSLayer: () => WMSLayer_default,
|
|
33296
|
+
compareDepartures: () => compareDepartures_default,
|
|
33296
33297
|
createRealtimeFilters: () => createRealtimeFilters_default,
|
|
33297
33298
|
debounceDeparturesMessages: () => debounceDeparturesMessages_default,
|
|
33298
33299
|
debounceWebsocketMessages: () => debounceWebsocketMessages_default,
|
|
@@ -34163,8 +34164,14 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34163
34164
|
var debounceWebsocketMessages_default = debounceWebsocketMessages;
|
|
34164
34165
|
|
|
34165
34166
|
// src/common/utils/getRealtimeModeSuffix.ts
|
|
34166
|
-
var
|
|
34167
|
-
|
|
34167
|
+
var getRealtimeModeSuffix = (mode, modes, tenant) => {
|
|
34168
|
+
const schematicSuffix = ["", "schematic"];
|
|
34169
|
+
if (tenant) {
|
|
34170
|
+
schematicSuffix.push(tenant);
|
|
34171
|
+
}
|
|
34172
|
+
return mode === modes.SCHEMATIC ? schematicSuffix.join("_") : "";
|
|
34173
|
+
};
|
|
34174
|
+
var getRealtimeModeSuffix_default = getRealtimeModeSuffix;
|
|
34168
34175
|
|
|
34169
34176
|
// src/api/RealtimeAPI.ts
|
|
34170
34177
|
var RealtimeModes = {
|
|
@@ -34175,7 +34182,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34175
34182
|
var RealtimeAPI = class {
|
|
34176
34183
|
constructor(options = {}) {
|
|
34177
34184
|
this.defineProperties(options);
|
|
34178
|
-
this.
|
|
34185
|
+
this.tenant = options.tenant;
|
|
34179
34186
|
this.onOpen = this.onOpen.bind(this);
|
|
34180
34187
|
}
|
|
34181
34188
|
defineProperties(options) {
|
|
@@ -34294,9 +34301,9 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34294
34301
|
this.wsApi.subscribe({ channel }, onSuccess, onError, quiet);
|
|
34295
34302
|
}
|
|
34296
34303
|
unsubscribe(channel, suffix = "", onMessage) {
|
|
34297
|
-
const
|
|
34298
|
-
const suffixTopographic = getRealtimeModeSuffix_default(RealtimeModes.TOPOGRAPHIC, RealtimeModes);
|
|
34299
|
-
this.wsApi.unsubscribe(`${channel}${
|
|
34304
|
+
const suffixSchematic = getRealtimeModeSuffix_default(RealtimeModes.SCHEMATIC, RealtimeModes, this.tenant);
|
|
34305
|
+
const suffixTopographic = getRealtimeModeSuffix_default(RealtimeModes.TOPOGRAPHIC, RealtimeModes, this.tenant);
|
|
34306
|
+
this.wsApi.unsubscribe(`${channel}${suffixSchematic}${suffix || ""}`, onMessage);
|
|
34300
34307
|
this.wsApi.unsubscribe(`${channel}${suffixTopographic}${suffix || ""}`, onMessage);
|
|
34301
34308
|
}
|
|
34302
34309
|
subscribeDepartures(stationId, onMessage, onError = () => {
|
|
@@ -34308,14 +34315,16 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34308
34315
|
}
|
|
34309
34316
|
subscribeDisruptions(onMessage, onError = () => {
|
|
34310
34317
|
}, quiet = false) {
|
|
34311
|
-
this.
|
|
34318
|
+
const channel = [this.tenant, "newsticker"];
|
|
34319
|
+
this.subscribe(channel.join("_"), onMessage, onError, quiet);
|
|
34312
34320
|
}
|
|
34313
34321
|
unsubscribeDisruptions(onMessage) {
|
|
34314
|
-
this.
|
|
34322
|
+
const channel = [this.tenant, "newsticker"];
|
|
34323
|
+
this.unsubscribe(channel.join("_"), "", onMessage);
|
|
34315
34324
|
}
|
|
34316
34325
|
getStation(uic, mode) {
|
|
34317
34326
|
const params = {
|
|
34318
|
-
channel: `station${getRealtimeModeSuffix_default(mode, RealtimeModes)}`,
|
|
34327
|
+
channel: `station${getRealtimeModeSuffix_default(mode, RealtimeModes, this.tenant)}`,
|
|
34319
34328
|
args: uic
|
|
34320
34329
|
};
|
|
34321
34330
|
return new Promise((resolve, reject) => {
|
|
@@ -34325,13 +34334,13 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34325
34334
|
getStations(mode, timeout = 100) {
|
|
34326
34335
|
return new Promise((resolve) => {
|
|
34327
34336
|
this.wsApi.get({
|
|
34328
|
-
channel: `station${getRealtimeModeSuffix_default(mode, RealtimeModes)}`
|
|
34337
|
+
channel: `station${getRealtimeModeSuffix_default(mode, RealtimeModes, this.tenant)}`
|
|
34329
34338
|
}, debounceWebsocketMessages_default(resolve, void 0, timeout));
|
|
34330
34339
|
});
|
|
34331
34340
|
}
|
|
34332
34341
|
subscribeStations(mode, onMessage, onError = () => {
|
|
34333
34342
|
}, quiet = false) {
|
|
34334
|
-
this.subscribe(`station${getRealtimeModeSuffix_default(mode, RealtimeModes)}`, onMessage, onError, quiet);
|
|
34343
|
+
this.subscribe(`station${getRealtimeModeSuffix_default(mode, RealtimeModes, this.tenant)}`, onMessage, onError, quiet);
|
|
34335
34344
|
}
|
|
34336
34345
|
unsubscribeStations(onMessage) {
|
|
34337
34346
|
this.unsubscribe("station", "", onMessage);
|
|
@@ -34346,7 +34355,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34346
34355
|
subscribeTrajectory(mode, onMessage, onError = () => {
|
|
34347
34356
|
}, quiet = false) {
|
|
34348
34357
|
this.unsubscribeTrajectory(onMessage);
|
|
34349
|
-
this.subscribe(`trajectory${getRealtimeModeSuffix_default(mode, RealtimeModes)}`, onMessage, onError, quiet);
|
|
34358
|
+
this.subscribe(`trajectory${getRealtimeModeSuffix_default(mode, RealtimeModes, this.tenant)}`, onMessage, onError, quiet);
|
|
34350
34359
|
}
|
|
34351
34360
|
unsubscribeTrajectory(onMessage) {
|
|
34352
34361
|
this.unsubscribe(`trajectory`, "", onMessage);
|
|
@@ -34354,13 +34363,15 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34354
34363
|
subscribeDeletedVehicles(mode, onMessage, onError = () => {
|
|
34355
34364
|
}, quiet = false) {
|
|
34356
34365
|
this.unsubscribeDeletedVehicles(onMessage);
|
|
34357
|
-
this.subscribe(`deleted_vehicles${getRealtimeModeSuffix_default(mode, RealtimeModes)}`, onMessage, onError, quiet);
|
|
34366
|
+
this.subscribe(`deleted_vehicles${getRealtimeModeSuffix_default(mode, RealtimeModes, this.tenant)}`, onMessage, onError, quiet);
|
|
34358
34367
|
}
|
|
34359
34368
|
unsubscribeDeletedVehicles(onMessage) {
|
|
34360
34369
|
this.unsubscribe("deleted_vehicles", "", onMessage);
|
|
34361
34370
|
}
|
|
34362
34371
|
getFullTrajectory(id, mode, generalizationLevel) {
|
|
34363
|
-
const channel = [
|
|
34372
|
+
const channel = [
|
|
34373
|
+
`full_trajectory${getRealtimeModeSuffix_default(mode, RealtimeModes)}`
|
|
34374
|
+
];
|
|
34364
34375
|
if (id) {
|
|
34365
34376
|
channel.push(id);
|
|
34366
34377
|
}
|
|
@@ -35879,7 +35890,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
35879
35890
|
var sortAndFilterDepartures_default = sortAndfilterDepartures;
|
|
35880
35891
|
|
|
35881
35892
|
// src/common/utils/debounceDeparturesMessages.ts
|
|
35882
|
-
var debounceDeparturesMessages = (onDeparturesUpdate, sortByMinArrivalTime =
|
|
35893
|
+
var debounceDeparturesMessages = (onDeparturesUpdate, sortByMinArrivalTime = false, maxDepartureAge = 30, timeout = 100) => {
|
|
35883
35894
|
const departureUpdateTimeout = {};
|
|
35884
35895
|
const departureObject = {};
|
|
35885
35896
|
return (data) => {
|
|
@@ -49131,11 +49142,14 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49131
49142
|
hitTolerance: 10,
|
|
49132
49143
|
...options
|
|
49133
49144
|
});
|
|
49145
|
+
this.minZoomInterpolation = 8;
|
|
49134
49146
|
this.debug = options.debug || false;
|
|
49135
49147
|
this.mode = options.mode || RealtimeModes.TOPOGRAPHIC;
|
|
49136
49148
|
this.api = options.api || new RealtimeAPI_default(options);
|
|
49137
49149
|
this.tenant = options.tenant || "";
|
|
49138
|
-
|
|
49150
|
+
if (!Number.isNaN(options.minZoomInterpolation)) {
|
|
49151
|
+
this.minZoomInterpolation = options.minZoomInterpolation || 0;
|
|
49152
|
+
}
|
|
49139
49153
|
this.format = new GeoJSON_default();
|
|
49140
49154
|
const allMots = [
|
|
49141
49155
|
"tram",
|
|
@@ -49223,6 +49237,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49223
49237
|
} = options;
|
|
49224
49238
|
let currSpeed = speed || 1;
|
|
49225
49239
|
let currTime = time || new Date();
|
|
49240
|
+
let currStyle = style || realtimeDefaultStyle_default;
|
|
49226
49241
|
super.defineProperties(options);
|
|
49227
49242
|
Object.defineProperties(this, {
|
|
49228
49243
|
isTrackerLayer: { value: true },
|
|
@@ -49230,7 +49245,11 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49230
49245
|
value: canvas2 || document.createElement("canvas")
|
|
49231
49246
|
},
|
|
49232
49247
|
style: {
|
|
49233
|
-
|
|
49248
|
+
get: () => currStyle,
|
|
49249
|
+
set: (newStyle) => {
|
|
49250
|
+
currStyle = newStyle;
|
|
49251
|
+
this.renderTrajectories();
|
|
49252
|
+
}
|
|
49234
49253
|
},
|
|
49235
49254
|
styleOptions: {
|
|
49236
49255
|
value: { ...realtimeConfig_exports, ...styleOptions || {} }
|
|
@@ -49484,7 +49503,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49484
49503
|
}
|
|
49485
49504
|
purgeTrajectory(trajectory, extent, zoom) {
|
|
49486
49505
|
const { type, bounds } = trajectory.properties;
|
|
49487
|
-
if (!intersects(extent, bounds) || !this.mots
|
|
49506
|
+
if (!intersects(extent, bounds) || this.mots && !this.mots.includes(type) || type !== "rail" && zoom < 9) {
|
|
49488
49507
|
this.removeTrajectory(trajectory);
|
|
49489
49508
|
return true;
|
|
49490
49509
|
}
|
|
@@ -49669,6 +49688,8 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49669
49688
|
super({
|
|
49670
49689
|
...options
|
|
49671
49690
|
});
|
|
49691
|
+
this.allowRenderWhenAnimating = false;
|
|
49692
|
+
this.allowRenderWhenAnimating = !!options.allowRenderWhenAnimating;
|
|
49672
49693
|
this.olLayer = options.olLayer || new Group_default({
|
|
49673
49694
|
layers: [
|
|
49674
49695
|
new Vector_default({
|
|
@@ -49775,7 +49796,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49775
49796
|
return false;
|
|
49776
49797
|
}
|
|
49777
49798
|
let isRendered = false;
|
|
49778
|
-
const blockRendering = this.map.getView().getAnimating() || this.map.getView().getInteracting();
|
|
49799
|
+
const blockRendering = this.allowRenderWhenAnimating ? false : this.map.getView().getAnimating() || this.map.getView().getInteracting();
|
|
49779
49800
|
isRendered = blockRendering ? false : super.renderTrajectoriesInternal(viewState, noInterpolate);
|
|
49780
49801
|
if (isRendered) {
|
|
49781
49802
|
this.renderedViewState = { ...viewState };
|
|
@@ -49930,6 +49951,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49930
49951
|
RealtimeModes: () => RealtimeModes,
|
|
49931
49952
|
RoutingAPI: () => RoutingAPI_default,
|
|
49932
49953
|
StopsAPI: () => StopsAPI_default,
|
|
49954
|
+
compareDepartures: () => compareDepartures_default,
|
|
49933
49955
|
createRealtimeFilters: () => createRealtimeFilters_default,
|
|
49934
49956
|
debounceDeparturesMessages: () => debounceDeparturesMessages_default,
|
|
49935
49957
|
debounceWebsocketMessages: () => debounceWebsocketMessages_default,
|