forked from organicmaps/organicmaps-tmp
Review fixes.
This commit is contained in:
parent
3d1cac6b69
commit
ebc163dc8e
7 changed files with 129 additions and 112 deletions
|
@ -44,7 +44,7 @@ public:
|
|||
for (auto const & anim : m_animations)
|
||||
{
|
||||
if ((anim->GetType() == type) &&
|
||||
(customType == nullptr || strcmp(anim->GetCustomType().c_str(), customType) == 0))
|
||||
(customType == nullptr || anim->GetCustomType() == customType))
|
||||
{
|
||||
ASSERT(dynamic_cast<T const *>(anim.get()) != nullptr, ());
|
||||
return static_cast<T const *>(anim.get());
|
||||
|
|
|
@ -36,18 +36,17 @@ public:
|
|||
void CorrectScalePoint(m2::PointD & pt1, m2::PointD & pt2) const override {}
|
||||
void CorrectGlobalScalePoint(m2::PointD & pt) const override {}
|
||||
void OnScaleEnded() override {}
|
||||
void OnAnimationStarted(ref_ptr<df::Animation> /* anim */) override {}
|
||||
void OnTouchMapAction() override {}
|
||||
void OnAnimatedScaleEnded() override {}
|
||||
|
||||
void AddUserEvent(df::TouchEvent const & event)
|
||||
{
|
||||
m_stream.AddEvent(event);
|
||||
m_stream.AddEvent(make_unique_dp<df::TouchEvent>(event));
|
||||
}
|
||||
|
||||
void SetRect(m2::RectD const & r)
|
||||
{
|
||||
m_stream.AddEvent(df::SetRectEvent(r, false, -1, false /* isAnim */));
|
||||
m_stream.AddEvent(make_unique_dp<df::SetRectEvent>(r, false, -1, false /* isAnim */));
|
||||
}
|
||||
|
||||
void AddExpectation(char const * action)
|
||||
|
@ -82,14 +81,20 @@ int touchTimeStamp = 1;
|
|||
df::TouchEvent MakeTouchEvent(m2::PointD const & pt1, m2::PointD const & pt2, df::TouchEvent::ETouchType type)
|
||||
{
|
||||
df::TouchEvent e;
|
||||
e.m_touches[0].m_location = pt1;
|
||||
e.m_touches[0].m_id = 1;
|
||||
e.m_touches[1].m_location = pt2;
|
||||
e.m_touches[1].m_id = 2;
|
||||
e.m_type = type;
|
||||
df::Touch t1;
|
||||
t1.m_location = pt1;
|
||||
t1.m_id = 1;
|
||||
e.SetFirstTouch(t1);
|
||||
|
||||
df::Touch t2;
|
||||
t2.m_location = pt2;
|
||||
t2.m_id = 2;
|
||||
e.SetSecondTouch(t2);
|
||||
|
||||
e.SetTouchType(type);
|
||||
e.SetFirstMaskedPointer(0);
|
||||
e.SetSecondMaskedPointer(1);
|
||||
e.m_timeStamp = touchTimeStamp++;
|
||||
e.SetTimeStamp(touchTimeStamp++);
|
||||
|
||||
return e;
|
||||
}
|
||||
|
@ -97,11 +102,15 @@ df::TouchEvent MakeTouchEvent(m2::PointD const & pt1, m2::PointD const & pt2, df
|
|||
df::TouchEvent MakeTouchEvent(m2::PointD const & pt, df::TouchEvent::ETouchType type)
|
||||
{
|
||||
df::TouchEvent e;
|
||||
e.m_touches[0].m_location = pt;
|
||||
e.m_touches[0].m_id = 1;
|
||||
e.m_type = type;
|
||||
|
||||
df::Touch t1;
|
||||
t1.m_location = pt;
|
||||
t1.m_id = 1;
|
||||
e.SetFirstTouch(t1);
|
||||
|
||||
e.SetTouchType(type);
|
||||
e.SetFirstMaskedPointer(0);
|
||||
e.m_timeStamp = touchTimeStamp++;
|
||||
e.SetTimeStamp(touchTimeStamp++);
|
||||
|
||||
return e;
|
||||
}
|
||||
|
|
|
@ -1401,10 +1401,6 @@ void FrontendRenderer::OnAnimatedScaleEnded()
|
|||
PullToBoundArea(false /* randomPlace */, false /* applyZoom */);
|
||||
}
|
||||
|
||||
void FrontendRenderer::OnAnimationStarted(ref_ptr<Animation> anim)
|
||||
{
|
||||
}
|
||||
|
||||
void FrontendRenderer::OnTouchMapAction()
|
||||
{
|
||||
m_myPositionController->ResetRoutingNotFollowTimer();
|
||||
|
@ -1608,30 +1604,30 @@ void FrontendRenderer::PositionChanged(m2::PointD const & position)
|
|||
m_userPositionChangedFn(position);
|
||||
}
|
||||
|
||||
void FrontendRenderer::ChangeModelView(m2::PointD const & center, int zoomLevel, TAnimationCreator parallelAnimCreator)
|
||||
void FrontendRenderer::ChangeModelView(m2::PointD const & center, int zoomLevel, TAnimationCreator const & parallelAnimCreator)
|
||||
{
|
||||
AddUserEvent(make_unique_dp<SetCenterEvent>(center, zoomLevel, true, parallelAnimCreator));
|
||||
}
|
||||
|
||||
void FrontendRenderer::ChangeModelView(double azimuth, TAnimationCreator parallelAnimCreator)
|
||||
void FrontendRenderer::ChangeModelView(double azimuth, TAnimationCreator const & parallelAnimCreator)
|
||||
{
|
||||
AddUserEvent(make_unique_dp<RotateEvent>(azimuth, parallelAnimCreator));
|
||||
}
|
||||
|
||||
void FrontendRenderer::ChangeModelView(m2::RectD const & rect, TAnimationCreator parallelAnimCreator)
|
||||
void FrontendRenderer::ChangeModelView(m2::RectD const & rect, TAnimationCreator const & parallelAnimCreator)
|
||||
{
|
||||
AddUserEvent(make_unique_dp<SetRectEvent>(rect, true, kDoNotChangeZoom, true, parallelAnimCreator));
|
||||
}
|
||||
|
||||
void FrontendRenderer::ChangeModelView(m2::PointD const & userPos, double azimuth,
|
||||
m2::PointD const & pxZero, int preferredZoomLevel,
|
||||
TAnimationCreator parallelAnimCreator)
|
||||
TAnimationCreator const & parallelAnimCreator)
|
||||
{
|
||||
AddUserEvent(make_unique_dp<FollowAndRotateEvent>(userPos, pxZero, azimuth, preferredZoomLevel, true, parallelAnimCreator));
|
||||
}
|
||||
|
||||
void FrontendRenderer::ChangeModelView(double autoScale, m2::PointD const & userPos, double azimuth, m2::PointD const & pxZero,
|
||||
TAnimationCreator parallelAnimCreator)
|
||||
TAnimationCreator const & parallelAnimCreator)
|
||||
{
|
||||
AddUserEvent(make_unique_dp<FollowAndRotateEvent>(userPos, pxZero, azimuth, autoScale, parallelAnimCreator));
|
||||
}
|
||||
|
|
|
@ -140,13 +140,13 @@ public:
|
|||
|
||||
/// MyPositionController::Listener
|
||||
void PositionChanged(m2::PointD const & position) override;
|
||||
void ChangeModelView(m2::PointD const & center, int zoomLevel, TAnimationCreator parallelAnimCreator) override;
|
||||
void ChangeModelView(double azimuth, TAnimationCreator parallelAnimCreator) override;
|
||||
void ChangeModelView(m2::RectD const & rect, TAnimationCreator parallelAnimCreator) override;
|
||||
void ChangeModelView(m2::PointD const & userPos, double azimuth,
|
||||
m2::PointD const & pxZero, int preferredZoomLevel, TAnimationCreator parallelAnimCreator) override;
|
||||
void ChangeModelView(m2::PointD const & center, int zoomLevel, TAnimationCreator const & parallelAnimCreator) override;
|
||||
void ChangeModelView(double azimuth, TAnimationCreator const & parallelAnimCreator) override;
|
||||
void ChangeModelView(m2::RectD const & rect, TAnimationCreator const & parallelAnimCreator) override;
|
||||
void ChangeModelView(m2::PointD const & userPos, double azimuth, m2::PointD const & pxZero,
|
||||
int preferredZoomLevel, TAnimationCreator const & parallelAnimCreator) override;
|
||||
void ChangeModelView(double autoScale, m2::PointD const & userPos, double azimuth, m2::PointD const & pxZero,
|
||||
TAnimationCreator parallelAnimCreator) override;
|
||||
TAnimationCreator const & parallelAnimCreator) override;
|
||||
|
||||
protected:
|
||||
void AcceptMessage(ref_ptr<Message> message) override;
|
||||
|
@ -198,7 +198,6 @@ private:
|
|||
void CorrectGlobalScalePoint(m2::PointD & pt) const override;
|
||||
void OnScaleEnded() override;
|
||||
void OnAnimatedScaleEnded() override;
|
||||
void OnAnimationStarted(ref_ptr<Animation> anim) override;
|
||||
void OnTouchMapAction() override;
|
||||
|
||||
class Routine : public threads::IRoutine
|
||||
|
|
|
@ -28,16 +28,16 @@ public:
|
|||
virtual ~Listener() {}
|
||||
virtual void PositionChanged(m2::PointD const & position) = 0;
|
||||
/// Show map with center in "center" point and current zoom
|
||||
virtual void ChangeModelView(m2::PointD const & center, int zoomLevel, TAnimationCreator parallelAnimCreator) = 0;
|
||||
virtual void ChangeModelView(m2::PointD const & center, int zoomLevel, TAnimationCreator const & parallelAnimCreator) = 0;
|
||||
/// Change azimuth of current ModelView
|
||||
virtual void ChangeModelView(double azimuth, TAnimationCreator parallelAnimCreator) = 0;
|
||||
virtual void ChangeModelView(double azimuth, TAnimationCreator const & parallelAnimCreator) = 0;
|
||||
/// Somehow show map that "rect" will see
|
||||
virtual void ChangeModelView(m2::RectD const & rect, TAnimationCreator parallelAnimCreator) = 0;
|
||||
virtual void ChangeModelView(m2::RectD const & rect, TAnimationCreator const & parallelAnimCreator) = 0;
|
||||
/// Show map where "usePos" (mercator) placed in "pxZero" on screen and map rotated around "userPos"
|
||||
virtual void ChangeModelView(m2::PointD const & userPos, double azimuth, m2::PointD const & pxZero,
|
||||
int zoomLevel, TAnimationCreator parallelAnimCreator) = 0;
|
||||
virtual void ChangeModelView(double autoScale,
|
||||
m2::PointD const & userPos, double azimuth, m2::PointD const & pxZero, TAnimationCreator parallelAnimCreator) = 0;
|
||||
int zoomLevel, TAnimationCreator const & parallelAnimCreator) = 0;
|
||||
virtual void ChangeModelView(double autoScale, m2::PointD const & userPos, double azimuth, m2::PointD const & pxZero,
|
||||
TAnimationCreator const & parallelAnimCreator) = 0;
|
||||
};
|
||||
|
||||
MyPositionController(location::EMyPositionMode initMode, double timeInBackground,
|
||||
|
|
|
@ -167,14 +167,14 @@ ScreenBase const & UserEventStream::ProcessEvents(bool & modelViewChanged, bool
|
|||
|
||||
switch (e->GetType())
|
||||
{
|
||||
case UserEvent::Scale:
|
||||
case UserEvent::EventType::Scale:
|
||||
{
|
||||
ref_ptr<ScaleEvent> scaleEvent = make_ref(e);
|
||||
breakAnim = SetScale(scaleEvent->GetPxPoint(), scaleEvent->GetFactor(), scaleEvent->IsAnim());
|
||||
breakAnim = OnSetScale(scaleEvent);
|
||||
TouchCancel(m_touches);
|
||||
}
|
||||
break;
|
||||
case UserEvent::Resize:
|
||||
case UserEvent::EventType::Resize:
|
||||
{
|
||||
ref_ptr<ResizeEvent> resizeEvent = make_ref(e);
|
||||
m_navigator.OnSize(resizeEvent->GetWidth(), resizeEvent->GetHeight());
|
||||
|
@ -184,66 +184,50 @@ ScreenBase const & UserEventStream::ProcessEvents(bool & modelViewChanged, bool
|
|||
EndDoubleTapAndHold(m_touches[0]);
|
||||
}
|
||||
break;
|
||||
case UserEvent::SetAnyRect:
|
||||
case UserEvent::EventType::SetAnyRect:
|
||||
{
|
||||
ref_ptr<SetAnyRectEvent> anyRectEvent = make_ref(e);
|
||||
breakAnim = SetRect(anyRectEvent->GetRect(), anyRectEvent->IsAnim());
|
||||
breakAnim = OnSetAnyRect(anyRectEvent);
|
||||
TouchCancel(m_touches);
|
||||
}
|
||||
break;
|
||||
case UserEvent::SetRect:
|
||||
case UserEvent::EventType::SetRect:
|
||||
{
|
||||
ref_ptr<SetRectEvent> rectEvent = make_ref(e);
|
||||
breakAnim = SetRect(rectEvent->GetRect(), rectEvent->GetZoom(),
|
||||
rectEvent->GetApplyRotation(), rectEvent->IsAnim(),
|
||||
rectEvent->GetParallelAnimCreator());
|
||||
breakAnim = OnSetRect(rectEvent);
|
||||
TouchCancel(m_touches);
|
||||
}
|
||||
break;
|
||||
case UserEvent::SetCenter:
|
||||
case UserEvent::EventType::SetCenter:
|
||||
{
|
||||
ref_ptr<SetCenterEvent> centerEvent = make_ref(e);
|
||||
breakAnim = SetCenter(centerEvent->GetCenter(), centerEvent->GetZoom(), centerEvent->IsAnim(),
|
||||
centerEvent->GetParallelAnimCreator());
|
||||
breakAnim = OnSetCenter(centerEvent);
|
||||
TouchCancel(m_touches);
|
||||
}
|
||||
break;
|
||||
case UserEvent::EventTouch:
|
||||
case UserEvent::EventType::Touch:
|
||||
{
|
||||
ref_ptr<TouchEvent> touchEvent = make_ref(e);
|
||||
breakAnim = ProcessTouch(*touchEvent.get());
|
||||
}
|
||||
break;
|
||||
case UserEvent::Rotate:
|
||||
case UserEvent::EventType::Rotate:
|
||||
{
|
||||
ref_ptr<RotateEvent> rotateEvent = make_ref(e);
|
||||
ScreenBase const & screen = m_navigator.Screen();
|
||||
if (screen.isPerspective())
|
||||
{
|
||||
m2::PointD pt = screen.PixelRectIn3d().Center();
|
||||
breakAnim = SetFollowAndRotate(screen.PtoG(screen.P3dtoP(pt)), pt,
|
||||
rotateEvent->GetTargetAzimuth(), kDoNotChangeZoom, kDoNotAutoZoom,
|
||||
true /* isAnim */, false /* isAutoScale */,
|
||||
rotateEvent->GetParallelAnimCreator());
|
||||
}
|
||||
else
|
||||
{
|
||||
m2::AnyRectD dstRect = GetTargetRect();
|
||||
dstRect.SetAngle(rotateEvent->GetTargetAzimuth());
|
||||
breakAnim = SetRect(dstRect, true, rotateEvent->GetParallelAnimCreator());
|
||||
}
|
||||
breakAnim = OnRotate(rotateEvent);
|
||||
}
|
||||
break;
|
||||
case UserEvent::FollowAndRotate:
|
||||
case UserEvent::EventType::FollowAndRotate:
|
||||
{
|
||||
ref_ptr<FollowAndRotateEvent> followEvent = make_ref(e);
|
||||
|
||||
breakAnim = SetFollowAndRotate(followEvent->GetUserPos(), followEvent->GetPixelZero(),
|
||||
followEvent->GetAzimuth(), followEvent->GetPreferredZoomLelel(),
|
||||
followEvent->GetAutoScale(), followEvent->IsAnim(), followEvent->IsAutoScale(),
|
||||
followEvent->GetParallelAnimCreator());
|
||||
}
|
||||
break;
|
||||
case UserEvent::AutoPerspective:
|
||||
case UserEvent::EventType::AutoPerspective:
|
||||
{
|
||||
ref_ptr<SetAutoPerspectiveEvent> perspectiveEvent = make_ref(e);
|
||||
SetAutoPerspective(perspectiveEvent->IsAutoPerspective());
|
||||
|
@ -297,13 +281,15 @@ ScreenBase const & UserEventStream::GetCurrentScreen() const
|
|||
return m_navigator.Screen();
|
||||
}
|
||||
|
||||
bool UserEventStream::SetScale(m2::PointD const & pxScaleCenter, double factor, bool isAnim)
|
||||
bool UserEventStream::OnSetScale(ref_ptr<ScaleEvent> scaleEvent)
|
||||
{
|
||||
m2::PointD scaleCenter = pxScaleCenter;
|
||||
double factor = scaleEvent->GetFactor();
|
||||
|
||||
m2::PointD scaleCenter = scaleEvent->GetPxPoint();
|
||||
if (m_listener)
|
||||
m_listener->CorrectScalePoint(scaleCenter);
|
||||
|
||||
if (isAnim)
|
||||
if (scaleEvent->IsAnim())
|
||||
{
|
||||
auto followAnim = m_animationSystem.FindAnimation<MapFollowAnimation>(Animation::MapFollow);
|
||||
if (followAnim == nullptr)
|
||||
|
@ -349,9 +335,24 @@ bool UserEventStream::SetScale(m2::PointD const & pxScaleCenter, double factor,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool UserEventStream::SetCenter(m2::PointD const & center, int zoom, bool isAnim, TAnimationCreator parallelAnimCreator)
|
||||
bool UserEventStream::OnSetAnyRect(ref_ptr<SetAnyRectEvent> anyRectEvent)
|
||||
{
|
||||
return SetRect(anyRectEvent->GetRect(), anyRectEvent->IsAnim());
|
||||
}
|
||||
|
||||
bool UserEventStream::OnSetRect(ref_ptr<SetRectEvent> rectEvent)
|
||||
{
|
||||
return SetRect(rectEvent->GetRect(), rectEvent->GetZoom(), rectEvent->GetApplyRotation(), rectEvent->IsAnim(),
|
||||
rectEvent->GetParallelAnimCreator());
|
||||
}
|
||||
|
||||
bool UserEventStream::OnSetCenter(ref_ptr<SetCenterEvent> centerEvent)
|
||||
{
|
||||
m2::PointD const & center = centerEvent->GetCenter();
|
||||
double zoom = centerEvent->GetZoom();
|
||||
|
||||
ScreenBase screen = GetCurrentScreen();
|
||||
|
||||
if (zoom == kDoNotChangeZoom)
|
||||
{
|
||||
GetTargetScreen(screen);
|
||||
|
@ -365,7 +366,24 @@ bool UserEventStream::SetCenter(m2::PointD const & center, int zoom, bool isAnim
|
|||
|
||||
ShrinkAndScaleInto(screen, df::GetWorldRect());
|
||||
|
||||
return SetScreen(screen, isAnim, parallelAnimCreator);
|
||||
return SetScreen(screen, centerEvent->IsAnim(), centerEvent->GetParallelAnimCreator());
|
||||
}
|
||||
|
||||
bool UserEventStream::OnRotate(ref_ptr<RotateEvent> rotateEvent)
|
||||
{
|
||||
ScreenBase const & screen = m_navigator.Screen();
|
||||
if (screen.isPerspective())
|
||||
{
|
||||
m2::PointD pt = screen.PixelRectIn3d().Center();
|
||||
return SetFollowAndRotate(screen.PtoG(screen.P3dtoP(pt)), pt,
|
||||
rotateEvent->GetTargetAzimuth(), kDoNotChangeZoom, kDoNotAutoZoom,
|
||||
true /* isAnim */, false /* isAutoScale */,
|
||||
rotateEvent->GetParallelAnimCreator());
|
||||
}
|
||||
|
||||
m2::AnyRectD dstRect = GetTargetRect();
|
||||
dstRect.SetAngle(rotateEvent->GetTargetAzimuth());
|
||||
return SetRect(dstRect, true, rotateEvent->GetParallelAnimCreator());
|
||||
}
|
||||
|
||||
bool UserEventStream::SetRect(m2::RectD rect, int zoom, bool applyRotation, bool isAnim, TAnimationCreator parallelAnimCreator)
|
||||
|
@ -376,6 +394,15 @@ bool UserEventStream::SetRect(m2::RectD rect, int zoom, bool applyRotation, bool
|
|||
return SetRect(targetRect, isAnim, parallelAnimCreator);
|
||||
}
|
||||
|
||||
bool UserEventStream::SetRect(m2::AnyRectD const & rect, bool isAnim, TAnimationCreator parallelAnimCreator)
|
||||
{
|
||||
ScreenBase tmp = GetCurrentScreen();
|
||||
tmp.SetFromRects(rect, tmp.PixelRectIn3d());
|
||||
tmp.MatchGandP3d(rect.GlobalCenter(), tmp.PixelRectIn3d().Center());
|
||||
|
||||
return SetScreen(tmp, isAnim, parallelAnimCreator);
|
||||
}
|
||||
|
||||
bool UserEventStream::SetScreen(ScreenBase const & endScreen, bool isAnim, TAnimationCreator parallelAnimCreator)
|
||||
{
|
||||
if (isAnim)
|
||||
|
@ -415,15 +442,6 @@ bool UserEventStream::SetScreen(ScreenBase const & endScreen, bool isAnim, TAnim
|
|||
return true;
|
||||
}
|
||||
|
||||
bool UserEventStream::SetRect(m2::AnyRectD const & rect, bool isAnim, TAnimationCreator parallelAnimCreator)
|
||||
{
|
||||
ScreenBase tmp = GetCurrentScreen();
|
||||
tmp.SetFromRects(rect, tmp.PixelRectIn3d());
|
||||
tmp.MatchGandP3d(rect.GlobalCenter(), tmp.PixelRectIn3d().Center());
|
||||
|
||||
return SetScreen(tmp, isAnim, parallelAnimCreator);
|
||||
}
|
||||
|
||||
bool UserEventStream::InterruptFollowAnimations(bool force)
|
||||
{
|
||||
Animation const * followAnim = m_animationSystem.FindAnimation<MapFollowAnimation>(Animation::MapFollow);
|
||||
|
@ -925,14 +943,7 @@ bool UserEventStream::EndDrag(Touch const & t, bool cancelled)
|
|||
{
|
||||
drape_ptr<Animation> anim = m_scroller.CreateKineticAnimation(m_navigator.Screen());
|
||||
if (anim != nullptr)
|
||||
{
|
||||
anim->SetOnStartAction([this](ref_ptr<Animation> animation)
|
||||
{
|
||||
if (m_listener)
|
||||
m_listener->OnAnimationStarted(animation);
|
||||
});
|
||||
m_animationSystem.CombineAnimation(move(anim));
|
||||
}
|
||||
m_scroller.CancelGrab();
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -28,9 +28,9 @@ using TAnimationCreator = function<drape_ptr<Animation>(double)>;
|
|||
class UserEvent
|
||||
{
|
||||
public:
|
||||
enum EEventType
|
||||
enum class EventType
|
||||
{
|
||||
EventTouch,
|
||||
Touch,
|
||||
Scale,
|
||||
SetCenter,
|
||||
SetRect,
|
||||
|
@ -42,7 +42,7 @@ public:
|
|||
};
|
||||
|
||||
virtual ~UserEvent() {}
|
||||
virtual EEventType GetType() const = 0;
|
||||
virtual EventType GetType() const = 0;
|
||||
};
|
||||
|
||||
struct Touch
|
||||
|
@ -72,12 +72,13 @@ public:
|
|||
|
||||
static uint8_t const INVALID_MASKED_POINTER;
|
||||
|
||||
EEventType GetType() const override { return UserEvent::EventTouch; }
|
||||
EventType GetType() const override { return UserEvent::EventType::Touch; }
|
||||
|
||||
ETouchType GetTouchType() const { return m_type; }
|
||||
void SetTouchType(ETouchType touchType) { m_type = touchType; }
|
||||
|
||||
double GetTimeStamp() const { return m_timeStamp; }
|
||||
void SetTimeStamp(double timeStamp) { m_timeStamp = timeStamp; }
|
||||
|
||||
array<Touch, 2> const & GetTouches() const { return m_touches; }
|
||||
|
||||
|
@ -121,7 +122,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
EEventType GetType() const override { return UserEvent::Scale; }
|
||||
EventType GetType() const override { return UserEvent::EventType::Scale; }
|
||||
|
||||
double GetFactor() const { return m_factor; }
|
||||
m2::PointD const & GetPxPoint() const { return m_pxPoint; }
|
||||
|
@ -137,7 +138,7 @@ class SetCenterEvent : public UserEvent
|
|||
{
|
||||
public:
|
||||
SetCenterEvent(m2::PointD const & center, int zoom, bool isAnim,
|
||||
TAnimationCreator parallelAnimCreator = nullptr)
|
||||
TAnimationCreator const & parallelAnimCreator = nullptr)
|
||||
: m_center(center)
|
||||
, m_zoom(zoom)
|
||||
, m_isAnim(isAnim)
|
||||
|
@ -145,7 +146,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
EEventType GetType() const override { return UserEvent::SetCenter; }
|
||||
EventType GetType() const override { return UserEvent::EventType::SetCenter; }
|
||||
|
||||
m2::PointD const & GetCenter() const { return m_center; }
|
||||
int GetZoom() const { return m_zoom; }
|
||||
|
@ -163,7 +164,7 @@ class SetRectEvent : public UserEvent
|
|||
{
|
||||
public:
|
||||
SetRectEvent(m2::RectD const & rect, bool rotate, int zoom, bool isAnim,
|
||||
TAnimationCreator parallelAnimCreator = nullptr)
|
||||
TAnimationCreator const & parallelAnimCreator = nullptr)
|
||||
: m_rect(rect)
|
||||
, m_applyRotation(rotate)
|
||||
, m_zoom(zoom)
|
||||
|
@ -172,7 +173,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
EEventType GetType() const override { return UserEvent::SetRect; }
|
||||
EventType GetType() const override { return UserEvent::EventType::SetRect; }
|
||||
|
||||
m2::RectD const & GetRect() const { return m_rect; }
|
||||
bool GetApplyRotation() const { return m_applyRotation; }
|
||||
|
@ -196,7 +197,7 @@ public:
|
|||
, m_isAnim(isAnim)
|
||||
{}
|
||||
|
||||
EEventType GetType() const override { return UserEvent::SetAnyRect; }
|
||||
EventType GetType() const override { return UserEvent::EventType::SetAnyRect; }
|
||||
|
||||
m2::AnyRectD const & GetRect() const { return m_rect; }
|
||||
bool IsAnim() const { return m_isAnim; }
|
||||
|
@ -210,7 +211,7 @@ class FollowAndRotateEvent : public UserEvent
|
|||
{
|
||||
public:
|
||||
FollowAndRotateEvent(m2::PointD const & userPos, m2::PointD const & pixelZero,
|
||||
double azimuth, double autoScale, TAnimationCreator parallelAnimCreator = nullptr)
|
||||
double azimuth, double autoScale, TAnimationCreator const & parallelAnimCreator = nullptr)
|
||||
: m_userPos(userPos)
|
||||
, m_pixelZero(pixelZero)
|
||||
, m_azimuth(azimuth)
|
||||
|
@ -224,7 +225,7 @@ public:
|
|||
|
||||
FollowAndRotateEvent(m2::PointD const & userPos, m2::PointD const & pixelZero,
|
||||
double azimuth, int preferredZoomLevel,
|
||||
bool isAnim, TAnimationCreator parallelAnimCreator = nullptr)
|
||||
bool isAnim, TAnimationCreator const & parallelAnimCreator = nullptr)
|
||||
: m_userPos(userPos)
|
||||
, m_pixelZero(pixelZero)
|
||||
, m_azimuth(azimuth)
|
||||
|
@ -235,7 +236,7 @@ public:
|
|||
, m_parallelAnimCreator(parallelAnimCreator)
|
||||
{}
|
||||
|
||||
EEventType GetType() const override { return UserEvent::FollowAndRotate; }
|
||||
EventType GetType() const override { return UserEvent::EventType::FollowAndRotate; }
|
||||
|
||||
m2::PointD const & GetUserPos() const { return m_userPos; }
|
||||
m2::PointD const & GetPixelZero() const { return m_pixelZero; }
|
||||
|
@ -264,7 +265,7 @@ public:
|
|||
: m_isAutoPerspective(isAutoPerspective)
|
||||
{}
|
||||
|
||||
EEventType GetType() const override { return UserEvent::AutoPerspective; }
|
||||
EventType GetType() const override { return UserEvent::EventType::AutoPerspective; }
|
||||
|
||||
bool IsAutoPerspective() const { return m_isAutoPerspective; }
|
||||
|
||||
|
@ -275,12 +276,12 @@ private:
|
|||
class RotateEvent : public UserEvent
|
||||
{
|
||||
public:
|
||||
RotateEvent(double targetAzimut, TAnimationCreator parallelAnimCreator = nullptr)
|
||||
RotateEvent(double targetAzimut, TAnimationCreator const & parallelAnimCreator = nullptr)
|
||||
: m_targetAzimut(targetAzimut)
|
||||
, m_parallelAnimCreator(parallelAnimCreator)
|
||||
{}
|
||||
|
||||
EEventType GetType() const override { return UserEvent::Rotate; }
|
||||
EventType GetType() const override { return UserEvent::EventType::Rotate; }
|
||||
|
||||
double GetTargetAzimuth() const { return m_targetAzimut; }
|
||||
TAnimationCreator const & GetParallelAnimCreator() const { return m_parallelAnimCreator; }
|
||||
|
@ -295,7 +296,7 @@ class ResizeEvent : public UserEvent
|
|||
public:
|
||||
ResizeEvent(uint32_t w, uint32_t h) : m_width(w), m_height(h) {}
|
||||
|
||||
EEventType GetType() const override { return UserEvent::Resize; }
|
||||
EventType GetType() const override { return UserEvent::EventType::Resize; }
|
||||
|
||||
uint32_t GetWidth() const { return m_width; }
|
||||
uint32_t GetHeight() const { return m_height; }
|
||||
|
@ -329,8 +330,6 @@ public:
|
|||
virtual void OnScaleEnded() = 0;
|
||||
virtual void OnAnimatedScaleEnded() = 0;
|
||||
|
||||
virtual void OnAnimationStarted(ref_ptr<Animation> anim) = 0;
|
||||
|
||||
virtual void OnTouchMapAction() = 0;
|
||||
};
|
||||
|
||||
|
@ -373,13 +372,16 @@ public:
|
|||
#endif
|
||||
|
||||
private:
|
||||
bool SetScale(m2::PointD const & pxScaleCenter, double factor, bool isAnim);
|
||||
bool SetCenter(m2::PointD const & center, int zoom, bool isAnim,
|
||||
TAnimationCreator parallelAnimCreator = nullptr);
|
||||
bool OnSetScale(ref_ptr<ScaleEvent> scaleEvent);
|
||||
bool OnSetAnyRect(ref_ptr<SetAnyRectEvent> anyRectEvent);
|
||||
bool OnSetRect(ref_ptr<SetRectEvent> rectEvent);
|
||||
bool OnSetCenter(ref_ptr<SetCenterEvent> centerEvent);
|
||||
bool OnRotate(ref_ptr<RotateEvent> rotateEvent);
|
||||
|
||||
bool SetRect(m2::RectD rect, int zoom, bool applyRotation, bool isAnim,
|
||||
TAnimationCreator parallelAnimCreator = nullptr);
|
||||
bool SetRect(m2::AnyRectD const & rect, bool isAnim,
|
||||
TAnimationCreator parallelAnimCreator = nullptr);
|
||||
bool SetRect(m2::AnyRectD const & rect, bool isAnim, TAnimationCreator parallelAnimCreator = nullptr);
|
||||
|
||||
bool SetScreen(ScreenBase const & screen, bool isAnim,
|
||||
TAnimationCreator parallelAnimCreator = nullptr);
|
||||
bool SetFollowAndRotate(m2::PointD const & userPos, m2::PointD const & pixelPos,
|
||||
|
|
Loading…
Add table
Reference in a new issue