From 701a91ed42d4b6caad926218a385640aa9b86fdf Mon Sep 17 00:00:00 2001 From: Daria Volvenkova Date: Fri, 29 May 2020 01:05:53 +0300 Subject: [PATCH] [guides on map] Review fixes. --- drape_frontend/message_subclasses.hpp | 10 +++++----- drape_frontend/rule_drawer.cpp | 20 +++++++++++--------- drape_frontend/rule_drawer.hpp | 2 ++ indexer/ftypes_matcher.cpp | 3 ++- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/drape_frontend/message_subclasses.hpp b/drape_frontend/message_subclasses.hpp index 12b15f2ccb..00c34f0ffc 100644 --- a/drape_frontend/message_subclasses.hpp +++ b/drape_frontend/message_subclasses.hpp @@ -1127,7 +1127,7 @@ public: Type GetType() const override { return Type::EnableIsolines; } - bool IsEnabled() { return m_isEnabled; } + bool IsEnabled() const { return m_isEnabled; } private: bool m_isEnabled = false; @@ -1142,7 +1142,7 @@ public: Type GetType() const override { return Type::EnableGuides; } - bool IsEnabled() { return m_isEnabled; } + bool IsEnabled() const { return m_isEnabled; } private: bool m_isEnabled = false; @@ -1157,7 +1157,7 @@ public: Type GetType() const override { return Type::EnableTransitScheme; } - bool IsEnabled() { return m_isEnabled; } + bool IsEnabled() const { return m_isEnabled; } private: bool m_isEnabled = false; @@ -1172,7 +1172,7 @@ public: Type GetType() const override { return Type::ClearTransitSchemeData; } - MwmSet::MwmId const & GetMwmId() { return m_mwmId; } + MwmSet::MwmId const & GetMwmId() const { return m_mwmId; } private: MwmSet::MwmId m_mwmId; @@ -1193,7 +1193,7 @@ public: Type GetType() const override { return Type::UpdateTransitScheme; } - TransitDisplayInfos const & GetTransitDisplayInfos() { return m_transitInfos; } + TransitDisplayInfos const & GetTransitDisplayInfos() const { return m_transitInfos; } private: TransitDisplayInfos m_transitInfos; diff --git a/drape_frontend/rule_drawer.cpp b/drape_frontend/rule_drawer.cpp index 3b0cf8f6bc..79d2a9f972 100644 --- a/drape_frontend/rule_drawer.cpp +++ b/drape_frontend/rule_drawer.cpp @@ -43,7 +43,6 @@ using namespace std::placeholders; namespace { -int constexpr kMinCountryZoom = 10; // The first zoom level in kAverageSegmentsCount. int constexpr kFirstZoomInAverageSegments = 10; std::vector const kAverageSegmentsCount = @@ -282,6 +281,15 @@ bool RuleDrawer::CheckCoastlines(FeatureType & f, Stylist const & s) return true; } +bool RuleDrawer::CheckPointStyle(FeatureType & f) +{ + int const zoomLevel = m_context->GetTileKey().m_zoomLevel; + if (!m_context->GuidesEnabled() || zoomLevel < scales::GetUpperCountryScale()) + return true; + + return IsGuidesLayerFeature(f); +} + void RuleDrawer::ProcessAreaStyle(FeatureType & f, Stylist const & s, TInsertShapeFn const & insertShape, int & minVisibleScale) { @@ -338,11 +346,8 @@ void RuleDrawer::ProcessAreaStyle(FeatureType & f, Stylist const & s, applyPointStyle = m_globalRect.IsPointInside(featureCenter); } - if (m_context->GuidesEnabled() && m_context->GetTileKey().m_zoomLevel >= kMinCountryZoom && - !IsGuidesLayerFeature(f)) - { + if (!CheckPointStyle(f)) applyPointStyle = false; - } if (applyPointStyle || is3dBuilding) minVisibleScale = feature::GetMinDrawableScale(f); @@ -470,11 +475,8 @@ void RuleDrawer::ProcessPointStyle(FeatureType & f, Stylist const & s, if (m_customFeaturesContext && m_customFeaturesContext->NeedDiscardGeometry(f.GetID())) return; - if (m_context->GuidesEnabled() && m_context->GetTileKey().m_zoomLevel >= kMinCountryZoom && - !IsGuidesLayerFeature(f)) - { + if (!CheckPointStyle(f)) return; - } int const zoomLevel = m_context->GetTileKey().m_zoomLevel; bool const isSpeedCamera = ftypes::IsSpeedCamChecker::Instance()(f); diff --git a/drape_frontend/rule_drawer.hpp b/drape_frontend/rule_drawer.hpp index 08ef2ab4ee..ea07fcc3e4 100644 --- a/drape_frontend/rule_drawer.hpp +++ b/drape_frontend/rule_drawer.hpp @@ -60,6 +60,8 @@ private: bool CheckCancelled(); + bool CheckPointStyle(FeatureType & f); + TDrawerCallback m_callback; TCheckCancelledCallback m_checkCancelled; TIsCountryLoadedByNameFn m_isLoadedFn; diff --git a/indexer/ftypes_matcher.cpp b/indexer/ftypes_matcher.cpp index ca5ac65467..88fe10b634 100644 --- a/indexer/ftypes_matcher.cpp +++ b/indexer/ftypes_matcher.cpp @@ -237,7 +237,8 @@ IsOutdoorChecker::IsOutdoorChecker() {"natural", "beach"}, {"natural", "cape"}, - {"natural", "glacier"}}; + {"natural", "glacier"}, + {"highway", "ford"}}; for (auto const & p : arr) m_types.push_back(c.GetTypeByPath({p[0], p[1]})); }