Files
comaps/drape_frontend/read_mwm_task.cpp
Konstantin Pastbin e3e4a1985a Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
2025-05-08 21:10:51 +07:00

59 lines
952 B
C++

#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