mobility-toolbox-js 2.0.0-beta.53 → 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/api/RealtimeAPI.d.ts +71 -81
- package/api/RealtimeAPI.d.ts.map +1 -1
- package/api/RealtimeAPI.js +98 -265
- package/common/api/WebSocketAPI.d.ts +13 -15
- package/common/api/WebSocketAPI.d.ts.map +1 -1
- package/common/mixins/RealtimeLayerMixin.d.ts +4 -4
- package/common/mixins/RealtimeLayerMixin.d.ts.map +1 -1
- package/common/mixins/RealtimeLayerMixin.js +4 -4
- 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/index.d.ts +3 -0
- package/common/utils/index.js +3 -0
- 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/mapbox/layers/RealtimeLayer.d.ts +4 -4
- package/mbt.js +183 -244
- package/mbt.js.map +3 -3
- package/mbt.min.js +11 -11
- package/mbt.min.js.map +3 -3
- 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/package.json +1 -1
- package/types/common.d.ts +1 -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
|
@@ -5,8 +5,9 @@ import { Coordinate } from 'ol/coordinate';
|
|
|
5
5
|
import { ObjectEvent } from 'ol/Object';
|
|
6
6
|
import Layer from './Layer';
|
|
7
7
|
import { RealtimeLayerMixinOptions } from '../../common/mixins/RealtimeLayerMixin';
|
|
8
|
-
import { AnyMap, LayerGetFeatureInfoResponse, RealtimeTrainId } from '../../types';
|
|
8
|
+
import { AnyMap, LayerGetFeatureInfoResponse, RealtimeFullTrajectory, RealtimeTrainId } from '../../types';
|
|
9
9
|
import { RealtimeTrajectory } from '../../api/typedefs';
|
|
10
|
+
import { WebSocketAPIMessageEventData } from '../../common/api/WebSocketAPI';
|
|
10
11
|
export declare type OlRealtimeLayerOptions = RealtimeLayerMixinOptions & {
|
|
11
12
|
fullTrajectoryStyle: (feature: FeatureLike, resolution: number, options: any) => void;
|
|
12
13
|
};
|
|
@@ -45,7 +46,8 @@ declare const RealtimeLayer_base: {
|
|
|
45
46
|
requestId?: number | undefined;
|
|
46
47
|
updateTimeInterval?: number | undefined;
|
|
47
48
|
updateTimeDelay?: number | undefined;
|
|
48
|
-
|
|
49
|
+
/** @ignore */
|
|
50
|
+
visibilityRef: import("ol/events").EventsKey; /** @ignore */
|
|
49
51
|
selectedVehicle: GeoJSONFeature;
|
|
50
52
|
getGeneralizationLevelByZoom: (zoom: number) => import("../../types").RealtimeGeneralizationLevel;
|
|
51
53
|
getRenderTimeIntervalByZoom: (zoom: number) => number;
|
|
@@ -70,16 +72,16 @@ declare const RealtimeLayer_base: {
|
|
|
70
72
|
coordinate: Coordinate;
|
|
71
73
|
}>;
|
|
72
74
|
getTrajectoryInfos(id: string): Promise<{
|
|
73
|
-
stopSequence:
|
|
74
|
-
fullTrajectory:
|
|
75
|
+
stopSequence: WebSocketAPIMessageEventData<RealtimeFullTrajectory> | WebSocketAPIMessageEventData<GeoJSONFeature[]>;
|
|
76
|
+
fullTrajectory: WebSocketAPIMessageEventData<RealtimeFullTrajectory> | WebSocketAPIMessageEventData<GeoJSONFeature[]>;
|
|
75
77
|
}>;
|
|
76
78
|
purgeTrajectory(trajectory: GeoJSONFeature, extent: [number, number, number, number], zoom: number): boolean;
|
|
77
79
|
addTrajectory(trajectory: GeoJSONFeature): void;
|
|
78
80
|
removeTrajectory(trajectoryOrId: any): void;
|
|
79
81
|
onZoomEnd(): void;
|
|
80
82
|
onDocumentVisibilityChange(): void;
|
|
81
|
-
onTrajectoryMessage(data:
|
|
82
|
-
onDeleteTrajectoryMessage(data:
|
|
83
|
+
onTrajectoryMessage(data: WebSocketAPIMessageEventData<GeoJSONFeature>): void;
|
|
84
|
+
onDeleteTrajectoryMessage(data: WebSocketAPIMessageEventData<string>): void;
|
|
83
85
|
onFeatureHover(features: Feature<import("ol/geom/Geometry").default>[], layer: import("../../types").AnyRealtimeLayer, coordinate: Coordinate): void;
|
|
84
86
|
onFeatureClick(features: Feature<import("ol/geom/Geometry").default>[], layer: import("../../types").AnyRealtimeLayer, coordinate: Coordinate): void;
|
|
85
87
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RealtimeLayer.d.ts","sourceRoot":"","sources":["../../../src/ol/layers/RealtimeLayer.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,mBAAmB,CAAC;AAKxC,OAAO,OAAO,EAAE,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAc,EACZ,yBAAyB,EAC1B,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,2BAA2B,
|
|
1
|
+
{"version":3,"file":"RealtimeLayer.d.ts","sourceRoot":"","sources":["../../../src/ol/layers/RealtimeLayer.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,mBAAmB,CAAC;AAKxC,OAAO,OAAO,EAAE,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,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;;;;OAMG;IAEH,SAAS;IAIT;;;;;OAKG;IACH,cAAc,CACZ,QAAQ,EAAE,OAAO,EAAE,EACnB,KAAK,EAAE,aAAa,EACpB,UAAU,EAAE,UAAU;IAQxB;;;;;OAKG;IACH,cAAc,CACZ,QAAQ,EAAE,OAAO,EAAE,EACnB,KAAK,EAAE,aAAa,EACpB,UAAU,EAAE,UAAU;IAWxB;;;;OAIG;IACH,eAAe,CACb,UAAU,EAAE,kBAAkB,EAC9B,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EACxC,IAAI,EAAE,MAAM;IASd;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM;IAUhE;;;OAGG;IACH,mBAAmB,CAAC,EAAE,EAAE,eAAe;IAmBvC;;;;OAIG;IACH,KAAK,CAAC,UAAU,EAAE,sBAAsB;CAGzC;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -281,9 +281,9 @@ class RealtimeLayer extends mixin(Layer) {
|
|
|
281
281
|
highlightTrajectory(id) {
|
|
282
282
|
this.api
|
|
283
283
|
.getFullTrajectory(id, this.mode, this.generalizationLevel)
|
|
284
|
-
.then((
|
|
285
|
-
const
|
|
286
|
-
|
|
284
|
+
.then((data) => {
|
|
285
|
+
const fullTrajectory = data.content;
|
|
286
|
+
this.vectorLayer.getSource().clear();
|
|
287
287
|
if (!fullTrajectory ||
|
|
288
288
|
!fullTrajectory.features ||
|
|
289
289
|
!fullTrajectory.features.length) {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "mobility-toolbox-js",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"description": "Toolbox for JavaScript applications in the domains of mobility and logistics.",
|
|
5
|
-
"version": "2.0.0-beta.
|
|
5
|
+
"version": "2.0.0-beta.54",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./index.js",
|
package/types/common.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ import type {
|
|
|
16
16
|
} from '../ol';
|
|
17
17
|
import { RealtimeTrajectory } from '../api/typedefs';
|
|
18
18
|
import CommonLayer, { LayerCommonOptions } from '../common/layers/LayerCommon';
|
|
19
|
-
import { RoutingParameters } from '.';
|
|
19
|
+
import type { RoutingParameters } from '.';
|
|
20
20
|
|
|
21
21
|
export type StyleCache = { [key: string]: AnyCanvas };
|
|
22
22
|
|
package/types/realtime.d.ts
CHANGED
|
@@ -132,8 +132,6 @@ export interface RealtimeStop {
|
|
|
132
132
|
state?: RealtimeStopState;
|
|
133
133
|
stationId: RealtimeStationId;
|
|
134
134
|
stationName: string;
|
|
135
|
-
arrivalTimeWithDelay: number; // TODO: add by cleanStopTime function
|
|
136
|
-
departureTimeWithDelay: number; // TODO: add by cleanStopTime function
|
|
137
135
|
}
|
|
138
136
|
|
|
139
137
|
export interface RealtimeStopSequence {
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { RealtimeStopSequence } from '../../types';
|
|
2
|
-
/**
|
|
3
|
-
* Remove the delay from arrivalTime and departureTime
|
|
4
|
-
* @private
|
|
5
|
-
*/
|
|
6
|
-
declare const cleanStopTime: (content: RealtimeStopSequence) => RealtimeStopSequence;
|
|
7
|
-
export default cleanStopTime;
|
|
8
|
-
//# sourceMappingURL=cleanStopTime.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cleanStopTime.d.ts","sourceRoot":"","sources":["../../../src/common/utils/cleanStopTime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD;;;GAGG;AACH,QAAA,MAAM,aAAa,YAAa,oBAAoB,KAAG,oBAmBtD,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Remove the delay from arrivalTime and departureTime
|
|
3
|
-
* @private
|
|
4
|
-
*/
|
|
5
|
-
const cleanStopTime = (content) => {
|
|
6
|
-
content.stations.forEach((station) => {
|
|
7
|
-
// eslint-disable-next-line no-param-reassign
|
|
8
|
-
station.arrivalTimeWithDelay = station.arrivalTime;
|
|
9
|
-
if (station.departureTime) {
|
|
10
|
-
// eslint-disable-next-line no-param-reassign
|
|
11
|
-
station.departureTimeWithDelay = station.departureTime;
|
|
12
|
-
}
|
|
13
|
-
if (station.arrivalDelay) {
|
|
14
|
-
// eslint-disable-next-line no-param-reassign
|
|
15
|
-
station.arrivalTime -= station.arrivalDelay;
|
|
16
|
-
if (station.departureTime) {
|
|
17
|
-
// eslint-disable-next-line no-param-reassign
|
|
18
|
-
station.departureTime -= station.arrivalDelay;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
// eslint-disable-next-line consistent-return
|
|
23
|
-
return content;
|
|
24
|
-
};
|
|
25
|
-
export default cleanStopTime;
|