mobility-toolbox-js 2.0.0-beta.74 → 2.0.0-beta.75
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 +16 -20
- package/common/mixins/RealtimeLayerMixin.d.ts +9 -4
- package/common/mixins/RealtimeLayerMixin.d.ts.map +1 -1
- package/common/mixins/RealtimeLayerMixin.js +10 -5
- package/common/utils/getMapboxRender.d.ts +1 -1
- package/common/utils/getMapboxRender.d.ts.map +1 -1
- package/common/utils/getRealtimeModeSuffix.d.ts +3 -3
- package/common/utils/getRealtimeModeSuffix.d.ts.map +1 -1
- package/common/utils/getRealtimeModeSuffix.js +2 -8
- package/mapbox/layers/RealtimeLayer.d.ts +2 -0
- package/mapbox/layers/RealtimeLayer.d.ts.map +1 -1
- package/mbt.js +24 -43
- package/mbt.js.map +2 -2
- package/mbt.min.js +2 -2
- package/mbt.min.js.map +3 -3
- package/ol/layers/RealtimeLayer.d.ts +2 -0
- package/ol/layers/RealtimeLayer.d.ts.map +1 -1
- package/package.json +1 -1
- package/common/styles/realtimeHeadingStyle.d.ts +0 -12
- package/common/styles/realtimeHeadingStyle.d.ts.map +0 -1
- package/common/styles/realtimeHeadingStyle.js +0 -85
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
|
|
2
|
+
import type { RealtimeMode, RealtimeDeparture, RealtimeNews, RealtimeStation, RealtimeExtraGeom, RealtimeTrainId, RealtimeGeneralizationLevel, RealtimeFullTrajectory, RealtimeTrajectoryResponse, RealtimeStationId } from '../types';
|
|
3
3
|
import { StopSequence } from './typedefs';
|
|
4
4
|
export declare type RealtimeAPIOptions = {
|
|
5
5
|
url?: string;
|
|
6
6
|
apiKey?: string;
|
|
7
|
-
|
|
7
|
+
prefix?: string;
|
|
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
|
+
prefix: string;
|
|
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.prefix=''] Service prefix to specify tenant.
|
|
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 ststions 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,
|
|
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,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,2BAA2B,EAC3B,sBAAsB,EACtB,0BAA0B,EAC1B,iBAAiB,EAClB,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,MAAM,CAAC;IAChB,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,CAAC;CACpC,CAAC;AAEF,oBAAY,yBAAyB,GAAG;IACtC,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB,CAAC;CACpC,CAAC;AAEF,oBAAY,iBAAiB,GAAG;IAC9B,GAAG,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AC,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 getModeSuffix 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.prefix=''] Service prefix to specify tenant.
|
|
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.prefix = options.prefix || '';
|
|
49
49
|
/** @ignore */
|
|
50
50
|
this.onOpen = this.onOpen.bind(this);
|
|
51
51
|
}
|
|
@@ -218,9 +218,9 @@ class RealtimeAPI {
|
|
|
218
218
|
* @private
|
|
219
219
|
*/
|
|
220
220
|
unsubscribe(channel, suffix = '', onMessage) {
|
|
221
|
-
const
|
|
222
|
-
const suffixTopographic =
|
|
223
|
-
this.wsApi.unsubscribe(`${channel}${
|
|
221
|
+
const suffixSchenatic = getModeSuffix(RealtimeModes.SCHEMATIC, RealtimeModes);
|
|
222
|
+
const suffixTopographic = getModeSuffix(RealtimeModes.TOPOGRAPHIC, RealtimeModes);
|
|
223
|
+
this.wsApi.unsubscribe(`${channel}${suffixSchenatic}${suffix || ''}`, onMessage);
|
|
224
224
|
this.wsApi.unsubscribe(`${channel}${suffixTopographic}${suffix || ''}`, onMessage);
|
|
225
225
|
}
|
|
226
226
|
/**
|
|
@@ -251,8 +251,7 @@ class RealtimeAPI {
|
|
|
251
251
|
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
252
252
|
*/
|
|
253
253
|
subscribeDisruptions(onMessage, onError = () => { }, quiet = false) {
|
|
254
|
-
|
|
255
|
-
this.subscribe(channel.join('_'), onMessage, onError, quiet);
|
|
254
|
+
this.subscribe(`${this.prefix}newsticker`, onMessage, onError, quiet);
|
|
256
255
|
}
|
|
257
256
|
/**
|
|
258
257
|
* Unsubscribe disruptions.
|
|
@@ -260,8 +259,7 @@ class RealtimeAPI {
|
|
|
260
259
|
* @param {function(data: { content: RealtimeNews[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
261
260
|
*/
|
|
262
261
|
unsubscribeDisruptions(onMessage) {
|
|
263
|
-
|
|
264
|
-
this.unsubscribe(channel.join('_'), '', onMessage);
|
|
262
|
+
this.unsubscribe(`${this.prefix}newsticker`, '', onMessage);
|
|
265
263
|
}
|
|
266
264
|
/**
|
|
267
265
|
* Return a station with a given uic number and a mode.
|
|
@@ -272,7 +270,7 @@ class RealtimeAPI {
|
|
|
272
270
|
*/
|
|
273
271
|
getStation(uic, mode) {
|
|
274
272
|
const params = {
|
|
275
|
-
channel: `station${
|
|
273
|
+
channel: `station${getModeSuffix(mode, RealtimeModes)}`,
|
|
276
274
|
args: uic,
|
|
277
275
|
};
|
|
278
276
|
return new Promise((resolve, reject) => {
|
|
@@ -280,7 +278,7 @@ class RealtimeAPI {
|
|
|
280
278
|
});
|
|
281
279
|
}
|
|
282
280
|
/**
|
|
283
|
-
* Get the list of
|
|
281
|
+
* Get the list of ststions available for a specifc mode. The promise is resolved every 100ms
|
|
284
282
|
* @param {RealtimeMode} mode Realtime mode.
|
|
285
283
|
* @param {number} timeout = 100 Duration in ms between each promise resolve calls.
|
|
286
284
|
* @return {Promise<RealtimeStation[]>} An array of stations.
|
|
@@ -288,7 +286,7 @@ class RealtimeAPI {
|
|
|
288
286
|
getStations(mode, timeout = 100) {
|
|
289
287
|
return new Promise((resolve) => {
|
|
290
288
|
this.wsApi.get({
|
|
291
|
-
channel: `station${
|
|
289
|
+
channel: `station${getModeSuffix(mode, RealtimeModes)}`,
|
|
292
290
|
}, debounceWebsocketMessages(resolve, undefined, timeout));
|
|
293
291
|
});
|
|
294
292
|
}
|
|
@@ -302,7 +300,7 @@ class RealtimeAPI {
|
|
|
302
300
|
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
303
301
|
*/
|
|
304
302
|
subscribeStations(mode, onMessage, onError = () => { }, quiet = false) {
|
|
305
|
-
this.subscribe(`station${
|
|
303
|
+
this.subscribe(`station${getModeSuffix(mode, RealtimeModes)}`, onMessage, onError, quiet);
|
|
306
304
|
}
|
|
307
305
|
/**
|
|
308
306
|
* Unsubscribe to stations channel.
|
|
@@ -338,7 +336,7 @@ class RealtimeAPI {
|
|
|
338
336
|
*/
|
|
339
337
|
subscribeTrajectory(mode, onMessage, onError = () => { }, quiet = false) {
|
|
340
338
|
this.unsubscribeTrajectory(onMessage);
|
|
341
|
-
this.subscribe(`trajectory${
|
|
339
|
+
this.subscribe(`trajectory${getModeSuffix(mode, RealtimeModes)}`, onMessage, onError, quiet);
|
|
342
340
|
}
|
|
343
341
|
/**
|
|
344
342
|
* Unsubscribe to trajectory channels.
|
|
@@ -357,7 +355,7 @@ class RealtimeAPI {
|
|
|
357
355
|
*/
|
|
358
356
|
subscribeDeletedVehicles(mode, onMessage, onError = () => { }, quiet = false) {
|
|
359
357
|
this.unsubscribeDeletedVehicles(onMessage);
|
|
360
|
-
this.subscribe(`deleted_vehicles${
|
|
358
|
+
this.subscribe(`deleted_vehicles${getModeSuffix(mode, RealtimeModes)}`, onMessage, onError, quiet);
|
|
361
359
|
}
|
|
362
360
|
/**
|
|
363
361
|
* Unsubscribe to deleted_vhicles channels.
|
|
@@ -375,9 +373,7 @@ class RealtimeAPI {
|
|
|
375
373
|
* @return {Promise<{ data: { content: FullTrajectory } }>} Return a full trajectory.
|
|
376
374
|
*/
|
|
377
375
|
getFullTrajectory(id, mode, generalizationLevel) {
|
|
378
|
-
const channel = [
|
|
379
|
-
`full_trajectory${getRealtimeModeSuffix(mode, RealtimeModes)}`,
|
|
380
|
-
];
|
|
376
|
+
const channel = [`full_trajectory${getModeSuffix(mode, RealtimeModes)}`];
|
|
381
377
|
if (id) {
|
|
382
378
|
channel.push(id);
|
|
383
379
|
}
|
|
@@ -401,7 +397,7 @@ class RealtimeAPI {
|
|
|
401
397
|
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
402
398
|
*/
|
|
403
399
|
subscribeFullTrajectory(id, mode, onMessage, onError = () => { }, quiet = false) {
|
|
404
|
-
this.subscribe(`full_trajectory${
|
|
400
|
+
this.subscribe(`full_trajectory${getModeSuffix(mode, RealtimeModes)}_${id}`, onMessage, onError, quiet);
|
|
405
401
|
}
|
|
406
402
|
/**
|
|
407
403
|
* Unsubscribe from full_trajectory channel
|
|
@@ -3,7 +3,7 @@ import { EventsKey } from 'ol/events';
|
|
|
3
3
|
import { Coordinate } from 'ol/coordinate';
|
|
4
4
|
import { Feature } from 'ol';
|
|
5
5
|
import { RealtimeAPI } from '../../api';
|
|
6
|
-
import { AnyCanvas, AnyLayerClass, AnyMap, AnyRealtimeLayer, LayerGetFeatureInfoOptions, RealtimeGeneralizationLevel, RealtimeMode, RealtimeMot, RealtimeRenderState, RealtimeStyleFunction, RealtimeStyleOptions, RealtimeTenant, RealtimeTrainId, ViewState } from '../../types';
|
|
6
|
+
import { AnyCanvas, AnyLayerClass, AnyMap, AnyRealtimeLayer, LayerGetFeatureInfoOptions, RealtimeGeneralizationLevel, RealtimeMode, RealtimeMot, RealtimeRenderState, RealtimeStyleFunction, RealtimeStyleOptions, RealtimeTenant, RealtimeTrainId, ViewState, AnyLayer } from '../../types';
|
|
7
7
|
import { RealtimeTrajectory } from '../../api/typedefs';
|
|
8
8
|
import { WebSocketAPIMessageEventData } from '../api/WebSocketAPI';
|
|
9
9
|
import type { OlLayerOptions } from '../../ol/layers/Layer';
|
|
@@ -34,8 +34,11 @@ export declare type RealtimeLayerMixinOptions = OlLayerOptions & {
|
|
|
34
34
|
getMotsByZoom: (zoom: number, motsByZoom: RealtimeMot[][]) => RealtimeMot[];
|
|
35
35
|
getGeneralizationLevelByZoom?: (zoom: number, generalizationLevelByZoom: RealtimeGeneralizationLevel[]) => RealtimeGeneralizationLevel;
|
|
36
36
|
getRenderTimeIntervalByZoom?: (zoom: number, renderTimeIntervalByZoom: number[]) => number;
|
|
37
|
+
onStart?: (realtimeLayer: AnyRealtimeLayer) => void;
|
|
38
|
+
onStop?: (realtimeLayer: AnyRealtimeLayer) => void;
|
|
37
39
|
url?: string;
|
|
38
40
|
apiKey?: string;
|
|
41
|
+
prefix?: string;
|
|
39
42
|
projection?: string;
|
|
40
43
|
bbox?: (number | string)[];
|
|
41
44
|
buffer?: number[];
|
|
@@ -44,7 +47,7 @@ export declare type RealtimeLayerMixinOptions = OlLayerOptions & {
|
|
|
44
47
|
/**
|
|
45
48
|
* RealtimeLayerInterface.
|
|
46
49
|
*/
|
|
47
|
-
export declare class
|
|
50
|
+
export declare class Function {
|
|
48
51
|
/**
|
|
49
52
|
* Start the clock.
|
|
50
53
|
*/
|
|
@@ -94,8 +97,8 @@ declare function RealtimeLayerMixin<T extends AnyLayerClass>(Base: T): {
|
|
|
94
97
|
time?: Date | undefined;
|
|
95
98
|
live?: boolean | undefined;
|
|
96
99
|
speed?: number | undefined;
|
|
97
|
-
filter?: Function | undefined;
|
|
98
|
-
sort?: Function | undefined;
|
|
100
|
+
filter?: globalThis.Function | undefined;
|
|
101
|
+
sort?: globalThis.Function | undefined;
|
|
99
102
|
style?: RealtimeStyleFunction | undefined;
|
|
100
103
|
styleOptions?: RealtimeStyleOptions | undefined;
|
|
101
104
|
pixelRatio?: number | undefined;
|
|
@@ -123,6 +126,8 @@ declare function RealtimeLayerMixin<T extends AnyLayerClass>(Base: T): {
|
|
|
123
126
|
getRenderTimeIntervalByZoom: (zoom: number) => number;
|
|
124
127
|
throttleRenderTrajectories: (viewState: ViewState, noInterpolate?: boolean) => void;
|
|
125
128
|
debounceRenderTrajectories: (viewState: ViewState, noInterpolate?: boolean) => void;
|
|
129
|
+
onStart?: ((realtimeLayer: AnyLayer) => void) | undefined;
|
|
130
|
+
onStop?: ((realtimeLayer: AnyLayer) => void) | undefined;
|
|
126
131
|
/**
|
|
127
132
|
* Define layer's properties.
|
|
128
133
|
*
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"RealtimeLayerMixin.d.ts","sourceRoot":"","sources":["../../../src/common/mixins/RealtimeLayerMixin.ts"],"names":[],"mappings":"AAOA,OAAO,OAAO,MAAM,mBAAmB,CAAC;AAIxC,OA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,kBAAkB,GAAG,eAAe;QAYrE;;;;;WAKG;;;QAqBH;;;;;WAKG;kCAEK,6BAA6B,kBAAkB,CAAC;QAgDxD;;;;;;WAMG;wCAEK,6BAA6B,eAAe,CAAC;QAQrD;;;;;;WAMG;iCAES,OAAO,EAAE,SACZ,gBAAgB;QAgBzB;;;;;;WAMG;iCAES,OAAO,EAAE,SACZ,gBAAgB;;MAkB5B;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -16,7 +16,7 @@ import * as realtimeConfig from '../utils/realtimeConfig';
|
|
|
16
16
|
/**
|
|
17
17
|
* RealtimeLayerInterface.
|
|
18
18
|
*/
|
|
19
|
-
export class
|
|
19
|
+
export class Function {
|
|
20
20
|
/**
|
|
21
21
|
* Start the clock.
|
|
22
22
|
*/
|
|
@@ -57,15 +57,14 @@ function RealtimeLayerMixin(Base) {
|
|
|
57
57
|
return class Mixin extends Base {
|
|
58
58
|
constructor(options) {
|
|
59
59
|
super(Object.assign({ hitTolerance: 10 }, options));
|
|
60
|
-
this.minZoomInterpolation = 8;
|
|
61
60
|
this.debug = options.debug || false;
|
|
62
61
|
this.mode = options.mode || RealtimeModes.TOPOGRAPHIC;
|
|
63
62
|
this.api = options.api || new RealtimeAPI(options);
|
|
64
63
|
this.tenant = options.tenant || ''; // sbb,sbh or sbm
|
|
65
|
-
|
|
66
|
-
this.minZoomInterpolation = options.minZoomInterpolation || 0; // Min zoom level from which trains positions are not interpolated.
|
|
67
|
-
}
|
|
64
|
+
this.minZoomInterpolation = options.minZoomInterpolation || 8; // Min zoom level from which trains positions are not interpolated.
|
|
68
65
|
this.format = new GeoJSON();
|
|
66
|
+
this.onStart = options.onStart;
|
|
67
|
+
this.onStop = options.onStop;
|
|
69
68
|
// MOTs by zoom
|
|
70
69
|
const allMots = [
|
|
71
70
|
'tram',
|
|
@@ -356,6 +355,9 @@ function RealtimeLayerMixin(Base) {
|
|
|
356
355
|
// @ts-ignore function without parameters defined by subclasses
|
|
357
356
|
this.setBbox();
|
|
358
357
|
}
|
|
358
|
+
if (this.onStart) {
|
|
359
|
+
this.onStart(this);
|
|
360
|
+
}
|
|
359
361
|
}
|
|
360
362
|
/**
|
|
361
363
|
* Start the clock.
|
|
@@ -378,6 +380,9 @@ function RealtimeLayerMixin(Base) {
|
|
|
378
380
|
this.api.unsubscribeTrajectory(this.onTrajectoryMessage);
|
|
379
381
|
this.api.unsubscribeDeletedVehicles(this.onDeleteTrajectoryMessage);
|
|
380
382
|
this.api.close();
|
|
383
|
+
if (this.onStop) {
|
|
384
|
+
this.onStop(this);
|
|
385
|
+
}
|
|
381
386
|
}
|
|
382
387
|
/**
|
|
383
388
|
* Stop the clock.
|
|
@@ -1 +1 @@
|
|
|
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,WAAW,MAAM,
|
|
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,CA4FhB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { RealtimeMode
|
|
1
|
+
import type { RealtimeMode } 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 getModeSuffix: (mode: RealtimeMode, modes: RealtimeModesType) => string;
|
|
9
|
+
export default getModeSuffix;
|
|
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,
|
|
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"}
|
|
@@ -3,11 +3,5 @@
|
|
|
3
3
|
* @param {String} mode Mode 'topographic' ou 'schematic'.
|
|
4
4
|
* @private
|
|
5
5
|
*/
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
if (tenant) {
|
|
9
|
-
schematicSuffix.push(tenant);
|
|
10
|
-
}
|
|
11
|
-
return mode === modes.SCHEMATIC ? schematicSuffix.join('_') : '';
|
|
12
|
-
};
|
|
13
|
-
export default getRealtimeModeSuffix;
|
|
6
|
+
const getModeSuffix = (mode, modes) => mode === modes.SCHEMATIC ? '_schematic' : '';
|
|
7
|
+
export default getModeSuffix;
|
|
@@ -47,6 +47,8 @@ declare const RealtimeLayer_base: {
|
|
|
47
47
|
getRenderTimeIntervalByZoom: (zoom: number) => number;
|
|
48
48
|
throttleRenderTrajectories: (viewState: import("../../types").ViewState, noInterpolate?: boolean | undefined) => void;
|
|
49
49
|
debounceRenderTrajectories: (viewState: import("../../types").ViewState, noInterpolate?: boolean | undefined) => void;
|
|
50
|
+
onStart?: ((realtimeLayer: any) => void) | undefined;
|
|
51
|
+
onStop?: ((realtimeLayer: any) => void) | undefined;
|
|
50
52
|
defineProperties(options: import("../../common/mixins/RealtimeLayerMixin").RealtimeLayerMixinOptions): void;
|
|
51
53
|
attachToMap(map: any): void;
|
|
52
54
|
detachFromMap(): void;
|
|
@@ -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,KAAK,EAAE,YAAY,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,KAAK,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,KAAK,EAAE,YAAY,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE7D;;;;;;;;;;;;;;;;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
|
@@ -34191,14 +34191,8 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34191
34191
|
var debounceWebsocketMessages_default = debounceWebsocketMessages;
|
|
34192
34192
|
|
|
34193
34193
|
// src/common/utils/getRealtimeModeSuffix.ts
|
|
34194
|
-
var
|
|
34195
|
-
|
|
34196
|
-
if (tenant) {
|
|
34197
|
-
schematicSuffix.push(tenant);
|
|
34198
|
-
}
|
|
34199
|
-
return mode === modes.SCHEMATIC ? schematicSuffix.join("_") : "";
|
|
34200
|
-
};
|
|
34201
|
-
var getRealtimeModeSuffix_default = getRealtimeModeSuffix;
|
|
34194
|
+
var getModeSuffix = (mode, modes) => mode === modes.SCHEMATIC ? "_schematic" : "";
|
|
34195
|
+
var getRealtimeModeSuffix_default = getModeSuffix;
|
|
34202
34196
|
|
|
34203
34197
|
// src/api/RealtimeAPI.ts
|
|
34204
34198
|
var RealtimeModes = {
|
|
@@ -34209,7 +34203,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34209
34203
|
var RealtimeAPI = class {
|
|
34210
34204
|
constructor(options = {}) {
|
|
34211
34205
|
this.defineProperties(options);
|
|
34212
|
-
this.
|
|
34206
|
+
this.prefix = options.prefix || "";
|
|
34213
34207
|
this.onOpen = this.onOpen.bind(this);
|
|
34214
34208
|
}
|
|
34215
34209
|
defineProperties(options) {
|
|
@@ -34330,18 +34324,16 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34330
34324
|
this.wsApi.subscribe({ channel }, onSuccess, onError, quiet);
|
|
34331
34325
|
}
|
|
34332
34326
|
unsubscribe(channel, suffix = "", onMessage) {
|
|
34333
|
-
const
|
|
34327
|
+
const suffixSchenatic = getRealtimeModeSuffix_default(
|
|
34334
34328
|
RealtimeModes.SCHEMATIC,
|
|
34335
|
-
RealtimeModes
|
|
34336
|
-
this.tenant
|
|
34329
|
+
RealtimeModes
|
|
34337
34330
|
);
|
|
34338
34331
|
const suffixTopographic = getRealtimeModeSuffix_default(
|
|
34339
34332
|
RealtimeModes.TOPOGRAPHIC,
|
|
34340
|
-
RealtimeModes
|
|
34341
|
-
this.tenant
|
|
34333
|
+
RealtimeModes
|
|
34342
34334
|
);
|
|
34343
34335
|
this.wsApi.unsubscribe(
|
|
34344
|
-
`${channel}${
|
|
34336
|
+
`${channel}${suffixSchenatic}${suffix || ""}`,
|
|
34345
34337
|
onMessage
|
|
34346
34338
|
);
|
|
34347
34339
|
this.wsApi.unsubscribe(
|
|
@@ -34358,20 +34350,14 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34358
34350
|
}
|
|
34359
34351
|
subscribeDisruptions(onMessage, onError = () => {
|
|
34360
34352
|
}, quiet = false) {
|
|
34361
|
-
|
|
34362
|
-
this.subscribe(channel.join("_"), onMessage, onError, quiet);
|
|
34353
|
+
this.subscribe(`${this.prefix}newsticker`, onMessage, onError, quiet);
|
|
34363
34354
|
}
|
|
34364
34355
|
unsubscribeDisruptions(onMessage) {
|
|
34365
|
-
|
|
34366
|
-
this.unsubscribe(channel.join("_"), "", onMessage);
|
|
34356
|
+
this.unsubscribe(`${this.prefix}newsticker`, "", onMessage);
|
|
34367
34357
|
}
|
|
34368
34358
|
getStation(uic, mode) {
|
|
34369
34359
|
const params = {
|
|
34370
|
-
channel: `station${getRealtimeModeSuffix_default(
|
|
34371
|
-
mode,
|
|
34372
|
-
RealtimeModes,
|
|
34373
|
-
this.tenant
|
|
34374
|
-
)}`,
|
|
34360
|
+
channel: `station${getRealtimeModeSuffix_default(mode, RealtimeModes)}`,
|
|
34375
34361
|
args: uic
|
|
34376
34362
|
};
|
|
34377
34363
|
return new Promise((resolve, reject) => {
|
|
@@ -34382,11 +34368,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34382
34368
|
return new Promise((resolve) => {
|
|
34383
34369
|
this.wsApi.get(
|
|
34384
34370
|
{
|
|
34385
|
-
channel: `station${getRealtimeModeSuffix_default(
|
|
34386
|
-
mode,
|
|
34387
|
-
RealtimeModes,
|
|
34388
|
-
this.tenant
|
|
34389
|
-
)}`
|
|
34371
|
+
channel: `station${getRealtimeModeSuffix_default(mode, RealtimeModes)}`
|
|
34390
34372
|
},
|
|
34391
34373
|
debounceWebsocketMessages_default(resolve, void 0, timeout)
|
|
34392
34374
|
);
|
|
@@ -34395,7 +34377,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34395
34377
|
subscribeStations(mode, onMessage, onError = () => {
|
|
34396
34378
|
}, quiet = false) {
|
|
34397
34379
|
this.subscribe(
|
|
34398
|
-
`station${getRealtimeModeSuffix_default(mode, RealtimeModes
|
|
34380
|
+
`station${getRealtimeModeSuffix_default(mode, RealtimeModes)}`,
|
|
34399
34381
|
onMessage,
|
|
34400
34382
|
onError,
|
|
34401
34383
|
quiet
|
|
@@ -34415,7 +34397,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34415
34397
|
}, quiet = false) {
|
|
34416
34398
|
this.unsubscribeTrajectory(onMessage);
|
|
34417
34399
|
this.subscribe(
|
|
34418
|
-
`trajectory${getRealtimeModeSuffix_default(mode, RealtimeModes
|
|
34400
|
+
`trajectory${getRealtimeModeSuffix_default(mode, RealtimeModes)}`,
|
|
34419
34401
|
onMessage,
|
|
34420
34402
|
onError,
|
|
34421
34403
|
quiet
|
|
@@ -34428,11 +34410,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34428
34410
|
}, quiet = false) {
|
|
34429
34411
|
this.unsubscribeDeletedVehicles(onMessage);
|
|
34430
34412
|
this.subscribe(
|
|
34431
|
-
`deleted_vehicles${getRealtimeModeSuffix_default(
|
|
34432
|
-
mode,
|
|
34433
|
-
RealtimeModes,
|
|
34434
|
-
this.tenant
|
|
34435
|
-
)}`,
|
|
34413
|
+
`deleted_vehicles${getRealtimeModeSuffix_default(mode, RealtimeModes)}`,
|
|
34436
34414
|
onMessage,
|
|
34437
34415
|
onError,
|
|
34438
34416
|
quiet
|
|
@@ -34442,9 +34420,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34442
34420
|
this.unsubscribe("deleted_vehicles", "", onMessage);
|
|
34443
34421
|
}
|
|
34444
34422
|
getFullTrajectory(id, mode, generalizationLevel) {
|
|
34445
|
-
const channel = [
|
|
34446
|
-
`full_trajectory${getRealtimeModeSuffix_default(mode, RealtimeModes)}`
|
|
34447
|
-
];
|
|
34423
|
+
const channel = [`full_trajectory${getRealtimeModeSuffix_default(mode, RealtimeModes)}`];
|
|
34448
34424
|
if (id) {
|
|
34449
34425
|
channel.push(id);
|
|
34450
34426
|
}
|
|
@@ -49669,15 +49645,14 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49669
49645
|
hitTolerance: 10,
|
|
49670
49646
|
...options
|
|
49671
49647
|
});
|
|
49672
|
-
this.minZoomInterpolation = 8;
|
|
49673
49648
|
this.debug = options.debug || false;
|
|
49674
49649
|
this.mode = options.mode || RealtimeModes.TOPOGRAPHIC;
|
|
49675
49650
|
this.api = options.api || new RealtimeAPI_default(options);
|
|
49676
49651
|
this.tenant = options.tenant || "";
|
|
49677
|
-
|
|
49678
|
-
this.minZoomInterpolation = options.minZoomInterpolation || 0;
|
|
49679
|
-
}
|
|
49652
|
+
this.minZoomInterpolation = options.minZoomInterpolation || 8;
|
|
49680
49653
|
this.format = new GeoJSON_default();
|
|
49654
|
+
this.onStart = options.onStart;
|
|
49655
|
+
this.onStop = options.onStop;
|
|
49681
49656
|
const allMots = [
|
|
49682
49657
|
"tram",
|
|
49683
49658
|
"subway",
|
|
@@ -49946,6 +49921,9 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49946
49921
|
if (this.isUpdateBboxOnMoveEnd) {
|
|
49947
49922
|
this.setBbox();
|
|
49948
49923
|
}
|
|
49924
|
+
if (this.onStart) {
|
|
49925
|
+
this.onStart(this);
|
|
49926
|
+
}
|
|
49949
49927
|
}
|
|
49950
49928
|
startUpdateTime() {
|
|
49951
49929
|
this.stopUpdateTime();
|
|
@@ -49964,6 +49942,9 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49964
49942
|
this.api.unsubscribeTrajectory(this.onTrajectoryMessage);
|
|
49965
49943
|
this.api.unsubscribeDeletedVehicles(this.onDeleteTrajectoryMessage);
|
|
49966
49944
|
this.api.close();
|
|
49945
|
+
if (this.onStop) {
|
|
49946
|
+
this.onStop(this);
|
|
49947
|
+
}
|
|
49967
49948
|
}
|
|
49968
49949
|
stopUpdateTime() {
|
|
49969
49950
|
if (this.updateTimeInterval) {
|