Added framework::GetViewportCenter()

This commit is contained in:
Alex Zolotarev 2011-09-28 01:03:32 +03:00 committed by Alex Zolotarev
parent 8b7a1163fb
commit 1efd7c8185
3 changed files with 12 additions and 9 deletions

View file

@ -68,7 +68,7 @@ void Framework<TModel>::OnGpsUpdate(location::GpsInfo const & info)
m_centeringMode = ECenterOnly;
}
else if (m_centeringMode == ECenterOnly)
CenterViewport(m_locationState.Position());
SetViewportCenter(m_locationState.Position());
Invalidate();
}
}
@ -385,7 +385,13 @@ void Framework<TModel>::DoPaint(shared_ptr<PaintEvent> const & e)
}
template <typename TModel>
void Framework<TModel>::CenterViewport(m2::PointD const & pt)
m2::PointD Framework<TModel>::GetViewportCenter() const
{
return m_navigator.Screen().GlobalRect().Center();
}
template <typename TModel>
void Framework<TModel>::SetViewportCenter(m2::PointD const & pt)
{
m_navigator.CenterViewport(pt);
Invalidate();

View file

@ -209,6 +209,9 @@ public:
double GetCurrentScale() const;
m2::PointD GetViewportCenter() const;
void SetViewportCenter(m2::PointD const & pt);
bool NeedRedraw() const;
void SetNeedRedraw(bool flag);
@ -218,8 +221,6 @@ public:
virtual void EndPaint(shared_ptr<PaintEvent> const & e);
void CenterViewport(m2::PointD const & pt);
void ShowRect(m2::RectD rect);
void MemoryWarning();

View file

@ -1,11 +1,9 @@
#pragma once
#include "../geometry/screenbase.hpp"
#include "../base/matrix.hpp"
#include "../base/start_mem_debug.hpp"
class FileReader;
template <class> class ReaderSource;
class FileWriter;
@ -101,5 +99,3 @@ private:
// Used in DoScale and ScaleByPoint
bool ScaleImpl(m2::PointD const & newPt1, m2::PointD const & newPt2, m2::PointD const & oldPt1, m2::PointD const & oldPt2, bool skipMaxScaleAndBordersCheck);
};
#include "../base/stop_mem_debug.hpp"