[gnome-maps] Revert "graphHopper: Fold instruction with common street names / numbers"
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] Revert "graphHopper: Fold instruction with common street names / numbers"
- Date: Sat, 4 May 2019 20:28:30 +0000 (UTC)
commit f3becfdfc2fe27996844b0bbb3af37dd6576f9c0
Author: Marcus Lundblad <ml update uu se>
Date: Sat May 4 22:19:44 2019 +0200
Revert "graphHopper: Fold instruction with common street names / numbers"
This reverts commit 4ebdbf6f0867b58af5cffe5c1f84edcbf1ff16ea.
src/graphHopper.js | 35 ++++++-----------------------------
1 file changed, 6 insertions(+), 29 deletions(-)
---
diff --git a/src/graphHopper.js b/src/graphHopper.js
index 5512bda..427419d 100644
--- a/src/graphHopper.js
+++ b/src/graphHopper.js
@@ -228,21 +228,6 @@ var GraphHopper = class GraphHopper {
return [startPoint].concat(rest);
}
- _splitStreetNames(names) {
- return names.split(',').map(n => n.trim());
- }
-
- /**
- * Returns names found in both the arrays names1 and names2
- */
- _namesIntersection(names1, names2) {
- return names1.filter(Set.prototype.has, new Set(names2));
- }
-
- _concatStreetNames(names) {
- return names.join(', ');
- }
-
_foldInstructions(instructions) {
let currInstruction = instructions[0];
let res = [];
@@ -250,30 +235,22 @@ var GraphHopper = class GraphHopper {
for (let i = 1; i < instructions.length; i++) {
let newInstruction = instructions[i];
let newSign = newInstruction.sign;
- let currStreetnames = this._splitStreetNames(currInstruction.street_name);
- let newStreetnames = this._splitStreetNames(newInstruction.street_name);
- let namesIntersect =
- this._namesIntersection(currStreetnames, newStreetnames);
+ let newStreetname = newInstruction.street_name;
/* if the direction is to continue straight, or keep left or keep
- * right on the same subset of street/road numbers, fold the instruction into
+ * right on the same street/road number, fold the instruction into
* the previous one
*/
- if ((newSign === Sign.CONTINUE_ON_STREET ||
- newSign === Sign.KEEP_LEFT || newSign === Sign.KEEP_RIGHT) &&
- namesIntersect.length > 0) {
+ if (newSign === Sign.CONTINUE_ON_STREET ||
+ ((newSign === Sign.KEEP_LEFT || newSign === Sign.KEEP_RIGHT) &&
+ newStreetname === currInstruction.street_name)) {
currInstruction.distance += newInstruction.distance;
- currInstruction.street_name =
- this._concatStreetNames(namesIntersect);
} else {
res.push(currInstruction);
- currInstruction = newInstruction;
+ currInstruction = instructions[i];
}
}
- // push finish instruction
- res.push(instructions[instructions.length - 1]);
-
return res;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]