Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvng <viktor.govako@gmail.com>2012-02-21 21:27:38 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:34:16 +0300
commit7ddf23c0c03f085a39a62191e9741d4b8741f9db (patch)
tree336da06500840f0063efffc3eebd2a5774b21cbd /indexer/feature_utils.cpp
parentfd7000f560049504f116f3fe82f8d4c8d393f67a (diff)
[search] Better viewport calculation for results.
Diffstat (limited to 'indexer/feature_utils.cpp')
-rw-r--r--indexer/feature_utils.cpp24
1 files changed, 8 insertions, 16 deletions
diff --git a/indexer/feature_utils.cpp b/indexer/feature_utils.cpp
index 69d28a3394..84eb377eb6 100644
--- a/indexer/feature_utils.cpp
+++ b/indexer/feature_utils.cpp
@@ -51,7 +51,6 @@ public:
m_TypeSmallVillage[2] = GetType("place", "farm");
}
- /*
void CorrectScaleForVisibility(TypesHolder const & types, int & scale) const
{
pair<int, int> const scaleR = feature::DrawableScaleRangeForText(types);
@@ -67,26 +66,19 @@ public:
return ((scale != scaleNew) ? scales::GetRectForLevel(scaleNew, rect.Center(), 1.0) : rect);
}
- */
- m2::RectD GetViewport(TypesHolder const & types, m2::PointD const & center) const
+ m2::RectD GetViewport(TypesHolder const & types, m2::RectD const & limitRect) const
{
+ if (types.GetGeoType() != feature::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 (scale == upperScale)
- {
- // get minimal draw text scale for feature type, that not mentioned in GetScaleForType
- scale = feature::DrawableScaleRangeForText(types).first;
-
- // if no texts at all - show at maximum zoom
- if (scale == -1)
- scale = upperScale;
- }
-
- return scales::GetRectForLevel(scale, center, 1.0);
+ CorrectScaleForVisibility(types, scale);
+ return scales::GetRectForLevel(scale, limitRect.Center(), 1.0);
}
uint8_t GetSearchRank(TypesHolder const & types, m2::PointD const & pt, uint32_t population) const
@@ -214,9 +206,9 @@ FeatureEstimator const & GetFeatureEstimator()
} // namespace feature::impl
-m2::RectD GetFeatureViewport(TypesHolder const & types, m2::PointD const & center)
+m2::RectD GetFeatureViewport(TypesHolder const & types, m2::RectD const & limRect)
{
- return impl::GetFeatureEstimator().GetViewport(types, center);
+ return impl::GetFeatureEstimator().GetViewport(types, limRect);
}
uint8_t GetSearchRank(TypesHolder const & types, m2::PointD const & pt, uint32_t population)