mobility-toolbox-js 3.0.0-beta.9 → 3.0.1-beta.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/api/HttpAPI.d.ts +5 -16
- package/api/HttpAPI.js +0 -11
- package/api/RealtimeAPI.d.ts +221 -176
- package/api/RealtimeAPI.js +317 -258
- 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 -164
- 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 +12 -12
- package/common/controls/StopFinderControlCommon.js +31 -31
- package/common/index.d.ts +1 -1
- package/common/index.js +1 -1
- package/common/mixins/RealtimeLayerMixin.d.ts +157 -163
- package/common/mixins/RealtimeLayerMixin.js +401 -393
- package/common/styles/realtimeDefaultStyle.js +6 -6
- package/common/styles/realtimeHeadingStyle.js +5 -5
- package/common/typedefs.d.ts +13 -6
- package/common/typedefs.js +7 -1
- 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/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 +9 -3
- package/common/utils/renderTrajectories.d.ts +1 -1
- package/common/utils/renderTrajectories.js +6 -6
- package/common/utils/sortAndFilterDepartures.d.ts +1 -1
- package/common/utils/sortAndFilterDepartures.js +1 -1
- package/common/utils/sortByDelay.d.ts +2 -2
- package/common/utils/sortByDelay.js +5 -1
- package/maplibre/layers/Layer.d.ts +1 -1
- package/maplibre/layers/Layer.js +1 -1
- package/maplibre/layers/RealtimeLayer.d.ts +87 -66
- package/maplibre/layers/RealtimeLayer.js +30 -6
- package/maplibre/utils/getSourceCoordinates.js +5 -5
- package/mbt.js +20988 -13287
- package/mbt.js.map +4 -4
- package/mbt.min.js +61 -58
- package/mbt.min.js.map +4 -4
- package/ol/controls/RoutingControl.d.ts +82 -89
- package/ol/controls/RoutingControl.js +217 -219
- package/ol/controls/StopFinderControl.d.ts +3 -3
- package/ol/controls/StopFinderControl.js +2 -2
- package/ol/index.d.ts +1 -0
- package/ol/index.js +1 -0
- package/ol/layers/Layer.d.ts +101 -0
- package/ol/layers/Layer.js +25 -0
- package/ol/layers/MaplibreLayer.d.ts +121 -24
- package/ol/layers/MaplibreLayer.js +98 -27
- package/ol/layers/MaplibreStyleLayer.d.ts +93 -91
- package/ol/layers/MaplibreStyleLayer.js +281 -257
- package/ol/layers/RealtimeLayer.d.ts +119 -121
- package/ol/layers/RealtimeLayer.js +143 -134
- package/ol/layers/VectorLayer.d.ts +18 -0
- package/ol/layers/VectorLayer.js +32 -0
- package/ol/layers/index.d.ts +2 -0
- package/ol/layers/index.js +3 -0
- package/ol/mixins/MobilityLayerMixin.d.ts +32 -34
- package/ol/mixins/PropertiesLayerMixin.d.ts +60 -51
- package/ol/mixins/PropertiesLayerMixin.js +114 -79
- package/ol/mixins/index.d.ts +1 -0
- package/ol/mixins/index.js +2 -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 +6 -6
- package/ol/renderers/RealtimeLayerRenderer.js +56 -51
- package/ol/utils/getFeatureInfoAtCoordinate.d.ts +1 -1
- package/ol/utils/getFeatureInfoAtCoordinate.js +11 -17
- package/package.json +31 -31
- package/setupTests.js +3 -4
- package/types/common.d.ts +55 -48
- package/types/index.d.ts +1 -1
- package/types/realtime.d.ts +91 -93
- package/types/routing.d.ts +60 -60
- package/types/stops.d.ts +62 -62
- package/ol/layers/MapGlLayer.d.ts +0 -144
- package/ol/layers/MapGlLayer.js +0 -144
|
@@ -1,37 +1,34 @@
|
|
|
1
1
|
import { Feature } from 'ol';
|
|
2
|
-
import
|
|
2
|
+
import Control, { Options } from 'ol/control/Control';
|
|
3
|
+
import { EventsKey } from 'ol/events';
|
|
4
|
+
import { GeoJSON } from 'ol/format';
|
|
3
5
|
import { Geometry, LineString, Point } from 'ol/geom';
|
|
4
6
|
import { Modify } from 'ol/interaction';
|
|
5
|
-
import { GeoJSON } from 'ol/format';
|
|
6
|
-
import type { Coordinate } from 'ol/coordinate';
|
|
7
|
-
import type { StyleLike } from 'ol/style/Style';
|
|
8
|
-
import { EventsKey } from 'ol/events';
|
|
9
7
|
import { ModifyEvent } from 'ol/interaction/Modify';
|
|
10
8
|
import VectorLayer from 'ol/layer/Vector';
|
|
11
|
-
import VectorSource from 'ol/source/Vector';
|
|
12
|
-
import Control, { Options } from 'ol/control/Control';
|
|
13
9
|
import { RoutingAPI } from '../../api';
|
|
10
|
+
import type { Map, MapBrowserEvent } from 'ol';
|
|
11
|
+
import type { Coordinate } from 'ol/coordinate';
|
|
12
|
+
import type { StyleLike } from 'ol/style/Style';
|
|
14
13
|
import type { RoutingGraph, RoutingMot, RoutingParameters, RoutingViaPoint } from '../../types';
|
|
15
|
-
export type RoutingControlOptions =
|
|
16
|
-
apiKey?: string;
|
|
14
|
+
export type RoutingControlOptions = {
|
|
17
15
|
active?: boolean;
|
|
18
|
-
|
|
19
|
-
stopsApiUrl?: string;
|
|
20
|
-
routingLayer?: VectorLayer<VectorSource<Feature<Geometry>>>;
|
|
16
|
+
apiKey?: string;
|
|
21
17
|
graphs?: RoutingGraph[];
|
|
22
|
-
mot?: string;
|
|
23
18
|
modify?: boolean;
|
|
19
|
+
mot?: string;
|
|
20
|
+
onRouteError?: () => void;
|
|
24
21
|
routingApiParams?: RoutingParameters;
|
|
25
|
-
|
|
22
|
+
routingLayer?: VectorLayer<Feature>;
|
|
26
23
|
snapToClosestStation?: boolean;
|
|
24
|
+
stopsApiKey?: string;
|
|
25
|
+
stopsApiUrl?: string;
|
|
27
26
|
style?: StyleLike;
|
|
28
|
-
|
|
29
|
-
};
|
|
30
|
-
export type AbotControllersByGraph =
|
|
31
|
-
[key: string]: AbortController;
|
|
32
|
-
};
|
|
27
|
+
useRawViaPoints?: boolean;
|
|
28
|
+
} & Options;
|
|
29
|
+
export type AbotControllersByGraph = Record<string, AbortController>;
|
|
33
30
|
/**
|
|
34
|
-
*
|
|
31
|
+
* This OpenLayers control allows the user to add and modifiy via points to a map and request a route from the [geOps Routing API](https://developer.geops.io/apis/routing/).
|
|
35
32
|
*
|
|
36
33
|
* @example
|
|
37
34
|
* import { Map } from 'ol';
|
|
@@ -63,42 +60,30 @@ export type AbotControllersByGraph = {
|
|
|
63
60
|
* @public
|
|
64
61
|
*/
|
|
65
62
|
declare class RoutingControl extends Control {
|
|
66
|
-
|
|
67
|
-
viaPoints: RoutingViaPoint[];
|
|
68
|
-
routingLayer?: VectorLayer<VectorSource<Feature<Geometry>>>;
|
|
69
|
-
graphs: RoutingGraph[];
|
|
70
|
-
routingApiParams?: RoutingParameters;
|
|
71
|
-
useRawViaPoints: boolean;
|
|
72
|
-
snapToClosestStation: boolean;
|
|
73
|
-
cacheStationData: {
|
|
74
|
-
[key: string]: Coordinate;
|
|
75
|
-
};
|
|
76
|
-
abortControllers: {
|
|
77
|
-
[key: string]: AbortController;
|
|
78
|
-
};
|
|
79
|
-
apiKey?: string;
|
|
80
|
-
stopsApiKey?: string;
|
|
81
|
-
segments: Feature<LineString>[];
|
|
82
|
-
stopsApiUrl?: string;
|
|
63
|
+
abortControllers: Record<string, AbortController>;
|
|
83
64
|
api?: RoutingAPI;
|
|
65
|
+
apiKey?: string;
|
|
66
|
+
cacheStationData: Record<string, Coordinate>;
|
|
84
67
|
format: GeoJSON;
|
|
68
|
+
graphs: RoutingGraph[];
|
|
85
69
|
graphsResolutions?: [number, number][];
|
|
86
|
-
onRouteError: (error?: Error, control?: RoutingControl) => void;
|
|
87
|
-
onMapClickKey?: EventsKey;
|
|
88
|
-
modifyInteraction?: Modify;
|
|
89
70
|
initialRouteDrag?: {
|
|
90
|
-
viaPoint?: Feature<Point>;
|
|
91
71
|
oldRoute?: Feature<LineString>;
|
|
92
72
|
segmentIndex?: number;
|
|
73
|
+
viaPoint?: Feature<Point>;
|
|
93
74
|
};
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
75
|
+
map?: Map;
|
|
76
|
+
modifyInteraction?: Modify;
|
|
77
|
+
onMapClickKey?: EventsKey;
|
|
78
|
+
onRouteError: (error?: Error, control?: RoutingControl) => void;
|
|
79
|
+
routingApiParams?: RoutingParameters;
|
|
80
|
+
routingLayer?: VectorLayer<Feature>;
|
|
81
|
+
segments: Feature<LineString>[];
|
|
82
|
+
snapToClosestStation: boolean;
|
|
83
|
+
stopsApiKey?: string;
|
|
84
|
+
stopsApiUrl?: string;
|
|
85
|
+
useRawViaPoints: boolean;
|
|
86
|
+
viaPoints: RoutingViaPoint[];
|
|
102
87
|
constructor(options?: RoutingControlOptions);
|
|
103
88
|
/**
|
|
104
89
|
* Calculate at which resolutions corresponds each generalizations.
|
|
@@ -107,10 +92,16 @@ declare class RoutingControl extends Control {
|
|
|
107
92
|
*/
|
|
108
93
|
static getGraphsResolutions(graphs: RoutingGraph[], map: Map): [number, number][];
|
|
109
94
|
/**
|
|
110
|
-
*
|
|
95
|
+
* Aborts viapoint and route requests
|
|
111
96
|
* @private
|
|
112
97
|
*/
|
|
113
|
-
|
|
98
|
+
abortRequests(): void;
|
|
99
|
+
activate(): void;
|
|
100
|
+
/**
|
|
101
|
+
* Add click listener to map.
|
|
102
|
+
* @private
|
|
103
|
+
*/
|
|
104
|
+
addListeners(): void;
|
|
114
105
|
/**
|
|
115
106
|
* Adds/Replaces a viaPoint to the viaPoints array and redraws route:
|
|
116
107
|
* Adds a viaPoint at end of array by default.
|
|
@@ -124,28 +115,17 @@ declare class RoutingControl extends Control {
|
|
|
124
115
|
*/
|
|
125
116
|
addViaPoint(coordinatesOrString: RoutingViaPoint, index?: number, overwrite?: number): void;
|
|
126
117
|
/**
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
* @
|
|
130
|
-
* @public
|
|
131
|
-
*/
|
|
132
|
-
removeViaPoint(index?: number): void;
|
|
133
|
-
/**
|
|
134
|
-
* Replaces the current viaPoints with a new coordinate array.
|
|
135
|
-
* @param {Array<Array<number>>} coordinateArray Array of nested coordinates
|
|
136
|
-
* @public
|
|
137
|
-
*/
|
|
138
|
-
setViaPoints(coordinateArray: Coordinate[]): void;
|
|
139
|
-
/**
|
|
140
|
-
* Removes all viaPoints, clears the source and triggers a change event
|
|
141
|
-
* @public
|
|
118
|
+
* Define a default element.
|
|
119
|
+
*
|
|
120
|
+
* @private
|
|
142
121
|
*/
|
|
143
|
-
|
|
122
|
+
createDefaultElement(): void;
|
|
144
123
|
/**
|
|
145
|
-
*
|
|
124
|
+
* Create the interaction used to modify vertexes of features.
|
|
146
125
|
* @private
|
|
147
126
|
*/
|
|
148
|
-
|
|
127
|
+
createModifyInteraction(): void;
|
|
128
|
+
deactivate(): void;
|
|
149
129
|
/**
|
|
150
130
|
* Draws route on map using an array of coordinates:
|
|
151
131
|
* If a single coordinate is passed a single point feature is added to map.
|
|
@@ -160,6 +140,11 @@ declare class RoutingControl extends Control {
|
|
|
160
140
|
* @private
|
|
161
141
|
*/
|
|
162
142
|
drawViaPoint(viaPoint: RoutingViaPoint, idx: number, abortController: AbortController): Promise<void | Feature<Geometry>> | Promise<Feature<Geometry> | null>;
|
|
143
|
+
/**
|
|
144
|
+
* Activet7deactivate the control when activ eproperty changes
|
|
145
|
+
* @private
|
|
146
|
+
*/
|
|
147
|
+
onActiveChange(): void;
|
|
163
148
|
/**
|
|
164
149
|
* Used on click on map while control is active:
|
|
165
150
|
* By default adds a viaPoint to the end of array.
|
|
@@ -167,12 +152,6 @@ declare class RoutingControl extends Control {
|
|
|
167
152
|
* @private
|
|
168
153
|
*/
|
|
169
154
|
onMapClick(evt: MapBrowserEvent<MouseEvent>): void;
|
|
170
|
-
/**
|
|
171
|
-
* Used on start of the modify interaction. Stores relevant data
|
|
172
|
-
* in this.initialRouteDrag object
|
|
173
|
-
* @private
|
|
174
|
-
*/
|
|
175
|
-
onModifyStart(evt: ModifyEvent): void;
|
|
176
155
|
/**
|
|
177
156
|
* Used on end of the modify interaction. Resolves feature modification:
|
|
178
157
|
* Line drag creates new viaPoint at the final coordinate of drag.
|
|
@@ -181,29 +160,43 @@ declare class RoutingControl extends Control {
|
|
|
181
160
|
*/
|
|
182
161
|
onModifyEnd(evt: ModifyEvent): void | Promise<never>;
|
|
183
162
|
/**
|
|
184
|
-
*
|
|
185
|
-
*
|
|
163
|
+
* Used on start of the modify interaction. Stores relevant data
|
|
164
|
+
* in this.initialRouteDrag object
|
|
186
165
|
* @private
|
|
187
166
|
*/
|
|
188
|
-
|
|
167
|
+
onModifyStart(evt: ModifyEvent): void;
|
|
189
168
|
/**
|
|
190
|
-
*
|
|
169
|
+
* Remove click listener from map.
|
|
191
170
|
* @private
|
|
192
171
|
*/
|
|
193
|
-
|
|
172
|
+
removeListeners(): void;
|
|
194
173
|
/**
|
|
195
|
-
*
|
|
196
|
-
*
|
|
174
|
+
* Removes a viaPoint at the passed array index and redraws route
|
|
175
|
+
* By default the last viaPoint is removed.
|
|
176
|
+
* @param {number} index Integer representing the index of the viaPoint to delete.
|
|
177
|
+
* @public
|
|
197
178
|
*/
|
|
198
|
-
|
|
179
|
+
removeViaPoint(index?: number): void;
|
|
180
|
+
render(): void;
|
|
199
181
|
/**
|
|
200
|
-
*
|
|
201
|
-
* @
|
|
182
|
+
* Removes all viaPoints, clears the source and triggers a change event
|
|
183
|
+
* @public
|
|
202
184
|
*/
|
|
203
|
-
|
|
185
|
+
reset(): void;
|
|
204
186
|
setMap(map: Map): void;
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
187
|
+
/**
|
|
188
|
+
* Replaces the current viaPoints with a new coordinate array.
|
|
189
|
+
* @param {Array<Array<number>>} coordinateArray Array of nested coordinates
|
|
190
|
+
* @public
|
|
191
|
+
*/
|
|
192
|
+
setViaPoints(coordinateArray: Coordinate[]): void;
|
|
193
|
+
get active(): boolean;
|
|
194
|
+
set active(newValue: boolean);
|
|
195
|
+
get loading(): boolean;
|
|
196
|
+
set loading(newValue: boolean);
|
|
197
|
+
get modify(): any;
|
|
198
|
+
set modify(newValue: any);
|
|
199
|
+
get mot(): RoutingMot;
|
|
200
|
+
set mot(newValue: RoutingMot);
|
|
208
201
|
}
|
|
209
202
|
export default RoutingControl;
|