From 717843cb297740cfd57dce2e99c005c329da443e Mon Sep 17 00:00:00 2001 From: "r.kuznetsov" Date: Fri, 18 Mar 2016 13:59:33 +0300 Subject: [PATCH] Added setting up minimal priority for area overlays --- drape_frontend/apply_feature_functors.cpp | 9 +++++++-- drape_frontend/apply_feature_functors.hpp | 3 ++- drape_frontend/circle_shape.cpp | 4 ++++ drape_frontend/poi_symbol_shape.cpp | 4 ++++ drape_frontend/rule_drawer.cpp | 4 ++-- drape_frontend/shape_view_params.hpp | 3 +++ drape_frontend/text_shape.cpp | 4 ++++ 7 files changed, 26 insertions(+), 5 deletions(-) diff --git a/drape_frontend/apply_feature_functors.cpp b/drape_frontend/apply_feature_functors.cpp index d2576ad0d7..c02af0ab79 100644 --- a/drape_frontend/apply_feature_functors.cpp +++ b/drape_frontend/apply_feature_functors.cpp @@ -242,6 +242,7 @@ ApplyPointFeature::ApplyPointFeature(TInsertShapeFn const & insertShape, Feature : TBase(insertShape, id, minVisibleScale, rank, captions) , m_posZ(posZ) , m_hasPoint(false) + , m_hasArea(false) , m_symbolDepth(dp::minDepth) , m_circleDepth(dp::minDepth) , m_symbolRule(NULL) @@ -249,15 +250,16 @@ ApplyPointFeature::ApplyPointFeature(TInsertShapeFn const & insertShape, Feature { } -void ApplyPointFeature::operator()(m2::PointD const & point) +void ApplyPointFeature::operator()(m2::PointD const & point, bool hasArea) { m_hasPoint = true; + m_hasArea = hasArea; m_centerPoint = point; } void ApplyPointFeature::ProcessRule(Stylist::TRuleWrapper const & rule) { - if (m_hasPoint == false) + if (!m_hasPoint) return; drule::BaseRule const * pRule = rule.first; @@ -287,6 +289,7 @@ void ApplyPointFeature::ProcessRule(Stylist::TRuleWrapper const & rule) params.m_minVisibleScale = m_minVisibleScale; params.m_rank = m_rank; params.m_posZ = m_posZ; + params.m_hasArea = m_hasArea; if(!params.m_primaryText.empty() || !params.m_secondaryText.empty()) { m_insertShape(make_unique_dp(m_centerPoint, params, hasPOI, 0 /* textIndex */, @@ -309,6 +312,7 @@ void ApplyPointFeature::Finish() params.m_rank = m_rank; params.m_color = ToDrapeColor(m_circleRule->color()); params.m_radius = m_circleRule->radius(); + params.m_hasArea = m_hasArea; m_insertShape(make_unique_dp(m_centerPoint, params)); } else if (m_symbolRule) @@ -321,6 +325,7 @@ void ApplyPointFeature::Finish() float const mainScale = df::VisualParams::Instance().GetVisualScale(); params.m_extendingSize = m_symbolRule->has_min_distance() ? mainScale * m_symbolRule->min_distance() : 0; params.m_posZ = m_posZ; + params.m_hasArea = m_hasArea; m_insertShape(make_unique_dp(m_centerPoint, params)); } } diff --git a/drape_frontend/apply_feature_functors.hpp b/drape_frontend/apply_feature_functors.hpp index 906338760b..8db6978ed1 100644 --- a/drape_frontend/apply_feature_functors.hpp +++ b/drape_frontend/apply_feature_functors.hpp @@ -57,7 +57,7 @@ public: int minVisibleScale, uint8_t rank, CaptionDescription const & captions, float posZ); - void operator()(m2::PointD const & point); + void operator()(m2::PointD const & point, bool hasArea); void ProcessRule(Stylist::TRuleWrapper const & rule); void Finish(); @@ -66,6 +66,7 @@ protected: private: bool m_hasPoint; + bool m_hasArea; double m_symbolDepth; double m_circleDepth; SymbolRuleProto const * m_symbolRule; diff --git a/drape_frontend/circle_shape.cpp b/drape_frontend/circle_shape.cpp index 6964533303..138f450d4b 100644 --- a/drape_frontend/circle_shape.cpp +++ b/drape_frontend/circle_shape.cpp @@ -64,6 +64,10 @@ void CircleShape::Draw(ref_ptr batcher, ref_ptr uint64_t CircleShape::GetOverlayPriority() const { + // Set up minimal priority for shapes which belong to areas. + if (m_params.m_hasArea) + return 0; + return dp::CalculateOverlayPriority(m_params.m_minVisibleScale, m_params.m_rank, m_params.m_depth); } diff --git a/drape_frontend/poi_symbol_shape.cpp b/drape_frontend/poi_symbol_shape.cpp index 3053deeba2..7698544ae9 100644 --- a/drape_frontend/poi_symbol_shape.cpp +++ b/drape_frontend/poi_symbol_shape.cpp @@ -64,6 +64,10 @@ void PoiSymbolShape::Draw(ref_ptr batcher, ref_ptr