@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.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;
|