forked from organicmaps/organicmaps
Use population rank (height of font) only for place-[city(-capital), town].
This commit is contained in:
parent
5bda2539a4
commit
16f89e272b
3 changed files with 34 additions and 15 deletions
|
@ -290,13 +290,13 @@ double FeatureType::GetPopulationDrawRank() const
|
|||
if (n == 1) return 0.0;
|
||||
|
||||
// Do not return rank for countries.
|
||||
if (feature::IsCountry(m_Types, m_Types + GetTypesCount()))
|
||||
return 0.0;
|
||||
else
|
||||
if (feature::UsePopulationRank(m_Types, m_Types + GetTypesCount()))
|
||||
{
|
||||
double const upperBound = 3.0E6;
|
||||
return min(upperBound, static_cast<double>(n)) / upperBound;
|
||||
}
|
||||
else
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
namespace
|
||||
|
|
|
@ -335,24 +335,42 @@ bool IsHighway(vector<uint32_t> const & types)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool IsCountry(uint32_t type)
|
||||
bool UsePopulationRank(uint32_t type)
|
||||
{
|
||||
class checker_t
|
||||
class CheckerT
|
||||
{
|
||||
public:
|
||||
uint32_t m_type;
|
||||
uint32_t m_types[3];
|
||||
|
||||
checker_t()
|
||||
public:
|
||||
CheckerT()
|
||||
{
|
||||
Classificator & c = classif();
|
||||
|
||||
vector<string> vec;
|
||||
vec.push_back("place");
|
||||
vec.push_back("country");
|
||||
m_type = classif().GetTypeByPath(vec);
|
||||
vec.push_back("city");
|
||||
m_types[0] = c.GetTypeByPath(vec);
|
||||
|
||||
vec.push_back("capital");
|
||||
m_types[1] = c.GetTypeByPath(vec);
|
||||
|
||||
vec.clear();
|
||||
vec.push_back("place");
|
||||
vec.push_back("town");
|
||||
m_types[2] = c.GetTypeByPath(vec);
|
||||
}
|
||||
|
||||
bool IsMyType(uint32_t t) const
|
||||
{
|
||||
for (size_t i = 0; i < ARRAY_SIZE(m_types); ++i)
|
||||
if (t == m_types[i])
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
static checker_t checker;
|
||||
return (type == checker.m_type);
|
||||
static CheckerT checker;
|
||||
return (checker.IsMyType(type));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -33,13 +33,14 @@ namespace feature
|
|||
|
||||
bool IsHighway(vector<uint32_t> const & types);
|
||||
|
||||
bool IsCountry(uint32_t type);
|
||||
bool UsePopulationRank(uint32_t type);
|
||||
|
||||
template <class IterT>
|
||||
inline bool IsCountry(IterT beg, IterT end)
|
||||
inline bool UsePopulationRank(IterT beg, IterT end)
|
||||
{
|
||||
while (beg != end)
|
||||
{
|
||||
if (IsCountry(*beg++))
|
||||
if (UsePopulationRank(*beg++))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Add table
Reference in a new issue