[ios] fixed Tiler object to generate less tiles.

This commit is contained in:
rachytski 2012-10-18 17:32:02 +03:00 committed by Alex Zolotarev
parent 258032e4d1
commit 73873c693a
3 changed files with 24 additions and 8 deletions

View file

@ -248,7 +248,13 @@ void ScreenCoverage::SetScreen(ScreenBase const & screen)
vector<Tiler::RectInfo> newRects;
TTileSet tiles;
m_tiler.tiles(allRects, GetPlatform().PreCachingDepth());
#ifdef OMIM_OS_IPHONE
int cacheDepthes[] = {0, 1};
#else
int cacheDepthes[] = {0, 1, 2};
#endif
m_tiler.tiles(allRects, cacheDepthes, sizeof(cacheDepthes) / sizeof(int));
TileCache * tileCache = &m_tileRenderer->GetTileCache();
@ -342,7 +348,13 @@ void ScreenCoverage::SetScreen(ScreenBase const & screen)
// if (m_tiler.isLeaf(nr) || (childTilesToDraw > 1))
if ((nr.m_tileScale == m_tiler.tileScale() - 2)
#ifdef OMIM_OS_IPHONE
int step = 1;
#else
int step = 2;
#endif
if ((nr.m_tileScale == m_tiler.tileScale() - step)
||(nr.m_tileScale == m_tiler.tileScale() ))
firstClassTiles.push_back(nr);
else

View file

@ -89,7 +89,7 @@ void Tiler::seed(ScreenBase const & screen, m2::PointD const & centerPt, size_t
m_tileScale = getTileScale(screen, tileSize);
}
void Tiler::tiles(vector<RectInfo> & tiles, int depth)
void Tiler::tiles(vector<RectInfo> & tiles, int const * depthes, unsigned count)
{
if (m_tileScale == 0)
return;
@ -97,12 +97,16 @@ void Tiler::tiles(vector<RectInfo> & tiles, int depth)
/// clearing previous coverage
tiles.clear();
if (m_tileScale - depth < 0)
depth = m_tileScale;
int maxDepth = depthes[count - 1];
for (unsigned i = 0; i < depth; ++i)
for (int j = count - 1; j >= 0; --j)
{
int pow = depth - 1 - i;
int curDepth = depthes[j];
if (m_tileScale - curDepth < 0)
curDepth = m_tileScale;
int pow = maxDepth - curDepth;
int scale = 1 << pow;

View file

@ -40,7 +40,7 @@ public:
/// seed tiler with new screenBase.
void seed(ScreenBase const & screenBase, m2::PointD const & centerPt, size_t tileSize);
void tiles(vector<RectInfo> & tiles, int depth);
void tiles(vector<RectInfo> & tiles, int const * depthes, unsigned count);
bool isLeaf(RectInfo const & ri) const;
int tileScale() const;