diff --git a/openlr/router.cpp b/openlr/router.cpp index 9152929977..0a80591145 100644 --- a/openlr/router.cpp +++ b/openlr/router.cpp @@ -42,7 +42,7 @@ uint32_t Bearing(m2::PointD const & a, m2::PointD const & b) return base::clamp(angle / kAnglesInBucket, 0.0, 255.0); } -class Score final +class VertexScore final { public: // A weight for total length of true fake edges. @@ -89,7 +89,7 @@ public: double GetPenalty() const { return m_penalty; } double GetScore() const { return m_distance + m_penalty; } - bool operator<(Score const & rhs) const + bool operator<(VertexScore const & rhs) const { auto const ls = GetScore(); auto const rs = rhs.GetScore(); @@ -101,14 +101,14 @@ public: return m_penalty < rhs.m_penalty; } - bool operator>(Score const & rhs) const { return rhs < *this; } + bool operator>(VertexScore const & rhs) const { return rhs < *this; } - bool operator==(Score const & rhs) const + bool operator==(VertexScore const & rhs) const { return m_distance == rhs.m_distance && m_penalty == rhs.m_penalty; } - bool operator!=(Score const & rhs) const { return !(*this == rhs); } + bool operator!=(VertexScore const & rhs) const { return !(*this == rhs); } private: // Reduced length of path in meters. @@ -245,13 +245,13 @@ bool Router::Init(std::vector const & points, double positiveOffsetM, bool Router::FindPath(std::vector & path) { - using State = std::pair; + using State = std::pair; std::priority_queue, greater> queue; - std::map scores; + std::map scores; Links links; - auto pushVertex = [&queue, &scores, &links](Vertex const & u, Vertex const & v, Score const & sv, - Edge const & e) { + auto pushVertex = [&queue, &scores, &links](Vertex const & u, Vertex const & v, + VertexScore const & sv, Edge const & e) { if ((scores.count(v) == 0 || scores[v].GetScore() > sv.GetScore() + kEps) && u != v) { scores[v] = sv; @@ -264,7 +264,7 @@ bool Router::FindPath(std::vector & path) false /* bearingChecked */); CHECK(!NeedToCheckBearing(s, 0 /* distance */), ()); - scores[s] = Score(); + scores[s] = VertexScore(); queue.emplace(scores[s], s); double const piS = GetPotential(s); @@ -274,7 +274,7 @@ bool Router::FindPath(std::vector & path) auto const p = queue.top(); queue.pop(); - Score const & su = p.first; + VertexScore const & su = p.first; Vertex const & u = p.second; if (su != scores[u]) @@ -314,7 +314,7 @@ bool Router::FindPath(std::vector & path) { Vertex v = u; - Score sv = su; + VertexScore sv = su; if (u.m_junction != u.m_stageStart) { int const expected = m_points[stage].m_bearing; @@ -332,7 +332,7 @@ bool Router::FindPath(std::vector & path) false /* bearingChecked */); double const piV = GetPotential(v); - Score sv = su; + VertexScore sv = su; sv.AddDistance(std::max(piV - piU, 0.0)); sv.AddIntermediateErrorPenalty( MercatorBounds::DistanceOnEarth(v.m_junction.GetPoint(), m_points[v.m_stage].m_point)); @@ -353,7 +353,7 @@ bool Router::FindPath(std::vector & path) double const piV = GetPotential(v); - Score sv = su; + VertexScore sv = su; double const w = GetWeight(edge); sv.AddDistance(std::max(w + piV - piU, 0.0));