mobility-toolbox-js 3.0.1-beta.0 → 3.0.1-beta.2
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/README.md +11 -3
- package/api/HttpAPI.js +1 -3
- package/api/RealtimeAPI.d.ts +47 -47
- package/api/RealtimeAPI.js +74 -74
- package/api/WebSocketAPI.js +0 -1
- package/common/controls/StopFinderControlCommon.d.ts +1 -1
- package/common/controls/StopFinderControlCommon.js +1 -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/typedefs.d.ts +0 -117
- package/common/typedefs.js +0 -31
- package/common/utils/RealtimeEngine.d.ts +214 -0
- package/common/utils/RealtimeEngine.js +554 -0
- package/common/utils/getLayersAsFlatArray.d.ts +0 -1
- package/common/utils/getLayersAsFlatArray.js +0 -1
- package/common/utils/getVehiclePosition.js +1 -4
- package/common/utils/realtimeConfig.d.ts +1 -1
- package/common/utils/realtimeConfig.js +0 -1
- package/common/utils/renderTrajectories.d.ts +1 -0
- package/common/utils/renderTrajectories.js +1 -0
- package/common/utils/sortAndFilterDepartures.d.ts +1 -0
- package/common/utils/sortAndFilterDepartures.js +1 -0
- package/maplibre/controls/CopyrightControl.d.ts +9 -6
- package/maplibre/controls/CopyrightControl.js +11 -8
- package/maplibre/layers/Layer.d.ts +7 -6
- package/maplibre/layers/Layer.js +1 -2
- package/maplibre/layers/RealtimeLayer.d.ts +54 -111
- package/maplibre/layers/RealtimeLayer.js +126 -114
- package/maplibre/utils/getSourceCoordinates.d.ts +1 -0
- package/maplibre/utils/getSourceCoordinates.js +5 -4
- package/mbt.js +6960 -14605
- package/mbt.js.map +4 -4
- package/mbt.min.js +68 -71
- package/mbt.min.js.map +4 -4
- package/ol/controls/CopyrightControl.d.ts +13 -5
- package/ol/controls/CopyrightControl.js +13 -5
- package/ol/controls/RoutingControl.d.ts +29 -18
- package/ol/controls/RoutingControl.js +44 -56
- package/ol/controls/StopFinderControl.d.ts +21 -2
- package/ol/controls/StopFinderControl.js +22 -3
- package/ol/index.d.ts +0 -1
- package/ol/index.js +0 -1
- package/ol/layers/Layer.d.ts +17 -92
- package/ol/layers/Layer.js +17 -3
- package/ol/layers/MaplibreLayer.d.ts +47 -114
- package/ol/layers/MaplibreLayer.js +102 -46
- package/ol/layers/MaplibreStyleLayer.d.ts +67 -147
- package/ol/layers/MaplibreStyleLayer.js +170 -123
- package/ol/layers/RealtimeLayer.d.ts +85 -218
- package/ol/layers/RealtimeLayer.js +170 -181
- package/ol/layers/VectorLayer.d.ts +1 -2
- package/ol/layers/VectorLayer.js +7 -6
- package/ol/renderers/MaplibreLayerRenderer.d.ts +9 -0
- package/ol/renderers/MaplibreLayerRenderer.js +35 -137
- package/ol/renderers/MaplibreStyleLayerRenderer.js +2 -2
- package/ol/renderers/RealtimeLayerRenderer.d.ts +1 -1
- 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 +13 -10
- package/ol/utils/defineDeprecatedProperties.d.ts +10 -0
- package/ol/utils/defineDeprecatedProperties.js +180 -0
- package/package.json +40 -39
- package/setupTests.js +14 -0
- package/types/common.d.ts +4 -27
- package/types/realtime.d.ts +7 -2
- package/common/mixins/RealtimeLayerMixin.d.ts +0 -267
- package/common/mixins/RealtimeLayerMixin.js +0 -751
- package/ol/mixins/MobilityLayerMixin.d.ts +0 -96
- package/ol/mixins/MobilityLayerMixin.js +0 -6
- package/ol/mixins/PropertiesLayerMixin.d.ts +0 -136
- package/ol/mixins/PropertiesLayerMixin.js +0 -178
- package/ol/mixins/index.d.ts +0 -1
- package/ol/mixins/index.js +0 -2
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.1-beta.
|
|
5
|
+
"version": "3.0.1-beta.2",
|
|
6
6
|
"homepage": "https://mobility-toolbox-js.geops.io/",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./index.js",
|
|
@@ -12,34 +12,35 @@
|
|
|
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.2",
|
|
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
|
-
"uuid": "
|
|
20
|
+
"uuid": "11.0.3"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"maplibre-gl": ">=
|
|
24
|
-
"ol": ">=
|
|
23
|
+
"maplibre-gl": ">=4",
|
|
24
|
+
"ol": ">=9"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@babel/preset-env": "^7.
|
|
28
|
-
"@babel/preset-typescript": "^7.
|
|
29
|
-
"@commitlint/cli": "19.
|
|
30
|
-
"@commitlint/config-conventional": "19.
|
|
31
|
-
"@geops/eslint-config-react": "^1.
|
|
27
|
+
"@babel/preset-env": "^7.26.0",
|
|
28
|
+
"@babel/preset-typescript": "^7.26.0",
|
|
29
|
+
"@commitlint/cli": "19.6.0",
|
|
30
|
+
"@commitlint/config-conventional": "19.6.0",
|
|
31
|
+
"@geops/eslint-config-react": "^1.3.2",
|
|
32
32
|
"@types/geojson": "7946.0.14",
|
|
33
|
+
"@types/lodash": "^4.17.13",
|
|
33
34
|
"@types/lodash.debounce": "4.0.9",
|
|
34
35
|
"@types/lodash.throttle": "4.1.9",
|
|
35
|
-
"@types/mapbox-gl": "3.1
|
|
36
|
+
"@types/mapbox-gl": "3.4.1",
|
|
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.17.0",
|
|
41
|
+
"@typescript-eslint/parser": "8.17.0",
|
|
42
|
+
"cypress": "13.16.1",
|
|
43
|
+
"esbuild": "0.24.0",
|
|
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.31.0",
|
|
55
|
+
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
56
|
+
"eslint-plugin-prettier": "5.2.1",
|
|
57
|
+
"eslint-plugin-react": "7.37.2",
|
|
57
58
|
"fixpack": "4.0.0",
|
|
58
|
-
"husky": "9.
|
|
59
|
+
"husky": "9.1.7",
|
|
59
60
|
"is-ci": "3.0.1",
|
|
60
61
|
"jest": "29.7.0",
|
|
61
62
|
"jest-canvas-mock": "2.5.2",
|
|
@@ -64,23 +65,25 @@
|
|
|
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.1",
|
|
69
70
|
"mock-socket": "9.3.1",
|
|
70
|
-
"next": "
|
|
71
|
+
"next": "15.0.3",
|
|
71
72
|
"next-transpile-modules": "10.0.1",
|
|
72
|
-
"ol": "
|
|
73
|
+
"ol": "10.3.1",
|
|
73
74
|
"openapi-typescript": "6.7.5",
|
|
74
|
-
"prettier": "3.
|
|
75
|
+
"prettier": "3.4.2",
|
|
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.11.0",
|
|
81
|
+
"stylelint-config-recommended-scss": "14.1.0",
|
|
81
82
|
"stylelint-config-standard": "36.0.1",
|
|
82
|
-
"stylelint-scss": "6.
|
|
83
|
-
"
|
|
83
|
+
"stylelint-scss": "6.10.0",
|
|
84
|
+
"ts-jest": "^29.2.5",
|
|
85
|
+
"typescript": "5.7.2",
|
|
86
|
+
"vite": "^6.0.2"
|
|
84
87
|
},
|
|
85
88
|
"scripts": {
|
|
86
89
|
"apidoc": "esdoc && cp apidoc/index.json doc/src/components/Esdoc",
|
|
@@ -93,19 +96,17 @@
|
|
|
93
96
|
"cy:test:chrome": "yarn build && start-server-and-test start http://localhost:3000 'cypress run --browser chrome'",
|
|
94
97
|
"cy:test:edge": "yarn build && start-server-and-test start http://localhost:3000 'cypress run --browser edge'",
|
|
95
98
|
"cy:test:firefox": "yarn build && start-server-and-test start http://localhost:3000 'cypress run --browser firefox'",
|
|
96
|
-
"dev": "
|
|
97
|
-
"dev:examples": "yarn clean && yarn build && cd doc && rm -rf node_modules/mobility-toolbox-js && yarn install --force && yarn dev",
|
|
99
|
+
"dev": "vite",
|
|
98
100
|
"doc": "yarn build && yarn apidoc && cd doc && rm -rf node_modules/mobility-toolbox-js && yarn install --force && yarn build",
|
|
101
|
+
"doc:dev": "yarn clean && yarn build && yarn apidoc && yarn doc:dev:examples",
|
|
102
|
+
"doc:dev:examples": "yarn clean && yarn build && cd doc && rm -rf node_modules/mobility-toolbox-js && yarn install --force && yarn dev",
|
|
99
103
|
"esbuild": "yarn esbuild:all && yarn esbuild:iife",
|
|
100
104
|
"esbuild:all": "esbuild src/index.js src/**/*.js src/**/*.ts src/**/**/*.js src/**/**/*.ts --target=chrome100 --outdir=build/ --loader:.js=jsx",
|
|
101
105
|
"esbuild:iife": "yarn esbuild:iife:unminify && yarn esbuild:iife:minify",
|
|
102
106
|
"esbuild:iife:base": "esbuild src/iife.js --bundle --sourcemap --target=chrome100",
|
|
103
107
|
"esbuild:iife:minify": "yarn esbuild:iife:base --minify --outfile=build/mbt.min.js",
|
|
104
108
|
"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
|
-
"lib": "REACT_APP_LIB_MODE=1 webpack --mode production",
|
|
107
|
-
"lib:dev": "REACT_APP_LIB_MODE=1 webpack --mode development",
|
|
108
|
-
"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",
|
|
109
|
+
"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",
|
|
109
110
|
"lint": "eslint src/**/*.js src/**/*.ts && stylelint src/**/*.css src/**/*.scss --allow-empty-input",
|
|
110
111
|
"prepare": "is-ci || husky",
|
|
111
112
|
"publish:beta": "HUSKY=0 yarn release -- --prerelease beta --skip.changelog && yarn run build && cd build && HUSKY=0 yarn publish --tag beta && git push origin HEAD && git push --tags ",
|
package/setupTests.js
CHANGED
|
@@ -23,3 +23,17 @@ class ResizeObserver {
|
|
|
23
23
|
disconnect() { }
|
|
24
24
|
}
|
|
25
25
|
window.ResizeObserver = ResizeObserver;
|
|
26
|
+
window.noop = () => { };
|
|
27
|
+
class Worker {
|
|
28
|
+
constructor(stringUrl) {
|
|
29
|
+
this.url = stringUrl;
|
|
30
|
+
this.onmessage = noop;
|
|
31
|
+
}
|
|
32
|
+
postMessage(msg) {
|
|
33
|
+
this.onmessage(msg);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
Object.defineProperty(window, 'Worker', {
|
|
37
|
+
writable: true,
|
|
38
|
+
value: Worker,
|
|
39
|
+
});
|
package/types/common.d.ts
CHANGED
|
@@ -4,9 +4,6 @@ import { ObjectEvent } from 'ol/Object';
|
|
|
4
4
|
import { Pixel } from 'ol/pixel';
|
|
5
5
|
|
|
6
6
|
import { RealtimeTrajectory } from '../api/typedefs';
|
|
7
|
-
import CommonLayer, {
|
|
8
|
-
LayerCommonOptions,
|
|
9
|
-
} from '../ol/mixins/PropertiesLayerMixin';
|
|
10
7
|
|
|
11
8
|
import type {
|
|
12
9
|
CopyrightControl as MbCopyrightControl,
|
|
@@ -36,6 +33,7 @@ export interface ViewState {
|
|
|
36
33
|
size?: number[];
|
|
37
34
|
time?: number;
|
|
38
35
|
zoom?: number;
|
|
36
|
+
visible?:boolean;
|
|
39
37
|
}
|
|
40
38
|
|
|
41
39
|
export interface RealtimeStyleOptions {
|
|
@@ -85,12 +83,6 @@ export interface RealtimeRenderState {
|
|
|
85
83
|
zoom?: number;
|
|
86
84
|
}
|
|
87
85
|
|
|
88
|
-
export type AnyMap = MapboxMap | MaplibreMap | OlMap;
|
|
89
|
-
export type AnyLayer = MbLayer | OlLayer;
|
|
90
|
-
export type AnyOlLayer = OlLayer;
|
|
91
|
-
export type AnyMapboxLayer = MapboxLayer | MaplibreLayer;
|
|
92
|
-
export type AnyRealtimeLayer = MbRealtimeLayer | OlRealtimeLayer;
|
|
93
|
-
export type AnyCopyrightControl = MbCopyrightControl | OlCopyrightControl;
|
|
94
86
|
export type AnyMapGlMap = maplibregl.Map;
|
|
95
87
|
export type AnyMapGlMapOptions = maplibregl.MapOptions;
|
|
96
88
|
export type AnyCanvas = HTMLCanvasElement | OffscreenCanvas;
|
|
@@ -99,19 +91,10 @@ export type AnyCanvasContext =
|
|
|
99
91
|
| null
|
|
100
92
|
| OffscreenCanvasRenderingContext2D
|
|
101
93
|
| undefined;
|
|
102
|
-
export type GConstructor<T extends CommonLayer> = new (options?: any) => T;
|
|
103
|
-
export type CommonLayerClass = GConstructor<CommonLayer>;
|
|
104
|
-
export type GConstructor2<T extends OlLayer> = new (options?: any) => T;
|
|
105
|
-
export type OlLayerClass = GConstructor<AnyOlLayer>;
|
|
106
|
-
export type AnyLayerClass = GConstructor<AnyLayer>;
|
|
107
94
|
|
|
108
|
-
type
|
|
109
|
-
export type
|
|
95
|
+
export type AnyRealtimeLayer = MbRealtimeLayer | OlRealtimeLayer;
|
|
96
|
+
export type AnyCopyrightControl = MbCopyrightControl | OlCopyrightControl;
|
|
110
97
|
|
|
111
|
-
export type AnyMapboxLayerClass = GConstructor<AnyMapboxLayer>;
|
|
112
|
-
export type AnyRealtimeLayerClass = GConstructor<AnyRealtimeLayer>;
|
|
113
|
-
export type AnyMapGlMapClass = GConstructor<AnyMapGlMap>;
|
|
114
|
-
export type AnyCopyrightControlClass = GConstructor<AnyCopyrightControl>;
|
|
115
98
|
|
|
116
99
|
export interface LayerGetFeatureInfoResponse {
|
|
117
100
|
coordinate: Coordinate;
|
|
@@ -121,15 +104,9 @@ export interface LayerGetFeatureInfoResponse {
|
|
|
121
104
|
|
|
122
105
|
export interface LayerGetFeatureInfoOptions {
|
|
123
106
|
nb?: number;
|
|
124
|
-
|
|
107
|
+
hitTolerance: number = 5;
|
|
125
108
|
}
|
|
126
109
|
|
|
127
|
-
export type UserInteractionCallback = (
|
|
128
|
-
features: Feature[],
|
|
129
|
-
layer: LayerCommonOptions,
|
|
130
|
-
coordinate: Coordinate,
|
|
131
|
-
event: ObjectEvent,
|
|
132
|
-
) => void;
|
|
133
110
|
|
|
134
111
|
export type RoutingGraph = [RoutingParameters.graph, number, number];
|
|
135
112
|
export type RoutingMot = RoutingParameters.mot;
|
package/types/realtime.d.ts
CHANGED
|
@@ -74,7 +74,12 @@ export type RealtimeChannelName =
|
|
|
74
74
|
export interface RealtimeTrajectoryProperties {
|
|
75
75
|
// Tralis and trafimage
|
|
76
76
|
bounds: [number, number, number, number];
|
|
77
|
+
|
|
78
|
+
// Only after first rendering on a map
|
|
79
|
+
coordinate?: [number, number];
|
|
80
|
+
|
|
77
81
|
delay: null | number;
|
|
82
|
+
|
|
78
83
|
// Tralis
|
|
79
84
|
event?: string;
|
|
80
85
|
event_delay?: number;
|
|
@@ -139,7 +144,7 @@ export interface RealtimeStop {
|
|
|
139
144
|
aimedDepartureTime: number;
|
|
140
145
|
arrivalDelay?: number;
|
|
141
146
|
arrivalTime: number;
|
|
142
|
-
cancelled:
|
|
147
|
+
cancelled: boolean;
|
|
143
148
|
coordinate: number[];
|
|
144
149
|
departureDelay: number;
|
|
145
150
|
departureTime: number;
|
|
@@ -167,7 +172,7 @@ export interface RealtimeStopSequence {
|
|
|
167
172
|
routeIdentifier: string;
|
|
168
173
|
shortName: string;
|
|
169
174
|
stations: RealtimeStop[];
|
|
170
|
-
stroke?:
|
|
175
|
+
stroke?: RealtimeTenant;
|
|
171
176
|
text_color: string;
|
|
172
177
|
type: RealtimeMot;
|
|
173
178
|
vehicleType: number;
|
|
@@ -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;
|