Enable transit line penalties also when no explicit line was given

Currently, if no transit line is given, all edges get penalty factor 0
regardless of whether there are transit lines following the edge or not.
The change introduced in this commit will give penalty factor 0 if there
is at least one transit line following the edge and penalty factor 1 if
there are no tranist lines at all following the edge.
Behavior in the case when a transit line is given is untouched.

This should improve routing results by preferring edges with
associated transit lines. This used to be the behaviour before
some refactoring. Maybe it was broken unintentionally.
This commit is contained in:
Alexander Held | geOps 2020-09-29 11:23:41 +02:00
parent 69dc466605
commit f813c1f842

View file

@ -108,7 +108,7 @@ EdgeCost CostFunc::operator()(const trgraph::Edge* from, const trgraph::Node* n,
// _____________________________________________________________________________
double CostFunc::transitLineCmp(const trgraph::EdgePL& e) const {
if (_rAttrs.shortName.empty() && _rAttrs.toString.empty() &&
_rAttrs.fromString.empty())
_rAttrs.fromString.empty() && !e.getLines().empty())
return 0;
double best = 1;
for (const auto* l : e.getLines()) {