forked from organicmaps/organicmaps-tmp
Route builded callback receives new code RouterResultCode::HasWarnings.
This commit is contained in:
parent
58f043b766
commit
c1788f19e6
8 changed files with 25 additions and 10 deletions
|
@ -30,6 +30,7 @@ class ResultCodesHelper
|
|||
private static final int TRANSIT_ROUTE_NOT_FOUND_NO_NETWORK = 13;
|
||||
private static final int TRANSIT_ROUTE_NOT_FOUND_TOO_LONG_PEDESTRIAN = 14;
|
||||
private static final int ROUTE_NOT_FOUND_REDRESS_ROUTE_ERROR = 15;
|
||||
static final int HAS_WARNINGS = 16;
|
||||
|
||||
static Pair<String, String> getDialogTitleSubtitle(int errorCode, int missingCount)
|
||||
{
|
||||
|
|
|
@ -128,6 +128,7 @@ public class RoutingController implements TaxiManager.TaxiListener
|
|||
mContainsCachedResult = true;
|
||||
|
||||
if (mLastResultCode == ResultCodesHelper.NO_ERROR
|
||||
|| mLastResultCode == ResultCodesHelper.HAS_WARNINGS
|
||||
|| ResultCodesHelper.isMoreMapsNeeded(mLastResultCode))
|
||||
{
|
||||
mCachedRoutingInfo = Framework.nativeGetRouteFollowingInfo();
|
||||
|
@ -183,7 +184,7 @@ public class RoutingController implements TaxiManager.TaxiListener
|
|||
|
||||
mContainsCachedResult = false;
|
||||
|
||||
if (mLastResultCode == ResultCodesHelper.NO_ERROR)
|
||||
if (mLastResultCode == ResultCodesHelper.NO_ERROR || mLastResultCode == ResultCodesHelper.HAS_WARNINGS)
|
||||
{
|
||||
updatePlan();
|
||||
return;
|
||||
|
|
|
@ -81,6 +81,7 @@
|
|||
case routing::RouterResultCode::InternalError: return [MWMDefaultAlert internalRoutingErrorAlert];
|
||||
case routing::RouterResultCode::Cancelled:
|
||||
case routing::RouterResultCode::NoError:
|
||||
case routing::RouterResultCode::HasWarnings:
|
||||
case routing::RouterResultCode::NeedMoreMaps: return nil;
|
||||
case routing::RouterResultCode::IntermediatePointNotFound: return [MWMDefaultAlert intermediatePointNotFoundAlert];
|
||||
}
|
||||
|
|
|
@ -627,6 +627,7 @@ void logPointEvent(MWMRoutePoint * point, NSString * eventType)
|
|||
switch (code)
|
||||
{
|
||||
case routing::RouterResultCode::NoError:
|
||||
case routing::RouterResultCode::HasWarnings:
|
||||
{
|
||||
GetFramework().DeactivateMapSelection(true);
|
||||
|
||||
|
|
|
@ -362,7 +362,7 @@ void RoutingManager::OnBuildRouteReady(Route const & route, RouterResultCode cod
|
|||
CHECK_EQUAL(code, RouterResultCode::NoError, ());
|
||||
HidePreviewSegments();
|
||||
|
||||
InsertRoute(route);
|
||||
auto const hasWarnings = InsertRoute(route);
|
||||
m_drapeEngine.SafeCall(&df::DrapeEngine::StopLocationFollow);
|
||||
|
||||
// Validate route (in case of bicycle routing it can be invalid).
|
||||
|
@ -375,7 +375,7 @@ void RoutingManager::OnBuildRouteReady(Route const & route, RouterResultCode cod
|
|||
true /* applyRotation */, -1 /* zoom */, true /* isAnim */);
|
||||
}
|
||||
|
||||
CallRouteBuilded(code, storage::CountriesVec());
|
||||
CallRouteBuilded(hasWarnings ? RouterResultCode::HasWarnings : code, storage::CountriesVec());
|
||||
}
|
||||
|
||||
void RoutingManager::OnRebuildRouteReady(Route const & route, RouterResultCode code)
|
||||
|
@ -385,8 +385,8 @@ void RoutingManager::OnRebuildRouteReady(Route const & route, RouterResultCode c
|
|||
if (code != RouterResultCode::NoError)
|
||||
return;
|
||||
|
||||
InsertRoute(route);
|
||||
CallRouteBuilded(code, storage::CountriesVec());
|
||||
auto const hasWarnings = InsertRoute(route);
|
||||
CallRouteBuilded(hasWarnings ? RouterResultCode::HasWarnings : code, storage::CountriesVec());
|
||||
}
|
||||
|
||||
void RoutingManager::OnNeedMoreMaps(uint64_t routeId, vector<string> const & absentCountries)
|
||||
|
@ -596,10 +596,10 @@ void RoutingManager::CreateRoadWarningMarks(RoadWarningsCollection && roadWarnin
|
|||
});
|
||||
}
|
||||
|
||||
void RoutingManager::InsertRoute(Route const & route)
|
||||
bool RoutingManager::InsertRoute(Route const & route)
|
||||
{
|
||||
if (!m_drapeEngine)
|
||||
return;
|
||||
return false;
|
||||
|
||||
// TODO: Now we always update whole route, so we need to remove previous one.
|
||||
RemoveRoute(false /* deactivateFollowing */);
|
||||
|
@ -644,7 +644,8 @@ void RoutingManager::InsertRoute(Route const & route)
|
|||
subroute->AddStyle(df::SubrouteStyle(df::kRouteColor, df::kRouteOutlineColor));
|
||||
FillTrafficForRendering(segments, subroute->m_traffic);
|
||||
FillTurnsDistancesForRendering(segments, subroute->m_baseDistance, subroute->m_turns);
|
||||
CollectRoadWarnings(segments, startPt, subroute->m_baseDistance, getMwmId, roadWarnings);
|
||||
if (m_currentRouterType == RouterType::Vehicle)
|
||||
CollectRoadWarnings(segments, startPt, subroute->m_baseDistance, getMwmId, roadWarnings);
|
||||
break;
|
||||
}
|
||||
case RouterType::Transit:
|
||||
|
@ -692,7 +693,12 @@ void RoutingManager::InsertRoute(Route const & route)
|
|||
});
|
||||
}
|
||||
|
||||
CreateRoadWarningMarks(std::move(roadWarnings));
|
||||
if (!roadWarnings.empty())
|
||||
{
|
||||
CreateRoadWarningMarks(std::move(roadWarnings));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void RoutingManager::FollowRoute()
|
||||
|
|
|
@ -291,7 +291,7 @@ public:
|
|||
void CancelPreviewMode();
|
||||
|
||||
private:
|
||||
void InsertRoute(routing::Route const & route);
|
||||
bool InsertRoute(routing::Route const & route);
|
||||
|
||||
struct RoadInfo
|
||||
{
|
||||
|
|
|
@ -291,6 +291,9 @@ void AsyncRouter::LogCode(RouterResultCode code, double const elapsedSec)
|
|||
case RouterResultCode::RouteNotFoundRedressRouteError:
|
||||
LOG(LWARNING, ("Route not found because of a redress route error"));
|
||||
break;
|
||||
case RouterResultCode::HasWarnings:
|
||||
LOG(LINFO, ("Route has warnings, elapsed seconds:", elapsedSec));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ enum class RouterResultCode
|
|||
TransitRouteNotFoundNoNetwork = 13,
|
||||
TransitRouteNotFoundTooLongPedestrian = 14,
|
||||
RouteNotFoundRedressRouteError = 15,
|
||||
HasWarnings = 16,
|
||||
};
|
||||
|
||||
using CheckpointCallback = std::function<void(size_t passedCheckpointIdx)>;
|
||||
|
@ -71,6 +72,7 @@ inline std::string DebugPrint(RouterResultCode code)
|
|||
case RouterResultCode::TransitRouteNotFoundNoNetwork: return "TransitRouteNotFoundNoNetwork";
|
||||
case RouterResultCode::TransitRouteNotFoundTooLongPedestrian: return "TransitRouteNotFoundTooLongPedestrian";
|
||||
case RouterResultCode::RouteNotFoundRedressRouteError: return "RouteNotFoundRedressRouteError";
|
||||
case RouterResultCode::HasWarnings: return "HasWarnings";
|
||||
}
|
||||
|
||||
std::string const result = "Unknown RouterResultCode: " + std::to_string(static_cast<int>(code));
|
||||
|
|
Loading…
Add table
Reference in a new issue