Tiles reading fixed.

This commit is contained in:
Daria Volvenkova 2016-03-24 11:52:12 +03:00
parent 635be54e90
commit 3eb9e4363c
6 changed files with 20 additions and 15 deletions

View file

@ -29,7 +29,7 @@ public:
private:
typedef pair<dp::Batcher *, int> TBatcherPair;
typedef map<TileKey, TBatcherPair> TBatcherMap;
typedef map<TileKey, TBatcherPair, TileKeyStrictComparator> TBatcherMap;
typedef TBatcherMap::iterator TIterator;
TSendMessageFn m_sendMessageFn;

View file

@ -598,6 +598,7 @@ void FrontendRenderer::AcceptMessage(ref_ptr<Message> message)
// Request new tiles.
ScreenBase screen = m_userEventStream.GetCurrentScreen();
m_lastReadedModelView = screen;
m_requestedTiles->Set(screen, m_isIsometry || screen.isPerspective(), ResolveTileKeys(screen));
m_commutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
make_unique_dp<UpdateReadManagerMessage>(),
@ -760,6 +761,7 @@ void FrontendRenderer::InvalidateRect(m2::RectD const & gRect)
blocker.Wait();
// Request new tiles.
m_lastReadedModelView = screen;
m_requestedTiles->Set(screen, m_isIsometry || screen.isPerspective(), ResolveTileKeys(screen));
m_commutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
make_unique_dp<UpdateReadManagerMessage>(),
@ -1577,10 +1579,14 @@ void FrontendRenderer::UpdateScene(ScreenBase const & modelView)
for (RenderLayer & layer : m_layers)
layer.m_isDirty |= RemoveGroups(removePredicate, layer.m_renderGroups, make_ref(m_overlayTree));
m_requestedTiles->Set(modelView, m_isIsometry || modelView.isPerspective(), ResolveTileKeys(modelView));
m_commutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
make_unique_dp<UpdateReadManagerMessage>(),
MessagePriority::UberHighSingleton);
if (m_lastReadedModelView != modelView)
{
m_lastReadedModelView = modelView;
m_requestedTiles->Set(modelView, m_isIsometry || modelView.isPerspective(), ResolveTileKeys(modelView));
m_commutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
make_unique_dp<UpdateReadManagerMessage>(),
MessagePriority::UberHighSingleton);
}
}
void FrontendRenderer::EmitModelViewChanged(ScreenBase const & modelView) const

View file

@ -271,6 +271,7 @@ private:
TTapEventInfoFn m_tapEventInfoFn;
TUserPositionChangedFn m_userPositionChangedFn;
ScreenBase m_lastReadedModelView;
TTilesCollection m_notFinishedTiles;
int m_currentZoomLevel = -1;

View file

@ -40,7 +40,6 @@ ReadManager::ReadManager(ref_ptr<ThreadsCommutator> commutator, MapDataProvider
: m_commutator(commutator)
, m_model(model)
, m_pool(make_unique_dp<threads::ThreadPool>(ReadCount(), bind(&ReadManager::OnTaskFinished, this, _1)))
, m_forceUpdate(true)
, m_have3dBuildings(false)
, m_allow3dBuildings(allow3dBuildings)
, m_modeChanged(false)
@ -88,10 +87,6 @@ void ReadManager::OnTaskFinished(threads::IRoutine * task)
void ReadManager::UpdateCoverage(ScreenBase const & screen, bool have3dBuildings,
TTilesCollection const & tiles, ref_ptr<dp::TextureManager> texMng)
{
if (screen == m_currentViewport && !m_forceUpdate)
return;
m_forceUpdate = false;
m_modeChanged |= (m_have3dBuildings != have3dBuildings);
m_have3dBuildings = have3dBuildings;
@ -160,8 +155,6 @@ void ReadManager::Invalidate(TTilesCollection const & keyStorage)
CancelTileInfo(info);
m_tileInfos.erase(info);
}
m_forceUpdate = true;
}
void ReadManager::InvalidateAll()
@ -171,7 +164,6 @@ void ReadManager::InvalidateAll()
m_tileInfos.clear();
m_forceUpdate = true;
m_modeChanged = true;
}
@ -271,7 +263,6 @@ void ReadManager::Allow3dBuildings(bool allow3dBuildings)
if (m_allow3dBuildings != allow3dBuildings)
{
m_modeChanged = true;
m_forceUpdate = true;
m_allow3dBuildings = allow3dBuildings;
}
}

View file

@ -54,7 +54,6 @@ private:
drape_ptr<threads::ThreadPool> m_pool;
ScreenBase m_currentViewport;
bool m_forceUpdate;
bool m_have3dBuildings;
bool m_allow3dBuildings;
bool m_modeChanged;

View file

@ -31,6 +31,14 @@ struct TileKey
uint64_t m_generation;
};
struct TileKeyStrictComparator
{
bool operator() (TileKey const & lhs, TileKey const & rhs) const
{
return lhs.LessStrict(rhs);
}
};
string DebugPrint(TileKey const & key);
} // namespace df