mobility-toolbox-js 2.0.0-beta.30 → 2.0.0-beta.34
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 +268 -0
- package/api/RealtimeAPI.d.ts.map +1 -0
- package/api/RealtimeAPI.js +626 -343
- package/api/RoutingAPI.d.ts +33 -0
- package/api/RoutingAPI.d.ts.map +1 -0
- package/api/RoutingAPI.js +65 -15
- package/api/StopsAPI.d.ts +36 -0
- package/api/StopsAPI.d.ts.map +1 -0
- package/api/StopsAPI.js +70 -12
- package/api/index.d.ts +5 -0
- package/api/index.d.ts.map +1 -0
- package/api/index.js +10 -3
- package/api/typedefs.d.ts +105 -0
- package/api/typedefs.d.ts.map +1 -0
- package/api/typedefs.js +72 -0
- package/common/api/HttpAPI.d.ts +31 -0
- package/common/api/HttpAPI.d.ts.map +1 -0
- package/common/api/HttpAPI.js +82 -30
- package/common/api/WebSocketAPI.d.ts +95 -0
- package/common/api/WebSocketAPI.d.ts.map +1 -0
- package/common/api/WebSocketAPI.js +313 -168
- package/common/controls/Control.d.ts +74 -0
- package/common/controls/Control.d.ts.map +1 -0
- package/common/controls/Control.js +167 -78
- package/common/index.d.ts +3 -0
- package/common/index.d.ts.map +1 -0
- package/common/index.js +18 -2
- package/common/layers/Layer.d.ts +80 -0
- package/common/layers/Layer.d.ts.map +1 -0
- package/common/layers/Layer.js +251 -134
- package/common/mixins/CopyrightMixin.d.ts +22 -0
- package/common/mixins/CopyrightMixin.d.ts.map +1 -0
- package/common/mixins/CopyrightMixin.js +70 -22
- package/common/mixins/MapboxLayerMixin.d.ts +27 -0
- package/common/mixins/MapboxLayerMixin.d.ts.map +1 -0
- package/common/mixins/MapboxLayerMixin.js +240 -0
- package/common/mixins/RealtimeLayerMixin.d.ts +58 -0
- package/common/mixins/RealtimeLayerMixin.d.ts.map +1 -0
- package/common/mixins/RealtimeLayerMixin.js +698 -429
- package/common/mixins/StopFinderMixin.d.ts +40 -0
- package/common/mixins/StopFinderMixin.d.ts.map +1 -0
- package/common/mixins/StopFinderMixin.js +195 -107
- package/common/mixins/UserInteractionsLayerMixin.d.ts +42 -0
- package/common/mixins/UserInteractionsLayerMixin.d.ts.map +1 -0
- package/common/mixins/UserInteractionsLayerMixin.js +222 -121
- package/common/styles/index.d.ts +5 -0
- package/common/styles/index.d.ts.map +1 -0
- package/common/styles/index.js +24 -4
- package/common/styles/realtimeDefaultStyle.d.ts +15 -0
- package/common/styles/realtimeDefaultStyle.d.ts.map +1 -0
- package/common/styles/realtimeDefaultStyle.js +236 -190
- package/common/styles/realtimeDelayStyle.d.ts +11 -0
- package/common/styles/realtimeDelayStyle.d.ts.map +1 -0
- package/common/styles/realtimeDelayStyle.js +25 -7
- package/common/styles/realtimeSimpleStyle.d.ts +3 -0
- package/common/styles/realtimeSimpleStyle.d.ts.map +1 -0
- package/common/styles/realtimeSimpleStyle.js +23 -17
- package/common/typedefs.d.ts +50 -0
- package/common/typedefs.d.ts.map +1 -0
- package/common/typedefs.js +21 -0
- package/common/utils/cleanStopTime.d.ts +7 -0
- package/common/utils/cleanStopTime.d.ts.map +1 -0
- package/common/utils/cleanStopTime.js +28 -17
- package/common/utils/compareDepartures.d.ts +9 -0
- package/common/utils/compareDepartures.d.ts.map +1 -0
- package/common/utils/compareDepartures.js +34 -22
- package/common/utils/createCanvas.d.ts +9 -0
- package/common/utils/createCanvas.d.ts.map +1 -0
- package/common/utils/createCanvas.js +28 -16
- package/common/utils/createTrackerFilters.d.ts +12 -0
- package/common/utils/createTrackerFilters.d.ts.map +1 -0
- package/common/utils/createTrackerFilters.js +75 -54
- package/common/utils/getLayersAsFlatArray.d.ts +3 -0
- package/common/utils/getLayersAsFlatArray.d.ts.map +1 -0
- package/common/utils/getLayersAsFlatArray.js +15 -13
- package/common/utils/getMapboxMapCopyrights.d.ts +8 -0
- package/common/utils/getMapboxMapCopyrights.d.ts.map +1 -0
- package/common/utils/getMapboxMapCopyrights.js +24 -17
- package/common/utils/getMapboxRender.d.ts +5 -0
- package/common/utils/getMapboxRender.d.ts.map +1 -0
- package/common/utils/getMapboxRender.js +77 -0
- package/common/utils/getMaplibreRender.d.ts +5 -0
- package/common/utils/getMaplibreRender.d.ts.map +1 -0
- package/common/utils/getMaplibreRender.js +38 -0
- package/common/utils/getRealtimeModeSuffix.d.ts +8 -0
- package/common/utils/getRealtimeModeSuffix.d.ts.map +1 -0
- package/common/utils/getRealtimeModeSuffix.js +11 -2
- package/common/utils/getUrlWithParams.d.ts +9 -0
- package/common/utils/getUrlWithParams.d.ts.map +1 -0
- package/common/utils/getUrlWithParams.js +20 -10
- package/common/utils/getVehiclePosition.d.ts +14 -0
- package/common/utils/getVehiclePosition.d.ts.map +1 -0
- package/common/utils/getVehiclePosition.js +63 -39
- package/common/utils/index.d.ts +12 -0
- package/common/utils/index.d.ts.map +1 -0
- package/common/utils/index.js +37 -9
- package/common/utils/removeDuplicate.d.ts +10 -0
- package/common/utils/removeDuplicate.d.ts.map +1 -0
- package/common/utils/removeDuplicate.js +29 -7
- package/common/utils/renderTrajectories.d.ts +20 -0
- package/common/utils/renderTrajectories.d.ts.map +1 -0
- package/common/utils/renderTrajectories.js +111 -78
- package/common/utils/sortByDelay.d.ts +3 -0
- package/common/utils/sortByDelay.d.ts.map +1 -0
- package/common/utils/sortByDelay.js +21 -17
- package/common/utils/timeUtils.d.ts +5 -0
- package/common/utils/timeUtils.d.ts.map +1 -0
- package/common/utils/timeUtils.js +47 -18
- package/common/utils/trackerConfig.d.ts +24 -0
- package/common/utils/trackerConfig.d.ts.map +1 -0
- package/common/utils/trackerConfig.js +171 -118
- package/iife.d.ts +3 -0
- package/iife.d.ts.map +1 -0
- package/iife.js +7 -0
- package/index.d.ts +6 -0
- package/index.d.ts.map +1 -0
- package/index.js +10 -7
- package/mapbox/controls/CopyrightControl.d.ts +32 -0
- package/mapbox/controls/CopyrightControl.d.ts.map +1 -0
- package/mapbox/controls/CopyrightControl.js +72 -28
- package/mapbox/controls/index.d.ts +2 -0
- package/mapbox/controls/index.d.ts.map +1 -0
- package/mapbox/controls/index.js +6 -1
- package/mapbox/index.d.ts +5 -0
- package/mapbox/index.d.ts.map +1 -0
- package/mapbox/index.js +20 -4
- package/mapbox/layers/Layer.d.ts +47 -0
- package/mapbox/layers/Layer.d.ts.map +1 -0
- package/mapbox/layers/Layer.js +137 -54
- package/mapbox/layers/RealtimeLayer.d.ts +118 -0
- package/mapbox/layers/RealtimeLayer.d.ts.map +1 -0
- package/mapbox/layers/RealtimeLayer.js +310 -183
- package/mapbox/layers/index.d.ts +3 -0
- package/mapbox/layers/index.d.ts.map +1 -0
- package/mapbox/layers/index.js +7 -2
- package/mapbox/utils.d.ts +8 -0
- package/mapbox/utils.d.ts.map +1 -0
- package/mapbox/utils.js +54 -29
- package/mbt.js +2052 -2109
- package/mbt.js.map +3 -3
- package/mbt.min.js +18 -18
- package/mbt.min.js.map +3 -3
- package/ol/controls/CopyrightControl.d.ts +31 -0
- package/ol/controls/CopyrightControl.d.ts.map +1 -0
- package/ol/controls/CopyrightControl.js +89 -41
- package/ol/controls/RoutingControl.d.ts +180 -0
- package/ol/controls/RoutingControl.d.ts.map +1 -0
- package/ol/controls/RoutingControl.js +666 -371
- package/ol/controls/StopFinderControl.d.ts +32 -0
- package/ol/controls/StopFinderControl.d.ts.map +1 -0
- package/ol/controls/StopFinderControl.js +59 -10
- package/ol/controls/index.d.ts +4 -0
- package/ol/controls/index.d.ts.map +1 -0
- package/ol/controls/index.js +9 -3
- package/ol/index.d.ts +6 -0
- package/ol/index.d.ts.map +1 -0
- package/ol/index.js +21 -5
- package/ol/layers/Layer.d.ts +49 -0
- package/ol/layers/Layer.d.ts.map +1 -0
- package/ol/layers/Layer.js +178 -81
- package/ol/layers/MapboxLayer.d.ts +42 -0
- package/ol/layers/MapboxLayer.d.ts.map +1 -0
- package/ol/layers/MapboxLayer.js +131 -198
- package/ol/layers/MapboxStyleLayer.d.ts +146 -0
- package/ol/layers/MapboxStyleLayer.d.ts.map +1 -0
- package/ol/layers/MapboxStyleLayer.js +382 -186
- package/ol/layers/MaplibreLayer.d.ts +27 -0
- package/ol/layers/MaplibreLayer.d.ts.map +1 -0
- package/ol/layers/MaplibreLayer.js +67 -138
- package/ol/layers/RealtimeLayer.d.ts +119 -0
- package/ol/layers/RealtimeLayer.d.ts.map +1 -0
- package/ol/layers/RealtimeLayer.js +327 -184
- package/ol/layers/RoutingLayer.d.ts +24 -0
- package/ol/layers/RoutingLayer.d.ts.map +1 -0
- package/ol/layers/RoutingLayer.js +111 -56
- package/ol/layers/VectorLayer.d.ts +23 -0
- package/ol/layers/VectorLayer.d.ts.map +1 -0
- package/ol/layers/VectorLayer.js +71 -21
- package/ol/layers/WMSLayer.d.ts +38 -0
- package/ol/layers/WMSLayer.d.ts.map +1 -0
- package/ol/layers/WMSLayer.js +105 -37
- package/ol/layers/index.d.ts +9 -0
- package/ol/layers/index.d.ts.map +1 -0
- package/ol/layers/index.js +19 -8
- package/ol/styles/fullTrajectoryDelayStyle.d.ts +4 -0
- package/ol/styles/fullTrajectoryDelayStyle.d.ts.map +1 -0
- package/ol/styles/fullTrajectoryDelayStyle.js +32 -28
- package/ol/styles/fullTrajectoryStyle.d.ts +4 -0
- package/ol/styles/fullTrajectoryStyle.d.ts.map +1 -0
- package/ol/styles/fullTrajectoryStyle.js +44 -40
- package/ol/styles/index.d.ts +3 -0
- package/ol/styles/index.d.ts.map +1 -0
- package/ol/styles/index.js +7 -2
- package/package.json +14 -36
- package/setupTests.d.ts +2 -0
- package/setupTests.d.ts.map +1 -0
- package/setupTests.js +15 -0
- package/types/index.d.ts +7 -6
- package/types/routing.d.ts +25 -25
- package/types/stops.d.ts +19 -19
- package/api/RealtimeAPI.test.js +0 -67
- package/api/RoutingAPI.test.js +0 -25
- package/api/StopsAPI.test.js +0 -22
- package/common/api/HttpAPI.test.js +0 -50
- package/common/api/WebSocketAPI.test.js +0 -311
- package/common/controls/Control.test.js +0 -87
- package/common/layers/Layer.test.js +0 -134
- package/common/mixins/UserInteractionsLayerMixin.test.js +0 -199
- package/common/utils/createTrackerFilters.test.js +0 -79
- package/common/utils/getMapboxMapCopyrights.test.js +0 -40
- package/common/utils/removeDuplicate.test.js +0 -19
- package/common/utils/timeUtils.test.js +0 -10
- package/common/utils/trackerConfig.test.js +0 -23
- package/mapbox/layers/Layer.test.js +0 -182
- package/mapbox/layers/RealtimeLayer.test.js +0 -10
- package/ol/controls/CopyrightControl.test.js +0 -165
- package/ol/controls/RoutingControl.test.js +0 -146
- package/ol/controls/StopFinderControl.test.js +0 -48
- package/ol/layers/Layer.test.js +0 -175
- package/ol/layers/MapboxLayer.test.js +0 -160
- package/ol/layers/MapboxStyleLayer.test.js +0 -226
- package/ol/layers/RealtimeLayer.test.js +0 -67
- package/ol/layers/RoutingLayer.test.js +0 -39
- package/ol/layers/VectorLayer.test.js +0 -76
- package/ol/layers/WMSLayer.test.js +0 -57
|
@@ -1,19 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* Remove the delay from arrivalTime and departureTime
|
|
5
|
+
* @private
|
|
6
|
+
*/
|
|
7
|
+
var cleanStopTime = function (content) {
|
|
8
|
+
if (!content) {
|
|
9
|
+
return;
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
station.departureTime
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
content.stations.forEach(function (station) {
|
|
12
|
+
// eslint-disable-next-line no-param-reassign
|
|
13
|
+
station.arrivalTimeWithDelay = station.arrivalTime;
|
|
14
|
+
if (station.departureTime) {
|
|
15
|
+
// eslint-disable-next-line no-param-reassign
|
|
16
|
+
station.departureTimeWithDelay = station.departureTime;
|
|
17
|
+
}
|
|
18
|
+
if (station.arrivalDelay) {
|
|
19
|
+
// eslint-disable-next-line no-param-reassign
|
|
20
|
+
station.arrivalTime -= station.arrivalDelay;
|
|
21
|
+
if (station.departureTime) {
|
|
22
|
+
// eslint-disable-next-line no-param-reassign
|
|
23
|
+
station.departureTime -= station.arrivalDelay;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
// eslint-disable-next-line consistent-return
|
|
28
|
+
return content;
|
|
18
29
|
};
|
|
19
|
-
|
|
30
|
+
exports.default = cleanStopTime;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export default compareDepartures;
|
|
2
|
+
/**
|
|
3
|
+
* Compare two given departures for sort alogithm,
|
|
4
|
+
* @param {Object} a First departure.
|
|
5
|
+
* @param {Object} b Second departure.
|
|
6
|
+
* @private
|
|
7
|
+
*/
|
|
8
|
+
declare function compareDepartures(a: any, b: any, sortByMinArrivalTime?: boolean): number;
|
|
9
|
+
//# sourceMappingURL=compareDepartures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compareDepartures.d.ts","sourceRoot":"","sources":["../../../src/common/utils/compareDepartures.js"],"names":[],"mappings":";AAAA;;;;;GAKG;AACH,2FA8BC"}
|
|
@@ -1,25 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* Compare two given departures for sort alogithm,
|
|
5
|
+
* @param {Object} a First departure.
|
|
6
|
+
* @param {Object} b Second departure.
|
|
7
|
+
* @private
|
|
8
|
+
*/
|
|
9
|
+
var compareDepartures = function (a, b, sortByMinArrivalTime) {
|
|
10
|
+
if (sortByMinArrivalTime === void 0) { sortByMinArrivalTime = false; }
|
|
11
|
+
// First LEAVING and HIDDEN, then BOARDING and then sorted by time.
|
|
12
|
+
var topStates = ['HIDDEN', 'LEAVING', 'BOARDING'];
|
|
13
|
+
var aTop = a.has_fzo && topStates.indexOf(a.state) > -1;
|
|
14
|
+
var bTop = b.has_fzo && topStates.indexOf(b.state) > -1;
|
|
15
|
+
if (aTop || bTop) {
|
|
16
|
+
if (aTop !== bTop) {
|
|
17
|
+
return aTop ? -1 : 1;
|
|
18
|
+
}
|
|
19
|
+
if (a.state !== b.state) {
|
|
20
|
+
// one is leaving
|
|
21
|
+
return topStates.indexOf(a.state) - topStates.indexOf(b.state);
|
|
22
|
+
}
|
|
8
23
|
}
|
|
9
|
-
|
|
10
|
-
|
|
24
|
+
var aDuration = null;
|
|
25
|
+
var bDuration = null;
|
|
26
|
+
var now = Date.now();
|
|
27
|
+
if (sortByMinArrivalTime) {
|
|
28
|
+
aDuration = new Date(a.min_arrival_time || a.time).getTime() - now;
|
|
29
|
+
bDuration = new Date(b.min_arrival_time || b.time).getTime() - now;
|
|
11
30
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
aDuration = new Date(a.min_arrival_time || a.time).getTime() - now;
|
|
18
|
-
bDuration = new Date(b.min_arrival_time || b.time).getTime() - now;
|
|
19
|
-
} else {
|
|
20
|
-
aDuration = new Date(a.time).getTime() - now;
|
|
21
|
-
bDuration = new Date(b.time).getTime() - now;
|
|
22
|
-
}
|
|
23
|
-
return aDuration - bDuration;
|
|
31
|
+
else {
|
|
32
|
+
aDuration = new Date(a.time).getTime() - now;
|
|
33
|
+
bDuration = new Date(b.time).getTime() - now;
|
|
34
|
+
}
|
|
35
|
+
return aDuration - bDuration;
|
|
24
36
|
};
|
|
25
|
-
|
|
37
|
+
exports.default = compareDepartures;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export default createCanvas;
|
|
2
|
+
/**
|
|
3
|
+
* This function try to create a canvas element and return it.
|
|
4
|
+
* it uses document.createElement('canvas') if document is available
|
|
5
|
+
* or new OffscreenCanvas(width, height) if OffscreenCanvas is avalaible (for web worker)
|
|
6
|
+
* or it returns null if neither is available.
|
|
7
|
+
*/
|
|
8
|
+
declare function createCanvas(width: any, height: any): any;
|
|
9
|
+
//# sourceMappingURL=createCanvas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createCanvas.d.ts","sourceRoot":"","sources":["../../../src/common/utils/createCanvas.js"],"names":[],"mappings":";AAAA;;;;;GAKG;AACH,4DAqBC"}
|
|
@@ -1,17 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* This function try to create a canvas element and return it.
|
|
5
|
+
* it uses document.createElement('canvas') if document is available
|
|
6
|
+
* or new OffscreenCanvas(width, height) if OffscreenCanvas is avalaible (for web worker)
|
|
7
|
+
* or it returns null if neither is available.
|
|
8
|
+
*/
|
|
9
|
+
var createCanvas = function (width, height) {
|
|
10
|
+
var canvas = null;
|
|
11
|
+
// Prevent SSR errors
|
|
12
|
+
if (typeof window === 'undefined') {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
if (document === null || document === void 0 ? void 0 : document.createElement) {
|
|
16
|
+
canvas = document.createElement('canvas');
|
|
17
|
+
canvas.width = width;
|
|
18
|
+
canvas.height = height;
|
|
19
|
+
}
|
|
20
|
+
else if (OffscreenCanvas) {
|
|
21
|
+
canvas = new OffscreenCanvas(width, height);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
// eslint-disable-next-line no-console
|
|
25
|
+
console.error("We didn't find a way to create a canvas element, document.createElement('canvas') and new OffscrenCanvas() are not supported");
|
|
26
|
+
}
|
|
27
|
+
return canvas;
|
|
16
28
|
};
|
|
17
|
-
|
|
29
|
+
exports.default = createCanvas;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default createFilters;
|
|
2
|
+
/**
|
|
3
|
+
* Return a filter functions based on some parameters of a vehicle.
|
|
4
|
+
*
|
|
5
|
+
* @param {string|Array<string>} line - A list of vehicle's name to filter. Names can be separated by a comma. Ex: 'S1,S2,S3'
|
|
6
|
+
* @param {string|Array<string} route - A list of vehicle's route (contained in routeIdentifier property) to filter. Indentifiers can be separated by a comma. Ex: 'id1,id2,id3'
|
|
7
|
+
* @param {string|Array<string} operator A list of vehicle's operator to filter. Operators can be separated by a comma. Ex: 'SBB,DB'
|
|
8
|
+
* @param {Regexp} regexLine - A regex aplly of vehcile's name.
|
|
9
|
+
* @private
|
|
10
|
+
*/
|
|
11
|
+
declare function createFilters(line: string | Array<string>, route: string | Array<string>, operator: string | Array<string>, regexLine: Regexp): (t: any) => boolean;
|
|
12
|
+
//# sourceMappingURL=createTrackerFilters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTrackerFilters.d.ts","sourceRoot":"","sources":["../../../src/common/utils/createTrackerFilters.js"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;AACH,qCANW,MAAM,GAAC,MAAM,MAAM,CAAC,SACpB,MAAM,GAAC,MAAM,MAAM,CAAA,YACnB,MAAM,GAAC,MAAM,MAAM,CAAA,0CA+E7B"}
|
|
@@ -1,56 +1,77 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
return (t) => {
|
|
48
|
-
for (let i = 0; i < filterList.length; i += 1) {
|
|
49
|
-
if (!filterList[i](t)) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* Return a filter functions based on some parameters of a vehicle.
|
|
5
|
+
*
|
|
6
|
+
* @param {string|Array<string>} line - A list of vehicle's name to filter. Names can be separated by a comma. Ex: 'S1,S2,S3'
|
|
7
|
+
* @param {string|Array<string} route - A list of vehicle's route (contained in routeIdentifier property) to filter. Indentifiers can be separated by a comma. Ex: 'id1,id2,id3'
|
|
8
|
+
* @param {string|Array<string} operator A list of vehicle's operator to filter. Operators can be separated by a comma. Ex: 'SBB,DB'
|
|
9
|
+
* @param {Regexp} regexLine - A regex aplly of vehcile's name.
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
var createFilters = function (line, route, operator, regexLine) {
|
|
13
|
+
var filterList = [];
|
|
14
|
+
if (!line && !route && !operator && !regexLine) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
if (regexLine) {
|
|
18
|
+
var regexLineList_1 = typeof regexLine === 'string' ? [regexLine] : regexLine;
|
|
19
|
+
var lineFilter = function (item) {
|
|
20
|
+
var name = item.properties.name ||
|
|
21
|
+
(item.properties.line && item.properties.line.name) ||
|
|
22
|
+
'';
|
|
23
|
+
if (!name) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
return regexLineList_1.some(function (regexStr) {
|
|
27
|
+
return new RegExp(regexStr, 'i').test(name);
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
filterList.push(lineFilter);
|
|
31
|
+
}
|
|
32
|
+
if (line) {
|
|
33
|
+
var lineFiltersList = typeof line === 'string' ? line.split(',') : line;
|
|
34
|
+
var lineList_1 = lineFiltersList.map(function (l) {
|
|
35
|
+
return l.replace(/\s+/g, '').toUpperCase();
|
|
36
|
+
});
|
|
37
|
+
var lineFilter = function (item) {
|
|
38
|
+
var _a = item.properties, linee = _a.line, name = _a.name;
|
|
39
|
+
var lineName = (name || (linee && linee.name) || '').toUpperCase();
|
|
40
|
+
if (!lineName) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
return lineList_1.includes(lineName);
|
|
44
|
+
};
|
|
45
|
+
filterList.push(lineFilter);
|
|
52
46
|
}
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
if (route) {
|
|
48
|
+
var routes = typeof route === 'string' ? route.split(',') : route;
|
|
49
|
+
var routeList_1 = routes.map(function (item) { return parseInt(item, 10); });
|
|
50
|
+
var routeFilter = function (item) {
|
|
51
|
+
var routeId = parseInt(item.properties.routeIdentifier.split('.')[0], 10);
|
|
52
|
+
return routeList_1.includes(routeId);
|
|
53
|
+
};
|
|
54
|
+
filterList.push(routeFilter);
|
|
55
|
+
}
|
|
56
|
+
if (operator) {
|
|
57
|
+
var operatorList_1 = typeof operator === 'string' ? [operator] : operator;
|
|
58
|
+
var operatorFilter = function (item) {
|
|
59
|
+
return operatorList_1.some(function (op) {
|
|
60
|
+
return new RegExp(op, 'i').test(item.properties.operator);
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
filterList.push(operatorFilter);
|
|
64
|
+
}
|
|
65
|
+
if (!filterList.length) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
return function (t) {
|
|
69
|
+
for (var i = 0; i < filterList.length; i += 1) {
|
|
70
|
+
if (!filterList[i](t)) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return true;
|
|
75
|
+
};
|
|
55
76
|
};
|
|
56
|
-
|
|
77
|
+
exports.default = createFilters;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getLayersAsFlatArray.d.ts","sourceRoot":"","sources":["../../../src/common/utils/getLayersAsFlatArray.js"],"names":[],"mappings":";AAAA,iEAYC"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
layers =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
flatLayers
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var getLayersAsFlatArray = function (layersOrLayer) {
|
|
4
|
+
var layers = layersOrLayer;
|
|
5
|
+
if (!Array.isArray(layers)) {
|
|
6
|
+
layers = [layersOrLayer];
|
|
7
|
+
}
|
|
8
|
+
var flatLayers = [];
|
|
9
|
+
layers.forEach(function (layer) {
|
|
10
|
+
flatLayers.push(layer);
|
|
11
|
+
var children = layer.children;
|
|
12
|
+
flatLayers = flatLayers.concat(getLayersAsFlatArray(children || []));
|
|
13
|
+
});
|
|
14
|
+
return flatLayers;
|
|
13
15
|
};
|
|
14
|
-
|
|
16
|
+
exports.default = getLayersAsFlatArray;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export default getMapboxMapCopyrights;
|
|
2
|
+
/**
|
|
3
|
+
* Return the copyright a Mapbox map.
|
|
4
|
+
* @param {mapboxgl.Map} map A Mapbox map
|
|
5
|
+
* @ignore
|
|
6
|
+
*/
|
|
7
|
+
declare function getMapboxMapCopyrights(map: mapboxgl.Map): any[];
|
|
8
|
+
//# sourceMappingURL=getMapboxMapCopyrights.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getMapboxMapCopyrights.d.ts","sourceRoot":"","sources":["../../../src/common/utils/getMapboxMapCopyrights.js"],"names":[],"mappings":";AAEA;;;;GAIG;AACH,kEAsBC"}
|
|
@@ -1,19 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (attribution) {
|
|
13
|
-
copyrights = copyrights.concat(attribution.replace(/©/g, "\xA9").split(/(<a.*?<\/a>)/));
|
|
14
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var removeDuplicate_1 = require("./removeDuplicate");
|
|
4
|
+
/**
|
|
5
|
+
* Return the copyright a Mapbox map.
|
|
6
|
+
* @param {mapboxgl.Map} map A Mapbox map
|
|
7
|
+
* @ignore
|
|
8
|
+
*/
|
|
9
|
+
var getMapboxMapCopyrights = function (map) {
|
|
10
|
+
if (!map || !map.style) {
|
|
11
|
+
return [];
|
|
15
12
|
}
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
var sourceCaches = map.style.sourceCaches;
|
|
14
|
+
var copyrights = [];
|
|
15
|
+
Object.values(sourceCaches).forEach(function (sourceCache) {
|
|
16
|
+
if (sourceCache.used) {
|
|
17
|
+
var source = sourceCache.getSource();
|
|
18
|
+
var attribution = source.attribution || (source.options && source.options.attribution);
|
|
19
|
+
if (attribution) {
|
|
20
|
+
copyrights = copyrights.concat(attribution.replace(/©/g, '©').split(/(<a.*?<\/a>)/));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return (0, removeDuplicate_1.default)(copyrights);
|
|
18
25
|
};
|
|
19
|
-
|
|
26
|
+
exports.default = getMapboxMapCopyrights;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getMapboxRender.d.ts","sourceRoot":"","sources":["../../../src/common/utils/getMapboxRender.js"],"names":[],"mappings":"AAGA;;GAEG;AACH,mFA4EC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/* eslint-disable no-underscore-dangle */
|
|
4
|
+
var proj_1 = require("ol/proj");
|
|
5
|
+
/**
|
|
6
|
+
* Return the render function fo the olLayer of a MaplibreLayer
|
|
7
|
+
*/
|
|
8
|
+
function getMapboxRender(mapoxLayer) {
|
|
9
|
+
return function (frameState) {
|
|
10
|
+
var map = mapoxLayer.map, mbMap = mapoxLayer.mbMap, renderState = mapoxLayer.renderState, olLayer = mapoxLayer.olLayer;
|
|
11
|
+
if (!map || !mbMap) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
var changed = false;
|
|
15
|
+
var canvas = mbMap.getCanvas();
|
|
16
|
+
var viewState = frameState.viewState;
|
|
17
|
+
var visible = olLayer.getVisible();
|
|
18
|
+
if (renderState.visible !== visible) {
|
|
19
|
+
canvas.style.display = visible ? 'block' : 'none';
|
|
20
|
+
renderState.visible = visible;
|
|
21
|
+
// Needed since mapbox-gl 1.9.0.
|
|
22
|
+
// Without you don't see others ol layers on top.
|
|
23
|
+
canvas.style.position = 'absolute';
|
|
24
|
+
}
|
|
25
|
+
var opacity = olLayer.getOpacity();
|
|
26
|
+
if (renderState.opacity !== opacity) {
|
|
27
|
+
canvas.style.opacity = opacity;
|
|
28
|
+
renderState.opacity = opacity;
|
|
29
|
+
}
|
|
30
|
+
// adjust view parameters in mapbox
|
|
31
|
+
var rotation = viewState.rotation;
|
|
32
|
+
if (renderState.rotation !== rotation) {
|
|
33
|
+
mbMap.rotateTo((-(rotation || 0) * 180) / Math.PI, {
|
|
34
|
+
animate: false,
|
|
35
|
+
});
|
|
36
|
+
changed = true;
|
|
37
|
+
renderState.rotation = rotation;
|
|
38
|
+
}
|
|
39
|
+
if (renderState.zoom !== viewState.zoom ||
|
|
40
|
+
renderState.center[0] !== viewState.center[0] ||
|
|
41
|
+
renderState.center[1] !== viewState.center[1]) {
|
|
42
|
+
mbMap.jumpTo({
|
|
43
|
+
center: (0, proj_1.toLonLat)(viewState.center),
|
|
44
|
+
zoom: viewState.zoom - 1,
|
|
45
|
+
animate: false,
|
|
46
|
+
});
|
|
47
|
+
changed = true;
|
|
48
|
+
renderState.zoom = viewState.zoom;
|
|
49
|
+
renderState.center = viewState.center;
|
|
50
|
+
}
|
|
51
|
+
var size = map.getSize();
|
|
52
|
+
if (renderState.size[0] !== size[0] || renderState.size[1] !== size[1]) {
|
|
53
|
+
changed = true;
|
|
54
|
+
renderState.size = size;
|
|
55
|
+
}
|
|
56
|
+
// cancel the scheduled update & trigger synchronous redraw
|
|
57
|
+
// see https://github.com/mapbox/mapbox-gl-js/issues/7893#issue-408992184
|
|
58
|
+
// NOTE: THIS MIGHT BREAK WHEN UPDATING MAPBOX
|
|
59
|
+
if (mbMap && mbMap.style && mbMap.isStyleLoaded() && changed) {
|
|
60
|
+
try {
|
|
61
|
+
if (mbMap._frame) {
|
|
62
|
+
mbMap._frame.cancel();
|
|
63
|
+
mbMap._frame = null;
|
|
64
|
+
}
|
|
65
|
+
mbMap._render();
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
// ignore render errors because it's probably related to
|
|
69
|
+
// a render during an update of the style.
|
|
70
|
+
// eslint-disable-next-line no-console
|
|
71
|
+
console.warn(err);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return mbMap.getContainer();
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
exports.default = getMapboxRender;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getMaplibreRender.d.ts","sourceRoot":"","sources":["../../../src/common/utils/getMaplibreRender.js"],"names":[],"mappings":"AAGA;;GAEG;AACH,wFAoCC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var proj_1 = require("ol/proj");
|
|
4
|
+
var math_1 = require("ol/math");
|
|
5
|
+
/**
|
|
6
|
+
* Return the render function fo the olLayer of a MaplibreLayer
|
|
7
|
+
*/
|
|
8
|
+
function getMaplibreRender(maplibreLayer) {
|
|
9
|
+
return function (frameState) {
|
|
10
|
+
var map = maplibreLayer.map, mbMap = maplibreLayer.mbMap, olLayer = maplibreLayer.olLayer;
|
|
11
|
+
if (!map || !mbMap) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
var canvas = mbMap.getCanvas();
|
|
15
|
+
var viewState = frameState.viewState;
|
|
16
|
+
var opacity = olLayer.getOpacity();
|
|
17
|
+
canvas.style.opacity = opacity;
|
|
18
|
+
// adjust view parameters in mapbox
|
|
19
|
+
mbMap.jumpTo({
|
|
20
|
+
center: (0, proj_1.toLonLat)(viewState.center),
|
|
21
|
+
zoom: viewState.zoom - 1,
|
|
22
|
+
bearing: (0, math_1.toDegrees)(-viewState.rotation),
|
|
23
|
+
animate: false,
|
|
24
|
+
});
|
|
25
|
+
if (!canvas.isConnected) {
|
|
26
|
+
// The canvas is not connected to the DOM, request a map rendering at the next animation frame
|
|
27
|
+
// to set the canvas size.
|
|
28
|
+
map.render();
|
|
29
|
+
}
|
|
30
|
+
else if (canvas.width !== frameState.size[0] ||
|
|
31
|
+
canvas.height !== frameState.size[1]) {
|
|
32
|
+
mbMap.resize();
|
|
33
|
+
}
|
|
34
|
+
mbMap.redraw();
|
|
35
|
+
return mbMap.getContainer();
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
exports.default = getMaplibreRender;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export default getModeSuffix;
|
|
2
|
+
/**
|
|
3
|
+
* Get the websocket channel suffix, depending on the current mode.
|
|
4
|
+
* @param {String} mode Mode 'topographic' ou 'schematic'.
|
|
5
|
+
* @private
|
|
6
|
+
*/
|
|
7
|
+
declare function getModeSuffix(mode: string, modes: any): "" | "_schematic";
|
|
8
|
+
//# sourceMappingURL=getRealtimeModeSuffix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getRealtimeModeSuffix.d.ts","sourceRoot":"","sources":["../../../src/common/utils/getRealtimeModeSuffix.js"],"names":[],"mappings":";AAAA;;;;GAIG;AACH,4EAC8C"}
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* Get the websocket channel suffix, depending on the current mode.
|
|
5
|
+
* @param {String} mode Mode 'topographic' ou 'schematic'.
|
|
6
|
+
* @private
|
|
7
|
+
*/
|
|
8
|
+
var getModeSuffix = function (mode, modes) {
|
|
9
|
+
return mode === modes.SCHEMATIC ? '_schematic' : '';
|
|
10
|
+
};
|
|
11
|
+
exports.default = getModeSuffix;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export default getUrlWithParams;
|
|
2
|
+
/**
|
|
3
|
+
* Return the styleUrl with apiKey parameters set.
|
|
4
|
+
* @param {string} url a url.
|
|
5
|
+
* @param {Object<String,String>} params a list of key/value pair to add to the url.
|
|
6
|
+
* @ignore
|
|
7
|
+
*/
|
|
8
|
+
declare function getUrlWithParams(url: string, params: any): URL;
|
|
9
|
+
//# sourceMappingURL=getUrlWithParams.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getUrlWithParams.d.ts","sourceRoot":"","sources":["../../../src/common/utils/getUrlWithParams.js"],"names":[],"mappings":";AAAA;;;;;GAKG;AACH,uCAJW,MAAM,oBAgBhB"}
|