diff --git a/graphics/depth_constants.hpp b/graphics/depth_constants.hpp index d1adf27e0c..cad5fc8320 100644 --- a/graphics/depth_constants.hpp +++ b/graphics/depth_constants.hpp @@ -20,7 +20,9 @@ namespace graphics static const int locationDepth = balloonBaseDepth - 10; static const int poiDepth = locationDepth - 10; static const int bookmarkDepth = poiDepth; - static const int tracksDepth = bookmarkDepth - balloonContentInc; + static const int routingFinishDepth = bookmarkDepth; + static const int routingSymbolsDepth = bookmarkDepth - 10; + static const int tracksDepth = routingSymbolsDepth - balloonContentInc; static const int tracksOutlineDepth = tracksDepth - 10; static const int activePinDepth = tracksDepth - 10; } diff --git a/map/framework.cpp b/map/framework.cpp index 54a510d095..a2220aeced 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -42,6 +42,8 @@ #include "../geometry/angles.hpp" #include "../geometry/distance_on_sphere.hpp" +#include "../graphics/depth_constants.hpp" + #include "../base/math.hpp" #include "../base/timer.hpp" #include "../base/scope_guard.hpp" @@ -1882,6 +1884,8 @@ void Framework::InsertRoute(routing::Route const & route) track.SetIsMarked(true); track.SetOutlineWidth(3.0f * GetVisualScale()); track.SetOutlineColor(graphics::Color::White()); + track.AddClosingSymbol(true, "route_from", graphics::EPosCenter, graphics::routingSymbolsDepth); + track.AddClosingSymbol(false, "route_to", graphics::EPosCenter, graphics::routingFinishDepth); cat->AddTrack(track); Invalidate(); } 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); diff --git a/map/track.hpp b/map/track.hpp index 96425f3613..cd4c10a890 100644 --- a/map/track.hpp +++ b/map/track.hpp @@ -4,6 +4,7 @@ #include "../geometry/screenbase.hpp" #include "../graphics/color.hpp" +#include "../graphics/defines.hpp" #include "../std/noncopyable.hpp" @@ -83,6 +84,8 @@ public: m2::RectD const & GetLimitRect() const { return m_rect; } //@} + void AddClosingSymbol(bool isBeginSymbol, string const & symbolName, graphics::EPosition pos, double depth); + double GetLengthMeters() const; double GetShortestSquareDistance(m2::PointD const & point) const; @@ -98,6 +101,11 @@ private: float m_outlineWidth; graphics::Color m_outlineColor; + typedef pair TSymbolVisParams; + typedef pair TClosingSymbol; + vector m_beginSymbols; + vector m_endSymbols; + PolylineD m_polyline; m2::RectD m_rect;