bool IsPanningAndRotate(ScreenBase const & s1, ScreenBase const & s2) { m2::RectD const & r1 = s1.GlobalRect().GetLocalRect(); m2::RectD const & r2 = s2.GlobalRect().GetLocalRect(); m2::PointD c1 = r1.Center(); m2::PointD c2 = r2.Center(); m2::PointD globPt(c1.x - r1.minX(), c1.y - r1.minY()); m2::PointD p1 = s1.GtoP(s1.GlobalRect().ConvertFrom(c1)) - s1.GtoP(s1.GlobalRect().ConvertFrom(c1 + globPt)); m2::PointD p2 = s2.GtoP(s2.GlobalRect().ConvertFrom(c2)) - s2.GtoP(s2.GlobalRect().ConvertFrom(c2 + globPt)); return p1.EqualDxDy(p2, 0.00001); }
// static void Animation::GetCurrentScreen(TPropertyCache const & properties, ScreenBase const & screen, ScreenBase & currentScreen) { currentScreen = screen; if (!properties.empty()) { double scale = currentScreen.GetScale(); double angle = currentScreen.GetAngle(); m2::PointD pos = currentScreen.GlobalRect().GlobalZero(); PropertyValue value; if (GetCachedProperty(properties, Object::MapPlane, ObjectProperty::Scale, value)) scale = value.m_valueD; if (GetCachedProperty(properties, Object::MapPlane, ObjectProperty::Angle, value)) angle = value.m_valueD; if (GetCachedProperty(properties, Object::MapPlane, ObjectProperty::Position, value)) pos = value.m_valuePointD; currentScreen.SetFromParams(pos, angle, scale); } }
bool ReadManager::MustDropAllTiles(ScreenBase const & screen) const { int const oldScale = df::GetDrawTileScale(m_currentViewport); int const newScale = df::GetDrawTileScale(screen); return (oldScale != newScale) || !m_currentViewport.GlobalRect().IsIntersect(screen.GlobalRect()); }
m2::PointD CalculateCenter(ScreenBase const & screen, m2::PointD const & userPos, m2::PointD const & pixelPos, double azimuth) { double const scale = screen.GlobalRect().GetLocalRect().SizeX() / screen.PixelRect().SizeX(); return CalculateCenter(scale, screen.PixelRect(), userPos, pixelPos, azimuth); }