forked from organicmaps/organicmaps
[omim] Added p2p routing procession to location state.
This commit is contained in:
parent
07f694664c
commit
0cbc5a3bbf
4 changed files with 33 additions and 12 deletions
|
@ -2258,6 +2258,12 @@ void Framework::RemoveRoute()
|
|||
m_bmManager.ResetRouteTrack();
|
||||
}
|
||||
|
||||
bool Framework::DisableFollowMode()
|
||||
{
|
||||
GetLocationState()->SetRoutingNotFollow();
|
||||
return m_routingSession.DisableFollowMode();
|
||||
}
|
||||
|
||||
void Framework::FollowRoute()
|
||||
{
|
||||
int const scale = (m_currentRouterType == RouterType::Pedestrian) ?
|
||||
|
|
|
@ -593,7 +593,7 @@ public:
|
|||
void BuildRoute(m2::PointD const & start, m2::PointD const & finish, uint32_t timeoutSec);
|
||||
// FollowRoute has a bug where the router follows the route even if the method hads't been called.
|
||||
// This method was added because we do not want to break the behaviour that is familiar to our users.
|
||||
bool DisableFollowMode() { return m_routingSession.DisableFollowMode(); }
|
||||
bool DisableFollowMode();
|
||||
void SetRouteBuildingListener(TRouteBuildingCallback const & buildingCallback) { m_routingCallback = buildingCallback; }
|
||||
void SetRouteProgressListener(TRouteProgressCallback const & progressCallback) { m_progressCallback = progressCallback; }
|
||||
void FollowRoute();
|
||||
|
|
|
@ -311,7 +311,7 @@ void State::SwitchToNextMode()
|
|||
Mode currentMode = GetMode();
|
||||
Mode newMode = currentMode;
|
||||
|
||||
if (!IsInRouting())
|
||||
if (!IsInRouting() || IsRoutingFollowingDisabled())
|
||||
{
|
||||
switch (currentMode)
|
||||
{
|
||||
|
@ -360,10 +360,7 @@ void State::RouteBuilded()
|
|||
if (mode > NotFollow)
|
||||
SetModeInfo(ChangeMode(m_modeInfo, NotFollow));
|
||||
else if (mode == UnknownPosition)
|
||||
{
|
||||
m_afterPendingMode = NotFollow;
|
||||
SetModeInfo(ChangeMode(m_modeInfo, PendingPosition));
|
||||
}
|
||||
}
|
||||
|
||||
void State::StartRouteFollow(int scale)
|
||||
|
@ -382,7 +379,11 @@ void State::StopRoutingMode()
|
|||
{
|
||||
if (IsInRouting())
|
||||
{
|
||||
SetModeInfo(ChangeMode(ExcludeModeBit(m_modeInfo, RoutingSessionBit), GetMode() == RotateAndFollow ? Follow : NotFollow));
|
||||
bool const isNotFollow = IsRoutingFollowingDisabled();
|
||||
m_modeInfo = ExcludeModeBit(m_modeInfo, RoutingNotFollowBit | RoutingSessionBit);
|
||||
if (isNotFollow)
|
||||
return;
|
||||
SetModeInfo(ChangeMode(m_modeInfo, GetMode() == RotateAndFollow ? Follow : NotFollow));
|
||||
RotateOnNorth();
|
||||
AnimateFollow();
|
||||
}
|
||||
|
@ -662,6 +663,11 @@ bool State::IsInRouting() const
|
|||
return TestModeBit(m_modeInfo, RoutingSessionBit);
|
||||
}
|
||||
|
||||
bool State::IsRoutingFollowingDisabled() const
|
||||
{
|
||||
return TestModeBit(m_modeInfo, RoutingNotFollowBit);
|
||||
}
|
||||
|
||||
m2::PointD const State::GetModeDefaultPixelBinding(State::Mode mode) const
|
||||
{
|
||||
switch (mode)
|
||||
|
@ -773,6 +779,11 @@ void State::SetFixedZoom()
|
|||
SetModeInfo(IncludeModeBit(m_modeInfo, FixedZoomBit));
|
||||
}
|
||||
|
||||
void State::SetRoutingNotFollow()
|
||||
{
|
||||
SetModeInfo(IncludeModeBit(m_modeInfo, RoutingNotFollowBit));
|
||||
}
|
||||
|
||||
void State::DragStarted()
|
||||
{
|
||||
m_dragModeInfo = m_modeInfo;
|
||||
|
|
|
@ -83,6 +83,7 @@ namespace location
|
|||
void StopCompassFollowing();
|
||||
void StopLocationFollow(bool callListeners = true);
|
||||
void SetFixedZoom();
|
||||
void SetRoutingNotFollow();
|
||||
|
||||
/// @name User input notification block
|
||||
//@{
|
||||
|
@ -142,6 +143,7 @@ namespace location
|
|||
|
||||
bool IsRotationActive() const;
|
||||
bool IsInRouting() const;
|
||||
bool IsRoutingFollowingDisabled() const;
|
||||
|
||||
m2::PointD const GetModeDefaultPixelBinding(Mode mode) const;
|
||||
m2::PointD const GetRaFModeDefaultPxBind() const;
|
||||
|
@ -158,12 +160,14 @@ namespace location
|
|||
const m2::PointD GetPositionForDraw() const;
|
||||
|
||||
private:
|
||||
// Mode bits
|
||||
// {
|
||||
static uint16_t const FixedZoomBit = 0x20;
|
||||
static uint16_t const RoutingSessionBit = 0x40;
|
||||
static uint16_t const KnownDirectionBit = 0x80;
|
||||
// }
|
||||
|
||||
enum ExternalMode
|
||||
{
|
||||
RoutingNotFollowBit = 0x10,
|
||||
FixedZoomBit = 0x20,
|
||||
RoutingSessionBit = 0x40,
|
||||
KnownDirectionBit = 0x80
|
||||
};
|
||||
static uint16_t const s_cacheRadius = 500.0f;
|
||||
|
||||
uint16_t m_modeInfo; // combination of Mode enum and "Mode bits"
|
||||
|
|
Loading…
Add table
Reference in a new issue