Fix color coding by cost. Closes #340. This makes sure it is relative to the length of the path.
This commit is contained in:
parent
652de90c06
commit
7c02d78f0b
2 changed files with 9 additions and 7 deletions
|
|
@ -70,13 +70,14 @@ BR.RoutingPathQuality = L.Control.extend({
|
||||||
},
|
},
|
||||||
valueFunction: function(latLng) {
|
valueFunction: function(latLng) {
|
||||||
var feature = latLng.feature;
|
var feature = latLng.feature;
|
||||||
return (
|
var cost = feature.cost.perKm;
|
||||||
feature.cost.perKm +
|
var distance = feature.distance / 1000; // in km
|
||||||
feature.cost.elev +
|
if (distance > 0) {
|
||||||
feature.cost.turn +
|
cost +=
|
||||||
feature.cost.node +
|
(feature.cost.elev + feature.cost.turn + feature.cost.node + feature.cost.initial) /
|
||||||
feature.cost.initial
|
distance;
|
||||||
);
|
}
|
||||||
|
return cost;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -236,6 +236,7 @@ L.BRouter = L.Class.extend({
|
||||||
node: parseInt(featureMessage[7]),
|
node: parseInt(featureMessage[7]),
|
||||||
initial: parseInt(featureMessage[8])
|
initial: parseInt(featureMessage[8])
|
||||||
},
|
},
|
||||||
|
distance: parseInt(featureMessage[3]),
|
||||||
wayTags: featureMessage[9],
|
wayTags: featureMessage[9],
|
||||||
nodeTags: featureMessage[10]
|
nodeTags: featureMessage[10]
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue