From 15febd8423abcc4ae48f0e9e4f60f6a228c84b0d Mon Sep 17 00:00:00 2001 From: Sergey Magidovich Date: Thu, 24 Sep 2015 10:50:32 +0300 Subject: [PATCH] Fix style and two warnings. --- routing/osrm_router.cpp | 24 ++++++++++++------------ routing/router.hpp | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/routing/osrm_router.cpp b/routing/osrm_router.cpp index 0d6249d53e..82c462b6d7 100644 --- a/routing/osrm_router.cpp +++ b/routing/osrm_router.cpp @@ -497,7 +497,7 @@ OsrmRouter::ResultCode OsrmRouter::MakeRouteFromCrossesPath(TCheckedPath const & vector mwmPoints; MakeTurnAnnotation(routingResult, mwmMapping, delegate, mwmPoints, mwmTurnsDir, mwmTimes); // Connect annotated route. - const uint32_t pSize = static_cast(Points.size()); + auto const pSize = static_cast(Points.size()); for (auto turn : mwmTurnsDir) { if (turn.m_index == 0) @@ -705,17 +705,17 @@ OsrmRouter::ResultCode OsrmRouter::MakeTurnAnnotation( // Get all the coordinates for the computed route size_t const n = segment.size(); - for (size_t j = 0; j < n; ++j) + for (size_t j = 0; j < n; ++j) // todo(mgsergio) rename! { RawPathData const & path_data = segment[j]; if (j > 0 && !points.empty()) { - turns::TurnItem t; - t.m_index = static_cast(points.size() - 1); + turns::TurnItem turnItem; + turnItem.m_index = static_cast(points.size() - 1); turns::TurnInfo turnInfo(*mapping, segment[j - 1].node, segment[j].node); - turns::GetTurnDirection(*m_pIndex, turnInfo, t); + turns::GetTurnDirection(*m_pIndex, turnInfo, turnItem); // ETA information. // Osrm multiples seconds to 10, so we need to divide it back. @@ -726,19 +726,19 @@ OsrmRouter::ResultCode OsrmRouter::MakeTurnAnnotation( for (size_t k = lastIdx + 1; k < points.size(); ++k) distMeters += MercatorBounds::DistanceOnEarth(points[k - 1], points[k]); LOG(LDEBUG, ("Speed:", 3.6 * distMeters / nodeTimeSeconds, "kmph; Dist:", distMeters, "Time:", - nodeTimeSeconds, "s", lastIdx, "e", points.size(), "source:", t.m_sourceName, - "target:", t.m_targetName)); + nodeTimeSeconds, "s", lastIdx, "e", points.size(), "source:", turnItem.m_sourceName, + "target:", turnItem.m_targetName)); lastIdx = points.size(); #endif estimatedTime += nodeTimeSeconds; times.push_back(Route::TTimeItem(points.size(), estimatedTime)); // Lane information. - if (t.m_turn != turns::TurnDirection::NoTurn) + if (turnItem.m_turn != turns::TurnDirection::NoTurn) { - t.m_lanes = turns::GetLanesInfo(segment[j - 1].node, + turnItem.m_lanes = turns::GetLanesInfo(segment[j - 1].node, *mapping, turns::GetLastSegmentPointIndex, *m_pIndex); - turnsDir.push_back(move(t)); + turnsDir.push_back(move(turnItem)); } } @@ -769,7 +769,7 @@ OsrmRouter::ResultCode OsrmRouter::MakeTurnAnnotation( } if (j == n - 1) { - if (!segEnd.IsValid()) + if (!segEnd.IsValid()) continue; endK = FindIntersectingSeg(segEnd) + 1; } @@ -827,7 +827,7 @@ OsrmRouter::ResultCode OsrmRouter::MakeTurnAnnotation( if (routingResult.targetEdge.segment.IsValid()) { turnsDir.push_back( - turns::TurnItem(static_cast(points.size() - 1), turns::TurnDirection::ReachedYourDestination)); + turns::TurnItem(static_cast(points.size()) - 1, turns::TurnDirection::ReachedYourDestination)); } turns::FixupTurns(points, turnsDir); diff --git a/routing/router.hpp b/routing/router.hpp index c5dcf0a467..bd46b60400 100644 --- a/routing/router.hpp +++ b/routing/router.hpp @@ -17,7 +17,7 @@ using TCountryFileFn = function; class Route; /// Routing engine type. -enum RouterType +enum class RouterType { Vehicle = 0, /// For OSRM vehicle routing Pedestrian /// For A star pedestrian routing @@ -31,7 +31,7 @@ public: /// Routing possible statuses enumeration. /// \warning this enum has JNI mirror! /// \see android/src/com/mapswithme/maps/data/RoutingResultCodesProcessor.java - enum ResultCode + enum ResultCode // TODO(mgsergio) enum class { NoError = 0, Cancelled = 1,