@wemap/routers 11.3.1 → 11.3.3
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/dist/index.js +17 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -15
- package/dist/index.mjs.map +1 -1
- package/helpers/InstructionManager.ts +18 -6
- package/helpers/InstructionManagerV1.ts +2 -2
- package/package.json +4 -4
- package/src/model/LevelChange.spec.ts +1 -2
- package/src/model/LevelChange.ts +1 -2
- package/src/wemap-osm/OsmRouter.ts +24 -18
- package/src/wemap-osm/OsmRouterOptions.ts +2 -2
package/dist/index.js
CHANGED
|
@@ -718,7 +718,7 @@ const buildStepsRules = (graphItinerary) => (currentCoords, nextCoords, previous
|
|
|
718
718
|
if (edge.data.isElevator) {
|
|
719
719
|
levelChangeType = "elevator";
|
|
720
720
|
} else if (edge.data instanceof osm.OsmWay && edge.data.isConveying && edge.data.areStairs) {
|
|
721
|
-
levelChangeType = "
|
|
721
|
+
levelChangeType = "escalator";
|
|
722
722
|
} else if (edge.data instanceof osm.OsmWay && edge.data.areStairs) {
|
|
723
723
|
levelChangeType = "stairs";
|
|
724
724
|
} else if (edge.data instanceof osm.OsmWay && edge.data.isConveying) {
|
|
@@ -726,20 +726,22 @@ const buildStepsRules = (graphItinerary) => (currentCoords, nextCoords, previous
|
|
|
726
726
|
}
|
|
727
727
|
let forceLevelChange;
|
|
728
728
|
const edgeTags = edge.data.tags || {};
|
|
729
|
-
if (edge.data instanceof osm.OsmWay && edge.data.areStairs && ["up", "down"].includes(edgeTags.incline) && !(previousStep == null ? void 0 : previousStep.levelChange)) {
|
|
729
|
+
if ((edge.data instanceof osm.OsmWay && edge.data.areStairs || edge.data.isElevator) && ["up", "down"].includes(edgeTags.incline) && !(previousStep == null ? void 0 : previousStep.levelChange)) {
|
|
730
730
|
forceLevelChange = edgeTags.incline;
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
731
|
+
if (edge.data instanceof osm.OsmWay) {
|
|
732
|
+
for (const n of edge.data.nodes) {
|
|
733
|
+
if (n !== vertex.data)
|
|
734
|
+
continue;
|
|
735
|
+
}
|
|
736
|
+
const isReversed = edge.data.nodes.reduce((acc, n, idx, arr) => {
|
|
737
|
+
if (n !== vertex.data)
|
|
738
|
+
return acc;
|
|
739
|
+
acc = !(idx + 1 < arr.length && arr[idx + 1] === nextVertex.data);
|
|
737
740
|
return acc;
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
forceLevelChange = forceLevelChange === "up" ? "down" : "up";
|
|
741
|
+
}, null);
|
|
742
|
+
if (isReversed) {
|
|
743
|
+
forceLevelChange = forceLevelChange === "up" ? "down" : "up";
|
|
744
|
+
}
|
|
743
745
|
}
|
|
744
746
|
}
|
|
745
747
|
const previousEdge = edgeId > 0 && edges.length ? edges[edgeId - 1] : null;
|
|
@@ -853,9 +855,9 @@ const _WemapOsmRouter = class extends geo.GeoGraphRouter {
|
|
|
853
855
|
return false;
|
|
854
856
|
if (typeof (options == null ? void 0 : options.useStairs) !== "undefined" && !(options == null ? void 0 : options.useStairs) && edge.data instanceof osm.OsmWay && edge.data.areStairs && !edge.data.isConveying)
|
|
855
857
|
return false;
|
|
856
|
-
if (typeof (options == null ? void 0 : options.
|
|
858
|
+
if (typeof (options == null ? void 0 : options.useEscalators) !== "undefined" && !(options == null ? void 0 : options.useEscalators) && edge.data instanceof osm.OsmWay && edge.data.areStairs && edge.data.isConveying)
|
|
857
859
|
return false;
|
|
858
|
-
if (typeof (options == null ? void 0 : options.
|
|
860
|
+
if (typeof (options == null ? void 0 : options.useElevators) !== "undefined" && !(options == null ? void 0 : options.useElevators) && ((_c = edge.data) == null ? void 0 : _c.isElevator))
|
|
859
861
|
return false;
|
|
860
862
|
return true;
|
|
861
863
|
};
|