mobility-toolbox-js 3.0.0-beta.32 → 3.0.0-beta.33
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/HttpAPI.js +1 -3
- package/api/RealtimeAPI.d.ts +3 -3
- package/api/WebSocketAPI.js +0 -1
- package/common/styles/realtimeDefaultStyle.js +0 -5
- package/common/styles/realtimeHeadingStyle.js +0 -5
- package/common/styles/realtimeSimpleStyle.d.ts +0 -1
- package/common/styles/realtimeSimpleStyle.js +0 -1
- package/common/utils/RealtimeEngine.d.ts +224 -0
- package/common/utils/RealtimeEngine.js +565 -0
- package/common/utils/getLayersAsFlatArray.d.ts +0 -1
- package/common/utils/getLayersAsFlatArray.js +0 -1
- package/common/utils/realtimeConfig.d.ts +1 -1
- package/common/utils/realtimeConfig.js +0 -1
- package/maplibre/layers/RealtimeLayer.d.ts +50 -109
- package/maplibre/layers/RealtimeLayer.js +108 -111
- package/mbt.js +5122 -13362
- package/mbt.js.map +4 -4
- package/mbt.min.js +67 -70
- package/mbt.min.js.map +4 -4
- package/ol/controls/RoutingControl.d.ts +5 -4
- package/ol/controls/RoutingControl.js +2 -29
- package/ol/controls/StopFinderControl.d.ts +2 -5
- package/ol/controls/StopFinderControl.js +0 -3
- package/ol/layers/MaplibreLayer.d.ts +18 -10
- package/ol/layers/MaplibreLayer.js +18 -10
- package/ol/layers/MaplibreStyleLayer.d.ts +39 -27
- package/ol/layers/MaplibreStyleLayer.js +33 -28
- package/ol/layers/RealtimeLayer.d.ts +72 -124
- package/ol/layers/RealtimeLayer.js +130 -168
- package/ol/mixins/PropertiesLayerMixin.d.ts +4 -6
- package/ol/mixins/PropertiesLayerMixin.js +0 -2
- package/ol/renderers/RealtimeLayerRenderer.js +6 -31
- package/ol/styles/fullTrajectoryDelayStyle.js +5 -7
- package/ol/styles/fullTrajectoryStyle.d.ts +1 -2
- package/ol/styles/fullTrajectoryStyle.js +5 -7
- package/ol/styles/routingStyle.d.ts +0 -1
- package/ol/styles/routingStyle.js +2 -7
- package/package.json +31 -30
- package/types/common.d.ts +2 -1
- package/common/mixins/RealtimeLayerMixin.d.ts +0 -267
- package/common/mixins/RealtimeLayerMixin.js +0 -751
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
import { Circle, Fill, Stroke } from 'ol/style';
|
|
2
2
|
import Style from 'ol/style/Style';
|
|
3
|
-
/** @private */
|
|
4
3
|
const circleStyle = new Circle({
|
|
5
|
-
radius: 6,
|
|
6
4
|
fill: new Fill({
|
|
7
5
|
color: [255, 0, 0, 1],
|
|
8
6
|
}),
|
|
7
|
+
radius: 6,
|
|
9
8
|
stroke: new Stroke({
|
|
10
9
|
color: [0, 0, 0, 1],
|
|
11
10
|
width: 1,
|
|
12
11
|
}),
|
|
13
12
|
});
|
|
14
|
-
/** @private */
|
|
15
13
|
const blackBorder = new Style({
|
|
16
14
|
stroke: new Stroke({
|
|
17
15
|
color: [0, 0, 0, 1],
|
|
18
16
|
width: 5,
|
|
19
17
|
}),
|
|
20
18
|
});
|
|
21
|
-
/** @private */
|
|
22
19
|
const redLine = new Style({
|
|
23
20
|
image: circleStyle,
|
|
24
21
|
stroke: new Stroke({
|
|
@@ -26,16 +23,14 @@ const redLine = new Style({
|
|
|
26
23
|
width: 3,
|
|
27
24
|
}),
|
|
28
25
|
});
|
|
29
|
-
/** @private */
|
|
30
26
|
const dashedRedLine = new Style({
|
|
31
27
|
image: circleStyle,
|
|
32
28
|
stroke: new Stroke({
|
|
33
29
|
color: [255, 0, 0, 1],
|
|
34
|
-
width: 3,
|
|
35
30
|
lineDash: [1, 10],
|
|
31
|
+
width: 3,
|
|
36
32
|
}),
|
|
37
33
|
});
|
|
38
|
-
/** @private */
|
|
39
34
|
const routingStyle = (feature, resolution) => {
|
|
40
35
|
const minResolution = feature.get('minResolution');
|
|
41
36
|
const maxResolution = feature.get('maxResolution');
|
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": "3.0.0-beta.
|
|
5
|
+
"version": "3.0.0-beta.33",
|
|
6
6
|
"homepage": "https://mobility-toolbox-js.geops.io/",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./index.js",
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"./types": "./types/index.d.ts"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@geoblocks/ol-maplibre-layer": "^1.0.
|
|
16
|
-
"@turf/helpers": "7.
|
|
17
|
-
"@turf/transform-rotate": "7.
|
|
15
|
+
"@geoblocks/ol-maplibre-layer": "^1.0.1",
|
|
16
|
+
"@turf/helpers": "7.1.0",
|
|
17
|
+
"@turf/transform-rotate": "7.1.0",
|
|
18
18
|
"lodash.debounce": "4.0.8",
|
|
19
19
|
"lodash.throttle": "4.1.1",
|
|
20
20
|
"uuid": "10.0.0"
|
|
@@ -24,22 +24,23 @@
|
|
|
24
24
|
"ol": ">=7"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@babel/preset-env": "^7.
|
|
27
|
+
"@babel/preset-env": "^7.25.4",
|
|
28
28
|
"@babel/preset-typescript": "^7.24.7",
|
|
29
|
-
"@commitlint/cli": "19.
|
|
30
|
-
"@commitlint/config-conventional": "19.
|
|
31
|
-
"@geops/eslint-config-react": "^1.
|
|
29
|
+
"@commitlint/cli": "19.5.0",
|
|
30
|
+
"@commitlint/config-conventional": "19.5.0",
|
|
31
|
+
"@geops/eslint-config-react": "^1.1.1",
|
|
32
32
|
"@types/geojson": "7946.0.14",
|
|
33
|
+
"@types/lodash": "^4.17.7",
|
|
33
34
|
"@types/lodash.debounce": "4.0.9",
|
|
34
35
|
"@types/lodash.throttle": "4.1.9",
|
|
35
|
-
"@types/mapbox-gl": "3.
|
|
36
|
+
"@types/mapbox-gl": "3.4.0",
|
|
36
37
|
"@types/offscreencanvas": "2019.7.3",
|
|
37
38
|
"@types/topojson": "3.2.6",
|
|
38
39
|
"@types/uuid": "10.0.0",
|
|
39
|
-
"@typescript-eslint/eslint-plugin": "
|
|
40
|
-
"@typescript-eslint/parser": "
|
|
41
|
-
"cypress": "13.
|
|
42
|
-
"esbuild": "0.
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "8.5.0",
|
|
41
|
+
"@typescript-eslint/parser": "8.5.0",
|
|
42
|
+
"cypress": "13.14.2",
|
|
43
|
+
"esbuild": "0.23.1",
|
|
43
44
|
"esdoc": "1.1.0",
|
|
44
45
|
"esdoc-ecmascript-proposal-plugin": "1.0.0",
|
|
45
46
|
"esdoc-publish-html-plugin": "1.1.2",
|
|
@@ -49,13 +50,13 @@
|
|
|
49
50
|
"eslint-config-airbnb": "19.0.4",
|
|
50
51
|
"eslint-config-airbnb-typescript": "18.0.0",
|
|
51
52
|
"eslint-config-prettier": "9.1.0",
|
|
52
|
-
"eslint-plugin-cypress": "3.
|
|
53
|
-
"eslint-plugin-import": "2.
|
|
54
|
-
"eslint-plugin-jsx-a11y": "6.
|
|
55
|
-
"eslint-plugin-prettier": "5.1
|
|
56
|
-
"eslint-plugin-react": "7.
|
|
53
|
+
"eslint-plugin-cypress": "3.5.0",
|
|
54
|
+
"eslint-plugin-import": "2.30.0",
|
|
55
|
+
"eslint-plugin-jsx-a11y": "6.10.0",
|
|
56
|
+
"eslint-plugin-prettier": "5.2.1",
|
|
57
|
+
"eslint-plugin-react": "7.36.1",
|
|
57
58
|
"fixpack": "4.0.0",
|
|
58
|
-
"husky": "9.
|
|
59
|
+
"husky": "9.1.6",
|
|
59
60
|
"is-ci": "3.0.1",
|
|
60
61
|
"jest": "29.7.0",
|
|
61
62
|
"jest-canvas-mock": "2.5.2",
|
|
@@ -64,23 +65,23 @@
|
|
|
64
65
|
"jest-serializer-html": "7.1.0",
|
|
65
66
|
"jest-transformer-svg": "2.0.2",
|
|
66
67
|
"jest-websocket-mock": "2.5.0",
|
|
67
|
-
"lint-staged": "15.2.
|
|
68
|
-
"maplibre-gl": "4.
|
|
68
|
+
"lint-staged": "15.2.10",
|
|
69
|
+
"maplibre-gl": "4.7.0",
|
|
69
70
|
"mock-socket": "9.3.1",
|
|
70
|
-
"next": "14.2.
|
|
71
|
+
"next": "14.2.11",
|
|
71
72
|
"next-transpile-modules": "10.0.1",
|
|
72
|
-
"ol": "
|
|
73
|
+
"ol": "10.1.0",
|
|
73
74
|
"openapi-typescript": "6.7.5",
|
|
74
|
-
"prettier": "3.3.
|
|
75
|
+
"prettier": "3.3.3",
|
|
75
76
|
"raw-loader": "4.0.2",
|
|
76
77
|
"sort-json": "2.0.1",
|
|
77
78
|
"standard-version": "9.5.0",
|
|
78
|
-
"start-server-and-test": "2.0.
|
|
79
|
-
"stylelint": "16.
|
|
80
|
-
"stylelint-config-recommended-scss": "14.
|
|
79
|
+
"start-server-and-test": "2.0.8",
|
|
80
|
+
"stylelint": "16.9.0",
|
|
81
|
+
"stylelint-config-recommended-scss": "14.1.0",
|
|
81
82
|
"stylelint-config-standard": "36.0.1",
|
|
82
|
-
"stylelint-scss": "6.
|
|
83
|
-
"typescript": "5.
|
|
83
|
+
"stylelint-scss": "6.6.0",
|
|
84
|
+
"typescript": "5.6.2"
|
|
84
85
|
},
|
|
85
86
|
"scripts": {
|
|
86
87
|
"apidoc": "esdoc && cp apidoc/index.json doc/src/components/Esdoc",
|
|
@@ -102,7 +103,7 @@
|
|
|
102
103
|
"esbuild:iife:base": "esbuild src/iife.js --bundle --sourcemap --target=chrome100",
|
|
103
104
|
"esbuild:iife:minify": "yarn esbuild:iife:base --minify --outfile=build/mbt.min.js",
|
|
104
105
|
"esbuild:iife:unminify": "yarn esbuild:iife:base --outfile=build/mbt.js",
|
|
105
|
-
"format": "prettier --write 'src/**/*.js' && eslint src/**/*.js src/**/*.ts --fix && stylelint 'src/**/*.css' 'src/**/*.scss' --fix --allow-empty-input",
|
|
106
|
+
"format": "prettier --write 'src/**/*.js' 'src/**/*.test.js' && eslint src/**/*.js src/**/*.test.js src/**/*.ts --fix && stylelint 'src/**/*.css' 'src/**/*.scss' --fix --allow-empty-input",
|
|
106
107
|
"lib": "REACT_APP_LIB_MODE=1 webpack --mode production",
|
|
107
108
|
"lib:dev": "REACT_APP_LIB_MODE=1 webpack --mode development",
|
|
108
109
|
"link2": "cmdToAdd=$(node ./scripts/read-pkg-json.js add) && $cmdToAdd && yarn build && cmdToRemove=$(node ./scripts/read-pkg-json.js remove) && $cmdToRemove && cd build && yarn link",
|
package/types/common.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ export interface ViewState {
|
|
|
36
36
|
size?: number[];
|
|
37
37
|
time?: number;
|
|
38
38
|
zoom?: number;
|
|
39
|
+
visible?:boolean;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
export interface RealtimeStyleOptions {
|
|
@@ -121,7 +122,7 @@ export interface LayerGetFeatureInfoResponse {
|
|
|
121
122
|
|
|
122
123
|
export interface LayerGetFeatureInfoOptions {
|
|
123
124
|
nb?: number;
|
|
124
|
-
|
|
125
|
+
hitTolerance: number = 5;
|
|
125
126
|
}
|
|
126
127
|
|
|
127
128
|
export type UserInteractionCallback = (
|
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
import { Coordinate } from 'ol/coordinate';
|
|
2
|
-
import { EventsKey } from 'ol/events';
|
|
3
|
-
import GeoJSON from 'ol/format/GeoJSON';
|
|
4
|
-
import { Options } from 'ol/layer/Layer';
|
|
5
|
-
import { RealtimeAPI } from '../../api';
|
|
6
|
-
import { WebSocketAPIMessageEventData } from '../../api/WebSocketAPI';
|
|
7
|
-
import { AnyCanvas, AnyLayer, AnyLayerable, AnyMap, AnyRealtimeLayer, LayerGetFeatureInfoOptions, LayerGetFeatureInfoResponse, RealtimeGeneralizationLevel, RealtimeMode, RealtimeMot, RealtimeRenderState, RealtimeStyleFunction, RealtimeStyleOptions, RealtimeTenant, RealtimeTrainId, RealtimeTrajectory, ViewState } from '../../types';
|
|
8
|
-
import { FilterFunction, SortFunction } from '../typedefs';
|
|
9
|
-
export type RealtimeLayerMixinOptions = {
|
|
10
|
-
api?: RealtimeAPI;
|
|
11
|
-
apiKey?: string;
|
|
12
|
-
bbox?: (number | string)[];
|
|
13
|
-
bboxParameters?: Record<string, boolean | boolean[] | number | number[] | string | string[]>;
|
|
14
|
-
buffer?: number[];
|
|
15
|
-
canvas?: HTMLCanvasElement;
|
|
16
|
-
debug?: boolean;
|
|
17
|
-
filter?: FilterFunction;
|
|
18
|
-
generalizationLevelByZoom?: RealtimeGeneralizationLevel[];
|
|
19
|
-
getGeneralizationLevelByZoom?: (zoom: number, generalizationLevelByZoom: RealtimeGeneralizationLevel[]) => RealtimeGeneralizationLevel;
|
|
20
|
-
getMotsByZoom?: (zoom: number, motsByZoom: RealtimeMot[][]) => RealtimeMot[];
|
|
21
|
-
getRenderTimeIntervalByZoom?: (zoom: number, renderTimeIntervalByZoom: number[]) => number;
|
|
22
|
-
hoverVehicleId?: RealtimeTrainId;
|
|
23
|
-
isUpdateBboxOnMoveEnd?: boolean;
|
|
24
|
-
live?: boolean;
|
|
25
|
-
minZoomInterpolation?: number;
|
|
26
|
-
mode?: RealtimeMode;
|
|
27
|
-
motsByZoom?: RealtimeMot[][];
|
|
28
|
-
onStart?: (realtimeLayer: AnyRealtimeLayer) => void;
|
|
29
|
-
onStop?: (realtimeLayer: AnyRealtimeLayer) => void;
|
|
30
|
-
pingIntervalMs?: number;
|
|
31
|
-
pixelRatio?: number;
|
|
32
|
-
prefix?: string;
|
|
33
|
-
renderTimeIntervalByZoom?: number[];
|
|
34
|
-
selectedVehicleId?: RealtimeTrainId;
|
|
35
|
-
sort?: SortFunction;
|
|
36
|
-
speed?: number;
|
|
37
|
-
style?: RealtimeStyleFunction;
|
|
38
|
-
styleOptions?: RealtimeStyleOptions;
|
|
39
|
-
tenant?: RealtimeTenant;
|
|
40
|
-
time?: number;
|
|
41
|
-
url?: string;
|
|
42
|
-
useDebounce?: boolean;
|
|
43
|
-
useRequestAnimationFrame?: boolean;
|
|
44
|
-
useThrottle?: boolean;
|
|
45
|
-
} & Options;
|
|
46
|
-
/**
|
|
47
|
-
* RealtimeLayerInterface.
|
|
48
|
-
* @private
|
|
49
|
-
*/
|
|
50
|
-
export declare class RealtimeLayerInterface {
|
|
51
|
-
/**
|
|
52
|
-
* Request the stopSequence and the fullTrajectory informations for a vehicle.
|
|
53
|
-
*
|
|
54
|
-
* @param {string} id The vehicle identifier (the train_id property).
|
|
55
|
-
* @param {RealtimeMode} mode The mode to request. If not defined, the layer´s mode propetrty will be used.
|
|
56
|
-
* @return {Promise<{stopSequence: RealtimeStopSequence, fullTrajectory: RealtimeFullTrajectory>} A promise that will be resolved with the trajectory informations.
|
|
57
|
-
*/
|
|
58
|
-
getTrajectoryInfos(id: string, mode: RealtimeMode): void;
|
|
59
|
-
/**
|
|
60
|
-
* Render the trajectories
|
|
61
|
-
*/
|
|
62
|
-
renderTrajectories(): void;
|
|
63
|
-
/**
|
|
64
|
-
* Set the Realtime api's bbox.
|
|
65
|
-
*
|
|
66
|
-
* @param {Array<number>} extent Extent to request, [minX, minY, maxX, maxY].
|
|
67
|
-
* @param {number} zoom Zoom level to request. Must be an integer.
|
|
68
|
-
*/
|
|
69
|
-
setBbox(extent: [number, number, number, number], zoom: number): void;
|
|
70
|
-
/**
|
|
71
|
-
* Start the clock.
|
|
72
|
-
*/
|
|
73
|
-
start(): void;
|
|
74
|
-
/**
|
|
75
|
-
* Stop the clock.
|
|
76
|
-
*/
|
|
77
|
-
stop(): void;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Mixin for RealtimeLayerInterface.
|
|
81
|
-
*
|
|
82
|
-
* @param {Class} Base A class to extend with {RealtimeLayerInterface} functionnalities.
|
|
83
|
-
* @return {Class} A class that implements {RealtimeLayerInterface} class and extends Base;
|
|
84
|
-
* @private
|
|
85
|
-
*/
|
|
86
|
-
declare function RealtimeLayerMixin<T extends AnyLayerable>(Base: T): {
|
|
87
|
-
new (options: RealtimeLayerMixinOptions): {
|
|
88
|
-
[x: string]: any;
|
|
89
|
-
[x: symbol]: any;
|
|
90
|
-
api: RealtimeAPI;
|
|
91
|
-
bboxParameters?: Record<string, boolean | boolean[] | number | number[] | string | string[]>;
|
|
92
|
-
canvas?: AnyCanvas;
|
|
93
|
-
debounceRenderTrajectories: (viewState: ViewState, noInterpolate?: boolean) => void;
|
|
94
|
-
debug: boolean;
|
|
95
|
-
filter?: FilterFunction;
|
|
96
|
-
format: GeoJSON;
|
|
97
|
-
generalizationLevel?: RealtimeGeneralizationLevel;
|
|
98
|
-
generalizationLevelByZoom: RealtimeGeneralizationLevel[];
|
|
99
|
-
getGeneralizationLevelByZoom: (zoom: number) => RealtimeGeneralizationLevel;
|
|
100
|
-
getMotsByZoom: (zoom: number) => RealtimeMot[];
|
|
101
|
-
getRenderTimeIntervalByZoom: (zoom: number) => number;
|
|
102
|
-
hoverVehicleId?: RealtimeTrainId;
|
|
103
|
-
isUpdateBboxOnMoveEnd: boolean;
|
|
104
|
-
live?: boolean;
|
|
105
|
-
minZoomInterpolation: number;
|
|
106
|
-
mode: RealtimeMode;
|
|
107
|
-
mots?: RealtimeMot[];
|
|
108
|
-
motsByZoom: RealtimeMot[][];
|
|
109
|
-
onStart?: (realtimeLayer: AnyLayer) => void;
|
|
110
|
-
onStop?: (realtimeLayer: AnyLayer) => void;
|
|
111
|
-
pixelRatio?: number;
|
|
112
|
-
renderState?: RealtimeRenderState;
|
|
113
|
-
renderTimeIntervalByZoom: number[];
|
|
114
|
-
requestId?: number;
|
|
115
|
-
selectedVehicle: RealtimeTrajectory;
|
|
116
|
-
selectedVehicleId?: RealtimeTrainId;
|
|
117
|
-
sort?: SortFunction;
|
|
118
|
-
speed?: number;
|
|
119
|
-
style?: RealtimeStyleFunction;
|
|
120
|
-
styleOptions?: RealtimeStyleOptions;
|
|
121
|
-
tenant: RealtimeTenant;
|
|
122
|
-
throttleRenderTrajectories: (viewState: ViewState, noInterpolate?: boolean) => void;
|
|
123
|
-
time?: Date;
|
|
124
|
-
trajectories?: Record<RealtimeTrainId, RealtimeTrajectory>;
|
|
125
|
-
updateTimeDelay?: number;
|
|
126
|
-
updateTimeInterval?: number;
|
|
127
|
-
useDebounce?: boolean;
|
|
128
|
-
useRequestAnimationFrame?: boolean;
|
|
129
|
-
useThrottle?: boolean;
|
|
130
|
-
visibilityRef: EventsKey;
|
|
131
|
-
/**
|
|
132
|
-
* Add a trajectory.
|
|
133
|
-
* @param {RealtimeTrajectory} trajectory The trajectory to add.
|
|
134
|
-
* @private
|
|
135
|
-
*/
|
|
136
|
-
addTrajectory(trajectory: RealtimeTrajectory): void;
|
|
137
|
-
attachToMap(map: AnyMap): void;
|
|
138
|
-
/**
|
|
139
|
-
* Define layer's properties.
|
|
140
|
-
*
|
|
141
|
-
* @private
|
|
142
|
-
*/
|
|
143
|
-
defineProperties(options: RealtimeLayerMixinOptions): void;
|
|
144
|
-
detachFromMap(): void;
|
|
145
|
-
/**
|
|
146
|
-
* Request feature information for a given coordinate.
|
|
147
|
-
*
|
|
148
|
-
* @param {ol/coordinate~Coordinate} coordinate Coordinate.
|
|
149
|
-
* @param {Object} options Options See child classes to see which options are supported.
|
|
150
|
-
* @param {number} [options.resolution=1] The resolution of the map.
|
|
151
|
-
* @param {number} [options.nb=Infinity] The max number of vehicles to return.
|
|
152
|
-
* @return {Promise<FeatureInfo>} Promise with features, layer and coordinate.
|
|
153
|
-
*/
|
|
154
|
-
getFeatureInfoAtCoordinate(coordinate: Coordinate, options: LayerGetFeatureInfoOptions): Promise<LayerGetFeatureInfoResponse>;
|
|
155
|
-
/**
|
|
156
|
-
* Get the duration before the next update depending on zoom level.
|
|
157
|
-
*
|
|
158
|
-
* @private
|
|
159
|
-
* @param {number} zoom
|
|
160
|
-
*/
|
|
161
|
-
getRefreshTimeInMs(zoom?: number | undefined): number;
|
|
162
|
-
/**
|
|
163
|
-
* Request the stopSequence and the fullTrajectory informations for a vehicle.
|
|
164
|
-
*
|
|
165
|
-
* @param {string} id The vehicle identifier (the train_id property).
|
|
166
|
-
* @return {Promise<{stopSequence: RealtimeStopSequence, fullTrajectory: RealtimeFullTrajectory>} A promise that will be resolved with the trajectory informations.
|
|
167
|
-
*/
|
|
168
|
-
getTrajectoryInfos(id: RealtimeTrainId): Promise<{
|
|
169
|
-
fullTrajectory: WebSocketAPIMessageEventData<import("../../types").RealtimeStopSequence[]> | WebSocketAPIMessageEventData<import("../../types").RealtimeFullTrajectory>;
|
|
170
|
-
stopSequence: WebSocketAPIMessageEventData<import("../../types").RealtimeStopSequence[]> | WebSocketAPIMessageEventData<import("../../types").RealtimeFullTrajectory>;
|
|
171
|
-
}>;
|
|
172
|
-
/**
|
|
173
|
-
* Get vehicle.
|
|
174
|
-
* @param {function} filterFc A function use to filter results.
|
|
175
|
-
* @return {Array<Object>} Array of vehicle.
|
|
176
|
-
*/
|
|
177
|
-
getVehicle(filterFc: FilterFunction): RealtimeTrajectory[];
|
|
178
|
-
highlightVehicle(id: RealtimeTrainId): void;
|
|
179
|
-
/**
|
|
180
|
-
* Callback on websocket's deleted_vehicles channel events.
|
|
181
|
-
* It removes the trajectory from the list.
|
|
182
|
-
*
|
|
183
|
-
* @private
|
|
184
|
-
* @override
|
|
185
|
-
*/
|
|
186
|
-
onDeleteTrajectoryMessage(data: WebSocketAPIMessageEventData<RealtimeTrainId>): void;
|
|
187
|
-
onDocumentVisibilityChange(): void;
|
|
188
|
-
/**
|
|
189
|
-
* Callback on websocket's trajectory channel events.
|
|
190
|
-
* It adds a trajectory to the list.
|
|
191
|
-
*
|
|
192
|
-
* @private
|
|
193
|
-
*/
|
|
194
|
-
onTrajectoryMessage(data: WebSocketAPIMessageEventData<RealtimeTrajectory>): void;
|
|
195
|
-
/**
|
|
196
|
-
* On zoomend we adjust the time interval of the update of vehicles positions.
|
|
197
|
-
*
|
|
198
|
-
* @param evt Event that triggered the function.
|
|
199
|
-
* @private
|
|
200
|
-
*/
|
|
201
|
-
onZoomEnd(): void;
|
|
202
|
-
/**
|
|
203
|
-
* Remove all trajectories that are in the past.
|
|
204
|
-
*/
|
|
205
|
-
purgeOutOfDateTrajectories(): void;
|
|
206
|
-
/**
|
|
207
|
-
* Determine if the trajectory is useless and should be removed from the list or not.
|
|
208
|
-
* By default, this function exclude vehicles:
|
|
209
|
-
* - that have their trajectory outside the current extent and
|
|
210
|
-
* - that aren't in the MOT list.
|
|
211
|
-
*
|
|
212
|
-
* @param {RealtimeTrajectory} trajectory
|
|
213
|
-
* @param {Array<number>} extent
|
|
214
|
-
* @param {number} zoom
|
|
215
|
-
* @return {boolean} if the trajectory must be displayed or not.
|
|
216
|
-
* @private
|
|
217
|
-
*/
|
|
218
|
-
purgeTrajectory(trajectory: RealtimeTrajectory, extent: [number, number, number, number], zoom: number): boolean;
|
|
219
|
-
removeTrajectory(trajectoryOrId: RealtimeTrainId | RealtimeTrajectory): void;
|
|
220
|
-
/**
|
|
221
|
-
* Render the trajectories requesting an animation frame and cancelling the previous one.
|
|
222
|
-
* This function must be overrided by children to provide the correct parameters.
|
|
223
|
-
*
|
|
224
|
-
* @param {object} viewState The view state of the map.
|
|
225
|
-
* @param {number[2]} viewState.center Center coordinate of the map in mercator coordinate.
|
|
226
|
-
* @param {number[4]} viewState.extent Extent of the map in mercator coordinates.
|
|
227
|
-
* @param {number[2]} viewState.size Size ([width, height]) of the canvas to render.
|
|
228
|
-
* @param {number} [viewState.rotation = 0] Rotation of the map to render.
|
|
229
|
-
* @param {number} viewState.resolution Resolution of the map to render.
|
|
230
|
-
* @param {boolean} noInterpolate If true trajectories are not interpolated but
|
|
231
|
-
* drawn at the last known coordinate. Use this for performance optimization
|
|
232
|
-
* during map navigation.
|
|
233
|
-
* @private
|
|
234
|
-
*/
|
|
235
|
-
renderTrajectories(viewState: undefined | ViewState, noInterpolate: boolean | undefined): void;
|
|
236
|
-
/**
|
|
237
|
-
* Launch renderTrajectories. it avoids duplicating code in renderTrajectories method.
|
|
238
|
-
*
|
|
239
|
-
* @param {object} viewState The view state of the map.
|
|
240
|
-
* @param {number[2]} viewState.center Center coordinate of the map in mercator coordinate.
|
|
241
|
-
* @param {number[4]} viewState.extent Extent of the map in mercator coordinates.
|
|
242
|
-
* @param {number[2]} viewState.size Size ([width, height]) of the canvas to render.
|
|
243
|
-
* @param {number} [viewState.rotation = 0] Rotation of the map to render.
|
|
244
|
-
* @param {number} viewState.resolution Resolution of the map to render.
|
|
245
|
-
* @param {boolean} noInterpolate If true trajectories are not interpolated but
|
|
246
|
-
* drawn at the last known coordinate. Use this for performance optimization
|
|
247
|
-
* during map navigation.
|
|
248
|
-
* @private
|
|
249
|
-
*/
|
|
250
|
-
renderTrajectoriesInternal(viewState: ViewState, noInterpolate?: boolean): boolean;
|
|
251
|
-
selectVehicle(id: RealtimeTrainId): void;
|
|
252
|
-
setBbox(extent: [number, number, number, number], zoom: number): void;
|
|
253
|
-
start(): void;
|
|
254
|
-
/**
|
|
255
|
-
* Start the clock.
|
|
256
|
-
* @private
|
|
257
|
-
*/
|
|
258
|
-
startUpdateTime(): void;
|
|
259
|
-
stop(): void;
|
|
260
|
-
/**
|
|
261
|
-
* Stop the clock.
|
|
262
|
-
* @private
|
|
263
|
-
*/
|
|
264
|
-
stopUpdateTime(): void;
|
|
265
|
-
};
|
|
266
|
-
} & T;
|
|
267
|
-
export default RealtimeLayerMixin;
|