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

metaline_manager.hpp « drape_frontend - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f1aa0908e4141477a4a67e15c0f9173cde5a1bd2 (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
#pragma once

#include "drape_frontend/read_metaline_task.hpp"

#include "drape/object_pool.hpp"
#include "drape/pointers.hpp"

#include "indexer/feature_decl.hpp"

#include <mutex>
#include <set>

namespace df
{
class ThreadsCommutator;

class MetalineManager
{
public:
  MetalineManager(ref_ptr<ThreadsCommutator> commutator, MapDataProvider & model);
  ~MetalineManager();

  void Start();
  void Stop();

  void Update(std::set<MwmSet::MwmId> const & mwms);

  m2::SharedSpline GetMetaline(FeatureID const & fid) const;

private:
  void OnTaskFinished(threads::IRoutine * task);

  using TasksPool = dp::ObjectPool<ReadMetalineTask, ReadMetalineTaskFactory>;

  MapDataProvider & m_model;

  MetalineCache m_metalineCache;
  mutable std::mutex m_metalineCacheMutex;

  std::set<MwmSet::MwmId> m_mwms;
  std::mutex m_mwmsMutex;

  TasksPool m_tasksPool;
  drape_ptr<threads::ThreadPool> m_threadsPool;
  ref_ptr<ThreadsCommutator> m_commutator;
};
}  // namespace df