diff --git a/indexer/feature.hpp b/indexer/feature.hpp index f2b26ff623..137775cdf2 100644 --- a/indexer/feature.hpp +++ b/indexer/feature.hpp @@ -374,6 +374,8 @@ public: string GetPreferredDrawableName() const; + uint8_t GetRank() const { return m_Params.rank; } + /// @name Statistic functions. //@{ void ParseBeforeStatistic() const diff --git a/map/drawer_yg.cpp b/map/drawer_yg.cpp index 66a82bb049..677bb8c55d 100644 --- a/map/drawer_yg.cpp +++ b/map/drawer_yg.cpp @@ -225,7 +225,7 @@ bool DrawerYG::filter_text_size(rule_ptr_t pRule) const return pRule->GetTextHeight() * m_scale <= min_text_height_filtered; } -void DrawerYG::drawText(m2::PointD const & pt, string const & name, rule_ptr_t pRule, yg::EPosition pos, int depth) +void DrawerYG::drawText(m2::PointD const & pt, di::DrawInfo const * pInfo, rule_ptr_t pRule, yg::EPosition pos, int depth) { int const color = pRule->GetFillColor(); yg::Color textColor(color == -1 ? yg::Color(0, 0, 0, 0) : yg::Color::fromXRGB(color, pRule->GetAlpha())); @@ -237,6 +237,7 @@ void DrawerYG::drawText(m2::PointD const & pt, string const & name, rule_ptr_t p // bool isMasked = pRule->GetColor() != -1; bool isMasked = true; yg::FontDesc fontDesc(false, get_text_font_size(pRule), textColor, isMasked, yg::Color(255, 255, 255, 255)); + fontDesc.SetRank(pInfo->m_rank); if (!filter_text_size(pRule)) m_pScreen->drawText( @@ -244,7 +245,7 @@ void DrawerYG::drawText(m2::PointD const & pt, string const & name, rule_ptr_t p pt, pos, 0.0, - name, + pInfo->m_name, depth, true); } @@ -367,7 +368,7 @@ void DrawerYG::Draw(di::DrawInfo const * pInfo, di::DrawRule const * rules, size if (isArea && isN) { for (list::const_iterator i = pInfo->m_areas.begin(); i != pInfo->m_areas.end(); ++i) - drawText(i->GetCenter(), pInfo->m_name, pRule, yg::EPosAbove, depth); + drawText(i->GetCenter(), pInfo, pRule, yg::EPosAbove, depth); } // draw way name @@ -402,7 +403,7 @@ void DrawerYG::Draw(di::DrawInfo const * pInfo, di::DrawRule const * rules, size // draw point text isN = ((pRule->GetType() & drule::node) != 0); if (!isPath && !isArea && isN) - drawText(pInfo->m_point, pInfo->m_name, pRule, yg::EPosAbove, depth); + drawText(pInfo->m_point, pInfo, pRule, yg::EPosAbove, depth); } } } diff --git a/map/drawer_yg.hpp b/map/drawer_yg.hpp index 9114f47d2f..e8746654ec 100644 --- a/map/drawer_yg.hpp +++ b/map/drawer_yg.hpp @@ -32,13 +32,14 @@ namespace di class DrawInfo { public: - DrawInfo(string const & name) : m_name(name) {} + DrawInfo(string const & name, uint8_t rank) : m_name(name), m_rank(rank) {} list m_pathes; list m_areas; m2::PointD m_point; string m_name; + uint8_t m_rank; }; struct DrawRule @@ -74,7 +75,7 @@ protected: void drawPath(vector const & pts, di::DrawRule const * rules, size_t count); void drawArea(vector const & pts, rule_ptr_t pRule, int depth); - void drawText(m2::PointD const & pt, string const & name, rule_ptr_t pRule, yg::EPosition pos, int depth); + void drawText(m2::PointD const & pt, di::DrawInfo const * pInfo, rule_ptr_t pRule, yg::EPosition pos, int depth); bool drawPathText(di::PathInfo const & info, string const & name, uint8_t fontSize, int depth); typedef shared_ptr texture_t; diff --git a/map/framework.cpp b/map/framework.cpp index 924f5ebf6d..966c04158c 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -158,7 +158,7 @@ namespace fwork m_renderState->m_isEmptyModelCurrent = false; - shared_ptr ptr(new di::DrawInfo(f.GetPreferredDrawableName())); + shared_ptr ptr(new di::DrawInfo(f.GetPreferredDrawableName(), f.GetRank())); DrawerYG * pDrawer = GetDrawer(); diff --git a/yg/font_desc.cpp b/yg/font_desc.cpp index 346f55c741..ed23dfb79f 100644 --- a/yg/font_desc.cpp +++ b/yg/font_desc.cpp @@ -1,6 +1,11 @@ #include "../base/SRC_FIRST.hpp" + #include "font_desc.hpp" +#include "../std/cmath.hpp" +#include "../std/algorithm.hpp" + + namespace yg { FontDesc const & FontDesc::defaultFont = FontDesc(); @@ -11,6 +16,13 @@ namespace yg m_isMasked(isMasked), m_maskColor(maskColor) {} + void FontDesc::SetRank(uint8_t rank) + { + m_size += static_cast(min(4.0E6, std::pow(1.1, double(rank))) / 2.0E6 * m_size); + //m_size += static_cast((double(rank) / 200.0) * m_size); + //m_size += (rank / 20); + } + bool FontDesc::operator ==(FontDesc const & src) const { return (m_isStatic == src.m_isStatic) diff --git a/yg/font_desc.hpp b/yg/font_desc.hpp index ab67c3786d..536a2ea331 100644 --- a/yg/font_desc.hpp +++ b/yg/font_desc.hpp @@ -15,6 +15,8 @@ namespace yg FontDesc(bool isStatic = true, int size = 10, yg::Color const & color = yg::Color(0, 0, 0, 255), bool isMasked = true, yg::Color const & maskColor = yg::Color(255, 255, 255, 255)); + void SetRank(uint8_t rank); + bool operator != (FontDesc const & src) const; bool operator == (FontDesc const & src) const; bool operator < (FontDesc const & src) const;