mobility-toolbox-js 2.0.0-beta.71 → 2.0.0-beta.73
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/styles/index.d.ts +1 -0
- package/common/styles/index.js +1 -0
- package/common/styles/realtimeHeadingStyle.d.ts +12 -0
- package/common/styles/realtimeHeadingStyle.d.ts.map +1 -0
- package/common/styles/realtimeHeadingStyle.js +85 -0
- package/common/utils/getVehiclePosition.d.ts.map +1 -1
- package/common/utils/getVehiclePosition.js +5 -1
- package/common/utils/index.d.ts +1 -0
- package/common/utils/index.js +1 -0
- package/common/utils/renderTrajectories.js +3 -2
- package/mbt.js +122 -26
- 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 +1 -1
- package/ol/layers/RealtimeLayer.d.ts.map +1 -1
- package/ol/layers/RealtimeLayer.js +3 -2
- package/package.json +1 -1
package/common/styles/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
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";
|
|
4
5
|
export * from "./realtimeDefaultStyle";
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
package/common/styles/index.js
CHANGED
|
@@ -1,4 +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';
|
|
4
5
|
export * from './realtimeDefaultStyle';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { RealtimeStyleFunction } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* A tracker style that take in account the delay.
|
|
4
|
+
*
|
|
5
|
+
* @param {RealtimeTrajectory} trajectory The trajectory to render.
|
|
6
|
+
* @param {ViewState} viewState The view state of the map.
|
|
7
|
+
* @param {RealtimeStyleOptions} options Some options to change the rendering
|
|
8
|
+
* @return a canvas
|
|
9
|
+
*/
|
|
10
|
+
declare const realtimeHeadingStyle: RealtimeStyleFunction;
|
|
11
|
+
export default realtimeHeadingStyle;
|
|
12
|
+
//# sourceMappingURL=realtimeHeadingStyle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtimeHeadingStyle.d.ts","sourceRoot":"","sources":["../../../src/common/styles/realtimeHeadingStyle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,qBAAqB,EAEtB,MAAM,aAAa,CAAC;AAoFrB;;;;;;;GAOG;AACH,QAAA,MAAM,oBAAoB,EAAE,qBAoC3B,CAAC;AACF,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import createCanvas from '../utils/createCanvas';
|
|
2
|
+
import { getBgColor } from '../utils/realtimeConfig';
|
|
3
|
+
import realtimeDefaultStyle from './realtimeDefaultStyle';
|
|
4
|
+
/** @private */
|
|
5
|
+
const rotateCanvas = (canvas, rotation) => {
|
|
6
|
+
const ctx = canvas.getContext('2d');
|
|
7
|
+
ctx === null || ctx === void 0 ? void 0 : ctx.translate(canvas.width / 2, canvas.height / 2);
|
|
8
|
+
ctx === null || ctx === void 0 ? void 0 : ctx.rotate(rotation);
|
|
9
|
+
ctx === null || ctx === void 0 ? void 0 : ctx.translate(-canvas.width / 2, -canvas.height / 2);
|
|
10
|
+
};
|
|
11
|
+
const arrowCache = {};
|
|
12
|
+
/** @private */
|
|
13
|
+
const getArrowCanvas = (fillColor) => {
|
|
14
|
+
const key = `${fillColor}`;
|
|
15
|
+
if (!arrowCache[key]) {
|
|
16
|
+
// Create the arrow canvas
|
|
17
|
+
const arrowCanvas = createCanvas(20, 20);
|
|
18
|
+
const ctx = arrowCanvas === null || arrowCanvas === void 0 ? void 0 : arrowCanvas.getContext('2d');
|
|
19
|
+
if (ctx) {
|
|
20
|
+
ctx.fillStyle = fillColor;
|
|
21
|
+
ctx.beginPath();
|
|
22
|
+
ctx.moveTo(5, 5);
|
|
23
|
+
ctx.lineTo(10, 10);
|
|
24
|
+
ctx.lineTo(5, 15);
|
|
25
|
+
ctx.fill();
|
|
26
|
+
ctx.beginPath();
|
|
27
|
+
ctx.moveTo(5, 5);
|
|
28
|
+
ctx.lineTo(10, 10);
|
|
29
|
+
ctx.lineTo(5, 15);
|
|
30
|
+
ctx.lineTo(5, 5);
|
|
31
|
+
ctx.stroke();
|
|
32
|
+
}
|
|
33
|
+
arrowCache[key] = arrowCanvas;
|
|
34
|
+
}
|
|
35
|
+
return arrowCache[key];
|
|
36
|
+
};
|
|
37
|
+
const bufferArrowCache = {};
|
|
38
|
+
/** @private */
|
|
39
|
+
const getBufferArrowCanvas = (canvas, fillColor, rotation) => {
|
|
40
|
+
const margin = 20;
|
|
41
|
+
const bufferKey = `${fillColor},${canvas.width},${canvas.height},${rotation}`;
|
|
42
|
+
if (!bufferArrowCache[bufferKey]) {
|
|
43
|
+
// Create a buffer canvas around the current vehicle to display properly the arrow
|
|
44
|
+
const buffer = createCanvas(canvas.width + margin * 2, canvas.height + margin * 2);
|
|
45
|
+
const arrowCanvas = getArrowCanvas(fillColor);
|
|
46
|
+
if (arrowCanvas && buffer) {
|
|
47
|
+
const bufferCtx = buffer.getContext('2d');
|
|
48
|
+
bufferCtx === null || bufferCtx === void 0 ? void 0 : bufferCtx.drawImage(arrowCanvas, buffer.width - margin, buffer.height / 2 - arrowCanvas.height / 2, arrowCanvas.width, arrowCanvas.height);
|
|
49
|
+
bufferCtx === null || bufferCtx === void 0 ? void 0 : bufferCtx.save();
|
|
50
|
+
const rot = rotation + (90 * Math.PI) / 180;
|
|
51
|
+
rotateCanvas(buffer, -rot);
|
|
52
|
+
bufferCtx === null || bufferCtx === void 0 ? void 0 : bufferCtx.restore();
|
|
53
|
+
}
|
|
54
|
+
bufferArrowCache[bufferKey] = buffer;
|
|
55
|
+
}
|
|
56
|
+
return bufferArrowCache[bufferKey];
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* A tracker style that take in account the delay.
|
|
60
|
+
*
|
|
61
|
+
* @param {RealtimeTrajectory} trajectory The trajectory to render.
|
|
62
|
+
* @param {ViewState} viewState The view state of the map.
|
|
63
|
+
* @param {RealtimeStyleOptions} options Some options to change the rendering
|
|
64
|
+
* @return a canvas
|
|
65
|
+
*/
|
|
66
|
+
const realtimeHeadingStyle = (trajectory, viewState, options) => {
|
|
67
|
+
var _a, _b;
|
|
68
|
+
// @ts-ignore
|
|
69
|
+
const { rotation, type, line } = trajectory.properties;
|
|
70
|
+
const { color } = line || {};
|
|
71
|
+
const canvas = realtimeDefaultStyle(trajectory, viewState, options);
|
|
72
|
+
if (canvas && rotation !== null) {
|
|
73
|
+
const circleFillColor = color || getBgColor(type);
|
|
74
|
+
const bufferArrow = getBufferArrowCanvas(canvas, circleFillColor, rotation);
|
|
75
|
+
if (bufferArrow) {
|
|
76
|
+
const bufferSize = (bufferArrow.width - canvas.width) / 2;
|
|
77
|
+
const vehicleWithArrow = createCanvas(bufferArrow.width, bufferArrow.height);
|
|
78
|
+
(_a = vehicleWithArrow === null || vehicleWithArrow === void 0 ? void 0 : vehicleWithArrow.getContext('2d')) === null || _a === void 0 ? void 0 : _a.drawImage(bufferArrow, 0, 0, bufferArrow.width, bufferArrow.height);
|
|
79
|
+
(_b = vehicleWithArrow === null || vehicleWithArrow === void 0 ? void 0 : vehicleWithArrow.getContext('2d')) === null || _b === void 0 ? void 0 : _b.drawImage(canvas, bufferSize, bufferSize, canvas.width, canvas.height);
|
|
80
|
+
return vehicleWithArrow;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return canvas;
|
|
84
|
+
};
|
|
85
|
+
export default realtimeHeadingStyle;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getVehiclePosition.d.ts","sourceRoot":"","sources":["../../../src/common/utils/getVehiclePosition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,oBAAY,eAAe,GAAG;IAC5B,KAAK,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;;;GAOG;AACH,QAAA,MAAM,kBAAkB,QACjB,MAAM,6CAEI,OAAO,KACrB,
|
|
1
|
+
{"version":3,"file":"getVehiclePosition.d.ts","sourceRoot":"","sources":["../../../src/common/utils/getVehiclePosition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,oBAAY,eAAe,GAAG;IAC5B,KAAK,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;;;GAOG;AACH,QAAA,MAAM,kBAAkB,QACjB,MAAM,6CAEI,OAAO,KACrB,eAoEF,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -9,10 +9,14 @@ import { LineString } from 'ol/geom';
|
|
|
9
9
|
*/
|
|
10
10
|
const getVehiclePosition = (now, trajectory, noInterpolate) => {
|
|
11
11
|
const { time_intervals: timeIntervals, olGeometry, coordinate, } = trajectory.properties;
|
|
12
|
-
const {
|
|
12
|
+
const { coordinates } = trajectory.geometry;
|
|
13
|
+
let { type } = trajectory.geometry;
|
|
13
14
|
let geometry = olGeometry;
|
|
14
15
|
let coord;
|
|
15
16
|
let rotation;
|
|
17
|
+
if (olGeometry) {
|
|
18
|
+
type = geometry.getType();
|
|
19
|
+
}
|
|
16
20
|
if (noInterpolate && coordinate) {
|
|
17
21
|
coord = coordinate;
|
|
18
22
|
}
|
package/common/utils/index.d.ts
CHANGED
|
@@ -12,5 +12,6 @@ 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";
|
|
15
16
|
export * as realtimeConfig from "./realtimeConfig";
|
|
16
17
|
//# sourceMappingURL=index.d.ts.map
|
package/common/utils/index.js
CHANGED
|
@@ -12,5 +12,6 @@ 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';
|
|
15
16
|
import * as realtimeConfig_1 from './realtimeConfig';
|
|
16
17
|
export { realtimeConfig_1 as realtimeConfig };
|
|
@@ -52,10 +52,11 @@ 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:
|
|
55
|
+
const { coord, rotation: heading } = getVehiclePosition(time - (timeOffset || 0), trajectory, noInterpolate);
|
|
56
|
+
// console.log(heading);
|
|
56
57
|
// We store the current vehicle position to the trajectory.
|
|
57
58
|
trajectories[i].properties.coordinate = coord;
|
|
58
|
-
trajectories[i].properties.rotation =
|
|
59
|
+
trajectories[i].properties.rotation = heading;
|
|
59
60
|
if (!coord) {
|
|
60
61
|
// eslint-disable-next-line no-continue
|
|
61
62
|
continue;
|
package/mbt.js
CHANGED
|
@@ -33297,6 +33297,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
33297
33297
|
VectorLayer: () => VectorLayer_default2,
|
|
33298
33298
|
WMSLayer: () => WMSLayer_default,
|
|
33299
33299
|
compareDepartures: () => compareDepartures_default,
|
|
33300
|
+
createCanvas: () => createCanvas_default,
|
|
33300
33301
|
createRealtimeFilters: () => createRealtimeFilters_default,
|
|
33301
33302
|
debounceDeparturesMessages: () => debounceDeparturesMessages_default,
|
|
33302
33303
|
debounceWebsocketMessages: () => debounceWebsocketMessages_default,
|
|
@@ -33318,6 +33319,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
33318
33319
|
realtimeConfig: () => realtimeConfig_exports,
|
|
33319
33320
|
realtimeDefaultStyle: () => realtimeDefaultStyle_default,
|
|
33320
33321
|
realtimeDelayStyle: () => realtimeDelayStyle_default,
|
|
33322
|
+
realtimeHeadingStyle: () => realtimeHeadingStyle_default,
|
|
33321
33323
|
realtimeSimpleStyle: () => realtimeSimpleStyle_default,
|
|
33322
33324
|
removeDuplicate: () => removeDuplicate_default,
|
|
33323
33325
|
renderTrajectories: () => renderTrajectories_default,
|
|
@@ -37985,10 +37987,14 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
37985
37987
|
olGeometry,
|
|
37986
37988
|
coordinate
|
|
37987
37989
|
} = trajectory.properties;
|
|
37988
|
-
const {
|
|
37990
|
+
const { coordinates: coordinates2 } = trajectory.geometry;
|
|
37991
|
+
let { type } = trajectory.geometry;
|
|
37989
37992
|
let geometry = olGeometry;
|
|
37990
37993
|
let coord;
|
|
37991
37994
|
let rotation;
|
|
37995
|
+
if (olGeometry) {
|
|
37996
|
+
type = geometry.getType();
|
|
37997
|
+
}
|
|
37992
37998
|
if (noInterpolate && coordinate) {
|
|
37993
37999
|
coord = coordinate;
|
|
37994
38000
|
} else if (type === "Point") {
|
|
@@ -38083,13 +38089,13 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
38083
38089
|
continue;
|
|
38084
38090
|
}
|
|
38085
38091
|
const { train_id: id, timeOffset } = trajectory.properties;
|
|
38086
|
-
const { coord, rotation:
|
|
38092
|
+
const { coord, rotation: heading } = getVehiclePosition_default(
|
|
38087
38093
|
time - (timeOffset || 0),
|
|
38088
38094
|
trajectory,
|
|
38089
38095
|
noInterpolate
|
|
38090
38096
|
);
|
|
38091
38097
|
trajectories[i].properties.coordinate = coord;
|
|
38092
|
-
trajectories[i].properties.rotation =
|
|
38098
|
+
trajectories[i].properties.rotation = heading;
|
|
38093
38099
|
if (!coord) {
|
|
38094
38100
|
continue;
|
|
38095
38101
|
}
|
|
@@ -38324,6 +38330,27 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
38324
38330
|
};
|
|
38325
38331
|
var debounceDeparturesMessages_default = debounceDeparturesMessages;
|
|
38326
38332
|
|
|
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
|
+
|
|
38327
38354
|
// src/common/utils/realtimeConfig.ts
|
|
38328
38355
|
var realtimeConfig_exports = {};
|
|
38329
38356
|
__export(realtimeConfig_exports, {
|
|
@@ -38471,27 +38498,6 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
38471
38498
|
return "";
|
|
38472
38499
|
};
|
|
38473
38500
|
|
|
38474
|
-
// src/common/utils/createCanvas.ts
|
|
38475
|
-
var createCanvas = (width, height) => {
|
|
38476
|
-
let canvas2 = null;
|
|
38477
|
-
if (typeof window === "undefined") {
|
|
38478
|
-
return null;
|
|
38479
|
-
}
|
|
38480
|
-
if (typeof document !== "undefined" && document?.createElement) {
|
|
38481
|
-
canvas2 = document.createElement("canvas");
|
|
38482
|
-
canvas2.width = width;
|
|
38483
|
-
canvas2.height = height;
|
|
38484
|
-
} else if (OffscreenCanvas) {
|
|
38485
|
-
canvas2 = new OffscreenCanvas(width, height);
|
|
38486
|
-
} else {
|
|
38487
|
-
console.error(
|
|
38488
|
-
"We didn't find a way to create a canvas element, document.createElement('canvas') and new OffscrenCanvas() are not supported"
|
|
38489
|
-
);
|
|
38490
|
-
}
|
|
38491
|
-
return canvas2;
|
|
38492
|
-
};
|
|
38493
|
-
var createCanvas_default = createCanvas;
|
|
38494
|
-
|
|
38495
38501
|
// src/common/styles/realtimeDefaultStyle.ts
|
|
38496
38502
|
var cacheDelayBg = {};
|
|
38497
38503
|
var getDelayBgCanvas = (origin, radius, color) => {
|
|
@@ -38796,6 +38802,93 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
38796
38802
|
};
|
|
38797
38803
|
var realtimeSimpleStyle_default = realtimeSimpleStyle;
|
|
38798
38804
|
|
|
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
|
+
|
|
38799
38892
|
// node_modules/ol/layer/Property.js
|
|
38800
38893
|
var Property_default = {
|
|
38801
38894
|
OPACITY: "opacity",
|
|
@@ -50506,14 +50599,15 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
50506
50599
|
super.setBbox(newExtent, newZoom);
|
|
50507
50600
|
}
|
|
50508
50601
|
highlightTrajectory(id) {
|
|
50509
|
-
this.api.getFullTrajectory(id, this.mode, this.generalizationLevel).then((data) => {
|
|
50602
|
+
return this.api.getFullTrajectory(id, this.mode, this.generalizationLevel).then((data) => {
|
|
50510
50603
|
const fullTrajectory = data.content;
|
|
50511
50604
|
this.vectorLayer.getSource().clear();
|
|
50512
50605
|
if (!fullTrajectory || !fullTrajectory.features || !fullTrajectory.features.length) {
|
|
50513
|
-
return;
|
|
50606
|
+
return void 0;
|
|
50514
50607
|
}
|
|
50515
50608
|
const features = format.readFeatures(fullTrajectory);
|
|
50516
50609
|
this.vectorLayer.getSource().addFeatures(features);
|
|
50610
|
+
return features;
|
|
50517
50611
|
});
|
|
50518
50612
|
}
|
|
50519
50613
|
clone(newOptions) {
|
|
@@ -50607,6 +50701,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
50607
50701
|
RoutingAPI: () => RoutingAPI_default,
|
|
50608
50702
|
StopsAPI: () => StopsAPI_default,
|
|
50609
50703
|
compareDepartures: () => compareDepartures_default,
|
|
50704
|
+
createCanvas: () => createCanvas_default,
|
|
50610
50705
|
createRealtimeFilters: () => createRealtimeFilters_default,
|
|
50611
50706
|
debounceDeparturesMessages: () => debounceDeparturesMessages_default,
|
|
50612
50707
|
debounceWebsocketMessages: () => debounceWebsocketMessages_default,
|
|
@@ -50628,6 +50723,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
50628
50723
|
realtimeConfig: () => realtimeConfig_exports,
|
|
50629
50724
|
realtimeDefaultStyle: () => realtimeDefaultStyle_default,
|
|
50630
50725
|
realtimeDelayStyle: () => realtimeDelayStyle_default,
|
|
50726
|
+
realtimeHeadingStyle: () => realtimeHeadingStyle_default,
|
|
50631
50727
|
realtimeSimpleStyle: () => realtimeSimpleStyle_default,
|
|
50632
50728
|
removeDuplicate: () => removeDuplicate_default,
|
|
50633
50729
|
renderTrajectories: () => renderTrajectories_default,
|