forked from organicmaps/organicmaps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathread_mwm_task.cpp
58 lines (51 loc) · 952 Bytes
/
read_mwm_task.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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