From fe9e7d13a1cbe74d92b8cac6ab73648d0d37dcb6 Mon Sep 17 00:00:00 2001 From: Yury Melnichek Date: Mon, 21 Nov 2011 00:06:54 +0100 Subject: [search] Improve GetSearchRank() and GetFeatureViewport(). --- indexer/feature_utils.cpp | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'indexer/feature_utils.cpp') 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(100)); + else if (IsEqual(types.m_types[i], m_TypeVillage)) population = max(population, static_cast(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(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(100000)); else if (types.m_types[i] == m_TypeCityCapital) population = max(population, static_cast(1000000)); - else if (IsEqual(types.m_types[i], m_TypeState)) - population = max(population, static_cast(1500000)); else if (types.m_types[i] == m_TypeCountry) population = max(population, static_cast(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(feature.GetPopulation() / 3000)); + double const radius = sqrt(static_cast(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() -- cgit v1.2.3