@wemap/routers 11.3.2 → 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 +15 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -13
- 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 +22 -16
package/dist/index.mjs
CHANGED
|
@@ -710,7 +710,7 @@ const buildStepsRules = (graphItinerary) => (currentCoords, nextCoords, previous
|
|
|
710
710
|
if (edge.data.isElevator) {
|
|
711
711
|
levelChangeType = "elevator";
|
|
712
712
|
} else if (edge.data instanceof OsmWay && edge.data.isConveying && edge.data.areStairs) {
|
|
713
|
-
levelChangeType = "
|
|
713
|
+
levelChangeType = "escalator";
|
|
714
714
|
} else if (edge.data instanceof OsmWay && edge.data.areStairs) {
|
|
715
715
|
levelChangeType = "stairs";
|
|
716
716
|
} else if (edge.data instanceof OsmWay && edge.data.isConveying) {
|
|
@@ -718,20 +718,22 @@ const buildStepsRules = (graphItinerary) => (currentCoords, nextCoords, previous
|
|
|
718
718
|
}
|
|
719
719
|
let forceLevelChange;
|
|
720
720
|
const edgeTags = edge.data.tags || {};
|
|
721
|
-
if (edge.data instanceof OsmWay && edge.data.areStairs && ["up", "down"].includes(edgeTags.incline) && !(previousStep == null ? void 0 : previousStep.levelChange)) {
|
|
721
|
+
if ((edge.data instanceof OsmWay && edge.data.areStairs || edge.data.isElevator) && ["up", "down"].includes(edgeTags.incline) && !(previousStep == null ? void 0 : previousStep.levelChange)) {
|
|
722
722
|
forceLevelChange = edgeTags.incline;
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
723
|
+
if (edge.data instanceof OsmWay) {
|
|
724
|
+
for (const n of edge.data.nodes) {
|
|
725
|
+
if (n !== vertex.data)
|
|
726
|
+
continue;
|
|
727
|
+
}
|
|
728
|
+
const isReversed = edge.data.nodes.reduce((acc, n, idx, arr) => {
|
|
729
|
+
if (n !== vertex.data)
|
|
730
|
+
return acc;
|
|
731
|
+
acc = !(idx + 1 < arr.length && arr[idx + 1] === nextVertex.data);
|
|
729
732
|
return acc;
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
forceLevelChange = forceLevelChange === "up" ? "down" : "up";
|
|
733
|
+
}, null);
|
|
734
|
+
if (isReversed) {
|
|
735
|
+
forceLevelChange = forceLevelChange === "up" ? "down" : "up";
|
|
736
|
+
}
|
|
735
737
|
}
|
|
736
738
|
}
|
|
737
739
|
const previousEdge = edgeId > 0 && edges.length ? edges[edgeId - 1] : null;
|