blob: 40d111ec564079a7a0407660bad443da4231e843 (
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
|
#include "map/local_ads_mark.hpp"
#include "drape_frontend/color_constants.hpp"
#include <utility>
namespace
{
static std::string const kLocalAdsPrimaryText = "LocalAdsPrimaryText";
static std::string const kLocalAdsPrimaryTextOutline = "LocalAdsPrimaryTextOutline";
static std::string const kLocalAdsSecondaryText = "LocalAdsSecondaryText";
static std::string const kLocalAdsSecondaryTextOutline = "LocalAdsSecondaryTextOutline";
float const kLocalAdsPrimaryTextSize = 11.0f;
float const kLocalAdsSecondaryTextSize = 10.0f;
float const kSecondaryOffsetY = 2.0;
} // namespace
LocalAdsMark::LocalAdsMark(m2::PointD const & ptOrg)
: UserMark(ptOrg, Type::LOCAL_ADS)
{
m_titleDecl.m_anchor = dp::Top;
m_titleDecl.m_primaryTextFont.m_color = df::GetColorConstant(kLocalAdsPrimaryText);
m_titleDecl.m_primaryTextFont.m_outlineColor = df::GetColorConstant(kLocalAdsPrimaryTextOutline);
m_titleDecl.m_primaryTextFont.m_size = kLocalAdsPrimaryTextSize;
m_titleDecl.m_secondaryTextFont.m_color = df::GetColorConstant(kLocalAdsSecondaryText);
m_titleDecl.m_secondaryTextFont.m_outlineColor = df::GetColorConstant(kLocalAdsSecondaryTextOutline);
m_titleDecl.m_secondaryTextFont.m_size = kLocalAdsSecondaryTextSize;
m_titleDecl.m_secondaryOffset = m2::PointF(0, kSecondaryOffsetY);
}
drape_ptr<df::UserPointMark::SymbolNameZoomInfo> LocalAdsMark::GetSymbolNames() const
{
auto symbol = make_unique_dp<SymbolNameZoomInfo>();
symbol->insert(std::make_pair(1 /* zoomLevel */, m_data.m_symbolName));
return symbol;
}
df::DepthLayer LocalAdsMark::GetDepthLayer() const
{
return df::DepthLayer::LocalAdsMarkLayer;
}
drape_ptr<df::UserPointMark::TitlesInfo> LocalAdsMark::GetTitleDecl() const
{
auto titles = make_unique_dp<TitlesInfo>();
titles->push_back(m_titleDecl);
return titles;
}
void LocalAdsMark::SetData(LocalAdsMarkData && data)
{
SetDirty();
m_data = std::move(data);
m_titleDecl.m_primaryText = m_data.m_mainText;
if (!m_titleDecl.m_primaryText.empty())
m_titleDecl.m_secondaryText = m_data.m_auxText;
else
m_titleDecl.m_secondaryText.clear();
}
void LocalAdsMark::SetFeatureId(FeatureID const & id)
{
SetDirty();
m_featureId = id;
}
|