forked from organicmaps/organicmaps
Added additional debug checks.
This commit is contained in:
parent
139cfd00d4
commit
5d35ecef20
2 changed files with 28 additions and 6 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue