Exemplo n.º 1
0
void Navigator::SetFromScreen(ScreenBase const & screen, uint32_t tileSize, double visualScale)
{
  ScreenBase tmp = ScaleInto(screen, df::GetWorldRect());

  if (!CheckMaxScale(tmp, tileSize, visualScale))
  {
    int const scale = scales::GetUpperStyleScale() - 1;
    m2::RectD newRect = df::GetRectForDrawScale(scale, screen.GetOrg());
    newRect.Scale(m_Screen.GetScale3d());
    CheckMinMaxVisibleScale(newRect, scale, m_Screen.GetScale3d());
    tmp = m_Screen;
    tmp.SetFromRect(m2::AnyRectD(newRect));

    ASSERT(CheckMaxScale(tmp, tileSize, visualScale), ());
  }
Exemplo n.º 2
0
void Navigator::SetFromRect(m2::AnyRectD const & r, uint32_t tileSize, double visualScale)
{
  m2::RectD const & worldR = df::GetWorldRect();

  ScreenBase tmp = m_Screen;

  tmp.SetFromRect(r);
  tmp = ScaleInto(tmp, worldR);
  if (!CheckMaxScale(tmp, tileSize, visualScale))
  {
    int const scale = scales::GetUpperStyleScale() - 1;
    m2::RectD newRect = df::GetRectForDrawScale(scale, r.Center());
    CheckMinMaxVisibleScale(newRect, scale);
    tmp = m_Screen;
    tmp.SetFromRect(m2::AnyRectD(newRect));
    ASSERT(CheckMaxScale(tmp, tileSize, visualScale), ());
  }