mobility-toolbox-js 2.0.0-beta.54 → 2.0.0-beta.55
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/common/mixins/RealtimeLayerMixin.d.ts +7 -4
- package/common/mixins/RealtimeLayerMixin.d.ts.map +1 -1
- package/common/mixins/RealtimeLayerMixin.js +32 -3
- package/mapbox/layers/RealtimeLayer.d.ts +3 -1
- package/mapbox/layers/RealtimeLayer.d.ts.map +1 -1
- package/mbt.js +20 -2
- package/mbt.js.map +2 -2
- package/mbt.min.js +1 -1
- package/mbt.min.js.map +2 -2
- package/ol/layers/RealtimeLayer.d.ts +4 -3
- package/ol/layers/RealtimeLayer.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -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, RealtimeRenderState, RealtimeStyleFunction, RealtimeStyleOptions, RealtimeTenant, RealtimeTrainId, ViewState } from '../../types';
|
|
6
|
+
import { AnyCanvas, AnyLayerClass, AnyMap, AnyRealtimeLayer, LayerGetFeatureInfoOptions, RealtimeGeneralizationLevel, RealtimeMode, RealtimeMot, RealtimeRenderState, RealtimeStyleFunction, RealtimeStyleOptions, RealtimeTenant, RealtimeTrainId, ViewState } 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';
|
|
@@ -12,9 +12,9 @@ export declare type RealtimeLayerMixinOptions = OlLayerOptions & {
|
|
|
12
12
|
mode?: RealtimeMode;
|
|
13
13
|
api?: RealtimeAPI;
|
|
14
14
|
tenant?: RealtimeTenant;
|
|
15
|
-
minZoomNonTrain?: number;
|
|
16
15
|
minZoomInterpolation?: number;
|
|
17
16
|
isUpdateBboxOnMoveEnd?: boolean;
|
|
17
|
+
motsByZoom?: RealtimeMot[][];
|
|
18
18
|
generalizationLevelByZoom?: RealtimeGeneralizationLevel[];
|
|
19
19
|
renderTimeIntervalByZoom?: number[];
|
|
20
20
|
style?: RealtimeStyleFunction;
|
|
@@ -31,6 +31,7 @@ export declare type RealtimeLayerMixinOptions = OlLayerOptions & {
|
|
|
31
31
|
useRequestAnimationFrame?: boolean;
|
|
32
32
|
useDebounce?: boolean;
|
|
33
33
|
useThrottle?: boolean;
|
|
34
|
+
getMotsByZoom: (zoom: number, motsByZoom: RealtimeMot[][]) => RealtimeMot[];
|
|
34
35
|
getGeneralizationLevelByZoom?: (zoom: number, generalizationLevelByZoom: RealtimeGeneralizationLevel[]) => RealtimeGeneralizationLevel;
|
|
35
36
|
getRenderTimeIntervalByZoom?: (zoom: number, renderTimeIntervalByZoom: number[]) => number;
|
|
36
37
|
url?: string;
|
|
@@ -105,7 +106,6 @@ declare function RealtimeLayerMixin<T extends AnyLayerClass>(Base: T): {
|
|
|
105
106
|
style?: RealtimeStyleFunction | undefined;
|
|
106
107
|
styleOptions?: RealtimeStyleOptions | undefined;
|
|
107
108
|
pixelRatio?: number | undefined;
|
|
108
|
-
minZoomNonTrain: number;
|
|
109
109
|
minZoomInterpolation: number;
|
|
110
110
|
isUpdateBboxOnMoveEnd: boolean;
|
|
111
111
|
hoverVehicleId?: string | undefined;
|
|
@@ -114,6 +114,8 @@ declare function RealtimeLayerMixin<T extends AnyLayerClass>(Base: T): {
|
|
|
114
114
|
useRequestAnimationFrame?: boolean | undefined;
|
|
115
115
|
useDebounce?: boolean | undefined;
|
|
116
116
|
useThrottle?: boolean | undefined;
|
|
117
|
+
mots?: RealtimeMot[] | undefined;
|
|
118
|
+
motsByZoom: RealtimeMot[][];
|
|
117
119
|
generalizationLevel?: RealtimeGeneralizationLevel | undefined;
|
|
118
120
|
generalizationLevelByZoom: RealtimeGeneralizationLevel[];
|
|
119
121
|
renderTimeIntervalByZoom: number[];
|
|
@@ -123,6 +125,7 @@ declare function RealtimeLayerMixin<T extends AnyLayerClass>(Base: T): {
|
|
|
123
125
|
updateTimeDelay?: number | undefined;
|
|
124
126
|
visibilityRef: EventsKey;
|
|
125
127
|
selectedVehicle: GeoJSONFeature;
|
|
128
|
+
getMotsByZoom: (zoom: number) => RealtimeMot[];
|
|
126
129
|
getGeneralizationLevelByZoom: (zoom: number) => RealtimeGeneralizationLevel;
|
|
127
130
|
getRenderTimeIntervalByZoom: (zoom: number) => number;
|
|
128
131
|
throttleRenderTrajectories: (viewState: ViewState, noInterpolate?: boolean) => void;
|
|
@@ -221,7 +224,7 @@ declare function RealtimeLayerMixin<T extends AnyLayerClass>(Base: T): {
|
|
|
221
224
|
* Determine if the trajectory is useless and should be removed from the list or not.
|
|
222
225
|
* By default, this function exclude vehicles:
|
|
223
226
|
* - that have their trajectory outside the current extent and
|
|
224
|
-
* - that
|
|
227
|
+
* - that aren't in the MOT list.
|
|
225
228
|
*
|
|
226
229
|
* @param {RealtimeTrajectory} trajectory
|
|
227
230
|
* @param {Array<number>} extent
|
|
@@ -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,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U,SAAS,kBACL,OAAO;QA8CxB;;;;;;;;;;;;;;WAcG;sCAEU,SAAS,GAAG,SAAS,iBACjB,OAAO,GAAG,SAAS;yBAwBnB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,SAAS,MAAM;sBAyClD,YAAY;QAmB1B;;;;;WAKG;kCACsB,MAAM,GAAG,SAAS,GAAO,MAAM;QA0BxD;;;;WAIG;6BACkB,cAAc;QASnC;;;;;;;;WAQG;oEAGQ,0BAA0B;;;;;QAkCrC;;;;;WAKG;+BACoB,eAAe;;;;QAiBtC;;;;;;;;;;;WAWG;4DAGO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,QAClC,MAAM;QAcd;;;;WAIG;;yCAa8B,kBAAkB,GAAG,eAAe;QAYrE;;;;;WAKG;;;QAgBH;;;;;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"}
|
|
@@ -67,9 +67,29 @@ function RealtimeLayerMixin(Base) {
|
|
|
67
67
|
this.mode = options.mode || RealtimeModes.TOPOGRAPHIC;
|
|
68
68
|
this.api = options.api || new RealtimeAPI(options);
|
|
69
69
|
this.tenant = options.tenant || ''; // sbb,sbh or sbm
|
|
70
|
-
this.minZoomNonTrain = options.minZoomNonTrain || 9; // Min zoom level from which non trains are allowed to be displayed. Min value is 9 (as configured by the server
|
|
71
70
|
this.minZoomInterpolation = options.minZoomInterpolation || 8; // Min zoom level from which trains positions are not interpolated.
|
|
72
71
|
this.format = new GeoJSON();
|
|
72
|
+
// MOTs by zoom
|
|
73
|
+
const allMots = [
|
|
74
|
+
'tram',
|
|
75
|
+
'subway',
|
|
76
|
+
'rail',
|
|
77
|
+
'bus',
|
|
78
|
+
'ferry',
|
|
79
|
+
'cablecar',
|
|
80
|
+
'gondola',
|
|
81
|
+
'funicular',
|
|
82
|
+
'coach',
|
|
83
|
+
];
|
|
84
|
+
// Server will block non train before zoom 9
|
|
85
|
+
this.motsByZoom = options.motsByZoom || [allMots];
|
|
86
|
+
this.getMotsByZoom = (zoom) => {
|
|
87
|
+
return ((options.getMotsByZoom &&
|
|
88
|
+
options.getMotsByZoom(zoom, this.motsByZoom)) ||
|
|
89
|
+
this.motsByZoom[zoom] ||
|
|
90
|
+
this.motsByZoom[this.motsByZoom.length - 1]);
|
|
91
|
+
};
|
|
92
|
+
// Generalization levels by zoom
|
|
73
93
|
this.generalizationLevelByZoom = options.generalizationLevelByZoom || [
|
|
74
94
|
5, 5, 5, 5, 5, 5, 5, 5, 10, 30, 30, 100, 100, 100,
|
|
75
95
|
];
|
|
@@ -78,6 +98,7 @@ function RealtimeLayerMixin(Base) {
|
|
|
78
98
|
options.getGeneralizationLevelByZoom(zoom, this.generalizationLevelByZoom)) ||
|
|
79
99
|
this.generalizationLevelByZoom[zoom]);
|
|
80
100
|
};
|
|
101
|
+
// Render time interval by zoom
|
|
81
102
|
this.renderTimeIntervalByZoom = options.renderTimeIntervalByZoom || [
|
|
82
103
|
100000, 50000, 40000, 30000, 20000, 15000, 10000, 5000, 2000, 1000, 400,
|
|
83
104
|
300, 250, 180, 90, 60, 50, 50, 50, 50, 50,
|
|
@@ -413,6 +434,11 @@ function RealtimeLayerMixin(Base) {
|
|
|
413
434
|
if (this.generalizationLevel) {
|
|
414
435
|
bbox.push(`gen=${this.generalizationLevel}`);
|
|
415
436
|
}
|
|
437
|
+
/* @ignore */
|
|
438
|
+
this.mots = this.getMotsByZoom(zoom);
|
|
439
|
+
if (this.mots) {
|
|
440
|
+
bbox.push(`mots=${this.mots}`);
|
|
441
|
+
}
|
|
416
442
|
}
|
|
417
443
|
this.api.bbox = bbox;
|
|
418
444
|
}
|
|
@@ -518,7 +544,7 @@ function RealtimeLayerMixin(Base) {
|
|
|
518
544
|
* Determine if the trajectory is useless and should be removed from the list or not.
|
|
519
545
|
* By default, this function exclude vehicles:
|
|
520
546
|
* - that have their trajectory outside the current extent and
|
|
521
|
-
* - that
|
|
547
|
+
* - that aren't in the MOT list.
|
|
522
548
|
*
|
|
523
549
|
* @param {RealtimeTrajectory} trajectory
|
|
524
550
|
* @param {Array<number>} extent
|
|
@@ -527,9 +553,12 @@ function RealtimeLayerMixin(Base) {
|
|
|
527
553
|
* @ignore
|
|
528
554
|
*/
|
|
529
555
|
purgeTrajectory(trajectory, extent, zoom) {
|
|
556
|
+
var _a;
|
|
530
557
|
const { type, bounds } = trajectory.properties;
|
|
531
558
|
if (!intersects(extent, bounds) ||
|
|
532
|
-
(
|
|
559
|
+
!((_a = this.mots) === null || _a === void 0 ? void 0 : _a.includes(type)) ||
|
|
560
|
+
(type !== 'rail' && zoom < 9) // zoom 9 is defined by the backend
|
|
561
|
+
) {
|
|
533
562
|
this.removeTrajectory(trajectory);
|
|
534
563
|
return true;
|
|
535
564
|
}
|
|
@@ -23,7 +23,6 @@ declare const RealtimeLayer_base: {
|
|
|
23
23
|
style?: import("../../types").RealtimeStyleFunction | undefined;
|
|
24
24
|
styleOptions?: import("../../types").RealtimeStyleOptions | undefined;
|
|
25
25
|
pixelRatio?: number | undefined;
|
|
26
|
-
minZoomNonTrain: number;
|
|
27
26
|
minZoomInterpolation: number;
|
|
28
27
|
isUpdateBboxOnMoveEnd: boolean;
|
|
29
28
|
hoverVehicleId?: string | undefined;
|
|
@@ -32,6 +31,8 @@ declare const RealtimeLayer_base: {
|
|
|
32
31
|
useRequestAnimationFrame?: boolean | undefined;
|
|
33
32
|
useDebounce?: boolean | undefined;
|
|
34
33
|
useThrottle?: boolean | undefined;
|
|
34
|
+
mots?: import("../../types").RealtimeMot[] | undefined;
|
|
35
|
+
motsByZoom: import("../../types").RealtimeMot[][];
|
|
35
36
|
generalizationLevel?: import("../../types").RealtimeGeneralizationLevel | undefined;
|
|
36
37
|
generalizationLevelByZoom: import("../../types").RealtimeGeneralizationLevel[];
|
|
37
38
|
renderTimeIntervalByZoom: number[];
|
|
@@ -41,6 +42,7 @@ declare const RealtimeLayer_base: {
|
|
|
41
42
|
updateTimeDelay?: number | undefined;
|
|
42
43
|
visibilityRef: import("ol/events").EventsKey;
|
|
43
44
|
selectedVehicle: GeoJSONFeature;
|
|
45
|
+
getMotsByZoom: (zoom: number) => import("../../types").RealtimeMot[];
|
|
44
46
|
getGeneralizationLevelByZoom: (zoom: number) => import("../../types").RealtimeGeneralizationLevel;
|
|
45
47
|
getRenderTimeIntervalByZoom: (zoom: number) => number;
|
|
46
48
|
throttleRenderTrajectories: (viewState: import("../../types").ViewState, noInterpolate?: boolean | undefined) => 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,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,oBAAo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${i3} ${o3} u_${a3};
|
|
|
49135
49135
|
this.mode = options.mode || RealtimeModes.TOPOGRAPHIC;
|
|
49136
49136
|
this.api = options.api || new RealtimeAPI_default(options);
|
|
49137
49137
|
this.tenant = options.tenant || "";
|
|
49138
|
-
this.minZoomNonTrain = options.minZoomNonTrain || 9;
|
|
49139
49138
|
this.minZoomInterpolation = options.minZoomInterpolation || 8;
|
|
49140
49139
|
this.format = new GeoJSON_default();
|
|
49140
|
+
const allMots = [
|
|
49141
|
+
"tram",
|
|
49142
|
+
"subway",
|
|
49143
|
+
"rail",
|
|
49144
|
+
"bus",
|
|
49145
|
+
"ferry",
|
|
49146
|
+
"cablecar",
|
|
49147
|
+
"gondola",
|
|
49148
|
+
"funicular",
|
|
49149
|
+
"coach"
|
|
49150
|
+
];
|
|
49151
|
+
this.motsByZoom = options.motsByZoom || [allMots];
|
|
49152
|
+
this.getMotsByZoom = (zoom) => {
|
|
49153
|
+
return options.getMotsByZoom && options.getMotsByZoom(zoom, this.motsByZoom) || this.motsByZoom[zoom] || this.motsByZoom[this.motsByZoom.length - 1];
|
|
49154
|
+
};
|
|
49141
49155
|
this.generalizationLevelByZoom = options.generalizationLevelByZoom || [
|
|
49142
49156
|
5,
|
|
49143
49157
|
5,
|
|
@@ -49399,6 +49413,10 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49399
49413
|
if (this.generalizationLevel) {
|
|
49400
49414
|
bbox.push(`gen=${this.generalizationLevel}`);
|
|
49401
49415
|
}
|
|
49416
|
+
this.mots = this.getMotsByZoom(zoom);
|
|
49417
|
+
if (this.mots) {
|
|
49418
|
+
bbox.push(`mots=${this.mots}`);
|
|
49419
|
+
}
|
|
49402
49420
|
}
|
|
49403
49421
|
this.api.bbox = bbox;
|
|
49404
49422
|
}
|
|
@@ -49466,7 +49484,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49466
49484
|
}
|
|
49467
49485
|
purgeTrajectory(trajectory, extent, zoom) {
|
|
49468
49486
|
const { type, bounds } = trajectory.properties;
|
|
49469
|
-
if (!intersects(extent, bounds) || type !== "rail" && zoom <
|
|
49487
|
+
if (!intersects(extent, bounds) || !this.mots?.includes(type) || type !== "rail" && zoom < 9) {
|
|
49470
49488
|
this.removeTrajectory(trajectory);
|
|
49471
49489
|
return true;
|
|
49472
49490
|
}
|