mobility-toolbox-js 3.0.0-beta.19 → 3.0.0-beta.20

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