From 3d208531a70cc4931ce21840a223f5f050221916 Mon Sep 17 00:00:00 2001 From: vng Date: Thu, 24 Mar 2011 22:03:23 +0200 Subject: [PATCH] Some minor fixes. --- indexer/geometry_coding.cpp | 5 +++-- indexer/geometry_serialization.cpp | 2 ++ indexer/index.hpp | 9 ++++----- indexer/point_to_int64.cpp | 6 ++---- map/framework.hpp | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/indexer/geometry_coding.cpp b/indexer/geometry_coding.cpp index 7c17f3c29f..502ff17d6c 100644 --- a/indexer/geometry_coding.cpp +++ b/indexer/geometry_coding.cpp @@ -14,8 +14,9 @@ namespace template inline m2::PointU ClampPoint(m2::PointU const & maxPoint, m2::Point const & point) { - return m2::PointU(my::clamp(static_cast(point.x), static_cast(0), maxPoint.x), - my::clamp(static_cast(point.y), static_cast(0), maxPoint.y)); + typedef m2::PointU::value_type uvalue_t; + return m2::PointU(my::clamp(static_cast(point.x), static_cast(0), maxPoint.x), + my::clamp(static_cast(point.y), static_cast(0), maxPoint.y)); } } diff --git a/indexer/geometry_serialization.cpp b/indexer/geometry_serialization.cpp index 03a9b457fe..af1bc7b231 100644 --- a/indexer/geometry_serialization.cpp +++ b/indexer/geometry_serialization.cpp @@ -24,6 +24,8 @@ namespace serial inline m2::PointD U2D(m2::PointU const & p) { CoordPointT const pt = PointU2PointD(p); + ASSERT ( MercatorBounds::minX <= pt.first && pt.first <= MercatorBounds::maxX, (pt.first) ); + ASSERT ( MercatorBounds::minY <= pt.second && pt.second <= MercatorBounds::maxY, (pt.second) ); return m2::PointD(pt.first, pt.second); } diff --git a/indexer/index.hpp b/indexer/index.hpp index 1a3f7b0c7c..f10bee5973 100644 --- a/indexer/index.hpp +++ b/indexer/index.hpp @@ -134,7 +134,7 @@ public: m_eActiveForEachIndexAction = ACTIVE_FOR_EACH_INDEX_DO_NOTHING; } - if (IndexT * pIndex = m_pActiveForEachIndex->GetIndex(scale, occlusionRect)) + if (IndexT * pIndex = m_pActiveForEachIndex->GetIndex(static_cast(scale), occlusionRect)) pIndex->ForEachInIntervalAndScale(f, beg, end, scale, query); } @@ -225,11 +225,10 @@ private: } // TODO: GetIndex(), Open() and Close() make Index single-threaded! - IndexT * GetIndex(uint32_t scale, m2::RectD const & occlusionRect) + IndexT * GetIndex(int scale, m2::RectD const & occlusionRect) { - if ((m_scaleRange.first <= static_cast(scale) - && static_cast(scale) <= m_scaleRange.second) - && m_Rect.IsIntersect(occlusionRect)) + if ((m_scaleRange.first <= scale && scale <= m_scaleRange.second) && + m_Rect.IsIntersect(occlusionRect)) { Open(); m_QueriesSkipped = 0; diff --git a/indexer/point_to_int64.cpp b/indexer/point_to_int64.cpp index 93c990d81b..15e1763351 100644 --- a/indexer/point_to_int64.cpp +++ b/indexer/point_to_int64.cpp @@ -14,10 +14,8 @@ m2::PointU PointD2PointU(CoordT x, CoordT y) { - if (x < MercatorBounds::minX) x = MercatorBounds::minX; - if (y < MercatorBounds::minY) y = MercatorBounds::minY; - if (x > MercatorBounds::maxX) x = MercatorBounds::maxX; - if (y > MercatorBounds::maxY) y = MercatorBounds::maxY; + x = my::clamp(x, MercatorBounds::minX, MercatorBounds::maxX); + y = my::clamp(y, MercatorBounds::minY, MercatorBounds::maxY); uint32_t const ix = static_cast(0.5 + (x - MercatorBounds::minX) / (MercatorBounds::maxX - MercatorBounds::minX) * (1 << POINT_COORD_BITS)); diff --git a/map/framework.hpp b/map/framework.hpp index 7e1b6755f3..ccf4ad9be3 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -508,7 +508,7 @@ public: Invalidate(); } - /// Show all model by it's worl rect. + /// Show all model by it's world rect. void ShowAll() { SetMaxWorldRect();