diff options
author | tatiana-kondakova <tatiana.kondakova@gmail.com> | 2017-09-11 18:44:29 +0300 |
---|---|---|
committer | Ilya Zverev <ilya@zverev.info> | 2017-09-21 11:12:26 +0300 |
commit | e49c0edeaeb16ebbe4e93a9baabca85943279442 (patch) | |
tree | c12ddb45ca75b55a5e3fdd4dc87952e5fba4a720 /routing/route_weight.cpp | |
parent | c4a66b7968f3db6ade11bc1e2409f9dddb398823 (diff) |
Add number of nontransit crossings to RouteWeight, add penality
Diffstat (limited to 'routing/route_weight.cpp')
-rw-r--r-- | routing/route_weight.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/routing/route_weight.cpp b/routing/route_weight.cpp index f962b6d345..a8645f457d 100644 --- a/routing/route_weight.cpp +++ b/routing/route_weight.cpp @@ -1,17 +1,26 @@ #include "routing/route_weight.hpp" +#include "routing/cross_mwm_connector.hpp" + using namespace std; namespace routing { +double RouteWeight::ToCrossMwmWeight() const +{ + if (m_nontransitCross > 0) + return CrossMwmConnector::kNoRoute; + return GetWeight(); +} + ostream & operator<<(ostream & os, RouteWeight const & routeWeight) { - os << routeWeight.GetWeight(); + os << "(" << routeWeight.GetNontransitCross() << ", " << routeWeight.GetWeight() << ")"; return os; } RouteWeight operator*(double lhs, RouteWeight const & rhs) { - return RouteWeight(lhs * rhs.GetWeight()); + return RouteWeight(lhs * rhs.GetWeight(), rhs.GetNontransitCross()); } } // namespace routing |