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-08 23:25:07 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:33:52 +0300
commitc7913216d250cbf8cb173ca98f97e7592e22283b (patch)
treeaf483bc75353a0157daa479359730f754f64be18 /indexer/feature_utils.cpp
parentdcad11d5c25dc6c1382f9a9188c5330285a07f99 (diff)
[search] Getting rank and center from trie.
Diffstat (limited to 'indexer/feature_utils.cpp')
-rw-r--r--indexer/feature_utils.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/indexer/feature_utils.cpp b/indexer/feature_utils.cpp
index 051bf2b33e..0302354f80 100644
--- a/indexer/feature_utils.cpp
+++ b/indexer/feature_utils.cpp
@@ -51,6 +51,7 @@ public:
m_TypeSmallVillage[2] = GetType("place", "farm");
}
+ /*
void CorrectScaleForVisibility(TypesHolder const & types, int & scale) const
{
pair<int, int> const scaleR = feature::DrawableScaleRangeForText(types);
@@ -66,21 +67,22 @@ public:
return ((scale != scaleNew) ? scales::GetRectForLevel(scaleNew, rect.Center(), 1.0) : rect);
}
+ */
- m2::RectD GetViewport(TypesHolder const & types, m2::RectD const & limitRect) const
+ m2::RectD GetViewport(TypesHolder const & types, m2::PointD const & center) 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]));
- CorrectScaleForVisibility(types, scale);
+ if (scale == upperScale)
+ {
+ // get minimal draw text scale for feature type, that not mentioned in GetScaleForType
+ scale = feature::DrawableScaleRangeForText(types).first;
+ }
- m2::PointD const centerXY = limitRect.Center();
- return scales::GetRectForLevel(scale, centerXY, 1.0);
+ return scales::GetRectForLevel(scale, center, 1.0);
}
uint8_t GetSearchRank(TypesHolder const & types, m2::PointD const & pt, uint32_t population) const
@@ -208,9 +210,9 @@ FeatureEstimator const & GetFeatureEstimator()
} // namespace feature::impl
-m2::RectD GetFeatureViewport(TypesHolder const & types, m2::RectD const & limitRect)
+m2::RectD GetFeatureViewport(TypesHolder const & types, m2::PointD const & center)
{
- return impl::GetFeatureEstimator().GetViewport(types, limitRect);
+ return impl::GetFeatureEstimator().GetViewport(types, center);
}
uint8_t GetSearchRank(TypesHolder const & types, m2::PointD const & pt, uint32_t population)