[indexer] Fix for review

This commit is contained in:
Anatoly Serdtcev 2018-12-27 16:41:18 +03:00 committed by mpimenov
parent 50b66e6985
commit c7d258558d
3 changed files with 11 additions and 11 deletions

View file

@ -36,7 +36,7 @@ inline size_t SplitRectCell(CellId const & id, m2::RectD const & rect,
// Covers |rect| with at most |cellsCount| cells that have levels equal to or less than |maxLevel|.
template <typename Bounds, typename CellId>
inline void CoverRectByCells(m2::RectD rect, size_t cellsCount, int maxLevel, std::vector<CellId> & result)
inline void CoverRect(m2::RectD rect, size_t cellsCount, int maxLevel, std::vector<CellId> & result)
{
ASSERT(result.empty(), ());
{
@ -105,7 +105,7 @@ inline void CoverRectByCells(m2::RectD rect, size_t cellsCount, int maxLevel, st
// Covers |rect| with cells using spiral order starting from the rect center cell of |maxLevel|.
template <typename Bounds, typename CellId>
void CoverSpiralByCells(m2::RectD rect, int maxLevel, std::vector<CellId> & result)
void CoverSpiral(m2::RectD rect, int maxLevel, std::vector<CellId> & result)
{
using Converter = CellIdConverter<Bounds, CellId>;

View file

@ -78,7 +78,7 @@ void CoverViewportAndAppendLowerLevels(m2::RectD const & r, int cellDepth, Inter
{
std::vector<m2::CellId<DEPTH_LEVELS>> ids;
ids.reserve(SPLIT_RECT_CELLS_COUNT);
CoverRectByCells<MercatorBounds, m2::CellId<DEPTH_LEVELS>>(r, SPLIT_RECT_CELLS_COUNT, cellDepth - 1, ids);
CoverRect<MercatorBounds, m2::CellId<DEPTH_LEVELS>>(r, SPLIT_RECT_CELLS_COUNT, cellDepth - 1, ids);
Intervals intervals;
for (auto const & id : ids)
@ -153,7 +153,7 @@ public:
case Spiral:
{
std::vector<m2::CellId<DEPTH_LEVELS>> ids;
CoverSpiralByCells<MercatorBounds, m2::CellId<DEPTH_LEVELS>>(m_rect, cellDepth - 1, ids);
CoverSpiral<MercatorBounds, m2::CellId<DEPTH_LEVELS>>(m_rect, cellDepth - 1, ids);
std::set<Interval> uniqueIds;
auto insertInterval = [this, ind, &uniqueIds](Interval const & interval) {

View file

@ -18,10 +18,10 @@ UNIT_TEST(CellIdToStringRecode)
TEST_EQUAL(CellIdT::FromString(kTest).ToString(), kTest, ());
}
UNIT_TEST(GoldenCoverRectByCells)
UNIT_TEST(GoldenCoverRect)
{
vector<CellIdT> cells;
CoverRectByCells<OrthoBounds>({27.43, 53.83, 27.70, 53.96}, 4, RectId::DEPTH_LEVELS - 1, cells);
CoverRect<OrthoBounds>({27.43, 53.83, 27.70, 53.96}, 4, RectId::DEPTH_LEVELS - 1, cells);
TEST_EQUAL(cells.size(), 4, ());
@ -31,12 +31,12 @@ UNIT_TEST(GoldenCoverRectByCells)
TEST_EQUAL(cells[3].ToString(), "32012211303", ());
}
UNIT_TEST(ArtificialCoverRectByCells)
UNIT_TEST(ArtificialCoverRect)
{
typedef Bounds<0, 0, 16, 16> TestBounds;
vector<CellIdT> cells;
CoverRectByCells<TestBounds>({5, 5, 11, 11}, 4, RectId::DEPTH_LEVELS - 1, cells);
CoverRect<TestBounds>({5, 5, 11, 11}, 4, RectId::DEPTH_LEVELS - 1, cells);
TEST_EQUAL(cells.size(), 4, ());
@ -46,7 +46,7 @@ UNIT_TEST(ArtificialCoverRectByCells)
TEST_EQUAL(cells[3].ToString(), "30", ());
}
UNIT_TEST(MaxDepthCoverSpiralByCells)
UNIT_TEST(MaxDepthCoverSpiral)
{
using TestBounds = Bounds<0, 0, 8, 8>;
@ -54,9 +54,9 @@ UNIT_TEST(MaxDepthCoverSpiralByCells)
{
auto cells = vector<m2::CellId<3>>{};
CoverSpiralByCells<TestBounds, m2::CellId<3>>({2.1, 4.1, 2.1, 4.1}, levelMax, cells);
CoverSpiral<TestBounds, m2::CellId<3>>({2.1, 4.1, 2.1, 4.1}, levelMax, cells);
TEST_EQUAL(cells.size(), 1, ());
TEST_EQUAL(cells[0].Level(), depthMax - 1, ());
TEST_EQUAL(cells[0].Level(), levelMax - 1, ());
}
}