forked from organicmaps/organicmaps
[core] new state of routing session. Not active state
This commit is contained in:
parent
e5ec6f4f50
commit
18d5ec3a62
2 changed files with 7 additions and 3 deletions
|
@ -7,7 +7,7 @@ namespace routing
|
|||
RoutingSession::RoutingSession()
|
||||
: m_router(nullptr)
|
||||
, m_route(string())
|
||||
, m_state(RouteNotReady)
|
||||
, m_state(RoutingNotActive)
|
||||
, m_lastMinDist(0.0)
|
||||
{
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ void RoutingSession::RebuildRoute(m2::PointD const & startPoint, IRouter::ReadyC
|
|||
{
|
||||
ASSERT(m_router != nullptr, ());
|
||||
Reset();
|
||||
m_state = RouteNotReady;
|
||||
|
||||
m2::RectD const errorRect = MercatorBounds::RectByCenterXYAndSizeInMeters(startPoint, 20);
|
||||
m_tolerance = (errorRect.SizeX() + errorRect.SizeY()) / 2.0;
|
||||
|
@ -41,12 +42,12 @@ void RoutingSession::RebuildRoute(m2::PointD const & startPoint, IRouter::ReadyC
|
|||
|
||||
bool RoutingSession::IsActive() const
|
||||
{
|
||||
return m_state != RouteNotReady;
|
||||
return m_state != RoutingNotActive;
|
||||
}
|
||||
|
||||
void RoutingSession::Reset()
|
||||
{
|
||||
m_state = RouteNotReady;
|
||||
m_state = RoutingNotActive;
|
||||
m_lastMinDist = 0.0;
|
||||
m_route = Route(string());
|
||||
}
|
||||
|
@ -54,6 +55,7 @@ void RoutingSession::Reset()
|
|||
RoutingSession::State RoutingSession::OnLocationPositionChanged(m2::PointD const & position,
|
||||
double errorRadius)
|
||||
{
|
||||
ASSERT(m_state != RoutingNotActive, ());
|
||||
ASSERT(m_router != nullptr, ());
|
||||
switch (m_state)
|
||||
{
|
||||
|
|
|
@ -16,6 +16,7 @@ class RoutingSession
|
|||
public:
|
||||
enum State
|
||||
{
|
||||
RoutingNotActive,
|
||||
RouteNotReady, // routing not active or we request route and wait when it will be builded
|
||||
RouteNotStarted, // route builded but user not on route
|
||||
OnRoute, // user follows the route
|
||||
|
@ -24,6 +25,7 @@ public:
|
|||
};
|
||||
|
||||
/*
|
||||
* RoutingNotActive -> RouteNotReady // wait route
|
||||
* RouteNotReady -> RouteNotStarted // rounte builded
|
||||
* RouteNotStarted -> OnRoute // user start follow the route
|
||||
* RouteNotStarted -> RouteLeft // user not like our route.
|
||||
|
|
Loading…
Add table
Reference in a new issue