diff options
Diffstat (limited to 'routing')
-rw-r--r-- | routing/features_road_graph.cpp | 24 | ||||
-rw-r--r-- | routing/features_road_graph.hpp | 2 | ||||
-rw-r--r-- | routing/routing_algorithm.cpp | 10 |
3 files changed, 15 insertions, 21 deletions
diff --git a/routing/features_road_graph.cpp b/routing/features_road_graph.cpp index df7f85c325..eee98a85ee 100644 --- a/routing/features_road_graph.cpp +++ b/routing/features_road_graph.cpp @@ -275,25 +275,23 @@ void FeaturesRoadGraph::ExtractRoadInfo(FeatureID const & featureId, FeatureType size_t const pointsCount = ft.GetPointsCount(); feature::TAltitudes altitudes; - if (value.HasAltitudeLoader()) + if (value.m_altitudeLoader) { altitudes = value.m_altitudeLoader->GetAltitudes(featureId.m_index, ft.GetPointsCount()); - if (altitudes.size() != pointsCount) - { - ASSERT(false, ("altitudes.size() is different from ft.GetPointsCount()")); - altitudes.clear(); - } } + else + { + ASSERT(false, ()); + altitudes = feature::TAltitudes(ft.GetPointsCount(), feature::kDefautlAltitudeMeters); + } + + CHECK_EQUAL(altitudes.size(), pointsCount, + ("altitudeLoader->GetAltitudes(", featureId.m_index, "...) returns wrong alititudes:", + altitudes)); - ri.m_junctions.clear(); ri.m_junctions.resize(pointsCount); for (size_t i = 0; i < pointsCount; ++i) - { - if (altitudes.empty()) - ri.m_junctions[i] = Junction(ft.GetPoint(i), feature::kInvalidAltitude); - else - ri.m_junctions[i] = Junction(ft.GetPoint(i), altitudes[i]); - } + ri.m_junctions[i] = Junction(ft.GetPoint(i), altitudes[i]); } IRoadGraph::RoadInfo const & FeaturesRoadGraph::GetCachedRoadInfo(FeatureID const & featureId) const diff --git a/routing/features_road_graph.hpp b/routing/features_road_graph.hpp index d160f941e4..59309e7bfb 100644 --- a/routing/features_road_graph.hpp +++ b/routing/features_road_graph.hpp @@ -86,8 +86,6 @@ private: bool IsAlive() const { return m_mwmHandle.IsAlive(); } - bool HasAltitudeLoader() const { return m_altitudeLoader && m_altitudeLoader->HasAltitudes(); } - MwmSet::MwmHandle m_mwmHandle; unique_ptr<feature::AltitudeLoader> m_altitudeLoader; }; diff --git a/routing/routing_algorithm.cpp b/routing/routing_algorithm.cpp index 3495ef8b02..773bd38be3 100644 --- a/routing/routing_algorithm.cpp +++ b/routing/routing_algorithm.cpp @@ -19,13 +19,11 @@ double constexpr KMPH2MPS = 1000.0 / (60 * 60); inline double TimeBetweenSec(Junction const & j1, Junction const & j2, double speedMPS) { ASSERT(speedMPS > 0.0, ()); - double const distanceM = MercatorBounds::DistanceOnEarth(j1.GetPoint(), j2.GetPoint()); - feature::TAltitude const j1Altitude = j1.GetAltitude(); - feature::TAltitude const j2Altitude = j2.GetAltitude(); - if (j1Altitude == feature::kInvalidAltitude || j2Altitude == feature::kInvalidAltitude) - return distanceM / speedMPS; + ASSERT_NOT_EQUAL(j1.GetAltitude(), feature::kInvalidAltitude, ()); + ASSERT_NOT_EQUAL(j2.GetAltitude(), feature::kInvalidAltitude, ()); - feature::TAltitude const altidudeDiffM = j2Altitude - j1Altitude; + double const distanceM = MercatorBounds::DistanceOnEarth(j1.GetPoint(), j2.GetPoint()); + feature::TAltitude const altidudeDiffM = j2.GetAltitude() - j1.GetAltitude(); return sqrt(distanceM * distanceM + altidudeDiffM * altidudeDiffM) / speedMPS; } |