diff options
38 files changed, 130 insertions, 130 deletions
diff --git a/geometry/aa_rect2d.hpp b/geometry/any_rect2d.hpp index e62a9829bd..842e62b959 100644 --- a/geometry/aa_rect2d.hpp +++ b/geometry/any_rect2d.hpp @@ -11,7 +11,7 @@ namespace m2 { /// axis aligned rect template <typename T> - class AARect + class AnyRect { private: @@ -37,17 +37,17 @@ namespace m2 public: - AARect() : m_i(1, 0), m_j(0, 1), m_zero(0, 0), m_rect(){} + AnyRect() : m_i(1, 0), m_j(0, 1), m_zero(0, 0), m_rect(){} /// creating from regular rect - explicit AARect(Rect<T> const & r) + explicit AnyRect(Rect<T> const & r) : m_angle(0), m_i(m_angle.cos(), m_angle.sin()), m_j(-m_angle.sin(), m_angle.cos()), m_zero(r == Rect<T>() ? Point<T>(0, 0) : Point<T>(r.minX(), r.minY())), m_rect(r == Rect<T>() ? Rect<T>() : Rect<T>(0, 0, r.SizeX(), r.SizeY())) { } - AARect(Point<T> const & zero, ang::Angle<T> const & angle, Rect<T> const & r) + AnyRect(Point<T> const & zero, ang::Angle<T> const & angle, Rect<T> const & r) : m_angle(angle), m_i(m_angle.cos(), m_angle.sin()), m_j(-m_angle.sin(), m_angle.cos()), m_zero(Convert(zero, Point<T>(1, 0), Point<T>(0, 1), m_i, m_j)), m_rect(r) @@ -96,7 +96,7 @@ namespace m2 return m_rect.IsPointInside(ConvertTo(pt)); } - bool IsRectInside(AARect<T> const & r) const + bool IsRectInside(AnyRect<T> const & r) const { m2::Point<T> pts[4]; r.GetGlobalPoints(pts); @@ -107,7 +107,7 @@ namespace m2 && m_rect.IsPointInside(pts[3]); } - bool IsIntersect(AARect<T> const & r) const + bool IsIntersect(AnyRect<T> const & r) const { m2::Point<T> pts[4]; if (r.GetLocalRect() == Rect<T>()) @@ -135,7 +135,7 @@ namespace m2 || Intersect(GetLocalRect(), pts[3], pts[0]); } - /// Convert into coordinate system of this AARect + /// Convert into coordinate system of this AnyRect Point<T> const ConvertTo(Point<T> const & p) const { m2::Point<T> i(1, 0); @@ -149,7 +149,7 @@ namespace m2 pts[i] = ConvertTo(pts[i]); } - /// Convert into global coordinates from the local coordinates of this AARect + /// Convert into global coordinates from the local coordinates of this AnyRect Point<T> const ConvertFrom(Point<T> const & p) const { m2::PointD i(1, 0); @@ -196,7 +196,7 @@ namespace m2 m_rect.Inflate(dx, dy); } - void Add(AARect<T> const & r) + void Add(AnyRect<T> const & r) { Point<T> pts[4]; r.GetGlobalPoints(pts); @@ -214,27 +214,27 @@ namespace m2 }; template <typename T> - AARect<T> const Offset(AARect<T> const & r, Point<T> const & pt) + AnyRect<T> const Offset(AnyRect<T> const & r, Point<T> const & pt) { - AARect<T> res(r); + AnyRect<T> res(r); res.Offset(pt); return res; } template <typename T, typename U> - AARect<T> const Inflate(AARect<T> const & r, U const & dx, U const & dy) + AnyRect<T> const Inflate(AnyRect<T> const & r, U const & dx, U const & dy) { - AARect<T> res = r; + AnyRect<T> res = r; res.Inflate(dx, dy); return res; } template <typename T, typename U> - AARect<T> const Inflate(AARect<T> const & r, Point<U> const & pt) + AnyRect<T> const Inflate(AnyRect<T> const & r, Point<U> const & pt) { return Inflate(r, pt.x, pt.y); } - typedef AARect<double> AARectD; - typedef AARect<float> AARectF; + typedef AnyRect<double> AnyRectD; + typedef AnyRect<float> AnyRectF; } diff --git a/geometry/geometry.pro b/geometry/geometry.pro index 35986be65f..08689d8225 100644 --- a/geometry/geometry.pro +++ b/geometry/geometry.pro @@ -35,6 +35,6 @@ HEADERS += \ polygon.hpp \ region2d.hpp \ robust_orientation.hpp \ - aa_rect2d.hpp \ + any_rect2d.hpp \ region2d/binary_operators.hpp \ region2d/boost_concept.hpp \ diff --git a/geometry/geometry_tests/aarect_test.cpp b/geometry/geometry_tests/anyrect_test.cpp index c0c3b1391d..e998fa0108 100644 --- a/geometry/geometry_tests/aarect_test.cpp +++ b/geometry/geometry_tests/anyrect_test.cpp @@ -2,13 +2,13 @@ #include "../../testing/testing.hpp" -#include "../aa_rect2d.hpp" +#include "../any_rect2d.hpp" #include "../../std/cmath.hpp" -UNIT_TEST(AARect_TestConvertTo) +UNIT_TEST(AnyRect_TestConvertTo) { - m2::AARectD r(m2::PointD(0, 0), math::pi / 4, m2::RectD(0, 0, 10, 10)); + m2::AnyRectD r(m2::PointD(0, 0), math::pi / 4, m2::RectD(0, 0, 10, 10)); m2::PointD pt1(100, 0); @@ -16,33 +16,33 @@ UNIT_TEST(AARect_TestConvertTo) TEST(r.ConvertTo(pt1).EqualDxDy(m2::PointD(100 / sqrt2, -100 / sqrt2), 10e-5), ()); TEST(r.ConvertTo(m2::PointD(100, 100)).EqualDxDy(m2::PointD(100 * sqrt2, 0), 10e-5), ()); - m2::AARectD r1(m2::PointD(100, 100), math::pi / 4, m2::RectD(0, 0, 10, 10)); + m2::AnyRectD r1(m2::PointD(100, 100), math::pi / 4, m2::RectD(0, 0, 10, 10)); m2::PointD pt(100, 100 + 50 * sqrt2); TEST(r1.ConvertTo(pt).EqualDxDy(m2::PointD(50, 50), 10e-5), ()); } -UNIT_TEST(AARect_TestConvertFrom) +UNIT_TEST(AnyRect_TestConvertFrom) { - m2::AARectD r(m2::PointD(100, 100), math::pi / 6, m2::RectD(0, 0, 10, 10)); + m2::AnyRectD r(m2::PointD(100, 100), math::pi / 6, m2::RectD(0, 0, 10, 10)); double const sqrt3 = sqrt(3.0); TEST(r.ConvertFrom(m2::PointD(50, 0)).EqualDxDy(m2::PointD(100 + 50 * sqrt3 / 2 , 100 + 50 * 1 / 2.0), 10e-5), ()); TEST(r.ConvertTo(m2::PointD(100 + 50 * sqrt3 / 2, 100 + 50 * 1.0 / 2)).EqualDxDy(m2::PointD(50, 0), 10e-5), ()); } -UNIT_TEST(AARect_ZeroRect) +UNIT_TEST(AnyRect_ZeroRect) { - m2::AARectD r0(m2::RectD(0, 0, 0, 0)); - m2::AARectD r1(m2::Offset(r0, m2::PointD(300.0, 300.0))); - m2::AARectD r2(m2::Inflate(r0, 2.0, 2.0)); + m2::AnyRectD r0(m2::RectD(0, 0, 0, 0)); + m2::AnyRectD r1(m2::Offset(r0, m2::PointD(300.0, 300.0))); + m2::AnyRectD r2(m2::Inflate(r0, 2.0, 2.0)); } -UNIT_TEST(AARect_TestIntersection) +UNIT_TEST(AnyRect_TestIntersection) { - m2::AARectD r0(m2::PointD(93.196, 104.21), 1.03, m2::RectD(2, 0, 4, 15)); - m2::AARectD r1(m2::PointD(99.713, 116.02), -1.03, m2::RectD(0, 0, 14, 14)); + m2::AnyRectD r0(m2::PointD(93.196, 104.21), 1.03, m2::RectD(2, 0, 4, 15)); + m2::AnyRectD r1(m2::PointD(99.713, 116.02), -1.03, m2::RectD(0, 0, 14, 14)); m2::PointD pts[4]; r0.GetGlobalPoints(pts); @@ -55,18 +55,18 @@ UNIT_TEST(AARect_TestIntersection) TEST(r1.GetLocalRect().IsIntersect(r2) == false, ()); } -UNIT_TEST(AARect_TestIsIntersect) +UNIT_TEST(AnyRect_TestIsIntersect) { - m2::AARectD r0(m2::PointD(100, 100), math::pi / 6, m2::RectD(0, 0, 50, 20)); - m2::AARectD r1(m2::PointD(100, 100), math::pi / 6, m2::RectD(0, -10, 50, 10)); - m2::AARectD r2(m2::PointD(100, 100), math::pi / 6, m2::RectD(0, -21, 50, -1)); + m2::AnyRectD r0(m2::PointD(100, 100), math::pi / 6, m2::RectD(0, 0, 50, 20)); + m2::AnyRectD r1(m2::PointD(100, 100), math::pi / 6, m2::RectD(0, -10, 50, 10)); + m2::AnyRectD r2(m2::PointD(100, 100), math::pi / 6, m2::RectD(0, -21, 50, -1)); TEST(r0.IsIntersect(r1), ()); TEST(r1.IsIntersect(r2), ()); TEST(!r0.IsIntersect(r2), ()); TEST(r1.IsIntersect(r2), ()); - m2::AARectD r3(m2::PointD(50, 50), math::pi / 8, m2::RectD(0, 0, 80, 30)); + m2::AnyRectD r3(m2::PointD(50, 50), math::pi / 8, m2::RectD(0, 0, 80, 30)); TEST(r0.IsIntersect(r3), ()); } diff --git a/geometry/geometry_tests/geometry_tests.pro b/geometry/geometry_tests/geometry_tests.pro index 308e54f33c..d1f5428e79 100644 --- a/geometry/geometry_tests/geometry_tests.pro +++ b/geometry/geometry_tests/geometry_tests.pro @@ -36,5 +36,5 @@ SOURCES += \ region_test.cpp \ rect_test.cpp \ robust_test.cpp \ - aarect_test.cpp \ + anyrect_test.cpp \ region2d_binary_op_test.cpp \ diff --git a/geometry/geometry_tests/screen_test.cpp b/geometry/geometry_tests/screen_test.cpp index d2bdd9610a..1cbc78c727 100644 --- a/geometry/geometry_tests/screen_test.cpp +++ b/geometry/geometry_tests/screen_test.cpp @@ -16,7 +16,7 @@ namespace m2::PointD b1(0.0, 0.0); m2::PointD b2(300.0, 300.0); - screen.SetFromRect(m2::AARectD(m2::RectD(b1, b2))); + screen.SetFromRect(m2::AnyRectD(m2::RectD(b1, b2))); b1 = screen.GtoP(b1); b2 = screen.GtoP(b2); @@ -37,7 +37,7 @@ UNIT_TEST(ScreenBase_P2G2P) check_set_from_rect(screen, 500, 1000); screen.OnSize(0, 0, 640, 480); - screen.SetFromRect(m2::AARectD(m2::RectD(-100, -200, 500, 680))); + screen.SetFromRect(m2::AnyRectD(m2::RectD(-100, -200, 500, 680))); /// checking that PtoG(GtoP(p)) == p @@ -55,7 +55,7 @@ UNIT_TEST(ScreenBase_AxisOrientation) ScreenBase screen; screen.OnSize(0, 0, 300, 200); - screen.SetFromRect(m2::AARectD(m2::RectD(0, 0, 300, 200))); + screen.SetFromRect(m2::AnyRectD(m2::RectD(0, 0, 300, 200))); TEST(is_equal(m2::PointD(150, 100), screen.GtoP(m2::PointD(150, 100))), ()); TEST(is_equal(m2::PointD(0, 0), screen.GtoP(m2::PointD(0, 200))), ()); @@ -68,7 +68,7 @@ UNIT_TEST(ScreenBase_X0Y0) { ScreenBase screen; screen.OnSize(10, 10, 300, 200); - screen.SetFromRect(m2::AARectD(m2::RectD(0, 0, 300, 200))); + screen.SetFromRect(m2::AnyRectD(m2::RectD(0, 0, 300, 200))); m2::PointD pxPt = screen.PtoG(m2::PointD(0, 0)); @@ -79,7 +79,7 @@ UNIT_TEST(ScreenBase_ChoosingMaxScale) { ScreenBase screen; screen.OnSize(10, 10, 300, 200); - screen.SetFromRect(m2::AARectD(m2::RectD(0, 0, 200, 400))); + screen.SetFromRect(m2::AnyRectD(m2::RectD(0, 0, 200, 400))); TEST(is_equal(screen.GtoP(m2::PointD(100, 200)), m2::PointD(160, 110)), ()); TEST(is_equal(screen.GtoP(m2::PointD(0, 0)), m2::PointD(110, 210)), ()); @@ -124,11 +124,11 @@ UNIT_TEST(ScreenBase_Rotate) { ScreenBase s; s.OnSize(0, 0, 100, 200); - s.SetFromRect(m2::AARectD(m2::RectD(0, 0, 100, 200))); + s.SetFromRect(m2::AnyRectD(m2::RectD(0, 0, 100, 200))); s.Rotate(math::pi / 4); m2::RectD pxRect = s.PixelRect(); - m2::AARectD glbRect = s.GlobalRect(); + m2::AnyRectD glbRect = s.GlobalRect(); TEST(pxRect == m2::RectD(0, 0, 100, 200), ()); } diff --git a/geometry/screenbase.cpp b/geometry/screenbase.cpp index bdbaa65c44..2f31218c99 100644 --- a/geometry/screenbase.cpp +++ b/geometry/screenbase.cpp @@ -20,7 +20,7 @@ ScreenBase::ScreenBase() : // UpdateDependentParameters(); } -ScreenBase::ScreenBase(m2::RectI const & pxRect, m2::AARectD const & glbRect) +ScreenBase::ScreenBase(m2::RectI const & pxRect, m2::AnyRectD const & glbRect) { OnSize(pxRect); SetFromRect(glbRect); @@ -53,11 +53,11 @@ void ScreenBase::UpdateDependentParameters() double HalfSizeX = PtoG(m2::PointD(m_PixelRect.maxX(), m_PixelRect.Center().y)).Length(PtoG(m2::PointD(m_PixelRect.Center()))); double HalfSizeY = PtoG(m2::PointD(m_PixelRect.Center().x, m_PixelRect.minY())).Length(PtoG(m2::PointD(m_PixelRect.Center()))); - m_GlobalRect = m2::AARectD(m_Org, m_Angle, m2::RectD(-HalfSizeX, -HalfSizeY, HalfSizeX, HalfSizeY)); + m_GlobalRect = m2::AnyRectD(m_Org, m_Angle, m2::RectD(-HalfSizeX, -HalfSizeY, HalfSizeX, HalfSizeY)); m_ClipRect = m_GlobalRect.GetGlobalRect(); } -void ScreenBase::SetFromRect(m2::AARectD const & GlobalRect) +void ScreenBase::SetFromRect(m2::AnyRectD const & GlobalRect) { double hScale = GlobalRect.GetLocalRect().SizeX() / m_PixelRect.SizeX(); double vScale = GlobalRect.GetLocalRect().SizeY() / m_PixelRect.SizeY(); @@ -125,7 +125,7 @@ m2::RectD const & ScreenBase::PixelRect() const return m_PixelRect; } -m2::AARectD const & ScreenBase::GlobalRect() const +m2::AnyRectD const & ScreenBase::GlobalRect() const { return m_GlobalRect; } diff --git a/geometry/screenbase.hpp b/geometry/screenbase.hpp index a50ce0deb7..dc0c9109d2 100644 --- a/geometry/screenbase.hpp +++ b/geometry/screenbase.hpp @@ -2,7 +2,7 @@ #include "point2d.hpp" #include "rect2d.hpp" -#include "aa_rect2d.hpp" +#include "any_rect2d.hpp" #include "../base/math.hpp" @@ -38,7 +38,7 @@ protected: math::Matrix<double, 3, 3> m_PtoG; /// Global Rect - m2::AARectD m_GlobalRect; + m2::AnyRectD m_GlobalRect; /// X-axis aligned global rect used for clipping m2::RectD m_ClipRect; @@ -52,9 +52,9 @@ protected: public: ScreenBase(); - ScreenBase(m2::RectI const & pxRect, m2::AARectD const & glbRect); + ScreenBase(m2::RectI const & pxRect, m2::AnyRectD const & glbRect); - void SetFromRect(m2::AARectD const & rect); + void SetFromRect(m2::AnyRectD const & rect); void SetOrg(m2::PointD const & p); void Move(double dx, double dy); @@ -104,7 +104,7 @@ public: math::Matrix<double, 3, 3> const & PtoGMatrix() const; m2::RectD const & PixelRect() const; - m2::AARectD const & GlobalRect() const; + m2::AnyRectD const & GlobalRect() const; m2::RectD const & ClipRect() const; /// Compute arbitrary pixel transformation, that translates the (oldPt1, oldPt2) -> (newPt1, newPt2) diff --git a/map/benchmark_framework.cpp b/map/benchmark_framework.cpp index ea995a5787..4be8146efc 100644 --- a/map/benchmark_framework.cpp +++ b/map/benchmark_framework.cpp @@ -245,7 +245,7 @@ void BenchmarkFramework<TModel>::NextBenchmarkCommand() if ((m_benchmarks[m_curBenchmark].m_provider->hasRect()) || (++m_curBenchmark < m_benchmarks.size())) { m_curBenchmarkRect = m_benchmarks[m_curBenchmark].m_provider->nextRect(); - base_type::m_navigator.SetFromRect(m2::AARectD(m_curBenchmarkRect)); + base_type::m_navigator.SetFromRect(m2::AnyRectD(m_curBenchmarkRect)); base_type::Invalidate(); } else diff --git a/map/framework.cpp b/map/framework.cpp index 2e066fc5c0..f2579f4543 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -235,7 +235,7 @@ void Framework<TModel>::PrepareToShutdown() template <typename TModel> void Framework<TModel>::SetMaxWorldRect() { - m_navigator.SetFromRect(m2::AARectD(m_model.GetWorldRect())); + m_navigator.SetFromRect(m2::AnyRectD(m_model.GetWorldRect())); } template <typename TModel> @@ -411,7 +411,7 @@ void Framework<TModel>::ShowRect(m2::RectD rect) if (rect.SizeX() < minSizeX && rect.SizeY() < minSizeY) rect.SetSizes(minSizeX, minSizeY); - m_navigator.SetFromRect(m2::AARectD(rect)); + m_navigator.SetFromRect(m2::AnyRectD(rect)); Invalidate(); } @@ -465,7 +465,7 @@ void Framework<TModel>::CenterAndScaleViewport() yMinSize / clipRect.SizeY()); clipRect.Scale(k); - m_navigator.SetFromRect(m2::AARectD(clipRect)); + m_navigator.SetFromRect(m2::AnyRectD(clipRect)); } Invalidate(); @@ -482,7 +482,7 @@ void Framework<TModel>::ShowAll() template <typename TModel> void Framework<TModel>::InvalidateRect(m2::RectD const & rect) { - if (m_navigator.Screen().GlobalRect().IsIntersect(m2::AARectD(rect))) + if (m_navigator.Screen().GlobalRect().IsIntersect(m2::AnyRectD(rect))) Invalidate(); } diff --git a/map/information_display.cpp b/map/information_display.cpp index 2e301ebaba..67ee93a15b 100644 --- a/map/information_display.cpp +++ b/map/information_display.cpp @@ -168,7 +168,7 @@ void InformationDisplay::enableGlobalRect(bool doEnable) m_isGlobalRectEnabled = doEnable; } -void InformationDisplay::setGlobalRect(m2::AARectD const & r) +void InformationDisplay::setGlobalRect(m2::AnyRectD const & r) { m_globalRect = r; } diff --git a/map/information_display.hpp b/map/information_display.hpp index c1327f6e60..ab9456b2bd 100644 --- a/map/information_display.hpp +++ b/map/information_display.hpp @@ -41,7 +41,7 @@ private: int m_currentScale; bool m_isGlobalRectEnabled; - m2::AARectD m_globalRect; + m2::AnyRectD m_globalRect; bool m_isDebugInfoEnabled; double m_frameDuration; @@ -93,7 +93,7 @@ public: void drawCenter(DrawerYG * pDrawer); void enableGlobalRect(bool doEnable); - void setGlobalRect(m2::AARectD const & r); + void setGlobalRect(m2::AnyRectD const & r); void drawGlobalRect(DrawerYG * pDrawer); void enableDebugInfo(bool doEnable); diff --git a/map/map_tests/navigator_test.cpp b/map/map_tests/navigator_test.cpp index def5fab6a3..cd0a44dec0 100644 --- a/map/map_tests/navigator_test.cpp +++ b/map/map_tests/navigator_test.cpp @@ -32,7 +32,7 @@ UNIT_TEST(NavigatorScale2Points) Navigator navigator; { // Initialize. navigator.OnSize(0, 0, 200, 100); - navigator.SetFromRect(m2::AARectD(m2::RectD(0, 0, 8, 4))); + navigator.SetFromRect(m2::AnyRectD(m2::RectD(0, 0, 8, 4))); TEST_EQUAL(navigator.Screen().ClipRect(), m2::RectD(0, 0, 8, 4), ()); } navigator.StartScale(navigator.Screen().GtoP(m2::PointD(1, 1)), diff --git a/map/navigator.cpp b/map/navigator.cpp index 4d95a66753..1b2fc63229 100644 --- a/map/navigator.cpp +++ b/map/navigator.cpp @@ -40,7 +40,7 @@ void Navigator::SetMinScreenParams(unsigned pxMinWidth, double metresMinWidth) m_metresMinWidth = metresMinWidth; } -void Navigator::SetFromRect(m2::AARectD const & r) +void Navigator::SetFromRect(m2::AnyRectD const & r) { m_Screen.SetFromRect(r); m_Screen = ScaleInto(m_Screen, m_worldRect); @@ -74,7 +74,7 @@ void Navigator::SaveState() bool Navigator::LoadState() { - m2::AARectD rect; + m2::AnyRectD rect; if (!Settings::Get("ScreenClipRect", rect)) return false; @@ -331,7 +331,7 @@ bool Navigator::ScaleImpl(m2::PointD const & newPt1, m2::PointD const & newPt2, ScreenBase tmp = m_Screen; tmp.SetGtoPMatrix(newM); - tmp.Rotate(tmp.GetAngle()); + //tmp.Rotate(tmp.GetAngle()); if (!skipMaxScaleAndBordersCheck && !CheckMaxScale(tmp)) return false; diff --git a/map/navigator.hpp b/map/navigator.hpp index f3b287fc8d..ad6a04cfb7 100644 --- a/map/navigator.hpp +++ b/map/navigator.hpp @@ -16,7 +16,7 @@ public: explicit Navigator(ScreenBase const & screen); void SetMinScreenParams(unsigned pxMinWidth, double metresMinWidth); - void SetFromRect(m2::AARectD const & r); + void SetFromRect(m2::AnyRectD const & r); void CenterViewport(m2::PointD const & p); void SaveState(); diff --git a/map/ruler.cpp b/map/ruler.cpp index 764358f16d..6b32890d0b 100644 --- a/map/ruler.cpp +++ b/map/ruler.cpp @@ -168,9 +168,9 @@ void Ruler::update() m_boundRect.Add(m_path[3]); } -vector<m2::AARectD> const & Ruler::boundRects() const +vector<m2::AnyRectD> const & Ruler::boundRects() const { - m_boundRects[0] = m2::AARectD(m_boundRect); + m_boundRects[0] = m2::AnyRectD(m_boundRect); return m_boundRects; } diff --git a/map/ruler.hpp b/map/ruler.hpp index a237b74ca5..c04da25ced 100644 --- a/map/ruler.hpp +++ b/map/ruler.hpp @@ -2,7 +2,7 @@ #include "../geometry/screenbase.hpp" #include "../geometry/point2d.hpp" -#include "../geometry/aa_rect2d.hpp" +#include "../geometry/any_rect2d.hpp" #include "../yg/overlay_element.hpp" #include "../yg/font_desc.hpp" @@ -41,7 +41,7 @@ private: typedef OverlayElement base_t; - mutable vector<m2::AARectD> m_boundRects; + mutable vector<m2::AnyRectD> m_boundRects; public: @@ -62,7 +62,7 @@ public: void setVisualScale(double visualScale); void setFontDesc(yg::FontDesc const & fontDesc); - vector<m2::AARectD> const & boundRects() const; + vector<m2::AnyRectD> const & boundRects() const; void draw(yg::gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const; diff --git a/map/tile_renderer.cpp b/map/tile_renderer.cpp index e165765225..282819417d 100644 --- a/map/tile_renderer.cpp +++ b/map/tile_renderer.cpp @@ -151,7 +151,7 @@ void TileRenderer::DrawTile(core::CommandsQueue::Environment const & env, drawer->screen()->drawText(yg::FontDesc(), renderRect.Center(), yg::EPosCenter, out.str().c_str(), 0, false); */ - frameScreen.SetFromRect(m2::AARectD(rectInfo.m_rect)); + frameScreen.SetFromRect(m2::AnyRectD(rectInfo.m_rect)); m2::RectD selectRect; m2::RectD clipRect; diff --git a/map/tiler.cpp b/map/tiler.cpp index 506298134d..10856c95e5 100644 --- a/map/tiler.cpp +++ b/map/tiler.cpp @@ -111,7 +111,7 @@ void Tiler::seed(ScreenBase const & screen, m2::PointD const & centerPt) double rectSizeX = (MercatorBounds::maxX - MercatorBounds::minX) / (1 << m_tileScale); double rectSizeY = (MercatorBounds::maxY - MercatorBounds::minY) / (1 << m_tileScale); - m2::AARectD const globalRect = m_screen.GlobalRect(); + m2::AnyRectD const globalRect = m_screen.GlobalRect(); m2::RectD const clipRect = m_screen.ClipRect(); int minTileX = static_cast<int>(floor(clipRect.minX() / rectSizeX)); @@ -132,7 +132,7 @@ void Tiler::seed(ScreenBase const & screen, m2::PointD const & centerPt) (tileX + 1) * rectSizeX, (tileY + 1) * rectSizeY); - if (globalRect.IsIntersect(m2::AARectD(tileRect))) + if (globalRect.IsIntersect(m2::AnyRectD(tileRect))) m_coverage.push_back(RectInfo(m_drawScale, m_tileScale, tileX, tileY)); } diff --git a/map/tiling_render_policy_st.cpp b/map/tiling_render_policy_st.cpp index d09ce3ff4e..9995e13468 100644 --- a/map/tiling_render_policy_st.cpp +++ b/map/tiling_render_policy_st.cpp @@ -109,7 +109,7 @@ void TilingRenderPolicyST::DrawFrame(shared_ptr<PaintEvent> const & e, ScreenBas m_tileDrawer->screen()->setClipRect(renderRect); m_tileDrawer->clear(c); - m_tileScreen.SetFromRect(m2::AARectD(ri.m_rect)); + m_tileScreen.SetFromRect(m2::AnyRectD(ri.m_rect)); m2::RectD selectRect; m2::RectD clipRect; diff --git a/platform/settings.cpp b/platform/settings.cpp index 2bdc682075..cea9c177e5 100644 --- a/platform/settings.cpp +++ b/platform/settings.cpp @@ -3,7 +3,7 @@ #include "../defines.hpp" #include "../geometry/rect2d.hpp" -#include "../geometry/aa_rect2d.hpp" +#include "../geometry/any_rect2d.hpp" #include "../platform/platform.hpp" @@ -79,7 +79,7 @@ namespace Settings return true; } - template <> string ToString<m2::AARectD>(m2::AARectD const & rect) + template <> string ToString<m2::AnyRectD>(m2::AnyRectD const & rect) { ostringstream out; out.precision(12); @@ -91,7 +91,7 @@ namespace Settings return out.str(); } - template <> bool FromString<m2::AARectD>(string const & str, m2::AARectD & rect) + template <> bool FromString<m2::AnyRectD>(string const & str, m2::AnyRectD & rect) { istringstream in(str); double val[7]; @@ -102,7 +102,7 @@ namespace Settings if (count != 7) return false; - rect = m2::AARectD(m2::PointD(val[0], val[1]), + rect = m2::AnyRectD(m2::PointD(val[0], val[1]), ang::AngleD(val[2]), m2::RectD(val[3], val[4], val[5], val[6])); diff --git a/qt_tstfrm/screen_qt.hpp b/qt_tstfrm/screen_qt.hpp index cec61717b9..fbf5e11ad0 100644 --- a/qt_tstfrm/screen_qt.hpp +++ b/qt_tstfrm/screen_qt.hpp @@ -32,7 +32,7 @@ namespace qt public: void setPainter(QPainter * p) { m_p = p; } void onSize(int w, int h) { m_convertor.OnSize(0, 0, w, h); } - void setFromRect(m2::RectD const & r) { m_convertor.SetFromRect(m2::AARectD(r)); } + void setFromRect(m2::RectD const & r) { m_convertor.SetFromRect(m2::AnyRectD(r)); } template <class TCont> void drawPath(TCont const & c) { diff --git a/yg/composite_overlay_element.cpp b/yg/composite_overlay_element.cpp index 31e01d785a..6a5ebde4e4 100644 --- a/yg/composite_overlay_element.cpp +++ b/yg/composite_overlay_element.cpp @@ -24,7 +24,7 @@ namespace yg return res; } - vector<m2::AARectD> const & CompositeOverlayElement::boundRects() const + vector<m2::AnyRectD> const & CompositeOverlayElement::boundRects() const { if (isDirtyRect()) { diff --git a/yg/composite_overlay_element.hpp b/yg/composite_overlay_element.hpp index ebaafe16db..e20e290dc0 100644 --- a/yg/composite_overlay_element.hpp +++ b/yg/composite_overlay_element.hpp @@ -12,7 +12,7 @@ namespace yg vector<shared_ptr<OverlayElement> > m_elements; - mutable vector<m2::AARectD> m_boundRects; + mutable vector<m2::AnyRectD> m_boundRects; public: @@ -22,7 +22,7 @@ namespace yg OverlayElement * clone(math::Matrix<double, 3, 3> const & m) const; - vector<m2::AARectD> const & boundRects() const; + vector<m2::AnyRectD> const & boundRects() const; void draw(gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const; diff --git a/yg/glyph_layout.cpp b/yg/glyph_layout.cpp index a6089695a6..11368cb1d5 100644 --- a/yg/glyph_layout.cpp +++ b/yg/glyph_layout.cpp @@ -7,7 +7,7 @@ #include "../std/sstream.hpp" #include "../geometry/angles.hpp" -#include "../geometry/aa_rect2d.hpp" +#include "../geometry/any_rect2d.hpp" #include "../base/thread.hpp" namespace yg @@ -18,7 +18,7 @@ namespace yg /// check, whether we should offset this symbol slightly /// not to overlap the previous symbol - m2::AARectD prevSymRectAA( + m2::AnyRectD prevSymRectAA( prevElem.m_pt.Move(prevMetrics.m_height, -prevElem.m_angle.cos(), prevElem.m_angle.sin()), //< moving by angle = prevElem.m_angle - math::pi / 2 prevElem.m_angle, m2::RectD(prevMetrics.m_xOffset, @@ -26,7 +26,7 @@ namespace yg prevMetrics.m_xOffset + prevMetrics.m_width, prevMetrics.m_yOffset + prevMetrics.m_height)); - m2::AARectD curSymRectAA( + m2::AnyRectD curSymRectAA( curElem.m_pt.Move(curMetrics.m_height, -curElem.m_angle.cos(), curElem.m_angle.sin()), //< moving by angle = curElem.m_angle - math::pi / 2 curElem.m_angle, m2::RectD(curMetrics.m_xOffset, @@ -126,7 +126,7 @@ namespace yg boundRect.Offset(ptOffs); - m_boundRects.push_back(m2::AARectD(boundRect)); + m_boundRects.push_back(m2::AnyRectD(boundRect)); } GlyphLayout::GlyphLayout(GlyphLayout const & src, @@ -140,7 +140,7 @@ namespace yg m_metrics(src.m_metrics), m_pivot(0, 0) { - m_boundRects.push_back(m2::AARectD(m2::RectD(0, 0, 0, 0))); + m_boundRects.push_back(m2::AnyRectD(m2::RectD(0, 0, 0, 0))); m_fullLength = (m2::PointD(src.m_fullLength, 0) * m).Length(m2::PointD(0, 0) * m); m_pathOffset = (m2::PointD(src.m_pathOffset, 0) * m).Length(m2::PointD(0, 0) * m); recalcAlongPath(); @@ -164,7 +164,7 @@ namespace yg m_fontDesc(fontDesc), m_pivot(0, 0) { - m_boundRects.push_back(m2::AARectD(m2::RectD(0, 0, 0, 0))); + m_boundRects.push_back(m2::AnyRectD(m2::RectD(0, 0, 0, 0))); for (size_t i = 0; i < m_visText.size(); ++i) m_metrics.push_back(glyphCache->getGlyphMetrics(GlyphKey(visText[i], m_fontDesc.m_size, m_fontDesc.m_isMasked, yg::Color(0, 0, 0, 0)))); recalcAlongPath(); @@ -323,7 +323,7 @@ namespace yg void GlyphLayout::computeBoundRects() { - map<double, m2::AARectD> rects; + map<double, m2::AnyRectD> rects; for (unsigned i = m_firstVisible; i < m_lastVisible; ++i) { @@ -331,9 +331,9 @@ namespace yg { ang::AngleD const & a = m_entries[i].m_angle; - map<double, m2::AARectD>::iterator it = rects.find(a.val()); + map<double, m2::AnyRectD>::iterator it = rects.find(a.val()); - m2::AARectD symRectAA( + m2::AnyRectD symRectAA( m_entries[i].m_pt.Move(m_metrics[i].m_height + m_metrics[i].m_yOffset, -a.cos(), a.sin()), //< moving by angle = m_entries[i].m_angle - math::pi / 2 a, m2::RectD(m_metrics[i].m_xOffset, @@ -351,9 +351,9 @@ namespace yg m_boundRects.clear(); - for (map<double, m2::AARectD>::const_iterator it = rects.begin(); it != rects.end(); ++it) + for (map<double, m2::AnyRectD>::const_iterator it = rects.begin(); it != rects.end(); ++it) { - m2::AARectD r(it->second); + m2::AnyRectD r(it->second); m2::PointD zero = r.GlobalZero(); double dx = zero.x - floor(zero.x); @@ -387,7 +387,7 @@ namespace yg return m_metrics; } - vector<m2::AARectD> const & GlyphLayout::boundRects() const + vector<m2::AnyRectD> const & GlyphLayout::boundRects() const { return m_boundRects; } diff --git a/yg/glyph_layout.hpp b/yg/glyph_layout.hpp index 81b3ef07ca..de83d0b4b9 100644 --- a/yg/glyph_layout.hpp +++ b/yg/glyph_layout.hpp @@ -6,7 +6,7 @@ #include "../geometry/rect2d.hpp" #include "../geometry/point2d.hpp" -#include "../geometry/aa_rect2d.hpp" +#include "../geometry/any_rect2d.hpp" #include "../geometry/angles.hpp" #include "../std/vector.hpp" @@ -50,7 +50,7 @@ namespace yg vector<GlyphMetrics> m_metrics; vector<GlyphLayoutElem> m_entries; - vector<m2::AARectD> m_boundRects; + vector<m2::AnyRectD> m_boundRects; m2::PointD m_pivot; @@ -88,7 +88,7 @@ namespace yg vector<GlyphLayoutElem> const & entries() const; vector<GlyphMetrics> const & metrics() const; - vector<m2::AARectD> const & boundRects() const; + vector<m2::AnyRectD> const & boundRects() const; m2::PointD const & pivot() const; diff --git a/yg/info_layer.cpp b/yg/info_layer.cpp index ef8fbfc085..79f76ad47a 100644 --- a/yg/info_layer.cpp +++ b/yg/info_layer.cpp @@ -44,7 +44,7 @@ namespace yg template <typename Tree> void offsetTree(Tree & tree, m2::PointD const & offs, m2::RectD const & r) { - m2::AARectD aaRect(r); + m2::AnyRectD AnyRect(r); typedef typename Tree::elem_t elem_t; vector<elem_t> elems; tree.ForEach(MakeBackInsertFunctor(elems)); @@ -53,7 +53,7 @@ namespace yg for (typename vector<elem_t>::iterator it = elems.begin(); it != elems.end(); ++it) { (*it)->offset(offs); - vector<m2::AARectD> const & aaLimitRects = (*it)->boundRects(); + vector<m2::AnyRectD> const & aaLimitRects = (*it)->boundRects(); bool doAppend = false; (*it)->setIsNeedRedraw(false); @@ -64,7 +64,7 @@ namespace yg for (int i = 0; i < aaLimitRects.size(); ++i) { - bool isPartInsideRect = aaRect.IsRectInside(aaLimitRects[i]); + bool isPartInsideRect = AnyRect.IsRectInside(aaLimitRects[i]); if (isPartInsideRect) { @@ -83,7 +83,7 @@ namespace yg } } - bool isRectInsidePart = aaLimitRects[i].IsRectInside(aaRect); + bool isRectInsidePart = aaLimitRects[i].IsRectInside(AnyRect); if (isRectInsidePart) { @@ -91,7 +91,7 @@ namespace yg break; } - bool isPartIntersectRect = aaRect.IsIntersect(aaLimitRects[i]); + bool isPartIntersectRect = AnyRect.IsIntersect(aaLimitRects[i]); if (isPartIntersectRect) { @@ -147,12 +147,12 @@ namespace yg if (*m_isIntersect) return; - vector<m2::AARectD> const & lr = m_oe->boundRects(); - vector<m2::AARectD> const & rr = e->boundRects(); + vector<m2::AnyRectD> const & lr = m_oe->boundRects(); + vector<m2::AnyRectD> const & rr = e->boundRects(); - for (vector<m2::AARectD>::const_iterator lit = lr.begin(); lit != lr.end(); ++lit) + for (vector<m2::AnyRectD>::const_iterator lit = lr.begin(); lit != lr.end(); ++lit) { - for (vector<m2::AARectD>::const_iterator rit = rr.begin(); rit != rr.end(); ++rit) + for (vector<m2::AnyRectD>::const_iterator rit = rr.begin(); rit != rr.end(); ++rit) { *m_isIntersect = lit->IsIntersect(*rit); if (*m_isIntersect) diff --git a/yg/overlay_element.hpp b/yg/overlay_element.hpp index 12a3baca64..6daad3130c 100644 --- a/yg/overlay_element.hpp +++ b/yg/overlay_element.hpp @@ -1,7 +1,7 @@ #pragma once #include "../geometry/point2d.hpp" -#include "../geometry/aa_rect2d.hpp" +#include "../geometry/any_rect2d.hpp" #include "../base/matrix.hpp" #include "defines.hpp" #include "../std/vector.hpp" @@ -51,7 +51,7 @@ namespace yg virtual OverlayElement * clone(math::Matrix<double, 3, 3> const & m) const = 0; /// PLEASE, REMEMBER THE REFERENCE!!! - virtual vector<m2::AARectD> const & boundRects() const = 0; + virtual vector<m2::AnyRectD> const & boundRects() const = 0; virtual void draw(gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const = 0; virtual int visualRank() const = 0; diff --git a/yg/path_text_element.cpp b/yg/path_text_element.cpp index 26cc85a2fb..068ee84ff5 100644 --- a/yg/path_text_element.cpp +++ b/yg/path_text_element.cpp @@ -27,7 +27,7 @@ namespace yg setIsVisible((m_glyphLayout.firstVisible() == 0) && (m_glyphLayout.lastVisible() == visText().size())); } - vector<m2::AARectD> const & PathTextElement::boundRects() const + vector<m2::AnyRectD> const & PathTextElement::boundRects() const { if (isDirtyRect()) { diff --git a/yg/path_text_element.hpp b/yg/path_text_element.hpp index ecf0822893..e90dfdb9a5 100644 --- a/yg/path_text_element.hpp +++ b/yg/path_text_element.hpp @@ -23,7 +23,7 @@ namespace yg PathTextElement(Params const & p); PathTextElement(PathTextElement const & src, math::Matrix<double, 3, 3> const & m); - vector<m2::AARectD> const & boundRects() const; + vector<m2::AnyRectD> const & boundRects() const; void draw(gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const; diff --git a/yg/shape_renderer.cpp b/yg/shape_renderer.cpp index 79c8759938..53ed58fa10 100644 --- a/yg/shape_renderer.cpp +++ b/yg/shape_renderer.cpp @@ -78,7 +78,7 @@ namespace yg drawTrianglesList(§orPts[0], sectorPts.size(), skin()->mapColor(c), depth); } - void ShapeRenderer::drawRectangle(m2::AARectD const & r, yg::Color const & c, double depth) + void ShapeRenderer::drawRectangle(m2::AnyRectD const & r, yg::Color const & c, double depth) { ResourceStyle const * style = skin()->fromID(skin()->mapColor(c)); diff --git a/yg/shape_renderer.hpp b/yg/shape_renderer.hpp index af5f5f2ba5..eb85b35d96 100644 --- a/yg/shape_renderer.hpp +++ b/yg/shape_renderer.hpp @@ -2,7 +2,7 @@ #include "path_renderer.hpp" #include "../geometry/rect2d.hpp" -#include "../geometry/aa_rect2d.hpp" +#include "../geometry/any_rect2d.hpp" namespace yg { @@ -21,7 +21,7 @@ namespace yg void drawSector(m2::PointD const & center, double startA, double endA, double r, yg::Color const & c, double depth); void fillSector(m2::PointD const & center, double startA, double endA, double r, yg::Color const & c, double depth); - void drawRectangle(m2::AARectD const & r, yg::Color const & c, double depth); + void drawRectangle(m2::AnyRectD const & r, yg::Color const & c, double depth); void drawRectangle(m2::RectD const & r, yg::Color const & c, double depth); }; } diff --git a/yg/straight_text_element.cpp b/yg/straight_text_element.cpp index dbb8c25df4..76bd3d52ae 100644 --- a/yg/straight_text_element.cpp +++ b/yg/straight_text_element.cpp @@ -162,7 +162,7 @@ namespace yg m_glyphLayouts[i].setPivot(pivot() + m_offsets[i]); } - vector<m2::AARectD> const & StraightTextElement::boundRects() const + vector<m2::AnyRectD> const & StraightTextElement::boundRects() const { if (isDirtyRect()) { diff --git a/yg/straight_text_element.hpp b/yg/straight_text_element.hpp index 6d05a70d0f..41367b58af 100644 --- a/yg/straight_text_element.hpp +++ b/yg/straight_text_element.hpp @@ -28,7 +28,7 @@ namespace yg StraightTextElement(Params const & p); StraightTextElement(StraightTextElement const & src, math::Matrix<double, 3, 3> const & m); - vector<m2::AARectD> const & boundRects() const; + vector<m2::AnyRectD> const & boundRects() const; void draw(gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const; diff --git a/yg/symbol_element.cpp b/yg/symbol_element.cpp index 874e25fa75..7781088ab3 100644 --- a/yg/symbol_element.cpp +++ b/yg/symbol_element.cpp @@ -35,7 +35,7 @@ namespace yg setPivot(se.pivot() * m); } - vector<m2::AARectD> const & SymbolElement::boundRects() const + vector<m2::AnyRectD> const & SymbolElement::boundRects() const { if (isDirtyRect()) { @@ -46,14 +46,14 @@ namespace yg return m_boundRects; } - m2::AARectD const SymbolElement::boundRect() const + m2::AnyRectD const SymbolElement::boundRect() const { m2::RectI texRect(m_symbolRect); texRect.Inflate(-1, -1); m2::PointD posPt = tieRect(m2::RectD(texRect), math::Identity<double, 3>()); - return m2::AARectD(m2::RectD(posPt, posPt + m2::PointD(texRect.SizeX(), texRect.SizeY()))); + return m2::AnyRectD(m2::RectD(posPt, posPt + m2::PointD(texRect.SizeX(), texRect.SizeY()))); } void SymbolElement::draw(gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const diff --git a/yg/symbol_element.hpp b/yg/symbol_element.hpp index 152c1e48da..cb45cb3f64 100644 --- a/yg/symbol_element.hpp +++ b/yg/symbol_element.hpp @@ -18,9 +18,9 @@ namespace yg string m_symbolName; mutable m2::RectU m_symbolRect; - mutable vector<m2::AARectD> m_boundRects; + mutable vector<m2::AnyRectD> m_boundRects; - m2::AARectD const boundRect() const; + m2::AnyRectD const boundRect() const; public: @@ -36,7 +36,7 @@ namespace yg SymbolElement(Params const & p); SymbolElement(SymbolElement const & se, math::Matrix<double, 3, 3> const & m); - vector<m2::AARectD> const & boundRects() const; + vector<m2::AnyRectD> const & boundRects() const; void draw(gl::OverlayRenderer * s, math::Matrix<double, 3, 3> const & m) const; void map(StylesCache * stylesCache) const; diff --git a/yg/text_element.hpp b/yg/text_element.hpp index 984205087f..833f551e9b 100644 --- a/yg/text_element.hpp +++ b/yg/text_element.hpp @@ -4,7 +4,7 @@ #include "../base/matrix.hpp" -#include "../geometry/aa_rect2d.hpp" +#include "../geometry/any_rect2d.hpp" #include "../std/shared_ptr.hpp" @@ -34,7 +34,7 @@ namespace yg bool m_log2vis; GlyphCache * m_glyphCache; - mutable vector<m2::AARectD> m_boundRects; + mutable vector<m2::AnyRectD> m_boundRects; bool isBidi() const; diff --git a/yg/yg_tests/screengl_test.cpp b/yg/yg_tests/screengl_test.cpp index 0abe4e16af..6edcbf623d 100644 --- a/yg/yg_tests/screengl_test.cpp +++ b/yg/yg_tests/screengl_test.cpp @@ -1135,16 +1135,16 @@ namespace } }; - struct TestDrawAARect + struct TestDrawAnyRect { public: void DoDraw(shared_ptr<yg::gl::Screen> p) { - m2::AARectD r[3] = + m2::AnyRectD r[3] = { - m2::AARectD(m2::PointD(100, 100), math::pi / 6, m2::RectD(0, 0, 50, 20)), - m2::AARectD(m2::PointD(100, 100), math::pi / 6, m2::RectD(0, -10, 50, 10)), - m2::AARectD(m2::PointD(100, 100), math::pi / 6, m2::RectD(0, -22, 50, -2)) + m2::AnyRectD(m2::PointD(100, 100), math::pi / 6, m2::RectD(0, 0, 50, 20)), + m2::AnyRectD(m2::PointD(100, 100), math::pi / 6, m2::RectD(0, -10, 50, 10)), + m2::AnyRectD(m2::PointD(100, 100), math::pi / 6, m2::RectD(0, -22, 50, -2)) }; p->drawRectangle(r[0], yg::Color(255, 0, 0, 128), yg::maxDepth - 2); @@ -1350,7 +1350,7 @@ namespace // UNIT_TEST_GL(TestDrawPathSolid2PX); // UNIT_TEST_GL(TestDrawPathSolid); // UNIT_TEST_GL(TestDrawOverlappedSymbolWithText); -// UNIT_TEST_GL(TestDrawAARect); +// UNIT_TEST_GL(TestDrawAnyRect); // UNIT_TEST_GL(TestDrawSector); // UNIT_TEST_GL(TestDrawPathSolidDiffWidth); // UNIT_TEST_GL(TestDrawPathZigZag); diff --git a/yg/yg_tests/screenglglobal_test.cpp b/yg/yg_tests/screenglglobal_test.cpp index 6cd82daef0..4291b49a52 100644 --- a/yg/yg_tests/screenglglobal_test.cpp +++ b/yg/yg_tests/screenglglobal_test.cpp @@ -15,7 +15,7 @@ namespace void Init() { - m_screenBase.SetFromRect(m2::AARectD(m2::RectD(-20, -10, 20, 10))); + m_screenBase.SetFromRect(m2::AnyRectD(m2::RectD(-20, -10, 20, 10))); m_screenBase.Rotate(math::pi / 6); } |