mobility-toolbox-js 3.0.0-beta.6 → 3.0.0-beta.8
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.js +96 -89
- package/common/utils/getLayersAsFlatArray.js +5 -1
- package/maplibre/layers/RealtimeLayer.js +2 -2
- package/mbt.js +105 -136
- package/mbt.js.map +3 -3
- package/mbt.min.js +5 -5
- package/mbt.min.js.map +3 -3
- package/ol/controls/CopyrightControl.js +18 -8
- package/ol/controls/RoutingControl.js +3 -0
- package/ol/controls/StopFinderControl.js +3 -0
- package/ol/layers/RealtimeLayer.js +2 -2
- package/ol/mixins/PropertiesLayerMixin.js +0 -60
- package/ol/utils/getFeatureInfoAtCoordinate.js +1 -1
- package/package.json +1 -1
package/api/RealtimeAPI.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable no-underscore-dangle */
|
|
1
2
|
/* eslint-disable class-methods-use-this */
|
|
2
3
|
import WebSocketAPI from './WebSocketAPI';
|
|
3
4
|
import debounceWebsocketMessages from '../common/utils/debounceWebsocketMessages';
|
|
@@ -17,14 +18,14 @@ export const RealtimeModes = {
|
|
|
17
18
|
SCHEMATIC: 'schematic',
|
|
18
19
|
};
|
|
19
20
|
/**
|
|
20
|
-
* This class provides convenience methods to use to the [geOps
|
|
21
|
+
* This class provides convenience methods to use to the [geOps realtime API](https://developer.geops.io/apis/realtime/).
|
|
21
22
|
*
|
|
22
23
|
* @example
|
|
23
24
|
* import { RealtimeAPI } from 'mobility-toolbox-js/api';
|
|
24
25
|
*
|
|
25
26
|
* const api = new RealtimeAPI({
|
|
26
27
|
* apiKey: "yourApiKey",
|
|
27
|
-
* bbox: [782001, 5888803, 923410, 5923660, 11, "mots=rail],
|
|
28
|
+
* bbox: [782001, 5888803, 923410, 5923660, 11, "mots=rail"],
|
|
28
29
|
* // url: "wss://api.geops.io/tracker-ws/v1/",
|
|
29
30
|
* });
|
|
30
31
|
*
|
|
@@ -34,106 +35,113 @@ export const RealtimeModes = {
|
|
|
34
35
|
* console.log('Log trajectories:', JSON.stringify(data.content));
|
|
35
36
|
* });
|
|
36
37
|
*
|
|
37
|
-
* @classproperty {string} apiKey - Access key for [geOps APIs](https://developer.geops.io/)
|
|
38
|
-
* @classproperty {RealtimeBbox} bbox - The bounding box to receive data from. \ Example: \ [ minX, minY, maxX, maxY, zoom, "tenant=tenant1", "gen_level=5", "mots=mot1,mot2" ]. \ tenant, gen_level and mots are optional.
|
|
39
|
-
* @classproperty {string} url - The [geOps Realtime API](https://developer.geops.io/apis/realtime/) url.
|
|
40
38
|
* @public
|
|
41
39
|
*/
|
|
42
40
|
class RealtimeAPI {
|
|
41
|
+
get url() {
|
|
42
|
+
return this._url;
|
|
43
|
+
}
|
|
44
|
+
set url(newUrl) {
|
|
45
|
+
if (this._url !== newUrl) {
|
|
46
|
+
this._url = newUrl;
|
|
47
|
+
// Update the websocket only if the url has changed and the websocket is already open or is opening.
|
|
48
|
+
if (this.wsApi.open || this.wsApi.connecting) {
|
|
49
|
+
this.open();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The bounding box to receive data from.\
|
|
55
|
+
* Example: [minX, minY, maxX, maxY, zoom, mots , gen_level, tenant, ...]\
|
|
56
|
+
* \
|
|
57
|
+
* Where:
|
|
58
|
+
* - **minX**: a string representation of an integer (not a float) representing the minimal X coordinate (in EPSG:3857) of a bounding box\
|
|
59
|
+
*
|
|
60
|
+
* - **minY**: a string representation of an integer (not a float) representing the minimal Y coordinate (in EPSG:3857) of a bounding box\
|
|
61
|
+
*
|
|
62
|
+
* - **maxX**: a string representation of an integer (not a float) representing the maximal X coordinate (in EPSG:3857) of a bounding box\
|
|
63
|
+
*
|
|
64
|
+
* - **maxY**: a string representation of an integer (not a float) representing the maximal Y coordinate (in EPSG:3857) of a bounding box\
|
|
65
|
+
*
|
|
66
|
+
* - **zoom**: a string representation of an integer representing the zoom level (from 4 to 22). When zoom < 8 only the trains are displayed for performance reasons.\
|
|
67
|
+
*
|
|
68
|
+
* - **mots**: A comma separated list of modes of transport. **Optional**.\
|
|
69
|
+
* Example: "mots=rail,subway".\
|
|
70
|
+
*
|
|
71
|
+
* - **gen_level**: An integer representing the generalization level. **Optional**.\
|
|
72
|
+
* Example: "gen_level=5"\
|
|
73
|
+
*
|
|
74
|
+
* - **tenant**: A string representing the tenant. **Optional**.\
|
|
75
|
+
* Example: "tenant=sbb"\
|
|
76
|
+
*
|
|
77
|
+
* - ...: Any other values added to the bbox will be send to the server
|
|
78
|
+
*
|
|
79
|
+
* @type {string[]}
|
|
80
|
+
*
|
|
81
|
+
* @public
|
|
82
|
+
*/
|
|
83
|
+
get bbox() {
|
|
84
|
+
return this._bbox;
|
|
85
|
+
}
|
|
86
|
+
set bbox(newBbox) {
|
|
87
|
+
if (JSON.stringify(newBbox) !== JSON.stringify(this._bbox)) {
|
|
88
|
+
this._bbox = newBbox;
|
|
89
|
+
if (this.wsApi && this._bbox) {
|
|
90
|
+
this.wsApi.send(`BBOX ${this._bbox.join(' ')}`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
get buffer() {
|
|
95
|
+
return this._buffer;
|
|
96
|
+
}
|
|
97
|
+
set buffer(newBuffer) {
|
|
98
|
+
if (JSON.stringify(newBuffer) !== JSON.stringify(this._buffer)) {
|
|
99
|
+
this._buffer = newBuffer;
|
|
100
|
+
if (this.wsApi && this._buffer) {
|
|
101
|
+
this.wsApi.send(`BUFFER ${this._buffer.join(' ')}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
43
105
|
/**
|
|
44
106
|
* Constructor
|
|
45
107
|
*
|
|
46
|
-
* @param {
|
|
47
|
-
* @param {string} options.url Url to the [geOps realtime
|
|
108
|
+
* @param {Object} options A string representing the url of the service or an object containing the url and the apiKey.
|
|
109
|
+
* @param {string} options.url Url to the [geOps realtime API](https://developer.geops.io/apis/realtime/).
|
|
48
110
|
* @param {string} options.apiKey Access key for [geOps apis](https://developer.geops.io/).
|
|
49
|
-
* @param {
|
|
111
|
+
* @param {string[]} options.bbox The bounding box to receive data from.
|
|
112
|
+
* @public
|
|
50
113
|
*/
|
|
51
114
|
constructor(options = {}) {
|
|
52
115
|
this.version = '2';
|
|
53
|
-
|
|
54
|
-
this.onOpen = this.onOpen.bind(this);
|
|
55
|
-
}
|
|
56
|
-
defineProperties(options = {}) {
|
|
57
|
-
let opt = options || {};
|
|
116
|
+
let opt = options;
|
|
58
117
|
if (typeof options === 'string') {
|
|
59
118
|
opt = { url: options };
|
|
60
119
|
}
|
|
61
|
-
const { apiKey
|
|
62
|
-
|
|
120
|
+
const { apiKey } = opt;
|
|
121
|
+
const { url } = opt;
|
|
63
122
|
const wsApi = new WebSocketAPI();
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if (apiKey) {
|
|
68
|
-
url = `${url}?key=${apiKey}`;
|
|
123
|
+
let suffix = '';
|
|
124
|
+
if (apiKey && !(url === null || url === void 0 ? void 0 : url.includes('key='))) {
|
|
125
|
+
suffix = `?key=${apiKey}`;
|
|
69
126
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
if (this.wsApi && bbox) {
|
|
89
|
-
this.wsApi.send(`BBOX ${bbox.join(' ')}`);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
buffer: {
|
|
95
|
-
get: () => buffer,
|
|
96
|
-
set: (newBuffer) => {
|
|
97
|
-
if (JSON.stringify(newBuffer) !== JSON.stringify(buffer)) {
|
|
98
|
-
buffer = newBuffer;
|
|
99
|
-
if (this.wsApi) {
|
|
100
|
-
this.wsApi.send(`BUFFER ${buffer.join(' ')}`);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
version: {
|
|
106
|
-
value: version,
|
|
107
|
-
writable: true,
|
|
108
|
-
},
|
|
109
|
-
/**
|
|
110
|
-
* The websocket helper class to connect the websocket.
|
|
111
|
-
*
|
|
112
|
-
* @private
|
|
113
|
-
*/
|
|
114
|
-
wsApi: {
|
|
115
|
-
value: wsApi,
|
|
116
|
-
writable: true,
|
|
117
|
-
},
|
|
118
|
-
/**
|
|
119
|
-
* Interval between PING request in ms.
|
|
120
|
-
* If equal to 0, no PING request are sent.
|
|
121
|
-
* @type {number}
|
|
122
|
-
* @private
|
|
123
|
-
*/
|
|
124
|
-
pingIntervalMs: {
|
|
125
|
-
value: options.pingIntervalMs || 10000,
|
|
126
|
-
writable: true,
|
|
127
|
-
},
|
|
128
|
-
/**
|
|
129
|
-
* Timeout in ms after an automatic reconnection when the websoscket has been closed by the server.
|
|
130
|
-
* @type {number}
|
|
131
|
-
*/
|
|
132
|
-
reconnectTimeoutMs: {
|
|
133
|
-
value: options.pingIntervalMs || 100,
|
|
134
|
-
writable: true,
|
|
135
|
-
},
|
|
136
|
-
});
|
|
127
|
+
this._url = (url || 'wss://api.geops.io/tracker-ws/v1/') + suffix;
|
|
128
|
+
this._buffer = opt.buffer || [100, 100];
|
|
129
|
+
this.version = opt.version || '2';
|
|
130
|
+
/**
|
|
131
|
+
* Interval between PING request in ms.
|
|
132
|
+
* If equal to 0, no PING request are sent.
|
|
133
|
+
* @type {number}
|
|
134
|
+
*/
|
|
135
|
+
this.pingIntervalMs = opt.pingIntervalMs || 10000;
|
|
136
|
+
/**
|
|
137
|
+
* Timeout in ms after an automatic reconnection when the websoscket has been closed by the server.
|
|
138
|
+
* @type {number}
|
|
139
|
+
*/
|
|
140
|
+
this.reconnectTimeoutMs = opt.reconnectTimeoutMs || 100;
|
|
141
|
+
/**
|
|
142
|
+
* The websocket helper class to connect the websocket.
|
|
143
|
+
*/
|
|
144
|
+
this.wsApi = wsApi;
|
|
137
145
|
}
|
|
138
146
|
/**
|
|
139
147
|
* Open the websocket connection.
|
|
@@ -141,7 +149,7 @@ class RealtimeAPI {
|
|
|
141
149
|
* @public
|
|
142
150
|
*/
|
|
143
151
|
open() {
|
|
144
|
-
this.wsApi.connect(this.url, this.onOpen);
|
|
152
|
+
this.wsApi.connect(this.url, this.onOpen.bind(this));
|
|
145
153
|
// Register reconnection on close.
|
|
146
154
|
if (this.wsApi.websocket) {
|
|
147
155
|
this.wsApi.websocket.onclose = () => {
|
|
@@ -160,7 +168,6 @@ class RealtimeAPI {
|
|
|
160
168
|
/**
|
|
161
169
|
* Unsubscribe trajectory and deleted_vehicles channels. To resubscribe you have to set a new BBOX.
|
|
162
170
|
*/
|
|
163
|
-
// eslint-disable-next-line class-methods-use-this
|
|
164
171
|
reset() {
|
|
165
172
|
this.wsApi.send('RESET');
|
|
166
173
|
}
|
|
@@ -7,8 +7,12 @@ const getLayersAsFlatArray = (layersOrLayer) => {
|
|
|
7
7
|
}
|
|
8
8
|
let flatLayers = [];
|
|
9
9
|
layers.forEach((layer) => {
|
|
10
|
+
var _a, _b;
|
|
10
11
|
flatLayers.push(layer);
|
|
11
|
-
|
|
12
|
+
// Handle children property and ol.layer.Group
|
|
13
|
+
const children = layer.children ||
|
|
14
|
+
layer.get('children') ||
|
|
15
|
+
((_b = (_a = layer.getLayers) === null || _a === void 0 ? void 0 : _a.call(layer)) === null || _b === void 0 ? void 0 : _b.getArray());
|
|
12
16
|
flatLayers = flatLayers.concat(getLayersAsFlatArray(children || []));
|
|
13
17
|
});
|
|
14
18
|
return flatLayers;
|
|
@@ -8,7 +8,7 @@ import Layer from './Layer';
|
|
|
8
8
|
import { getSourceCoordinates } from '../utils';
|
|
9
9
|
import toMercatorExtent from '../../common/utils/toMercatorExtent';
|
|
10
10
|
/**
|
|
11
|
-
* Responsible for loading and display data from a geOps
|
|
11
|
+
* Responsible for loading and display data from a geOps realtime API.
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* import { RealtimeLayer } from 'mobility-toolbox-js/Maplibre';
|
|
@@ -31,7 +31,7 @@ class RealtimeLayer extends RealtimeLayerMixin(Layer) {
|
|
|
31
31
|
*
|
|
32
32
|
* @param {RealtimeLayerOptions} options
|
|
33
33
|
* @param {string} options.apiKey Access key for [geOps apis](https://developer.geops.io/).
|
|
34
|
-
* @param {string} [options.url="wss://api.geops.io/tracker-ws/v1/"] The geOps
|
|
34
|
+
* @param {string} [options.url="wss://api.geops.io/tracker-ws/v1/"] The geOps realtime API url.
|
|
35
35
|
*
|
|
36
36
|
*/
|
|
37
37
|
constructor(options = {}) {
|
package/mbt.js
CHANGED
|
@@ -19610,96 +19610,94 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
19610
19610
|
/**
|
|
19611
19611
|
* Constructor
|
|
19612
19612
|
*
|
|
19613
|
-
* @param {
|
|
19614
|
-
* @param {string} options.url Url to the [geOps realtime
|
|
19613
|
+
* @param {Object} options A string representing the url of the service or an object containing the url and the apiKey.
|
|
19614
|
+
* @param {string} options.url Url to the [geOps realtime API](https://developer.geops.io/apis/realtime/).
|
|
19615
19615
|
* @param {string} options.apiKey Access key for [geOps apis](https://developer.geops.io/).
|
|
19616
|
-
* @param {
|
|
19616
|
+
* @param {string[]} options.bbox The bounding box to receive data from.
|
|
19617
|
+
* @public
|
|
19617
19618
|
*/
|
|
19618
19619
|
constructor(options = {}) {
|
|
19619
19620
|
this.version = "2";
|
|
19620
|
-
|
|
19621
|
-
this.onOpen = this.onOpen.bind(this);
|
|
19622
|
-
}
|
|
19623
|
-
defineProperties(options = {}) {
|
|
19624
|
-
let opt = options || {};
|
|
19621
|
+
let opt = options;
|
|
19625
19622
|
if (typeof options === "string") {
|
|
19626
19623
|
opt = { url: options };
|
|
19627
19624
|
}
|
|
19628
|
-
const { apiKey
|
|
19629
|
-
|
|
19625
|
+
const { apiKey } = opt;
|
|
19626
|
+
const { url } = opt;
|
|
19630
19627
|
const wsApi = new WebSocketAPI_default();
|
|
19631
|
-
|
|
19632
|
-
|
|
19628
|
+
let suffix = "";
|
|
19629
|
+
if (apiKey && !url?.includes("key=")) {
|
|
19630
|
+
suffix = `?key=${apiKey}`;
|
|
19633
19631
|
}
|
|
19634
|
-
|
|
19635
|
-
|
|
19632
|
+
this._url = (url || "wss://api.geops.io/tracker-ws/v1/") + suffix;
|
|
19633
|
+
this._buffer = opt.buffer || [100, 100];
|
|
19634
|
+
this.version = opt.version || "2";
|
|
19635
|
+
this.pingIntervalMs = opt.pingIntervalMs || 1e4;
|
|
19636
|
+
this.reconnectTimeoutMs = opt.reconnectTimeoutMs || 100;
|
|
19637
|
+
this.wsApi = wsApi;
|
|
19638
|
+
}
|
|
19639
|
+
get url() {
|
|
19640
|
+
return this._url;
|
|
19641
|
+
}
|
|
19642
|
+
set url(newUrl) {
|
|
19643
|
+
if (this._url !== newUrl) {
|
|
19644
|
+
this._url = newUrl;
|
|
19645
|
+
if (this.wsApi.open || this.wsApi.connecting) {
|
|
19646
|
+
this.open();
|
|
19647
|
+
}
|
|
19648
|
+
}
|
|
19649
|
+
}
|
|
19650
|
+
/**
|
|
19651
|
+
* The bounding box to receive data from.\
|
|
19652
|
+
* Example: [minX, minY, maxX, maxY, zoom, mots , gen_level, tenant, ...]\
|
|
19653
|
+
* \
|
|
19654
|
+
* Where:
|
|
19655
|
+
* - **minX**: a string representation of an integer (not a float) representing the minimal X coordinate (in EPSG:3857) of a bounding box\
|
|
19656
|
+
*
|
|
19657
|
+
* - **minY**: a string representation of an integer (not a float) representing the minimal Y coordinate (in EPSG:3857) of a bounding box\
|
|
19658
|
+
*
|
|
19659
|
+
* - **maxX**: a string representation of an integer (not a float) representing the maximal X coordinate (in EPSG:3857) of a bounding box\
|
|
19660
|
+
*
|
|
19661
|
+
* - **maxY**: a string representation of an integer (not a float) representing the maximal Y coordinate (in EPSG:3857) of a bounding box\
|
|
19662
|
+
*
|
|
19663
|
+
* - **zoom**: a string representation of an integer representing the zoom level (from 4 to 22). When zoom < 8 only the trains are displayed for performance reasons.\
|
|
19664
|
+
*
|
|
19665
|
+
* - **mots**: A comma separated list of modes of transport. **Optional**.\
|
|
19666
|
+
* Example: "mots=rail,subway".\
|
|
19667
|
+
*
|
|
19668
|
+
* - **gen_level**: An integer representing the generalization level. **Optional**.\
|
|
19669
|
+
* Example: "gen_level=5"\
|
|
19670
|
+
*
|
|
19671
|
+
* - **tenant**: A string representing the tenant. **Optional**.\
|
|
19672
|
+
* Example: "tenant=sbb"\
|
|
19673
|
+
*
|
|
19674
|
+
* - ...: Any other values added to the bbox will be send to the server
|
|
19675
|
+
*
|
|
19676
|
+
* @type {string[]}
|
|
19677
|
+
*
|
|
19678
|
+
* @public
|
|
19679
|
+
*/
|
|
19680
|
+
get bbox() {
|
|
19681
|
+
return this._bbox;
|
|
19682
|
+
}
|
|
19683
|
+
set bbox(newBbox) {
|
|
19684
|
+
if (JSON.stringify(newBbox) !== JSON.stringify(this._bbox)) {
|
|
19685
|
+
this._bbox = newBbox;
|
|
19686
|
+
if (this.wsApi && this._bbox) {
|
|
19687
|
+
this.wsApi.send(`BBOX ${this._bbox.join(" ")}`);
|
|
19688
|
+
}
|
|
19636
19689
|
}
|
|
19637
|
-
|
|
19638
|
-
|
|
19639
|
-
|
|
19640
|
-
|
|
19641
|
-
|
|
19642
|
-
|
|
19643
|
-
|
|
19644
|
-
|
|
19645
|
-
|
|
19646
|
-
}
|
|
19647
|
-
}
|
|
19648
|
-
},
|
|
19649
|
-
bbox: {
|
|
19650
|
-
get: () => bbox,
|
|
19651
|
-
set: (newBbox) => {
|
|
19652
|
-
if (JSON.stringify(newBbox) !== JSON.stringify(bbox)) {
|
|
19653
|
-
bbox = newBbox;
|
|
19654
|
-
if (this.wsApi && bbox) {
|
|
19655
|
-
this.wsApi.send(`BBOX ${bbox.join(" ")}`);
|
|
19656
|
-
}
|
|
19657
|
-
}
|
|
19658
|
-
}
|
|
19659
|
-
},
|
|
19660
|
-
buffer: {
|
|
19661
|
-
get: () => buffer2,
|
|
19662
|
-
set: (newBuffer) => {
|
|
19663
|
-
if (JSON.stringify(newBuffer) !== JSON.stringify(buffer2)) {
|
|
19664
|
-
buffer2 = newBuffer;
|
|
19665
|
-
if (this.wsApi) {
|
|
19666
|
-
this.wsApi.send(`BUFFER ${buffer2.join(" ")}`);
|
|
19667
|
-
}
|
|
19668
|
-
}
|
|
19669
|
-
}
|
|
19670
|
-
},
|
|
19671
|
-
version: {
|
|
19672
|
-
value: version,
|
|
19673
|
-
writable: true
|
|
19674
|
-
},
|
|
19675
|
-
/**
|
|
19676
|
-
* The websocket helper class to connect the websocket.
|
|
19677
|
-
*
|
|
19678
|
-
* @private
|
|
19679
|
-
*/
|
|
19680
|
-
wsApi: {
|
|
19681
|
-
value: wsApi,
|
|
19682
|
-
writable: true
|
|
19683
|
-
},
|
|
19684
|
-
/**
|
|
19685
|
-
* Interval between PING request in ms.
|
|
19686
|
-
* If equal to 0, no PING request are sent.
|
|
19687
|
-
* @type {number}
|
|
19688
|
-
* @private
|
|
19689
|
-
*/
|
|
19690
|
-
pingIntervalMs: {
|
|
19691
|
-
value: options.pingIntervalMs || 1e4,
|
|
19692
|
-
writable: true
|
|
19693
|
-
},
|
|
19694
|
-
/**
|
|
19695
|
-
* Timeout in ms after an automatic reconnection when the websoscket has been closed by the server.
|
|
19696
|
-
* @type {number}
|
|
19697
|
-
*/
|
|
19698
|
-
reconnectTimeoutMs: {
|
|
19699
|
-
value: options.pingIntervalMs || 100,
|
|
19700
|
-
writable: true
|
|
19690
|
+
}
|
|
19691
|
+
get buffer() {
|
|
19692
|
+
return this._buffer;
|
|
19693
|
+
}
|
|
19694
|
+
set buffer(newBuffer) {
|
|
19695
|
+
if (JSON.stringify(newBuffer) !== JSON.stringify(this._buffer)) {
|
|
19696
|
+
this._buffer = newBuffer;
|
|
19697
|
+
if (this.wsApi && this._buffer) {
|
|
19698
|
+
this.wsApi.send(`BUFFER ${this._buffer.join(" ")}`);
|
|
19701
19699
|
}
|
|
19702
|
-
}
|
|
19700
|
+
}
|
|
19703
19701
|
}
|
|
19704
19702
|
/**
|
|
19705
19703
|
* Open the websocket connection.
|
|
@@ -19707,7 +19705,7 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
19707
19705
|
* @public
|
|
19708
19706
|
*/
|
|
19709
19707
|
open() {
|
|
19710
|
-
this.wsApi.connect(this.url, this.onOpen);
|
|
19708
|
+
this.wsApi.connect(this.url, this.onOpen.bind(this));
|
|
19711
19709
|
if (this.wsApi.websocket) {
|
|
19712
19710
|
this.wsApi.websocket.onclose = () => {
|
|
19713
19711
|
this.onClose();
|
|
@@ -19725,7 +19723,6 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
19725
19723
|
/**
|
|
19726
19724
|
* Unsubscribe trajectory and deleted_vehicles channels. To resubscribe you have to set a new BBOX.
|
|
19727
19725
|
*/
|
|
19728
|
-
// eslint-disable-next-line class-methods-use-this
|
|
19729
19726
|
reset() {
|
|
19730
19727
|
this.wsApi.send("RESET");
|
|
19731
19728
|
}
|
|
@@ -20225,7 +20222,7 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
20225
20222
|
let flatLayers = [];
|
|
20226
20223
|
layers.forEach((layer) => {
|
|
20227
20224
|
flatLayers.push(layer);
|
|
20228
|
-
const children = layer.children || layer.get("children") ||
|
|
20225
|
+
const children = layer.children || layer.get("children") || layer.getLayers?.()?.getArray();
|
|
20229
20226
|
flatLayers = flatLayers.concat(getLayersAsFlatArray(children || []));
|
|
20230
20227
|
});
|
|
20231
20228
|
return flatLayers;
|
|
@@ -29162,6 +29159,9 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
29162
29159
|
element,
|
|
29163
29160
|
...options
|
|
29164
29161
|
});
|
|
29162
|
+
this.format = options.format || ((copyrights) => {
|
|
29163
|
+
return copyrights?.join(" | ");
|
|
29164
|
+
});
|
|
29165
29165
|
}
|
|
29166
29166
|
render({ frameState }) {
|
|
29167
29167
|
if (!frameState) {
|
|
@@ -29171,14 +29171,23 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
29171
29171
|
let copyrights = [];
|
|
29172
29172
|
frameState?.layerStatesArray.forEach((layerState) => {
|
|
29173
29173
|
const { layer } = layerState;
|
|
29174
|
-
if (frameState && inView(layerState, frameState.viewState)
|
|
29175
|
-
|
|
29176
|
-
|
|
29177
|
-
|
|
29174
|
+
if (frameState && inView(layerState, frameState.viewState)) {
|
|
29175
|
+
if (layer?.getSource()?.getAttributions()) {
|
|
29176
|
+
copyrights = copyrights.concat(
|
|
29177
|
+
layer.getSource().getAttributions()(frameState)
|
|
29178
|
+
);
|
|
29179
|
+
}
|
|
29180
|
+
if (layer?.get("copyrights")) {
|
|
29181
|
+
let copyProp = layer.get("copyrights");
|
|
29182
|
+
copyProp = !Array.isArray(copyProp) ? [copyProp] : copyProp;
|
|
29183
|
+
if (copyProp?.length) {
|
|
29184
|
+
copyrights.push(...copyProp);
|
|
29185
|
+
}
|
|
29186
|
+
}
|
|
29178
29187
|
}
|
|
29179
29188
|
});
|
|
29180
29189
|
const unique = removeDuplicate_default(copyrights) || [];
|
|
29181
|
-
this.element.innerHTML =
|
|
29190
|
+
this.element.innerHTML = this.format(unique);
|
|
29182
29191
|
}
|
|
29183
29192
|
};
|
|
29184
29193
|
var CopyrightControl_default = CopyrightControl;
|
|
@@ -44741,6 +44750,9 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
44741
44750
|
this.segments = [];
|
|
44742
44751
|
this.format = new GeoJSON_default({ featureProjection: "EPSG:3857" });
|
|
44743
44752
|
this.initialRouteDrag = {};
|
|
44753
|
+
if (!this.element) {
|
|
44754
|
+
this.createDefaultElement();
|
|
44755
|
+
}
|
|
44744
44756
|
this.loading = false;
|
|
44745
44757
|
this.active = options.active || true;
|
|
44746
44758
|
this.graphs = options.graphs || [["osm", 0, 99]];
|
|
@@ -45421,6 +45433,9 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
45421
45433
|
const coord = fromLonLat(suggestion.geometry.coordinates);
|
|
45422
45434
|
this.getMap()?.getView().setCenter(coord);
|
|
45423
45435
|
}
|
|
45436
|
+
search(q, abortController) {
|
|
45437
|
+
return this.controller.search(q, abortController);
|
|
45438
|
+
}
|
|
45424
45439
|
};
|
|
45425
45440
|
var StopFinderControl_default = StopFinderControl;
|
|
45426
45441
|
|
|
@@ -45449,20 +45464,6 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
45449
45464
|
if (evt.key === "children") {
|
|
45450
45465
|
this.onChildrenChange(evt.oldValue);
|
|
45451
45466
|
}
|
|
45452
|
-
}),
|
|
45453
|
-
// Manage group visiblity
|
|
45454
|
-
this.on("change:visible", () => {
|
|
45455
|
-
this.onVisibleChange();
|
|
45456
|
-
}),
|
|
45457
|
-
// Listen for group visiblity change
|
|
45458
|
-
// if a layer from a group is newly visible we hide the others.
|
|
45459
|
-
// @ts-ignore
|
|
45460
|
-
this.on(`change:visible:group`, (evt) => {
|
|
45461
|
-
if (this.group === evt.target.group && this !== evt.target && this.visible) {
|
|
45462
|
-
this.visible = false;
|
|
45463
|
-
} else if (this.children) {
|
|
45464
|
-
this.children.forEach((child) => child.dispatchEvent(evt));
|
|
45465
|
-
}
|
|
45466
45467
|
})
|
|
45467
45468
|
);
|
|
45468
45469
|
this.options = options;
|
|
@@ -45548,38 +45549,6 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
45548
45549
|
child.set("parent", this);
|
|
45549
45550
|
});
|
|
45550
45551
|
}
|
|
45551
|
-
/** @private */
|
|
45552
|
-
onVisibleChange() {
|
|
45553
|
-
const parent = this.get("parent");
|
|
45554
|
-
const children = this.get("children") || [];
|
|
45555
|
-
if (this.getVisible()) {
|
|
45556
|
-
const group = this.get("group");
|
|
45557
|
-
if (parent) {
|
|
45558
|
-
parent.setVisible(true);
|
|
45559
|
-
}
|
|
45560
|
-
if (children && !children.some((child) => child.getVisible())) {
|
|
45561
|
-
children.forEach((child) => {
|
|
45562
|
-
child.setVisible(true);
|
|
45563
|
-
});
|
|
45564
|
-
}
|
|
45565
|
-
if (parent && group) {
|
|
45566
|
-
let higherParent = parent;
|
|
45567
|
-
while (higherParent.get("parent")) {
|
|
45568
|
-
higherParent = higherParent.get("parent");
|
|
45569
|
-
}
|
|
45570
|
-
const evt = new Event_default(`change:visible:group`);
|
|
45571
|
-
evt.target = this;
|
|
45572
|
-
higherParent.dispatchEvent(evt);
|
|
45573
|
-
}
|
|
45574
|
-
} else {
|
|
45575
|
-
children.forEach((child) => {
|
|
45576
|
-
child.setVisible(false);
|
|
45577
|
-
});
|
|
45578
|
-
if (parent?.getVisible() && !parent?.get("children").find((child) => child.getVisible())) {
|
|
45579
|
-
parent.setVisible(false);
|
|
45580
|
-
}
|
|
45581
|
-
}
|
|
45582
|
-
}
|
|
45583
45552
|
/**
|
|
45584
45553
|
* Initialize the layer with the map passed in parameters.
|
|
45585
45554
|
*
|
|
@@ -47373,7 +47342,7 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
47373
47342
|
* @param {RealtimeLayerOptions} options
|
|
47374
47343
|
* @param {boolean} [options.allowRenderWhenAnimating=false] Allow rendering of the layer when the map is animating.
|
|
47375
47344
|
* @param {string} options.apiKey Access key for [geOps apis](https://developer.geops.io/).
|
|
47376
|
-
* @param {string} [options.url="wss://api.geops.io/tracker-ws/v1/"] The geOps
|
|
47345
|
+
* @param {string} [options.url="wss://api.geops.io/tracker-ws/v1/"] The geOps realtime API url.
|
|
47377
47346
|
*
|
|
47378
47347
|
*/
|
|
47379
47348
|
constructor(options) {
|
|
@@ -47685,7 +47654,7 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
47685
47654
|
}
|
|
47686
47655
|
const source = layer?.getSource();
|
|
47687
47656
|
if (source?.getFeatureInfoUrl) {
|
|
47688
|
-
const id = getUid(
|
|
47657
|
+
const id = getUid(layer);
|
|
47689
47658
|
abortControllers[id]?.abort();
|
|
47690
47659
|
abortControllers[id] = new AbortController();
|
|
47691
47660
|
const resolution = map?.getView()?.getResolution();
|
|
@@ -48446,7 +48415,7 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
48446
48415
|
*
|
|
48447
48416
|
* @param {RealtimeLayerOptions} options
|
|
48448
48417
|
* @param {string} options.apiKey Access key for [geOps apis](https://developer.geops.io/).
|
|
48449
|
-
* @param {string} [options.url="wss://api.geops.io/tracker-ws/v1/"] The geOps
|
|
48418
|
+
* @param {string} [options.url="wss://api.geops.io/tracker-ws/v1/"] The geOps realtime API url.
|
|
48450
48419
|
*
|
|
48451
48420
|
*/
|
|
48452
48421
|
constructor(options = {}) {
|