From 1cf8edd5cfc2611e21e6c37a0731d7dcc31d08e6 Mon Sep 17 00:00:00 2001 From: Vladimir Byko-Ianko Date: Wed, 8 Nov 2017 10:56:43 +0300 Subject: [PATCH] Removing CalculateEdgeWeights() from transit GraphData. --- generator/transit_generator.cpp | 23 ----------------------- generator/transit_generator.hpp | 4 ---- 2 files changed, 27 deletions(-) diff --git a/generator/transit_generator.cpp b/generator/transit_generator.cpp index aca77671a4..fb75656320 100644 --- a/generator/transit_generator.cpp +++ b/generator/transit_generator.cpp @@ -352,10 +352,6 @@ void GraphData::Sort() void GraphData::ClipGraph(std::vector const & borders) { Sort(); - // @todo(bykoianko) Edge weight should be calculated on transit graph preparation stage. - // When it's done it'll be checked at Edge::IsValid() and the call of |CalculateEdgeWeights();| - // will be removed. - CalculateEdgeWeights(); CHECK(IsValid(), ()); ClipLines(borders); @@ -369,21 +365,6 @@ void GraphData::ClipGraph(std::vector const & borders) ClipShapes(); } -void GraphData::CalculateEdgeWeights() -{ - CHECK(is_sorted(m_stops.cbegin(), m_stops.cend()), ()); - for (auto & e : m_edges) - { - if (e.GetWeight() != kInvalidWeight) - continue; - - Stop const & s1 = FindById(m_stops, e.GetStop1Id()); - Stop const & s2 = FindById(m_stops, e.GetStop2Id()); - double const lengthInMeters = MercatorBounds::DistanceOnEarth(s1.GetPoint(), s2.GetPoint()); - e.SetWeight(lengthInMeters / kTransitAverageSpeedMPS); - } -} - void GraphData::CalculateBestPedestrianSegments(string const & mwmPath, string const & countryId) { // Creating IndexRouter. @@ -635,10 +616,6 @@ void ProcessGraph(string const & mwmPath, string const & countryId, { data.CalculateBestPedestrianSegments(mwmPath, countryId); data.Sort(); - // @todo(bykoianko) Edge weight should be calculated on transit graph preparation stage. - // When it's done it'll be checked at Edge::IsValid() and the call of |data.CalculateEdgeWeights();| - // will be removed. - data.CalculateEdgeWeights(); CHECK(data.IsValid(), (mwmPath)); } diff --git a/generator/transit_generator.hpp b/generator/transit_generator.hpp index 442a271424..955bf9cc36 100644 --- a/generator/transit_generator.hpp +++ b/generator/transit_generator.hpp @@ -123,10 +123,6 @@ public: /// \note Before call of the method every line in |m_stopIds| should contain |m_stopIds| /// with only one stop range. void ClipGraph(std::vector const & borders); - /// \brief Calculates and updates |m_edges| by adding valid value for Edge::m_weight - /// if it's not valid. - /// \note |m_stops|, Edge::m_stop1Id and Edge::m_stop2Id in |m_edges| must be valid before call. - void CalculateEdgeWeights(); /// \brief Calculates best pedestrian segment for every gate in |m_gates|. /// \note All gates in |m_gates| must have a valid |m_point| field before the call. void CalculateBestPedestrianSegments(std::string const & mwmPath, std::string const & countryId);