Welcome to mirror list, hosted at ThFree Co, Russian Federation.

read_mwm_task.cpp « drape_frontend - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4421a9c7610450a5217036419fc2c7500ceefbc8 (plain)
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(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();
}

bool ReadMWMTask::IsCancelled() const
{
  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

  shared_ptr<TileInfo> tile = m_tileInfo.lock();
  if (tile == nullptr)
    return;
  try
  {
    tile->ReadFeatures(m_model);
  }
  catch (TileInfo::ReadCanceledException &)
  {
    return;
  }
}

} // namespace df