mobility-toolbox-js 3.0.0-beta.8 → 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 +20 -0
- package/api/HttpAPI.js +1 -14
- package/api/RealtimeAPI.d.ts +404 -0
- package/api/RealtimeAPI.js +265 -206
- package/api/RoutingAPI.d.ts +47 -0
- package/api/RoutingAPI.js +17 -7
- package/api/StopsAPI.d.ts +44 -0
- package/api/StopsAPI.js +17 -11
- package/api/WebSocketAPI.d.ts +147 -0
- package/api/WebSocketAPI.js +164 -165
- package/api/index.d.ts +3 -0
- package/api/index.js +1 -1
- package/api/typedefs.d.ts +76 -0
- package/api/typedefs.js +27 -42
- package/common/controls/StopFinderControlCommon.d.ts +53 -0
- package/common/controls/StopFinderControlCommon.js +32 -32
- package/common/index.d.ts +2 -0
- package/common/index.js +1 -1
- package/common/styles/index.d.ts +4 -0
- package/common/styles/realtimeDefaultStyle.d.ts +36 -0
- package/common/styles/realtimeDefaultStyle.js +6 -11
- package/common/styles/realtimeDelayStyle.d.ts +12 -0
- package/common/styles/realtimeHeadingStyle.d.ts +12 -0
- package/common/styles/realtimeHeadingStyle.js +5 -10
- package/common/styles/realtimeSimpleStyle.d.ts +3 -0
- package/common/styles/realtimeSimpleStyle.js +0 -1
- package/common/typedefs.d.ts +102 -0
- 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 +10 -0
- package/common/utils/compareDepartures.js +2 -2
- package/common/utils/constants.d.ts +5 -0
- package/common/utils/createCanvas.d.ts +10 -0
- package/common/utils/createDefaultCopyrightElt.d.ts +5 -0
- package/common/utils/createDefaultStopFinderElt.d.ts +5 -0
- package/common/utils/createRealtimeFilters.d.ts +12 -0
- package/common/utils/debounceDeparturesMessages.d.ts +12 -0
- package/common/utils/debounceWebsocketMessages.d.ts +11 -0
- package/common/utils/getLayersAsFlatArray.d.ts +2 -0
- package/common/utils/getLayersAsFlatArray.js +0 -1
- package/common/utils/getMapGlCopyrights.d.ts +17 -0
- package/common/utils/getMapGlCopyrights.js +3 -3
- package/common/utils/getRealtimeModeSuffix.d.ts +10 -0
- package/common/utils/getRealtimeModeSuffix.js +1 -0
- package/common/utils/getUrlWithParams.d.ts +8 -0
- package/common/utils/getVehiclePosition.d.ts +17 -0
- package/common/utils/getVehiclePosition.js +6 -3
- package/common/utils/index.d.ts +16 -0
- package/common/utils/realtimeConfig.d.ts +64 -0
- package/common/utils/realtimeConfig.js +0 -1
- package/common/utils/removeDuplicate.d.ts +9 -0
- package/common/utils/renderTrajectories.d.ts +17 -0
- package/common/utils/renderTrajectories.js +7 -6
- package/common/utils/sortAndFilterDepartures.d.ts +16 -0
- package/common/utils/sortAndFilterDepartures.js +2 -1
- package/common/utils/sortByDelay.d.ts +3 -0
- package/common/utils/sortByDelay.js +5 -1
- package/common/utils/timeUtils.d.ts +23 -0
- package/common/utils/toMercatorExtent.d.ts +5 -0
- package/iife.d.ts +2 -0
- package/index.d.ts +9 -0
- package/maplibre/controls/CopyrightControl.d.ts +38 -0
- package/maplibre/controls/CopyrightControl.js +11 -8
- package/maplibre/controls/index.d.ts +1 -0
- package/maplibre/index.d.ts +5 -0
- package/maplibre/layers/Layer.d.ts +29 -0
- package/maplibre/layers/Layer.js +2 -3
- package/maplibre/layers/RealtimeLayer.d.ts +124 -0
- package/maplibre/layers/RealtimeLayer.js +154 -118
- package/maplibre/layers/index.d.ts +2 -0
- package/maplibre/utils/getMercatorResolution.d.ts +7 -0
- package/maplibre/utils/getSourceCoordinates.d.ts +8 -0
- package/maplibre/utils/getSourceCoordinates.js +6 -5
- package/maplibre/utils/index.d.ts +2 -0
- package/mbt.js +14585 -14557
- 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 +39 -0
- package/ol/controls/CopyrightControl.js +13 -5
- package/ol/controls/RoutingControl.d.ts +213 -0
- package/ol/controls/RoutingControl.js +250 -264
- package/ol/controls/StopFinderControl.d.ts +56 -0
- package/ol/controls/StopFinderControl.js +24 -5
- package/ol/controls/index.d.ts +3 -0
- package/ol/index.d.ts +6 -0
- package/ol/layers/Layer.d.ts +26 -0
- package/ol/layers/Layer.js +39 -0
- package/ol/layers/MaplibreLayer.d.ts +91 -0
- package/ol/layers/MaplibreLayer.js +154 -31
- package/ol/layers/MaplibreStyleLayer.d.ts +157 -0
- package/ol/layers/MaplibreStyleLayer.js +281 -210
- package/ol/layers/RealtimeLayer.d.ts +150 -0
- package/ol/layers/RealtimeLayer.js +210 -206
- package/ol/layers/VectorLayer.d.ts +17 -0
- package/ol/layers/VectorLayer.js +33 -0
- package/ol/layers/index.d.ts +5 -0
- package/ol/layers/index.js +3 -0
- package/ol/renderers/MaplibreLayerRenderer.d.ts +0 -0
- package/ol/renderers/MaplibreLayerRenderer.js +142 -114
- package/ol/renderers/MaplibreStyleLayerRenderer.d.ts +20 -0
- package/ol/renderers/MaplibreStyleLayerRenderer.js +20 -23
- package/ol/renderers/RealtimeLayerRenderer.d.ts +22 -0
- package/ol/renderers/RealtimeLayerRenderer.js +50 -70
- package/ol/styles/fullTrajectoryDelayStyle.d.ts +6 -0
- package/ol/styles/fullTrajectoryDelayStyle.js +5 -7
- package/ol/styles/fullTrajectoryStyle.d.ts +4 -0
- package/ol/styles/fullTrajectoryStyle.js +5 -7
- package/ol/styles/index.d.ts +3 -0
- package/ol/styles/routingStyle.d.ts +3 -0
- 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 +8 -0
- package/ol/utils/getFeatureInfoAtCoordinate.js +11 -17
- package/ol/utils/index.d.ts +1 -0
- package/package.json +44 -44
- package/setupTests.d.ts +1 -0
- 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.js +0 -743
- package/ol/layers/MapGlLayer.js +0 -142
- package/ol/mixins/MobilityLayerMixin.js +0 -9
- package/ol/mixins/PropertiesLayerMixin.js +0 -142
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 */
|