mobility-toolbox-js 3.0.0-beta.9 → 3.0.0
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.d.ts +5 -16
- package/api/HttpAPI.js +1 -14
- package/api/RealtimeAPI.d.ts +188 -143
- package/api/RealtimeAPI.js +265 -206
- package/api/RoutingAPI.d.ts +21 -11
- package/api/RoutingAPI.js +17 -7
- package/api/StopsAPI.d.ts +20 -14
- package/api/StopsAPI.js +17 -11
- package/api/WebSocketAPI.d.ts +60 -66
- package/api/WebSocketAPI.js +164 -165
- package/api/index.js +1 -1
- package/api/typedefs.d.ts +0 -102
- package/api/typedefs.js +27 -42
- package/common/controls/StopFinderControlCommon.d.ts +13 -13
- package/common/controls/StopFinderControlCommon.js +32 -32
- package/common/index.d.ts +1 -1
- package/common/index.js +1 -1
- package/common/styles/realtimeDefaultStyle.js +6 -11
- package/common/styles/realtimeHeadingStyle.js +5 -10
- package/common/styles/realtimeSimpleStyle.d.ts +0 -1
- package/common/styles/realtimeSimpleStyle.js +0 -1
- package/common/typedefs.d.ts +11 -121
- package/common/typedefs.js +6 -31
- package/common/utils/RealtimeEngine.d.ts +214 -0
- package/common/utils/RealtimeEngine.js +554 -0
- package/common/utils/compareDepartures.d.ts +2 -2
- package/common/utils/compareDepartures.js +2 -2
- package/common/utils/debounceWebsocketMessages.d.ts +1 -1
- package/common/utils/getLayersAsFlatArray.d.ts +0 -1
- package/common/utils/getLayersAsFlatArray.js +0 -1
- package/common/utils/getMapGlCopyrights.d.ts +1 -1
- package/common/utils/getMapGlCopyrights.js +3 -3
- package/common/utils/getRealtimeModeSuffix.d.ts +1 -0
- package/common/utils/getRealtimeModeSuffix.js +1 -0
- package/common/utils/getVehiclePosition.d.ts +5 -4
- package/common/utils/getVehiclePosition.js +6 -3
- package/common/utils/realtimeConfig.d.ts +1 -1
- package/common/utils/realtimeConfig.js +0 -1
- package/common/utils/renderTrajectories.d.ts +2 -1
- package/common/utils/renderTrajectories.js +7 -6
- package/common/utils/sortAndFilterDepartures.d.ts +2 -1
- package/common/utils/sortAndFilterDepartures.js +2 -1
- package/common/utils/sortByDelay.d.ts +2 -2
- package/common/utils/sortByDelay.js +5 -1
- package/maplibre/controls/CopyrightControl.d.ts +9 -6
- package/maplibre/controls/CopyrightControl.js +11 -8
- package/maplibre/layers/Layer.d.ts +8 -7
- package/maplibre/layers/Layer.js +2 -3
- package/maplibre/layers/RealtimeLayer.d.ts +82 -118
- package/maplibre/layers/RealtimeLayer.js +154 -118
- package/maplibre/utils/getSourceCoordinates.d.ts +1 -0
- package/maplibre/utils/getSourceCoordinates.js +6 -5
- package/mbt.js +14611 -14591
- package/mbt.js.map +4 -4
- package/mbt.min.js +75 -75
- 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 +105 -101
- package/ol/controls/RoutingControl.js +250 -264
- package/ol/controls/StopFinderControl.d.ts +24 -5
- package/ol/controls/StopFinderControl.js +24 -5
- package/ol/layers/Layer.d.ts +26 -0
- package/ol/layers/Layer.js +39 -0
- package/ol/layers/MaplibreLayer.d.ts +56 -28
- package/ol/layers/MaplibreLayer.js +154 -31
- package/ol/layers/MaplibreStyleLayer.d.ts +71 -149
- package/ol/layers/MaplibreStyleLayer.js +281 -210
- package/ol/layers/RealtimeLayer.d.ts +95 -230
- package/ol/layers/RealtimeLayer.js +209 -211
- package/ol/layers/VectorLayer.d.ts +17 -0
- package/ol/layers/VectorLayer.js +33 -0
- package/ol/layers/index.d.ts +2 -0
- package/ol/layers/index.js +3 -0
- package/ol/renderers/MaplibreLayerRenderer.d.ts +0 -20
- package/ol/renderers/MaplibreLayerRenderer.js +142 -114
- package/ol/renderers/MaplibreStyleLayerRenderer.d.ts +6 -6
- package/ol/renderers/MaplibreStyleLayerRenderer.js +20 -23
- package/ol/renderers/RealtimeLayerRenderer.d.ts +7 -7
- package/ol/renderers/RealtimeLayerRenderer.js +46 -66
- 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/ol/utils/getFeatureInfoAtCoordinate.d.ts +1 -1
- package/ol/utils/getFeatureInfoAtCoordinate.js +11 -17
- package/package.json +44 -44
- package/setupTests.js +17 -4
- package/types/common.d.ts +53 -69
- package/types/index.d.ts +1 -1
- package/types/realtime.d.ts +98 -95
- package/types/routing.d.ts +60 -60
- package/types/stops.d.ts +62 -62
- package/common/mixins/RealtimeLayerMixin.d.ts +0 -273
- package/common/mixins/RealtimeLayerMixin.js +0 -743
- package/ol/layers/MapGlLayer.d.ts +0 -144
- package/ol/layers/MapGlLayer.js +0 -144
- package/ol/mixins/MobilityLayerMixin.d.ts +0 -98
- package/ol/mixins/MobilityLayerMixin.js +0 -6
- package/ol/mixins/PropertiesLayerMixin.d.ts +0 -127
- package/ol/mixins/PropertiesLayerMixin.js +0 -143
package/types/routing.d.ts
CHANGED
|
@@ -9,6 +9,58 @@ export interface Paths {
|
|
|
9
9
|
get: {
|
|
10
10
|
parameters: {
|
|
11
11
|
query: {
|
|
12
|
+
/**
|
|
13
|
+
* Whether to use beelines (line strings with 2 points) between
|
|
14
|
+
* mutually unreachable hops as a fallback for "Route not found"
|
|
15
|
+
* errors. "true", "on", "yes", "y", "1" will enable the
|
|
16
|
+
* fallback. Default: enabled
|
|
17
|
+
*/
|
|
18
|
+
'beeline-fallback'?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Distance punishment factor for edge snapping of coordinates (see
|
|
21
|
+
* "Note on coordinates" at the top). Large: prefer close edge. Small:
|
|
22
|
+
* prefer short total route. Negative value: like worst edge
|
|
23
|
+
* category. Default: -1.0
|
|
24
|
+
*/
|
|
25
|
+
'coord-punish'?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Search radius for candidate edges during snapping of coordinates
|
|
28
|
+
* (see "Note on coordinates" at the top) Default: -1.0
|
|
29
|
+
*/
|
|
30
|
+
'coord-radius'?: number;
|
|
31
|
+
/** Only for mot=rail. Default is a detailed network based on OpenStreetMap. gen1 to gen4 provide rail networks with increasing levels of generalization */
|
|
32
|
+
graph?: 'gen1' | 'gen2' | 'gen3' | 'gen4';
|
|
33
|
+
/**
|
|
34
|
+
* Whether to include intermediate hops (stations/stops) found on the
|
|
35
|
+
* route to the response. "true", "on", "yes", "y", "1" will enable
|
|
36
|
+
* intermediate hops. Default: disabled
|
|
37
|
+
*/
|
|
38
|
+
hops?: string;
|
|
39
|
+
/** A line name that should be preferred */
|
|
40
|
+
line?: string;
|
|
41
|
+
/** Name of origin of the preferred line */
|
|
42
|
+
'line-from'?: string;
|
|
43
|
+
/** Name of destination of the preferred line */
|
|
44
|
+
'line-to'?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Maximum allowed ratio of hops to skip if not found. Only non-start
|
|
47
|
+
* and non-end hops are counted in ratio numerator and denominator.
|
|
48
|
+
*/
|
|
49
|
+
'max-skip-hop-ratio'?: number;
|
|
50
|
+
/** Mode of transport */
|
|
51
|
+
mot:
|
|
52
|
+
| 'bus'
|
|
53
|
+
| 'car'
|
|
54
|
+
| 'coach'
|
|
55
|
+
| 'ferry'
|
|
56
|
+
| 'foot'
|
|
57
|
+
| 'funicular'
|
|
58
|
+
| 'gondola'
|
|
59
|
+
| 'rail'
|
|
60
|
+
| 'subway'
|
|
61
|
+
| 'tram';
|
|
62
|
+
/** Douglas-Peucker distance parameter for simplification. Default 0.5 in Mercator units */
|
|
63
|
+
simplify?: number;
|
|
12
64
|
/**
|
|
13
65
|
* A pipe separated list of hops. A hop describes a station with either
|
|
14
66
|
* - a name or abbreviation
|
|
@@ -52,58 +104,6 @@ export interface Paths {
|
|
|
52
104
|
* - `freiburg|basel%20sbb|bern` - from Freiburg (Breisgau) Hbf via Basel SBB to Bern
|
|
53
105
|
*/
|
|
54
106
|
via: string;
|
|
55
|
-
/** Mode of transport */
|
|
56
|
-
mot:
|
|
57
|
-
| 'rail'
|
|
58
|
-
| 'bus'
|
|
59
|
-
| 'coach'
|
|
60
|
-
| 'foot'
|
|
61
|
-
| 'tram'
|
|
62
|
-
| 'subway'
|
|
63
|
-
| 'gondola'
|
|
64
|
-
| 'funicular'
|
|
65
|
-
| 'ferry'
|
|
66
|
-
| 'car';
|
|
67
|
-
/** Only for mot=rail. Default is a detailed network based on OpenStreetMap. gen1 to gen4 provide rail networks with increasing levels of generalization */
|
|
68
|
-
graph?: 'gen1' | 'gen2' | 'gen3' | 'gen4';
|
|
69
|
-
/** A line name that should be preferred */
|
|
70
|
-
line?: string;
|
|
71
|
-
/** Name of origin of the preferred line */
|
|
72
|
-
'line-from'?: string;
|
|
73
|
-
/** Name of destination of the preferred line */
|
|
74
|
-
'line-to'?: string;
|
|
75
|
-
/** Douglas-Peucker distance parameter for simplification. Default 0.5 in Mercator units */
|
|
76
|
-
simplify?: number;
|
|
77
|
-
/**
|
|
78
|
-
* Maximum allowed ratio of hops to skip if not found. Only non-start
|
|
79
|
-
* and non-end hops are counted in ratio numerator and denominator.
|
|
80
|
-
*/
|
|
81
|
-
'max-skip-hop-ratio'?: number;
|
|
82
|
-
/**
|
|
83
|
-
* Whether to include intermediate hops (stations/stops) found on the
|
|
84
|
-
* route to the response. "true", "on", "yes", "y", "1" will enable
|
|
85
|
-
* intermediate hops. Default: disabled
|
|
86
|
-
*/
|
|
87
|
-
hops?: string;
|
|
88
|
-
/**
|
|
89
|
-
* Whether to use beelines (line strings with 2 points) between
|
|
90
|
-
* mutually unreachable hops as a fallback for "Route not found"
|
|
91
|
-
* errors. "true", "on", "yes", "y", "1" will enable the
|
|
92
|
-
* fallback. Default: enabled
|
|
93
|
-
*/
|
|
94
|
-
'beeline-fallback'?: string;
|
|
95
|
-
/**
|
|
96
|
-
* Search radius for candidate edges during snapping of coordinates
|
|
97
|
-
* (see "Note on coordinates" at the top) Default: -1.0
|
|
98
|
-
*/
|
|
99
|
-
'coord-radius'?: number;
|
|
100
|
-
/**
|
|
101
|
-
* Distance punishment factor for edge snapping of coordinates (see
|
|
102
|
-
* "Note on coordinates" at the top). Large: prefer close edge. Small:
|
|
103
|
-
* prefer short total route. Negative value: like worst edge
|
|
104
|
-
* category. Default: -1.0
|
|
105
|
-
*/
|
|
106
|
-
'coord-punish'?: number;
|
|
107
107
|
/**
|
|
108
108
|
* Whether to output OSM way ids in Feature properties.
|
|
109
109
|
* "true", "on", "yes", "y", "1" will enable output. Default: disabled
|
|
@@ -147,14 +147,14 @@ export interface Paths {
|
|
|
147
147
|
* @example
|
|
148
148
|
*/
|
|
149
149
|
id?: string;
|
|
150
|
-
/** @example Freiburg Littenweiler */
|
|
151
|
-
name?: string;
|
|
152
|
-
/** @example 1 */
|
|
153
|
-
platform?: string;
|
|
154
150
|
/** @description Latitude of the stop, in WGS84 */
|
|
155
151
|
latitude?: number;
|
|
156
152
|
/** @description Latitude of the stop, in WGS84 */
|
|
157
153
|
longitude?: number;
|
|
154
|
+
/** @example Freiburg Littenweiler */
|
|
155
|
+
name?: string;
|
|
156
|
+
/** @example 1 */
|
|
157
|
+
platform?: string;
|
|
158
158
|
};
|
|
159
159
|
station_to?: {
|
|
160
160
|
/**
|
|
@@ -162,14 +162,14 @@ export interface Paths {
|
|
|
162
162
|
* @example 8004158
|
|
163
163
|
*/
|
|
164
164
|
id?: string;
|
|
165
|
-
/** @example Muenchen Pasing */
|
|
166
|
-
name?: string;
|
|
167
|
-
/** @example 4 */
|
|
168
|
-
platform?: string;
|
|
169
165
|
/** @description Latitude of the stop, in WGS84 */
|
|
170
166
|
latitude?: number;
|
|
171
167
|
/** @description Latitude of the stop, in WGS84 */
|
|
172
168
|
longitude?: number;
|
|
169
|
+
/** @example Muenchen Pasing */
|
|
170
|
+
name?: string;
|
|
171
|
+
/** @example 4 */
|
|
172
|
+
platform?: string;
|
|
173
173
|
};
|
|
174
174
|
/** @enum {string} */
|
|
175
175
|
type?: 'Feature';
|
package/types/stops.d.ts
CHANGED
|
@@ -9,35 +9,35 @@ export interface Paths {
|
|
|
9
9
|
get: {
|
|
10
10
|
parameters: {
|
|
11
11
|
query: {
|
|
12
|
-
/** Control how many matches will be returned */
|
|
13
|
-
limit?: number;
|
|
14
|
-
/** Anything you'd like to search for */
|
|
15
|
-
q: string;
|
|
16
12
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
13
|
+
* left,bottom,right,up coordinates in WGS84 wherein the
|
|
14
|
+
* station should lie
|
|
19
15
|
*/
|
|
20
|
-
|
|
16
|
+
bbox?: string;
|
|
17
|
+
/** which field to look up, default: all of them */
|
|
18
|
+
field?: 'coords' | 'id' | 'name';
|
|
19
|
+
/** Control how many matches will be returned */
|
|
20
|
+
limit?: number;
|
|
21
21
|
/**
|
|
22
22
|
* comma seperated list of mot's which should be available
|
|
23
23
|
* at the stop
|
|
24
24
|
*/
|
|
25
25
|
mots?:
|
|
26
26
|
| 'bus'
|
|
27
|
+
| 'cable_car'
|
|
27
28
|
| 'ferry'
|
|
29
|
+
| 'funicular'
|
|
28
30
|
| 'gondola'
|
|
29
|
-
| 'tram'
|
|
30
31
|
| 'rail'
|
|
31
|
-
| '
|
|
32
|
-
| '
|
|
33
|
-
| 'subway';
|
|
32
|
+
| 'subway'
|
|
33
|
+
| 'tram';
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
35
|
+
* comma seperated list, order chooses which agency will be preferred
|
|
36
|
+
* as ident_source (for id and code fields)
|
|
37
37
|
*/
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
|
|
38
|
+
prefagencies?: 'db' | 'sbb';
|
|
39
|
+
/** Anything you'd like to search for */
|
|
40
|
+
q: string;
|
|
41
41
|
/**
|
|
42
42
|
* Coordinates in WGS84 (in lat,lon order) used to rank stops close to
|
|
43
43
|
* this position higher
|
|
@@ -49,81 +49,81 @@ export interface Paths {
|
|
|
49
49
|
/** stop(s) */
|
|
50
50
|
200: {
|
|
51
51
|
schema: {
|
|
52
|
-
/** @enum {string} */
|
|
53
|
-
type?: 'FeatureCollection';
|
|
54
52
|
features?: {
|
|
55
|
-
/** @
|
|
56
|
-
|
|
53
|
+
/** @description the coordinates of the stop */
|
|
54
|
+
geometry?: {
|
|
55
|
+
/**
|
|
56
|
+
* @example [
|
|
57
|
+
* 7.439119,
|
|
58
|
+
* 46.94882
|
|
59
|
+
* ]
|
|
60
|
+
*/
|
|
61
|
+
coordinates?: number[];
|
|
62
|
+
/** @enum {string} */
|
|
63
|
+
type?: 'Point';
|
|
64
|
+
};
|
|
57
65
|
properties?: {
|
|
58
|
-
/** @description internal ID */
|
|
59
|
-
uid?: string;
|
|
60
66
|
/**
|
|
61
|
-
* @description
|
|
62
|
-
*
|
|
67
|
+
* @description Abbreviation code from the transport agency (e.g. DS100 for Deutsche Bahn)
|
|
68
|
+
*
|
|
69
|
+
* @example BN
|
|
63
70
|
*/
|
|
64
|
-
|
|
71
|
+
code?: string;
|
|
65
72
|
/**
|
|
66
73
|
* @description 2 letter country code where the station is located
|
|
67
74
|
* @example CH
|
|
68
75
|
*/
|
|
69
76
|
country_code?: string;
|
|
70
77
|
/**
|
|
71
|
-
* @description
|
|
72
|
-
*
|
|
78
|
+
* @description uic number
|
|
79
|
+
* @example 8507000
|
|
73
80
|
*/
|
|
74
|
-
|
|
81
|
+
id?: string;
|
|
75
82
|
/**
|
|
76
|
-
* @description
|
|
77
|
-
* @
|
|
83
|
+
* @description source agency for id and code (see below)
|
|
84
|
+
* @example sbb
|
|
78
85
|
*/
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
language?: 'de' | 'en' | 'fr' | 'it';
|
|
83
|
-
}[];
|
|
86
|
+
ident_source?: string;
|
|
87
|
+
/** @description ifopt identifier, if available */
|
|
88
|
+
ifopt?: string;
|
|
84
89
|
/** @description Means of transport that are available at this station */
|
|
85
90
|
mot?: {
|
|
86
91
|
bus?: boolean;
|
|
92
|
+
cable_car?: boolean;
|
|
87
93
|
ferry?: boolean;
|
|
94
|
+
funicular?: boolean;
|
|
88
95
|
gondola?: boolean;
|
|
89
|
-
tram?: boolean;
|
|
90
96
|
rail?: boolean;
|
|
91
|
-
funicular?: boolean;
|
|
92
|
-
cable_car?: boolean;
|
|
93
97
|
subway?: boolean;
|
|
98
|
+
tram?: boolean;
|
|
94
99
|
};
|
|
95
100
|
/**
|
|
96
|
-
* @description
|
|
97
|
-
* @example
|
|
98
|
-
*/
|
|
99
|
-
ident_source?: string;
|
|
100
|
-
/**
|
|
101
|
-
* @description uic number
|
|
102
|
-
* @example 8507000
|
|
101
|
+
* @description name of the stop
|
|
102
|
+
* @example Bern
|
|
103
103
|
*/
|
|
104
|
-
|
|
104
|
+
name?: string;
|
|
105
105
|
/**
|
|
106
|
-
* @description
|
|
107
|
-
*
|
|
108
|
-
* @example BN
|
|
106
|
+
* @description how well the result matches your query, 0
|
|
107
|
+
* means best
|
|
109
108
|
*/
|
|
110
|
-
|
|
111
|
-
/** @description ifopt identifier, if available */
|
|
112
|
-
ifopt?: string;
|
|
113
|
-
};
|
|
114
|
-
/** @description the coordinates of the stop */
|
|
115
|
-
geometry?: {
|
|
116
|
-
/** @enum {string} */
|
|
117
|
-
type?: 'Point';
|
|
109
|
+
rank?: number;
|
|
118
110
|
/**
|
|
119
|
-
* @
|
|
120
|
-
*
|
|
121
|
-
* 46.94882
|
|
122
|
-
* ]
|
|
111
|
+
* @description array of translations of the stopname
|
|
112
|
+
* @default []
|
|
123
113
|
*/
|
|
124
|
-
|
|
114
|
+
translated_names?: {
|
|
115
|
+
/** @enum {string} */
|
|
116
|
+
language?: 'de' | 'en' | 'fr' | 'it';
|
|
117
|
+
value?: string;
|
|
118
|
+
}[];
|
|
119
|
+
/** @description internal ID */
|
|
120
|
+
uid?: string;
|
|
125
121
|
};
|
|
122
|
+
/** @enum {string} */
|
|
123
|
+
type?: 'Feature';
|
|
126
124
|
}[];
|
|
125
|
+
/** @enum {string} */
|
|
126
|
+
type?: 'FeatureCollection';
|
|
127
127
|
};
|
|
128
128
|
};
|
|
129
129
|
/** limit parameter too high */
|
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
import GeoJSON from 'ol/format/GeoJSON';
|
|
2
|
-
import { EventsKey } from 'ol/events';
|
|
3
|
-
import { Coordinate } from 'ol/coordinate';
|
|
4
|
-
import { Options } from 'ol/layer/Layer';
|
|
5
|
-
import { RealtimeAPI } from '../../api';
|
|
6
|
-
import { AnyCanvas, AnyLayerClass, AnyMap, AnyRealtimeLayer, LayerGetFeatureInfoOptions, RealtimeGeneralizationLevel, RealtimeMode, RealtimeMot, RealtimeRenderState, RealtimeStyleFunction, RealtimeStyleOptions, RealtimeTenant, RealtimeTrainId, ViewState, AnyLayer, LayerGetFeatureInfoResponse } from '../../types';
|
|
7
|
-
import { RealtimeTrajectory } from '../../api/typedefs';
|
|
8
|
-
import { WebSocketAPIMessageEventData } from '../../api/WebSocketAPI';
|
|
9
|
-
import { FilterFunction, SortFunction } from '../typedefs';
|
|
10
|
-
export type RealtimeLayerMixinOptions = Options & {
|
|
11
|
-
debug?: boolean;
|
|
12
|
-
mode?: RealtimeMode;
|
|
13
|
-
api?: RealtimeAPI;
|
|
14
|
-
tenant?: RealtimeTenant;
|
|
15
|
-
minZoomInterpolation?: number;
|
|
16
|
-
isUpdateBboxOnMoveEnd?: boolean;
|
|
17
|
-
motsByZoom?: RealtimeMot[][];
|
|
18
|
-
generalizationLevelByZoom?: RealtimeGeneralizationLevel[];
|
|
19
|
-
renderTimeIntervalByZoom?: number[];
|
|
20
|
-
style?: RealtimeStyleFunction;
|
|
21
|
-
speed?: number;
|
|
22
|
-
pixelRatio?: number;
|
|
23
|
-
hoverVehicleId?: RealtimeTrainId;
|
|
24
|
-
selectedVehicleId?: RealtimeTrainId;
|
|
25
|
-
filter?: FilterFunction;
|
|
26
|
-
sort?: SortFunction;
|
|
27
|
-
time?: number;
|
|
28
|
-
live?: boolean;
|
|
29
|
-
canvas?: HTMLCanvasElement;
|
|
30
|
-
styleOptions?: RealtimeStyleOptions;
|
|
31
|
-
useRequestAnimationFrame?: boolean;
|
|
32
|
-
useDebounce?: boolean;
|
|
33
|
-
useThrottle?: boolean;
|
|
34
|
-
getMotsByZoom?: (zoom: number, motsByZoom: RealtimeMot[][]) => RealtimeMot[];
|
|
35
|
-
getGeneralizationLevelByZoom?: (zoom: number, generalizationLevelByZoom: RealtimeGeneralizationLevel[]) => RealtimeGeneralizationLevel;
|
|
36
|
-
getRenderTimeIntervalByZoom?: (zoom: number, renderTimeIntervalByZoom: number[]) => number;
|
|
37
|
-
onStart?: (realtimeLayer: AnyRealtimeLayer) => void;
|
|
38
|
-
onStop?: (realtimeLayer: AnyRealtimeLayer) => void;
|
|
39
|
-
url?: string;
|
|
40
|
-
apiKey?: string;
|
|
41
|
-
prefix?: string;
|
|
42
|
-
bbox?: (number | string)[];
|
|
43
|
-
buffer?: number[];
|
|
44
|
-
pingIntervalMs?: number;
|
|
45
|
-
bboxParameters?: {
|
|
46
|
-
[index: string]: string | number | boolean | string[] | boolean[] | number[];
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* RealtimeLayerInterface.
|
|
51
|
-
* @private
|
|
52
|
-
*/
|
|
53
|
-
export declare class RealtimeLayerInterface {
|
|
54
|
-
/**
|
|
55
|
-
* Start the clock.
|
|
56
|
-
*/
|
|
57
|
-
start(): void;
|
|
58
|
-
/**
|
|
59
|
-
* Stop the clock.
|
|
60
|
-
*/
|
|
61
|
-
stop(): void;
|
|
62
|
-
/**
|
|
63
|
-
* Set the Realtime api's bbox.
|
|
64
|
-
*
|
|
65
|
-
* @param {Array<number>} extent Extent to request, [minX, minY, maxX, maxY].
|
|
66
|
-
* @param {number} zoom Zoom level to request. Must be an integer.
|
|
67
|
-
*/
|
|
68
|
-
setBbox(extent: [number, number, number, number], zoom: number): void;
|
|
69
|
-
/**
|
|
70
|
-
* Render the trajectories
|
|
71
|
-
*/
|
|
72
|
-
renderTrajectories(): void;
|
|
73
|
-
/**
|
|
74
|
-
* Request the stopSequence and the fullTrajectory informations for a vehicle.
|
|
75
|
-
*
|
|
76
|
-
* @param {string} id The vehicle identifier (the train_id property).
|
|
77
|
-
* @param {RealtimeMode} mode The mode to request. If not defined, the layer´s mode propetrty will be used.
|
|
78
|
-
* @return {Promise<{stopSequence: StopSequence, fullTrajectory: FullTrajectory>} A promise that will be resolved with the trajectory informations.
|
|
79
|
-
*/
|
|
80
|
-
getTrajectoryInfos(id: string, mode: RealtimeMode): void;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Mixin for RealtimeLayerInterface.
|
|
84
|
-
*
|
|
85
|
-
* @param {Class} Base A class to extend with {RealtimeLayerInterface} functionnalities.
|
|
86
|
-
* @return {Class} A class that implements {RealtimeLayerInterface} class and extends Base;
|
|
87
|
-
* @private
|
|
88
|
-
*/
|
|
89
|
-
declare function RealtimeLayerMixin<T extends AnyLayerClass>(Base: T): {
|
|
90
|
-
new (options: RealtimeLayerMixinOptions): {
|
|
91
|
-
[x: string]: any;
|
|
92
|
-
debug: boolean;
|
|
93
|
-
trajectories?: {
|
|
94
|
-
[key: string]: GeoJSONFeature;
|
|
95
|
-
} | undefined;
|
|
96
|
-
canvas?: AnyCanvas | undefined;
|
|
97
|
-
mode: RealtimeMode;
|
|
98
|
-
api: RealtimeAPI;
|
|
99
|
-
tenant: RealtimeTenant;
|
|
100
|
-
bboxParameters?: {
|
|
101
|
-
[index: string]: string | number | boolean | string[] | number[] | boolean[];
|
|
102
|
-
} | undefined;
|
|
103
|
-
time?: Date | undefined;
|
|
104
|
-
live?: boolean | undefined;
|
|
105
|
-
speed?: number | undefined;
|
|
106
|
-
filter?: Function | undefined;
|
|
107
|
-
sort?: Function | undefined;
|
|
108
|
-
style?: RealtimeStyleFunction | undefined;
|
|
109
|
-
styleOptions?: RealtimeStyleOptions | undefined;
|
|
110
|
-
pixelRatio?: number | undefined;
|
|
111
|
-
minZoomInterpolation: number;
|
|
112
|
-
isUpdateBboxOnMoveEnd: boolean;
|
|
113
|
-
hoverVehicleId?: string | undefined;
|
|
114
|
-
selectedVehicleId?: string | undefined;
|
|
115
|
-
renderState?: RealtimeRenderState | undefined;
|
|
116
|
-
useRequestAnimationFrame?: boolean | undefined;
|
|
117
|
-
useDebounce?: boolean | undefined;
|
|
118
|
-
useThrottle?: boolean | undefined;
|
|
119
|
-
mots?: RealtimeMot[] | undefined;
|
|
120
|
-
motsByZoom: RealtimeMot[][];
|
|
121
|
-
generalizationLevel?: RealtimeGeneralizationLevel | undefined;
|
|
122
|
-
generalizationLevelByZoom: RealtimeGeneralizationLevel[];
|
|
123
|
-
renderTimeIntervalByZoom: number[];
|
|
124
|
-
format: GeoJSON;
|
|
125
|
-
requestId?: number | undefined;
|
|
126
|
-
updateTimeInterval?: number | undefined;
|
|
127
|
-
updateTimeDelay?: number | undefined;
|
|
128
|
-
visibilityRef: EventsKey;
|
|
129
|
-
selectedVehicle: GeoJSONFeature;
|
|
130
|
-
getMotsByZoom: (zoom: number) => RealtimeMot[];
|
|
131
|
-
getGeneralizationLevelByZoom: (zoom: number) => RealtimeGeneralizationLevel;
|
|
132
|
-
getRenderTimeIntervalByZoom: (zoom: number) => number;
|
|
133
|
-
throttleRenderTrajectories: (viewState: ViewState, noInterpolate?: boolean) => void;
|
|
134
|
-
debounceRenderTrajectories: (viewState: ViewState, noInterpolate?: boolean) => void;
|
|
135
|
-
onStart?: ((realtimeLayer: AnyLayer) => void) | undefined;
|
|
136
|
-
onStop?: ((realtimeLayer: AnyLayer) => void) | undefined;
|
|
137
|
-
/**
|
|
138
|
-
* Define layer's properties.
|
|
139
|
-
*
|
|
140
|
-
* @private
|
|
141
|
-
*/
|
|
142
|
-
defineProperties(options: RealtimeLayerMixinOptions): void;
|
|
143
|
-
attachToMap(map: AnyMap): void;
|
|
144
|
-
detachFromMap(): void;
|
|
145
|
-
start(): void;
|
|
146
|
-
/**
|
|
147
|
-
* Start the clock.
|
|
148
|
-
* @private
|
|
149
|
-
*/
|
|
150
|
-
startUpdateTime(): void;
|
|
151
|
-
stop(): void;
|
|
152
|
-
/**
|
|
153
|
-
* Stop the clock.
|
|
154
|
-
* @private
|
|
155
|
-
*/
|
|
156
|
-
stopUpdateTime(): void;
|
|
157
|
-
/**
|
|
158
|
-
* Launch renderTrajectories. it avoids duplicating code in renderTrajectories method.
|
|
159
|
-
*
|
|
160
|
-
* @param {object} viewState The view state of the map.
|
|
161
|
-
* @param {number[2]} viewState.center Center coordinate of the map in mercator coordinate.
|
|
162
|
-
* @param {number[4]} viewState.extent Extent of the map in mercator coordinates.
|
|
163
|
-
* @param {number[2]} viewState.size Size ([width, height]) of the canvas to render.
|
|
164
|
-
* @param {number} [viewState.rotation = 0] Rotation of the map to render.
|
|
165
|
-
* @param {number} viewState.resolution Resolution of the map to render.
|
|
166
|
-
* @param {boolean} noInterpolate If true trajectories are not interpolated but
|
|
167
|
-
* drawn at the last known coordinate. Use this for performance optimization
|
|
168
|
-
* during map navigation.
|
|
169
|
-
* @private
|
|
170
|
-
*/
|
|
171
|
-
renderTrajectoriesInternal(viewState: ViewState, noInterpolate?: boolean): boolean;
|
|
172
|
-
/**
|
|
173
|
-
* Render the trajectories requesting an animation frame and cancelling the previous one.
|
|
174
|
-
* This function must be overrided by children to provide the correct parameters.
|
|
175
|
-
*
|
|
176
|
-
* @param {object} viewState The view state of the map.
|
|
177
|
-
* @param {number[2]} viewState.center Center coordinate of the map in mercator coordinate.
|
|
178
|
-
* @param {number[4]} viewState.extent Extent of the map in mercator coordinates.
|
|
179
|
-
* @param {number[2]} viewState.size Size ([width, height]) of the canvas to render.
|
|
180
|
-
* @param {number} [viewState.rotation = 0] Rotation of the map to render.
|
|
181
|
-
* @param {number} viewState.resolution Resolution of the map to render.
|
|
182
|
-
* @param {boolean} noInterpolate If true trajectories are not interpolated but
|
|
183
|
-
* drawn at the last known coordinate. Use this for performance optimization
|
|
184
|
-
* during map navigation.
|
|
185
|
-
* @private
|
|
186
|
-
*/
|
|
187
|
-
renderTrajectories(viewState: ViewState | undefined, noInterpolate: boolean | undefined): void;
|
|
188
|
-
setBbox(extent: [number, number, number, number], zoom: number): void;
|
|
189
|
-
/**
|
|
190
|
-
* Get the duration before the next update depending on zoom level.
|
|
191
|
-
*
|
|
192
|
-
* @private
|
|
193
|
-
* @param {number} zoom
|
|
194
|
-
*/
|
|
195
|
-
getRefreshTimeInMs(zoom?: number | undefined): number;
|
|
196
|
-
/**
|
|
197
|
-
* Get vehicle.
|
|
198
|
-
* @param {function} filterFc A function use to filter results.
|
|
199
|
-
* @return {Array<Object>} Array of vehicle.
|
|
200
|
-
*/
|
|
201
|
-
getVehicle(filterFc: FilterFunction): GeoJSONFeature[];
|
|
202
|
-
/**
|
|
203
|
-
* Request feature information for a given coordinate.
|
|
204
|
-
*
|
|
205
|
-
* @param {ol/coordinate~Coordinate} coordinate Coordinate.
|
|
206
|
-
* @param {Object} options Options See child classes to see which options are supported.
|
|
207
|
-
* @param {number} [options.resolution=1] The resolution of the map.
|
|
208
|
-
* @param {number} [options.nb=Infinity] The max number of vehicles to return.
|
|
209
|
-
* @return {Promise<FeatureInfo>} Promise with features, layer and coordinate.
|
|
210
|
-
*/
|
|
211
|
-
getFeatureInfoAtCoordinate(coordinate: Coordinate, options: LayerGetFeatureInfoOptions): Promise<LayerGetFeatureInfoResponse>;
|
|
212
|
-
/**
|
|
213
|
-
* Request the stopSequence and the fullTrajectory informations for a vehicle.
|
|
214
|
-
*
|
|
215
|
-
* @param {string} id The vehicle identifier (the train_id property).
|
|
216
|
-
* @return {Promise<{stopSequence: StopSequence, fullTrajectory: FullTrajectory>} A promise that will be resolved with the trajectory informations.
|
|
217
|
-
*/
|
|
218
|
-
getTrajectoryInfos(id: RealtimeTrainId): Promise<{
|
|
219
|
-
stopSequence: WebSocketAPIMessageEventData<import("../../types").RealtimeFullTrajectory> | WebSocketAPIMessageEventData<GeoJSONFeature[]>;
|
|
220
|
-
fullTrajectory: WebSocketAPIMessageEventData<import("../../types").RealtimeFullTrajectory> | WebSocketAPIMessageEventData<GeoJSONFeature[]>;
|
|
221
|
-
}>;
|
|
222
|
-
/**
|
|
223
|
-
* Remove all trajectories that are in the past.
|
|
224
|
-
*/
|
|
225
|
-
purgeOutOfDateTrajectories(): void;
|
|
226
|
-
/**
|
|
227
|
-
* Determine if the trajectory is useless and should be removed from the list or not.
|
|
228
|
-
* By default, this function exclude vehicles:
|
|
229
|
-
* - that have their trajectory outside the current extent and
|
|
230
|
-
* - that aren't in the MOT list.
|
|
231
|
-
*
|
|
232
|
-
* @param {RealtimeTrajectory} trajectory
|
|
233
|
-
* @param {Array<number>} extent
|
|
234
|
-
* @param {number} zoom
|
|
235
|
-
* @return {boolean} if the trajectory must be displayed or not.
|
|
236
|
-
* @private
|
|
237
|
-
*/
|
|
238
|
-
purgeTrajectory(trajectory: GeoJSONFeature, extent: [number, number, number, number], zoom: number): boolean;
|
|
239
|
-
/**
|
|
240
|
-
* Add a trajectory.
|
|
241
|
-
* @param {RealtimeTrajectory} trajectory The trajectory to add.
|
|
242
|
-
* @private
|
|
243
|
-
*/
|
|
244
|
-
addTrajectory(trajectory: GeoJSONFeature): void;
|
|
245
|
-
removeTrajectory(trajectoryOrId: RealtimeTrajectory | RealtimeTrainId): void;
|
|
246
|
-
/**
|
|
247
|
-
* On zoomend we adjust the time interval of the update of vehicles positions.
|
|
248
|
-
*
|
|
249
|
-
* @param evt Event that triggered the function.
|
|
250
|
-
* @private
|
|
251
|
-
*/
|
|
252
|
-
onZoomEnd(): void;
|
|
253
|
-
onDocumentVisibilityChange(): void;
|
|
254
|
-
/**
|
|
255
|
-
* Callback on websocket's trajectory channel events.
|
|
256
|
-
* It adds a trajectory to the list.
|
|
257
|
-
*
|
|
258
|
-
* @private
|
|
259
|
-
*/
|
|
260
|
-
onTrajectoryMessage(data: WebSocketAPIMessageEventData<RealtimeTrajectory>): void;
|
|
261
|
-
/**
|
|
262
|
-
* Callback on websocket's deleted_vehicles channel events.
|
|
263
|
-
* It removes the trajectory from the list.
|
|
264
|
-
*
|
|
265
|
-
* @private
|
|
266
|
-
* @override
|
|
267
|
-
*/
|
|
268
|
-
onDeleteTrajectoryMessage(data: WebSocketAPIMessageEventData<RealtimeTrainId>): void;
|
|
269
|
-
highlightVehicle(id: RealtimeTrainId): void;
|
|
270
|
-
selectVehicle(id: RealtimeTrainId): void;
|
|
271
|
-
};
|
|
272
|
-
} & T;
|
|
273
|
-
export default RealtimeLayerMixin;
|