forked from organicmaps/organicmaps
Review fixes.
Conflicts: android/jni/com/mapswithme/maps/Framework.cpp drape_frontend/message.hpp drape_frontend/message_subclasses.hpp map/framework.cpp
This commit is contained in:
parent
ae8b16f023
commit
227b48c667
14 changed files with 44 additions and 42 deletions
|
@ -188,9 +188,9 @@ MapStyle Framework::GetMapStyle() const
|
|||
return m_work.GetMapStyle();
|
||||
}
|
||||
|
||||
void Framework::Enable3dMode(bool enable)
|
||||
void Framework::Allow3dMode(bool allow)
|
||||
{
|
||||
m_work.Enable3dMode(enable);
|
||||
m_work.Allow3dMode(allow);
|
||||
}
|
||||
|
||||
Storage & Framework::Storage()
|
||||
|
@ -1319,13 +1319,13 @@ extern "C"
|
|||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_Framework_nativeEnable3dMode(JNIEnv * env, jclass thiz, jboolean enable)
|
||||
Java_com_mapswithme_maps_Framework_nativeAllow3dMode(JNIEnv * env, jclass thiz, jboolean allow)
|
||||
{
|
||||
bool const enable3d = static_cast<bool>(enable);
|
||||
bool const allow3d = static_cast<bool>(allow);
|
||||
|
||||
g_framework->PostDrapeTask([enable3d]()
|
||||
g_framework->PostDrapeTask([allow3d]()
|
||||
{
|
||||
g_framework->Enable3dMode(enable3d);
|
||||
g_framework->Allow3dMode(allow3d);
|
||||
});
|
||||
}
|
||||
} // extern "C"
|
||||
|
|
|
@ -156,7 +156,7 @@ namespace android
|
|||
location::EMyPositionMode GetMyPositionMode() const;
|
||||
void SetMyPositionMode(location::EMyPositionMode mode);
|
||||
|
||||
void Enable3dMode(bool enable);
|
||||
void Allow3dMode(bool allow);
|
||||
|
||||
void SetupWidget(gui::EWidget widget, float x, float y, dp::Anchor anchor);
|
||||
void ApplyWidgets();
|
||||
|
|
|
@ -178,5 +178,5 @@ public class Framework
|
|||
|
||||
public native static void nativeDeregisterMaps();
|
||||
|
||||
public native static void nativeEnable3dMode(boolean enable);
|
||||
public native static void nativeAllow3dMode(boolean enable);
|
||||
}
|
||||
|
|
|
@ -345,7 +345,7 @@ public class SearchFragment extends BaseMwmFragment
|
|||
return false;
|
||||
|
||||
hideSearch();
|
||||
Framework.nativeEnable3dMode(is3d);
|
||||
Framework.nativeAllow3dMode(is3d);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -429,10 +429,10 @@ gui::TWidgetsSizeInfo const & DrapeEngine::GetWidgetSizes()
|
|||
return m_widgetSizes;
|
||||
}
|
||||
|
||||
void DrapeEngine::Enable3dMode(bool enable)
|
||||
void DrapeEngine::Allow3dMode(bool enable)
|
||||
{
|
||||
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
|
||||
make_unique_dp<Enable3dModeMessage>(enable),
|
||||
make_unique_dp<Allow3dModeMessage>(enable),
|
||||
MessagePriority::Normal);
|
||||
}
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ public:
|
|||
void SetWidgetLayout(gui::TWidgetsLayoutInfo && info);
|
||||
gui::TWidgetsSizeInfo const & GetWidgetSizes();
|
||||
|
||||
void Enable3dMode(bool enable);
|
||||
void Allow3dMode(bool enable);
|
||||
void EnablePerspective(double rotationAngle, double angleFOV);
|
||||
|
||||
private:
|
||||
|
|
|
@ -490,9 +490,9 @@ void FrontendRenderer::AcceptMessage(ref_ptr<Message> message)
|
|||
break;
|
||||
}
|
||||
|
||||
case Message::Enable3dMode:
|
||||
case Message::Allow3dMode:
|
||||
{
|
||||
ref_ptr<Enable3dModeMessage> const msg = message;
|
||||
ref_ptr<Allow3dModeMessage> const msg = message;
|
||||
m_enable3dInNavigation = msg->Enable();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
UpdateMapStyle,
|
||||
InvalidateTextures,
|
||||
Invalidate,
|
||||
Enable3dMode,
|
||||
Allow3dMode,
|
||||
EnablePerspective
|
||||
};
|
||||
|
||||
|
|
|
@ -653,14 +653,14 @@ public:
|
|||
Type GetType() const override { return Message::DeactivateRouteFollowing; }
|
||||
};
|
||||
|
||||
class Enable3dModeMessage : public Message
|
||||
class Allow3dModeMessage : public Message
|
||||
{
|
||||
public:
|
||||
Enable3dModeMessage(bool enable)
|
||||
Allow3dModeMessage(bool enable)
|
||||
: m_enable(enable)
|
||||
{}
|
||||
|
||||
Type GetType() const override { return Message::Enable3dMode; }
|
||||
Type GetType() const override { return Message::Allow3dMode; }
|
||||
bool Enable() const { return m_enable; }
|
||||
|
||||
private:
|
||||
|
|
|
@ -187,7 +187,7 @@ ScreenBase const & UserEventStream::ProcessEvents(bool & modelViewChange, bool &
|
|||
e.m_followAndRotate.m_isAnim);
|
||||
TouchCancel(m_touches);
|
||||
break;
|
||||
case UserEvent::EVENT_ENABLE_3D_MODE:
|
||||
case UserEvent::EVENT_ENABLE_PERSPECTIVE:
|
||||
if (e.m_enable3dMode.m_isAnim)
|
||||
{
|
||||
m_pendingEvent.reset(new UserEvent(e.m_enable3dMode));
|
||||
|
@ -200,7 +200,7 @@ ScreenBase const & UserEventStream::ProcessEvents(bool & modelViewChange, bool &
|
|||
viewportChanged = true;
|
||||
}
|
||||
break;
|
||||
case UserEvent::EVENT_DISABLE_3D_MODE:
|
||||
case UserEvent::EVENT_DISABLE_PERSPECTIVE:
|
||||
SetDisable3dModeAnimation();
|
||||
break;
|
||||
default:
|
||||
|
@ -223,7 +223,7 @@ ScreenBase const & UserEventStream::ProcessEvents(bool & modelViewChange, bool &
|
|||
if (m_animation->IsFinished())
|
||||
{
|
||||
if (m_animation->GetType() == ModelViewAnimationType::FollowAndRotate &&
|
||||
m_pendingEvent != nullptr && m_pendingEvent->m_type == UserEvent::EVENT_ENABLE_3D_MODE)
|
||||
m_pendingEvent != nullptr && m_pendingEvent->m_type == UserEvent::EVENT_ENABLE_PERSPECTIVE)
|
||||
{
|
||||
SetEnable3dModeAnimation(m_pendingEvent->m_enable3dMode.m_rotationAngle);
|
||||
m_navigator.Enable3dMode(0.0 /* current rotation angle */,
|
||||
|
|
|
@ -35,14 +35,14 @@
|
|||
+ (BOOL)perform3dMode:(NSString *)cmd
|
||||
{
|
||||
// Hook for shell command on change 3d mode
|
||||
BOOL const enable = [cmd isEqualToString:@"?3d"];
|
||||
BOOL const disable = [cmd isEqualToString:@"?2d"];
|
||||
BOOL const is3d = [cmd isEqualToString:@"?3d"];
|
||||
BOOL const is2d = [cmd isEqualToString:@"?2d"];
|
||||
|
||||
if (!enable && !disable)
|
||||
if (!is3d && !is2d)
|
||||
return NO;
|
||||
|
||||
Framework & frm = GetFramework();
|
||||
frm.Enable3dMode(enable);
|
||||
frm.Allow3dMode(is3d);
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
|
|
@ -90,11 +90,13 @@ namespace
|
|||
{
|
||||
static const int BM_TOUCH_PIXEL_INCREASE = 20;
|
||||
static const int kKeepPedestrianDistanceMeters = 10000;
|
||||
|
||||
char const kRouterTypeKey[] = "router";
|
||||
char const kMapStyleKey[] = "MapStyleKeyV1";
|
||||
char const kAllow3dKey[] = "Allow3d";
|
||||
|
||||
double constexpr kRotationAngle = math::pi4;
|
||||
double constexpr kAngleFOV = math::pi / 3.0;
|
||||
double const kRotationAngle = math::pi4;
|
||||
double const kAngleFOV = math::pi / 3.0;
|
||||
}
|
||||
|
||||
pair<MwmSet::MwmId, MwmSet::RegResult> Framework::RegisterMap(
|
||||
|
@ -1269,14 +1271,14 @@ void Framework::CreateDrapeEngine(ref_ptr<dp::OGLContextFactory> contextFactory,
|
|||
ActivateUserMark(mark, true);
|
||||
}
|
||||
|
||||
bool const enable3d = Load3dMode();
|
||||
Enable3dMode(enable3d);
|
||||
bool const allow3d = Load3dMode();
|
||||
Allow3dMode(allow3d);
|
||||
|
||||
// In case of the engine reinitialization recover route.
|
||||
if (m_routingSession.IsActive())
|
||||
{
|
||||
InsertRoute(m_routingSession.GetRoute());
|
||||
if (enable3d)
|
||||
if (allow3d)
|
||||
m_drapeEngine->EnablePerspective(kRotationAngle, kAngleFOV);
|
||||
}
|
||||
}
|
||||
|
@ -2061,20 +2063,20 @@ void Framework::SetRouteFinishPoint(m2::PointD const & pt, bool isValid)
|
|||
m_drapeEngine->SetRoutePoint(pt, false /* isStart */, isValid);
|
||||
}
|
||||
|
||||
void Framework::Enable3dMode(bool enable)
|
||||
void Framework::Allow3dMode(bool allow)
|
||||
{
|
||||
Save3dMode(enable);
|
||||
CallDrapeFunction(bind(&df::DrapeEngine::Enable3dMode, _1, enable));
|
||||
Save3dMode(allow);
|
||||
CallDrapeFunction(bind(&df::DrapeEngine::Allow3dMode, _1, allow));
|
||||
}
|
||||
|
||||
void Framework::Save3dMode(bool enable)
|
||||
void Framework::Save3dMode(bool allow)
|
||||
{
|
||||
Settings::Set("Enable3d", enable);
|
||||
Settings::Set(kAllow3dKey, allow);
|
||||
}
|
||||
|
||||
bool Framework::Load3dMode()
|
||||
{
|
||||
bool enable3d = false;
|
||||
Settings::Get("Enable3d", enable3d);
|
||||
return enable3d;
|
||||
bool allow = false;
|
||||
Settings::Get(kAllow3dKey, allow);
|
||||
return allow;
|
||||
}
|
||||
|
|
|
@ -544,9 +544,9 @@ public:
|
|||
void SetRouteStartPoint(m2::PointD const & pt, bool isValid);
|
||||
void SetRouteFinishPoint(m2::PointD const & pt, bool isValid);
|
||||
|
||||
void Enable3dMode(bool enable);
|
||||
void Save3dMode(bool enable);
|
||||
void Load3dMode();
|
||||
void Allow3dMode(bool allow);
|
||||
void Save3dMode(bool allow);
|
||||
bool Load3dMode();
|
||||
|
||||
private:
|
||||
void SetRouterImpl(routing::RouterType type);
|
||||
|
|
|
@ -200,7 +200,7 @@ bool SearchPanel::Try3dModeCmd(QString const & str)
|
|||
if (!is3dModeOn && !is3dModeOff)
|
||||
return false;
|
||||
|
||||
m_pDrawWidget->GetFramework().Enable3dMode(is3dModeOn);
|
||||
m_pDrawWidget->GetFramework().Allow3dMode(is3dModeOn);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue