diff --git a/defines.hpp b/defines.hpp index 9058753286..a27eedcbab 100644 --- a/defines.hpp +++ b/defines.hpp @@ -27,10 +27,6 @@ #define ROUTING_FTSEG_FILE_TAG "ftseg" #define ROUTING_NODEIND_TO_FTSEGIND_FILE_TAG "node2ftseg" -// Secret word to unlock experimental features in production builds. -#define ROUTING_SECRET_UNLOCKING_WORD "?pedestrian" -#define ROUTING_SECRET_LOCKING_WORD "?vehicle" - // Switch to a development osrm server for online checking of the absent contries. #ifdef DEV_OSRM_SERVER #define OSRM_ONLINE_SERVER_URL "http://osrm.online.dev.server" diff --git a/map/framework.cpp b/map/framework.cpp index 8817399de7..f2fd215edd 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -255,11 +255,8 @@ Framework::Framework() m_storage.Init(bind(&Framework::UpdateLatestCountryFile, this, _1)); LOG(LDEBUG, ("Storage initialized")); -#ifdef USE_PEDESTRIAN_ROUTER - SetRouter(RouterType::Pedestrian); -#else - SetRouter(RouterType::Vehicle); -#endif + SetRouterImpl(RouterType::Vehicle); + LOG(LDEBUG, ("Routing engine initialized")); LOG(LINFO, ("System languages:", languages::GetPreferred())); @@ -1274,19 +1271,6 @@ void Framework::PrepareSearch() bool Framework::Search(search::SearchParams const & params) { - if (params.m_query == ROUTING_SECRET_UNLOCKING_WORD) - { - LOG(LINFO, ("Pedestrian routing mode enabled")); - SetRouter(RouterType::Pedestrian); - return false; - } - if (params.m_query == ROUTING_SECRET_LOCKING_WORD) - { - LOG(LINFO, ("Vehicle routing mode enabled")); - SetRouter(RouterType::Vehicle); - return false; - } - #ifdef FIXED_LOCATION search::SearchParams rParams(params); if (params.IsValidPosition()) @@ -2138,6 +2122,18 @@ void Framework::BuildRoute(m2::PointD const & destination, uint32_t timeoutSec) } void Framework::SetRouter(RouterType type) +{ + if (m_currentRouterType == type) + return; + SetRouterImpl(type); +} + +routing::RouterType Framework::GetRouter() const +{ + return m_currentRouterType; +} + +void Framework::SetRouterImpl(RouterType type) { #ifdef DEBUG TRoutingVisualizerFn const routingVisualizerFn = [this](m2::PointD const & pt) diff --git a/map/framework.hpp b/map/framework.hpp index bd8cfc3664..7748d3a1af 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -556,6 +556,8 @@ public: public: /// @name Routing mode //@{ + void SetRouter(routing::RouterType type); + routing::RouterType GetRouter() const; bool IsRoutingActive() const { return m_routingSession.IsActive(); } bool IsRouteBuilt() const { return m_routingSession.IsBuilt(); } bool IsRouteBuilding() const { return m_routingSession.IsBuilding(); } @@ -581,7 +583,7 @@ public: } private: - void SetRouter(routing::RouterType type); + void SetRouterImpl(routing::RouterType type); void RemoveRoute(); void InsertRoute(routing::Route const & route); void CheckLocationForRouting(location::GpsInfo const & info); diff --git a/routing/router.hpp b/routing/router.hpp index c88d41e7e6..a6dd54bf88 100644 --- a/routing/router.hpp +++ b/routing/router.hpp @@ -15,8 +15,8 @@ class Route; /// Routing engine type. enum RouterType { - Vehicle, /// For OSRM vehicle routing - Pedestrian /// For A star pedestrian routing + Vehicle = 0, /// For OSRM vehicle routing + Pedestrian /// For A star pedestrian routing }; class IRouter : public my::Cancellable