diff options
author | vng <viktor.govako@gmail.com> | 2013-09-20 19:09:46 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:02:06 +0300 |
commit | 6f2ad31c264c8209072df7cfed9e1027d8e3ee34 (patch) | |
tree | c5bc54c6931a6c559cb97d8d6e66af7285dda1e1 /indexer/feature_utils.cpp | |
parent | f0122d60b5264645e2679220215c52a8a0083ce0 (diff) |
[search] Correct zoom for result and fix balloon point for streets.
Diffstat (limited to 'indexer/feature_utils.cpp')
-rw-r--r-- | indexer/feature_utils.cpp | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/indexer/feature_utils.cpp b/indexer/feature_utils.cpp index 8a845cec6d..a117d0ad3b 100644 --- a/indexer/feature_utils.cpp +++ b/indexer/feature_utils.cpp @@ -66,27 +66,18 @@ public: } } - m2::RectD CorrectRectForScales(TypesHolder const & types, m2::RectD const & rect) const + int GetViewportScale(TypesHolder const & types) const { - int const scale = scales::GetScaleLevel(rect); - int scaleNew = scale; - CorrectScaleForVisibility(types, scaleNew); + int scale = GetDefaultScale(); - return ((scale != scaleNew) ? scales::GetRectForLevel(scaleNew, rect.Center()) : rect); - } - - m2::RectD GetViewport(TypesHolder const & types, m2::RectD const & limitRect) const - { - if (types.GetGeoType() != GEOM_POINT) - return CorrectRectForScales(types, limitRect); - - int const upperScale = scales::GetUpperScale(); - int scale = upperScale; - for (size_t i = 0; i < types.Size(); ++i) - scale = min(scale, GetScaleForType(types[i])); + if (types.GetGeoType() == GEOM_POINT) + { + for (size_t i = 0; i < types.Size(); ++i) + scale = min(scale, GetScaleForType(types[i])); + } CorrectScaleForVisibility(types, scale); - return scales::GetRectForLevel(scale, limitRect.Center()); + return scale; } uint8_t GetSearchRank(TypesHolder const & types, m2::PointD const & pt, uint32_t population) const @@ -101,7 +92,8 @@ public: population = max(population, static_cast<uint32_t>(10000)); else if (types[i] == m_TypeState) { - m2::RectD usaRects[] = { + m2::RectD usaRects[] = + { // Continental part of USA m2::RectD(-125.73195962769162293, 25.168771674082393019, -66.925073086214325713, 56.956377399113392812), @@ -152,6 +144,7 @@ public: } private: + static int GetDefaultScale() { return scales::GetUpperComfortScale(); } // Returns width and height (lon and lat) for a given type. int GetScaleForType(uint32_t const type) const @@ -181,7 +174,7 @@ private: if (IsEqual(type, m_TypeSmallVillage)) return 14; - return scales::GetUpperScale(); + return GetDefaultScale(); } static uint32_t GetType(string const & s1, @@ -214,9 +207,9 @@ FeatureEstimator const & GetFeatureEstimator() } // namespace feature::impl -m2::RectD GetFeatureViewport(TypesHolder const & types, m2::RectD const & limRect) +int GetFeatureViewportScale(TypesHolder const & types) { - return impl::GetFeatureEstimator().GetViewport(types, limRect); + return impl::GetFeatureEstimator().GetViewportScale(types); } uint8_t GetSearchRank(TypesHolder const & types, m2::PointD const & pt, uint32_t population) |