diff --git a/routing/edge_estimator.cpp b/routing/edge_estimator.cpp index be1c06eb84..354b1283d1 100644 --- a/routing/edge_estimator.cpp +++ b/routing/edge_estimator.cpp @@ -27,7 +27,7 @@ double constexpr kKMPH2MPS = 1000.0 / (60 * 60); inline double TimeBetweenSec(m2::PointD const & from, m2::PointD const & to, double speedMPS) { - ASSERT_GREATER(speedMPS, 0.0, ()); + CHECK_GREATER(speedMPS, 0.0, ()); double const distanceM = MercatorBounds::DistanceOnEarth(from, to); return distanceM / speedMPS; diff --git a/routing/geometry.cpp b/routing/geometry.cpp index 6ffb2534fa..417a0ba083 100644 --- a/routing/geometry.cpp +++ b/routing/geometry.cpp @@ -51,16 +51,14 @@ namespace routing { // RoadGeometry ------------------------------------------------------------------------------------ RoadGeometry::RoadGeometry(bool oneWay, double speed, Points const & points) - : m_points(points), m_speed(speed), m_isOneWay(oneWay) + : m_points(points), m_speed(speed), m_isOneWay(oneWay), m_valid(true) { ASSERT_GREATER(speed, 0.0, ()); } void RoadGeometry::Load(IVehicleModel const & vehicleModel, FeatureType const & feature) { - if (!vehicleModel.IsRoad(feature)) - return; - + m_valid = vehicleModel.IsRoad(feature); m_isOneWay = vehicleModel.IsOneWay(feature); m_speed = vehicleModel.GetSpeed(feature); diff --git a/routing/geometry.hpp b/routing/geometry.hpp index dce2280cc9..c172f4cf88 100644 --- a/routing/geometry.hpp +++ b/routing/geometry.hpp @@ -35,10 +35,18 @@ public: } uint32_t GetPointsCount() const { return static_cast(m_points.size()); } + + // Note. It's possible that car_model was changed after the map was built. + // For example, the map from 12.2016 contained highway=pedestrian + // in car_model but this type of highways is removed as of 01.2017. + // In such cases RoadGeometry is not valid. + bool IsValid() const { return m_valid; } + private: Points m_points; double m_speed = 0.0; bool m_isOneWay = false; + bool m_valid = false; }; class GeometryLoader diff --git a/routing/index_graph.cpp b/routing/index_graph.cpp index aa02358918..f2b4eef17c 100644 --- a/routing/index_graph.cpp +++ b/routing/index_graph.cpp @@ -49,10 +49,7 @@ void IndexGraph::GetNeighboringEdges(Segment const & from, RoadPoint const & rp, { RoadGeometry const & road = m_geometry.GetRoad(rp.GetFeatureId()); - // Note. It's possible that it's used a map which is built with car_model different from - // car_model in current sources. For example, the map from 12.2016 contained highway==pedestrian - // in car_model but now this type of highways is removed. In such cases |road| has no points. - if (road.GetPointsCount() == 0) + if (!road.IsValid()) return; bool const bidirectional = !road.IsOneWay();