diff --git a/routing/edge_estimator.hpp b/routing/edge_estimator.hpp index af8883f694..def69fa598 100644 --- a/routing/edge_estimator.hpp +++ b/routing/edge_estimator.hpp @@ -24,11 +24,13 @@ public: virtual double CalcSegmentWeight(Segment const & segment, RoadGeometry const & road) const = 0; virtual double CalcHeuristic(m2::PointD const & from, m2::PointD const & to) const = 0; - // Returns time in seconds is taken for going from point |from| to point |to| along a leap (fake) + // Returns time in seconds it takes to go from point |from| to point |to| along a leap (fake) // edge |from|-|to|. // Note 1. The result of the method should be used if it's necessary to add a leap (fake) edge - // (|form|, |to|) in road graph. + // (|from|, |to|) in road graph. // Note 2. The result of the method should be less or equal to CalcHeuristic(|form|, |to|). + // Note 3. It's assumed here that GetEstimator().CalcLeapWeight(p1, p2) == + // GetEstimator().CalcLeapWeight(p2, p1). virtual double CalcLeapWeight(m2::PointD const & from, m2::PointD const & to) const = 0; virtual double GetUTurnPenalty() const = 0; // The leap is the shortcut edge from mwm border enter to exit. diff --git a/routing/index_graph_starter.cpp b/routing/index_graph_starter.cpp index 35b6eb5a3a..778a4fb93c 100644 --- a/routing/index_graph_starter.cpp +++ b/routing/index_graph_starter.cpp @@ -102,8 +102,6 @@ void IndexGraphStarter::GetNormalToFakeEdge(Segment const & segment, FakeVertex if (segment.GetMwmId() == fakeVertex.GetMwmId() && m_graph.GetMode() == WorldGraph::Mode::LeapsOnly) { - // It's assumed here that GetEstimator().CalcLeapWeight(p1, p2) == - // GetEstimator().CalcLeapWeight(p2, p1). if (m_graph.IsTransition(segment, isOutgoing)) { edges.emplace_back(fakeSegment, @@ -131,8 +129,6 @@ void IndexGraphStarter::ConnectLeapToTransitions(FakeVertex const & fakeVertex, // finish mwm should be connected with the finish point. So |isEnter| below should be set to true. m_graph.ForEachTransition( fakeVertex.GetMwmId(), !isOutgoing /* isEnter */, [&](Segment const & transition) { - // It's assumed here that GetEstimator().CalcLeapWeight(p1, p2) == - // GetEstimator().CalcLeapWeight(p2, p1). edges.emplace_back(transition, m_graph.GetEstimator().CalcLeapWeight( segmentPoint, GetPoint(transition, isOutgoing))); }); diff --git a/routing/world_graph.cpp b/routing/world_graph.cpp index 1db7e2a160..248ddafec1 100644 --- a/routing/world_graph.cpp +++ b/routing/world_graph.cpp @@ -69,6 +69,7 @@ string DebugPrint(WorldGraph::Mode mode) case WorldGraph::Mode::LeapsIfPossible: return "LeapsIfPossible"; case WorldGraph::Mode::NoLeaps: return "NoLeaps"; } + ASSERT(false, ("Unknown mode:", static_cast(mode))); return "Unknown mode"; } } // namespace routing diff --git a/routing/world_graph.hpp b/routing/world_graph.hpp index e0c7c067ba..76160c25c8 100644 --- a/routing/world_graph.hpp +++ b/routing/world_graph.hpp @@ -20,10 +20,10 @@ public: enum class Mode { SingleMwm, // Mode for building a route within single mwm. - LeapsOnly, // Mode for building a cross mwm route contains of only leaps. In case of start and + LeapsOnly, // Mode for building a cross mwm route containing only leaps. In case of start and // finish they (start and finish) will be connected with all transition segments of // their mwm with leap (fake) edges. - LeapsIfPossible, // Mode for build cross mwm and single mwm routes. In case of cross mwm route + LeapsIfPossible, // Mode for building cross mwm and single mwm routes. In case of cross mwm route // if they are neighboring mwms the route will be made without leaps. // If not the route is made with leaps for intermediate mwms. NoLeaps, // Mode for building route and getting outgoing/ingoing edges without leaps anyway. @@ -45,6 +45,7 @@ public: void ClearIndexGraphs() { m_loader->Clear(); } void SetMode(Mode mode) { m_mode = mode; } Mode GetMode() const { return m_mode; } + template void ForEachTransition(NumMwmId numMwmId, bool isEnter, Fn && fn) {