mobility-toolbox-js 3.0.1-beta.4 → 3.0.1-beta.6
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/utils/RealtimeEngine.d.ts +10 -10
- package/common/utils/RealtimeEngine.js +37 -37
- package/maplibre/layers/RealtimeLayer.d.ts +3 -3
- package/maplibre/layers/RealtimeLayer.js +9 -9
- package/mbt.js +44 -54
- package/mbt.js.map +2 -2
- package/mbt.min.js +1 -1
- package/mbt.min.js.map +3 -3
- package/ol/layers/MaplibreStyleLayer.js +0 -11
- package/ol/renderers/RealtimeLayerRenderer.js +1 -0
- package/package.json +1 -1
|
@@ -68,7 +68,6 @@ declare class RealtimeEngine {
|
|
|
68
68
|
getGeneralizationLevelByZoom: (zoom: number) => RealtimeGeneralizationLevel;
|
|
69
69
|
getMotsByZoom: (zoom: number) => RealtimeMot[];
|
|
70
70
|
getRenderTimeIntervalByZoom: (zoom: number) => number;
|
|
71
|
-
getViewState: () => ViewState;
|
|
72
71
|
hoverVehicleId?: RealtimeTrainId;
|
|
73
72
|
isUpdateBboxOnMoveEnd: boolean;
|
|
74
73
|
live?: boolean;
|
|
@@ -84,7 +83,6 @@ declare class RealtimeEngine {
|
|
|
84
83
|
requestId?: number;
|
|
85
84
|
selectedVehicle: RealtimeTrajectory;
|
|
86
85
|
selectedVehicleId?: RealtimeTrainId;
|
|
87
|
-
shouldRender: () => boolean;
|
|
88
86
|
sort?: SortFunction;
|
|
89
87
|
styleOptions?: RealtimeStyleOptions;
|
|
90
88
|
tenant: RealtimeTenant;
|
|
@@ -95,6 +93,14 @@ declare class RealtimeEngine {
|
|
|
95
93
|
useDebounce?: boolean;
|
|
96
94
|
useRequestAnimationFrame?: boolean;
|
|
97
95
|
useThrottle?: boolean;
|
|
96
|
+
get mode(): RealtimeMode;
|
|
97
|
+
set mode(newMode: RealtimeMode);
|
|
98
|
+
get speed(): number;
|
|
99
|
+
set speed(newSpeed: number);
|
|
100
|
+
get style(): RealtimeStyleFunction;
|
|
101
|
+
set style(newStyle: RealtimeStyleFunction);
|
|
102
|
+
get time(): Date;
|
|
103
|
+
set time(newTime: Date | number);
|
|
98
104
|
constructor(options: RealtimeEngineOptions);
|
|
99
105
|
/**
|
|
100
106
|
* Add a trajectory.
|
|
@@ -126,6 +132,7 @@ declare class RealtimeEngine {
|
|
|
126
132
|
* @return {Promise<FeatureInfo>} Promise with features, layer and coordinate.
|
|
127
133
|
*/
|
|
128
134
|
getVehiclesAtCoordinate(coordinate: Coordinate, options?: LayerGetFeatureInfoOptions): FeatureCollection;
|
|
135
|
+
getViewState: () => ViewState;
|
|
129
136
|
/**
|
|
130
137
|
* Callback on websocket's deleted_vehicles channel events.
|
|
131
138
|
* It removes the trajectory from the list.
|
|
@@ -190,6 +197,7 @@ declare class RealtimeEngine {
|
|
|
190
197
|
*/
|
|
191
198
|
renderTrajectoriesInternal(viewState: ViewState, noInterpolate?: boolean): boolean;
|
|
192
199
|
setBbox(): void;
|
|
200
|
+
shouldRender: () => boolean;
|
|
193
201
|
start(): void;
|
|
194
202
|
/**
|
|
195
203
|
* Start the clock.
|
|
@@ -202,13 +210,5 @@ declare class RealtimeEngine {
|
|
|
202
210
|
* @private
|
|
203
211
|
*/
|
|
204
212
|
stopUpdateTime(): void;
|
|
205
|
-
get mode(): RealtimeMode;
|
|
206
|
-
set mode(newMode: RealtimeMode);
|
|
207
|
-
get speed(): number;
|
|
208
|
-
set speed(newSpeed: number);
|
|
209
|
-
get style(): RealtimeStyleFunction;
|
|
210
|
-
set style(newStyle: RealtimeStyleFunction);
|
|
211
|
-
get time(): Date;
|
|
212
|
-
set time(newTime: Date | number);
|
|
213
213
|
}
|
|
214
214
|
export default RealtimeEngine;
|
|
@@ -14,6 +14,43 @@ import renderTrajectories from './renderTrajectories';
|
|
|
14
14
|
* This class is totally agnostic from Maplibre or OpenLayers and must stay taht way.
|
|
15
15
|
*/
|
|
16
16
|
class RealtimeEngine {
|
|
17
|
+
get mode() {
|
|
18
|
+
return this._mode;
|
|
19
|
+
}
|
|
20
|
+
set mode(newMode) {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
if (newMode === this._mode) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
this._mode = newMode;
|
|
26
|
+
if ((_b = (_a = this.api) === null || _a === void 0 ? void 0 : _a.wsApi) === null || _b === void 0 ? void 0 : _b.open) {
|
|
27
|
+
this.stop();
|
|
28
|
+
this.start();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
get speed() {
|
|
32
|
+
return this._speed;
|
|
33
|
+
}
|
|
34
|
+
set speed(newSpeed) {
|
|
35
|
+
this._speed = newSpeed;
|
|
36
|
+
this.start();
|
|
37
|
+
}
|
|
38
|
+
get style() {
|
|
39
|
+
return this._style;
|
|
40
|
+
}
|
|
41
|
+
set style(newStyle) {
|
|
42
|
+
this._style = newStyle;
|
|
43
|
+
this.renderTrajectories();
|
|
44
|
+
}
|
|
45
|
+
get time() {
|
|
46
|
+
return this._time;
|
|
47
|
+
}
|
|
48
|
+
set time(newTime) {
|
|
49
|
+
this._time = (newTime === null || newTime === void 0 ? void 0 : newTime.getTime)
|
|
50
|
+
? newTime
|
|
51
|
+
: new Date(newTime);
|
|
52
|
+
this.renderTrajectories();
|
|
53
|
+
}
|
|
17
54
|
constructor(options) {
|
|
18
55
|
this.getViewState = () => ({});
|
|
19
56
|
this.shouldRender = () => true;
|
|
@@ -513,42 +550,5 @@ class RealtimeEngine {
|
|
|
513
550
|
this.updateTimeInterval = undefined;
|
|
514
551
|
}
|
|
515
552
|
}
|
|
516
|
-
get mode() {
|
|
517
|
-
return this._mode;
|
|
518
|
-
}
|
|
519
|
-
set mode(newMode) {
|
|
520
|
-
var _a, _b;
|
|
521
|
-
if (newMode === this._mode) {
|
|
522
|
-
return;
|
|
523
|
-
}
|
|
524
|
-
this._mode = newMode;
|
|
525
|
-
if ((_b = (_a = this.api) === null || _a === void 0 ? void 0 : _a.wsApi) === null || _b === void 0 ? void 0 : _b.open) {
|
|
526
|
-
this.stop();
|
|
527
|
-
this.start();
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
get speed() {
|
|
531
|
-
return this._speed;
|
|
532
|
-
}
|
|
533
|
-
set speed(newSpeed) {
|
|
534
|
-
this._speed = newSpeed;
|
|
535
|
-
this.start();
|
|
536
|
-
}
|
|
537
|
-
get style() {
|
|
538
|
-
return this._style;
|
|
539
|
-
}
|
|
540
|
-
set style(newStyle) {
|
|
541
|
-
this._style = newStyle;
|
|
542
|
-
this.renderTrajectories();
|
|
543
|
-
}
|
|
544
|
-
get time() {
|
|
545
|
-
return this._time;
|
|
546
|
-
}
|
|
547
|
-
set time(newTime) {
|
|
548
|
-
this._time = (newTime === null || newTime === void 0 ? void 0 : newTime.getTime)
|
|
549
|
-
? newTime
|
|
550
|
-
: new Date(newTime);
|
|
551
|
-
this.renderTrajectories();
|
|
552
|
-
}
|
|
553
553
|
}
|
|
554
554
|
export default RealtimeEngine;
|
|
@@ -45,6 +45,9 @@ declare class RealtimeLayer extends Layer {
|
|
|
45
45
|
layer: LayerSpecification;
|
|
46
46
|
source: CanvasSourceSpecification;
|
|
47
47
|
sourceId: string;
|
|
48
|
+
get canvas(): AnyCanvas | undefined;
|
|
49
|
+
get pixelRatio(): number | undefined;
|
|
50
|
+
set pixelRatio(pixelRatio: number | undefined);
|
|
48
51
|
/**
|
|
49
52
|
* Constructor.
|
|
50
53
|
*
|
|
@@ -117,8 +120,5 @@ declare class RealtimeLayer extends Layer {
|
|
|
117
120
|
* @public
|
|
118
121
|
*/
|
|
119
122
|
stop(): void;
|
|
120
|
-
get canvas(): AnyCanvas | undefined;
|
|
121
|
-
get pixelRatio(): number | undefined;
|
|
122
|
-
set pixelRatio(pixelRatio: number | undefined);
|
|
123
123
|
}
|
|
124
124
|
export default RealtimeLayer;
|
|
@@ -54,6 +54,15 @@ import Layer from './Layer';
|
|
|
54
54
|
* @public
|
|
55
55
|
*/
|
|
56
56
|
class RealtimeLayer extends Layer {
|
|
57
|
+
get canvas() {
|
|
58
|
+
return this.engine.canvas;
|
|
59
|
+
}
|
|
60
|
+
get pixelRatio() {
|
|
61
|
+
return this.engine.pixelRatio || 1;
|
|
62
|
+
}
|
|
63
|
+
set pixelRatio(pixelRatio) {
|
|
64
|
+
this.engine.pixelRatio = pixelRatio || 1;
|
|
65
|
+
}
|
|
57
66
|
/**
|
|
58
67
|
* Constructor.
|
|
59
68
|
*
|
|
@@ -248,15 +257,6 @@ class RealtimeLayer extends Layer {
|
|
|
248
257
|
(_b = this.map) === null || _b === void 0 ? void 0 : _b.off('moveend', this.onMoveEnd);
|
|
249
258
|
(_c = this.map) === null || _c === void 0 ? void 0 : _c.off('zoomend', this.onZoomEnd);
|
|
250
259
|
}
|
|
251
|
-
get canvas() {
|
|
252
|
-
return this.engine.canvas;
|
|
253
|
-
}
|
|
254
|
-
get pixelRatio() {
|
|
255
|
-
return this.engine.pixelRatio || 1;
|
|
256
|
-
}
|
|
257
|
-
set pixelRatio(pixelRatio) {
|
|
258
|
-
this.engine.pixelRatio = pixelRatio || 1;
|
|
259
|
-
}
|
|
260
260
|
}
|
|
261
261
|
_RealtimeLayer_internalId = new WeakMap();
|
|
262
262
|
export default RealtimeLayer;
|
package/mbt.js
CHANGED
|
@@ -46312,21 +46312,10 @@ uniform ${i3} ${a3} u_${s3};
|
|
|
46312
46312
|
* @override
|
|
46313
46313
|
*/
|
|
46314
46314
|
attachToMap(map) {
|
|
46315
|
-
if (this.maplibreLayer && !this.maplibreLayer.getMapInternal()) {
|
|
46316
|
-
map.addLayer(this.maplibreLayer);
|
|
46317
|
-
}
|
|
46318
46315
|
const mapInternal = this.getMapInternal();
|
|
46319
46316
|
if (!mapInternal || !this.maplibreLayer) {
|
|
46320
46317
|
return;
|
|
46321
46318
|
}
|
|
46322
|
-
if (!mapInternal.getTargetElement()) {
|
|
46323
|
-
this.olEventsKeys.push(
|
|
46324
|
-
mapInternal.on("change:target", () => {
|
|
46325
|
-
this.attachToMap(map);
|
|
46326
|
-
})
|
|
46327
|
-
);
|
|
46328
|
-
return;
|
|
46329
|
-
}
|
|
46330
46319
|
const { mapLibreMap } = this.maplibreLayer;
|
|
46331
46320
|
if (mapLibreMap) {
|
|
46332
46321
|
if (mapLibreMap.loaded()) {
|
|
@@ -46679,6 +46668,40 @@ uniform ${i3} ${a3} u_${s3};
|
|
|
46679
46668
|
this.onDeleteTrajectoryMessage = this.onDeleteTrajectoryMessage.bind(this);
|
|
46680
46669
|
this.onDocumentVisibilityChange = this.onDocumentVisibilityChange.bind(this);
|
|
46681
46670
|
}
|
|
46671
|
+
get mode() {
|
|
46672
|
+
return this._mode;
|
|
46673
|
+
}
|
|
46674
|
+
set mode(newMode) {
|
|
46675
|
+
if (newMode === this._mode) {
|
|
46676
|
+
return;
|
|
46677
|
+
}
|
|
46678
|
+
this._mode = newMode;
|
|
46679
|
+
if (this.api?.wsApi?.open) {
|
|
46680
|
+
this.stop();
|
|
46681
|
+
this.start();
|
|
46682
|
+
}
|
|
46683
|
+
}
|
|
46684
|
+
get speed() {
|
|
46685
|
+
return this._speed;
|
|
46686
|
+
}
|
|
46687
|
+
set speed(newSpeed) {
|
|
46688
|
+
this._speed = newSpeed;
|
|
46689
|
+
this.start();
|
|
46690
|
+
}
|
|
46691
|
+
get style() {
|
|
46692
|
+
return this._style;
|
|
46693
|
+
}
|
|
46694
|
+
set style(newStyle) {
|
|
46695
|
+
this._style = newStyle;
|
|
46696
|
+
this.renderTrajectories();
|
|
46697
|
+
}
|
|
46698
|
+
get time() {
|
|
46699
|
+
return this._time;
|
|
46700
|
+
}
|
|
46701
|
+
set time(newTime) {
|
|
46702
|
+
this._time = newTime?.getTime ? newTime : new Date(newTime);
|
|
46703
|
+
this.renderTrajectories();
|
|
46704
|
+
}
|
|
46682
46705
|
/**
|
|
46683
46706
|
* Add a trajectory.
|
|
46684
46707
|
* @param {RealtimeTrajectory} trajectory The trajectory to add.
|
|
@@ -47085,40 +47108,6 @@ uniform ${i3} ${a3} u_${s3};
|
|
|
47085
47108
|
this.updateTimeInterval = void 0;
|
|
47086
47109
|
}
|
|
47087
47110
|
}
|
|
47088
|
-
get mode() {
|
|
47089
|
-
return this._mode;
|
|
47090
|
-
}
|
|
47091
|
-
set mode(newMode) {
|
|
47092
|
-
if (newMode === this._mode) {
|
|
47093
|
-
return;
|
|
47094
|
-
}
|
|
47095
|
-
this._mode = newMode;
|
|
47096
|
-
if (this.api?.wsApi?.open) {
|
|
47097
|
-
this.stop();
|
|
47098
|
-
this.start();
|
|
47099
|
-
}
|
|
47100
|
-
}
|
|
47101
|
-
get speed() {
|
|
47102
|
-
return this._speed;
|
|
47103
|
-
}
|
|
47104
|
-
set speed(newSpeed) {
|
|
47105
|
-
this._speed = newSpeed;
|
|
47106
|
-
this.start();
|
|
47107
|
-
}
|
|
47108
|
-
get style() {
|
|
47109
|
-
return this._style;
|
|
47110
|
-
}
|
|
47111
|
-
set style(newStyle) {
|
|
47112
|
-
this._style = newStyle;
|
|
47113
|
-
this.renderTrajectories();
|
|
47114
|
-
}
|
|
47115
|
-
get time() {
|
|
47116
|
-
return this._time;
|
|
47117
|
-
}
|
|
47118
|
-
set time(newTime) {
|
|
47119
|
-
this._time = newTime?.getTime ? newTime : new Date(newTime);
|
|
47120
|
-
this.renderTrajectories();
|
|
47121
|
-
}
|
|
47122
47111
|
};
|
|
47123
47112
|
var RealtimeEngine_default = RealtimeEngine;
|
|
47124
47113
|
|
|
@@ -47172,6 +47161,7 @@ uniform ${i3} ${a3} u_${s3};
|
|
|
47172
47161
|
}
|
|
47173
47162
|
renderFrame(frameState) {
|
|
47174
47163
|
const { canvas: canvas2, renderedViewState } = this.getLayer();
|
|
47164
|
+
this.getLayer().engine.pixelRatio = frameState.pixelRatio;
|
|
47175
47165
|
if (!this.container) {
|
|
47176
47166
|
this.container = document.createElement("div");
|
|
47177
47167
|
this.container.className = this.getLayer().getClassName();
|
|
@@ -48474,6 +48464,15 @@ uniform ${i3} ${a3} u_${s3};
|
|
|
48474
48464
|
|
|
48475
48465
|
// src/maplibre/layers/RealtimeLayer.ts
|
|
48476
48466
|
var RealtimeLayer2 = class extends Layer_default5 {
|
|
48467
|
+
get canvas() {
|
|
48468
|
+
return this.engine.canvas;
|
|
48469
|
+
}
|
|
48470
|
+
get pixelRatio() {
|
|
48471
|
+
return this.engine.pixelRatio || 1;
|
|
48472
|
+
}
|
|
48473
|
+
set pixelRatio(pixelRatio) {
|
|
48474
|
+
this.engine.pixelRatio = pixelRatio || 1;
|
|
48475
|
+
}
|
|
48477
48476
|
#internalId;
|
|
48478
48477
|
/**
|
|
48479
48478
|
* Constructor.
|
|
@@ -48674,15 +48673,6 @@ uniform ${i3} ${a3} u_${s3};
|
|
|
48674
48673
|
this.map?.off("moveend", this.onMoveEnd);
|
|
48675
48674
|
this.map?.off("zoomend", this.onZoomEnd);
|
|
48676
48675
|
}
|
|
48677
|
-
get canvas() {
|
|
48678
|
-
return this.engine.canvas;
|
|
48679
|
-
}
|
|
48680
|
-
get pixelRatio() {
|
|
48681
|
-
return this.engine.pixelRatio || 1;
|
|
48682
|
-
}
|
|
48683
|
-
set pixelRatio(pixelRatio) {
|
|
48684
|
-
this.engine.pixelRatio = pixelRatio || 1;
|
|
48685
|
-
}
|
|
48686
48676
|
};
|
|
48687
48677
|
var RealtimeLayer_default2 = RealtimeLayer2;
|
|
48688
48678
|
|