From e5f3ddf1c68968dd425716d518fa58a59c0722f7 Mon Sep 17 00:00:00 2001 From: Yury Melnichek Date: Mon, 30 May 2011 20:26:55 +0200 Subject: [PATCH] Add GetPopulation() to feature. --- indexer/feature.cpp | 8 ++++++++ indexer/feature.hpp | 1 + 2 files changed, 9 insertions(+) diff --git a/indexer/feature.cpp b/indexer/feature.cpp index f574a6872b..61112138d6 100644 --- a/indexer/feature.cpp +++ b/indexer/feature.cpp @@ -981,3 +981,11 @@ uint8_t FeatureType::GetRank() const return m_Params.rank; } + +uint32_t FeatureType::GetPopulation() const +{ + uint8_t const rank = GetRank(); + if (rank == 0) + return 1; + return static_cast(min(double(uint32_t(-1)), pow(1.1, rank))); +} diff --git a/indexer/feature.hpp b/indexer/feature.hpp index 25a4354d1b..7aa9d09e42 100644 --- a/indexer/feature.hpp +++ b/indexer/feature.hpp @@ -377,6 +377,7 @@ public: string DebugString(int scale) const; uint8_t GetRank() const; + uint32_t GetPopulation() const; /// @name Statistic functions. //@{