mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-21 05:43:37 +00:00
committed by
Konstantin Pastbin
parent
c9cbb64f12
commit
76ffc99abd
58
libs/drape_frontend/read_mwm_task.cpp
Normal file
58
libs/drape_frontend/read_mwm_task.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
#include "drape_frontend/read_mwm_task.hpp"
|
||||
|
||||
namespace df
|
||||
{
|
||||
ReadMWMTask::ReadMWMTask(MapDataProvider & model)
|
||||
: m_model(model)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
m_checker = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void ReadMWMTask::Init(std::shared_ptr<TileInfo> const & tileInfo)
|
||||
{
|
||||
m_tileInfo = tileInfo;
|
||||
m_tileKey = tileInfo->GetTileKey();
|
||||
#ifdef DEBUG
|
||||
m_checker = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
void ReadMWMTask::Reset()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
m_checker = false;
|
||||
#endif
|
||||
m_tileInfo.reset();
|
||||
IRoutine::Reset();
|
||||
}
|
||||
|
||||
bool ReadMWMTask::IsCancelled() const
|
||||
{
|
||||
std::shared_ptr<TileInfo> tile = m_tileInfo.lock();
|
||||
if (tile == nullptr)
|
||||
return true;
|
||||
|
||||
return tile->IsCancelled() || IRoutine::IsCancelled();
|
||||
}
|
||||
|
||||
void ReadMWMTask::Do()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
ASSERT(m_checker, ());
|
||||
#endif
|
||||
|
||||
std::shared_ptr<TileInfo> tile = m_tileInfo.lock();
|
||||
if (tile == nullptr)
|
||||
return;
|
||||
try
|
||||
{
|
||||
tile->ReadFeatures(m_model);
|
||||
}
|
||||
catch (TileInfo::ReadCanceledException &)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
} // namespace df
|
||||
Reference in New Issue
Block a user