mobility-toolbox-js 1.6.4-beta.1 → 1.6.4-beta.2
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/routing/RoutingAPI.js +1 -1
- package/api/stops/StopsAPI.js +1 -1
- package/api/trajserv/TrajservAPI.js +3 -3
- package/api/trajserv/TrajservAPIUtils.js +3 -3
- package/api/tralis/TralisAPI.js +30 -20
- package/api/tralis/TralisAPI.test.js +75 -0
- package/api/tralis/WebSocketConnector.js +2 -2
- package/common/Tracker.js +17 -5
- package/common/layers/Layer.js +5 -5
- package/common/mixins/CopyrightMixin.js +1 -1
- package/common/mixins/MapMixin.js +3 -3
- package/common/mixins/SearchMixin.js +1 -1
- package/common/mixins/TrackerLayerMixin.js +4 -7
- package/common/mixins/TrajservLayerMixin.js +1 -1
- package/common/mixins/TralisLayerMixin.js +203 -130
- package/common/utils/delayTrackerStyle.js +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/mapbox/layers/Layer.js +1 -1
- package/mapbox/layers/TrackerLayer.js +1 -1
- package/mapbox/layers/TrajservLayer.js +1 -1
- package/mapbox/layers/TralisLayer.js +1 -14
- package/ol/layers/Layer.js +1 -1
- package/ol/layers/MapboxLayer.js +2 -2
- package/ol/layers/MapboxStyleLayer.js +2 -2
- package/ol/layers/RoutingLayer.js +1 -1
- package/ol/layers/TrackerLayer.js +2 -2
- package/ol/layers/TrajservLayer.js +2 -2
- package/ol/layers/TralisLayer.js +19 -18
- package/ol/layers/VectorLayer.js +2 -2
- package/ol/layers/WMSLayer.js +3 -3
- package/package.json +1 -1
|
@@ -32,7 +32,7 @@ class RoutingAPI extends API {
|
|
|
32
32
|
*
|
|
33
33
|
* @param {RoutingSearchParams} params Request parameters. See [Routing service documentation](https://developer.geops.io/apis/routing/).
|
|
34
34
|
* @param {AbortController} abortController Abort controller used to cancel the request.
|
|
35
|
-
* @
|
|
35
|
+
* @return {Promise<GeoJSONFeatureCollection>} An GeoJSON feature collection with coordinates in [EPSG:4326](http://epsg.io/4326).
|
|
36
36
|
*/
|
|
37
37
|
route(params, abortController = new AbortController()) {
|
|
38
38
|
return this.fetch('', params, {
|
package/api/stops/StopsAPI.js
CHANGED
|
@@ -29,7 +29,7 @@ class StopsAPI extends API {
|
|
|
29
29
|
*
|
|
30
30
|
* @param {StopsSearchParams} params Request parameters. See [Stops service documentation](https://developer.geops.io/apis/5dcbd702a256d90001cf1361/).
|
|
31
31
|
* @param {AbortController} abortController Abort controller used to cancel the request.
|
|
32
|
-
* @
|
|
32
|
+
* @return {Promise<Array<GeoJSONFeature>>} An array of GeoJSON features with coordinates in [EPSG:4326](http://epsg.io/4326).
|
|
33
33
|
*/
|
|
34
34
|
search(params, abortController = {}) {
|
|
35
35
|
return this.fetch('', params, {
|
|
@@ -33,7 +33,7 @@ class TrajservAPI extends API {
|
|
|
33
33
|
*
|
|
34
34
|
* @param {GetTrajectoryByIdParams} params Request parameters. See [Realtime service documentation](https://developer.geops.io/apis/5dcbd5c9a256d90001cf1360/#/default/get_trajectorybyid).
|
|
35
35
|
* @param {AbortController} abortController Abort controller used to cancel the request.
|
|
36
|
-
* @
|
|
36
|
+
* @return {Promise<TrajservTrajectory>} A trajectory.
|
|
37
37
|
*/
|
|
38
38
|
fetchTrajectoryById(params, abortController = {}) {
|
|
39
39
|
return this.fetch(`/trajectorybyid`, params, {
|
|
@@ -46,7 +46,7 @@ class TrajservAPI extends API {
|
|
|
46
46
|
*
|
|
47
47
|
* @param {GetTrajectoriesParams} params Request parameters. See [Realtime service documentation](https://developer.geops.io/apis/5dcbd5c9a256d90001cf1360/#/default/get_trajectory_collection).
|
|
48
48
|
* @param {AbortController} abortController Abort controller used to cancel the request.
|
|
49
|
-
* @
|
|
49
|
+
* @return {Promise<Array<Trajectory>>} A list of trajectories.
|
|
50
50
|
*/
|
|
51
51
|
fetchTrajectories(params, abortController = {}) {
|
|
52
52
|
return this.fetch(`/trajectory_collection`, params, {
|
|
@@ -61,7 +61,7 @@ class TrajservAPI extends API {
|
|
|
61
61
|
*
|
|
62
62
|
* @param {GetTrajectoryStationsParams} params Request parameters. See [Realtime service documentation](https://developer.geops.io/apis/5dcbd5c9a256d90001cf1360/#/default/get_trajstations).
|
|
63
63
|
* @param {AbortController} abortController Abort controller used to cancel the request.
|
|
64
|
-
* @
|
|
64
|
+
* @return {Promise<Array<TrajectoryStation>>} A list of stations.
|
|
65
65
|
*/
|
|
66
66
|
fetchTrajectoryStations(params, abortController = {}) {
|
|
67
67
|
return this.fetch(`/trajstations`, params, {
|
|
@@ -2,7 +2,7 @@ import { LineString } from 'ol/geom';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Translate the response date object into a readable object.
|
|
5
|
-
* @
|
|
5
|
+
* @return {Date[]}
|
|
6
6
|
* @ignore
|
|
7
7
|
*/
|
|
8
8
|
const translateDates = (dates = []) => {
|
|
@@ -21,7 +21,7 @@ const translateDates = (dates = []) => {
|
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Translate the trajstations response into a readable object.
|
|
24
|
-
* @
|
|
24
|
+
* @return {Object} returns a readable object
|
|
25
25
|
* @private
|
|
26
26
|
*/
|
|
27
27
|
export const translateTrajStationsResp = (data) => {
|
|
@@ -125,7 +125,7 @@ export const translateTrajStationsResp = (data) => {
|
|
|
125
125
|
|
|
126
126
|
/**
|
|
127
127
|
* Translate the trajectory_collection response into a js usable object.
|
|
128
|
-
* @
|
|
128
|
+
* @return {Array} returns an array of trajectories.
|
|
129
129
|
* @ignore
|
|
130
130
|
*/
|
|
131
131
|
export const translateTrajCollResponse = (features = []) => {
|
package/api/tralis/TralisAPI.js
CHANGED
|
@@ -64,8 +64,6 @@ class TralisAPI {
|
|
|
64
64
|
|
|
65
65
|
/** @ignore */
|
|
66
66
|
this.prefix = options.prefix || '';
|
|
67
|
-
|
|
68
|
-
this.isUpdateBboxOnMoveEnd = options.isUpdateBboxOnMoveEnd || false;
|
|
69
67
|
}
|
|
70
68
|
|
|
71
69
|
defineProperties(options) {
|
|
@@ -80,7 +78,7 @@ class TralisAPI {
|
|
|
80
78
|
const conn = new WebSocketConnector();
|
|
81
79
|
|
|
82
80
|
if (apiKey) {
|
|
83
|
-
url = `${url}?key=${apiKey}`;
|
|
81
|
+
url = `${url || 'wss://tralis-tracker-api.geops.io/ws'}?key=${apiKey}`;
|
|
84
82
|
}
|
|
85
83
|
|
|
86
84
|
Object.defineProperties(this, {
|
|
@@ -202,7 +200,7 @@ class TralisAPI {
|
|
|
202
200
|
window.clearInterval(this.pingInterval);
|
|
203
201
|
/** @ignore */
|
|
204
202
|
this.pingInterval = setInterval(() => {
|
|
205
|
-
this.send('PING');
|
|
203
|
+
this.conn.send('PING');
|
|
206
204
|
}, this.pingIntervalMs);
|
|
207
205
|
}
|
|
208
206
|
}
|
|
@@ -264,7 +262,7 @@ class TralisAPI {
|
|
|
264
262
|
*
|
|
265
263
|
* @param {Object} depObject The object containing departures by id.
|
|
266
264
|
* @param {boolean} [sortByMinArrivalTime=false] If true sort departures by arrival time.
|
|
267
|
-
* @
|
|
265
|
+
* @return {Array<departure>} Return departures array.
|
|
268
266
|
* @private
|
|
269
267
|
*/
|
|
270
268
|
filterDepartures(depObject, sortByMinArrivalTime = false) {
|
|
@@ -396,7 +394,7 @@ class TralisAPI {
|
|
|
396
394
|
*
|
|
397
395
|
* @param {number} uic UIC of the station.
|
|
398
396
|
* @param {TralisMode} mode Tralis mode.
|
|
399
|
-
* @
|
|
397
|
+
* @return {Promise<Station>} A station.
|
|
400
398
|
*/
|
|
401
399
|
getStation(uic, mode) {
|
|
402
400
|
const params = {
|
|
@@ -419,7 +417,7 @@ class TralisAPI {
|
|
|
419
417
|
* Update the model's station list for a given mode and a bbox.
|
|
420
418
|
*
|
|
421
419
|
* @param {TralisMode} mode Tralis mode.
|
|
422
|
-
* @
|
|
420
|
+
* @return {Promise<Array<Station>>} An array of stations.
|
|
423
421
|
*/
|
|
424
422
|
getStations(mode) {
|
|
425
423
|
const stations = [];
|
|
@@ -448,7 +446,6 @@ class TralisAPI {
|
|
|
448
446
|
* One message pro station.
|
|
449
447
|
*
|
|
450
448
|
* @param {TralisMode} mode Tralis mode.
|
|
451
|
-
* @param {number[4]} bbox The extent where to request.
|
|
452
449
|
* @param {function(station: Station)} onMessage Function called on each message of the channel.
|
|
453
450
|
*/
|
|
454
451
|
subscribeStations(mode, onMessage) {
|
|
@@ -507,14 +504,15 @@ class TralisAPI {
|
|
|
507
504
|
*
|
|
508
505
|
* @param {TralisMode} mode Tralis mode.
|
|
509
506
|
* @param {function(trajectory: TralisTrajectory)} onMessage Function called on each message of the channel.
|
|
507
|
+
* @param {boolean} quiet If true, the subscription will not send GET and SUB requests to the websocket.
|
|
510
508
|
*/
|
|
511
|
-
subscribeTrajectory(mode, onMessage) {
|
|
509
|
+
subscribeTrajectory(mode, onMessage, quiet = false) {
|
|
512
510
|
this.unsubscribeTrajectory(onMessage);
|
|
513
511
|
this.subscribe(
|
|
514
512
|
`trajectory${getModeSuffix(mode, TralisModes)}`,
|
|
515
513
|
onMessage,
|
|
516
514
|
null,
|
|
517
|
-
|
|
515
|
+
quiet,
|
|
518
516
|
);
|
|
519
517
|
}
|
|
520
518
|
|
|
@@ -531,14 +529,15 @@ class TralisAPI {
|
|
|
531
529
|
*
|
|
532
530
|
* @param {TralisMode} mode Tralis mode.
|
|
533
531
|
* @param {function(response: { content: Vehicle })} onMessage Function called on each message of the channel.
|
|
532
|
+
* @param {boolean} quiet If true, the subscription will not send GET and SUB requests to the websocket.
|
|
534
533
|
*/
|
|
535
|
-
subscribeDeletedVehicles(mode, onMessage) {
|
|
534
|
+
subscribeDeletedVehicles(mode, onMessage, quiet = false) {
|
|
536
535
|
this.unsubscribeDeletedVehicles(onMessage);
|
|
537
536
|
this.subscribe(
|
|
538
537
|
`deleted_vehicles${getModeSuffix(mode, TralisModes)}`,
|
|
539
538
|
onMessage,
|
|
540
539
|
null,
|
|
541
|
-
|
|
540
|
+
quiet,
|
|
542
541
|
);
|
|
543
542
|
}
|
|
544
543
|
|
|
@@ -555,11 +554,21 @@ class TralisAPI {
|
|
|
555
554
|
*
|
|
556
555
|
* @param {string} id A vehicle id.
|
|
557
556
|
* @param {TralisMode} mode Tralis mode.
|
|
558
|
-
* @
|
|
557
|
+
* @param {string} generalizationLevel The generalization level to request. Can be one of 5 (more generalized), 10, 30, 100, undefined (less generalized).
|
|
558
|
+
* @return {Promise<FullTrajectory>} Return a full trajectory.
|
|
559
559
|
*/
|
|
560
|
-
getFullTrajectory(id, mode) {
|
|
560
|
+
getFullTrajectory(id, mode, generalizationLevel) {
|
|
561
|
+
const channel = [`full_trajectory${getModeSuffix(mode, TralisModes)}`];
|
|
562
|
+
if (id) {
|
|
563
|
+
channel.push(id);
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
if ((!mode || mode === TralisModes.TOPOGRAPHIC) && generalizationLevel) {
|
|
567
|
+
channel.push(`gen${generalizationLevel}`);
|
|
568
|
+
}
|
|
569
|
+
|
|
561
570
|
const params = {
|
|
562
|
-
channel:
|
|
571
|
+
channel: channel.join('_'),
|
|
563
572
|
};
|
|
564
573
|
|
|
565
574
|
return new Promise((resolve) => {
|
|
@@ -576,11 +585,12 @@ class TralisAPI {
|
|
|
576
585
|
*
|
|
577
586
|
* @param {string[]} ids List of vehicles ids.
|
|
578
587
|
* @param {TralisMode} mode Tralis mode.
|
|
579
|
-
* @
|
|
588
|
+
* @param {string} generalizationLevel The generalization level to request. Can be one of '', 'gen5', 'gen10', 'gen30', 'gen100'.
|
|
589
|
+
* @return {Promise<Array<FullTrajectory>>} Return an array of full trajectories.
|
|
580
590
|
*/
|
|
581
|
-
getFullTrajectories(ids, mode) {
|
|
591
|
+
getFullTrajectories(ids, mode, generalizationLevel) {
|
|
582
592
|
const promises = ids.map((id) => {
|
|
583
|
-
return this.getFullTrajectory(id, mode);
|
|
593
|
+
return this.getFullTrajectory(id, mode, generalizationLevel);
|
|
584
594
|
});
|
|
585
595
|
return Promise.all(promises);
|
|
586
596
|
}
|
|
@@ -621,7 +631,7 @@ class TralisAPI {
|
|
|
621
631
|
* Get the list of stops for this vehicle.
|
|
622
632
|
*
|
|
623
633
|
* @param {string} id A vehicle id.
|
|
624
|
-
* @
|
|
634
|
+
* @return {Promise<StopSequence>} Returns a stop sequence object.
|
|
625
635
|
*/
|
|
626
636
|
getStopSequence(id) {
|
|
627
637
|
const params = {
|
|
@@ -652,7 +662,7 @@ class TralisAPI {
|
|
|
652
662
|
* Get a list of stops for a list of vehicles.
|
|
653
663
|
*
|
|
654
664
|
* @param {string[]} ids List of vehicles ids.
|
|
655
|
-
* @
|
|
665
|
+
* @return {Promise<Array<StopSequence>>} Return an array of stop sequences.
|
|
656
666
|
*/
|
|
657
667
|
getStopSequences(ids) {
|
|
658
668
|
const promises = ids.map((id) => {
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { TralisAPI, TralisModes } from '..';
|
|
2
|
+
|
|
3
|
+
describe('TralisAPI', () => {
|
|
4
|
+
let tralisAPI;
|
|
5
|
+
let get;
|
|
6
|
+
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
get = jest.fn((params, cb) => {
|
|
9
|
+
cb({ content: 'content' });
|
|
10
|
+
});
|
|
11
|
+
tralisAPI = new TralisAPI();
|
|
12
|
+
tralisAPI.conn = {
|
|
13
|
+
get,
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
describe('#getFullTrajectory() calls fullTrajectory channel', () => {
|
|
18
|
+
test('without parameters', (done) => {
|
|
19
|
+
tralisAPI.getFullTrajectory().then(() => {
|
|
20
|
+
expect(get.mock.calls.length).toBe(1);
|
|
21
|
+
expect(get.mock.calls[0][0]).toEqual({
|
|
22
|
+
channel: 'full_trajectory',
|
|
23
|
+
});
|
|
24
|
+
done();
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
[null, TralisModes.TOPOGRAPHIC].forEach((mode) => {
|
|
29
|
+
describe(`using mode ${mode}`, () => {
|
|
30
|
+
test('using id', (done) => {
|
|
31
|
+
tralisAPI.getFullTrajectory('foo', mode).then(() => {
|
|
32
|
+
expect(get.mock.calls.length).toBe(1);
|
|
33
|
+
expect(get.mock.calls[0][0]).toEqual({
|
|
34
|
+
channel: 'full_trajectory_foo',
|
|
35
|
+
});
|
|
36
|
+
done();
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test('using id and generalizationLevel param', (done) => {
|
|
41
|
+
tralisAPI.getFullTrajectory('foo', mode, 5).then(() => {
|
|
42
|
+
expect(get.mock.calls.length).toBe(1);
|
|
43
|
+
expect(get.mock.calls[0][0]).toEqual({
|
|
44
|
+
channel: 'full_trajectory_foo_gen5',
|
|
45
|
+
});
|
|
46
|
+
done();
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
describe('using schematic mode ', () => {
|
|
53
|
+
test('using id', (done) => {
|
|
54
|
+
tralisAPI.getFullTrajectory('foo', TralisModes.SCHEMATIC).then(() => {
|
|
55
|
+
expect(get.mock.calls.length).toBe(1);
|
|
56
|
+
expect(get.mock.calls[0][0]).toEqual({
|
|
57
|
+
channel: 'full_trajectory_schematic_foo',
|
|
58
|
+
});
|
|
59
|
+
done();
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
test("doesn't use generalizationLevel param", (done) => {
|
|
63
|
+
tralisAPI
|
|
64
|
+
.getFullTrajectory('foo', TralisModes.SCHEMATIC, 10)
|
|
65
|
+
.then(() => {
|
|
66
|
+
expect(get.mock.calls.length).toBe(1);
|
|
67
|
+
expect(get.mock.calls[0][0]).toEqual({
|
|
68
|
+
channel: 'full_trajectory_schematic_foo',
|
|
69
|
+
});
|
|
70
|
+
done();
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
});
|
|
@@ -82,7 +82,7 @@ class WebSocketConnector {
|
|
|
82
82
|
* @param {string} params.channel Channel name
|
|
83
83
|
* @param {string} [params.args] Request arguments
|
|
84
84
|
* @param {Number} [params.id] Request identifier
|
|
85
|
-
* @
|
|
85
|
+
* @return {string} request string
|
|
86
86
|
* @private
|
|
87
87
|
*/
|
|
88
88
|
static getRequestString(method, params) {
|
|
@@ -160,7 +160,7 @@ class WebSocketConnector {
|
|
|
160
160
|
* @param {Object} params Parameters for the websocket get request
|
|
161
161
|
* @param {function} cb callback on listen
|
|
162
162
|
* @param {function} errorCb Callback on error
|
|
163
|
-
* @
|
|
163
|
+
* @return {{onMessage: function, errorCb: function}} Object with onMessage and error callbacks
|
|
164
164
|
* @private
|
|
165
165
|
*/
|
|
166
166
|
listen(params, cb, errorCb) {
|
package/common/Tracker.js
CHANGED
|
@@ -123,7 +123,7 @@ export default class Tracker {
|
|
|
123
123
|
|
|
124
124
|
/**
|
|
125
125
|
* Return the trajectories.
|
|
126
|
-
* @
|
|
126
|
+
* @return {array<trajectory>} trajectories
|
|
127
127
|
*/
|
|
128
128
|
getTrajectories() {
|
|
129
129
|
return this.trajectories || [];
|
|
@@ -203,6 +203,8 @@ export default class Tracker {
|
|
|
203
203
|
for (let i = (this.trajectories || []).length - 1; i >= 0; i -= 1) {
|
|
204
204
|
const traj = this.trajectories[i];
|
|
205
205
|
|
|
206
|
+
this.trajectories[i].rendered = false;
|
|
207
|
+
|
|
206
208
|
// We simplify the traj object
|
|
207
209
|
const { geometry, timeIntervals, timeOffset } = traj;
|
|
208
210
|
|
|
@@ -293,16 +295,26 @@ export default class Tracker {
|
|
|
293
295
|
return p * pixelRatio;
|
|
294
296
|
});
|
|
295
297
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
298
|
+
if (
|
|
299
|
+
px[0] < 0 ||
|
|
300
|
+
px[0] > this.canvas.width ||
|
|
301
|
+
px[1] < 0 ||
|
|
302
|
+
px[1] > this.canvas.height
|
|
303
|
+
) {
|
|
304
|
+
// eslint-disable-next-line no-continue
|
|
305
|
+
continue;
|
|
306
|
+
}
|
|
300
307
|
|
|
308
|
+
const vehicleImg = this.style(traj, viewState);
|
|
301
309
|
if (!vehicleImg) {
|
|
302
310
|
// eslint-disable-next-line no-continue
|
|
303
311
|
continue;
|
|
304
312
|
}
|
|
305
313
|
|
|
314
|
+
// Trajectory with pixel (i.e. within map extent) will be in renderedTrajectories.
|
|
315
|
+
this.trajectories[i].rendered = true;
|
|
316
|
+
this.renderedTrajectories.push(this.trajectories[i]);
|
|
317
|
+
|
|
306
318
|
const imgWidth = vehicleImg.width;
|
|
307
319
|
const imgHeight = vehicleImg.height;
|
|
308
320
|
|
package/common/layers/Layer.js
CHANGED
|
@@ -186,7 +186,7 @@ export default class Layer extends Observable {
|
|
|
186
186
|
* Get a layer property.
|
|
187
187
|
*
|
|
188
188
|
* @param {string} name Property name.
|
|
189
|
-
* @
|
|
189
|
+
* @return {property} Property
|
|
190
190
|
*/
|
|
191
191
|
get(name) {
|
|
192
192
|
return this.properties[name];
|
|
@@ -239,7 +239,7 @@ export default class Layer extends Observable {
|
|
|
239
239
|
/**
|
|
240
240
|
* Returns an array with visible child layers
|
|
241
241
|
*
|
|
242
|
-
* @
|
|
242
|
+
* @return {Layer[]} Visible children
|
|
243
243
|
*/
|
|
244
244
|
getVisibleChildren() {
|
|
245
245
|
return this.children.filter((child) => child.visible);
|
|
@@ -248,7 +248,7 @@ export default class Layer extends Observable {
|
|
|
248
248
|
/**
|
|
249
249
|
* Checks whether the layer has child layers with visible set to True
|
|
250
250
|
*
|
|
251
|
-
* @
|
|
251
|
+
* @return {boolean} True if the layer has visible child layers
|
|
252
252
|
* @deprecated
|
|
253
253
|
*/
|
|
254
254
|
hasVisibleChildren() {
|
|
@@ -259,7 +259,7 @@ export default class Layer extends Observable {
|
|
|
259
259
|
* Checks whether the layer has any child layers with visible equal to the input parameter
|
|
260
260
|
*
|
|
261
261
|
* @param {boolean} visible The state to check the childlayers against
|
|
262
|
-
* @
|
|
262
|
+
* @return {boolean} True if the layer has children with the given visibility
|
|
263
263
|
*/
|
|
264
264
|
hasChildren(visible) {
|
|
265
265
|
return !!this.children.find((child) => child.visible === visible);
|
|
@@ -302,7 +302,7 @@ export default class Layer extends Observable {
|
|
|
302
302
|
*
|
|
303
303
|
* @param {ol/coordinate~Coordinate} coordinate Coordinate.
|
|
304
304
|
* @param {Object} options Some options. See child classes to see which are supported.
|
|
305
|
-
* @
|
|
305
|
+
* @return {Promise<FeatureInfo>} An empty response.
|
|
306
306
|
*/
|
|
307
307
|
// eslint-disable-next-line no-unused-vars
|
|
308
308
|
getFeatureInfoAtCoordinate(coordinate, options) {
|
|
@@ -20,19 +20,19 @@ export class MapInterface {
|
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Returns the HTML element of the map.
|
|
23
|
-
* @
|
|
23
|
+
* @return {HTMLElement}
|
|
24
24
|
*/
|
|
25
25
|
getContainer() {}
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Returns a list of mobility layers.
|
|
29
|
-
* @
|
|
29
|
+
* @return {Layer[]}
|
|
30
30
|
*/
|
|
31
31
|
getMobilityLayers() {}
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Returns a list of mobility controls.
|
|
35
|
-
* @
|
|
35
|
+
* @return {Control[]}
|
|
36
36
|
*/
|
|
37
37
|
getMobilityControls() {}
|
|
38
38
|
}
|
|
@@ -27,7 +27,7 @@ export class SearchInterface {
|
|
|
27
27
|
*
|
|
28
28
|
* @param {String} query The query to search for.
|
|
29
29
|
* @param {AbortController} abortController Abort controller used to cancel the request.
|
|
30
|
-
* @
|
|
30
|
+
* @return {Promise<Array<GeoJSONFeature>>} An array of GeoJSON features with coordinates in [EPSG:4326](http://epsg.io/4326).
|
|
31
31
|
*/
|
|
32
32
|
// eslint-disable-next-line no-unused-vars
|
|
33
33
|
search(query, abortController) {}
|
|
@@ -75,7 +75,7 @@ export class TrackerLayerInterface {
|
|
|
75
75
|
* @param {number[2]} coordinate A coordinate ([x,y]).
|
|
76
76
|
* @param {number} [resolution=1] The resolution of the map.
|
|
77
77
|
* @param {number} [nb=Infinity] nb The max number of vehicles to return.
|
|
78
|
-
* @
|
|
78
|
+
* @return {Array<ol/Feature~Feature>} Array of vehicles.
|
|
79
79
|
*/
|
|
80
80
|
// eslint-disable-next-line no-unused-vars
|
|
81
81
|
getVehiclesAtCoordinate(coordinate, resolution = 1, nb = Infinity) {}
|
|
@@ -508,9 +508,6 @@ const TrackerLayerMixin = (Base) =>
|
|
|
508
508
|
}
|
|
509
509
|
}
|
|
510
510
|
|
|
511
|
-
/**
|
|
512
|
-
*
|
|
513
|
-
|
|
514
511
|
/**
|
|
515
512
|
* Launch renderTrajectories. it avoids duplicating code in renderTrajectories method.
|
|
516
513
|
*
|
|
@@ -569,7 +566,7 @@ const TrackerLayerMixin = (Base) =>
|
|
|
569
566
|
/**
|
|
570
567
|
* Get vehicle.
|
|
571
568
|
* @param {function} filterFc A function use to filter results.
|
|
572
|
-
* @
|
|
569
|
+
* @return {Array<Object>} Array of vehicle.
|
|
573
570
|
*/
|
|
574
571
|
getVehicle(filterFc) {
|
|
575
572
|
return this.tracker.getTrajectories().filter(filterFc);
|
|
@@ -581,7 +578,7 @@ const TrackerLayerMixin = (Base) =>
|
|
|
581
578
|
* @param {number[2]} coordinate A coordinate ([x,y]).
|
|
582
579
|
* @param {number} [resolution=1] The resolution of the map.
|
|
583
580
|
* @param {number} [nb=Infinity] The max number of vehicles to return.
|
|
584
|
-
* @
|
|
581
|
+
* @return {Array<ol/Feature~Feature>} Array of vehicle.
|
|
585
582
|
*/
|
|
586
583
|
getVehiclesAtCoordinate(coordinate, resolution = 1, nb = Infinity) {
|
|
587
584
|
const ext = buffer(
|
|
@@ -612,7 +609,7 @@ const TrackerLayerMixin = (Base) =>
|
|
|
612
609
|
* @param {Object} options Options See child classes to see which options are supported.
|
|
613
610
|
* @param {number} [options.resolution=1] The resolution of the map.
|
|
614
611
|
* @param {number} [options.nb=Infinity] The max number of vehicles to return.
|
|
615
|
-
* @
|
|
612
|
+
* @return {Promise<FeatureInfo>} Promise with features, layer and coordinate.
|
|
616
613
|
*/
|
|
617
614
|
getFeatureInfoAtCoordinate(coordinate, options = {}) {
|
|
618
615
|
const { resolution, nb } = options;
|