Welcome to mirror list, hosted at ThFree Co, Russian Federation.

navigator_utils.cpp « map - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7bdb8c70eebcfdc4d2a840fd7e22e5d72d09fde1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "navigator_utils.hpp"

namespace navi
{

m2::AnyRectD ToRotated(m2::RectD const & rect, Navigator const & navigator)
{
  double const dx = rect.SizeX();
  double const dy = rect.SizeY();

  return m2::AnyRectD(rect.Center(),
                      navigator.Screen().GetAngle(),
                      m2::RectD(-dx/2, -dy/2, dx/2, dy/2));
}

void SetRectFixedAR(m2::AnyRectD const & rect, const ScalesProcessor & scales, Navigator & navigator)
{
  double const halfSize = scales.GetTileSize() / 2.0;
  m2::RectD etalonRect(-halfSize, -halfSize, halfSize, halfSize);

  m2::PointD const pxCenter = navigator.Screen().PixelRect().Center();
  etalonRect.Offset(pxCenter);

  navigator.SetFromRects(rect, etalonRect);
}

} // namespace navi