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

api_mark_point.cpp « map - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5793a6f30e46d7e7d41c9c23d245ab21f7a2d142 (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
75
76
77
78
#include "map/api_mark_point.hpp"

#include "base/logging.hpp"

#include <map>

namespace style
{
std::map<std::string, std::string> kStyleToColor = {
  {"placemark-red", "BookmarkRed"},
  {"placemark-blue", "BookmarkBlue"},
  {"placemark-purple", "BookmarkPurple"},
  {"placemark-yellow", "BookmarkYellow"},
  {"placemark-pink", "BookmarkPink"},
  {"placemark-brown", "BookmarkBrown"},
  {"placemark-green", "BookmarkGreen"},
  {"placemark-orange", "BookmarkOrange"},
  {"placemark-deeppurple", "BookmarkDeepPurple"},
  {"placemark-lightblue", "BookmarkLightBlue"},
  {"placemark-cyan", "BookmarkCyan"},
  {"placemark-teal", "BookmarkTeal"},
  {"placemark-lime", "BookmarkLime"},
  {"placemark-deeporange", "BookmarkDeepOrange"},
  {"placemark-gray", "BookmarkGray"},
  {"placemark-bluegray", "BookmarkBlueGray"}
};

std::string GetSupportedStyle(std::string const & style)
{
  auto const it = kStyleToColor.find(style);
  if (it == kStyleToColor.cend())
    return "BookmarkGreen";
  return it->second;
}
}  // style

ApiMarkPoint::ApiMarkPoint(m2::PointD const & ptOrg)
  : UserMark(ptOrg, UserMark::Type::API)
{}

ApiMarkPoint::ApiMarkPoint(std::string const & name, std::string const & id, std::string const & style,
                           m2::PointD const & ptOrg)
  : UserMark(ptOrg, UserMark::Type::API)
  , m_name(name)
  , m_id(id)
  , m_style(style)
{}

drape_ptr<df::UserPointMark::SymbolNameZoomInfo> ApiMarkPoint::GetSymbolNames() const
{
  //TODO: use its own icon.
  auto symbol = make_unique_dp<SymbolNameZoomInfo>();
  symbol->insert(std::make_pair(1 /* zoomLevel */, "coloredmark-default-s"));
  return symbol;
}

df::ColorConstant ApiMarkPoint::GetColorConstant() const
{
  return m_style;
}

void ApiMarkPoint::SetName(std::string const & name)
{
  SetDirty();
  m_name = name;
}

void ApiMarkPoint::SetApiID(std::string const & id)
{
  SetDirty();
  m_id = id;
}

void ApiMarkPoint::SetStyle(std::string const & style)
{
  SetDirty();
  m_style = style;
}