Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorExMix <rahuba.youri@mapswithme.com>2014-09-16 14:00:28 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:27:09 +0300
commitb95ebf1da3180651ed4567cd66fa689f89c4dd79 (patch)
tree3d17a4032b1c7b34eace5beb642619fdf233eb38
parent767e14ca685e92178ae4aaad9756cb04326c8403 (diff)
[core] handle routing start in lite version
-rw-r--r--android/jni/com/mapswithme/platform/Platform.cpp1
-rw-r--r--map/framework.cpp8
-rw-r--r--map/location_state.cpp25
-rw-r--r--map/location_state.hpp2
-rw-r--r--platform/platform.hpp2
-rw-r--r--platform/platform_ios.mm2
-rw-r--r--platform/platform_tizen.cpp1
7 files changed, 21 insertions, 20 deletions
diff --git a/android/jni/com/mapswithme/platform/Platform.cpp b/android/jni/com/mapswithme/platform/Platform.cpp
index 2e2eafe1c9..3acd130d55 100644
--- a/android/jni/com/mapswithme/platform/Platform.cpp
+++ b/android/jni/com/mapswithme/platform/Platform.cpp
@@ -88,6 +88,7 @@ namespace android
m_flags[PRO_URL] = isPro;
m_flags[HAS_BOOKMARKS] = isPro || isYota;
m_flags[HAS_ROTATION] = isPro;
+ m_flags[HAS_ROUTING] = isPro;
string const obbPath = jni::ToNativeString(env, obbGooglePath);
Platform::FilesList files;
diff --git a/map/framework.cpp b/map/framework.cpp
index 1c4dff6d9d..414986fd92 100644
--- a/map/framework.cpp
+++ b/map/framework.cpp
@@ -1942,13 +1942,13 @@ bool Framework::IsRountingActive() const
bool Framework::StartRoutingSession(m2::PointD const & destination)
{
- if (IsRountingActive())
- CancelRoutingSession();
-
shared_ptr<location::State> state = GetLocationState();
- if (state->GetMode() < location::State::NotFollow)
+ if (!GetPlatform().HasRouting() || !state->IsModeHasPosition())
return false;
+ if (IsRountingActive())
+ CancelRoutingSession();
+
m_routingSession.reset(new routing::RoutingSession(CreateRouter()));
m_routingSession->BuildRoute(state->Position(), destination,
[this, state](routing::Route const & route)
diff --git a/map/location_state.cpp b/map/location_state.cpp
index 44137bd3f9..59f0d502f9 100644
--- a/map/location_state.cpp
+++ b/map/location_state.cpp
@@ -115,7 +115,7 @@ void State::SwitchToNextMode()
newMode = Follow;
break;
case Follow:
- if (HasDirection())
+ if (IsRotationActive())
newMode = RotateAndFollow;
else
newMode = UnknownPosition;
@@ -126,15 +126,16 @@ void State::SwitchToNextMode()
}
}
else
- newMode = HasDirection() ? RotateAndFollow : Follow;
+ newMode = IsRotationActive() ? RotateAndFollow : Follow;
SetModeInfo(ChangeMode(m_modeInfo, newMode));
}
void State::StartRoutingMode()
{
+ ASSERT(GetPlatform().HasRouting(), ());
ASSERT(IsModeHasPosition(), ());
- State::Mode newMode = HasDirection() ? RotateAndFollow : Follow;
+ State::Mode newMode = IsRotationActive() ? RotateAndFollow : Follow;
SetModeInfo(ChangeMode(IncludeModeBit(m_modeInfo, RoutingSessionBit), newMode));
}
@@ -270,7 +271,7 @@ void State::draw(graphics::OverlayRenderer * r,
r->drawDisplayList(m_locationMarkDL.get(), drawM);
// if we know look direction than we draw arrow
- if (HasDirection())
+ if (IsRotationActive())
{
double rotateAngle = m_drawDirection + m_framework->GetNavigator().Screen().GetAngle();
@@ -358,9 +359,9 @@ void State::CacheLocationMark()
cacheScreen->endFrame();
}
-bool State::HasDirection() const
+bool State::IsRotationActive() const
{
- return TestModeBit(m_modeInfo, KnownDirectionBit);
+ return m_framework->GetNavigator().DoSupportRotation() && TestModeBit(m_modeInfo, KnownDirectionBit);
}
bool State::IsInRouting() const
@@ -370,17 +371,13 @@ bool State::IsInRouting() const
void State::FollowCompass()
{
- if (!m_framework->GetNavigator().DoSupportRotation())
+ if (!IsRotationActive() || GetMode() != RotateAndFollow)
return;
- if (TestModeBit(m_modeInfo, KnownDirectionBit) && GetMode() == RotateAndFollow)
- {
- anim::Controller::Guard guard(m_framework->GetAnimController());
+ anim::Controller::Guard guard(m_framework->GetAnimController());
- m_framework->GetAnimator().RotateScreen(
- m_framework->GetNavigator().Screen().GetAngle(),
- -m_drawDirection);
- }
+ m_framework->GetAnimator().RotateScreen(m_framework->GetNavigator().Screen().GetAngle(),
+ -m_drawDirection);
}
void State::SetModeInfo(uint16_t modeInfo)
diff --git a/map/location_state.hpp b/map/location_state.hpp
index cf5ffeaeee..493386e65e 100644
--- a/map/location_state.hpp
+++ b/map/location_state.hpp
@@ -112,7 +112,7 @@ namespace location
void CachePositionArrow();
void CacheLocationMark();
- bool HasDirection() const;
+ bool IsRotationActive() const;
bool IsInRouting() const;
void FollowCompass();
diff --git a/platform/platform.hpp b/platform/platform.hpp
index 6a3572fc21..ca246994ec 100644
--- a/platform/platform.hpp
+++ b/platform/platform.hpp
@@ -34,6 +34,7 @@ protected:
PRO_URL,
HAS_BOOKMARKS,
HAS_ROTATION,
+ HAS_ROUTING,
FLAGS_COUNT // should always be the last one
};
@@ -138,6 +139,7 @@ public:
inline bool IsPro() const { return m_flags[PRO_URL]; }
inline bool HasBookmarks() const { return m_flags[HAS_BOOKMARKS]; }
inline bool HasRotation() const { return m_flags[HAS_ROTATION]; }
+ inline bool HasRouting() const { return m_flags[HAS_ROUTING]; }
/// @return url for clients to download maps
//@{
diff --git a/platform/platform_ios.mm b/platform/platform_ios.mm
index 3f20526c6c..0a4dd2943b 100644
--- a/platform/platform_ios.mm
+++ b/platform/platform_ios.mm
@@ -47,7 +47,7 @@ Platform::Platform()
// .travelguide corresponds to the Lite version without search
m_flags[PRO_URL] = ([appID rangeOfString:@"com.mapswithme.travelguide"].location == NSNotFound);
- m_flags[HAS_BOOKMARKS] = m_flags[HAS_ROTATION] = m_flags[PRO_URL];
+ m_flags[HAS_BOOKMARKS] = m_flags[HAS_ROTATION] = m_flags[HAS_ROUTING] = m_flags[PRO_URL];
UIDevice * device = [UIDevice currentDevice];
NSLog(@"Device: %@, SystemName: %@, SystemVersion: %@", device.model, device.systemName, device.systemVersion);
diff --git a/platform/platform_tizen.cpp b/platform/platform_tizen.cpp
index b0cb4db90d..f554700991 100644
--- a/platform/platform_tizen.cpp
+++ b/platform/platform_tizen.cpp
@@ -41,6 +41,7 @@ Platform::Platform()
m_flags[HAS_BOOKMARKS] = true;
m_flags[HAS_ROTATION] = true;
+ m_flags[HAS_ROUTING] = true;
}
int Platform::CpuCores() const