From 1487b01d043ff96ecebe56929b8222734a543da8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BE=D0=B1=D1=80=D1=8B=D0=B8=CC=86=20=D0=AD=D1=8D?= =?UTF-8?q?=D1=85?= Date: Tue, 17 Jan 2017 17:20:15 +0300 Subject: [PATCH] [routing] fix ferry routes --- routing/edge_estimator.cpp | 3 ++- routing/geometry.cpp | 11 +++++++++++ routing/vehicle_model.cpp | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/routing/edge_estimator.cpp b/routing/edge_estimator.cpp index 31bbe0107a..0257de25bd 100644 --- a/routing/edge_estimator.cpp +++ b/routing/edge_estimator.cpp @@ -27,7 +27,8 @@ double constexpr kKMPH2MPS = 1000.0 / (60 * 60); inline double TimeBetweenSec(m2::PointD const & from, m2::PointD const & to, double speedMPS) { - CHECK_GREATER(speedMPS, 0.0, ()); + CHECK_GREATER(speedMPS, 0.0, + ("from:", MercatorBounds::ToLatLon(from), "to:", MercatorBounds::ToLatLon(to))); double const distanceM = MercatorBounds::DistanceOnEarth(from, to); return distanceM / speedMPS; diff --git a/routing/geometry.cpp b/routing/geometry.cpp index 417a0ba083..0b65626c5b 100644 --- a/routing/geometry.cpp +++ b/routing/geometry.cpp @@ -66,6 +66,17 @@ void RoadGeometry::Load(IVehicleModel const & vehicleModel, FeatureType const & m_points.reserve(feature.GetPointsCount()); for (size_t i = 0; i < feature.GetPointsCount(); ++i) m_points.emplace_back(feature.GetPoint(i)); + + if (m_valid && m_speed <= 0.0) + { + auto const & id = feature.GetID(); + CHECK(!m_points.empty(), ("mwm:", id.GetMwmName(), ", featureId:", id.m_index)); + auto const begin = MercatorBounds::ToLatLon(m_points.front()); + auto const end = MercatorBounds::ToLatLon(m_points.back()); + LOG(LERROR, ("Invalid speed", m_speed, "mwm:", id.GetMwmName(), ", featureId:", id.m_index, + ", begin:", begin, "end:", end)); + m_valid = false; + } } // Geometry ---------------------------------------------------------------------------------------- diff --git a/routing/vehicle_model.cpp b/routing/vehicle_model.cpp index 9176375b34..c44496e5bb 100644 --- a/routing/vehicle_model.cpp +++ b/routing/vehicle_model.cpp @@ -62,7 +62,7 @@ double VehicleModel::GetMinTypeSpeed(feature::TypesHolder const & types) const if (it != m_types.end()) speed = min(speed, it->second); - auto const addRoadInfoIter = FindRoadType(type); + auto const addRoadInfoIter = FindRoadType(t); if (addRoadInfoIter != m_addRoadTypes.cend()) speed = min(speed, addRoadInfoIter->m_speedKMpH); }