From dcf3105989171a67ef5c6f6a197d452cada46b5f Mon Sep 17 00:00:00 2001 From: "r.kuznetsov" Date: Tue, 5 Jan 2016 15:35:11 +0300 Subject: [PATCH] Fixed road numbers' priority calculation --- drape_frontend/apply_feature_functors.cpp | 3 ++- drape_frontend/text_shape.cpp | 26 +++++++++++++++++------ drape_frontend/text_shape.hpp | 4 +++- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/drape_frontend/apply_feature_functors.cpp b/drape_frontend/apply_feature_functors.cpp index bc5dc5c3ad..4a6c264ed8 100644 --- a/drape_frontend/apply_feature_functors.cpp +++ b/drape_frontend/apply_feature_functors.cpp @@ -650,7 +650,8 @@ void ApplyLineFeature::Finish() m2::Spline::iterator it = m_spline.CreateIterator(); while (!it.BeginAgain()) { - m_insertShape(make_unique_dp(it.m_pos, viewParams, false /* hasPOI */)); + m_insertShape(make_unique_dp(it.m_pos, viewParams, false /* hasPOI */, + false /* affectedByZoomPriority */)); it.Advance(splineStep); } } diff --git a/drape_frontend/text_shape.cpp b/drape_frontend/text_shape.cpp index 2ec4c14e3d..a11a15ee09 100644 --- a/drape_frontend/text_shape.cpp +++ b/drape_frontend/text_shape.cpp @@ -29,13 +29,14 @@ public: dp::Anchor anchor, glsl::vec2 const & pivot, glsl::vec2 const & pxSize, glsl::vec2 const & offset, uint64_t priority, ref_ptr textureManager, - bool isOptional, gpu::TTextDynamicVertexBuffer && normals, - bool isBillboard = false) + bool isOptional, bool affectedByZoomPriority, + gpu::TTextDynamicVertexBuffer && normals, bool isBillboard = false) : TextHandle(id, text, anchor, priority, textureManager, move(normals), isBillboard) , m_pivot(glsl::ToPoint(pivot)) , m_offset(glsl::ToPoint(offset)) , m_size(glsl::ToPoint(pxSize)) , m_isOptional(isOptional) + , m_affectedByZoomPriority(affectedByZoomPriority) {} m2::PointD GetPivot(ScreenBase const & screen, bool perspective) const override @@ -98,6 +99,14 @@ public: rects.emplace_back(GetPixelRect(screen, perspective)); } + uint64_t GetPriorityMask() const override + { + if (!m_affectedByZoomPriority) + return dp::kPriorityMaskManual | dp::kPriorityMaskRank; + + return dp::kPriorityMaskAll; + } + bool IsBound() const override { return !m_isOptional; @@ -108,14 +117,17 @@ private: m2::PointF m_offset; m2::PointF m_size; bool m_isOptional; + bool m_affectedByZoomPriority; }; } // namespace -TextShape::TextShape(m2::PointF const & basePoint, TextViewParams const & params, bool hasPOI) - : m_basePoint(basePoint), - m_params(params), - m_hasPOI(hasPOI) +TextShape::TextShape(m2::PointF const & basePoint, TextViewParams const & params, + bool hasPOI, bool affectedByZoomPriority) + : m_basePoint(basePoint) + , m_params(params) + , m_hasPOI(hasPOI) + , m_affectedByZoomPriority(affectedByZoomPriority) {} void TextShape::Draw(ref_ptr batcher, ref_ptr textures) const @@ -203,6 +215,7 @@ void TextShape::DrawSubStringPlain(StraightTextLayout const & layout, dp::FontDe GetOverlayPriority(), textures, isOptional, + m_affectedByZoomPriority, move(dynamicBuffer), true); handle->SetPivotZ(m_params.m_posZ); @@ -248,6 +261,7 @@ void TextShape::DrawSubStringOutlined(StraightTextLayout const & layout, dp::Fon GetOverlayPriority(), textures, isOptional, + m_affectedByZoomPriority, move(dynamicBuffer), true); handle->SetPivotZ(m_params.m_posZ); diff --git a/drape_frontend/text_shape.hpp b/drape_frontend/text_shape.hpp index 28d1a6ccff..cceef289c0 100644 --- a/drape_frontend/text_shape.hpp +++ b/drape_frontend/text_shape.hpp @@ -14,7 +14,8 @@ class StraightTextLayout; class TextShape : public MapShape { public: - TextShape(m2::PointF const & basePoint, TextViewParams const & params, bool hasPOI); + TextShape(m2::PointF const & basePoint, TextViewParams const & params, + bool hasPOI, bool affectedByZoomPriority = true); void Draw(ref_ptr batcher, ref_ptr textures) const override; MapShapePriority GetPriority() const override { return MapShapePriority::TextAndPoiPriority; } @@ -36,6 +37,7 @@ private: m2::PointF m_basePoint; TextViewParams m_params; bool m_hasPOI; + bool m_affectedByZoomPriority; }; } // namespace df