mobility-toolbox-js 2.0.0-beta.73 → 2.0.0-beta.75
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/common/mixins/RealtimeLayerMixin.d.ts +8 -4
- package/common/mixins/RealtimeLayerMixin.d.ts.map +1 -1
- package/common/mixins/RealtimeLayerMixin.js +9 -1
- package/common/styles/index.d.ts +0 -1
- package/common/styles/index.js +0 -1
- package/common/utils/index.d.ts +0 -1
- package/common/utils/index.js +0 -1
- package/common/utils/renderTrajectories.js +2 -3
- package/mapbox/layers/RealtimeLayer.d.ts +2 -0
- package/mapbox/layers/RealtimeLayer.d.ts.map +1 -1
- package/mbt.js +31 -114
- package/mbt.js.map +4 -4
- package/mbt.min.js +28 -28
- package/mbt.min.js.map +4 -4
- package/ol/layers/RealtimeLayer.d.ts +2 -0
- package/ol/layers/RealtimeLayer.d.ts.map +1 -1
- package/package.json +1 -1
- package/common/styles/realtimeHeadingStyle.d.ts +0 -12
- package/common/styles/realtimeHeadingStyle.d.ts.map +0 -1
- package/common/styles/realtimeHeadingStyle.js +0 -85
|
@@ -3,7 +3,7 @@ import { EventsKey } from 'ol/events';
|
|
|
3
3
|
import { Coordinate } from 'ol/coordinate';
|
|
4
4
|
import { Feature } from 'ol';
|
|
5
5
|
import { RealtimeAPI } from '../../api';
|
|
6
|
-
import { AnyCanvas, AnyLayerClass, AnyMap, AnyRealtimeLayer, LayerGetFeatureInfoOptions, RealtimeGeneralizationLevel, RealtimeMode, RealtimeMot, RealtimeRenderState, RealtimeStyleFunction, RealtimeStyleOptions, RealtimeTenant, RealtimeTrainId, ViewState } from '../../types';
|
|
6
|
+
import { AnyCanvas, AnyLayerClass, AnyMap, AnyRealtimeLayer, LayerGetFeatureInfoOptions, RealtimeGeneralizationLevel, RealtimeMode, RealtimeMot, RealtimeRenderState, RealtimeStyleFunction, RealtimeStyleOptions, RealtimeTenant, RealtimeTrainId, ViewState, AnyLayer } from '../../types';
|
|
7
7
|
import { RealtimeTrajectory } from '../../api/typedefs';
|
|
8
8
|
import { WebSocketAPIMessageEventData } from '../api/WebSocketAPI';
|
|
9
9
|
import type { OlLayerOptions } from '../../ol/layers/Layer';
|
|
@@ -34,6 +34,8 @@ export declare type RealtimeLayerMixinOptions = OlLayerOptions & {
|
|
|
34
34
|
getMotsByZoom: (zoom: number, motsByZoom: RealtimeMot[][]) => RealtimeMot[];
|
|
35
35
|
getGeneralizationLevelByZoom?: (zoom: number, generalizationLevelByZoom: RealtimeGeneralizationLevel[]) => RealtimeGeneralizationLevel;
|
|
36
36
|
getRenderTimeIntervalByZoom?: (zoom: number, renderTimeIntervalByZoom: number[]) => number;
|
|
37
|
+
onStart?: (realtimeLayer: AnyRealtimeLayer) => void;
|
|
38
|
+
onStop?: (realtimeLayer: AnyRealtimeLayer) => void;
|
|
37
39
|
url?: string;
|
|
38
40
|
apiKey?: string;
|
|
39
41
|
prefix?: string;
|
|
@@ -45,7 +47,7 @@ export declare type RealtimeLayerMixinOptions = OlLayerOptions & {
|
|
|
45
47
|
/**
|
|
46
48
|
* RealtimeLayerInterface.
|
|
47
49
|
*/
|
|
48
|
-
export declare class
|
|
50
|
+
export declare class Function {
|
|
49
51
|
/**
|
|
50
52
|
* Start the clock.
|
|
51
53
|
*/
|
|
@@ -95,8 +97,8 @@ declare function RealtimeLayerMixin<T extends AnyLayerClass>(Base: T): {
|
|
|
95
97
|
time?: Date | undefined;
|
|
96
98
|
live?: boolean | undefined;
|
|
97
99
|
speed?: number | undefined;
|
|
98
|
-
filter?: Function | undefined;
|
|
99
|
-
sort?: Function | undefined;
|
|
100
|
+
filter?: globalThis.Function | undefined;
|
|
101
|
+
sort?: globalThis.Function | undefined;
|
|
100
102
|
style?: RealtimeStyleFunction | undefined;
|
|
101
103
|
styleOptions?: RealtimeStyleOptions | undefined;
|
|
102
104
|
pixelRatio?: number | undefined;
|
|
@@ -124,6 +126,8 @@ declare function RealtimeLayerMixin<T extends AnyLayerClass>(Base: T): {
|
|
|
124
126
|
getRenderTimeIntervalByZoom: (zoom: number) => number;
|
|
125
127
|
throttleRenderTrajectories: (viewState: ViewState, noInterpolate?: boolean) => void;
|
|
126
128
|
debounceRenderTrajectories: (viewState: ViewState, noInterpolate?: boolean) => void;
|
|
129
|
+
onStart?: ((realtimeLayer: AnyLayer) => void) | undefined;
|
|
130
|
+
onStop?: ((realtimeLayer: AnyLayer) => void) | undefined;
|
|
127
131
|
/**
|
|
128
132
|
* Define layer's properties.
|
|
129
133
|
*
|
|
@@ -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,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAiB,MAAM,WAAW,CAAC;AAGvD,OAAO,EACL,SAAS,EACT,aAAa,EACb,MAAM,EACN,gBAAgB,EAChB,0BAA0B,EAC1B,2BAA2B,EAC3B,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,SAAS,
|
|
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,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAiB,MAAM,WAAW,CAAC;AAGvD,OAAO,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;;WAMG;iCAES,OAAO,EAAE,SACZ,gBAAgB;;MAkB5B;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -16,7 +16,7 @@ import * as realtimeConfig from '../utils/realtimeConfig';
|
|
|
16
16
|
/**
|
|
17
17
|
* RealtimeLayerInterface.
|
|
18
18
|
*/
|
|
19
|
-
export class
|
|
19
|
+
export class Function {
|
|
20
20
|
/**
|
|
21
21
|
* Start the clock.
|
|
22
22
|
*/
|
|
@@ -63,6 +63,8 @@ function RealtimeLayerMixin(Base) {
|
|
|
63
63
|
this.tenant = options.tenant || ''; // sbb,sbh or sbm
|
|
64
64
|
this.minZoomInterpolation = options.minZoomInterpolation || 8; // Min zoom level from which trains positions are not interpolated.
|
|
65
65
|
this.format = new GeoJSON();
|
|
66
|
+
this.onStart = options.onStart;
|
|
67
|
+
this.onStop = options.onStop;
|
|
66
68
|
// MOTs by zoom
|
|
67
69
|
const allMots = [
|
|
68
70
|
'tram',
|
|
@@ -353,6 +355,9 @@ function RealtimeLayerMixin(Base) {
|
|
|
353
355
|
// @ts-ignore function without parameters defined by subclasses
|
|
354
356
|
this.setBbox();
|
|
355
357
|
}
|
|
358
|
+
if (this.onStart) {
|
|
359
|
+
this.onStart(this);
|
|
360
|
+
}
|
|
356
361
|
}
|
|
357
362
|
/**
|
|
358
363
|
* Start the clock.
|
|
@@ -375,6 +380,9 @@ function RealtimeLayerMixin(Base) {
|
|
|
375
380
|
this.api.unsubscribeTrajectory(this.onTrajectoryMessage);
|
|
376
381
|
this.api.unsubscribeDeletedVehicles(this.onDeleteTrajectoryMessage);
|
|
377
382
|
this.api.close();
|
|
383
|
+
if (this.onStop) {
|
|
384
|
+
this.onStop(this);
|
|
385
|
+
}
|
|
378
386
|
}
|
|
379
387
|
/**
|
|
380
388
|
* Stop the clock.
|
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';
|
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;
|
|
@@ -47,6 +47,8 @@ declare const RealtimeLayer_base: {
|
|
|
47
47
|
getRenderTimeIntervalByZoom: (zoom: number) => number;
|
|
48
48
|
throttleRenderTrajectories: (viewState: import("../../types").ViewState, noInterpolate?: boolean | undefined) => void;
|
|
49
49
|
debounceRenderTrajectories: (viewState: import("../../types").ViewState, noInterpolate?: boolean | undefined) => void;
|
|
50
|
+
onStart?: ((realtimeLayer: any) => void) | undefined;
|
|
51
|
+
onStop?: ((realtimeLayer: any) => void) | undefined;
|
|
50
52
|
defineProperties(options: import("../../common/mixins/RealtimeLayerMixin").RealtimeLayerMixinOptions): void;
|
|
51
53
|
attachToMap(map: any): void;
|
|
52
54
|
detachFromMap(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RealtimeLayer.d.ts","sourceRoot":"","sources":["../../../src/mapbox/layers/RealtimeLayer.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAE7B,OAAO,KAAK,MAAM,SAAS,CAAC;AAE5B,OAAO,KAAK,EAAE,YAAY,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,KAAK,EAAE,kBAAkB,EAAE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MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM;IAUhE;;;;OAIG;IACH,MAAM;IAIN,0BAA0B,CACxB,SAAS,EAAE,SAAS,EACpB,aAAa,GAAE,OAAe;IAahC;;;;;OAKG;IACH,SAAS;IAQT;;;;;OAKG;IACH,cAAc,CACZ,QAAQ,EAAE,OAAO,EAAE,EACnB,KAAK,EAAE,aAAa,EACpB,UAAU,EAAE,UAAU;CAOzB;AAED,eAAe,aAAa,CAAC"}
|
package/mbt.js
CHANGED
|
@@ -33297,7 +33297,6 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
33297
33297
|
VectorLayer: () => VectorLayer_default2,
|
|
33298
33298
|
WMSLayer: () => WMSLayer_default,
|
|
33299
33299
|
compareDepartures: () => compareDepartures_default,
|
|
33300
|
-
createCanvas: () => createCanvas_default,
|
|
33301
33300
|
createRealtimeFilters: () => createRealtimeFilters_default,
|
|
33302
33301
|
debounceDeparturesMessages: () => debounceDeparturesMessages_default,
|
|
33303
33302
|
debounceWebsocketMessages: () => debounceWebsocketMessages_default,
|
|
@@ -33319,7 +33318,6 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
33319
33318
|
realtimeConfig: () => realtimeConfig_exports,
|
|
33320
33319
|
realtimeDefaultStyle: () => realtimeDefaultStyle_default,
|
|
33321
33320
|
realtimeDelayStyle: () => realtimeDelayStyle_default,
|
|
33322
|
-
realtimeHeadingStyle: () => realtimeHeadingStyle_default,
|
|
33323
33321
|
realtimeSimpleStyle: () => realtimeSimpleStyle_default,
|
|
33324
33322
|
removeDuplicate: () => removeDuplicate_default,
|
|
33325
33323
|
renderTrajectories: () => renderTrajectories_default,
|
|
@@ -38089,13 +38087,13 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
38089
38087
|
continue;
|
|
38090
38088
|
}
|
|
38091
38089
|
const { train_id: id, timeOffset } = trajectory.properties;
|
|
38092
|
-
const { coord, rotation:
|
|
38090
|
+
const { coord, rotation: rotationIcon } = getVehiclePosition_default(
|
|
38093
38091
|
time - (timeOffset || 0),
|
|
38094
38092
|
trajectory,
|
|
38095
38093
|
noInterpolate
|
|
38096
38094
|
);
|
|
38097
38095
|
trajectories[i].properties.coordinate = coord;
|
|
38098
|
-
trajectories[i].properties.rotation =
|
|
38096
|
+
trajectories[i].properties.rotation = rotationIcon;
|
|
38099
38097
|
if (!coord) {
|
|
38100
38098
|
continue;
|
|
38101
38099
|
}
|
|
@@ -38330,27 +38328,6 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
38330
38328
|
};
|
|
38331
38329
|
var debounceDeparturesMessages_default = debounceDeparturesMessages;
|
|
38332
38330
|
|
|
38333
|
-
// src/common/utils/createCanvas.ts
|
|
38334
|
-
var createCanvas = (width, height) => {
|
|
38335
|
-
let canvas2 = null;
|
|
38336
|
-
if (typeof window === "undefined") {
|
|
38337
|
-
return null;
|
|
38338
|
-
}
|
|
38339
|
-
if (typeof document !== "undefined" && document?.createElement) {
|
|
38340
|
-
canvas2 = document.createElement("canvas");
|
|
38341
|
-
canvas2.width = width;
|
|
38342
|
-
canvas2.height = height;
|
|
38343
|
-
} else if (OffscreenCanvas) {
|
|
38344
|
-
canvas2 = new OffscreenCanvas(width, height);
|
|
38345
|
-
} else {
|
|
38346
|
-
console.error(
|
|
38347
|
-
"We didn't find a way to create a canvas element, document.createElement('canvas') and new OffscrenCanvas() are not supported"
|
|
38348
|
-
);
|
|
38349
|
-
}
|
|
38350
|
-
return canvas2;
|
|
38351
|
-
};
|
|
38352
|
-
var createCanvas_default = createCanvas;
|
|
38353
|
-
|
|
38354
38331
|
// src/common/utils/realtimeConfig.ts
|
|
38355
38332
|
var realtimeConfig_exports = {};
|
|
38356
38333
|
__export(realtimeConfig_exports, {
|
|
@@ -38498,6 +38475,27 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
38498
38475
|
return "";
|
|
38499
38476
|
};
|
|
38500
38477
|
|
|
38478
|
+
// src/common/utils/createCanvas.ts
|
|
38479
|
+
var createCanvas = (width, height) => {
|
|
38480
|
+
let canvas2 = null;
|
|
38481
|
+
if (typeof window === "undefined") {
|
|
38482
|
+
return null;
|
|
38483
|
+
}
|
|
38484
|
+
if (typeof document !== "undefined" && document?.createElement) {
|
|
38485
|
+
canvas2 = document.createElement("canvas");
|
|
38486
|
+
canvas2.width = width;
|
|
38487
|
+
canvas2.height = height;
|
|
38488
|
+
} else if (OffscreenCanvas) {
|
|
38489
|
+
canvas2 = new OffscreenCanvas(width, height);
|
|
38490
|
+
} else {
|
|
38491
|
+
console.error(
|
|
38492
|
+
"We didn't find a way to create a canvas element, document.createElement('canvas') and new OffscrenCanvas() are not supported"
|
|
38493
|
+
);
|
|
38494
|
+
}
|
|
38495
|
+
return canvas2;
|
|
38496
|
+
};
|
|
38497
|
+
var createCanvas_default = createCanvas;
|
|
38498
|
+
|
|
38501
38499
|
// src/common/styles/realtimeDefaultStyle.ts
|
|
38502
38500
|
var cacheDelayBg = {};
|
|
38503
38501
|
var getDelayBgCanvas = (origin, radius, color) => {
|
|
@@ -38802,93 +38800,6 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
38802
38800
|
};
|
|
38803
38801
|
var realtimeSimpleStyle_default = realtimeSimpleStyle;
|
|
38804
38802
|
|
|
38805
|
-
// src/common/styles/realtimeHeadingStyle.ts
|
|
38806
|
-
var rotateCanvas = (canvas2, rotation) => {
|
|
38807
|
-
const ctx = canvas2.getContext("2d");
|
|
38808
|
-
ctx?.translate(canvas2.width / 2, canvas2.height / 2);
|
|
38809
|
-
ctx?.rotate(rotation);
|
|
38810
|
-
ctx?.translate(-canvas2.width / 2, -canvas2.height / 2);
|
|
38811
|
-
};
|
|
38812
|
-
var arrowCache = {};
|
|
38813
|
-
var getArrowCanvas = (fillColor) => {
|
|
38814
|
-
const key = `${fillColor}`;
|
|
38815
|
-
if (!arrowCache[key]) {
|
|
38816
|
-
const arrowCanvas = createCanvas_default(20, 20);
|
|
38817
|
-
const ctx = arrowCanvas?.getContext("2d");
|
|
38818
|
-
if (ctx) {
|
|
38819
|
-
ctx.fillStyle = fillColor;
|
|
38820
|
-
ctx.beginPath();
|
|
38821
|
-
ctx.moveTo(5, 5);
|
|
38822
|
-
ctx.lineTo(10, 10);
|
|
38823
|
-
ctx.lineTo(5, 15);
|
|
38824
|
-
ctx.fill();
|
|
38825
|
-
ctx.beginPath();
|
|
38826
|
-
ctx.moveTo(5, 5);
|
|
38827
|
-
ctx.lineTo(10, 10);
|
|
38828
|
-
ctx.lineTo(5, 15);
|
|
38829
|
-
ctx.lineTo(5, 5);
|
|
38830
|
-
ctx.stroke();
|
|
38831
|
-
}
|
|
38832
|
-
arrowCache[key] = arrowCanvas;
|
|
38833
|
-
}
|
|
38834
|
-
return arrowCache[key];
|
|
38835
|
-
};
|
|
38836
|
-
var bufferArrowCache = {};
|
|
38837
|
-
var getBufferArrowCanvas = (canvas2, fillColor, rotation) => {
|
|
38838
|
-
const margin = 20;
|
|
38839
|
-
const bufferKey = `${fillColor},${canvas2.width},${canvas2.height},${rotation}`;
|
|
38840
|
-
if (!bufferArrowCache[bufferKey]) {
|
|
38841
|
-
const buffer2 = createCanvas_default(
|
|
38842
|
-
canvas2.width + margin * 2,
|
|
38843
|
-
canvas2.height + margin * 2
|
|
38844
|
-
);
|
|
38845
|
-
const arrowCanvas = getArrowCanvas(fillColor);
|
|
38846
|
-
if (arrowCanvas && buffer2) {
|
|
38847
|
-
const bufferCtx = buffer2.getContext("2d");
|
|
38848
|
-
bufferCtx?.drawImage(
|
|
38849
|
-
arrowCanvas,
|
|
38850
|
-
buffer2.width - margin,
|
|
38851
|
-
buffer2.height / 2 - arrowCanvas.height / 2,
|
|
38852
|
-
arrowCanvas.width,
|
|
38853
|
-
arrowCanvas.height
|
|
38854
|
-
);
|
|
38855
|
-
bufferCtx?.save();
|
|
38856
|
-
const rot = rotation + 90 * Math.PI / 180;
|
|
38857
|
-
rotateCanvas(buffer2, -rot);
|
|
38858
|
-
bufferCtx?.restore();
|
|
38859
|
-
}
|
|
38860
|
-
bufferArrowCache[bufferKey] = buffer2;
|
|
38861
|
-
}
|
|
38862
|
-
return bufferArrowCache[bufferKey];
|
|
38863
|
-
};
|
|
38864
|
-
var realtimeHeadingStyle = (trajectory, viewState, options) => {
|
|
38865
|
-
const { rotation, type, line } = trajectory.properties;
|
|
38866
|
-
const { color } = line || {};
|
|
38867
|
-
const canvas2 = realtimeDefaultStyle_default(trajectory, viewState, options);
|
|
38868
|
-
if (canvas2 && rotation !== null) {
|
|
38869
|
-
const circleFillColor = color || getBgColor(type);
|
|
38870
|
-
const bufferArrow = getBufferArrowCanvas(canvas2, circleFillColor, rotation);
|
|
38871
|
-
if (bufferArrow) {
|
|
38872
|
-
const bufferSize = (bufferArrow.width - canvas2.width) / 2;
|
|
38873
|
-
const vehicleWithArrow = createCanvas_default(
|
|
38874
|
-
bufferArrow.width,
|
|
38875
|
-
bufferArrow.height
|
|
38876
|
-
);
|
|
38877
|
-
vehicleWithArrow?.getContext("2d")?.drawImage(bufferArrow, 0, 0, bufferArrow.width, bufferArrow.height);
|
|
38878
|
-
vehicleWithArrow?.getContext("2d")?.drawImage(
|
|
38879
|
-
canvas2,
|
|
38880
|
-
bufferSize,
|
|
38881
|
-
bufferSize,
|
|
38882
|
-
canvas2.width,
|
|
38883
|
-
canvas2.height
|
|
38884
|
-
);
|
|
38885
|
-
return vehicleWithArrow;
|
|
38886
|
-
}
|
|
38887
|
-
}
|
|
38888
|
-
return canvas2;
|
|
38889
|
-
};
|
|
38890
|
-
var realtimeHeadingStyle_default = realtimeHeadingStyle;
|
|
38891
|
-
|
|
38892
38803
|
// node_modules/ol/layer/Property.js
|
|
38893
38804
|
var Property_default = {
|
|
38894
38805
|
OPACITY: "opacity",
|
|
@@ -49740,6 +49651,8 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49740
49651
|
this.tenant = options.tenant || "";
|
|
49741
49652
|
this.minZoomInterpolation = options.minZoomInterpolation || 8;
|
|
49742
49653
|
this.format = new GeoJSON_default();
|
|
49654
|
+
this.onStart = options.onStart;
|
|
49655
|
+
this.onStop = options.onStop;
|
|
49743
49656
|
const allMots = [
|
|
49744
49657
|
"tram",
|
|
49745
49658
|
"subway",
|
|
@@ -50008,6 +49921,9 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
50008
49921
|
if (this.isUpdateBboxOnMoveEnd) {
|
|
50009
49922
|
this.setBbox();
|
|
50010
49923
|
}
|
|
49924
|
+
if (this.onStart) {
|
|
49925
|
+
this.onStart(this);
|
|
49926
|
+
}
|
|
50011
49927
|
}
|
|
50012
49928
|
startUpdateTime() {
|
|
50013
49929
|
this.stopUpdateTime();
|
|
@@ -50026,6 +49942,9 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
50026
49942
|
this.api.unsubscribeTrajectory(this.onTrajectoryMessage);
|
|
50027
49943
|
this.api.unsubscribeDeletedVehicles(this.onDeleteTrajectoryMessage);
|
|
50028
49944
|
this.api.close();
|
|
49945
|
+
if (this.onStop) {
|
|
49946
|
+
this.onStop(this);
|
|
49947
|
+
}
|
|
50029
49948
|
}
|
|
50030
49949
|
stopUpdateTime() {
|
|
50031
49950
|
if (this.updateTimeInterval) {
|
|
@@ -50701,7 +50620,6 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
50701
50620
|
RoutingAPI: () => RoutingAPI_default,
|
|
50702
50621
|
StopsAPI: () => StopsAPI_default,
|
|
50703
50622
|
compareDepartures: () => compareDepartures_default,
|
|
50704
|
-
createCanvas: () => createCanvas_default,
|
|
50705
50623
|
createRealtimeFilters: () => createRealtimeFilters_default,
|
|
50706
50624
|
debounceDeparturesMessages: () => debounceDeparturesMessages_default,
|
|
50707
50625
|
debounceWebsocketMessages: () => debounceWebsocketMessages_default,
|
|
@@ -50723,7 +50641,6 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
50723
50641
|
realtimeConfig: () => realtimeConfig_exports,
|
|
50724
50642
|
realtimeDefaultStyle: () => realtimeDefaultStyle_default,
|
|
50725
50643
|
realtimeDelayStyle: () => realtimeDelayStyle_default,
|
|
50726
|
-
realtimeHeadingStyle: () => realtimeHeadingStyle_default,
|
|
50727
50644
|
realtimeSimpleStyle: () => realtimeSimpleStyle_default,
|
|
50728
50645
|
removeDuplicate: () => removeDuplicate_default,
|
|
50729
50646
|
renderTrajectories: () => renderTrajectories_default,
|