mobility-toolbox-js 2.0.0-beta.51 → 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} +4 -4
- package/common/utils/createRealtimeFilters.d.ts.map +1 -0
- package/common/utils/{createTrackerFilters.js → createRealtimeFilters.js} +12 -5
- 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 +172 -168
- 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/types/realtime.d.ts +16 -4
- 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;
|
|
@@ -34620,14 +34623,18 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34620
34623
|
const routes = typeof route === "string" ? route.split(",") : route;
|
|
34621
34624
|
const routeList = routes.map((item) => parseInt(item, 10));
|
|
34622
34625
|
const routeFilter = (item) => {
|
|
34623
|
-
const
|
|
34626
|
+
const routeIdentifier = item.properties.route_identifier || item.properties.routeIdentifier || "";
|
|
34627
|
+
const routeId = parseInt(routeIdentifier.split(".")[0], 10);
|
|
34624
34628
|
return routeList.includes(routeId);
|
|
34625
34629
|
};
|
|
34626
34630
|
filterList.push(routeFilter);
|
|
34627
34631
|
}
|
|
34628
34632
|
if (operator) {
|
|
34629
34633
|
const operatorList = typeof operator === "string" ? [operator] : operator;
|
|
34630
|
-
const operatorFilter = (item) => operatorList.some((op) =>
|
|
34634
|
+
const operatorFilter = (item) => operatorList.some((op) => {
|
|
34635
|
+
const tenant = item.properties.operator || item.properties.tenant || "";
|
|
34636
|
+
return new RegExp(op, "i").test(tenant);
|
|
34637
|
+
});
|
|
34631
34638
|
filterList.push(operatorFilter);
|
|
34632
34639
|
}
|
|
34633
34640
|
if (!filterList.length) {
|
|
@@ -34642,7 +34649,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34642
34649
|
return true;
|
|
34643
34650
|
};
|
|
34644
34651
|
};
|
|
34645
|
-
var
|
|
34652
|
+
var createRealtimeFilters_default = createRealtimeFilters;
|
|
34646
34653
|
|
|
34647
34654
|
// src/common/utils/getLayersAsFlatArray.ts
|
|
34648
34655
|
var getLayersAsFlatArray = (layersOrLayer) => {
|
|
@@ -34660,7 +34667,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34660
34667
|
};
|
|
34661
34668
|
var getLayersAsFlatArray_default = getLayersAsFlatArray;
|
|
34662
34669
|
|
|
34663
|
-
// src/common/utils/timeUtils.
|
|
34670
|
+
// src/common/utils/timeUtils.ts
|
|
34664
34671
|
var getUTCDateString = (now = new Date()) => {
|
|
34665
34672
|
let month = (now.getUTCMonth() + 1).toString();
|
|
34666
34673
|
month = month.length === 1 ? `0${month}` : month;
|
|
@@ -34673,7 +34680,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34673
34680
|
date.getUTCMinutes(),
|
|
34674
34681
|
`${date.getUTCSeconds()}.${date.getUTCMilliseconds()}`
|
|
34675
34682
|
].join(":");
|
|
34676
|
-
var pad = (integer) => integer < 10 ? `0${integer}` : integer
|
|
34683
|
+
var pad = (integer) => integer < 10 ? `0${integer}` : `${integer}`;
|
|
34677
34684
|
var getHoursAndMinutes = (timeInMs) => {
|
|
34678
34685
|
if (!timeInMs || timeInMs <= 0) {
|
|
34679
34686
|
return "";
|
|
@@ -34682,7 +34689,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34682
34689
|
return `${pad(date.getHours())}:${pad(date.getMinutes())}`;
|
|
34683
34690
|
};
|
|
34684
34691
|
|
|
34685
|
-
// src/common/utils/sortByDelay.
|
|
34692
|
+
// src/common/utils/sortByDelay.ts
|
|
34686
34693
|
var sortByDelay = (traj1, traj2) => {
|
|
34687
34694
|
const props1 = traj1.properties;
|
|
34688
34695
|
const props2 = traj2.properties;
|
|
@@ -34862,7 +34869,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
34862
34869
|
CIRCLE: "Circle"
|
|
34863
34870
|
};
|
|
34864
34871
|
|
|
34865
|
-
// src/common/utils/getVehiclePosition.
|
|
34872
|
+
// src/common/utils/getVehiclePosition.ts
|
|
34866
34873
|
var getVehiclePosition = (now, trajectory, noInterpolate) => {
|
|
34867
34874
|
const {
|
|
34868
34875
|
time_intervals: timeIntervals,
|
|
@@ -35867,22 +35874,22 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
35867
35874
|
}
|
|
35868
35875
|
addCommon();
|
|
35869
35876
|
|
|
35870
|
-
// src/common/utils/getMaplibreRender.
|
|
35877
|
+
// src/common/utils/getMaplibreRender.ts
|
|
35871
35878
|
function getMaplibreRender(maplibreLayer) {
|
|
35879
|
+
const emptyDiv = document.createElement("div");
|
|
35872
35880
|
return (frameState) => {
|
|
35873
35881
|
const { map, mbMap, olLayer } = maplibreLayer;
|
|
35874
35882
|
if (!map || !mbMap) {
|
|
35875
|
-
return
|
|
35883
|
+
return emptyDiv;
|
|
35876
35884
|
}
|
|
35877
35885
|
const canvas2 = mbMap.getCanvas();
|
|
35878
35886
|
const { viewState } = frameState;
|
|
35879
|
-
const opacity = olLayer
|
|
35880
|
-
canvas2.style.opacity = opacity
|
|
35887
|
+
const opacity = olLayer?.getOpacity() || 1;
|
|
35888
|
+
canvas2.style.opacity = `${opacity}`;
|
|
35881
35889
|
mbMap.jumpTo({
|
|
35882
35890
|
center: toLonLat(viewState.center),
|
|
35883
35891
|
zoom: viewState.zoom - 1,
|
|
35884
|
-
bearing: toDegrees(-viewState.rotation)
|
|
35885
|
-
animate: false
|
|
35892
|
+
bearing: toDegrees(-viewState.rotation)
|
|
35886
35893
|
});
|
|
35887
35894
|
if (!canvas2.isConnected) {
|
|
35888
35895
|
map.render();
|
|
@@ -35896,10 +35903,11 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
35896
35903
|
|
|
35897
35904
|
// src/common/utils/getMapboxRender.ts
|
|
35898
35905
|
function getMapboxRender(mapoxLayer) {
|
|
35906
|
+
const emptyDiv = document.createElement("div");
|
|
35899
35907
|
return (frameState) => {
|
|
35900
35908
|
const { map, mbMap, renderState, olLayer } = mapoxLayer;
|
|
35901
35909
|
if (!map || !mbMap) {
|
|
35902
|
-
return
|
|
35910
|
+
return emptyDiv;
|
|
35903
35911
|
}
|
|
35904
35912
|
let changed = false;
|
|
35905
35913
|
const canvas2 = mbMap.getCanvas();
|
|
@@ -35952,9 +35960,9 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
35952
35960
|
};
|
|
35953
35961
|
}
|
|
35954
35962
|
|
|
35955
|
-
// src/common/utils/
|
|
35956
|
-
var
|
|
35957
|
-
__export(
|
|
35963
|
+
// src/common/utils/realtimeConfig.ts
|
|
35964
|
+
var realtimeConfig_exports = {};
|
|
35965
|
+
__export(realtimeConfig_exports, {
|
|
35958
35966
|
bgColors: () => bgColors,
|
|
35959
35967
|
getBgColor: () => getBgColor,
|
|
35960
35968
|
getDelayColor: () => getDelayColor,
|
|
@@ -35966,18 +35974,18 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
35966
35974
|
textColors: () => textColors,
|
|
35967
35975
|
types: () => types
|
|
35968
35976
|
});
|
|
35969
|
-
var
|
|
35970
|
-
|
|
35971
|
-
|
|
35972
|
-
|
|
35973
|
-
|
|
35974
|
-
|
|
35975
|
-
|
|
35976
|
-
|
|
35977
|
-
|
|
35978
|
-
|
|
35979
|
-
|
|
35980
|
-
|
|
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
|
+
];
|
|
35981
35989
|
var types = [
|
|
35982
35990
|
/^Tram/i,
|
|
35983
35991
|
/^Subway( \/ Metro \/ S-Bahn)?/i,
|
|
@@ -36023,25 +36031,25 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
36023
36031
|
var getRadius = (type, zoom) => {
|
|
36024
36032
|
try {
|
|
36025
36033
|
const typeIdx = getTypeIndex(type || 0);
|
|
36026
|
-
return
|
|
36034
|
+
return radiusMapping[typeIdx][zoom];
|
|
36027
36035
|
} catch (e) {
|
|
36028
36036
|
return 1;
|
|
36029
36037
|
}
|
|
36030
36038
|
};
|
|
36031
|
-
var getBgColor = (type
|
|
36039
|
+
var getBgColor = (type) => {
|
|
36032
36040
|
try {
|
|
36033
36041
|
const typeIdx = getTypeIndex(type);
|
|
36034
36042
|
return bgColors[typeIdx];
|
|
36035
36043
|
} catch (e) {
|
|
36036
|
-
return
|
|
36044
|
+
return "#ffffff";
|
|
36037
36045
|
}
|
|
36038
36046
|
};
|
|
36039
|
-
var getTextColor = (type
|
|
36047
|
+
var getTextColor = (type) => {
|
|
36040
36048
|
try {
|
|
36041
36049
|
const typeIdx = getTypeIndex(type);
|
|
36042
36050
|
return textColors[typeIdx];
|
|
36043
36051
|
} catch (e) {
|
|
36044
|
-
return
|
|
36052
|
+
return "#ffffff";
|
|
36045
36053
|
}
|
|
36046
36054
|
};
|
|
36047
36055
|
var getTextSize = (ctx, markerSize, text, fontSize) => {
|
|
@@ -37260,8 +37268,8 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
37260
37268
|
}();
|
|
37261
37269
|
var tmpTransform = create();
|
|
37262
37270
|
var Geometry = function(_super) {
|
|
37263
|
-
__extends11(
|
|
37264
|
-
function
|
|
37271
|
+
__extends11(Geometry3, _super);
|
|
37272
|
+
function Geometry3() {
|
|
37265
37273
|
var _this = _super.call(this) || this;
|
|
37266
37274
|
_this.extent_ = createEmpty();
|
|
37267
37275
|
_this.extentRevision_ = -1;
|
|
@@ -37277,31 +37285,31 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
37277
37285
|
});
|
|
37278
37286
|
return _this;
|
|
37279
37287
|
}
|
|
37280
|
-
|
|
37288
|
+
Geometry3.prototype.simplifyTransformed = function(squaredTolerance, opt_transform) {
|
|
37281
37289
|
return this.simplifyTransformedInternal(this.getRevision(), squaredTolerance, opt_transform);
|
|
37282
37290
|
};
|
|
37283
|
-
|
|
37291
|
+
Geometry3.prototype.clone = function() {
|
|
37284
37292
|
return abstract();
|
|
37285
37293
|
};
|
|
37286
|
-
|
|
37294
|
+
Geometry3.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
|
37287
37295
|
return abstract();
|
|
37288
37296
|
};
|
|
37289
|
-
|
|
37297
|
+
Geometry3.prototype.containsXY = function(x, y) {
|
|
37290
37298
|
var coord = this.getClosestPoint([x, y]);
|
|
37291
37299
|
return coord[0] === x && coord[1] === y;
|
|
37292
37300
|
};
|
|
37293
|
-
|
|
37301
|
+
Geometry3.prototype.getClosestPoint = function(point2, opt_closestPoint) {
|
|
37294
37302
|
var closestPoint = opt_closestPoint ? opt_closestPoint : [NaN, NaN];
|
|
37295
37303
|
this.closestPointXY(point2[0], point2[1], closestPoint, Infinity);
|
|
37296
37304
|
return closestPoint;
|
|
37297
37305
|
};
|
|
37298
|
-
|
|
37306
|
+
Geometry3.prototype.intersectsCoordinate = function(coordinate) {
|
|
37299
37307
|
return this.containsXY(coordinate[0], coordinate[1]);
|
|
37300
37308
|
};
|
|
37301
|
-
|
|
37309
|
+
Geometry3.prototype.computeExtent = function(extent) {
|
|
37302
37310
|
return abstract();
|
|
37303
37311
|
};
|
|
37304
|
-
|
|
37312
|
+
Geometry3.prototype.getExtent = function(opt_extent) {
|
|
37305
37313
|
if (this.extentRevision_ != this.getRevision()) {
|
|
37306
37314
|
var extent = this.computeExtent(this.extent_);
|
|
37307
37315
|
if (isNaN(extent[0]) || isNaN(extent[1])) {
|
|
@@ -37311,31 +37319,31 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
37311
37319
|
}
|
|
37312
37320
|
return returnOrUpdate(this.extent_, opt_extent);
|
|
37313
37321
|
};
|
|
37314
|
-
|
|
37322
|
+
Geometry3.prototype.rotate = function(angle, anchor) {
|
|
37315
37323
|
abstract();
|
|
37316
37324
|
};
|
|
37317
|
-
|
|
37325
|
+
Geometry3.prototype.scale = function(sx, opt_sy, opt_anchor) {
|
|
37318
37326
|
abstract();
|
|
37319
37327
|
};
|
|
37320
|
-
|
|
37328
|
+
Geometry3.prototype.simplify = function(tolerance) {
|
|
37321
37329
|
return this.getSimplifiedGeometry(tolerance * tolerance);
|
|
37322
37330
|
};
|
|
37323
|
-
|
|
37331
|
+
Geometry3.prototype.getSimplifiedGeometry = function(squaredTolerance) {
|
|
37324
37332
|
return abstract();
|
|
37325
37333
|
};
|
|
37326
|
-
|
|
37334
|
+
Geometry3.prototype.getType = function() {
|
|
37327
37335
|
return abstract();
|
|
37328
37336
|
};
|
|
37329
|
-
|
|
37337
|
+
Geometry3.prototype.applyTransform = function(transformFn) {
|
|
37330
37338
|
abstract();
|
|
37331
37339
|
};
|
|
37332
|
-
|
|
37340
|
+
Geometry3.prototype.intersectsExtent = function(extent) {
|
|
37333
37341
|
return abstract();
|
|
37334
37342
|
};
|
|
37335
|
-
|
|
37343
|
+
Geometry3.prototype.translate = function(deltaX, deltaY) {
|
|
37336
37344
|
abstract();
|
|
37337
37345
|
};
|
|
37338
|
-
|
|
37346
|
+
Geometry3.prototype.transform = function(source, destination) {
|
|
37339
37347
|
var sourceProj = get3(source);
|
|
37340
37348
|
var transformFn = sourceProj.getUnits() == Units_default.TILE_PIXELS ? function(inCoordinates, outCoordinates, stride) {
|
|
37341
37349
|
var pixelExtent = sourceProj.getExtent();
|
|
@@ -37348,7 +37356,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
37348
37356
|
this.applyTransform(transformFn);
|
|
37349
37357
|
return this;
|
|
37350
37358
|
};
|
|
37351
|
-
return
|
|
37359
|
+
return Geometry3;
|
|
37352
37360
|
}(Object_default);
|
|
37353
37361
|
var Geometry_default = Geometry;
|
|
37354
37362
|
|
|
@@ -47852,10 +47860,13 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
47852
47860
|
var Layer2 = class extends Object_default {
|
|
47853
47861
|
constructor(options = {}) {
|
|
47854
47862
|
super();
|
|
47863
|
+
this.properties = {};
|
|
47864
|
+
this.options = {};
|
|
47855
47865
|
this.defineProperties(options);
|
|
47856
47866
|
if (options.properties) {
|
|
47857
47867
|
this.setProperties(options.properties);
|
|
47858
47868
|
}
|
|
47869
|
+
this.options = options;
|
|
47859
47870
|
this.visible = options.visible === void 0 ? true : !!options.visible;
|
|
47860
47871
|
this.group = options.group;
|
|
47861
47872
|
this.copyrights = options.copyrights;
|
|
@@ -48103,10 +48114,9 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48103
48114
|
event: evt
|
|
48104
48115
|
};
|
|
48105
48116
|
return this.getFeatureInfoAtCoordinate(coordinate).then((featureInfo) => {
|
|
48106
|
-
|
|
48107
|
-
|
|
48108
|
-
|
|
48109
|
-
});
|
|
48117
|
+
const event = new Event_default("user:click");
|
|
48118
|
+
event.target = featureInfo;
|
|
48119
|
+
this.dispatchEvent(event);
|
|
48110
48120
|
return featureInfo;
|
|
48111
48121
|
}).catch(() => emptyFeatureInfo);
|
|
48112
48122
|
}
|
|
@@ -48119,10 +48129,9 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48119
48129
|
event: evt
|
|
48120
48130
|
};
|
|
48121
48131
|
return this.getFeatureInfoAtCoordinate(coordinate).then((featureInfo) => {
|
|
48122
|
-
|
|
48123
|
-
|
|
48124
|
-
|
|
48125
|
-
});
|
|
48132
|
+
const event = new Event_default("user:hover");
|
|
48133
|
+
event.target = featureInfo;
|
|
48134
|
+
this.dispatchEvent(event);
|
|
48126
48135
|
return featureInfo;
|
|
48127
48136
|
}).catch(() => emptyFeatureInfo);
|
|
48128
48137
|
}
|
|
@@ -48218,7 +48227,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48218
48227
|
};
|
|
48219
48228
|
var Layer_default4 = Layer3;
|
|
48220
48229
|
|
|
48221
|
-
// src/ol/layers/RoutingLayer.
|
|
48230
|
+
// src/ol/layers/RoutingLayer.ts
|
|
48222
48231
|
var circleStyle = new Circle_default({
|
|
48223
48232
|
radius: 6,
|
|
48224
48233
|
fill: new Fill_default({
|
|
@@ -48255,7 +48264,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48255
48264
|
const maxResolution = feature2.get("maxResolution");
|
|
48256
48265
|
const inRange = resolution <= minResolution && resolution > maxResolution;
|
|
48257
48266
|
if (minResolution && maxResolution && !inRange) {
|
|
48258
|
-
return
|
|
48267
|
+
return [];
|
|
48259
48268
|
}
|
|
48260
48269
|
const mot = feature2.get("mot");
|
|
48261
48270
|
if (mot !== "foot") {
|
|
@@ -48264,8 +48273,9 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48264
48273
|
return [dashedRedLine];
|
|
48265
48274
|
};
|
|
48266
48275
|
var RoutingLayer = class extends Layer_default4 {
|
|
48267
|
-
constructor(options
|
|
48276
|
+
constructor(options) {
|
|
48268
48277
|
super(options);
|
|
48278
|
+
this.options = {};
|
|
48269
48279
|
this.olLayer = options.olLayer || new Vector_default({
|
|
48270
48280
|
source: new Vector_default2(),
|
|
48271
48281
|
style: options.style || defaultStyleFunction
|
|
@@ -48277,7 +48287,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48277
48287
|
};
|
|
48278
48288
|
var RoutingLayer_default = RoutingLayer;
|
|
48279
48289
|
|
|
48280
|
-
// src/ol/controls/RoutingControl.
|
|
48290
|
+
// src/ol/controls/RoutingControl.ts
|
|
48281
48291
|
var REGEX_VIA_POINT = /^([^@$!\n]*)(@?([\d.]+),([\d.]+))?(\$?([a-zA-Z0-9]{0,2}))$/;
|
|
48282
48292
|
var REGEX_VIA_POINT_COORD = /^([\d.]+),([\d.]+)$/;
|
|
48283
48293
|
var REGEX_VIA_POINT_STATION_ID = /^!([^$]*)(\$?([a-zA-Z0-9]{0,2}))$/;
|
|
@@ -48285,13 +48295,27 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48285
48295
|
var getFlatCoordinatesFromSegments = (segmentArray) => {
|
|
48286
48296
|
const coords = [];
|
|
48287
48297
|
segmentArray.forEach((seg) => {
|
|
48288
|
-
|
|
48298
|
+
const coordArr = seg.getGeometry()?.getCoordinates();
|
|
48299
|
+
if (coordArr?.length) {
|
|
48300
|
+
coords.push(...coordArr);
|
|
48301
|
+
}
|
|
48289
48302
|
});
|
|
48290
48303
|
return coords;
|
|
48291
48304
|
};
|
|
48292
48305
|
var RoutingControl = class extends ControlCommon_default {
|
|
48293
48306
|
constructor(options = {}) {
|
|
48294
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 = {};
|
|
48295
48319
|
Object.defineProperties(this, {
|
|
48296
48320
|
mot: {
|
|
48297
48321
|
get: () => this.get("mot"),
|
|
@@ -48321,14 +48345,11 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48321
48345
|
this.graphs = options.graphs || [["osm", 0, 99]];
|
|
48322
48346
|
this.mot = options.mot || "bus";
|
|
48323
48347
|
this.modify = options.modify !== false;
|
|
48324
|
-
this.routingApiParams = options.routingApiParams
|
|
48348
|
+
this.routingApiParams = options.routingApiParams;
|
|
48325
48349
|
this.useRawViaPoints = options.useRawViaPoints || false;
|
|
48326
48350
|
this.snapToClosestStation = options.snapToClosestStation || false;
|
|
48327
|
-
this.cacheStationData = {};
|
|
48328
|
-
this.abortControllers = [];
|
|
48329
48351
|
this.apiKey = options.apiKey;
|
|
48330
48352
|
this.stopsApiKey = options.stopsApiKey || this.apiKey;
|
|
48331
|
-
this.segments = [];
|
|
48332
48353
|
this.stopsApiUrl = options.stopsApiUrl || "https://api.geops.io/stops/v1/";
|
|
48333
48354
|
this.api = new RoutingAPI_default({
|
|
48334
48355
|
...options
|
|
@@ -48338,18 +48359,13 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48338
48359
|
style: options.style
|
|
48339
48360
|
});
|
|
48340
48361
|
this.onRouteError = options.onRouteError || ((error) => {
|
|
48341
|
-
this.dispatchEvent(
|
|
48342
|
-
type: "change:route",
|
|
48343
|
-
target: this
|
|
48344
|
-
});
|
|
48362
|
+
this.dispatchEvent(new Event_default("change:route"));
|
|
48345
48363
|
this.reset();
|
|
48346
48364
|
console.error(error);
|
|
48347
48365
|
});
|
|
48348
|
-
this.viaPoints = [];
|
|
48349
48366
|
this.onMapClick = this.onMapClick.bind(this);
|
|
48350
48367
|
this.onModifyEnd = this.onModifyEnd.bind(this);
|
|
48351
48368
|
this.onModifyStart = this.onModifyStart.bind(this);
|
|
48352
|
-
this.apiChangeListener = () => this.drawRoute();
|
|
48353
48369
|
this.createModifyInteraction();
|
|
48354
48370
|
}
|
|
48355
48371
|
static getGraphsResolutions(graphs, map) {
|
|
@@ -48362,44 +48378,33 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48362
48378
|
addViaPoint(coordinatesOrString, index = -1, overwrite = 0) {
|
|
48363
48379
|
this.viaPoints.splice(index === -1 ? this.viaPoints.length : index, overwrite, coordinatesOrString);
|
|
48364
48380
|
this.drawRoute();
|
|
48365
|
-
this.dispatchEvent(
|
|
48366
|
-
type: "change:route",
|
|
48367
|
-
target: this
|
|
48368
|
-
});
|
|
48381
|
+
this.dispatchEvent(new Event_default("change:route"));
|
|
48369
48382
|
}
|
|
48370
|
-
removeViaPoint(index = this.viaPoints.length - 1) {
|
|
48383
|
+
removeViaPoint(index = (this.viaPoints || []).length - 1) {
|
|
48371
48384
|
if (this.viaPoints.length && this.viaPoints[index]) {
|
|
48372
48385
|
this.viaPoints.splice(index, 1);
|
|
48373
48386
|
}
|
|
48374
48387
|
this.drawRoute();
|
|
48375
|
-
this.dispatchEvent(
|
|
48376
|
-
type: "change:route",
|
|
48377
|
-
target: this
|
|
48378
|
-
});
|
|
48388
|
+
this.dispatchEvent(new Event_default("change:route"));
|
|
48379
48389
|
}
|
|
48380
48390
|
setViaPoints(coordinateArray) {
|
|
48381
48391
|
this.viaPoints = [...coordinateArray];
|
|
48382
48392
|
this.drawRoute();
|
|
48383
|
-
this.dispatchEvent(
|
|
48384
|
-
type: "change:route",
|
|
48385
|
-
target: this
|
|
48386
|
-
});
|
|
48393
|
+
this.dispatchEvent(new Event_default("change:route"));
|
|
48387
48394
|
}
|
|
48388
48395
|
reset() {
|
|
48389
48396
|
this.abortRequests();
|
|
48390
48397
|
this.viaPoints = [];
|
|
48391
|
-
this.routingLayer
|
|
48392
|
-
this.dispatchEvent(
|
|
48393
|
-
type: "change:route",
|
|
48394
|
-
target: this
|
|
48395
|
-
});
|
|
48398
|
+
this.routingLayer?.olLayer?.getSource()?.clear();
|
|
48399
|
+
this.dispatchEvent(new Event_default("change:route"));
|
|
48396
48400
|
}
|
|
48397
48401
|
abortRequests() {
|
|
48398
|
-
this.graphs.forEach((
|
|
48399
|
-
|
|
48400
|
-
|
|
48402
|
+
this.graphs.forEach((graph) => {
|
|
48403
|
+
const graphName = graph[0];
|
|
48404
|
+
if (this.abortControllers[graphName]) {
|
|
48405
|
+
this.abortControllers[graphName].abort();
|
|
48401
48406
|
}
|
|
48402
|
-
this.abortControllers[
|
|
48407
|
+
this.abortControllers[graphName] = new AbortController();
|
|
48403
48408
|
});
|
|
48404
48409
|
this.abortControllers[STOP_FETCH_ABORT_CONTROLLER_KEY]?.abort();
|
|
48405
48410
|
this.abortControllers[STOP_FETCH_ABORT_CONTROLLER_KEY] = new AbortController();
|
|
@@ -48407,7 +48412,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48407
48412
|
}
|
|
48408
48413
|
drawRoute() {
|
|
48409
48414
|
this.abortRequests();
|
|
48410
|
-
this.routingLayer
|
|
48415
|
+
this.routingLayer?.olLayer?.getSource()?.clear();
|
|
48411
48416
|
if (!this.viaPoints.length) {
|
|
48412
48417
|
return null;
|
|
48413
48418
|
}
|
|
@@ -48416,26 +48421,29 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48416
48421
|
}
|
|
48417
48422
|
const formattedViaPoints = this.viaPoints.map((viaPoint) => {
|
|
48418
48423
|
if (Array.isArray(viaPoint)) {
|
|
48419
|
-
const projection = this.map
|
|
48424
|
+
const projection = this.map?.getView().getProjection();
|
|
48420
48425
|
const [lon, lat] = toLonLat(viaPoint, projection);
|
|
48421
48426
|
return this.snapToClosestStation ? [`@${lat}`, lon] : [lat, lon];
|
|
48422
48427
|
}
|
|
48423
48428
|
return this.useRawViaPoints ? viaPoint : `!${viaPoint}`;
|
|
48424
48429
|
});
|
|
48425
48430
|
this.loading = true;
|
|
48426
|
-
this.routingLayer
|
|
48431
|
+
this.routingLayer?.olLayer?.getSource()?.clear();
|
|
48427
48432
|
this.viaPoints.forEach((viaPoint, idx) => this.drawViaPoint(viaPoint, idx, this.abortControllers[STOP_FETCH_ABORT_CONTROLLER_KEY]));
|
|
48428
48433
|
return Promise.all(this.graphs.map(([graph], index) => {
|
|
48429
48434
|
const { signal } = this.abortControllers[graph];
|
|
48435
|
+
if (!this.api) {
|
|
48436
|
+
return Promise.resolve([]);
|
|
48437
|
+
}
|
|
48430
48438
|
return this.api.route({
|
|
48431
48439
|
graph,
|
|
48432
48440
|
via: `${formattedViaPoints.join("|")}`,
|
|
48433
|
-
mot:
|
|
48441
|
+
mot: this.mot,
|
|
48434
48442
|
"resolve-hops": false,
|
|
48435
48443
|
elevation: false,
|
|
48436
48444
|
"coord-radius": 100,
|
|
48437
48445
|
"coord-punish": 1e3,
|
|
48438
|
-
...this.routingApiParams
|
|
48446
|
+
...this.routingApiParams || {}
|
|
48439
48447
|
}, { signal }).then((featureCollection) => {
|
|
48440
48448
|
this.segments = this.format.readFeatures(featureCollection);
|
|
48441
48449
|
if (this.mot === "foot") {
|
|
@@ -48460,19 +48468,18 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48460
48468
|
});
|
|
48461
48469
|
routeFeature.set("graph", graph);
|
|
48462
48470
|
routeFeature.set("mot", this.mot);
|
|
48463
|
-
|
|
48464
|
-
|
|
48465
|
-
|
|
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);
|
|
48466
48476
|
this.loading = false;
|
|
48467
48477
|
}).catch((error) => {
|
|
48468
48478
|
if (error.name === "AbortError") {
|
|
48469
48479
|
return;
|
|
48470
48480
|
}
|
|
48471
48481
|
this.segments = [];
|
|
48472
|
-
this.dispatchEvent(
|
|
48473
|
-
type: "error",
|
|
48474
|
-
target: this
|
|
48475
|
-
});
|
|
48482
|
+
this.dispatchEvent(new Event_default("error"));
|
|
48476
48483
|
this.onRouteError(error, this);
|
|
48477
48484
|
this.loading = false;
|
|
48478
48485
|
});
|
|
@@ -48483,14 +48490,14 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48483
48490
|
pointFeature.set("viaPointIdx", idx);
|
|
48484
48491
|
if (Array.isArray(viaPoint)) {
|
|
48485
48492
|
pointFeature.setGeometry(new Point_default(viaPoint));
|
|
48486
|
-
this.routingLayer
|
|
48493
|
+
this.routingLayer?.olLayer?.getSource()?.addFeature(pointFeature);
|
|
48487
48494
|
return Promise.resolve(pointFeature);
|
|
48488
48495
|
}
|
|
48489
48496
|
if (!this.useRawViaPoints || REGEX_VIA_POINT_STATION_ID.test(viaPoint)) {
|
|
48490
48497
|
let stationId;
|
|
48491
48498
|
let track2;
|
|
48492
48499
|
if (this.useRawViaPoints) {
|
|
48493
|
-
[, stationId, , track2] = REGEX_VIA_POINT_STATION_ID.exec(viaPoint);
|
|
48500
|
+
[, stationId, , track2] = REGEX_VIA_POINT_STATION_ID.exec(viaPoint) || [];
|
|
48494
48501
|
} else {
|
|
48495
48502
|
[stationId, track2] = viaPoint.split("$");
|
|
48496
48503
|
}
|
|
@@ -48499,33 +48506,30 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48499
48506
|
this.cacheStationData[viaPoint] = fromLonLat(coordinates2);
|
|
48500
48507
|
pointFeature.set("viaPointTrack", track2);
|
|
48501
48508
|
pointFeature.setGeometry(new Point_default(fromLonLat(coordinates2)));
|
|
48502
|
-
this.routingLayer
|
|
48509
|
+
this.routingLayer?.olLayer?.getSource()?.addFeature(pointFeature);
|
|
48503
48510
|
return pointFeature;
|
|
48504
48511
|
}).catch((error) => {
|
|
48505
48512
|
if (error.name === "AbortError") {
|
|
48506
48513
|
return;
|
|
48507
48514
|
}
|
|
48508
|
-
this.dispatchEvent(
|
|
48509
|
-
type: "error",
|
|
48510
|
-
target: this
|
|
48511
|
-
});
|
|
48515
|
+
this.dispatchEvent(new Event_default("error"));
|
|
48512
48516
|
this.onRouteError(error, this);
|
|
48513
48517
|
this.loading = false;
|
|
48514
48518
|
});
|
|
48515
48519
|
}
|
|
48516
48520
|
if (this.useRawViaPoints && REGEX_VIA_POINT_COORD.test(viaPoint)) {
|
|
48517
|
-
const [lat2, lon2] = REGEX_VIA_POINT_COORD.exec(viaPoint);
|
|
48518
|
-
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());
|
|
48519
48523
|
pointFeature.setGeometry(new Point_default(coordinates2));
|
|
48520
|
-
this.routingLayer
|
|
48524
|
+
this.routingLayer?.olLayer?.getSource()?.addFeature(pointFeature);
|
|
48521
48525
|
return Promise.resolve(pointFeature);
|
|
48522
48526
|
}
|
|
48523
|
-
const [, stationName, , lat, lon, , track] = REGEX_VIA_POINT.exec(viaPoint);
|
|
48527
|
+
const [, stationName, , lat, lon, , track] = REGEX_VIA_POINT.exec(viaPoint) || [];
|
|
48524
48528
|
if (lon && lat) {
|
|
48525
|
-
const coordinates2 = fromLonLat([parseFloat(lon), parseFloat(lat)], this.map
|
|
48529
|
+
const coordinates2 = fromLonLat([parseFloat(lon), parseFloat(lat)], this.map?.getView().getProjection());
|
|
48526
48530
|
pointFeature.set("viaPointTrack", track);
|
|
48527
48531
|
pointFeature.setGeometry(new Point_default(coordinates2));
|
|
48528
|
-
this.routingLayer
|
|
48532
|
+
this.routingLayer?.olLayer?.getSource()?.addFeature(pointFeature);
|
|
48529
48533
|
return Promise.resolve(pointFeature);
|
|
48530
48534
|
}
|
|
48531
48535
|
if (stationName) {
|
|
@@ -48534,13 +48538,10 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48534
48538
|
this.cacheStationData[viaPoint] = fromLonLat(coordinates2);
|
|
48535
48539
|
pointFeature.set("viaPointTrack", track);
|
|
48536
48540
|
pointFeature.setGeometry(new Point_default(fromLonLat(coordinates2)));
|
|
48537
|
-
this.routingLayer
|
|
48541
|
+
this.routingLayer?.olLayer?.getSource()?.addFeature(pointFeature);
|
|
48538
48542
|
return pointFeature;
|
|
48539
48543
|
}).catch((error) => {
|
|
48540
|
-
this.dispatchEvent(
|
|
48541
|
-
type: "error",
|
|
48542
|
-
target: this
|
|
48543
|
-
});
|
|
48544
|
+
this.dispatchEvent(new Event_default("error"));
|
|
48544
48545
|
this.onRouteError(error, this);
|
|
48545
48546
|
this.loading = false;
|
|
48546
48547
|
return null;
|
|
@@ -48548,21 +48549,21 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48548
48549
|
}
|
|
48549
48550
|
return Promise.resolve(null);
|
|
48550
48551
|
}
|
|
48551
|
-
onMapClick(
|
|
48552
|
-
const feats =
|
|
48552
|
+
onMapClick(evt) {
|
|
48553
|
+
const feats = evt.target.getFeaturesAtPixel(evt.pixel);
|
|
48553
48554
|
const viaPoint = feats.find((feat) => feat.getGeometry()?.getType() === GeometryType_default.POINT && feat.get("viaPointIdx") !== void 0);
|
|
48554
48555
|
if (viaPoint) {
|
|
48555
48556
|
this.removeViaPoint(viaPoint.get("viaPointIdx"));
|
|
48556
48557
|
return;
|
|
48557
48558
|
}
|
|
48558
|
-
this.addViaPoint(
|
|
48559
|
+
this.addViaPoint(evt.coordinate);
|
|
48559
48560
|
}
|
|
48560
48561
|
onModifyStart(evt) {
|
|
48561
48562
|
let segmentIndex = -1;
|
|
48562
48563
|
const route = evt.features.getArray().find((feat) => feat.getGeometry()?.getType() === GeometryType_default.LINE_STRING);
|
|
48563
|
-
if (route) {
|
|
48564
|
-
const closestExtent = buffer(new Point_default(route.getGeometry()
|
|
48565
|
-
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));
|
|
48566
48567
|
}
|
|
48567
48568
|
const viaPoint = (evt.features.getArray().filter((feat) => feat.getGeometry()?.getType() === GeometryType_default.POINT) || [])[0];
|
|
48568
48569
|
this.initialRouteDrag = {
|
|
@@ -48573,7 +48574,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48573
48574
|
}
|
|
48574
48575
|
onModifyEnd(evt) {
|
|
48575
48576
|
const coord = evt.mapBrowserEvent.coordinate;
|
|
48576
|
-
const { oldRoute, viaPoint, segmentIndex } = this.initialRouteDrag;
|
|
48577
|
+
const { oldRoute, viaPoint, segmentIndex } = this.initialRouteDrag || {};
|
|
48577
48578
|
if (viaPoint) {
|
|
48578
48579
|
return this.addViaPoint(coord, viaPoint.get("viaPointIdx"), 1);
|
|
48579
48580
|
}
|
|
@@ -48583,7 +48584,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48583
48584
|
if (segmentIndex === -1) {
|
|
48584
48585
|
return Promise.reject(new Error("No segment found"));
|
|
48585
48586
|
}
|
|
48586
|
-
return this.addViaPoint(coord, segmentIndex + 1);
|
|
48587
|
+
return this.addViaPoint(coord, (segmentIndex || 0) + 1);
|
|
48587
48588
|
}
|
|
48588
48589
|
createDefaultElement() {
|
|
48589
48590
|
this.element = document.createElement("button");
|
|
@@ -48598,9 +48599,9 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48598
48599
|
}
|
|
48599
48600
|
createModifyInteraction() {
|
|
48600
48601
|
this.modifyInteraction = new Modify_default({
|
|
48601
|
-
source: this.routingLayer
|
|
48602
|
+
source: this.routingLayer?.olLayer?.getSource() || void 0,
|
|
48602
48603
|
pixelTolerance: 4,
|
|
48603
|
-
hitDetection: this.routingLayer
|
|
48604
|
+
hitDetection: this.routingLayer?.olLayer,
|
|
48604
48605
|
deleteCondition: (e) => {
|
|
48605
48606
|
const feats = e.target.getFeaturesAtPixel(e.pixel, {
|
|
48606
48607
|
hitTolerance: 5
|
|
@@ -48622,10 +48623,12 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48622
48623
|
return;
|
|
48623
48624
|
}
|
|
48624
48625
|
this.removeListeners();
|
|
48625
|
-
this.onMapClickKey = this.map
|
|
48626
|
+
this.onMapClickKey = this.map?.on("singleclick", this.onMapClick);
|
|
48626
48627
|
}
|
|
48627
48628
|
removeListeners() {
|
|
48628
|
-
|
|
48629
|
+
if (this.onMapClickKey) {
|
|
48630
|
+
unByKey(this.onMapClickKey);
|
|
48631
|
+
}
|
|
48629
48632
|
}
|
|
48630
48633
|
activate() {
|
|
48631
48634
|
super.activate();
|
|
@@ -48634,20 +48637,23 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48634
48637
|
featureProjection: this.map.getView().getProjection()
|
|
48635
48638
|
});
|
|
48636
48639
|
this.graphsResolutions = RoutingControl.getGraphsResolutions(this.graphs, this.map);
|
|
48637
|
-
|
|
48638
|
-
|
|
48639
|
-
|
|
48640
|
-
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);
|
|
48641
48648
|
this.addListeners();
|
|
48642
|
-
} else {
|
|
48643
|
-
this.format = new GeoJSON_default({ featureProjection: "EPSG:3857" });
|
|
48644
|
-
this.graphsResolutions = this.graphs;
|
|
48645
48649
|
}
|
|
48646
48650
|
}
|
|
48647
48651
|
deactivate() {
|
|
48648
48652
|
if (this.map) {
|
|
48649
|
-
this.routingLayer
|
|
48650
|
-
|
|
48653
|
+
this.routingLayer?.detachFromMap();
|
|
48654
|
+
if (this.modifyInteraction) {
|
|
48655
|
+
this.map.removeInteraction(this.modifyInteraction);
|
|
48656
|
+
}
|
|
48651
48657
|
this.removeListeners();
|
|
48652
48658
|
this.reset();
|
|
48653
48659
|
}
|
|
@@ -48846,10 +48852,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48846
48852
|
});
|
|
48847
48853
|
this.mbMap.once("load", () => {
|
|
48848
48854
|
this.loaded = true;
|
|
48849
|
-
this.dispatchEvent(
|
|
48850
|
-
type: "load",
|
|
48851
|
-
target: this
|
|
48852
|
-
});
|
|
48855
|
+
this.dispatchEvent(new Event_default("load"));
|
|
48853
48856
|
});
|
|
48854
48857
|
this.mbMap.on("idle", this.updateAttribution);
|
|
48855
48858
|
}
|
|
@@ -49002,8 +49005,9 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49002
49005
|
};
|
|
49003
49006
|
}
|
|
49004
49007
|
if (!this.styleLayersFilter && this.styleLayers) {
|
|
49005
|
-
|
|
49006
|
-
|
|
49008
|
+
this.styleLayersFilter = (styleLayer) => {
|
|
49009
|
+
return !!this.styleLayers?.find((sl) => styleLayer.id === sl.id);
|
|
49010
|
+
};
|
|
49007
49011
|
}
|
|
49008
49012
|
}
|
|
49009
49013
|
attachToMap(map) {
|
|
@@ -49279,7 +49283,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49279
49283
|
value: style || realtimeDefaultStyle_default
|
|
49280
49284
|
},
|
|
49281
49285
|
styleOptions: {
|
|
49282
|
-
value: { ...
|
|
49286
|
+
value: { ...realtimeConfig_exports, ...styleOptions || {} }
|
|
49283
49287
|
},
|
|
49284
49288
|
speed: {
|
|
49285
49289
|
get: () => currSpeed,
|
|
@@ -49972,7 +49976,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49972
49976
|
RealtimeModes: () => RealtimeModes,
|
|
49973
49977
|
RoutingAPI: () => RoutingAPI_default,
|
|
49974
49978
|
StopsAPI: () => StopsAPI_default,
|
|
49975
|
-
|
|
49979
|
+
createRealtimeFilters: () => createRealtimeFilters_default,
|
|
49976
49980
|
getCircleCanvas: () => getCircleCanvas,
|
|
49977
49981
|
getDelayBgCanvas: () => getDelayBgCanvas,
|
|
49978
49982
|
getDelayTextCanvas: () => getDelayTextCanvas,
|
|
@@ -49988,13 +49992,13 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49988
49992
|
getUTCTimeString: () => getUTCTimeString,
|
|
49989
49993
|
getUrlWithParams: () => getUrlWithParams_default,
|
|
49990
49994
|
pad: () => pad,
|
|
49995
|
+
realtimeConfig: () => realtimeConfig_exports,
|
|
49991
49996
|
realtimeDefaultStyle: () => realtimeDefaultStyle_default,
|
|
49992
49997
|
realtimeDelayStyle: () => realtimeDelayStyle_default,
|
|
49993
49998
|
realtimeSimpleStyle: () => realtimeSimpleStyle_default,
|
|
49994
49999
|
removeDuplicate: () => removeDuplicate_default,
|
|
49995
50000
|
renderTrajectories: () => renderTrajectories_default,
|
|
49996
|
-
sortByDelay: () => sortByDelay_default
|
|
49997
|
-
trackerConfig: () => trackerConfig_exports
|
|
50001
|
+
sortByDelay: () => sortByDelay_default
|
|
49998
50002
|
});
|
|
49999
50003
|
|
|
50000
50004
|
// src/mapbox/controls/CopyrightControl.ts
|