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

engine_context.hpp « drape_frontend - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7dfd19e27f3eaf20094834d6d975ab7cb6c03389 (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
59
60
61
62
63
64
65
66
#pragma once

#include "drape_frontend/custom_features_context.hpp"
#include "drape_frontend/map_shape.hpp"
#include "drape_frontend/tile_utils.hpp"
#include "drape_frontend/threads_commutator.hpp"
#include "drape_frontend/traffic_generator.hpp"

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

#include <functional>

namespace dp
{
class TextureManager;
}  // namespace dp

namespace df
{
class Message;
class MetalineManager;

class EngineContext
{
public:
  using TIsUGCFn = std::function<bool (FeatureID const &)>;
  EngineContext(TileKey tileKey,
                ref_ptr<ThreadsCommutator> commutator,
                ref_ptr<dp::TextureManager> texMng,
                ref_ptr<MetalineManager> metalineMng,
                CustomFeaturesContextWeakPtr customFeaturesContext,
                bool is3dBuildingsEnabled,
                bool isTrafficEnabled,
                int displacementMode,
                TIsUGCFn const & isUGCFn);

  TileKey const & GetTileKey() const { return m_tileKey; }
  bool Is3dBuildingsEnabled() const { return m_3dBuildingsEnabled; }
  bool IsTrafficEnabled() const { return m_trafficEnabled; }
  bool IsUGC(FeatureID const & fid) { return m_isUGCFn ? m_isUGCFn(fid) : false; }
  int GetDisplacementMode() const { return m_displacementMode; }
  CustomFeaturesContextWeakPtr GetCustomFeaturesContext() const { return m_customFeaturesContext; }
  ref_ptr<dp::TextureManager> GetTextureManager() const;
  ref_ptr<MetalineManager> GetMetalineManager() const;

  void BeginReadTile();
  void Flush(TMapShapes && shapes);
  void FlushOverlays(TMapShapes && shapes);
  void FlushTrafficGeometry(TrafficSegmentsGeometry && geometry);
  void EndReadTile();

private:
  void PostMessage(drape_ptr<Message> && message);

  TileKey m_tileKey;
  ref_ptr<ThreadsCommutator> m_commutator;
  ref_ptr<dp::TextureManager> m_texMng;
  ref_ptr<MetalineManager> m_metalineMng;
  CustomFeaturesContextWeakPtr m_customFeaturesContext;
  bool m_3dBuildingsEnabled;
  bool m_trafficEnabled;
  int m_displacementMode;
  TIsUGCFn m_isUGCFn;
};
}  // namespace df