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

drape_api.hpp « drape_frontend - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4d3b63fcf083e1ce329169302c5d6fd8ae4d4197 (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
67
68
69
70
71
72
73
74
#pragma once

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

#include "geometry/point2d.hpp"

#include "std/mutex.hpp"
#include "std/unordered_map.hpp"
#include "std/vector.hpp"

namespace df
{

class DrapeEngine;

struct DrapeApiLineData
{
  DrapeApiLineData() = default;

  DrapeApiLineData(vector<m2::PointD> const & points, dp::Color const & color)
    : m_points(points)
    , m_color(color)
  {}

  DrapeApiLineData & ShowPoints(bool markPoints)
  {
    m_showPoints = true;
    m_markPoints = markPoints;
    return *this;
  }

  DrapeApiLineData & Width(float width)
  {
    m_width = width;
    return *this;
  }

  DrapeApiLineData & ShowId()
  {
    m_showId = true;
    return *this;
  }

  vector<m2::PointD> m_points;
  float m_width = 1.0f;
  dp::Color m_color;

  bool m_showPoints = false;
  bool m_markPoints = false;
  bool m_showId = false;
};

class DrapeApi
{
public:
  using TLines = unordered_map<string, DrapeApiLineData>;

  DrapeApi() = default;

  void SetEngine(ref_ptr<DrapeEngine> engine);

  void AddLine(string const & id, DrapeApiLineData const & data);
  void RemoveLine(string const & id);
  void Clear();
  void Invalidate();

private:
  ref_ptr<DrapeEngine> m_engine;
  TLines m_lines;
  mutex m_mutex;
};

} // namespace df