Removing CalculateEdgeWeights() from transit GraphData.

This commit is contained in:
Vladimir Byko-Ianko 2017-11-08 10:56:43 +03:00 committed by Tatiana Yan
parent 9269549766
commit 1cf8edd5cf
2 changed files with 0 additions and 27 deletions

View file

@ -352,10 +352,6 @@ void GraphData::Sort()
void GraphData::ClipGraph(std::vector<m2::RegionD> 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<m2::RegionD> 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));
}

View file

@ -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<m2::RegionD> 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);