diff --git a/indexer/cell_id.hpp b/indexer/cell_id.hpp index d9babb1378..6d9a014366 100644 --- a/indexer/cell_id.hpp +++ b/indexer/cell_id.hpp @@ -68,12 +68,12 @@ public: id2 = id2.Parent(); } #if 0 // DEBUG - CoordT minX, minY, maxX, maxY; + double minX, minY, maxX, maxY; GetCellBounds(id1, minX, minY, maxX, maxY); - ASSERT(minX <= x1 && x1 <= maxX, (x1, y1, x2, y2, id1, minX, minY, maxX, maxY)); - ASSERT(minX <= x2 && x2 <= maxX, (x1, y1, x2, y2, id1, minX, minY, maxX, maxY)); - ASSERT(minY <= y1 && y1 <= maxY, (x1, y1, x2, y2, id1, minX, minY, maxX, maxY)); - ASSERT(minY <= y2 && y2 <= maxY, (x1, y1, x2, y2, id1, minX, minY, maxX, maxY)); + ASSERT(my::between_s(minX, maxX, x1), (x1, minX, maxX)); + ASSERT(my::between_s(minX, maxX, x2), (x2, minX, maxX)); + ASSERT(my::between_s(minY, maxY, y1), (y1, minY, maxY)); + ASSERT(my::between_s(minY, maxY, y2), (y2, minY, maxY)); #endif return id1; } diff --git a/indexer/feature_covering.cpp b/indexer/feature_covering.cpp index e153818b4f..29b2459945 100644 --- a/indexer/feature_covering.cpp +++ b/indexer/feature_covering.cpp @@ -207,11 +207,23 @@ RectId GetRectIdAsIs(m2::RectD const & r) { double const eps = MercatorBounds::GetCellID2PointAbsEpsilon(); - return CellIdConverter::Cover2PointsWithCell( + typedef CellIdConverter TConverter; + RectId const id = TConverter::Cover2PointsWithCell( MercatorBounds::ClampX(r.minX() + eps), MercatorBounds::ClampY(r.minY() + eps), MercatorBounds::ClampX(r.maxX() - eps), MercatorBounds::ClampY(r.maxY() - eps)); + + // Calling this function make sence only for rects that are equal with index cells. + // Check it here ... +#ifdef DEBUG + double minX, minY, maxX, maxY; + TConverter::GetCellBounds(id, minX, minY, maxX, maxY); + m2::RectD dbgR(minX, minY, maxX, maxY); + ASSERT(m2::IsEqual(dbgR, r, eps, eps), (r, dbgR)); +#endif + + return id; } int GetCodingDepth(int scale) @@ -241,6 +253,16 @@ IntervalsT const & CoveringGetter::Get(int scale) while (id.Level() >= cellDepth) id = id.Parent(); AppendLowerLevels(id, cellDepth, m_res[ind]); +/* +#ifdef DEBUG + size_t oldSize = m_res[ind].size(); + IntervalsT res; + SortAndMergeIntervals(m_res[ind], res); + if (res.size() != oldSize) + LOG(LDEBUG, ("Old =", oldSize, "; New =", res.size())); + res.swap(m_res[ind]); +#endif +*/ break; }