Do ChangeViewportTask according to our common rules (9 zoom when no country under viewport).

This commit is contained in:
vng 2013-07-19 18:09:09 +03:00 committed by Alex Zolotarev
parent 22bf903382
commit 6415731b34
4 changed files with 13 additions and 19 deletions

View file

@ -4,25 +4,22 @@
ChangeViewportTask::ChangeViewportTask(m2::AnyRectD const & startRect,
m2::AnyRectD const & endRect,
double rotationSpeed,
Framework *framework)
: anim::AnyRectInterpolation(startRect,
endRect,
rotationSpeed,
m_outRect),
Framework * framework)
: BaseT(startRect, endRect, rotationSpeed, m_outRect),
m_framework(framework)
{
}
void ChangeViewportTask::OnStep(double ts)
{
anim::AnyRectInterpolation::OnStep(ts);
m_framework->GetNavigator().SetFromRect(m_outRect);
BaseT::OnStep(ts);
m_framework->ShowRectExVisibleScale(m_outRect.GetGlobalRect());
}
void ChangeViewportTask::OnEnd(double ts)
{
anim::AnyRectInterpolation::OnEnd(ts);
m_framework->GetNavigator().SetFromRect(m_outRect);
BaseT::OnEnd(ts);
m_framework->ShowRectExVisibleScale(m_outRect.GetGlobalRect());
}
bool ChangeViewportTask::IsVisual() const

View file

@ -6,7 +6,7 @@ class Framework;
class ChangeViewportTask : public anim::AnyRectInterpolation
{
private:
typedef anim::AnyRectInterpolation BaseT;
Framework * m_framework;
m2::AnyRectD m_outRect;

View file

@ -1379,7 +1379,7 @@ bool Framework::SetViewportByURL(string const & url, url_scheme::ApiPoint & ball
balloonPoint.m_name = m_stringsBundle.GetString("dropped_pin");
balloonPoint.m_lat = info.m_lat;
balloonPoint.m_lon = info.m_lon;
SetViewPortSync(info.GetViewport());
SetViewPortASync(info.GetViewport());
return true;
}
}
@ -1394,7 +1394,7 @@ bool Framework::SetViewportByURL(string const & url, url_scheme::ApiPoint & ball
balloonPoint.m_name = m_stringsBundle.GetString("dropped_pin");
m2::PointD const center(MercatorBounds::LonToX(balloonPoint.m_lon), MercatorBounds::LatToY(balloonPoint.m_lat));
SetViewPortSync(m_scales.GetRectForDrawScale(zoomLevel, center));
SetViewPortASync(m_scales.GetRectForDrawScale(zoomLevel, center));
return true;
}
}
@ -1404,7 +1404,7 @@ bool Framework::SetViewportByURL(string const & url, url_scheme::ApiPoint & ball
{
StopLocationFollow();
// Can do better consider nav bar size
SetViewPortSync(MercatorBounds::FromLatLonRect(m_ParsedMapApi.GetLatLonRect()));
SetViewPortASync(MercatorBounds::FromLatLonRect(m_ParsedMapApi.GetLatLonRect()));
if (!m_ParsedMapApi.GetPoints().empty())
{
@ -1416,12 +1416,9 @@ bool Framework::SetViewportByURL(string const & url, url_scheme::ApiPoint & ball
return false;
}
void Framework::SetViewPortSync(m2::RectD rect)
void Framework::SetViewPortASync(m2::RectD const & r)
{
CheckMinMaxVisibleScale(rect);
m2::AnyRectD aRect(rect);
CheckMinGlobalRect(aRect);
m2::AnyRectD const aRect(r);
m_animator.ChangeViewport(aRect, aRect, 0.0);
}

View file

@ -442,7 +442,7 @@ public:
private:
url_scheme::ParsedMapApi m_ParsedMapApi;
void DrawMapApiPoints(shared_ptr<PaintEvent> const & e);
void SetViewPortSync(m2::RectD rect);
void SetViewPortASync(m2::RectD const & rect);
public:
void MapApiSetUriAndParse(string const & url);