mobility-toolbox-js 2.0.0-beta.52 → 2.0.0-beta.53
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/README.md +26 -3
- package/api/RealtimeAPI.d.ts +8 -3
- package/api/RealtimeAPI.d.ts.map +1 -1
- package/api/RealtimeAPI.js +4 -1
- package/common/controls/ControlCommon.d.ts +1 -1
- package/common/controls/ControlCommon.d.ts.map +1 -1
- package/common/layers/LayerCommon.d.ts +1 -0
- package/common/layers/LayerCommon.d.ts.map +1 -1
- package/common/layers/LayerCommon.js +3 -0
- package/common/mixins/RealtimeLayerMixin.d.ts +1 -1
- package/common/mixins/RealtimeLayerMixin.d.ts.map +1 -1
- package/common/mixins/RealtimeLayerMixin.js +2 -2
- package/common/mixins/UserInteractionsLayerMixin.d.ts.map +1 -1
- package/common/mixins/UserInteractionsLayerMixin.js +7 -10
- package/common/styles/realtimeDefaultStyle.d.ts +2 -2
- package/common/styles/realtimeDefaultStyle.d.ts.map +1 -1
- package/common/styles/realtimeDelayStyle.d.ts +2 -2
- package/common/styles/realtimeDelayStyle.d.ts.map +1 -1
- package/common/styles/realtimeSimpleStyle.d.ts +2 -1
- package/common/styles/realtimeSimpleStyle.d.ts.map +1 -1
- package/common/typedefs.js +3 -3
- package/common/utils/{createTrackerFilters.d.ts → createRealtimeFilters.d.ts} +3 -3
- package/common/utils/createRealtimeFilters.d.ts.map +1 -0
- package/common/utils/{createTrackerFilters.js → createRealtimeFilters.js} +2 -2
- package/common/utils/getMapboxRender.d.ts +3 -3
- package/common/utils/getMapboxRender.d.ts.map +1 -1
- package/common/utils/getMapboxRender.js +2 -1
- package/common/utils/getMaplibreRender.d.ts +3 -1
- package/common/utils/getMaplibreRender.d.ts.map +1 -1
- package/common/utils/getMaplibreRender.js +4 -4
- package/common/utils/getRealtimeModeSuffix.d.ts +4 -2
- package/common/utils/getRealtimeModeSuffix.d.ts.map +1 -1
- package/common/utils/getUrlWithParams.d.ts +2 -2
- package/common/utils/getUrlWithParams.d.ts.map +1 -1
- package/common/utils/getVehiclePosition.d.ts +7 -5
- package/common/utils/getVehiclePosition.d.ts.map +1 -1
- package/common/utils/index.d.ts +2 -2
- package/common/utils/index.js +3 -3
- package/common/utils/realtimeConfig.d.ts +49 -0
- package/common/utils/realtimeConfig.d.ts.map +1 -0
- package/common/utils/{trackerConfig.js → realtimeConfig.js} +17 -17
- package/common/utils/sortByDelay.d.ts +1 -1
- package/common/utils/sortByDelay.d.ts.map +1 -1
- package/common/utils/timeUtils.d.ts +23 -4
- package/common/utils/timeUtils.d.ts.map +1 -1
- package/common/utils/timeUtils.js +1 -1
- package/mbt.js +166 -166
- package/mbt.js.map +3 -3
- package/mbt.min.js +62 -62
- package/mbt.min.js.map +3 -3
- package/ol/controls/RoutingControl.d.ts +95 -91
- package/ol/controls/RoutingControl.d.ts.map +1 -1
- package/ol/controls/RoutingControl.js +100 -90
- package/ol/layers/Layer.d.ts +3 -2
- package/ol/layers/Layer.d.ts.map +1 -1
- package/ol/layers/Layer.js +2 -0
- package/ol/layers/MapGlLayer.d.ts.map +1 -1
- package/ol/layers/MapGlLayer.js +3 -5
- package/ol/layers/MapboxLayer.d.ts +1 -1
- package/ol/layers/MapboxLayer.d.ts.map +1 -1
- package/ol/layers/MapboxLayer.js +1 -0
- package/ol/layers/MapboxStyleLayer.js +4 -2
- package/ol/layers/MaplibreLayer.d.ts +2 -1
- package/ol/layers/MaplibreLayer.d.ts.map +1 -1
- package/ol/layers/RoutingLayer.d.ts +15 -5
- package/ol/layers/RoutingLayer.d.ts.map +1 -1
- package/ol/layers/RoutingLayer.js +3 -2
- package/ol/styles/fullTrajectoryStyle.d.ts +2 -2
- package/ol/styles/fullTrajectoryStyle.d.ts.map +1 -1
- package/package.json +1 -1
- package/types/common.d.ts +6 -1
- package/common/utils/createTrackerFilters.d.ts.map +0 -1
- package/common/utils/trackerConfig.d.ts +0 -24
- package/common/utils/trackerConfig.d.ts.map +0 -1
package/mbt.js
CHANGED
|
@@ -33293,7 +33293,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
33293
33293
|
StopsAPI: () => StopsAPI_default,
|
|
33294
33294
|
VectorLayer: () => VectorLayer_default2,
|
|
33295
33295
|
WMSLayer: () => WMSLayer_default,
|
|
33296
|
-
|
|
33296
|
+
createRealtimeFilters: () => createRealtimeFilters_default,
|
|
33297
33297
|
fullTrajectoryDelayStyle: () => fullTrajectoryDelayStyle_default,
|
|
33298
33298
|
fullTrajectoryStyle: () => fullTrajectoryStyle_default,
|
|
33299
33299
|
getCircleCanvas: () => getCircleCanvas,
|
|
@@ -33309,13 +33309,13 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
33309
33309
|
getUTCTimeString: () => getUTCTimeString,
|
|
33310
33310
|
getUrlWithParams: () => getUrlWithParams_default,
|
|
33311
33311
|
pad: () => pad,
|
|
33312
|
+
realtimeConfig: () => realtimeConfig_exports,
|
|
33312
33313
|
realtimeDefaultStyle: () => realtimeDefaultStyle_default,
|
|
33313
33314
|
realtimeDelayStyle: () => realtimeDelayStyle_default,
|
|
33314
33315
|
realtimeSimpleStyle: () => realtimeSimpleStyle_default,
|
|
33315
33316
|
removeDuplicate: () => removeDuplicate_default,
|
|
33316
33317
|
renderTrajectories: () => renderTrajectories_default,
|
|
33317
|
-
sortByDelay: () => sortByDelay_default
|
|
33318
|
-
trackerConfig: () => trackerConfig_exports
|
|
33318
|
+
sortByDelay: () => sortByDelay_default
|
|
33319
33319
|
});
|
|
33320
33320
|
|
|
33321
33321
|
// node_modules/ol/events/Event.js
|
|
@@ -33862,7 +33862,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
33862
33862
|
}(Observable_default);
|
|
33863
33863
|
var Object_default = BaseObject;
|
|
33864
33864
|
|
|
33865
|
-
// src/common/utils/getUrlWithParams.
|
|
33865
|
+
// src/common/utils/getUrlWithParams.ts
|
|
33866
33866
|
var getUrlWithParams = (url, params) => {
|
|
33867
33867
|
const newUrl = new URL(url);
|
|
33868
33868
|
const searchParams = params || {};
|
|
@@ -34154,7 +34154,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34154
34154
|
};
|
|
34155
34155
|
var cleanStopTime_default = cleanStopTime;
|
|
34156
34156
|
|
|
34157
|
-
// src/common/utils/getRealtimeModeSuffix.
|
|
34157
|
+
// src/common/utils/getRealtimeModeSuffix.ts
|
|
34158
34158
|
var getModeSuffix = (mode, modes) => mode === modes.SCHEMATIC ? "_schematic" : "";
|
|
34159
34159
|
var getRealtimeModeSuffix_default = getModeSuffix;
|
|
34160
34160
|
|
|
@@ -34209,8 +34209,11 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34209
34209
|
const { apiKey } = opt;
|
|
34210
34210
|
let { url, projection, bbox, buffer: buffer2 = [100, 100] } = opt;
|
|
34211
34211
|
const wsApi = new WebSocketAPI_default();
|
|
34212
|
+
if (!url) {
|
|
34213
|
+
url = "wss://api.geops.io/tracker-ws/v1/";
|
|
34214
|
+
}
|
|
34212
34215
|
if (apiKey) {
|
|
34213
|
-
url = `${url
|
|
34216
|
+
url = `${url}?key=${apiKey}`;
|
|
34214
34217
|
}
|
|
34215
34218
|
Object.defineProperties(this, {
|
|
34216
34219
|
url: {
|
|
@@ -34586,8 +34589,8 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34586
34589
|
};
|
|
34587
34590
|
var getMapboxMapCopyrights_default = getMapboxMapCopyrights;
|
|
34588
34591
|
|
|
34589
|
-
// src/common/utils/
|
|
34590
|
-
var
|
|
34592
|
+
// src/common/utils/createRealtimeFilters.ts
|
|
34593
|
+
var createRealtimeFilters = (line, route, operator, regexLine) => {
|
|
34591
34594
|
const filterList = [];
|
|
34592
34595
|
if (!line && !route && !operator && !regexLine) {
|
|
34593
34596
|
return null;
|
|
@@ -34646,7 +34649,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34646
34649
|
return true;
|
|
34647
34650
|
};
|
|
34648
34651
|
};
|
|
34649
|
-
var
|
|
34652
|
+
var createRealtimeFilters_default = createRealtimeFilters;
|
|
34650
34653
|
|
|
34651
34654
|
// src/common/utils/getLayersAsFlatArray.ts
|
|
34652
34655
|
var getLayersAsFlatArray = (layersOrLayer) => {
|
|
@@ -34664,7 +34667,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34664
34667
|
};
|
|
34665
34668
|
var getLayersAsFlatArray_default = getLayersAsFlatArray;
|
|
34666
34669
|
|
|
34667
|
-
// src/common/utils/timeUtils.
|
|
34670
|
+
// src/common/utils/timeUtils.ts
|
|
34668
34671
|
var getUTCDateString = (now = new Date()) => {
|
|
34669
34672
|
let month = (now.getUTCMonth() + 1).toString();
|
|
34670
34673
|
month = month.length === 1 ? `0${month}` : month;
|
|
@@ -34677,7 +34680,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34677
34680
|
date.getUTCMinutes(),
|
|
34678
34681
|
`${date.getUTCSeconds()}.${date.getUTCMilliseconds()}`
|
|
34679
34682
|
].join(":");
|
|
34680
|
-
var pad = (integer) => integer < 10 ? `0${integer}` : integer
|
|
34683
|
+
var pad = (integer) => integer < 10 ? `0${integer}` : `${integer}`;
|
|
34681
34684
|
var getHoursAndMinutes = (timeInMs) => {
|
|
34682
34685
|
if (!timeInMs || timeInMs <= 0) {
|
|
34683
34686
|
return "";
|
|
@@ -34686,7 +34689,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34686
34689
|
return `${pad(date.getHours())}:${pad(date.getMinutes())}`;
|
|
34687
34690
|
};
|
|
34688
34691
|
|
|
34689
|
-
// src/common/utils/sortByDelay.
|
|
34692
|
+
// src/common/utils/sortByDelay.ts
|
|
34690
34693
|
var sortByDelay = (traj1, traj2) => {
|
|
34691
34694
|
const props1 = traj1.properties;
|
|
34692
34695
|
const props2 = traj2.properties;
|
|
@@ -34866,7 +34869,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34866
34869
|
CIRCLE: "Circle"
|
|
34867
34870
|
};
|
|
34868
34871
|
|
|
34869
|
-
// src/common/utils/getVehiclePosition.
|
|
34872
|
+
// src/common/utils/getVehiclePosition.ts
|
|
34870
34873
|
var getVehiclePosition = (now, trajectory, noInterpolate) => {
|
|
34871
34874
|
const {
|
|
34872
34875
|
time_intervals: timeIntervals,
|
|
@@ -35871,22 +35874,22 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
35871
35874
|
}
|
|
35872
35875
|
addCommon();
|
|
35873
35876
|
|
|
35874
|
-
// src/common/utils/getMaplibreRender.
|
|
35877
|
+
// src/common/utils/getMaplibreRender.ts
|
|
35875
35878
|
function getMaplibreRender(maplibreLayer) {
|
|
35879
|
+
const emptyDiv = document.createElement("div");
|
|
35876
35880
|
return (frameState) => {
|
|
35877
35881
|
const { map, mbMap, olLayer } = maplibreLayer;
|
|
35878
35882
|
if (!map || !mbMap) {
|
|
35879
|
-
return
|
|
35883
|
+
return emptyDiv;
|
|
35880
35884
|
}
|
|
35881
35885
|
const canvas2 = mbMap.getCanvas();
|
|
35882
35886
|
const { viewState } = frameState;
|
|
35883
|
-
const opacity = olLayer
|
|
35884
|
-
canvas2.style.opacity = opacity
|
|
35887
|
+
const opacity = olLayer?.getOpacity() || 1;
|
|
35888
|
+
canvas2.style.opacity = `${opacity}`;
|
|
35885
35889
|
mbMap.jumpTo({
|
|
35886
35890
|
center: toLonLat(viewState.center),
|
|
35887
35891
|
zoom: viewState.zoom - 1,
|
|
35888
|
-
bearing: toDegrees(-viewState.rotation)
|
|
35889
|
-
animate: false
|
|
35892
|
+
bearing: toDegrees(-viewState.rotation)
|
|
35890
35893
|
});
|
|
35891
35894
|
if (!canvas2.isConnected) {
|
|
35892
35895
|
map.render();
|
|
@@ -35900,10 +35903,11 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
35900
35903
|
|
|
35901
35904
|
// src/common/utils/getMapboxRender.ts
|
|
35902
35905
|
function getMapboxRender(mapoxLayer) {
|
|
35906
|
+
const emptyDiv = document.createElement("div");
|
|
35903
35907
|
return (frameState) => {
|
|
35904
35908
|
const { map, mbMap, renderState, olLayer } = mapoxLayer;
|
|
35905
35909
|
if (!map || !mbMap) {
|
|
35906
|
-
return
|
|
35910
|
+
return emptyDiv;
|
|
35907
35911
|
}
|
|
35908
35912
|
let changed = false;
|
|
35909
35913
|
const canvas2 = mbMap.getCanvas();
|
|
@@ -35956,9 +35960,9 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
35956
35960
|
};
|
|
35957
35961
|
}
|
|
35958
35962
|
|
|
35959
|
-
// src/common/utils/
|
|
35960
|
-
var
|
|
35961
|
-
__export(
|
|
35963
|
+
// src/common/utils/realtimeConfig.ts
|
|
35964
|
+
var realtimeConfig_exports = {};
|
|
35965
|
+
__export(realtimeConfig_exports, {
|
|
35962
35966
|
bgColors: () => bgColors,
|
|
35963
35967
|
getBgColor: () => getBgColor,
|
|
35964
35968
|
getDelayColor: () => getDelayColor,
|
|
@@ -35970,18 +35974,18 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
35970
35974
|
textColors: () => textColors,
|
|
35971
35975
|
types: () => types
|
|
35972
35976
|
});
|
|
35973
|
-
var
|
|
35974
|
-
|
|
35975
|
-
|
|
35976
|
-
|
|
35977
|
-
|
|
35978
|
-
|
|
35979
|
-
|
|
35980
|
-
|
|
35981
|
-
|
|
35982
|
-
|
|
35983
|
-
|
|
35984
|
-
|
|
35977
|
+
var radiusMapping = [
|
|
35978
|
+
[0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
|
|
35979
|
+
[0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
|
|
35980
|
+
[0, 0, 0, 0, 0, 2, 2, 3, 7, 7, 7, 12, 15, 15, 15, 15, 15],
|
|
35981
|
+
[0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
|
|
35982
|
+
[0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
|
|
35983
|
+
[0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
|
|
35984
|
+
[0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
|
|
35985
|
+
[0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
|
|
35986
|
+
[0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
|
|
35987
|
+
[0, 0, 0, 0, 0, 2, 2, 3, 7, 7, 7, 12, 15, 15, 15, 15, 15]
|
|
35988
|
+
];
|
|
35985
35989
|
var types = [
|
|
35986
35990
|
/^Tram/i,
|
|
35987
35991
|
/^Subway( \/ Metro \/ S-Bahn)?/i,
|
|
@@ -36027,25 +36031,25 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
36027
36031
|
var getRadius = (type, zoom) => {
|
|
36028
36032
|
try {
|
|
36029
36033
|
const typeIdx = getTypeIndex(type || 0);
|
|
36030
|
-
return
|
|
36034
|
+
return radiusMapping[typeIdx][zoom];
|
|
36031
36035
|
} catch (e) {
|
|
36032
36036
|
return 1;
|
|
36033
36037
|
}
|
|
36034
36038
|
};
|
|
36035
|
-
var getBgColor = (type
|
|
36039
|
+
var getBgColor = (type) => {
|
|
36036
36040
|
try {
|
|
36037
36041
|
const typeIdx = getTypeIndex(type);
|
|
36038
36042
|
return bgColors[typeIdx];
|
|
36039
36043
|
} catch (e) {
|
|
36040
|
-
return
|
|
36044
|
+
return "#ffffff";
|
|
36041
36045
|
}
|
|
36042
36046
|
};
|
|
36043
|
-
var getTextColor = (type
|
|
36047
|
+
var getTextColor = (type) => {
|
|
36044
36048
|
try {
|
|
36045
36049
|
const typeIdx = getTypeIndex(type);
|
|
36046
36050
|
return textColors[typeIdx];
|
|
36047
36051
|
} catch (e) {
|
|
36048
|
-
return
|
|
36052
|
+
return "#ffffff";
|
|
36049
36053
|
}
|
|
36050
36054
|
};
|
|
36051
36055
|
var getTextSize = (ctx, markerSize, text, fontSize) => {
|
|
@@ -37264,8 +37268,8 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
37264
37268
|
}();
|
|
37265
37269
|
var tmpTransform = create();
|
|
37266
37270
|
var Geometry = function(_super) {
|
|
37267
|
-
__extends11(
|
|
37268
|
-
function
|
|
37271
|
+
__extends11(Geometry3, _super);
|
|
37272
|
+
function Geometry3() {
|
|
37269
37273
|
var _this = _super.call(this) || this;
|
|
37270
37274
|
_this.extent_ = createEmpty();
|
|
37271
37275
|
_this.extentRevision_ = -1;
|
|
@@ -37281,31 +37285,31 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
37281
37285
|
});
|
|
37282
37286
|
return _this;
|
|
37283
37287
|
}
|
|
37284
|
-
|
|
37288
|
+
Geometry3.prototype.simplifyTransformed = function(squaredTolerance, opt_transform) {
|
|
37285
37289
|
return this.simplifyTransformedInternal(this.getRevision(), squaredTolerance, opt_transform);
|
|
37286
37290
|
};
|
|
37287
|
-
|
|
37291
|
+
Geometry3.prototype.clone = function() {
|
|
37288
37292
|
return abstract();
|
|
37289
37293
|
};
|
|
37290
|
-
|
|
37294
|
+
Geometry3.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
|
37291
37295
|
return abstract();
|
|
37292
37296
|
};
|
|
37293
|
-
|
|
37297
|
+
Geometry3.prototype.containsXY = function(x, y) {
|
|
37294
37298
|
var coord = this.getClosestPoint([x, y]);
|
|
37295
37299
|
return coord[0] === x && coord[1] === y;
|
|
37296
37300
|
};
|
|
37297
|
-
|
|
37301
|
+
Geometry3.prototype.getClosestPoint = function(point2, opt_closestPoint) {
|
|
37298
37302
|
var closestPoint = opt_closestPoint ? opt_closestPoint : [NaN, NaN];
|
|
37299
37303
|
this.closestPointXY(point2[0], point2[1], closestPoint, Infinity);
|
|
37300
37304
|
return closestPoint;
|
|
37301
37305
|
};
|
|
37302
|
-
|
|
37306
|
+
Geometry3.prototype.intersectsCoordinate = function(coordinate) {
|
|
37303
37307
|
return this.containsXY(coordinate[0], coordinate[1]);
|
|
37304
37308
|
};
|
|
37305
|
-
|
|
37309
|
+
Geometry3.prototype.computeExtent = function(extent) {
|
|
37306
37310
|
return abstract();
|
|
37307
37311
|
};
|
|
37308
|
-
|
|
37312
|
+
Geometry3.prototype.getExtent = function(opt_extent) {
|
|
37309
37313
|
if (this.extentRevision_ != this.getRevision()) {
|
|
37310
37314
|
var extent = this.computeExtent(this.extent_);
|
|
37311
37315
|
if (isNaN(extent[0]) || isNaN(extent[1])) {
|
|
@@ -37315,31 +37319,31 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
37315
37319
|
}
|
|
37316
37320
|
return returnOrUpdate(this.extent_, opt_extent);
|
|
37317
37321
|
};
|
|
37318
|
-
|
|
37322
|
+
Geometry3.prototype.rotate = function(angle, anchor) {
|
|
37319
37323
|
abstract();
|
|
37320
37324
|
};
|
|
37321
|
-
|
|
37325
|
+
Geometry3.prototype.scale = function(sx, opt_sy, opt_anchor) {
|
|
37322
37326
|
abstract();
|
|
37323
37327
|
};
|
|
37324
|
-
|
|
37328
|
+
Geometry3.prototype.simplify = function(tolerance) {
|
|
37325
37329
|
return this.getSimplifiedGeometry(tolerance * tolerance);
|
|
37326
37330
|
};
|
|
37327
|
-
|
|
37331
|
+
Geometry3.prototype.getSimplifiedGeometry = function(squaredTolerance) {
|
|
37328
37332
|
return abstract();
|
|
37329
37333
|
};
|
|
37330
|
-
|
|
37334
|
+
Geometry3.prototype.getType = function() {
|
|
37331
37335
|
return abstract();
|
|
37332
37336
|
};
|
|
37333
|
-
|
|
37337
|
+
Geometry3.prototype.applyTransform = function(transformFn) {
|
|
37334
37338
|
abstract();
|
|
37335
37339
|
};
|
|
37336
|
-
|
|
37340
|
+
Geometry3.prototype.intersectsExtent = function(extent) {
|
|
37337
37341
|
return abstract();
|
|
37338
37342
|
};
|
|
37339
|
-
|
|
37343
|
+
Geometry3.prototype.translate = function(deltaX, deltaY) {
|
|
37340
37344
|
abstract();
|
|
37341
37345
|
};
|
|
37342
|
-
|
|
37346
|
+
Geometry3.prototype.transform = function(source, destination) {
|
|
37343
37347
|
var sourceProj = get3(source);
|
|
37344
37348
|
var transformFn = sourceProj.getUnits() == Units_default.TILE_PIXELS ? function(inCoordinates, outCoordinates, stride) {
|
|
37345
37349
|
var pixelExtent = sourceProj.getExtent();
|
|
@@ -37352,7 +37356,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
37352
37356
|
this.applyTransform(transformFn);
|
|
37353
37357
|
return this;
|
|
37354
37358
|
};
|
|
37355
|
-
return
|
|
37359
|
+
return Geometry3;
|
|
37356
37360
|
}(Object_default);
|
|
37357
37361
|
var Geometry_default = Geometry;
|
|
37358
37362
|
|
|
@@ -47856,10 +47860,13 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
47856
47860
|
var Layer2 = class extends Object_default {
|
|
47857
47861
|
constructor(options = {}) {
|
|
47858
47862
|
super();
|
|
47863
|
+
this.properties = {};
|
|
47864
|
+
this.options = {};
|
|
47859
47865
|
this.defineProperties(options);
|
|
47860
47866
|
if (options.properties) {
|
|
47861
47867
|
this.setProperties(options.properties);
|
|
47862
47868
|
}
|
|
47869
|
+
this.options = options;
|
|
47863
47870
|
this.visible = options.visible === void 0 ? true : !!options.visible;
|
|
47864
47871
|
this.group = options.group;
|
|
47865
47872
|
this.copyrights = options.copyrights;
|
|
@@ -48107,10 +48114,9 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48107
48114
|
event: evt
|
|
48108
48115
|
};
|
|
48109
48116
|
return this.getFeatureInfoAtCoordinate(coordinate).then((featureInfo) => {
|
|
48110
|
-
|
|
48111
|
-
|
|
48112
|
-
|
|
48113
|
-
});
|
|
48117
|
+
const event = new Event_default("user:click");
|
|
48118
|
+
event.target = featureInfo;
|
|
48119
|
+
this.dispatchEvent(event);
|
|
48114
48120
|
return featureInfo;
|
|
48115
48121
|
}).catch(() => emptyFeatureInfo);
|
|
48116
48122
|
}
|
|
@@ -48123,10 +48129,9 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48123
48129
|
event: evt
|
|
48124
48130
|
};
|
|
48125
48131
|
return this.getFeatureInfoAtCoordinate(coordinate).then((featureInfo) => {
|
|
48126
|
-
|
|
48127
|
-
|
|
48128
|
-
|
|
48129
|
-
});
|
|
48132
|
+
const event = new Event_default("user:hover");
|
|
48133
|
+
event.target = featureInfo;
|
|
48134
|
+
this.dispatchEvent(event);
|
|
48130
48135
|
return featureInfo;
|
|
48131
48136
|
}).catch(() => emptyFeatureInfo);
|
|
48132
48137
|
}
|
|
@@ -48222,7 +48227,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48222
48227
|
};
|
|
48223
48228
|
var Layer_default4 = Layer3;
|
|
48224
48229
|
|
|
48225
|
-
// src/ol/layers/RoutingLayer.
|
|
48230
|
+
// src/ol/layers/RoutingLayer.ts
|
|
48226
48231
|
var circleStyle = new Circle_default({
|
|
48227
48232
|
radius: 6,
|
|
48228
48233
|
fill: new Fill_default({
|
|
@@ -48259,7 +48264,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48259
48264
|
const maxResolution = feature2.get("maxResolution");
|
|
48260
48265
|
const inRange = resolution <= minResolution && resolution > maxResolution;
|
|
48261
48266
|
if (minResolution && maxResolution && !inRange) {
|
|
48262
|
-
return
|
|
48267
|
+
return [];
|
|
48263
48268
|
}
|
|
48264
48269
|
const mot = feature2.get("mot");
|
|
48265
48270
|
if (mot !== "foot") {
|
|
@@ -48268,8 +48273,9 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48268
48273
|
return [dashedRedLine];
|
|
48269
48274
|
};
|
|
48270
48275
|
var RoutingLayer = class extends Layer_default4 {
|
|
48271
|
-
constructor(options
|
|
48276
|
+
constructor(options) {
|
|
48272
48277
|
super(options);
|
|
48278
|
+
this.options = {};
|
|
48273
48279
|
this.olLayer = options.olLayer || new Vector_default({
|
|
48274
48280
|
source: new Vector_default2(),
|
|
48275
48281
|
style: options.style || defaultStyleFunction
|
|
@@ -48281,7 +48287,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48281
48287
|
};
|
|
48282
48288
|
var RoutingLayer_default = RoutingLayer;
|
|
48283
48289
|
|
|
48284
|
-
// src/ol/controls/RoutingControl.
|
|
48290
|
+
// src/ol/controls/RoutingControl.ts
|
|
48285
48291
|
var REGEX_VIA_POINT = /^([^@$!\n]*)(@?([\d.]+),([\d.]+))?(\$?([a-zA-Z0-9]{0,2}))$/;
|
|
48286
48292
|
var REGEX_VIA_POINT_COORD = /^([\d.]+),([\d.]+)$/;
|
|
48287
48293
|
var REGEX_VIA_POINT_STATION_ID = /^!([^$]*)(\$?([a-zA-Z0-9]{0,2}))$/;
|
|
@@ -48289,13 +48295,27 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48289
48295
|
var getFlatCoordinatesFromSegments = (segmentArray) => {
|
|
48290
48296
|
const coords = [];
|
|
48291
48297
|
segmentArray.forEach((seg) => {
|
|
48292
|
-
|
|
48298
|
+
const coordArr = seg.getGeometry()?.getCoordinates();
|
|
48299
|
+
if (coordArr?.length) {
|
|
48300
|
+
coords.push(...coordArr);
|
|
48301
|
+
}
|
|
48293
48302
|
});
|
|
48294
48303
|
return coords;
|
|
48295
48304
|
};
|
|
48296
48305
|
var RoutingControl = class extends ControlCommon_default {
|
|
48297
48306
|
constructor(options = {}) {
|
|
48298
48307
|
super(options);
|
|
48308
|
+
this.viaPoints = [];
|
|
48309
|
+
this.loading = false;
|
|
48310
|
+
this.graphs = [];
|
|
48311
|
+
this.modify = true;
|
|
48312
|
+
this.useRawViaPoints = false;
|
|
48313
|
+
this.snapToClosestStation = false;
|
|
48314
|
+
this.cacheStationData = {};
|
|
48315
|
+
this.abortControllers = {};
|
|
48316
|
+
this.segments = [];
|
|
48317
|
+
this.format = new GeoJSON_default({ featureProjection: "EPSG:3857" });
|
|
48318
|
+
this.initialRouteDrag = {};
|
|
48299
48319
|
Object.defineProperties(this, {
|
|
48300
48320
|
mot: {
|
|
48301
48321
|
get: () => this.get("mot"),
|
|
@@ -48325,14 +48345,11 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48325
48345
|
this.graphs = options.graphs || [["osm", 0, 99]];
|
|
48326
48346
|
this.mot = options.mot || "bus";
|
|
48327
48347
|
this.modify = options.modify !== false;
|
|
48328
|
-
this.routingApiParams = options.routingApiParams
|
|
48348
|
+
this.routingApiParams = options.routingApiParams;
|
|
48329
48349
|
this.useRawViaPoints = options.useRawViaPoints || false;
|
|
48330
48350
|
this.snapToClosestStation = options.snapToClosestStation || false;
|
|
48331
|
-
this.cacheStationData = {};
|
|
48332
|
-
this.abortControllers = [];
|
|
48333
48351
|
this.apiKey = options.apiKey;
|
|
48334
48352
|
this.stopsApiKey = options.stopsApiKey || this.apiKey;
|
|
48335
|
-
this.segments = [];
|
|
48336
48353
|
this.stopsApiUrl = options.stopsApiUrl || "https://api.geops.io/stops/v1/";
|
|
48337
48354
|
this.api = new RoutingAPI_default({
|
|
48338
48355
|
...options
|
|
@@ -48342,18 +48359,13 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48342
48359
|
style: options.style
|
|
48343
48360
|
});
|
|
48344
48361
|
this.onRouteError = options.onRouteError || ((error) => {
|
|
48345
|
-
this.dispatchEvent(
|
|
48346
|
-
type: "change:route",
|
|
48347
|
-
target: this
|
|
48348
|
-
});
|
|
48362
|
+
this.dispatchEvent(new Event_default("change:route"));
|
|
48349
48363
|
this.reset();
|
|
48350
48364
|
console.error(error);
|
|
48351
48365
|
});
|
|
48352
|
-
this.viaPoints = [];
|
|
48353
48366
|
this.onMapClick = this.onMapClick.bind(this);
|
|
48354
48367
|
this.onModifyEnd = this.onModifyEnd.bind(this);
|
|
48355
48368
|
this.onModifyStart = this.onModifyStart.bind(this);
|
|
48356
|
-
this.apiChangeListener = () => this.drawRoute();
|
|
48357
48369
|
this.createModifyInteraction();
|
|
48358
48370
|
}
|
|
48359
48371
|
static getGraphsResolutions(graphs, map) {
|
|
@@ -48366,44 +48378,33 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48366
48378
|
addViaPoint(coordinatesOrString, index = -1, overwrite = 0) {
|
|
48367
48379
|
this.viaPoints.splice(index === -1 ? this.viaPoints.length : index, overwrite, coordinatesOrString);
|
|
48368
48380
|
this.drawRoute();
|
|
48369
|
-
this.dispatchEvent(
|
|
48370
|
-
type: "change:route",
|
|
48371
|
-
target: this
|
|
48372
|
-
});
|
|
48381
|
+
this.dispatchEvent(new Event_default("change:route"));
|
|
48373
48382
|
}
|
|
48374
|
-
removeViaPoint(index = this.viaPoints.length - 1) {
|
|
48383
|
+
removeViaPoint(index = (this.viaPoints || []).length - 1) {
|
|
48375
48384
|
if (this.viaPoints.length && this.viaPoints[index]) {
|
|
48376
48385
|
this.viaPoints.splice(index, 1);
|
|
48377
48386
|
}
|
|
48378
48387
|
this.drawRoute();
|
|
48379
|
-
this.dispatchEvent(
|
|
48380
|
-
type: "change:route",
|
|
48381
|
-
target: this
|
|
48382
|
-
});
|
|
48388
|
+
this.dispatchEvent(new Event_default("change:route"));
|
|
48383
48389
|
}
|
|
48384
48390
|
setViaPoints(coordinateArray) {
|
|
48385
48391
|
this.viaPoints = [...coordinateArray];
|
|
48386
48392
|
this.drawRoute();
|
|
48387
|
-
this.dispatchEvent(
|
|
48388
|
-
type: "change:route",
|
|
48389
|
-
target: this
|
|
48390
|
-
});
|
|
48393
|
+
this.dispatchEvent(new Event_default("change:route"));
|
|
48391
48394
|
}
|
|
48392
48395
|
reset() {
|
|
48393
48396
|
this.abortRequests();
|
|
48394
48397
|
this.viaPoints = [];
|
|
48395
|
-
this.routingLayer
|
|
48396
|
-
this.dispatchEvent(
|
|
48397
|
-
type: "change:route",
|
|
48398
|
-
target: this
|
|
48399
|
-
});
|
|
48398
|
+
this.routingLayer?.olLayer?.getSource()?.clear();
|
|
48399
|
+
this.dispatchEvent(new Event_default("change:route"));
|
|
48400
48400
|
}
|
|
48401
48401
|
abortRequests() {
|
|
48402
|
-
this.graphs.forEach((
|
|
48403
|
-
|
|
48404
|
-
|
|
48402
|
+
this.graphs.forEach((graph) => {
|
|
48403
|
+
const graphName = graph[0];
|
|
48404
|
+
if (this.abortControllers[graphName]) {
|
|
48405
|
+
this.abortControllers[graphName].abort();
|
|
48405
48406
|
}
|
|
48406
|
-
this.abortControllers[
|
|
48407
|
+
this.abortControllers[graphName] = new AbortController();
|
|
48407
48408
|
});
|
|
48408
48409
|
this.abortControllers[STOP_FETCH_ABORT_CONTROLLER_KEY]?.abort();
|
|
48409
48410
|
this.abortControllers[STOP_FETCH_ABORT_CONTROLLER_KEY] = new AbortController();
|
|
@@ -48411,7 +48412,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48411
48412
|
}
|
|
48412
48413
|
drawRoute() {
|
|
48413
48414
|
this.abortRequests();
|
|
48414
|
-
this.routingLayer
|
|
48415
|
+
this.routingLayer?.olLayer?.getSource()?.clear();
|
|
48415
48416
|
if (!this.viaPoints.length) {
|
|
48416
48417
|
return null;
|
|
48417
48418
|
}
|
|
@@ -48420,26 +48421,29 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48420
48421
|
}
|
|
48421
48422
|
const formattedViaPoints = this.viaPoints.map((viaPoint) => {
|
|
48422
48423
|
if (Array.isArray(viaPoint)) {
|
|
48423
|
-
const projection = this.map
|
|
48424
|
+
const projection = this.map?.getView().getProjection();
|
|
48424
48425
|
const [lon, lat] = toLonLat(viaPoint, projection);
|
|
48425
48426
|
return this.snapToClosestStation ? [`@${lat}`, lon] : [lat, lon];
|
|
48426
48427
|
}
|
|
48427
48428
|
return this.useRawViaPoints ? viaPoint : `!${viaPoint}`;
|
|
48428
48429
|
});
|
|
48429
48430
|
this.loading = true;
|
|
48430
|
-
this.routingLayer
|
|
48431
|
+
this.routingLayer?.olLayer?.getSource()?.clear();
|
|
48431
48432
|
this.viaPoints.forEach((viaPoint, idx) => this.drawViaPoint(viaPoint, idx, this.abortControllers[STOP_FETCH_ABORT_CONTROLLER_KEY]));
|
|
48432
48433
|
return Promise.all(this.graphs.map(([graph], index) => {
|
|
48433
48434
|
const { signal } = this.abortControllers[graph];
|
|
48435
|
+
if (!this.api) {
|
|
48436
|
+
return Promise.resolve([]);
|
|
48437
|
+
}
|
|
48434
48438
|
return this.api.route({
|
|
48435
48439
|
graph,
|
|
48436
48440
|
via: `${formattedViaPoints.join("|")}`,
|
|
48437
|
-
mot:
|
|
48441
|
+
mot: this.mot,
|
|
48438
48442
|
"resolve-hops": false,
|
|
48439
48443
|
elevation: false,
|
|
48440
48444
|
"coord-radius": 100,
|
|
48441
48445
|
"coord-punish": 1e3,
|
|
48442
|
-
...this.routingApiParams
|
|
48446
|
+
...this.routingApiParams || {}
|
|
48443
48447
|
}, { signal }).then((featureCollection) => {
|
|
48444
48448
|
this.segments = this.format.readFeatures(featureCollection);
|
|
48445
48449
|
if (this.mot === "foot") {
|
|
@@ -48464,19 +48468,18 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48464
48468
|
});
|
|
48465
48469
|
routeFeature.set("graph", graph);
|
|
48466
48470
|
routeFeature.set("mot", this.mot);
|
|
48467
|
-
|
|
48468
|
-
|
|
48469
|
-
|
|
48471
|
+
if (this.graphsResolutions && this.graphsResolutions[index]?.length >= 2) {
|
|
48472
|
+
routeFeature.set("minResolution", this.graphsResolutions[index][0]);
|
|
48473
|
+
routeFeature.set("maxResolution", this.graphsResolutions[index][1]);
|
|
48474
|
+
}
|
|
48475
|
+
this.routingLayer?.olLayer?.getSource()?.addFeature(routeFeature);
|
|
48470
48476
|
this.loading = false;
|
|
48471
48477
|
}).catch((error) => {
|
|
48472
48478
|
if (error.name === "AbortError") {
|
|
48473
48479
|
return;
|
|
48474
48480
|
}
|
|
48475
48481
|
this.segments = [];
|
|
48476
|
-
this.dispatchEvent(
|
|
48477
|
-
type: "error",
|
|
48478
|
-
target: this
|
|
48479
|
-
});
|
|
48482
|
+
this.dispatchEvent(new Event_default("error"));
|
|
48480
48483
|
this.onRouteError(error, this);
|
|
48481
48484
|
this.loading = false;
|
|
48482
48485
|
});
|
|
@@ -48487,14 +48490,14 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48487
48490
|
pointFeature.set("viaPointIdx", idx);
|
|
48488
48491
|
if (Array.isArray(viaPoint)) {
|
|
48489
48492
|
pointFeature.setGeometry(new Point_default(viaPoint));
|
|
48490
|
-
this.routingLayer
|
|
48493
|
+
this.routingLayer?.olLayer?.getSource()?.addFeature(pointFeature);
|
|
48491
48494
|
return Promise.resolve(pointFeature);
|
|
48492
48495
|
}
|
|
48493
48496
|
if (!this.useRawViaPoints || REGEX_VIA_POINT_STATION_ID.test(viaPoint)) {
|
|
48494
48497
|
let stationId;
|
|
48495
48498
|
let track2;
|
|
48496
48499
|
if (this.useRawViaPoints) {
|
|
48497
|
-
[, stationId, , track2] = REGEX_VIA_POINT_STATION_ID.exec(viaPoint);
|
|
48500
|
+
[, stationId, , track2] = REGEX_VIA_POINT_STATION_ID.exec(viaPoint) || [];
|
|
48498
48501
|
} else {
|
|
48499
48502
|
[stationId, track2] = viaPoint.split("$");
|
|
48500
48503
|
}
|
|
@@ -48503,33 +48506,30 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48503
48506
|
this.cacheStationData[viaPoint] = fromLonLat(coordinates2);
|
|
48504
48507
|
pointFeature.set("viaPointTrack", track2);
|
|
48505
48508
|
pointFeature.setGeometry(new Point_default(fromLonLat(coordinates2)));
|
|
48506
|
-
this.routingLayer
|
|
48509
|
+
this.routingLayer?.olLayer?.getSource()?.addFeature(pointFeature);
|
|
48507
48510
|
return pointFeature;
|
|
48508
48511
|
}).catch((error) => {
|
|
48509
48512
|
if (error.name === "AbortError") {
|
|
48510
48513
|
return;
|
|
48511
48514
|
}
|
|
48512
|
-
this.dispatchEvent(
|
|
48513
|
-
type: "error",
|
|
48514
|
-
target: this
|
|
48515
|
-
});
|
|
48515
|
+
this.dispatchEvent(new Event_default("error"));
|
|
48516
48516
|
this.onRouteError(error, this);
|
|
48517
48517
|
this.loading = false;
|
|
48518
48518
|
});
|
|
48519
48519
|
}
|
|
48520
48520
|
if (this.useRawViaPoints && REGEX_VIA_POINT_COORD.test(viaPoint)) {
|
|
48521
|
-
const [lat2, lon2] = REGEX_VIA_POINT_COORD.exec(viaPoint);
|
|
48522
|
-
const coordinates2 = fromLonLat([parseFloat(lon2), parseFloat(lat2)], this.map
|
|
48521
|
+
const [lat2, lon2] = REGEX_VIA_POINT_COORD.exec(viaPoint) || [];
|
|
48522
|
+
const coordinates2 = fromLonLat([parseFloat(lon2), parseFloat(lat2)], this.map?.getView().getProjection());
|
|
48523
48523
|
pointFeature.setGeometry(new Point_default(coordinates2));
|
|
48524
|
-
this.routingLayer
|
|
48524
|
+
this.routingLayer?.olLayer?.getSource()?.addFeature(pointFeature);
|
|
48525
48525
|
return Promise.resolve(pointFeature);
|
|
48526
48526
|
}
|
|
48527
|
-
const [, stationName, , lat, lon, , track] = REGEX_VIA_POINT.exec(viaPoint);
|
|
48527
|
+
const [, stationName, , lat, lon, , track] = REGEX_VIA_POINT.exec(viaPoint) || [];
|
|
48528
48528
|
if (lon && lat) {
|
|
48529
|
-
const coordinates2 = fromLonLat([parseFloat(lon), parseFloat(lat)], this.map
|
|
48529
|
+
const coordinates2 = fromLonLat([parseFloat(lon), parseFloat(lat)], this.map?.getView().getProjection());
|
|
48530
48530
|
pointFeature.set("viaPointTrack", track);
|
|
48531
48531
|
pointFeature.setGeometry(new Point_default(coordinates2));
|
|
48532
|
-
this.routingLayer
|
|
48532
|
+
this.routingLayer?.olLayer?.getSource()?.addFeature(pointFeature);
|
|
48533
48533
|
return Promise.resolve(pointFeature);
|
|
48534
48534
|
}
|
|
48535
48535
|
if (stationName) {
|
|
@@ -48538,13 +48538,10 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48538
48538
|
this.cacheStationData[viaPoint] = fromLonLat(coordinates2);
|
|
48539
48539
|
pointFeature.set("viaPointTrack", track);
|
|
48540
48540
|
pointFeature.setGeometry(new Point_default(fromLonLat(coordinates2)));
|
|
48541
|
-
this.routingLayer
|
|
48541
|
+
this.routingLayer?.olLayer?.getSource()?.addFeature(pointFeature);
|
|
48542
48542
|
return pointFeature;
|
|
48543
48543
|
}).catch((error) => {
|
|
48544
|
-
this.dispatchEvent(
|
|
48545
|
-
type: "error",
|
|
48546
|
-
target: this
|
|
48547
|
-
});
|
|
48544
|
+
this.dispatchEvent(new Event_default("error"));
|
|
48548
48545
|
this.onRouteError(error, this);
|
|
48549
48546
|
this.loading = false;
|
|
48550
48547
|
return null;
|
|
@@ -48552,21 +48549,21 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48552
48549
|
}
|
|
48553
48550
|
return Promise.resolve(null);
|
|
48554
48551
|
}
|
|
48555
|
-
onMapClick(
|
|
48556
|
-
const feats =
|
|
48552
|
+
onMapClick(evt) {
|
|
48553
|
+
const feats = evt.target.getFeaturesAtPixel(evt.pixel);
|
|
48557
48554
|
const viaPoint = feats.find((feat) => feat.getGeometry()?.getType() === GeometryType_default.POINT && feat.get("viaPointIdx") !== void 0);
|
|
48558
48555
|
if (viaPoint) {
|
|
48559
48556
|
this.removeViaPoint(viaPoint.get("viaPointIdx"));
|
|
48560
48557
|
return;
|
|
48561
48558
|
}
|
|
48562
|
-
this.addViaPoint(
|
|
48559
|
+
this.addViaPoint(evt.coordinate);
|
|
48563
48560
|
}
|
|
48564
48561
|
onModifyStart(evt) {
|
|
48565
48562
|
let segmentIndex = -1;
|
|
48566
48563
|
const route = evt.features.getArray().find((feat) => feat.getGeometry()?.getType() === GeometryType_default.LINE_STRING);
|
|
48567
|
-
if (route) {
|
|
48568
|
-
const closestExtent = buffer(new Point_default(route.getGeometry()
|
|
48569
|
-
segmentIndex = this.segments.findIndex((segment) => segment.getGeometry()
|
|
48564
|
+
if (route && route.getGeometry() && evt.mapBrowserEvent.coordinate) {
|
|
48565
|
+
const closestExtent = buffer(new Point_default(route.getGeometry()?.getClosestPoint(evt.mapBrowserEvent.coordinate)).getExtent(), 1e-3);
|
|
48566
|
+
segmentIndex = this.segments.findIndex((segment) => segment.getGeometry()?.intersectsExtent(closestExtent));
|
|
48570
48567
|
}
|
|
48571
48568
|
const viaPoint = (evt.features.getArray().filter((feat) => feat.getGeometry()?.getType() === GeometryType_default.POINT) || [])[0];
|
|
48572
48569
|
this.initialRouteDrag = {
|
|
@@ -48577,7 +48574,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48577
48574
|
}
|
|
48578
48575
|
onModifyEnd(evt) {
|
|
48579
48576
|
const coord = evt.mapBrowserEvent.coordinate;
|
|
48580
|
-
const { oldRoute, viaPoint, segmentIndex } = this.initialRouteDrag;
|
|
48577
|
+
const { oldRoute, viaPoint, segmentIndex } = this.initialRouteDrag || {};
|
|
48581
48578
|
if (viaPoint) {
|
|
48582
48579
|
return this.addViaPoint(coord, viaPoint.get("viaPointIdx"), 1);
|
|
48583
48580
|
}
|
|
@@ -48587,7 +48584,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48587
48584
|
if (segmentIndex === -1) {
|
|
48588
48585
|
return Promise.reject(new Error("No segment found"));
|
|
48589
48586
|
}
|
|
48590
|
-
return this.addViaPoint(coord, segmentIndex + 1);
|
|
48587
|
+
return this.addViaPoint(coord, (segmentIndex || 0) + 1);
|
|
48591
48588
|
}
|
|
48592
48589
|
createDefaultElement() {
|
|
48593
48590
|
this.element = document.createElement("button");
|
|
@@ -48602,9 +48599,9 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48602
48599
|
}
|
|
48603
48600
|
createModifyInteraction() {
|
|
48604
48601
|
this.modifyInteraction = new Modify_default({
|
|
48605
|
-
source: this.routingLayer
|
|
48602
|
+
source: this.routingLayer?.olLayer?.getSource() || void 0,
|
|
48606
48603
|
pixelTolerance: 4,
|
|
48607
|
-
hitDetection: this.routingLayer
|
|
48604
|
+
hitDetection: this.routingLayer?.olLayer,
|
|
48608
48605
|
deleteCondition: (e) => {
|
|
48609
48606
|
const feats = e.target.getFeaturesAtPixel(e.pixel, {
|
|
48610
48607
|
hitTolerance: 5
|
|
@@ -48626,10 +48623,12 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48626
48623
|
return;
|
|
48627
48624
|
}
|
|
48628
48625
|
this.removeListeners();
|
|
48629
|
-
this.onMapClickKey = this.map
|
|
48626
|
+
this.onMapClickKey = this.map?.on("singleclick", this.onMapClick);
|
|
48630
48627
|
}
|
|
48631
48628
|
removeListeners() {
|
|
48632
|
-
|
|
48629
|
+
if (this.onMapClickKey) {
|
|
48630
|
+
unByKey(this.onMapClickKey);
|
|
48631
|
+
}
|
|
48633
48632
|
}
|
|
48634
48633
|
activate() {
|
|
48635
48634
|
super.activate();
|
|
@@ -48638,20 +48637,23 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48638
48637
|
featureProjection: this.map.getView().getProjection()
|
|
48639
48638
|
});
|
|
48640
48639
|
this.graphsResolutions = RoutingControl.getGraphsResolutions(this.graphs, this.map);
|
|
48641
|
-
|
|
48642
|
-
|
|
48643
|
-
|
|
48644
|
-
this.
|
|
48640
|
+
if (this.modifyInteraction) {
|
|
48641
|
+
this.map.removeInteraction(this.modifyInteraction);
|
|
48642
|
+
}
|
|
48643
|
+
this.routingLayer?.attachToMap(this.map);
|
|
48644
|
+
if (this.modifyInteraction) {
|
|
48645
|
+
this.map.addInteraction(this.modifyInteraction);
|
|
48646
|
+
}
|
|
48647
|
+
this.modifyInteraction?.setActive(this.modify);
|
|
48645
48648
|
this.addListeners();
|
|
48646
|
-
} else {
|
|
48647
|
-
this.format = new GeoJSON_default({ featureProjection: "EPSG:3857" });
|
|
48648
|
-
this.graphsResolutions = this.graphs;
|
|
48649
48649
|
}
|
|
48650
48650
|
}
|
|
48651
48651
|
deactivate() {
|
|
48652
48652
|
if (this.map) {
|
|
48653
|
-
this.routingLayer
|
|
48654
|
-
|
|
48653
|
+
this.routingLayer?.detachFromMap();
|
|
48654
|
+
if (this.modifyInteraction) {
|
|
48655
|
+
this.map.removeInteraction(this.modifyInteraction);
|
|
48656
|
+
}
|
|
48655
48657
|
this.removeListeners();
|
|
48656
48658
|
this.reset();
|
|
48657
48659
|
}
|
|
@@ -48850,10 +48852,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48850
48852
|
});
|
|
48851
48853
|
this.mbMap.once("load", () => {
|
|
48852
48854
|
this.loaded = true;
|
|
48853
|
-
this.dispatchEvent(
|
|
48854
|
-
type: "load",
|
|
48855
|
-
target: this
|
|
48856
|
-
});
|
|
48855
|
+
this.dispatchEvent(new Event_default("load"));
|
|
48857
48856
|
});
|
|
48858
48857
|
this.mbMap.on("idle", this.updateAttribution);
|
|
48859
48858
|
}
|
|
@@ -49006,8 +49005,9 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49006
49005
|
};
|
|
49007
49006
|
}
|
|
49008
49007
|
if (!this.styleLayersFilter && this.styleLayers) {
|
|
49009
|
-
|
|
49010
|
-
|
|
49008
|
+
this.styleLayersFilter = (styleLayer) => {
|
|
49009
|
+
return !!this.styleLayers?.find((sl) => styleLayer.id === sl.id);
|
|
49010
|
+
};
|
|
49011
49011
|
}
|
|
49012
49012
|
}
|
|
49013
49013
|
attachToMap(map) {
|
|
@@ -49283,7 +49283,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49283
49283
|
value: style || realtimeDefaultStyle_default
|
|
49284
49284
|
},
|
|
49285
49285
|
styleOptions: {
|
|
49286
|
-
value: { ...
|
|
49286
|
+
value: { ...realtimeConfig_exports, ...styleOptions || {} }
|
|
49287
49287
|
},
|
|
49288
49288
|
speed: {
|
|
49289
49289
|
get: () => currSpeed,
|
|
@@ -49976,7 +49976,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49976
49976
|
RealtimeModes: () => RealtimeModes,
|
|
49977
49977
|
RoutingAPI: () => RoutingAPI_default,
|
|
49978
49978
|
StopsAPI: () => StopsAPI_default,
|
|
49979
|
-
|
|
49979
|
+
createRealtimeFilters: () => createRealtimeFilters_default,
|
|
49980
49980
|
getCircleCanvas: () => getCircleCanvas,
|
|
49981
49981
|
getDelayBgCanvas: () => getDelayBgCanvas,
|
|
49982
49982
|
getDelayTextCanvas: () => getDelayTextCanvas,
|
|
@@ -49992,13 +49992,13 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49992
49992
|
getUTCTimeString: () => getUTCTimeString,
|
|
49993
49993
|
getUrlWithParams: () => getUrlWithParams_default,
|
|
49994
49994
|
pad: () => pad,
|
|
49995
|
+
realtimeConfig: () => realtimeConfig_exports,
|
|
49995
49996
|
realtimeDefaultStyle: () => realtimeDefaultStyle_default,
|
|
49996
49997
|
realtimeDelayStyle: () => realtimeDelayStyle_default,
|
|
49997
49998
|
realtimeSimpleStyle: () => realtimeSimpleStyle_default,
|
|
49998
49999
|
removeDuplicate: () => removeDuplicate_default,
|
|
49999
50000
|
renderTrajectories: () => renderTrajectories_default,
|
|
50000
|
-
sortByDelay: () => sortByDelay_default
|
|
50001
|
-
trackerConfig: () => trackerConfig_exports
|
|
50001
|
+
sortByDelay: () => sortByDelay_default
|
|
50002
50002
|
});
|
|
50003
50003
|
|
|
50004
50004
|
// src/mapbox/controls/CopyrightControl.ts
|