From 0c531ca4d9df0bc7f068afc1695e20fcbe610465 Mon Sep 17 00:00:00 2001 From: Daria Volvenkova Date: Tue, 28 Nov 2017 15:44:46 +0300 Subject: [PATCH] Fixed transit marks displacement. Fixed intermediate point icon getting. --- drape_frontend/drape_engine.cpp | 1 + drape_frontend/user_mark_shapes.cpp | 6 +++--- drape_frontend/user_mark_shapes.hpp | 1 + drape_frontend/user_marks_provider.hpp | 1 + map/routing_mark.cpp | 7 +++++++ map/routing_mark.hpp | 4 ++++ map/transit/transit_display.cpp | 5 +++-- map/user_mark.hpp | 1 + 8 files changed, 21 insertions(+), 5 deletions(-) diff --git a/drape_frontend/drape_engine.cpp b/drape_frontend/drape_engine.cpp index 3b755aac3f..6c7a2bf6f4 100644 --- a/drape_frontend/drape_engine.cpp +++ b/drape_frontend/drape_engine.cpp @@ -246,6 +246,7 @@ void DrapeEngine::UpdateUserMarksGroup(MarkGroupID groupId, UserMarksProvider * renderInfo->m_hasSymbolPriority = mark->HasSymbolPriority(); renderInfo->m_hasTitlePriority = mark->HasTitlePriority(); renderInfo->m_priority = mark->GetPriority(); + renderInfo->m_index = mark->GetIndex(); renderInfo->m_featureId = mark->GetFeatureID(); renderInfo->m_hasCreationAnimation = mark->HasCreationAnimation(); diff --git a/drape_frontend/user_mark_shapes.cpp b/drape_frontend/user_mark_shapes.cpp index ad5b8c17b8..5911c28e96 100644 --- a/drape_frontend/user_mark_shapes.cpp +++ b/drape_frontend/user_mark_shapes.cpp @@ -154,7 +154,7 @@ void CacheUserMarks(TileKey const & tileKey, ref_ptr texture params.m_specialDisplacement = SpecialDisplacement::UserMark; params.m_specialPriority = renderInfo.m_priority; ColoredSymbolShape(renderInfo.m_pivot, params, tileKey, - kStartUserMarkOverlayIndex).Draw(&batcher, textures); + kStartUserMarkOverlayIndex + renderInfo.m_index).Draw(&batcher, textures); break; } } @@ -171,7 +171,7 @@ void CacheUserMarks(TileKey const & tileKey, ref_ptr texture params.m_symbolName = symbolName; params.m_startOverlayRank = renderInfo.m_coloredSymbols != nullptr ? dp::OverlayRank1 : dp::OverlayRank0; PoiSymbolShape(renderInfo.m_pivot, params, tileKey, - kStartUserMarkOverlayIndex).Draw(&batcher, textures); + kStartUserMarkOverlayIndex + renderInfo.m_index).Draw(&batcher, textures); } } else if (renderInfo.m_symbolNames != nullptr) @@ -236,7 +236,7 @@ void CacheUserMarks(TileKey const & tileKey, ref_ptr texture { params.m_specialDisplacement = SpecialDisplacement::UserMark; params.m_specialPriority = renderInfo.m_priority; - overlayIndex = kStartUserMarkOverlayIndex; + overlayIndex = kStartUserMarkOverlayIndex + renderInfo.m_index; params.m_startOverlayRank = dp::OverlayRank0; if (renderInfo.m_symbolNames != nullptr) diff --git a/drape_frontend/user_mark_shapes.hpp b/drape_frontend/user_mark_shapes.hpp index d00f38e930..0c2fe0fba2 100644 --- a/drape_frontend/user_mark_shapes.hpp +++ b/drape_frontend/user_mark_shapes.hpp @@ -26,6 +26,7 @@ struct UserMarkRenderParams bool m_hasSymbolPriority = false; bool m_hasTitlePriority = false; uint16_t m_priority = 0; + uint32_t m_index = 0; float m_depth = 0.0; RenderState::DepthLayer m_depthLayer = RenderState::UserMarkLayer; bool m_hasCreationAnimation = false; diff --git a/drape_frontend/user_marks_provider.hpp b/drape_frontend/user_marks_provider.hpp index cc0374e92d..efd2e76d34 100644 --- a/drape_frontend/user_marks_provider.hpp +++ b/drape_frontend/user_marks_provider.hpp @@ -61,6 +61,7 @@ public: virtual drape_ptr GetSymbolNames() const = 0; virtual drape_ptr GetColoredSymbols() const = 0; virtual uint16_t GetPriority() const = 0; + virtual uint32_t GetIndex() const = 0; virtual bool HasSymbolPriority() const = 0; virtual bool HasTitlePriority() const = 0; virtual int GetMinZoom() const = 0; diff --git a/map/routing_mark.cpp b/map/routing_mark.cpp index 831b3fc743..5023ddcf84 100644 --- a/map/routing_mark.cpp +++ b/map/routing_mark.cpp @@ -130,6 +130,7 @@ drape_ptr RouteMarkPoint::GetSymbolNames( case 2: name = "route-point-c"; break; default: name = ""; break; } + break; } case RouteMarkType::Finish: name = "route-point-finish"; break; } @@ -389,6 +390,12 @@ void TransitMark::SetFeatureId(FeatureID featureId) m_featureId = featureId; } +void TransitMark::SetIndex(uint32_t index) +{ + SetDirty(); + m_index = index; +} + void TransitMark::SetPriority(Priority priority) { SetDirty(); diff --git a/map/routing_mark.hpp b/map/routing_mark.hpp index b1054b7adb..b666a3f70b 100644 --- a/map/routing_mark.hpp +++ b/map/routing_mark.hpp @@ -117,6 +117,9 @@ public: void SetFeatureId(FeatureID featureId); FeatureID GetFeatureID() const override { return m_featureId; } + void SetIndex(uint32_t index); + uint32_t GetIndex() const override { return m_index; } + void SetPriority(Priority priority); uint16_t GetPriority() const override { return static_cast(m_priority); } @@ -140,6 +143,7 @@ public: private: int m_minZoom = 1; int m_minTitleZoom = 1; + uint32_t m_index = 0; Priority m_priority; FeatureID m_featureId; TitlesInfo m_titles; diff --git a/map/transit/transit_display.cpp b/map/transit/transit_display.cpp index 78c0b77ee2..751ef1492c 100644 --- a/map/transit/transit_display.cpp +++ b/map/transit/transit_display.cpp @@ -452,11 +452,12 @@ void TransitRouteDisplay::CreateTransitMarks(std::vector const static vector const kStopMarkerSizes = GetTransitMarkerSizes(kStopMarkerScale); auto & marksController = m_bmManager->GetUserMarksController(UserMark::Type::TRANSIT); + uint32_t nextIndex = static_cast(marksController.GetUserMarkCount()); auto const vs = df::VisualParams::Instance().GetVisualScale(); for (size_t i = 0; i < transitMarks.size(); ++i) { - auto const &mark = transitMarks[i]; + auto const & mark = transitMarks[i]; auto userMark = marksController.CreateUserMark(mark.m_point); ASSERT(dynamic_cast(userMark) != nullptr, ()); @@ -464,7 +465,7 @@ void TransitRouteDisplay::CreateTransitMarks(std::vector const dp::TitleDecl titleDecl; transitMark->SetFeatureId(mark.m_featureId); - + transitMark->SetIndex(nextIndex++); if (mark.m_type == TransitMarkInfo::Type::Gate) { if (!mark.m_titles.empty()) diff --git a/map/user_mark.hpp b/map/user_mark.hpp index 55af91fff7..07566130e5 100644 --- a/map/user_mark.hpp +++ b/map/user_mark.hpp @@ -53,6 +53,7 @@ public: drape_ptr GetTitleDecl() const override { return nullptr; } drape_ptr GetColoredSymbols() const override { return nullptr; } uint16_t GetPriority() const override { return static_cast(Priority::Default); } + uint32_t GetIndex() const override { return 0; } bool HasSymbolPriority() const override { return false; } bool HasTitlePriority() const override { return false; } int GetMinZoom() const override { return 1; }