diff options
author | vng <viktor.govako@gmail.com> | 2015-10-29 15:24:41 +0300 |
---|---|---|
committer | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2015-11-30 16:26:54 +0300 |
commit | 5d35ecef20dafb3d81f6ae44adca8a3b470bfd4d (patch) | |
tree | a2f47407ca24b1818d2de2ac0541b56749a081f3 /indexer/feature_covering.cpp | |
parent | 139cfd00d471629ad298ceb4bfbc8f3e6dd0e31f (diff) |
Added additional debug checks.
Diffstat (limited to 'indexer/feature_covering.cpp')
-rw-r--r-- | indexer/feature_covering.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
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<MercatorBounds, RectId>::Cover2PointsWithCell( + typedef CellIdConverter<MercatorBounds, RectId> 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; } |