aboutsummaryrefslogtreecommitdiff
path: root/libs/map/api_mark_point.cpp
blob: 34fa0aaa5e5566b80c5e1ca3b8b94d6b28c87cc1 (plain) (blame)
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
#include "map/api_mark_point.hpp"

#include <map>

namespace style
{
std::map<std::string_view, df::ColorConstant> 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"},
};

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

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

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(df::ColorConstant style)
{
  SetDirty();
  m_style = style;
}