Immediately changing mode in routing.

This commit is contained in:
Daria Volvenkova 2015-12-23 13:42:00 +03:00
parent 8542ffe82e
commit df1bdbd1aa
6 changed files with 27 additions and 8 deletions

View file

@ -429,14 +429,14 @@ gui::TWidgetsSizeInfo const & DrapeEngine::GetWidgetSizes()
return m_widgetSizes;
}
void DrapeEngine::Allow3dMode(bool allow3d, bool allow3dBuildings)
void DrapeEngine::Allow3dMode(bool allow3d, bool allow3dBuildings, double rotationAngle, double angleFOV)
{
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
make_unique_dp<Allow3dBuildingsMessage>(allow3d && allow3dBuildings),
MessagePriority::Normal);
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
make_unique_dp<Allow3dModeMessage>(allow3d),
make_unique_dp<Allow3dModeMessage>(allow3d, rotationAngle, angleFOV),
MessagePriority::Normal);
}

View file

@ -114,7 +114,7 @@ public:
void SetWidgetLayout(gui::TWidgetsLayoutInfo && info);
gui::TWidgetsSizeInfo const & GetWidgetSizes();
void Allow3dMode(bool allow3d, bool allow3dBuildings);
void Allow3dMode(bool allow3d, bool allow3dBuildings, double rotationAngle, double angleFOV);
void EnablePerspective(double rotationAngle, double angleFOV);
private:

View file

@ -513,20 +513,33 @@ void FrontendRenderer::AcceptMessage(ref_ptr<Message> message)
case Message::Allow3dMode:
{
ref_ptr<Allow3dModeMessage> const msg = message;
#ifdef OMIM_OS_DESKTOP
bool const isPerspective = m_userEventStream.GetCurrentScreen().isPerspective();
#ifdef OMIM_OS_DESKTOP
if (m_enable3dInNavigation == msg->Allow() &&
m_enable3dInNavigation != isPerspective)
{
if (m_enable3dInNavigation)
AddUserEvent(EnablePerspectiveEvent(M_PI / 4.0, M_PI / 3.0,
AddUserEvent(EnablePerspectiveEvent(msg->GetRotationAngle(), msg->GetAngleFOV(),
false /* animated */, true /* immediately start */));
else
AddUserEvent(DisablePerspectiveEvent());
}
#endif
m_enable3dInNavigation = msg->Allow();
if (m_myPositionController->IsInRouting())
{
if (m_enable3dInNavigation && !isPerspective && !m_perspectiveDiscarded)
{
AddUserEvent(EnablePerspectiveEvent(msg->GetRotationAngle(), msg->GetAngleFOV(),
true /* animated */, true /* immediately start */));
}
else if (!m_enable3dInNavigation && (isPerspective || m_perspectiveDiscarded))
{
DisablePerspective();
}
}
break;
}

View file

@ -656,15 +656,21 @@ public:
class Allow3dModeMessage : public Message
{
public:
Allow3dModeMessage(bool allow)
Allow3dModeMessage(bool allow, double rotationAngle, double angleFOV)
: m_allow(allow)
, m_rotationAngle(rotationAngle)
, m_angleFOV(angleFOV)
{}
Type GetType() const override { return Message::Allow3dMode; }
bool Allow() const { return m_allow; }
double GetRotationAngle() const { return m_rotationAngle; }
double GetAngleFOV() const { return m_angleFOV; }
private:
bool const m_allow;
double const m_rotationAngle;
double const m_angleFOV;
};
class Allow3dBuildingsMessage : public Message

View file

@ -85,6 +85,7 @@ public:
dp::UniformValuesStorage const & commonUniforms);
bool IsFollowingActive() const;
bool IsInRouting() const;
private:
void AnimateStateTransition(location::EMyPositionMode oldMode, location::EMyPositionMode newMode);
@ -97,7 +98,6 @@ private:
location::EMyPositionMode GetMode() const;
void CallModeListener(uint32_t mode);
bool IsInRouting() const;
bool IsRotationActive() const;
bool IsVisible() const { return m_isVisible; }

View file

@ -2078,7 +2078,7 @@ void Framework::SetRouteFinishPoint(m2::PointD const & pt, bool isValid)
void Framework::Allow3dMode(bool allow3d, bool allow3dBuildings)
{
CallDrapeFunction(bind(&df::DrapeEngine::Allow3dMode, _1, allow3d, allow3dBuildings));
CallDrapeFunction(bind(&df::DrapeEngine::Allow3dMode, _1, allow3d, allow3dBuildings, kRotationAngle, kAngleFOV));
}
void Framework::Save3dMode(bool allow3d, bool allow3dBuildings)