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-11-21 03:06:54 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:28:39 +0300
commitfe9e7d13a1cbe74d92b8cac6ab73648d0d37dcb6 (patch)
tree639ce1a3523f0601799be710f5bd6be9a306c3d9 /indexer/feature_utils.cpp
parent24c5921e001adeaa2cc0e2e90f21c23661087cca (diff)
[search] Improve GetSearchRank() and GetFeatureViewport().
Diffstat (limited to 'indexer/feature_utils.cpp')
-rw-r--r--indexer/feature_utils.cpp42
1 files changed, 24 insertions, 18 deletions
diff --git a/indexer/feature_utils.cpp b/indexer/feature_utils.cpp
index 927878ecc4..7f577ec16f 100644
--- a/indexer/feature_utils.cpp
+++ b/indexer/feature_utils.cpp
@@ -30,9 +30,9 @@ public:
m_TypeContinent = GetType("place", "continent");
m_TypeCountry = GetType("place", "country");
- m_TypeState[0] = GetType("place", "state");
- m_TypeState[1] = GetType("place", "region");
- m_TypeState[2] = GetType("place", "county");
+ m_TypeState = GetType("place", "state");
+ m_TypeCounty[0] = GetType("place", "region");
+ m_TypeCounty[1] = GetType("place", "county");
m_TypeCity = GetType("place", "city");
m_TypeCityCapital = GetType("place", "city", "capital");
@@ -40,9 +40,10 @@ public:
m_TypeVillage[0] = GetType("place", "village");
m_TypeVillage[1] = GetType("place", "suburb");
- m_TypeVillage[2] = GetType("place", "hamlet");
- m_TypeVillage[3] = GetType("place", "locality");
- m_TypeVillage[4] = GetType("place", "farm");
+
+ m_TypeSmallVillage[0] = GetType("place", "hamlet");
+ m_TypeSmallVillage[1] = GetType("place", "locality");
+ m_TypeSmallVillage[2] = GetType("place", "farm");
}
m2::RectD GetViewport(FeatureType const & feature) const
@@ -74,16 +75,16 @@ public:
feature.ForEachTypeRef(types);
for (size_t i = 0; i < types.m_size; ++i)
{
- if (IsEqual(types.m_types[i], m_TypeVillage))
+ if (IsEqual(types.m_types[i], m_TypeSmallVillage))
+ population = max(population, static_cast<uint32_t>(100));
+ else if (IsEqual(types.m_types[i], m_TypeVillage))
population = max(population, static_cast<uint32_t>(1000));
- else if (types.m_types[i] == m_TypeTown)
+ else if (types.m_types[i] == m_TypeTown || IsEqual(types.m_types[i], m_TypeCounty))
population = max(population, static_cast<uint32_t>(10000));
- else if (types.m_types[i] == m_TypeCity)
+ else if (types.m_types[i] == m_TypeCity || types.m_types[i] == m_TypeState)
population = max(population, static_cast<uint32_t>(100000));
else if (types.m_types[i] == m_TypeCityCapital)
population = max(population, static_cast<uint32_t>(1000000));
- else if (IsEqual(types.m_types[i], m_TypeState))
- population = max(population, static_cast<uint32_t>(1500000));
else if (types.m_types[i] == m_TypeCountry)
population = max(population, static_cast<uint32_t>(2000000));
else if (types.m_types[i] == m_TypeContinent)
@@ -106,22 +107,25 @@ private:
if (type == m_TypeCountry)
return m2::PointD(500*km, 500*km);
- if (IsEqual(type, m_TypeState))
+ if (type == m_TypeState)
return m2::PointD(200*km, 200*km);
+ if (IsEqual(type, m_TypeCounty))
+ return m2::PointD(40*km, 40*km);
+
if (type == m_TypeCity || type == m_TypeCityCapital)
{
- double const radius = sqrt(static_cast<double>(feature.GetPopulation() / 3000));
+ double const radius = sqrt(static_cast<double>(feature.GetPopulation() / 2500));
return m2::PointD(radius*km, radius*km);
}
if (type == m_TypeTown)
- return m2::PointD(8*km, 8*km);
+ return m2::PointD(6*km, 6*km);
if (IsEqual(type, m_TypeVillage))
- return m2::PointD(3*km, 3*km);
+ return m2::PointD(1.5*km, 1.5*km);
- return m2::PointD(0, 0);
+ return m2::PointD(100, 100);
}
static uint32_t GetType(string const & s1,
@@ -137,11 +141,13 @@ private:
uint32_t m_TypeContinent;
uint32_t m_TypeCountry;
- uint32_t m_TypeState[3];
+ uint32_t m_TypeState;
+ uint32_t m_TypeCounty[2];
uint32_t m_TypeCity;
uint32_t m_TypeCityCapital;
uint32_t m_TypeTown;
- uint32_t m_TypeVillage[5];
+ uint32_t m_TypeVillage[2];
+ uint32_t m_TypeSmallVillage[3];
};
FeatureEstimator const & GetFeatureEstimator()