forked from organicmaps/organicmaps
[ios] Repositioned ruler and coordinates
This commit is contained in:
parent
d0bf1ede5a
commit
6bd6e4baaa
2 changed files with 17 additions and 18 deletions
|
@ -25,8 +25,10 @@
|
|||
#include "../std/iomanip.hpp"
|
||||
#include "../std/target_os.hpp"
|
||||
|
||||
#define DEFAULT_FONT_SIZE 11
|
||||
|
||||
InformationDisplay::InformationDisplay(Framework * framework)
|
||||
: m_ruler(Ruler::Params()),
|
||||
: m_fontDesc(DEFAULT_FONT_SIZE), m_ruler(Ruler::Params()),
|
||||
m_bottomShift(0)
|
||||
{
|
||||
CountryStatusDisplay::Params p;
|
||||
|
@ -75,8 +77,6 @@ InformationDisplay::InformationDisplay(Framework * framework)
|
|||
|
||||
for (int i = 0; i < sizeof(m_DebugPts) / sizeof(m2::PointD); ++i)
|
||||
m_DebugPts[i] = m2::PointD(0, 0);
|
||||
|
||||
m_fontDesc = yg::FontDesc(12);
|
||||
}
|
||||
|
||||
void InformationDisplay::setController(gui::Controller *controller)
|
||||
|
@ -151,17 +151,16 @@ void InformationDisplay::drawRuler(DrawerYG * pDrawer)
|
|||
m_ruler.setVisualScale(m_visualScale);
|
||||
|
||||
#if defined(OMIM_OS_IPHONE)
|
||||
m2::PointD pivot(m2::PointD(m_displayRect.maxX(),
|
||||
m_displayRect.maxY() - 20 * m_visualScale)
|
||||
+ m2::PointD(-10 * m_visualScale, - 10 * m_visualScale));
|
||||
m2::PointD const pivot(m2::PointD(m_displayRect.maxX() - 5 * m_visualScale,
|
||||
m_displayRect.maxY() - 5 * m_visualScale));
|
||||
m_ruler.setPosition(yg::EPosAboveLeft);
|
||||
#elif defined(OMIM_OS_ANDROID)
|
||||
m2::PointD pivot(m2::PointD(m_displayRect.maxX(),
|
||||
m2::PointD const pivot(m2::PointD(m_displayRect.maxX(),
|
||||
m_displayRect.maxY() - 20 * m_visualScale)
|
||||
+ m2::PointD(-10 * m_visualScale, - 10 * m_visualScale));
|
||||
m_ruler.setPosition(yg::EPosAboveLeft);
|
||||
#else
|
||||
m2::PointD pivot(m2::PointD(m_displayRect.minX(),
|
||||
m2::PointD const pivot(m2::PointD(m_displayRect.minX(),
|
||||
m_displayRect.maxY() - m_bottomShift * m_visualScale)
|
||||
+ m2::PointD(10 * m_visualScale, -10 * m_visualScale));
|
||||
|
||||
|
@ -177,7 +176,7 @@ void InformationDisplay::setVisualScale(double visualScale)
|
|||
{
|
||||
m_visualScale = visualScale;
|
||||
|
||||
m_fontDesc.m_size = static_cast<uint32_t>(12 * visualScale);
|
||||
m_fontDesc.m_size = static_cast<uint32_t>(DEFAULT_FONT_SIZE * visualScale);
|
||||
}
|
||||
|
||||
void InformationDisplay::enableCenter(bool doEnable)
|
||||
|
@ -205,8 +204,8 @@ void InformationDisplay::drawCenter(DrawerYG * drawer)
|
|||
params.m_log2vis = false;
|
||||
|
||||
#if defined(OMIM_OS_IPHONE)
|
||||
params.m_pivot = m2::PointD(m_displayRect.maxX() - 10 * m_visualScale,
|
||||
m_displayRect.maxY() - 10 * m_visualScale);
|
||||
params.m_pivot = m2::PointD(m_displayRect.maxX() - 3 * m_visualScale,
|
||||
m_displayRect.maxY() - 22 * m_visualScale);
|
||||
params.m_position = yg::EPosAboveLeft;
|
||||
#elif defined(OMIM_OS_ANDROID)
|
||||
params.m_pivot = m2::PointD(m_displayRect.maxX() - 10 * m_visualScale,
|
||||
|
|
|
@ -203,22 +203,22 @@ void Ruler::update()
|
|||
{
|
||||
m2::PointD glbPivot = m_screen.PtoG(pivot());
|
||||
|
||||
int rulerHeight = static_cast<int>(7 * m_visualScale);
|
||||
int rulerHeight = static_cast<int>(3 * m_visualScale);
|
||||
unsigned minPxWidth = static_cast<unsigned>(m_minPxWidth * m_visualScale);
|
||||
|
||||
m2::PointD pt0 = m_screen.PtoG(pivot() - m2::PointD(minPxWidth / 2, 0));
|
||||
m2::PointD pt1 = m_screen.PtoG(pivot() + m2::PointD(minPxWidth / 2, 0));
|
||||
|
||||
double DistanceInMetres = ms::DistanceOnEarth(MercatorBounds::YToLat(pt0.y),
|
||||
double const distanceInMetres = ms::DistanceOnEarth(MercatorBounds::YToLat(pt0.y),
|
||||
MercatorBounds::XToLon(pt0.x),
|
||||
MercatorBounds::YToLat(pt1.y),
|
||||
MercatorBounds::XToLon(pt1.x));
|
||||
|
||||
/// converting into metres
|
||||
CalcMetresDiff(m_conversionFn(DistanceInMetres));
|
||||
CalcMetresDiff(m_conversionFn(distanceInMetres));
|
||||
|
||||
bool higherThanMax = m_metresDiff > m_maxUnitsWidth;
|
||||
bool lessThanMin = m_metresDiff < m_minUnitsWidth;
|
||||
bool const higherThanMax = m_metresDiff > m_maxUnitsWidth;
|
||||
bool const lessThanMin = m_metresDiff < m_minUnitsWidth;
|
||||
|
||||
double scalerWidthInPx = minPxWidth;
|
||||
|
||||
|
@ -290,7 +290,7 @@ void Ruler::draw(yg::gl::OverlayRenderer * s, math::Matrix<double, 3, 3> const &
|
|||
|
||||
if (position() & yg::EPosLeft)
|
||||
s->drawText(m_fontDesc,
|
||||
m_path[2] + m2::PointD(-7, -3),
|
||||
m_path[2] + m2::PointD(-1, -3),
|
||||
yg::EPosAboveLeft,
|
||||
m_scalerText,
|
||||
depth(),
|
||||
|
@ -298,7 +298,7 @@ void Ruler::draw(yg::gl::OverlayRenderer * s, math::Matrix<double, 3, 3> const &
|
|||
else
|
||||
if (position() & yg::EPosRight)
|
||||
s->drawText(m_fontDesc,
|
||||
m_path[1] + m2::PointD(7, -3),
|
||||
m_path[1] + m2::PointD(1, -3),
|
||||
yg::EPosAboveRight,
|
||||
m_scalerText,
|
||||
depth(),
|
||||
|
|
Loading…
Add table
Reference in a new issue