diff options
author | ExMix <rahuba.youri@mapswithme.com> | 2014-09-22 14:15:02 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:28:35 +0300 |
commit | 5d2d3894a99a49da405578cd204d1bc541827748 (patch) | |
tree | 8e5866dc9067b4a20d7795f1f8b14c89b0df0390 /map/track.cpp | |
parent | ef0f588cf3e4e06e3e3b1f9f4145052e766b7b23 (diff) |
[core] draw symbols on begin\end points of track
Diffstat (limited to 'map/track.cpp')
-rw-r--r-- | map/track.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/map/track.cpp b/map/track.cpp index 192ed9fa35..bb2e2a39a8 100644 --- a/map/track.cpp +++ b/map/track.cpp @@ -36,6 +36,14 @@ void Track::DeleteDisplayList() const } } +void Track::AddClosingSymbol(bool isBeginSymbol, string const & symbolName, graphics::EPosition pos, double depth) +{ + if (isBeginSymbol) + m_beginSymbols.push_back(make_pair(symbolName, make_pair(pos, depth))); + else + m_endSymbols.push_back(make_pair(symbolName, make_pair(pos, depth))); +} + void Track::Draw(graphics::Screen * pScreen, MatrixT const & matrix) const { pScreen->drawDisplayList(m_dList, matrix); @@ -86,6 +94,20 @@ void Track::CreateDisplayList(graphics::Screen * dlScreen, MatrixT const & matri dlScreen->drawPath(pts2.data(), pts2.size(), 0, resId, graphics::tracksDepth); + if (!m_beginSymbols.empty() || !m_endSymbols.empty()) + { + m2::PointD pivot = pts2.front(); + auto symDrawer = [&dlScreen, &pivot](TClosingSymbol const & symbol) + { + dlScreen->drawSymbol(pivot, symbol.first, symbol.second.first, symbol.second.second); + }; + + for_each(m_beginSymbols.begin(), m_beginSymbols.end(), symDrawer); + + pivot = pts2.back(); + for_each(m_endSymbols.begin(), m_endSymbols.end(), symDrawer); + } + dlScreen->setDisplayList(0); dlScreen->endFrame(); } @@ -123,6 +145,8 @@ void Track::Swap(Track & rhs) swap(m_isMarked, rhs.m_isMarked); swap(m_outlineColor, rhs.m_outlineColor); swap(m_outlineWidth, rhs.m_outlineWidth); + swap(m_beginSymbols, rhs.m_beginSymbols); + swap(m_endSymbols, rhs.m_endSymbols); m_name.swap(rhs.m_name); m_polyline.Swap(rhs.m_polyline); |