MCPcopy Create free account
hub / github.com/comaps/comaps / AddLabel

Method AddLabel

libs/drape_frontend/gui/debug_label.cpp:49–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49void DebugInfoLabels::AddLabel(ref_ptr<dp::TextureManager> tex, std::string const & caption,
50 TUpdateDebugLabelFn const & onUpdateFn)
51{
52 std::string alphabet;
53 std::set<char> symbols;
54 AddSymbols(caption, symbols);
55 AddSymbols("0123456789.-e", symbols);
56
57 alphabet.reserve(symbols.size());
58 for (auto const & ch : symbols)
59 alphabet.push_back(ch);
60
61 MutableLabelDrawer::Params params;
62 params.m_anchor = dp::LeftTop;
63 params.m_alphabet = alphabet;
64 params.m_maxLength = 100;
65 params.m_font = DrapeGui::GetGuiTextFont();
66 params.m_font.m_color = dp::Color(0, 0, 255, 255);
67 params.m_font.m_size *= 1.2;
68 params.m_pivot = m_position.m_pixelPivot;
69
70#ifdef RENDER_DEBUG_INFO_LABELS
71 uint32_t const id = GuiHandleDebugLabel + m_labelsCount;
72
73 params.m_handleCreator = [id, onUpdateFn, tex](dp::Anchor anchor, m2::PointF const & pivot)
74 { return make_unique_dp<DebugLabelHandle>(id, anchor, pivot, tex, onUpdateFn); };
75#endif
76 m_labelsParams.push_back(params);
77 ++m_labelsCount;
78}
79
80drape_ptr<ShapeRenderer> DebugInfoLabels::Draw(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::TextureManager> tex)
81{

Callers 1

RecacheDebugLabelsMethod · 0.80

Calls 5

AddSymbolsFunction · 0.85
ColorClass · 0.50
reserveMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected