mobility-toolbox-js 2.0.0-beta.73 → 2.0.0-beta.74
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 +5 -5
- package/api/RealtimeAPI.d.ts.map +1 -1
- package/api/RealtimeAPI.js +20 -16
- package/common/mixins/RealtimeLayerMixin.d.ts +0 -1
- package/common/mixins/RealtimeLayerMixin.d.ts.map +1 -1
- package/common/mixins/RealtimeLayerMixin.js +4 -1
- package/common/styles/index.d.ts +0 -1
- package/common/styles/index.js +0 -1
- package/common/utils/getMapboxRender.d.ts +1 -1
- package/common/utils/getMapboxRender.d.ts.map +1 -1
- package/common/utils/getRealtimeModeSuffix.d.ts +3 -3
- package/common/utils/getRealtimeModeSuffix.d.ts.map +1 -1
- package/common/utils/getRealtimeModeSuffix.js +8 -2
- package/common/utils/index.d.ts +0 -1
- package/common/utils/index.js +0 -1
- package/common/utils/renderTrajectories.js +2 -3
- package/mbt.js +66 -130
- package/mbt.js.map +4 -4
- package/mbt.min.js +28 -28
- package/mbt.min.js.map +4 -4
- package/package.json +1 -1
package/api/RealtimeAPI.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import WebSocketAPI, { WebSocketAPIMessageCallback, WebSocketAPIMessageEventData } from '../common/api/WebSocketAPI';
|
|
2
|
-
import
|
|
2
|
+
import { RealtimeMode, RealtimeDeparture, RealtimeNews, RealtimeStation, RealtimeExtraGeom, RealtimeTrainId, RealtimeGeneralizationLevel, RealtimeFullTrajectory, RealtimeTrajectoryResponse, RealtimeStationId, RealtimeTenant } from '../types';
|
|
3
3
|
import { StopSequence } from './typedefs';
|
|
4
4
|
export declare type RealtimeAPIOptions = {
|
|
5
5
|
url?: string;
|
|
6
6
|
apiKey?: string;
|
|
7
|
-
|
|
7
|
+
tenant?: RealtimeTenant;
|
|
8
8
|
projection?: string;
|
|
9
9
|
bbox?: (number | string)[];
|
|
10
10
|
buffer?: number[];
|
|
@@ -57,7 +57,7 @@ declare class RealtimeAPI {
|
|
|
57
57
|
projection?: string;
|
|
58
58
|
bbox?: (number | string)[];
|
|
59
59
|
buffer?: number[];
|
|
60
|
-
|
|
60
|
+
tenant?: RealtimeTenant;
|
|
61
61
|
pingInterval: number;
|
|
62
62
|
pingIntervalMs: number;
|
|
63
63
|
reconnectTimeout?: number;
|
|
@@ -68,7 +68,7 @@ declare class RealtimeAPI {
|
|
|
68
68
|
* @param {Object|string} options A string representing the url of the service or an object containing the url and the apiKey.
|
|
69
69
|
* @param {string} options.url Url to the [geOps realtime api](https://developer.geops.io/apis/realtime/).
|
|
70
70
|
* @param {string} options.apiKey Access key for [geOps apis](https://developer.geops.io/).
|
|
71
|
-
* @param {string} [options.
|
|
71
|
+
* @param {string} [options.tenant=''] Tenant of the provider. Use to limitate some subscriptions to a specfic provider (it is used by schematic channels and newsticker).
|
|
72
72
|
* @param {string} [options.projection] The epsg code of the projection for features. Default to EPSG:3857.
|
|
73
73
|
* @param {number[4]} [options.bbox=[minX, minY, maxX, maxY, zoom, tenant] The bounding box to receive data from.
|
|
74
74
|
*/
|
|
@@ -151,7 +151,7 @@ declare class RealtimeAPI {
|
|
|
151
151
|
*/
|
|
152
152
|
getStation(uic: RealtimeStationId, mode: RealtimeMode): Promise<WebSocketAPIMessageEventData<RealtimeStation>>;
|
|
153
153
|
/**
|
|
154
|
-
* Get the list of
|
|
154
|
+
* Get the list of stations available for a specifc mode. The promise is resolved every 100ms
|
|
155
155
|
* @param {RealtimeMode} mode Realtime mode.
|
|
156
156
|
* @param {number} timeout = 100 Duration in ms between each promise resolve calls.
|
|
157
157
|
* @return {Promise<RealtimeStation[]>} An array of stations.
|
package/api/RealtimeAPI.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RealtimeAPI.d.ts","sourceRoot":"","sources":["../../src/api/RealtimeAPI.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,EAAE,EACnB,2BA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../common/utils/debounceWebsocketMessages';
|
|
3
|
-
import
|
|
3
|
+
import getRealtimeModeSuffix from '../common/utils/getRealtimeModeSuffix';
|
|
4
4
|
/**
|
|
5
5
|
* Enum for Realtime modes.
|
|
6
6
|
* @readonly
|
|
@@ -38,14 +38,14 @@ class RealtimeAPI {
|
|
|
38
38
|
* @param {Object|string} options A string representing the url of the service or an object containing the url and the apiKey.
|
|
39
39
|
* @param {string} options.url Url to the [geOps realtime api](https://developer.geops.io/apis/realtime/).
|
|
40
40
|
* @param {string} options.apiKey Access key for [geOps apis](https://developer.geops.io/).
|
|
41
|
-
* @param {string} [options.
|
|
41
|
+
* @param {string} [options.tenant=''] Tenant of the provider. Use to limitate some subscriptions to a specfic provider (it is used by schematic channels and newsticker).
|
|
42
42
|
* @param {string} [options.projection] The epsg code of the projection for features. Default to EPSG:3857.
|
|
43
43
|
* @param {number[4]} [options.bbox=[minX, minY, maxX, maxY, zoom, tenant] The bounding box to receive data from.
|
|
44
44
|
*/
|
|
45
45
|
constructor(options = {}) {
|
|
46
46
|
this.defineProperties(options);
|
|
47
47
|
/** @ignore */
|
|
48
|
-
this.
|
|
48
|
+
this.tenant = options.tenant;
|
|
49
49
|
/** @ignore */
|
|
50
50
|
this.onOpen = this.onOpen.bind(this);
|
|
51
51
|
}
|
|
@@ -218,9 +218,9 @@ class RealtimeAPI {
|
|
|
218
218
|
* @private
|
|
219
219
|
*/
|
|
220
220
|
unsubscribe(channel, suffix = '', onMessage) {
|
|
221
|
-
const
|
|
222
|
-
const suffixTopographic =
|
|
223
|
-
this.wsApi.unsubscribe(`${channel}${
|
|
221
|
+
const suffixSchematic = getRealtimeModeSuffix(RealtimeModes.SCHEMATIC, RealtimeModes, this.tenant);
|
|
222
|
+
const suffixTopographic = getRealtimeModeSuffix(RealtimeModes.TOPOGRAPHIC, RealtimeModes, this.tenant);
|
|
223
|
+
this.wsApi.unsubscribe(`${channel}${suffixSchematic}${suffix || ''}`, onMessage);
|
|
224
224
|
this.wsApi.unsubscribe(`${channel}${suffixTopographic}${suffix || ''}`, onMessage);
|
|
225
225
|
}
|
|
226
226
|
/**
|
|
@@ -251,7 +251,8 @@ class RealtimeAPI {
|
|
|
251
251
|
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
252
252
|
*/
|
|
253
253
|
subscribeDisruptions(onMessage, onError = () => { }, quiet = false) {
|
|
254
|
-
this.
|
|
254
|
+
const channel = [this.tenant, 'newsticker'];
|
|
255
|
+
this.subscribe(channel.join('_'), onMessage, onError, quiet);
|
|
255
256
|
}
|
|
256
257
|
/**
|
|
257
258
|
* Unsubscribe disruptions.
|
|
@@ -259,7 +260,8 @@ class RealtimeAPI {
|
|
|
259
260
|
* @param {function(data: { content: RealtimeNews[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
260
261
|
*/
|
|
261
262
|
unsubscribeDisruptions(onMessage) {
|
|
262
|
-
this.
|
|
263
|
+
const channel = [this.tenant, 'newsticker'];
|
|
264
|
+
this.unsubscribe(channel.join('_'), '', onMessage);
|
|
263
265
|
}
|
|
264
266
|
/**
|
|
265
267
|
* Return a station with a given uic number and a mode.
|
|
@@ -270,7 +272,7 @@ class RealtimeAPI {
|
|
|
270
272
|
*/
|
|
271
273
|
getStation(uic, mode) {
|
|
272
274
|
const params = {
|
|
273
|
-
channel: `station${
|
|
275
|
+
channel: `station${getRealtimeModeSuffix(mode, RealtimeModes, this.tenant)}`,
|
|
274
276
|
args: uic,
|
|
275
277
|
};
|
|
276
278
|
return new Promise((resolve, reject) => {
|
|
@@ -278,7 +280,7 @@ class RealtimeAPI {
|
|
|
278
280
|
});
|
|
279
281
|
}
|
|
280
282
|
/**
|
|
281
|
-
* Get the list of
|
|
283
|
+
* Get the list of stations available for a specifc mode. The promise is resolved every 100ms
|
|
282
284
|
* @param {RealtimeMode} mode Realtime mode.
|
|
283
285
|
* @param {number} timeout = 100 Duration in ms between each promise resolve calls.
|
|
284
286
|
* @return {Promise<RealtimeStation[]>} An array of stations.
|
|
@@ -286,7 +288,7 @@ class RealtimeAPI {
|
|
|
286
288
|
getStations(mode, timeout = 100) {
|
|
287
289
|
return new Promise((resolve) => {
|
|
288
290
|
this.wsApi.get({
|
|
289
|
-
channel: `station${
|
|
291
|
+
channel: `station${getRealtimeModeSuffix(mode, RealtimeModes, this.tenant)}`,
|
|
290
292
|
}, debounceWebsocketMessages(resolve, undefined, timeout));
|
|
291
293
|
});
|
|
292
294
|
}
|
|
@@ -300,7 +302,7 @@ class RealtimeAPI {
|
|
|
300
302
|
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
301
303
|
*/
|
|
302
304
|
subscribeStations(mode, onMessage, onError = () => { }, quiet = false) {
|
|
303
|
-
this.subscribe(`station${
|
|
305
|
+
this.subscribe(`station${getRealtimeModeSuffix(mode, RealtimeModes, this.tenant)}`, onMessage, onError, quiet);
|
|
304
306
|
}
|
|
305
307
|
/**
|
|
306
308
|
* Unsubscribe to stations channel.
|
|
@@ -336,7 +338,7 @@ class RealtimeAPI {
|
|
|
336
338
|
*/
|
|
337
339
|
subscribeTrajectory(mode, onMessage, onError = () => { }, quiet = false) {
|
|
338
340
|
this.unsubscribeTrajectory(onMessage);
|
|
339
|
-
this.subscribe(`trajectory${
|
|
341
|
+
this.subscribe(`trajectory${getRealtimeModeSuffix(mode, RealtimeModes, this.tenant)}`, onMessage, onError, quiet);
|
|
340
342
|
}
|
|
341
343
|
/**
|
|
342
344
|
* Unsubscribe to trajectory channels.
|
|
@@ -355,7 +357,7 @@ class RealtimeAPI {
|
|
|
355
357
|
*/
|
|
356
358
|
subscribeDeletedVehicles(mode, onMessage, onError = () => { }, quiet = false) {
|
|
357
359
|
this.unsubscribeDeletedVehicles(onMessage);
|
|
358
|
-
this.subscribe(`deleted_vehicles${
|
|
360
|
+
this.subscribe(`deleted_vehicles${getRealtimeModeSuffix(mode, RealtimeModes, this.tenant)}`, onMessage, onError, quiet);
|
|
359
361
|
}
|
|
360
362
|
/**
|
|
361
363
|
* Unsubscribe to deleted_vhicles channels.
|
|
@@ -373,7 +375,9 @@ class RealtimeAPI {
|
|
|
373
375
|
* @return {Promise<{ data: { content: FullTrajectory } }>} Return a full trajectory.
|
|
374
376
|
*/
|
|
375
377
|
getFullTrajectory(id, mode, generalizationLevel) {
|
|
376
|
-
const channel = [
|
|
378
|
+
const channel = [
|
|
379
|
+
`full_trajectory${getRealtimeModeSuffix(mode, RealtimeModes)}`,
|
|
380
|
+
];
|
|
377
381
|
if (id) {
|
|
378
382
|
channel.push(id);
|
|
379
383
|
}
|
|
@@ -397,7 +401,7 @@ class RealtimeAPI {
|
|
|
397
401
|
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
398
402
|
*/
|
|
399
403
|
subscribeFullTrajectory(id, mode, onMessage, onError = () => { }, quiet = false) {
|
|
400
|
-
this.subscribe(`full_trajectory${
|
|
404
|
+
this.subscribe(`full_trajectory${getRealtimeModeSuffix(mode, RealtimeModes)}_${id}`, onMessage, onError, quiet);
|
|
401
405
|
}
|
|
402
406
|
/**
|
|
403
407
|
* Unsubscribe from full_trajectory channel
|
|
@@ -36,7 +36,6 @@ export declare type RealtimeLayerMixinOptions = OlLayerOptions & {
|
|
|
36
36
|
getRenderTimeIntervalByZoom?: (zoom: number, renderTimeIntervalByZoom: number[]) => number;
|
|
37
37
|
url?: string;
|
|
38
38
|
apiKey?: string;
|
|
39
|
-
prefix?: string;
|
|
40
39
|
projection?: string;
|
|
41
40
|
bbox?: (number | string)[];
|
|
42
41
|
buffer?: number[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RealtimeLayerMixin.d.ts","sourceRoot":"","sources":["../../../src/common/mixins/RealtimeLayerMixin.ts"],"names":[],"mappings":"AAOA,OAAO,OAAO,MAAM,mBAAmB,CAAC;AAIxC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe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EU,SAAS,kBACL,OAAO;QA8CxB;;;;;;;;;;;;;;WAcG;sCAEU,SAAS,GAAG,SAAS,iBACjB,OAAO,GAAG,SAAS;yBAwBnB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,SAAS,MAAM;QAyChE;;;;;WAKG;kCACsB,MAAM,GAAG,SAAS,GAAO,MAAM;QA0BxD;;;;WAIG;6BACkB,cAAc;QASnC;;;;;;;;WAQG;oEAGQ,0BAA0B;;;;;QAkCrC;;;;;WAKG;+BACoB,eAAe;;;;QAiBtC;;WAEG;;QAaH;;;;;;;;;;;WAWG;4DAGO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,QAClC,MAAM;QAcd;;;;WAIG;;yCAa8B,kBAAkB,GAAG,eAAe;QAYrE;;;;;WAKG;;;QAqBH;;;;;WAKG;kCAEK,6BAA6B,kBAAkB,CAAC;QAgDxD;;;;;;WAMG;wCAEK,6BAA6B,eAAe,CAAC;QAQrD;;;;;;WAMG;iCAES,OAAO,EAAE,SACZ,gBAAgB;QAgBzB;;;;;;WAMG;iCAES,OAAO,EAAE,SACZ,gBAAgB;;MAkB5B;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -57,11 +57,14 @@ function RealtimeLayerMixin(Base) {
|
|
|
57
57
|
return class Mixin extends Base {
|
|
58
58
|
constructor(options) {
|
|
59
59
|
super(Object.assign({ hitTolerance: 10 }, options));
|
|
60
|
+
this.minZoomInterpolation = 8;
|
|
60
61
|
this.debug = options.debug || false;
|
|
61
62
|
this.mode = options.mode || RealtimeModes.TOPOGRAPHIC;
|
|
62
63
|
this.api = options.api || new RealtimeAPI(options);
|
|
63
64
|
this.tenant = options.tenant || ''; // sbb,sbh or sbm
|
|
64
|
-
|
|
65
|
+
if (!Number.isNaN(options.minZoomInterpolation)) {
|
|
66
|
+
this.minZoomInterpolation = options.minZoomInterpolation || 0; // Min zoom level from which trains positions are not interpolated.
|
|
67
|
+
}
|
|
65
68
|
this.format = new GeoJSON();
|
|
66
69
|
// MOTs by zoom
|
|
67
70
|
const allMots = [
|
package/common/styles/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { default as realtimeDefaultStyle } from "./realtimeDefaultStyle";
|
|
2
2
|
export { default as realtimeDelayStyle } from "./realtimeDelayStyle";
|
|
3
3
|
export { default as realtimeSimpleStyle } from "./realtimeSimpleStyle";
|
|
4
|
-
export { default as realtimeHeadingStyle } from "./realtimeHeadingStyle";
|
|
5
4
|
export * from "./realtimeDefaultStyle";
|
|
6
5
|
//# sourceMappingURL=index.d.ts.map
|
package/common/styles/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { default as realtimeDefaultStyle } from './realtimeDefaultStyle';
|
|
2
2
|
export { default as realtimeDelayStyle } from './realtimeDelayStyle';
|
|
3
3
|
export { default as realtimeSimpleStyle } from './realtimeSimpleStyle';
|
|
4
|
-
export { default as realtimeHeadingStyle } from './realtimeHeadingStyle';
|
|
5
4
|
export * from './realtimeDefaultStyle';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMapboxRender.d.ts","sourceRoot":"","sources":["../../../src/common/utils/getMapboxRender.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"getMapboxRender.d.ts","sourceRoot":"","sources":["../../../src/common/utils/getMapboxRender.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,KAAK,WAAW,MAAM,6BAA6B,CAAC;AAC3D;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,UAAU,EAAE,WAAW,GACtB,cAAc,CA4FhB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { RealtimeMode } from '../../types';
|
|
1
|
+
import type { RealtimeMode, RealtimeTenant } from '../../types';
|
|
2
2
|
import type { RealtimeModesType } from '../../api/RealtimeAPI';
|
|
3
3
|
/**
|
|
4
4
|
* Get the websocket channel suffix, depending on the current mode.
|
|
5
5
|
* @param {String} mode Mode 'topographic' ou 'schematic'.
|
|
6
6
|
* @private
|
|
7
7
|
*/
|
|
8
|
-
declare const
|
|
9
|
-
export default
|
|
8
|
+
declare const getRealtimeModeSuffix: (mode: RealtimeMode, modes: RealtimeModesType, tenant?: RealtimeTenant) => string;
|
|
9
|
+
export default getRealtimeModeSuffix;
|
|
10
10
|
//# sourceMappingURL=getRealtimeModeSuffix.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRealtimeModeSuffix.d.ts","sourceRoot":"","sources":["../../../src/common/utils/getRealtimeModeSuffix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"getRealtimeModeSuffix.d.ts","sourceRoot":"","sources":["../../../src/common/utils/getRealtimeModeSuffix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D;;;;GAIG;AACH,QAAA,MAAM,qBAAqB,SACnB,YAAY,SACX,iBAAiB,WACf,cAAc,KACtB,MAQF,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -3,5 +3,11 @@
|
|
|
3
3
|
* @param {String} mode Mode 'topographic' ou 'schematic'.
|
|
4
4
|
* @private
|
|
5
5
|
*/
|
|
6
|
-
const
|
|
7
|
-
|
|
6
|
+
const getRealtimeModeSuffix = (mode, modes, tenant) => {
|
|
7
|
+
const schematicSuffix = ['', 'schematic'];
|
|
8
|
+
if (tenant) {
|
|
9
|
+
schematicSuffix.push(tenant);
|
|
10
|
+
}
|
|
11
|
+
return mode === modes.SCHEMATIC ? schematicSuffix.join('_') : '';
|
|
12
|
+
};
|
|
13
|
+
export default getRealtimeModeSuffix;
|
package/common/utils/index.d.ts
CHANGED
|
@@ -12,6 +12,5 @@ export { default as debounceDeparturesMessages } from "./debounceDeparturesMessa
|
|
|
12
12
|
export { default as debounceWebsocketMessages } from "./debounceWebsocketMessages";
|
|
13
13
|
export { default as sortAndFilterDepartures } from "./sortAndFilterDepartures";
|
|
14
14
|
export { default as compareDepartures } from "./compareDepartures";
|
|
15
|
-
export { default as createCanvas } from "./createCanvas";
|
|
16
15
|
export * as realtimeConfig from "./realtimeConfig";
|
|
17
16
|
//# sourceMappingURL=index.d.ts.map
|
package/common/utils/index.js
CHANGED
|
@@ -12,6 +12,5 @@ export { default as debounceDeparturesMessages } from './debounceDeparturesMessa
|
|
|
12
12
|
export { default as debounceWebsocketMessages } from './debounceWebsocketMessages';
|
|
13
13
|
export { default as sortAndFilterDepartures } from './sortAndFilterDepartures';
|
|
14
14
|
export { default as compareDepartures } from './compareDepartures';
|
|
15
|
-
export { default as createCanvas } from './createCanvas';
|
|
16
15
|
import * as realtimeConfig_1 from './realtimeConfig';
|
|
17
16
|
export { realtimeConfig_1 as realtimeConfig };
|
|
@@ -52,11 +52,10 @@ const renderTrajectories = (canvas, trajectories, style, viewState, options) =>
|
|
|
52
52
|
const { train_id: id, timeOffset } = trajectory.properties;
|
|
53
53
|
// We set the rotation and the timeFraction of the trajectory (used by tralis).
|
|
54
54
|
// if rotation === null that seems there is no rotation available.
|
|
55
|
-
const { coord, rotation:
|
|
56
|
-
// console.log(heading);
|
|
55
|
+
const { coord, rotation: rotationIcon } = getVehiclePosition(time - (timeOffset || 0), trajectory, noInterpolate);
|
|
57
56
|
// We store the current vehicle position to the trajectory.
|
|
58
57
|
trajectories[i].properties.coordinate = coord;
|
|
59
|
-
trajectories[i].properties.rotation =
|
|
58
|
+
trajectories[i].properties.rotation = rotationIcon;
|
|
60
59
|
if (!coord) {
|
|
61
60
|
// eslint-disable-next-line no-continue
|
|
62
61
|
continue;
|