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:
authorDaria Volvenkova <d.volvenkova@corp.mail.ru>2016-07-05 01:02:00 +0300
committerDaria Volvenkova <d.volvenkova@corp.mail.ru>2016-07-07 15:31:12 +0300
commit7ab8f049ed68092129f96de13940afab01adfbf6 (patch)
treea80944672c2b7e330dc581c6225b6b093e0d91cb /drape_frontend
parent502db7d3e167e30571b4e3abafe9f6403d3cb569 (diff)
Perspective animation removed.
Diffstat (limited to 'drape_frontend')
-rw-r--r--drape_frontend/animation/animation.hpp34
-rw-r--r--drape_frontend/animation/perspective_animation.cpp121
-rw-r--r--drape_frontend/animation/perspective_animation.hpp58
-rw-r--r--drape_frontend/animation_system.cpp30
-rw-r--r--drape_frontend/animation_system.hpp3
-rw-r--r--drape_frontend/drape_engine.cpp14
-rw-r--r--drape_frontend/drape_engine.hpp6
-rwxr-xr-xdrape_frontend/drape_frontend.pro2
-rwxr-xr-xdrape_frontend/frontend_renderer.cpp58
-rwxr-xr-xdrape_frontend/frontend_renderer.hpp13
-rw-r--r--drape_frontend/message_subclasses.hpp28
-rw-r--r--drape_frontend/navigator.cpp5
-rw-r--r--drape_frontend/navigator.hpp1
-rw-r--r--drape_frontend/user_event_stream.cpp123
-rw-r--r--drape_frontend/user_event_stream.hpp38
15 files changed, 57 insertions, 477 deletions
diff --git a/drape_frontend/animation/animation.hpp b/drape_frontend/animation/animation.hpp
index 57c96764df..3153dcf37b 100644
--- a/drape_frontend/animation/animation.hpp
+++ b/drape_frontend/animation/animation.hpp
@@ -19,7 +19,6 @@ public:
MapLinear,
MapScale,
MapFollow,
- MapPerspective,
Arrow,
KineticScroll
};
@@ -35,28 +34,7 @@ public:
{
Position,
Scale,
- Angle,
- AnglePerspective,
- SwitchPerspective
- };
-
- struct SwitchPerspectiveParams
- {
- SwitchPerspectiveParams() = default;
-
- SwitchPerspectiveParams(bool enable,
- double startAngle, double endAngle,
- double angleFOV)
- : m_enable(enable)
- , m_startAngle(startAngle)
- , m_endAngle(endAngle)
- , m_angleFOV(angleFOV)
- {}
-
- bool m_enable = false;
- double m_startAngle = 0.0;
- double m_endAngle = 0.0;
- double m_angleFOV = 0.0;
+ Angle
};
struct PropertyValue
@@ -64,8 +42,7 @@ public:
enum Type
{
ValueD,
- ValuePointD,
- ValuePerspectiveParams
+ ValuePointD
};
PropertyValue()
@@ -81,18 +58,11 @@ public:
, m_valuePointD(value)
{}
- explicit PropertyValue(SwitchPerspectiveParams const & params)
- : m_type(ValuePerspectiveParams)
- {
- m_valuePerspectiveParams = params;
- }
-
Type m_type;
union
{
m2::PointD m_valuePointD;
double m_valueD;
- SwitchPerspectiveParams m_valuePerspectiveParams;
};
};
diff --git a/drape_frontend/animation/perspective_animation.cpp b/drape_frontend/animation/perspective_animation.cpp
deleted file mode 100644
index 73feabbaba..0000000000
--- a/drape_frontend/animation/perspective_animation.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-#include "perspective_animation.hpp"
-
-namespace df
-{
-
-PerspectiveSwitchAnimation::PerspectiveSwitchAnimation(double startAngle, double endAngle, double angleFOV)
- : Animation(false /* couldBeInterrupted */, false /* couldBeBlended */)
- , m_angleInterpolator(GetRotateDuration(startAngle, endAngle), startAngle, endAngle)
- , m_startAngle(startAngle)
- , m_endAngle(endAngle)
- , m_angleFOV(angleFOV)
- , m_isEnablePerspectiveAnim(m_endAngle > 0.0)
- , m_needPerspectiveSwitch(false)
-{
- m_objects.insert(Animation::MapPlane);
- m_properties.insert(Animation::AnglePerspective);
- m_properties.insert(Animation::SwitchPerspective);
-}
-
-// static
-double PerspectiveSwitchAnimation::GetRotateDuration(double startAngle, double endAngle)
-{
- double const kScalar = 0.5;
- return kScalar * fabs(endAngle - startAngle) / math::pi4;
-}
-
-Animation::TObjectProperties const & PerspectiveSwitchAnimation::GetProperties(TObject object) const
-{
- ASSERT_EQUAL(object, Animation::MapPlane, ());
- return m_properties;
-}
-
-bool PerspectiveSwitchAnimation::HasProperty(TObject object, TProperty property) const
-{
- return HasObject(object) && m_properties.find(property) != m_properties.end();
-}
-
-bool PerspectiveSwitchAnimation::HasTargetProperty(TObject object, TProperty property) const
-{
- return HasObject(object) && property == Animation::SwitchPerspective;
-}
-
-void PerspectiveSwitchAnimation::Advance(double elapsedSeconds)
-{
- m_angleInterpolator.Advance(elapsedSeconds);
-}
-
-void PerspectiveSwitchAnimation::Finish()
-{
- m_angleInterpolator.Finish();
- Animation::Finish();
-}
-
-void PerspectiveSwitchAnimation::OnStart()
-{
- if (m_isEnablePerspectiveAnim)
- m_needPerspectiveSwitch = true;
- Animation::OnStart();
-}
-
-void PerspectiveSwitchAnimation::OnFinish()
-{
- if (!m_isEnablePerspectiveAnim)
- m_needPerspectiveSwitch = true;
- Animation::OnFinish();
-}
-
-void PerspectiveSwitchAnimation::SetMaxDuration(double maxDuration)
-{
- m_angleInterpolator.SetMaxDuration(maxDuration);
-}
-
-double PerspectiveSwitchAnimation::GetDuration() const
-{
- return m_angleInterpolator.GetDuration();
-}
-
-bool PerspectiveSwitchAnimation::IsFinished() const
-{
- return m_angleInterpolator.IsFinished();
-}
-
-bool PerspectiveSwitchAnimation::GetTargetProperty(TObject object, TProperty property, PropertyValue & value) const
-{
- ASSERT_EQUAL(object, Animation::MapPlane, ());
-
- if (property == Animation::SwitchPerspective)
- {
- value = PropertyValue(SwitchPerspectiveParams(m_isEnablePerspectiveAnim, m_endAngle, m_endAngle, m_angleFOV));
- return true;
- }
-
- ASSERT(false, ("Wrong property:", property));
- return false;
-}
-
-bool PerspectiveSwitchAnimation::GetProperty(TObject object, TProperty property, PropertyValue & value) const
-{
- ASSERT_EQUAL(object, Animation::MapPlane, ());
-
- switch (property)
- {
- case Animation::AnglePerspective:
- value = PropertyValue(m_angleInterpolator.GetAngle());
- return true;
- case Animation::SwitchPerspective:
- if (m_needPerspectiveSwitch)
- {
- m_needPerspectiveSwitch = false;
- value = PropertyValue(SwitchPerspectiveParams(m_isEnablePerspectiveAnim, m_startAngle, m_endAngle, m_angleFOV));
- return true;
- }
- return false;
- default:
- ASSERT(false, ("Wrong property:", property));
- }
-
- return false;
-}
-
-} // namespace df
diff --git a/drape_frontend/animation/perspective_animation.hpp b/drape_frontend/animation/perspective_animation.hpp
deleted file mode 100644
index 00671a450d..0000000000
--- a/drape_frontend/animation/perspective_animation.hpp
+++ /dev/null
@@ -1,58 +0,0 @@
-#pragma once
-
-#include "animation.hpp"
-#include "interpolators.hpp"
-
-namespace df
-{
-
-class PerspectiveSwitchAnimation : public Animation
-{
-public:
- PerspectiveSwitchAnimation(double startAngle, double endAngle, double angleFOV);
-
- static double GetRotateDuration(double startAngle, double endAngle);
-
- Animation::Type GetType() const override { return Animation::MapPerspective; }
-
- TAnimObjects const & GetObjects() const override
- {
- return m_objects;
- }
-
- bool HasObject(TObject object) const override
- {
- return m_objects.find(object) != m_objects.end();
- }
-
- TObjectProperties const & GetProperties(TObject object) const override;
- bool HasProperty(TObject object, TProperty property) const override;
- bool HasTargetProperty(TObject object, TProperty property) const override;
-
- void Advance(double elapsedSeconds) override;
- void Finish() override;
-
- void OnStart() override;
- void OnFinish() override;
-
- void SetMaxDuration(double maxDuration) override;
- double GetDuration() const override;
- bool IsFinished() const override;
-
- bool GetProperty(TObject object, TProperty property, PropertyValue & value) const override;
- bool GetTargetProperty(TObject object, TProperty property, PropertyValue & value) const override;
-
-private:
- AngleInterpolator m_angleInterpolator;
- double m_startAngle;
- double m_endAngle;
- double m_angleFOV;
-
- bool m_isEnablePerspectiveAnim;
- mutable bool m_needPerspectiveSwitch;
- TAnimObjects m_objects;
- TObjectProperties m_properties;
-};
-
-} // namespace df
-
diff --git a/drape_frontend/animation_system.cpp b/drape_frontend/animation_system.cpp
index 76d113ecdf..fd8e6b039b 100644
--- a/drape_frontend/animation_system.cpp
+++ b/drape_frontend/animation_system.cpp
@@ -18,14 +18,6 @@ public:
void Blend(Animation::PropertyValue const & value)
{
- // Now perspective parameters can't be blended.
- if (value.m_type == Animation::PropertyValue::ValuePerspectiveParams)
- {
- m_value = value;
- m_counter = 1;
- return;
- }
-
if (m_counter != 0)
{
// New value type resets current blended value.
@@ -116,28 +108,6 @@ bool AnimationSystem::GetScreen(ScreenBase const & currentScreen, TGetPropertyFn
return true;
}
-bool AnimationSystem::GetPerspectiveAngle(double & angle)
-{
- Animation::PropertyValue value;
- if (GetProperty(Animation::MapPlane, Animation::AnglePerspective, value))
- {
- angle = value.m_valueD;
- return true;
- }
- return false;
-}
-
-bool AnimationSystem::SwitchPerspective(Animation::SwitchPerspectiveParams & params)
-{
- Animation::PropertyValue value;
- if (GetProperty(Animation::MapPlane, Animation::SwitchPerspective, value))
- {
- params = value.m_valuePerspectiveParams;
- return true;
- }
- return false;
-}
-
bool AnimationSystem::GetArrowPosition(m2::PointD & position)
{
Animation::PropertyValue value;
diff --git a/drape_frontend/animation_system.hpp b/drape_frontend/animation_system.hpp
index c989da99f2..d92982d6ed 100644
--- a/drape_frontend/animation_system.hpp
+++ b/drape_frontend/animation_system.hpp
@@ -23,9 +23,6 @@ public:
bool GetScreen(ScreenBase const & currentScreen, ScreenBase & screen);
void GetTargetScreen(ScreenBase const & currentScreen, ScreenBase & screen);
- bool SwitchPerspective(Animation::SwitchPerspectiveParams & params);
- bool GetPerspectiveAngle(double & angle);
-
bool GetArrowPosition(m2::PointD & position);
bool GetArrowAngle(double & angle);
diff --git a/drape_frontend/drape_engine.cpp b/drape_frontend/drape_engine.cpp
index d45db5ef08..8ad2631e88 100644
--- a/drape_frontend/drape_engine.cpp
+++ b/drape_frontend/drape_engine.cpp
@@ -265,11 +265,10 @@ void DrapeEngine::StopLocationFollow()
MessagePriority::High);
}
-void DrapeEngine::FollowRoute(int preferredZoomLevel, int preferredZoomLevel3d, double rotationAngle, double angleFOV)
+void DrapeEngine::FollowRoute(int preferredZoomLevel, int preferredZoomLevel3d)
{
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
- make_unique_dp<FollowRouteMessage>(preferredZoomLevel, preferredZoomLevel3d,
- rotationAngle, angleFOV),
+ make_unique_dp<FollowRouteMessage>(preferredZoomLevel, preferredZoomLevel3d),
MessagePriority::High);
}
@@ -380,22 +379,21 @@ void DrapeEngine::SetWidgetLayout(gui::TWidgetsLayoutInfo && info)
MessagePriority::Normal);
}
-void DrapeEngine::Allow3dMode(bool allowPerspectiveInNavigation, bool allow3dBuildings, double rotationAngle, double angleFOV)
+void DrapeEngine::Allow3dMode(bool allowPerspectiveInNavigation, bool allow3dBuildings)
{
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
make_unique_dp<Allow3dBuildingsMessage>(allow3dBuildings),
MessagePriority::Normal);
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
- make_unique_dp<Allow3dModeMessage>(allowPerspectiveInNavigation, allow3dBuildings,
- rotationAngle, angleFOV),
+ make_unique_dp<Allow3dModeMessage>(allowPerspectiveInNavigation, allow3dBuildings),
MessagePriority::Normal);
}
-void DrapeEngine::EnablePerspective(double rotationAngle, double angleFOV)
+void DrapeEngine::EnablePerspective()
{
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
- make_unique_dp<EnablePerspectiveMessage>(rotationAngle, angleFOV),
+ make_unique_dp<EnablePerspectiveMessage>(),
MessagePriority::Normal);
}
diff --git a/drape_frontend/drape_engine.hpp b/drape_frontend/drape_engine.hpp
index 421509a1ea..b48cdb9d2d 100644
--- a/drape_frontend/drape_engine.hpp
+++ b/drape_frontend/drape_engine.hpp
@@ -124,14 +124,14 @@ public:
void AddRoute(m2::PolylineD const & routePolyline, vector<double> const & turns,
df::ColorConstant color, df::RoutePattern pattern = df::RoutePattern());
void RemoveRoute(bool deactivateFollowing);
- void FollowRoute(int preferredZoomLevel, int preferredZoomLevel3d, double rotationAngle, double angleFOV);
+ void FollowRoute(int preferredZoomLevel, int preferredZoomLevel3d);
void DeactivateRouteFollowing();
void SetRoutePoint(m2::PointD const & position, bool isStart, bool isValid);
void SetWidgetLayout(gui::TWidgetsLayoutInfo && info);
- void Allow3dMode(bool allowPerspectiveInNavigation, bool allow3dBuildings, double rotationAngle, double angleFOV);
- void EnablePerspective(double rotationAngle, double angleFOV);
+ void Allow3dMode(bool allowPerspectiveInNavigation, bool allow3dBuildings);
+ void EnablePerspective();
void UpdateGpsTrackPoints(vector<df::GpsTrackPoint> && toAdd, vector<uint32_t> && toRemove);
void ClearGpsTrackPoints();
diff --git a/drape_frontend/drape_frontend.pro b/drape_frontend/drape_frontend.pro
index 246a71d272..514f82d1ab 100755
--- a/drape_frontend/drape_frontend.pro
+++ b/drape_frontend/drape_frontend.pro
@@ -23,7 +23,6 @@ SOURCES += \
animation/scale_animation.cpp \
animation/sequence_animation.cpp \
animation/parallel_animation.cpp \
- animation/perspective_animation.cpp \
animation/opacity_animation.cpp \
animation/show_hide_animation.cpp \
gui/choose_position_mark.cpp \
@@ -116,7 +115,6 @@ HEADERS += \
animation/scale_animation.hpp \
animation/sequence_animation.hpp \
animation/parallel_animation.hpp \
- animation/perspective_animation.hpp \
animation/opacity_animation.hpp \
animation/show_hide_animation.hpp \
animation/value_mapping.hpp \
diff --git a/drape_frontend/frontend_renderer.cpp b/drape_frontend/frontend_renderer.cpp
index bac2bb33a8..560fe7a4b6 100755
--- a/drape_frontend/frontend_renderer.cpp
+++ b/drape_frontend/frontend_renderer.cpp
@@ -484,8 +484,7 @@ void FrontendRenderer::AcceptMessage(ref_ptr<Message> message)
if (m_pendingFollowRoute != nullptr)
{
- FollowRoute(m_pendingFollowRoute->m_preferredZoomLevel, m_pendingFollowRoute->m_preferredZoomLevelIn3d,
- m_pendingFollowRoute->m_rotationAngle, m_pendingFollowRoute->m_angleFOV);
+ FollowRoute(m_pendingFollowRoute->m_preferredZoomLevel, m_pendingFollowRoute->m_preferredZoomLevelIn3d);
m_pendingFollowRoute.reset();
}
break;
@@ -522,13 +521,11 @@ void FrontendRenderer::AcceptMessage(ref_ptr<Message> message)
if (m_routeRenderer->GetRouteData() == nullptr)
{
m_pendingFollowRoute.reset(
- new FollowRouteData(msg->GetPreferredZoomLevel(), msg->GetPreferredZoomLevelIn3d(),
- msg->GetRotationAngle(), msg->GetAngleFOV()));
+ new FollowRouteData(msg->GetPreferredZoomLevel(), msg->GetPreferredZoomLevelIn3d()));
break;
}
- FollowRoute(msg->GetPreferredZoomLevel(), msg->GetPreferredZoomLevelIn3d(),
- msg->GetRotationAngle(), msg->GetAngleFOV());
+ FollowRoute(msg->GetPreferredZoomLevel(), msg->GetPreferredZoomLevelIn3d());
break;
}
@@ -613,9 +610,7 @@ void FrontendRenderer::AcceptMessage(ref_ptr<Message> message)
case Message::EnablePerspective:
{
- ref_ptr<EnablePerspectiveMessage> const msg = message;
- AddUserEvent(EnablePerspectiveEvent(msg->GetRotationAngle(), msg->GetAngleFOV(),
- false /* animated */, true /* immediately start */));
+ AddUserEvent(SetAutoPerspectiveEvent(true /* isAutoPerspective */));
break;
}
@@ -628,11 +623,7 @@ void FrontendRenderer::AcceptMessage(ref_ptr<Message> message)
if (m_enablePerspectiveInNavigation == msg->AllowPerspective() &&
m_enablePerspectiveInNavigation != screen.isPerspective())
{
- if (m_enablePerspectiveInNavigation)
- AddUserEvent(EnablePerspectiveEvent(msg->GetRotationAngle(), msg->GetAngleFOV(),
- false /* animated */, true /* immediately start */));
- else
- AddUserEvent(DisablePerspectiveEvent());
+ AddUserEvent(SetAutoPerspectiveEvent(m_enablePerspectiveInNavigation));
}
#endif
@@ -648,15 +639,7 @@ void FrontendRenderer::AcceptMessage(ref_ptr<Message> message)
m_enablePerspectiveInNavigation = msg->AllowPerspective();
if (m_myPositionController->IsInRouting())
{
- if (m_enablePerspectiveInNavigation && !screen.isPerspective() && !m_perspectiveDiscarded)
- {
- AddUserEvent(EnablePerspectiveEvent(msg->GetRotationAngle(), msg->GetAngleFOV(),
- true /* animated */, true /* immediately start */));
- }
- else if (!m_enablePerspectiveInNavigation && (screen.isPerspective() || m_perspectiveDiscarded))
- {
- DisablePerspective();
- }
+ AddUserEvent(SetAutoPerspectiveEvent(m_enablePerspectiveInNavigation));
}
}
break;
@@ -750,18 +733,14 @@ unique_ptr<threads::IRoutine> FrontendRenderer::CreateRoutine()
return make_unique<Routine>(*this);
}
-void FrontendRenderer::FollowRoute(int preferredZoomLevel, int preferredZoomLevelIn3d,
- double rotationAngle, double angleFOV)
+void FrontendRenderer::FollowRoute(int preferredZoomLevel, int preferredZoomLevelIn3d)
{
m_myPositionController->ActivateRouting(!m_enablePerspectiveInNavigation ? preferredZoomLevel
: preferredZoomLevelIn3d);
if (m_enablePerspectiveInNavigation)
- {
- bool immediatelyStart = !m_myPositionController->IsRotationAvailable();
- AddUserEvent(EnablePerspectiveEvent(rotationAngle, angleFOV, true /* animated */, immediatelyStart));
- }
+ AddUserEvent(SetAutoPerspectiveEvent(true /* isAutoPerspective */));
m_overlayTree->SetFollowingMode(true);
}
@@ -1226,10 +1205,17 @@ void FrontendRenderer::RefreshModelView(ScreenBase const & screen)
m_generalUniforms.SetMatrix4x4Value("modelView", mv.m_data);
- // TODO: Calculate exact value of zScale
- double const averageScale3d = 3.0;
- float const zScale = 2.0f / (screen.PixelRectIn3d().SizeY() * averageScale3d * screen.GetScale());
- //float const zScale = 2.0f / (screen.GetHeight() * screen.GetScale());
+ float zScale;
+ if (screen.isPerspective())
+ {
+ // TODO: Calculate exact value of zScale
+ double const averageScale3d = 3.0;
+ zScale = 2.0f / (screen.PixelRectIn3d().SizeY() * averageScale3d * screen.GetScale());
+ }
+ else
+ {
+ zScale = 2.0f / (screen.GetHeight() * screen.GetScale());
+ }
m_generalUniforms.SetFloatValue("zScale", zScale);
}
@@ -1264,8 +1250,7 @@ void FrontendRenderer::RefreshBgColor()
void FrontendRenderer::DisablePerspective()
{
- m_perspectiveDiscarded = false;
- AddUserEvent(DisablePerspectiveEvent());
+ AddUserEvent(SetAutoPerspectiveEvent(false /* isAutoPerspective */));
}
void FrontendRenderer::CheckIsometryMinScale(ScreenBase const & screen)
@@ -1620,8 +1605,7 @@ void FrontendRenderer::PositionChanged(m2::PointD const & position)
void FrontendRenderer::ChangeModelView(m2::PointD const & center, int zoomLevel)
{
- AddUserEvent(FollowAndRotateEvent(center, m_userEventStream.GetCurrentScreen().PixelRectIn3d().Center(), -m_userEventStream.GetCurrentScreen().GetAngle(), zoomLevel, true));
- //AddUserEvent(SetCenterEvent(center, zoomLevel, true));
+ AddUserEvent(SetCenterEvent(center, zoomLevel, true));
}
void FrontendRenderer::ChangeModelView(double azimuth)
diff --git a/drape_frontend/frontend_renderer.hpp b/drape_frontend/frontend_renderer.hpp
index 873a774b87..5f7459c7bb 100755
--- a/drape_frontend/frontend_renderer.hpp
+++ b/drape_frontend/frontend_renderer.hpp
@@ -221,8 +221,7 @@ private:
using TRenderGroupRemovePredicate = function<bool(drape_ptr<RenderGroup> const &)>;
void RemoveRenderGroupsLater(TRenderGroupRemovePredicate const & predicate);
- void FollowRoute(int preferredZoomLevel, int preferredZoomLevelIn3d,
- double rotationAngle, double angleFOV);
+ void FollowRoute(int preferredZoomLevel, int preferredZoomLevelIn3d);
void InvalidateRect(m2::RectD const & gRect);
bool CheckTileGenerations(TileKey const & tileKey);
void UpdateCanBeDeletedStatus();
@@ -294,8 +293,6 @@ private:
TTilesCollection m_notFinishedTiles;
int m_currentZoomLevel = -1;
-
- bool m_perspectiveDiscarded = false;
ref_ptr<RequestedTiles> m_requestedTiles;
uint64_t m_maxGeneration;
@@ -304,19 +301,13 @@ private:
struct FollowRouteData
{
FollowRouteData(int preferredZoomLevel,
- int preferredZoomLevelIn3d,
- double rotationAngle,
- double angleFOV)
+ int preferredZoomLevelIn3d)
: m_preferredZoomLevel(preferredZoomLevel)
, m_preferredZoomLevelIn3d(preferredZoomLevelIn3d)
- , m_rotationAngle(rotationAngle)
- , m_angleFOV(angleFOV)
{}
int m_preferredZoomLevel;
int m_preferredZoomLevelIn3d;
- double m_rotationAngle;
- double m_angleFOV;
};
unique_ptr<FollowRouteData> m_pendingFollowRoute;
diff --git a/drape_frontend/message_subclasses.hpp b/drape_frontend/message_subclasses.hpp
index 49e327af05..67da3f47dd 100644
--- a/drape_frontend/message_subclasses.hpp
+++ b/drape_frontend/message_subclasses.hpp
@@ -645,24 +645,18 @@ public:
class FollowRouteMessage : public Message
{
public:
- FollowRouteMessage(int preferredZoomLevel, int preferredZoomLevelIn3d, double rotationAngle, double angleFOV)
+ FollowRouteMessage(int preferredZoomLevel, int preferredZoomLevelIn3d)
: m_preferredZoomLevel(preferredZoomLevel)
, m_preferredZoomLevelIn3d(preferredZoomLevelIn3d)
- , m_rotationAngle(rotationAngle)
- , m_angleFOV(angleFOV)
{}
Type GetType() const override { return Message::FollowRoute; }
int GetPreferredZoomLevel() const { return m_preferredZoomLevel; }
int GetPreferredZoomLevelIn3d() const { return m_preferredZoomLevelIn3d; }
- double GetRotationAngle() const { return m_rotationAngle; }
- double GetAngleFOV() const { return m_angleFOV; }
private:
int const m_preferredZoomLevel;
int const m_preferredZoomLevelIn3d;
- double const m_rotationAngle;
- double const m_angleFOV;
};
class InvalidateTexturesMessage : public BaseBlockingMessage
@@ -694,24 +688,18 @@ public:
class Allow3dModeMessage : public Message
{
public:
- Allow3dModeMessage(bool allowPerspective, bool allow3dBuildings, double rotationAngle, double angleFOV)
+ Allow3dModeMessage(bool allowPerspective, bool allow3dBuildings)
: m_allowPerspective(allowPerspective)
, m_allow3dBuildings(allow3dBuildings)
- , m_rotationAngle(rotationAngle)
- , m_angleFOV(angleFOV)
{}
Type GetType() const override { return Message::Allow3dMode; }
bool AllowPerspective() const { return m_allowPerspective; }
bool Allow3dBuildings() const { return m_allow3dBuildings; }
- double GetRotationAngle() const { return m_rotationAngle; }
- double GetAngleFOV() const { return m_angleFOV; }
private:
bool const m_allowPerspective;
bool const m_allow3dBuildings;
- double const m_rotationAngle;
- double const m_angleFOV;
};
class Allow3dBuildingsMessage : public Message
@@ -731,19 +719,9 @@ private:
class EnablePerspectiveMessage : public Message
{
public:
- EnablePerspectiveMessage(double rotationAngle, double angleFOV)
- : m_rotationAngle(rotationAngle)
- , m_angleFOV(angleFOV)
- {}
+ EnablePerspectiveMessage() = default;
Type GetType() const override { return Message::EnablePerspective; }
-
- double GetRotationAngle() const { return m_rotationAngle; }
- double GetAngleFOV() const { return m_angleFOV; }
-
-private:
- double const m_rotationAngle;
- double const m_angleFOV;
};
class CacheGpsTrackPointsMessage : public Message
diff --git a/drape_frontend/navigator.cpp b/drape_frontend/navigator.cpp
index 3c01342cf1..3ef11b1a32 100644
--- a/drape_frontend/navigator.cpp
+++ b/drape_frontend/navigator.cpp
@@ -279,6 +279,11 @@ bool Navigator::IsRotatingDuringScale() const
return m_IsRotatingDuringScale;
}
+void Navigator::SetAutoPerspective(bool enable)
+{
+ m_Screen.SetAutoPerspective(enable);
+}
+
void Navigator::Enable3dMode(double currentRotationAngle, double maxRotationAngle, double angleFOV)
{
m_Screen.ApplyPerspective(currentRotationAngle, maxRotationAngle, angleFOV);
diff --git a/drape_frontend/navigator.hpp b/drape_frontend/navigator.hpp
index 0155a4dd9f..e285e9c34d 100644
--- a/drape_frontend/navigator.hpp
+++ b/drape_frontend/navigator.hpp
@@ -46,6 +46,7 @@ public:
void Scale(m2::PointD const & pixelScaleCenter, double factor);
bool InAction() const;
+ void SetAutoPerspective(bool enable);
void Enable3dMode(double currentRotationAngle, double maxRotationAngle, double angleFOV);
void SetRotationIn3dMode(double rotationAngle);
void Disable3dMode();
diff --git a/drape_frontend/user_event_stream.cpp b/drape_frontend/user_event_stream.cpp
index 21b431f215..106bd58023 100644
--- a/drape_frontend/user_event_stream.cpp
+++ b/drape_frontend/user_event_stream.cpp
@@ -2,7 +2,6 @@
#include "drape_frontend/animation/linear_animation.hpp"
#include "drape_frontend/animation/scale_animation.hpp"
#include "drape_frontend/animation/follow_animation.hpp"
-#include "drape_frontend/animation/perspective_animation.hpp"
#include "drape_frontend/animation/sequence_animation.hpp"
#include "drape_frontend/animation_constants.hpp"
#include "drape_frontend/animation_system.hpp"
@@ -152,9 +151,6 @@ ScreenBase const & UserEventStream::ProcessEvents(bool & modelViewChanged, bool
m_modelViewChanged = !events.empty() || m_state == STATE_SCALE || m_state == STATE_DRAG;
for (UserEvent const & e : events)
{
- if (m_perspectiveAnimation && FilterEventWhile3dAnimation(e.m_type))
- continue;
-
bool breakAnim = false;
switch (e.m_type)
@@ -175,11 +171,6 @@ ScreenBase const & UserEventStream::ProcessEvents(bool & modelViewChanged, bool
TouchCancel(m_touches);
break;
case UserEvent::EVENT_SET_RECT:
- if (m_perspectiveAnimation)
- {
- m_pendingEvent.reset(new UserEvent(e.m_rectEvent));
- break;
- }
breakAnim = SetRect(e.m_rectEvent.m_rect, e.m_rectEvent.m_zoom, e.m_rectEvent.m_applyRotation, e.m_rectEvent.m_isAnim);
TouchCancel(m_touches);
break;
@@ -213,12 +204,8 @@ ScreenBase const & UserEventStream::ProcessEvents(bool & modelViewChanged, bool
e.m_followAndRotate.m_isAnim);
TouchCancel(m_touches);
break;
- case UserEvent::EVENT_ENABLE_PERSPECTIVE:
- SetEnable3dMode(e.m_enable3dMode.m_rotationAngle, e.m_enable3dMode.m_angleFOV,
- e.m_enable3dMode.m_isAnim, e.m_enable3dMode.m_immediatelyStart);
- break;
- case UserEvent::EVENT_DISABLE_PERSPECTIVE:
- SetDisable3dModeAnimation();
+ case UserEvent::EVENT_AUTO_PERSPECTIVE:
+ SetAutoPerspective(e.m_autoPerspective.m_isAutoPerspective);
break;
default:
ASSERT(false, ());
@@ -231,21 +218,6 @@ ScreenBase const & UserEventStream::ProcessEvents(bool & modelViewChanged, bool
ApplyAnimations();
- if (m_perspectiveAnimation)
- {
- TouchCancel(m_touches);
- }
- else
- {
- if (m_pendingEvent != nullptr && m_pendingEvent->m_type == UserEvent::EVENT_SET_RECT)
- {
- SetRect(m_pendingEvent->m_rectEvent.m_rect, m_pendingEvent->m_rectEvent.m_zoom,
- m_pendingEvent->m_rectEvent.m_applyRotation, m_pendingEvent->m_rectEvent.m_isAnim);
- m_pendingEvent.reset();
- m_modelViewChanged = true;
- }
- }
-
if (GetValidTouchesCount(m_touches) == 1)
{
if (m_state == STATE_WAIT_DOUBLE_TAP)
@@ -274,27 +246,6 @@ void UserEventStream::ApplyAnimations()
if (m_animationSystem.GetScreen(GetCurrentScreen(), screen))
m_navigator.SetFromScreen(screen);
- Animation::SwitchPerspectiveParams switchPerspective;
- if (m_animationSystem.SwitchPerspective(switchPerspective))
- {
- if (switchPerspective.m_enable)
- {
- m_navigator.Enable3dMode(switchPerspective.m_startAngle, switchPerspective.m_endAngle,
- switchPerspective.m_angleFOV);
- }
- else
- {
- m_navigator.Disable3dMode();
- }
- }
-
- double perspectiveAngle;
- if (m_animationSystem.GetPerspectiveAngle(perspectiveAngle) &&
- GetCurrentScreen().isPerspective())
- {
- m_navigator.SetRotationIn3dMode(perspectiveAngle);
- }
-
m_modelViewChanged = true;
}
}
@@ -510,61 +461,12 @@ bool UserEventStream::SetFollowAndRotate(m2::PointD const & userPos, m2::PointD
return true;
}
-bool UserEventStream::FilterEventWhile3dAnimation(UserEvent::EEventType type) const
-{
- return type != UserEvent::EVENT_RESIZE && type != UserEvent::EVENT_SET_RECT &&
- type != UserEvent::EVENT_ENABLE_PERSPECTIVE &&
- type != UserEvent::EVENT_DISABLE_PERSPECTIVE;
-}
-
-void UserEventStream::SetEnable3dMode(double maxRotationAngle, double angleFOV,
- bool isAnim, bool immediatelyStart)
+void UserEventStream::SetAutoPerspective(bool isAutoPerspective)
{
+ if (!isAutoPerspective)
+ m_navigator.Disable3dMode();
+ m_navigator.SetAutoPerspective(isAutoPerspective);
return;
-
- ResetAnimationsBeforeSwitch3D();
-
- if (immediatelyStart)
- InterruptFollowAnimations(true /* force */);
-
- double const startAngle = isAnim ? 0.0 : maxRotationAngle;
- double const endAngle = maxRotationAngle;
-
- auto anim = make_unique_dp<PerspectiveSwitchAnimation>(startAngle, endAngle, angleFOV);
- anim->SetOnStartAction([this, startAngle, endAngle, angleFOV](ref_ptr<Animation>)
- {
- m_perspectiveAnimation = true;
- });
- anim->SetOnFinishAction([this](ref_ptr<Animation>)
- {
- m_perspectiveAnimation = false;
- });
- if (immediatelyStart)
- m_animationSystem.CombineAnimation(move(anim));
- else
- m_animationSystem.PushAnimation(move(anim));
-}
-
-void UserEventStream::SetDisable3dModeAnimation()
-{
- return;
-
- ResetAnimationsBeforeSwitch3D();
- InterruptFollowAnimations(true /* force */);
-
- double const startAngle = m_navigator.Screen().GetRotationAngle();
- double const endAngle = 0.0;
-
- auto anim = make_unique_dp<PerspectiveSwitchAnimation>(startAngle, endAngle, m_navigator.Screen().GetAngleFOV());
- anim->SetOnStartAction([this](ref_ptr<Animation>)
- {
- m_perspectiveAnimation = true;
- });
- anim->SetOnFinishAction([this](ref_ptr<Animation>)
- {
- m_perspectiveAnimation = false;
- });
- m_animationSystem.CombineAnimation(move(anim));
}
void UserEventStream::ResetAnimations(Animation::Type animType, bool finishAll)
@@ -591,14 +493,6 @@ void UserEventStream::ResetMapPlaneAnimations()
ApplyAnimations();
}
-void UserEventStream::ResetAnimationsBeforeSwitch3D()
-{
- ResetAnimations(Animation::MapLinear);
- ResetAnimations(Animation::Sequence, kPrettyMoveAnim);
- ResetAnimations(Animation::MapScale);
- ResetAnimations(Animation::MapPerspective, true /* finishAll */);
-}
-
m2::AnyRectD UserEventStream::GetCurrentRect() const
{
return m_navigator.Screen().GlobalRect();
@@ -1195,11 +1089,6 @@ bool UserEventStream::IsWaitingForActionCompletion() const
return m_state != STATE_EMPTY;
}
-bool UserEventStream::IsInPerspectiveAnimation() const
-{
- return m_perspectiveAnimation;
-}
-
void UserEventStream::SetKineticScrollEnabled(bool enabled)
{
m_kineticScrollEnabled = enabled;
diff --git a/drape_frontend/user_event_stream.hpp b/drape_frontend/user_event_stream.hpp
index aa02aca90d..c3ad87d6a2 100644
--- a/drape_frontend/user_event_stream.hpp
+++ b/drape_frontend/user_event_stream.hpp
@@ -145,25 +145,13 @@ struct FollowAndRotateEvent
bool m_isAnim;
};
-struct EnablePerspectiveEvent
+struct SetAutoPerspectiveEvent
{
- EnablePerspectiveEvent(double rotationAngle, double angleFOV,
- bool isAnim, bool immediatelyStart)
- : m_isAnim(isAnim)
- , m_immediatelyStart(immediatelyStart)
- , m_rotationAngle(rotationAngle)
- , m_angleFOV(angleFOV)
+ SetAutoPerspectiveEvent(bool isAutoPerspective)
+ : m_isAutoPerspective(isAutoPerspective)
{}
- bool m_isAnim;
- bool m_immediatelyStart;
- double m_rotationAngle;
- double m_angleFOV;
-};
-
-struct DisablePerspectiveEvent
-{
- DisablePerspectiveEvent() {}
+ bool m_isAutoPerspective;
};
struct RotateEvent
@@ -193,8 +181,7 @@ struct UserEvent
EVENT_RESIZE,
EVENT_ROTATE,
EVENT_FOLLOW_AND_ROTATE,
- EVENT_ENABLE_PERSPECTIVE,
- EVENT_DISABLE_PERSPECTIVE
+ EVENT_AUTO_PERSPECTIVE
};
UserEvent(TouchEvent const & e) : m_type(EVENT_TOUCH) { m_touchEvent = e; }
@@ -205,8 +192,7 @@ struct UserEvent
UserEvent(ResizeEvent const & e) : m_type(EVENT_RESIZE) { m_resize = e; }
UserEvent(RotateEvent const & e) : m_type(EVENT_ROTATE) { m_rotate = e; }
UserEvent(FollowAndRotateEvent const & e) : m_type(EVENT_FOLLOW_AND_ROTATE) { m_followAndRotate = e; }
- UserEvent(EnablePerspectiveEvent const & e) : m_type(EVENT_ENABLE_PERSPECTIVE) { m_enable3dMode = e; }
- UserEvent(DisablePerspectiveEvent const & e) : m_type(EVENT_DISABLE_PERSPECTIVE) { m_disable3dMode = e; }
+ UserEvent(SetAutoPerspectiveEvent const & e) : m_type(EVENT_AUTO_PERSPECTIVE) { m_autoPerspective = e; }
EEventType m_type;
union
@@ -219,8 +205,7 @@ struct UserEvent
ResizeEvent m_resize;
RotateEvent m_rotate;
FollowAndRotateEvent m_followAndRotate;
- EnablePerspectiveEvent m_enable3dMode;
- DisablePerspectiveEvent m_disable3dMode;
+ SetAutoPerspectiveEvent m_autoPerspective;
};
};
@@ -261,7 +246,6 @@ public:
void GetTargetScreen(ScreenBase & screen) const;
m2::AnyRectD GetTargetRect() const;
bool IsInUserAction() const;
- bool IsInPerspectiveAnimation() const;
bool IsWaitingForActionCompletion() const;
void SetListener(ref_ptr<Listener> listener) { m_listener = listener; }
@@ -299,11 +283,7 @@ private:
bool SetScreen(ScreenBase const & screen, bool isAnim);
bool SetFollowAndRotate(m2::PointD const & userPos, m2::PointD const & pixelPos,
double azimuth, int preferredZoomLevel, bool isAnim);
-
- bool FilterEventWhile3dAnimation(UserEvent::EEventType type) const;
- void SetEnable3dMode(double maxRotationAngle, double angleFOV,
- bool isAnim, bool immediatelyStart);
- void SetDisable3dModeAnimation();
+ void SetAutoPerspective(bool isAutoPerspective);
m2::AnyRectD GetCurrentRect() const;
@@ -348,7 +328,6 @@ private:
void ResetAnimations(Animation::Type animType, bool finishAll = false);
void ResetAnimations(Animation::Type animType, string const & customType, bool finishAll = false);
void ResetMapPlaneAnimations();
- void ResetAnimationsBeforeSwitch3D();
bool InterruptFollowAnimations(bool force);
list<UserEvent> m_events;
@@ -375,7 +354,6 @@ private:
bool m_modelViewChanged = false;
- bool m_perspectiveAnimation = false;
unique_ptr<UserEvent> m_pendingEvent;
ref_ptr<Listener> m_listener;