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:
authorYury Melnichek <melnichek@gmail.com>2011-10-03 02:56:09 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:25:02 +0300
commitaf02c0990a2d485673894b6579771aa7d09ac4c7 (patch)
tree7d9429e89b7a4d14742cce73da3a2cc6dc6416a2 /indexer/feature_utils.cpp
parent0226c8c3eb1eebdc427cd62250fd0ce8900dbdc5 (diff)
[search] Take into account some feature types in GetSearchRank(). TODO: Support more types.
Diffstat (limited to 'indexer/feature_utils.cpp')
-rw-r--r--indexer/feature_utils.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/indexer/feature_utils.cpp b/indexer/feature_utils.cpp
index 60fad6e9a5..71a1930231 100644
--- a/indexer/feature_utils.cpp
+++ b/indexer/feature_utils.cpp
@@ -48,6 +48,25 @@ public:
uint8_t GetSearchRank(FeatureType const & feature) const
{
uint32_t const population = feature.GetPopulation();
+
+ FeatureBase::GetTypesFn types;
+ feature.ForEachTypeRef(types);
+ for (size_t i = 0; i < types.m_size; ++i)
+ {
+ if (types.m_types[i] == m_TypeVillage)
+ population = max(population, 1000);
+ else if (types.m_types[i] == m_TypeTown)
+ population = max(population, 10000);
+ else if (types.m_types[i] == m_TypeCity)
+ population = max(population, 100000);
+ else if (types.m_types[i] == m_TypeCityCapital)
+ population = max(population, 1000000);
+ else if (types.m_types[i] == m_TypeCountry)
+ population = max(population, 2000000);
+ else if (types.m_types[i] == m_TypeContinent)
+ population = max(population, 20000000);
+ }
+
return static_cast<uint8_t>(log(double(population)) / log(1.1));
}