mobility-toolbox-js 2.0.0-beta.32 → 2.0.0-beta.33
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/RealtimeAPI.d.ts +268 -0
- package/api/RealtimeAPI.d.ts.map +1 -0
- package/api/RoutingAPI.d.ts +33 -0
- package/api/RoutingAPI.d.ts.map +1 -0
- package/api/StopsAPI.d.ts +36 -0
- package/api/StopsAPI.d.ts.map +1 -0
- package/api/index.d.ts +5 -0
- package/api/index.d.ts.map +1 -0
- package/api/typedefs.d.ts +105 -0
- package/api/typedefs.d.ts.map +1 -0
- package/common/api/HttpAPI.d.ts +31 -0
- package/common/api/HttpAPI.d.ts.map +1 -0
- package/common/api/WebSocketAPI.d.ts +95 -0
- package/common/api/WebSocketAPI.d.ts.map +1 -0
- package/common/controls/Control.d.ts +74 -0
- package/common/controls/Control.d.ts.map +1 -0
- package/common/{index.js → index.d.ts} +1 -0
- package/common/index.d.ts.map +1 -0
- package/common/layers/Layer.d.ts +80 -0
- package/common/layers/Layer.d.ts.map +1 -0
- package/common/mixins/CopyrightMixin.d.ts +22 -0
- package/common/mixins/CopyrightMixin.d.ts.map +1 -0
- package/common/mixins/MapboxLayerMixin.d.ts +27 -0
- package/common/mixins/MapboxLayerMixin.d.ts.map +1 -0
- package/common/mixins/RealtimeLayerMixin.d.ts +58 -0
- package/common/mixins/RealtimeLayerMixin.d.ts.map +1 -0
- package/common/mixins/StopFinderMixin.d.ts +40 -0
- package/common/mixins/StopFinderMixin.d.ts.map +1 -0
- package/common/mixins/UserInteractionsLayerMixin.d.ts +42 -0
- package/common/mixins/UserInteractionsLayerMixin.d.ts.map +1 -0
- package/common/styles/{index.js → index.d.ts} +1 -0
- package/common/styles/index.d.ts.map +1 -0
- package/common/styles/realtimeDefaultStyle.d.ts +15 -0
- package/common/styles/realtimeDefaultStyle.d.ts.map +1 -0
- package/common/styles/realtimeDelayStyle.d.ts +11 -0
- package/common/styles/realtimeDelayStyle.d.ts.map +1 -0
- package/common/styles/realtimeSimpleStyle.d.ts +3 -0
- package/common/styles/realtimeSimpleStyle.d.ts.map +1 -0
- package/common/typedefs.d.ts +50 -0
- package/common/typedefs.d.ts.map +1 -0
- package/common/utils/cleanStopTime.d.ts +7 -0
- package/common/utils/cleanStopTime.d.ts.map +1 -0
- package/common/utils/compareDepartures.d.ts +9 -0
- package/common/utils/compareDepartures.d.ts.map +1 -0
- package/common/utils/createCanvas.d.ts +9 -0
- package/common/utils/createCanvas.d.ts.map +1 -0
- package/common/utils/createTrackerFilters.d.ts +12 -0
- package/common/utils/createTrackerFilters.d.ts.map +1 -0
- package/common/utils/getLayersAsFlatArray.d.ts +3 -0
- package/common/utils/getLayersAsFlatArray.d.ts.map +1 -0
- package/common/utils/getMapboxMapCopyrights.d.ts +8 -0
- package/common/utils/getMapboxMapCopyrights.d.ts.map +1 -0
- package/common/utils/getMapboxRender.d.ts +5 -0
- package/common/utils/getMapboxRender.d.ts.map +1 -0
- package/common/utils/getMaplibreRender.d.ts +5 -0
- package/common/utils/getMaplibreRender.d.ts.map +1 -0
- package/common/utils/getRealtimeModeSuffix.d.ts +8 -0
- package/common/utils/getRealtimeModeSuffix.d.ts.map +1 -0
- package/common/utils/getUrlWithParams.d.ts +9 -0
- package/common/utils/getUrlWithParams.d.ts.map +1 -0
- package/common/utils/getVehiclePosition.d.ts +14 -0
- package/common/utils/getVehiclePosition.d.ts.map +1 -0
- package/common/utils/{index.js → index.d.ts} +3 -0
- package/common/utils/index.d.ts.map +1 -0
- package/common/utils/removeDuplicate.d.ts +10 -0
- package/common/utils/removeDuplicate.d.ts.map +1 -0
- package/common/utils/renderTrajectories.d.ts +20 -0
- package/common/utils/renderTrajectories.d.ts.map +1 -0
- package/common/utils/sortByDelay.d.ts +3 -0
- package/common/utils/sortByDelay.d.ts.map +1 -0
- package/common/utils/timeUtils.d.ts +5 -0
- package/common/utils/timeUtils.d.ts.map +1 -0
- package/common/utils/trackerConfig.d.ts +24 -0
- package/common/utils/trackerConfig.d.ts.map +1 -0
- package/iife.d.ts +3 -0
- package/iife.d.ts.map +1 -0
- package/index.d.ts +6 -0
- package/index.d.ts.map +1 -0
- package/mapbox/controls/CopyrightControl.d.ts +32 -0
- package/mapbox/controls/CopyrightControl.d.ts.map +1 -0
- package/mapbox/controls/{index.js → index.d.ts} +1 -0
- package/mapbox/controls/index.d.ts.map +1 -0
- package/mapbox/{index.js → index.d.ts} +1 -0
- package/mapbox/index.d.ts.map +1 -0
- package/mapbox/layers/Layer.d.ts +47 -0
- package/mapbox/layers/Layer.d.ts.map +1 -0
- package/mapbox/layers/RealtimeLayer.d.ts +118 -0
- package/mapbox/layers/RealtimeLayer.d.ts.map +1 -0
- package/mapbox/layers/{index.js → index.d.ts} +1 -0
- package/mapbox/layers/index.d.ts.map +1 -0
- package/mapbox/utils.d.ts +8 -0
- package/mapbox/utils.d.ts.map +1 -0
- package/mbt.js +2049 -2106
- package/mbt.js.map +3 -3
- package/mbt.min.js +18 -18
- package/mbt.min.js.map +3 -3
- package/ol/controls/CopyrightControl.d.ts +31 -0
- package/ol/controls/CopyrightControl.d.ts.map +1 -0
- package/ol/controls/RoutingControl.d.ts +180 -0
- package/ol/controls/RoutingControl.d.ts.map +1 -0
- package/ol/controls/StopFinderControl.d.ts +32 -0
- package/ol/controls/StopFinderControl.d.ts.map +1 -0
- package/ol/controls/{index.js → index.d.ts} +1 -0
- package/ol/controls/index.d.ts.map +1 -0
- package/ol/{index.js → index.d.ts} +1 -0
- package/ol/index.d.ts.map +1 -0
- package/ol/layers/Layer.d.ts +49 -0
- package/ol/layers/Layer.d.ts.map +1 -0
- package/ol/layers/MapboxLayer.d.ts +42 -0
- package/ol/layers/MapboxLayer.d.ts.map +1 -0
- package/ol/layers/MapboxStyleLayer.d.ts +146 -0
- package/ol/layers/MapboxStyleLayer.d.ts.map +1 -0
- package/ol/layers/MaplibreLayer.d.ts +27 -0
- package/ol/layers/MaplibreLayer.d.ts.map +1 -0
- package/ol/layers/RealtimeLayer.d.ts +119 -0
- package/ol/layers/RealtimeLayer.d.ts.map +1 -0
- package/ol/layers/RoutingLayer.d.ts +24 -0
- package/ol/layers/RoutingLayer.d.ts.map +1 -0
- package/ol/layers/VectorLayer.d.ts +23 -0
- package/ol/layers/VectorLayer.d.ts.map +1 -0
- package/ol/layers/WMSLayer.d.ts +38 -0
- package/ol/layers/WMSLayer.d.ts.map +1 -0
- package/ol/layers/{index.js → index.d.ts} +1 -0
- package/ol/layers/index.d.ts.map +1 -0
- package/ol/styles/fullTrajectoryDelayStyle.d.ts +4 -0
- package/ol/styles/fullTrajectoryDelayStyle.d.ts.map +1 -0
- package/ol/styles/fullTrajectoryStyle.d.ts +4 -0
- package/ol/styles/fullTrajectoryStyle.d.ts.map +1 -0
- package/ol/styles/{index.js → index.d.ts} +1 -0
- package/ol/styles/index.d.ts.map +1 -0
- package/package.json +14 -36
- package/setupTests.d.ts +2 -0
- package/setupTests.d.ts.map +1 -0
- package/types/index.d.ts +7 -6
- package/types/routing.d.ts +25 -25
- package/types/stops.d.ts +19 -19
- package/api/RealtimeAPI.js +0 -357
- package/api/RealtimeAPI.test.js +0 -67
- package/api/RoutingAPI.js +0 -15
- package/api/RoutingAPI.test.js +0 -25
- package/api/StopsAPI.js +0 -12
- package/api/StopsAPI.test.js +0 -22
- package/api/index.js +0 -3
- package/api/typedefs.js +0 -0
- package/common/api/HttpAPI.js +0 -32
- package/common/api/HttpAPI.test.js +0 -50
- package/common/api/WebSocketAPI.js +0 -175
- package/common/api/WebSocketAPI.test.js +0 -311
- package/common/controls/Control.js +0 -81
- package/common/controls/Control.test.js +0 -87
- package/common/layers/Layer.js +0 -140
- package/common/layers/Layer.test.js +0 -134
- package/common/mixins/CopyrightMixin.js +0 -24
- package/common/mixins/RealtimeLayerMixin.js +0 -436
- package/common/mixins/StopFinderMixin.js +0 -110
- package/common/mixins/UserInteractionsLayerMixin.js +0 -124
- package/common/mixins/UserInteractionsLayerMixin.test.js +0 -199
- package/common/styles/realtimeDefaultStyle.js +0 -202
- package/common/styles/realtimeDelayStyle.js +0 -8
- package/common/styles/realtimeSimpleStyle.js +0 -18
- package/common/typedefs.js +0 -0
- package/common/utils/cleanStopTime.js +0 -19
- package/common/utils/compareDepartures.js +0 -25
- package/common/utils/createCanvas.js +0 -17
- package/common/utils/createTrackerFilters.js +0 -56
- package/common/utils/createTrackerFilters.test.js +0 -79
- package/common/utils/getLayersAsFlatArray.js +0 -14
- package/common/utils/getMapboxMapCopyrights.js +0 -19
- package/common/utils/getMapboxMapCopyrights.test.js +0 -40
- package/common/utils/getRealtimeModeSuffix.js +0 -2
- package/common/utils/getUrlWithParams.js +0 -11
- package/common/utils/getVehiclePosition.js +0 -42
- package/common/utils/removeDuplicate.js +0 -8
- package/common/utils/removeDuplicate.test.js +0 -19
- package/common/utils/renderTrajectories.js +0 -86
- package/common/utils/sortByDelay.js +0 -18
- package/common/utils/timeUtils.js +0 -20
- package/common/utils/timeUtils.test.js +0 -10
- package/common/utils/trackerConfig.js +0 -129
- package/common/utils/trackerConfig.test.js +0 -23
- package/index.js +0 -8
- package/mapbox/controls/CopyrightControl.js +0 -29
- package/mapbox/layers/Layer.js +0 -56
- package/mapbox/layers/Layer.test.js +0 -182
- package/mapbox/layers/RealtimeLayer.js +0 -185
- package/mapbox/layers/RealtimeLayer.test.js +0 -10
- package/mapbox/utils.js +0 -32
- package/ol/controls/CopyrightControl.js +0 -42
- package/ol/controls/CopyrightControl.test.js +0 -165
- package/ol/controls/RoutingControl.js +0 -388
- package/ol/controls/RoutingControl.test.js +0 -146
- package/ol/controls/StopFinderControl.js +0 -10
- package/ol/controls/StopFinderControl.test.js +0 -48
- package/ol/layers/Layer.js +0 -83
- package/ol/layers/Layer.test.js +0 -175
- package/ol/layers/MapboxLayer.js +0 -204
- package/ol/layers/MapboxLayer.test.js +0 -160
- package/ol/layers/MapboxStyleLayer.js +0 -187
- package/ol/layers/MapboxStyleLayer.test.js +0 -226
- package/ol/layers/MaplibreLayer.js +0 -140
- package/ol/layers/RealtimeLayer.js +0 -187
- package/ol/layers/RealtimeLayer.test.js +0 -67
- package/ol/layers/RoutingLayer.js +0 -61
- package/ol/layers/RoutingLayer.test.js +0 -39
- package/ol/layers/VectorLayer.js +0 -22
- package/ol/layers/VectorLayer.test.js +0 -76
- package/ol/layers/WMSLayer.js +0 -38
- package/ol/layers/WMSLayer.test.js +0 -57
- package/ol/styles/fullTrajectoryDelayStyle.js +0 -31
- package/ol/styles/fullTrajectoryStyle.js +0 -42
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum for Realtime modes.
|
|
3
|
+
*/
|
|
4
|
+
export type RealtimeModes = RealtimeMode;
|
|
5
|
+
export namespace RealtimeModes {
|
|
6
|
+
const RAW: string;
|
|
7
|
+
const TOPOGRAPHIC: string;
|
|
8
|
+
const SCHEMATIC: string;
|
|
9
|
+
}
|
|
10
|
+
export default RealtimeAPI;
|
|
11
|
+
/**
|
|
12
|
+
* Enum for Realtime modes.
|
|
13
|
+
*/
|
|
14
|
+
export type RealtimeMode = string;
|
|
15
|
+
/**
|
|
16
|
+
* This class provides convenience methods to access to the [geOps realtime api](https://developer.geops.io/apis/realtime/).
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* import { RealtimeAPI } from 'mobility-toolbox-js/api';
|
|
20
|
+
*
|
|
21
|
+
* const api = new RealtimeAPI({
|
|
22
|
+
* url: "yourUrl",
|
|
23
|
+
* apiKey: "yourApiKey"
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* import { RealtimeAPI } from 'mobility-toolbox-js/api';
|
|
28
|
+
*
|
|
29
|
+
* const api = new RealtimeAPI("yourUrl");
|
|
30
|
+
*/
|
|
31
|
+
declare class RealtimeAPI {
|
|
32
|
+
/**
|
|
33
|
+
* Constructor
|
|
34
|
+
*
|
|
35
|
+
* @param {Object|string} options A string representing the url of the service or an object containing the url and the apiKey.
|
|
36
|
+
* @param {string} options.url Url to the [geOps realtime api](https://developer.geops.io/apis/realtime/).
|
|
37
|
+
* @param {string} options.apiKey Access key for [geOps apis](https://developer.geops.io/).
|
|
38
|
+
* @param {string} [options.prefix=''] Service prefix to specify tenant.
|
|
39
|
+
* @param {string} [options.projection] The epsg code of the projection for features. Default to EPSG:3857.
|
|
40
|
+
* @param {number[4]} [options.bbox=[minX, minY, maxX, maxY, zoom, tenant] The bounding box to receive data from.
|
|
41
|
+
*/
|
|
42
|
+
constructor(options?: any | string);
|
|
43
|
+
/** @ignore */
|
|
44
|
+
subscribedStationUic: number;
|
|
45
|
+
/** @ignore */
|
|
46
|
+
departureUpdateTimeout: number;
|
|
47
|
+
/** @ignore */
|
|
48
|
+
maxDepartureAge: number;
|
|
49
|
+
/** @ignore */
|
|
50
|
+
extraGeoms: {};
|
|
51
|
+
/** @ignore */
|
|
52
|
+
prefix: any;
|
|
53
|
+
/**
|
|
54
|
+
* Callback when the websocket is opened and ready.
|
|
55
|
+
* It applies the bbox and the projection.
|
|
56
|
+
*/
|
|
57
|
+
onOpen(): void;
|
|
58
|
+
defineProperties(options: any): void;
|
|
59
|
+
open(): void;
|
|
60
|
+
/**
|
|
61
|
+
* Close the websocket connection without reconnection.
|
|
62
|
+
*/
|
|
63
|
+
close(): void;
|
|
64
|
+
/**
|
|
65
|
+
* Unsubscribe trajectory and deleted_vehicles channels. To resubscribe you have to set a new BBOX.
|
|
66
|
+
*/
|
|
67
|
+
reset(): void;
|
|
68
|
+
/** @ignore */
|
|
69
|
+
pingInterval: NodeJS.Timer;
|
|
70
|
+
/**
|
|
71
|
+
* Callback when the websocket is closed by the server.
|
|
72
|
+
* It auto reconnects after a timeout.
|
|
73
|
+
*/
|
|
74
|
+
onClose(): void;
|
|
75
|
+
/** @ignore */
|
|
76
|
+
reconnectTimeout: number;
|
|
77
|
+
/**
|
|
78
|
+
* Subscribe to a channel.
|
|
79
|
+
*
|
|
80
|
+
* @param {string} channel Name of the websocket channel to subscribe.
|
|
81
|
+
* @param {function} onSuccess Callback when the subscription succeeds.
|
|
82
|
+
* @param {function} onError Callback when the subscription fails.
|
|
83
|
+
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
84
|
+
* @private
|
|
85
|
+
*/
|
|
86
|
+
private subscribe;
|
|
87
|
+
/**
|
|
88
|
+
* Unsubscribe both modes of a channel.
|
|
89
|
+
*
|
|
90
|
+
* @param {string} channel Name of the websocket channel to unsubscribe.
|
|
91
|
+
* @param {string} suffix Suffix to add to the channel name.
|
|
92
|
+
* @param {function} cb Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
93
|
+
* @private
|
|
94
|
+
*/
|
|
95
|
+
private unsubscribe;
|
|
96
|
+
/**
|
|
97
|
+
* Filter departures and return an array.
|
|
98
|
+
*
|
|
99
|
+
* @param {Object} depObject The object containing departures by id.
|
|
100
|
+
* @param {boolean} [sortByMinArrivalTime=false] If true sort departures by arrival time.
|
|
101
|
+
* @return {Array<departure>} Return departures array.
|
|
102
|
+
* @private
|
|
103
|
+
*/
|
|
104
|
+
private filterDepartures;
|
|
105
|
+
/**
|
|
106
|
+
* Subscribe to departures channel of a given station.
|
|
107
|
+
*
|
|
108
|
+
* @param {number} stationId UIC of the station.
|
|
109
|
+
* @param {Boolean} sortByMinArrivalTime Sort by minimum arrival time
|
|
110
|
+
* @param {function(departures:Departure[])} onMessage Function called on each message of the channel.
|
|
111
|
+
*/
|
|
112
|
+
subscribeDepartures(stationId: number, sortByMinArrivalTime: boolean, onMessage: (arg0: departures, arg1: Departure[]) => any): void;
|
|
113
|
+
/**
|
|
114
|
+
* Unsubscribe from current departures channel.
|
|
115
|
+
* @param {function} cb Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
116
|
+
*/
|
|
117
|
+
unsubscribeDepartures(cb: Function): void;
|
|
118
|
+
/**
|
|
119
|
+
* Subscribe to the disruptions channel for tenant.
|
|
120
|
+
*
|
|
121
|
+
* @param {function} onMessage Function called on each message of the channel.
|
|
122
|
+
*/
|
|
123
|
+
subscribeDisruptions(onMessage: Function): void;
|
|
124
|
+
/**
|
|
125
|
+
* Unsubscribe disruptions.
|
|
126
|
+
* @param {function} cb Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
127
|
+
*/
|
|
128
|
+
unsubscribeDisruptions(cb: Function): void;
|
|
129
|
+
/**
|
|
130
|
+
* Return a station with a given uic number and a mode.
|
|
131
|
+
*
|
|
132
|
+
* @param {number} uic UIC of the station.
|
|
133
|
+
* @param {RealtimeMode} mode Realtime mode.
|
|
134
|
+
* @return {Promise<Station>} A station.
|
|
135
|
+
*/
|
|
136
|
+
getStation(uic: number, mode: RealtimeMode): Promise<Station>;
|
|
137
|
+
/**
|
|
138
|
+
* Update the model's station list for a given mode and a bbox.
|
|
139
|
+
*
|
|
140
|
+
* @param {RealtimeMode} mode Realtime mode.
|
|
141
|
+
* @return {Promise<Array<Station>>} An array of stations.
|
|
142
|
+
*/
|
|
143
|
+
getStations(mode: RealtimeMode): Promise<Array<Station>>;
|
|
144
|
+
/** @ignore */
|
|
145
|
+
stationUpdateTimeout: number;
|
|
146
|
+
/**
|
|
147
|
+
* Subscribe to stations channel.
|
|
148
|
+
* One message pro station.
|
|
149
|
+
*
|
|
150
|
+
* @param {RealtimeMode} mode Realtime mode.
|
|
151
|
+
* @param {function(station: Station)} onMessage Function called on each message of the channel.
|
|
152
|
+
*/
|
|
153
|
+
subscribeStations(mode: RealtimeMode, onMessage: (arg0: station, arg1: Station) => any): void;
|
|
154
|
+
/**
|
|
155
|
+
* Unsubscribe to stations channel.
|
|
156
|
+
* @param {function} cb The listener callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribe.
|
|
157
|
+
*/
|
|
158
|
+
unsubscribeStations(cb: Function): void;
|
|
159
|
+
/**
|
|
160
|
+
* Subscribe to extra_geoms channel.
|
|
161
|
+
*
|
|
162
|
+
* @param {function(extraGeoms: GeosJSONFeature[])} onMessage Function called on each message of the channel.
|
|
163
|
+
*/
|
|
164
|
+
subscribeExtraGeoms(onMessage: (arg0: extraGeoms, arg1: GeosJSONFeature[]) => any): void;
|
|
165
|
+
/**
|
|
166
|
+
* Unsubscribe to extra_geoms channel.
|
|
167
|
+
* @param {function} cb Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
168
|
+
*/
|
|
169
|
+
unsubscribeExtraGeoms(cb: Function): void;
|
|
170
|
+
/**
|
|
171
|
+
* Subscribe to trajectory channel.
|
|
172
|
+
*
|
|
173
|
+
* @param {RealtimeMode} mode Realtime mode.
|
|
174
|
+
* @param {function(trajectory: RealtimeTrajectory)} onMessage Function called on each message of the channel.
|
|
175
|
+
* @param {boolean} quiet If true, the subscription will not send GET and SUB requests to the websocket.
|
|
176
|
+
*/
|
|
177
|
+
subscribeTrajectory(mode: RealtimeMode, onMessage: (arg0: trajectory, arg1: RealtimeTrajectory) => any, quiet?: boolean): void;
|
|
178
|
+
/**
|
|
179
|
+
* Unsubscribe to trajectory channels.
|
|
180
|
+
* @param {function} cb Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
181
|
+
*/
|
|
182
|
+
unsubscribeTrajectory(cb: Function): void;
|
|
183
|
+
/**
|
|
184
|
+
* Subscribe to deleted_vhicles channel.
|
|
185
|
+
*
|
|
186
|
+
* @param {RealtimeMode} mode Realtime mode.
|
|
187
|
+
* @param {function(response: { content: Vehicle })} onMessage Function called on each message of the channel.
|
|
188
|
+
* @param {boolean} quiet If true, the subscription will not send GET and SUB requests to the websocket.
|
|
189
|
+
*/
|
|
190
|
+
subscribeDeletedVehicles(mode: RealtimeMode, onMessage: (arg0: response, arg1: {
|
|
191
|
+
content: Vehicle;
|
|
192
|
+
}) => any, quiet?: boolean): void;
|
|
193
|
+
/**
|
|
194
|
+
* Unsubscribe to deleted_vhicles channels.
|
|
195
|
+
* @param {function} cb Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
196
|
+
*/
|
|
197
|
+
unsubscribeDeletedVehicles(cb: Function): void;
|
|
198
|
+
/**
|
|
199
|
+
* Get a full trajectory of a vehicule .
|
|
200
|
+
*
|
|
201
|
+
* @param {string} id A vehicle id.
|
|
202
|
+
* @param {RealtimeMode} mode Realtime mode.
|
|
203
|
+
* @param {string} generalizationLevel The generalization level to request. Can be one of 5 (more generalized), 10, 30, 100, undefined (less generalized).
|
|
204
|
+
* @return {Promise<FullTrajectory>} Return a full trajectory.
|
|
205
|
+
*/
|
|
206
|
+
getFullTrajectory(id: string, mode: RealtimeMode, generalizationLevel: string): Promise<FullTrajectory>;
|
|
207
|
+
/**
|
|
208
|
+
* Get full trajectories of a vehicules .
|
|
209
|
+
*
|
|
210
|
+
* @param {string[]} ids List of vehicles ids.
|
|
211
|
+
* @param {RealtimeMode} mode Realtime mode.
|
|
212
|
+
* @param {string} generalizationLevel The generalization level to request. Can be one of '', 'gen5', 'gen10', 'gen30', 'gen100'.
|
|
213
|
+
* @return {Promise<Array<FullTrajectory>>} Return an array of full trajectories.
|
|
214
|
+
*/
|
|
215
|
+
getFullTrajectories(ids: string[], mode: RealtimeMode, generalizationLevel: string): Promise<Array<FullTrajectory>>;
|
|
216
|
+
/**
|
|
217
|
+
* Subscribe to full_trajectory channel of a given vehicle.
|
|
218
|
+
*
|
|
219
|
+
* @param {string} id A vehicle id.
|
|
220
|
+
* @param {RealtimeMode} mode Realtime mode.
|
|
221
|
+
*/
|
|
222
|
+
subscribeFullTrajectory(id: string, mode: RealtimeMode): void;
|
|
223
|
+
/**
|
|
224
|
+
* Unsubscribe from full_trajectory channel
|
|
225
|
+
*
|
|
226
|
+
* @param {string} id A vehicle id.
|
|
227
|
+
* @param {function} cb Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
228
|
+
*/
|
|
229
|
+
unsubscribeFullTrajectory(id: string, cb: Function): void;
|
|
230
|
+
/**
|
|
231
|
+
* Get the list of stops for this vehicle.
|
|
232
|
+
*
|
|
233
|
+
* @param {string} id A vehicle id.
|
|
234
|
+
* @return {Promise<StopSequence>} Returns a stop sequence object.
|
|
235
|
+
*/
|
|
236
|
+
getStopSequence(id: string): Promise<StopSequence>;
|
|
237
|
+
/**
|
|
238
|
+
* Get a list of stops for a list of vehicles.
|
|
239
|
+
*
|
|
240
|
+
* @param {string[]} ids List of vehicles ids.
|
|
241
|
+
* @return {Promise<Array<StopSequence>>} Return an array of stop sequences.
|
|
242
|
+
*/
|
|
243
|
+
getStopSequences(ids: string[]): Promise<Array<StopSequence>>;
|
|
244
|
+
/**
|
|
245
|
+
* Subscribe to stopsequence channel of a given vehicle.
|
|
246
|
+
*
|
|
247
|
+
* @param {string} id A vehicle id.
|
|
248
|
+
* @param {function(stopSequence: StopSequence)} onMessage Function called on each message of the channel.
|
|
249
|
+
*/
|
|
250
|
+
subscribeStopSequence(id: string, onMessage: (arg0: stopSequence, arg1: StopSequence) => any): void;
|
|
251
|
+
/**
|
|
252
|
+
* Unsubscribe from stopsequence channel
|
|
253
|
+
*
|
|
254
|
+
* @param {string} id A vehicle id.
|
|
255
|
+
* @param {function} cb Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
256
|
+
*/
|
|
257
|
+
unsubscribeStopSequence(id: string, cb: Function): void;
|
|
258
|
+
/**
|
|
259
|
+
* Subscribe to healthcheck channel.
|
|
260
|
+
* @param {function} onMessage Callback when the subscribe to healthcheck channel succeeds.
|
|
261
|
+
*/
|
|
262
|
+
subscribeHealthCheck(onMessage: Function): void;
|
|
263
|
+
/**
|
|
264
|
+
* Unsubscribe to healthcheck channel.
|
|
265
|
+
*/
|
|
266
|
+
unsubscribeHealthCheck(): void;
|
|
267
|
+
}
|
|
268
|
+
//# sourceMappingURL=RealtimeAPI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RealtimeAPI.d.ts","sourceRoot":"","sources":["../../src/api/RealtimeAPI.js"],"names":[],"mappings":";;;4BAYU,YAAY;;;;;;;;;;2BAJT,MAAM;AAYnB;;;;;;;;;;;;;;;GAeG;AACH;IACE;;;;;;;;;OASG;IACH,sBAPW,MAAO,MAAM,EA2BvB;IAjBC,cAAc;IACd,6BAAgC;IAEhC,cAAc;IACd,+BAAkC;IAElC,cAAc;IACd,wBAAyB;IAEzB,cAAc;IACd,eAAoB;IAEpB,cAAc;IACd,YAAkC;IAsHpC;;;OAGG;IACH,eAuBC;IA3ID,qCAoFC;IAED,aASC;IAED;;OAEG;IACH,cAEC;IAED;;OAEG;IAEH,cAEC;IAwBG,cAAc;IACd,2BAEuB;IAI3B;;;OAGG;IACH,gBAWC;IANG,cAAc;IACd,yBAGC;IAIL;;;;;;;;OAQG;IACH,kBAEC;IAED;;;;;;;OAOG;IACH,oBAcC;IAED;;;;;;;OAOG;IACH,yBAsDC;IAED;;;;;;OAMG;IACH,+BAJW,MAAM,qEAEc,SAAS,EAAE,gBA+BzC;IAED;;;OAGG;IACH,0CAKC;IAED;;;;OAIG;IACH,gDAIC;IAED;;;OAGG;IACH,2CAEC;IAED;;;;;;OAMG;IACH,gBAJW,MAAM,QACN,YAAY,GACX,QAAQ,OAAO,CAAC,CAiB3B;IAED;;;;;OAKG;IACH,kBAHW,YAAY,GACX,QAAQ,MAAM,OAAO,CAAC,CAAC,CAsBlC;IATO,cAAc;IACd,6BAEM;IAQd;;;;;;OAMG;IACH,wBAHW,YAAY,mCACM,OAAO,gBASnC;IAED;;;OAGG;IACH,wCAGC;IAED;;;;OAIG;IACH,wDAFgC,iBAAiB,gBAoBhD;IAED;;;OAGG;IACH,0CAEC;IAED;;;;;;OAMG;IACH,0BAJW,YAAY,sCACS,kBAAkB,kBACvC,OAAO,QAUjB;IAED;;;OAGG;IACH,0CAEC;IAED;;;;;;OAMG;IACH,+BAJW,YAAY,oCACO;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,kBACvC,OAAO,QAUjB;IAED;;;OAGG;IACH,+CAEC;IAED;;;;;;;OAOG;IACH,sBALW,MAAM,QACN,YAAY,uBACZ,MAAM,GACL,QAAQ,cAAc,CAAC,CAuBlC;IAED;;;;;;;OAOG;IACH,yBALW,MAAM,EAAE,QACR,YAAY,uBACZ,MAAM,GACL,QAAQ,MAAM,cAAc,CAAC,CAAC,CAOzC;IAED;;;;;OAKG;IACH,4BAHW,MAAM,QACN,YAAY,QAgBtB;IAED;;;;;OAKG;IACH,8BAHW,MAAM,sBAKhB;IAED;;;;;OAKG;IACH,oBAHW,MAAM,GACL,QAAQ,YAAY,CAAC,CAyBhC;IAED;;;;;OAKG;IACH,sBAHW,MAAM,EAAE,GACP,QAAQ,MAAM,YAAY,CAAC,CAAC,CAKvC;IAED;;;;;OAKG;IACH,0BAHW,MAAM,wCACiB,YAAY,gBAuB7C;IAED;;;;;OAKG;IACH,4BAHW,MAAM,sBAKhB;IAED;;;OAGG;IACH,gDAGC;IAED;;OAEG;IACH,+BAEC;CACF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import HttpAPI, { HttpApiOptions } from '../common/api/HttpAPI';
|
|
2
|
+
import { RoutingParameters, RoutingResponse } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Access to the [geOps Routing service](https://developer.geops.io/apis/routing).
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* import { RoutingAPI } from 'mobility-toolbox-js';
|
|
8
|
+
*
|
|
9
|
+
* const api = new RoutingAPI({
|
|
10
|
+
* apiKey: [yourApiKey]
|
|
11
|
+
* });
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
declare class RoutingAPI extends HttpAPI {
|
|
15
|
+
/**
|
|
16
|
+
* Constructor
|
|
17
|
+
*
|
|
18
|
+
* @param {RoutingAPIOptions} options Options.
|
|
19
|
+
* @param {string} [options.url='https://api.geops.io/routing/v1/'] Service url.
|
|
20
|
+
* @param {string} options.apiKey Access key for [geOps services](https://developer.geops.io/).
|
|
21
|
+
*/
|
|
22
|
+
constructor(options: HttpApiOptions);
|
|
23
|
+
/**
|
|
24
|
+
* Route.
|
|
25
|
+
*
|
|
26
|
+
* @param {RoutingParameters} params Request parameters. See [Routing service documentation](https://developer.geops.io/apis/routing/).
|
|
27
|
+
* @param {RequestInit} config Options for the fetch request.
|
|
28
|
+
* @return {Promise<RoutingResponse>} An GeoJSON feature collection with coordinates in [EPSG:4326](http://epsg.io/4326).
|
|
29
|
+
*/
|
|
30
|
+
route(params: RoutingParameters, config: RequestInit): Promise<RoutingResponse>;
|
|
31
|
+
}
|
|
32
|
+
export default RoutingAPI;
|
|
33
|
+
//# sourceMappingURL=RoutingAPI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RoutingAPI.d.ts","sourceRoot":"","sources":["../../src/api/RoutingAPI.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEjE;;;;;;;;;;GAUG;AACH,cAAM,UAAW,SAAQ,OAAO;IAC9B;;;;;;OAMG;gBACS,OAAO,EAAE,cAAc;IAOnC;;;;;;OAMG;IACH,KAAK,CACH,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,eAAe,CAAC;CAG5B;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export default StopsAPI;
|
|
2
|
+
/**
|
|
3
|
+
* Access to the [Stops service](https://developer.geops.io/apis/5dcbd702a256d90001cf1361/).
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* import { StopsAPI } from 'mobility-toolbox-js/api';
|
|
7
|
+
*
|
|
8
|
+
* const api = new StopsAPI({
|
|
9
|
+
* url: 'https://api.geops.io/stops/v1/',
|
|
10
|
+
* apiKey: [yourApiKey]
|
|
11
|
+
* });
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
declare class StopsAPI extends HttpAPI {
|
|
15
|
+
/**
|
|
16
|
+
* Constructor
|
|
17
|
+
*
|
|
18
|
+
* @param {Object} options Options.
|
|
19
|
+
* @param {string} [options.url='https://api.geops.io/stops/v1/'] Service url.
|
|
20
|
+
* @param {string} options.apiKey Access key for [geOps services](https://developer.geops.io/).
|
|
21
|
+
*/
|
|
22
|
+
constructor(options?: {
|
|
23
|
+
url?: string;
|
|
24
|
+
apiKey: string;
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* Search.
|
|
28
|
+
*
|
|
29
|
+
* @param {StopsSearchParams} params Request parameters. See [Stops service documentation](https://developer.geops.io/apis/5dcbd702a256d90001cf1361/).
|
|
30
|
+
* @param {AbortController} abortController Abort controller used to cancel the request.
|
|
31
|
+
* @return {Promise<GeoJSONFeatureCollection>} An GeoJSON feature collection with coordinates in [EPSG:4326](http://epsg.io/4326).
|
|
32
|
+
*/
|
|
33
|
+
search(params: StopsSearchParams, abortController?: AbortController): Promise<GeoJSONFeatureCollection>;
|
|
34
|
+
}
|
|
35
|
+
import HttpAPI from "../common/api/HttpAPI";
|
|
36
|
+
//# sourceMappingURL=StopsAPI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StopsAPI.d.ts","sourceRoot":"","sources":["../../src/api/StopsAPI.js"],"names":[],"mappings":";AAEA;;;;;;;;;;;GAWG;AACH;IACE;;;;;;OAMG;IACH;QAH4B,GAAG,GAApB,MAAM;QACU,MAAM,EAAtB,MAAM;OAIhB;IAED;;;;;;OAMG;IACH,oDAHW,eAAe,GACd,iCAAiC,CAM5C;CACF"}
|
package/api/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,GAAG,CAAC;AAEnB,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
type Departure = {
|
|
2
|
+
/**
|
|
3
|
+
* Timestamp in ms.
|
|
4
|
+
*/
|
|
5
|
+
time: number;
|
|
6
|
+
no_stop_between: boolean;
|
|
7
|
+
train_number: number;
|
|
8
|
+
to: string[];
|
|
9
|
+
/**
|
|
10
|
+
* Timestamp in ms.
|
|
11
|
+
*/
|
|
12
|
+
ris_aimed_time: number;
|
|
13
|
+
/**
|
|
14
|
+
* Timestamp in ms.
|
|
15
|
+
*/
|
|
16
|
+
updated_at: number;
|
|
17
|
+
new_to: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Timestamp in ms.
|
|
20
|
+
*/
|
|
21
|
+
min_arrival_time: number;
|
|
22
|
+
/**
|
|
23
|
+
* List of next stops. Like value in at_station_ds100.
|
|
24
|
+
*/
|
|
25
|
+
next_stoppoints: string[];
|
|
26
|
+
/**
|
|
27
|
+
* Timestamp in ms.
|
|
28
|
+
*/
|
|
29
|
+
ris_estimated_time: number;
|
|
30
|
+
line: NetworkLine;
|
|
31
|
+
/**
|
|
32
|
+
* if true this departure has realtime data.
|
|
33
|
+
*/
|
|
34
|
+
has_fzo: boolean;
|
|
35
|
+
train_id: number;
|
|
36
|
+
platform: string;
|
|
37
|
+
state: any | null;
|
|
38
|
+
/**
|
|
39
|
+
* Timestamp in ms.
|
|
40
|
+
*/
|
|
41
|
+
fzo_estimated_time: number;
|
|
42
|
+
formation: any | null;
|
|
43
|
+
no_stop_till: any | null;
|
|
44
|
+
train_type: number;
|
|
45
|
+
call_id: number;
|
|
46
|
+
/**
|
|
47
|
+
* Timestamp in ms.
|
|
48
|
+
*/
|
|
49
|
+
created_at: string;
|
|
50
|
+
at_station_ds100: string;
|
|
51
|
+
/**
|
|
52
|
+
* Timestamp in ms.
|
|
53
|
+
*/
|
|
54
|
+
timediff: number;
|
|
55
|
+
};
|
|
56
|
+
type Station = GeoJSONFeature;
|
|
57
|
+
type StationProperties = {
|
|
58
|
+
transfers: Transfer[];
|
|
59
|
+
elevatorOutOfOrder: boolean;
|
|
60
|
+
uic: number;
|
|
61
|
+
name: string;
|
|
62
|
+
networkLines: NetworkLine[];
|
|
63
|
+
hasElevator: boolean;
|
|
64
|
+
hasZOB: boolean;
|
|
65
|
+
hasAccessibility: boolean;
|
|
66
|
+
type: string;
|
|
67
|
+
};
|
|
68
|
+
type NetworkLine = {
|
|
69
|
+
/**
|
|
70
|
+
* Identifier of the line.
|
|
71
|
+
*/
|
|
72
|
+
id: number;
|
|
73
|
+
/**
|
|
74
|
+
* Color of the line (CSS color string).
|
|
75
|
+
*/
|
|
76
|
+
color: string;
|
|
77
|
+
/**
|
|
78
|
+
* Stroke color of the line (CSS color string).
|
|
79
|
+
*/
|
|
80
|
+
stroke: string;
|
|
81
|
+
/**
|
|
82
|
+
* Name of the line.
|
|
83
|
+
*/
|
|
84
|
+
name: string;
|
|
85
|
+
/**
|
|
86
|
+
* Text color of the line (CSS color string).
|
|
87
|
+
*/
|
|
88
|
+
text_color: string;
|
|
89
|
+
};
|
|
90
|
+
type Transfer = {
|
|
91
|
+
/**
|
|
92
|
+
* Mode of transportation (ex: U-Bahn).
|
|
93
|
+
*/
|
|
94
|
+
mot: string;
|
|
95
|
+
/**
|
|
96
|
+
* Array of lines name (ex: ["U4", "U5"]).
|
|
97
|
+
*/
|
|
98
|
+
lines: string[];
|
|
99
|
+
};
|
|
100
|
+
type StopSequence = GeoJSONFeature;
|
|
101
|
+
type RealtimeTrajectory = GeoJSONFeature;
|
|
102
|
+
type FullTrajectory = GeoJSONFeature;
|
|
103
|
+
type Vehicle = GeoJSONFeature;
|
|
104
|
+
type ExtraGeom = GeoJSONFeature;
|
|
105
|
+
//# sourceMappingURL=typedefs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typedefs.d.ts","sourceRoot":"","sources":["../../src/api/typedefs.js"],"names":[],"mappings":";;;;UAEc,MAAM;qBACN,OAAO;kBACP,MAAM;QACN,MAAM,EAAE;;;;oBACR,MAAM;;;;gBACN,MAAM;YACN,OAAO;;;;sBACP,MAAM;;;;qBACN,MAAM,EAAE;;;;wBACR,MAAM;UACN,WAAW;;;;aACX,OAAO;cACP,MAAM;cACN,MAAM;;;;;wBAEN,MAAM;;;gBAGN,MAAM;aACN,MAAM;;;;gBACN,MAAM;sBACN,MAAM;;;;cACN,MAAM;;;;eAYN,QAAQ,EAAE;wBACV,OAAO;SACP,MAAM;UACN,MAAM;kBACN,WAAW,EAAE;iBACb,OAAO;YACP,OAAO;sBACP,OAAO;UACP,MAAM;;;;;;QAKN,MAAM;;;;WACN,MAAM;;;;YACN,MAAM;;;;UACN,MAAM;;;;gBACN,MAAM;;;;;;SAKN,MAAM;;;;WACN,MAAM,EAAE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import BaseObject from 'ol/Object';
|
|
2
|
+
export declare type HttpApiOptions = {
|
|
3
|
+
url?: string;
|
|
4
|
+
apiKey?: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Common class to access to a geOps api using http.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* import { API } from 'mobility-toolbox-js/api';
|
|
11
|
+
*
|
|
12
|
+
* const api = new HttpApi({
|
|
13
|
+
* url: [yourUrl],
|
|
14
|
+
* apiKey: [yourApiKey]
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* @classproperty {string} url Url of the service.
|
|
18
|
+
* @classproperty {string} apiKey Api key to access the service.
|
|
19
|
+
*/
|
|
20
|
+
declare class HttpAPI extends BaseObject {
|
|
21
|
+
url?: string;
|
|
22
|
+
apiKey?: string;
|
|
23
|
+
constructor(options: HttpApiOptions);
|
|
24
|
+
/**
|
|
25
|
+
* Append the apiKey before sending the request.
|
|
26
|
+
* @ignore
|
|
27
|
+
*/
|
|
28
|
+
fetch(path: string, params: Object, config: RequestInit): Promise<any>;
|
|
29
|
+
}
|
|
30
|
+
export default HttpAPI;
|
|
31
|
+
//# sourceMappingURL=HttpAPI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpAPI.d.ts","sourceRoot":"","sources":["../../../src/common/api/HttpAPI.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,WAAW,CAAC;AAGnC,oBAAY,cAAc,GAAG;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AACF;;;;;;;;;;;;;GAaG;AACH,cAAM,OAAQ,SAAQ,UAAU;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;gBAEJ,OAAO,EAAE,cAAc;IASnC;;;OAGG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC;CA6BvE;AAED,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
export default WebSocketAPI;
|
|
2
|
+
/**
|
|
3
|
+
* Class used to facilitate connection to a WebSocket and
|
|
4
|
+
* also to manage properly messages send to the WebSocket.
|
|
5
|
+
* This class must not contain any specific implementation.
|
|
6
|
+
*/
|
|
7
|
+
declare class WebSocketAPI {
|
|
8
|
+
/**
|
|
9
|
+
* Get the websocket request string.
|
|
10
|
+
*
|
|
11
|
+
* @param {string} method Request mehtod {GET, SUB}.
|
|
12
|
+
* @param {Object} params Request parameters.
|
|
13
|
+
* @param {string} params.channel Channel name
|
|
14
|
+
* @param {string} [params.args] Request arguments
|
|
15
|
+
* @param {Number} [params.id] Request identifier
|
|
16
|
+
* @return {string} request string
|
|
17
|
+
* @private
|
|
18
|
+
*/
|
|
19
|
+
private static getRequestString;
|
|
20
|
+
defineProperties(): void;
|
|
21
|
+
/**
|
|
22
|
+
* (Re)connect the websocket.
|
|
23
|
+
*
|
|
24
|
+
* @param {strin} url Websocket url.
|
|
25
|
+
* @param {function} onOpen Callback called when the websocket connection is opened and before subscriptions of previous subscriptions.
|
|
26
|
+
* @private
|
|
27
|
+
*/
|
|
28
|
+
private connect;
|
|
29
|
+
/** @ignore */
|
|
30
|
+
websocket: WebSocket;
|
|
31
|
+
/**
|
|
32
|
+
* Close the websocket definitively.
|
|
33
|
+
*
|
|
34
|
+
* @private
|
|
35
|
+
*/
|
|
36
|
+
private close;
|
|
37
|
+
messagesOnOpen: any[];
|
|
38
|
+
/**
|
|
39
|
+
* Sends a message to the websocket.
|
|
40
|
+
*
|
|
41
|
+
* @param {message} message Message to send.
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
private send;
|
|
45
|
+
/**
|
|
46
|
+
* Listen to websocket messages.
|
|
47
|
+
*
|
|
48
|
+
* @param {Object} params Parameters for the websocket get request
|
|
49
|
+
* @param {function} cb callback on listen
|
|
50
|
+
* @param {function} errorCb Callback on error
|
|
51
|
+
* @return {{onMessage: function, errorCb: function}} Object with onMessage and error callbacks
|
|
52
|
+
* @private
|
|
53
|
+
*/
|
|
54
|
+
private listen;
|
|
55
|
+
/**
|
|
56
|
+
* Unlisten websocket messages.
|
|
57
|
+
*
|
|
58
|
+
* @param {Object} params Parameters for the websocket get request.
|
|
59
|
+
* @param {function} cb Callback used when listen.
|
|
60
|
+
* @private
|
|
61
|
+
*/
|
|
62
|
+
private unlisten;
|
|
63
|
+
/**
|
|
64
|
+
* Sends a get request to the websocket.
|
|
65
|
+
*
|
|
66
|
+
* @param {Object} params Parameters for the websocket get request
|
|
67
|
+
* @param {function} cb callback on listen
|
|
68
|
+
* @param {function} errorCb Callback on error
|
|
69
|
+
* @private
|
|
70
|
+
*/
|
|
71
|
+
private get;
|
|
72
|
+
/**
|
|
73
|
+
* Subscribe to a given channel.
|
|
74
|
+
*
|
|
75
|
+
* @param {Object} params Parameters for the websocket get request
|
|
76
|
+
* @param {function} cb callback on listen
|
|
77
|
+
* @param {function} errorCb Callback on error
|
|
78
|
+
* @param {boolean} quiet if false, no GET or SUB requests are send, only the callback is registered.
|
|
79
|
+
* @private
|
|
80
|
+
*/
|
|
81
|
+
private subscribe;
|
|
82
|
+
/**
|
|
83
|
+
* Unsubscribe from a channel.
|
|
84
|
+
* @param {string} source source to unsubscribe from
|
|
85
|
+
* @param {function} cb Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
86
|
+
* @private
|
|
87
|
+
*/
|
|
88
|
+
private unsubscribe;
|
|
89
|
+
subscriptions: any;
|
|
90
|
+
/**
|
|
91
|
+
* After an auto reconnection we need to re-subscribe to the channels.
|
|
92
|
+
*/
|
|
93
|
+
subscribePreviousSubscriptions(): void;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=WebSocketAPI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebSocketAPI.d.ts","sourceRoot":"","sources":["../../../src/common/api/WebSocketAPI.js"],"names":[],"mappings":";AAAA;;;;GAIG;AACH;IAiEE;;;;;;;;;;OAUG;IACH,gCAKC;IA5ED,yBA0DC;IAoBD;;;;;;OAMG;IACH,gBAiBC;IAZC,cAAc;IACd,qBAAmC;IAarC;;;;OAIG;IACH,cAOC;IAFG,sBAAwB;IAI5B;;;;;OAKG;IACH,aAsBC;IAED;;;;;;;;OAQG;IACH,eAsCC;IAED;;;;;;OAMG;IACH,iBAiBC;IAED;;;;;;;OAOG;IACH,YAIC;IAED;;;;;;;;OAQG;IACH,kBAqBC;IAED;;;;;OAKG;IACH,oBA8BC;IAfC,mBAEC;IAeH;;OAEG;IACH,uCAYC;CACF"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export default Control;
|
|
2
|
+
/**
|
|
3
|
+
* A class representing a control to display on map.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* const control = new Control();
|
|
7
|
+
*
|
|
8
|
+
* @classproperty {ol/Map~Map|mapboxgl.Map} map - The map which the control refers to.
|
|
9
|
+
* @classproperty {boolean} active - Active the control.
|
|
10
|
+
* @classproperty {HTMLElement} element - The HTML element used to render the control.
|
|
11
|
+
* @classproperty {HTMLElement} target - The HTML element where to render the element property. Default is the map's element. Read only.
|
|
12
|
+
*/
|
|
13
|
+
declare class Control extends BaseObject {
|
|
14
|
+
/**
|
|
15
|
+
* Constructor
|
|
16
|
+
*
|
|
17
|
+
* @param {Object} [options] Control options.
|
|
18
|
+
* @param {boolean} [options.active = true] Whether the control is active or not.
|
|
19
|
+
* @param {HTMLElement} [options.element] The HTML element used to render the control.
|
|
20
|
+
* @param {HTMLElement} [options.target] The HTML element where to render the element property. Default is the map's element.
|
|
21
|
+
* @param {function} [options.render] Render function called whenever the control needs to be rerendered.
|
|
22
|
+
*/
|
|
23
|
+
constructor(options?: {
|
|
24
|
+
active?: boolean;
|
|
25
|
+
element?: HTMLElement;
|
|
26
|
+
target?: HTMLElement;
|
|
27
|
+
render?: Function;
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* @ignore
|
|
31
|
+
*/
|
|
32
|
+
active: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Define control's properties.
|
|
35
|
+
*
|
|
36
|
+
* @private
|
|
37
|
+
*/
|
|
38
|
+
private defineProperties;
|
|
39
|
+
/**
|
|
40
|
+
* Attach the control to the map. Add events, html element ...
|
|
41
|
+
*/
|
|
42
|
+
attachToMap(map: any): void;
|
|
43
|
+
map: any;
|
|
44
|
+
/**
|
|
45
|
+
* Detach the control From the map. Remove events, html element ..
|
|
46
|
+
*/
|
|
47
|
+
detachFromMap(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Add listeners then renders the control.
|
|
50
|
+
* To be defined in inherited classes.
|
|
51
|
+
*/
|
|
52
|
+
activate(): void;
|
|
53
|
+
/**
|
|
54
|
+
* Remove listeners added by activate() function then renders the control.
|
|
55
|
+
* To be defined in inherited classes.
|
|
56
|
+
*/
|
|
57
|
+
deactivate(): void;
|
|
58
|
+
/**
|
|
59
|
+
* The default render function. It renders content in the HTML element.
|
|
60
|
+
* To be defined in inherited classes.
|
|
61
|
+
*
|
|
62
|
+
* @private
|
|
63
|
+
*/
|
|
64
|
+
private render;
|
|
65
|
+
/**
|
|
66
|
+
* The default element to display if this.element is not defined.
|
|
67
|
+
* To be defined in inherited classes.
|
|
68
|
+
*
|
|
69
|
+
* @private
|
|
70
|
+
*/
|
|
71
|
+
private createDefaultElement;
|
|
72
|
+
}
|
|
73
|
+
import BaseObject from "ol/Object";
|
|
74
|
+
//# sourceMappingURL=Control.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Control.d.ts","sourceRoot":"","sources":["../../../src/common/controls/Control.js"],"names":[],"mappings":";AAEA;;;;;;;;;;GAUG;AACH;IACE;;;;;;;;OAQG;IACH;QAL6B,MAAM,GAAxB,OAAO;QACe,OAAO,GAA7B,WAAW;QACW,MAAM,GAA5B,WAAW;QACQ,MAAM;OAenC;IAJC;;OAEG;IACH,gBAAoB;IAGtB;;;;OAIG;IACH,yBAmEC;IAED;;OAEG;IACH,4BAEC;IADC,SAAc;IAGhB;;OAEG;IACH,sBAEC;IAED;;;OAGG;IACH,iBAEC;IAED;;;OAGG;IAEH,mBAAe;IAEf;;;;;OAKG;IACH,eAAW;IAEX;;;;;OAKG;IAEH,6BAAyB;CAC1B"}
|