Fix maximum feature types count constant.

This commit is contained in:
vng 2011-05-13 00:24:33 +03:00 committed by Alex Zolotarev
parent 95269ed597
commit 23d89b6acf
3 changed files with 7 additions and 9 deletions

View file

@ -166,7 +166,8 @@ public:
/// Base feature class for storing common data (without geometry).
class FeatureBase
{
static const int m_maxTypesCount = 7;
static const int m_maxTypesCount = feature::max_types_count;
public:
FeatureBase() : m_Offset(0) {}

View file

@ -33,11 +33,6 @@ void FeatureParams::AddTypes(FeatureParams const & rhs)
m_Types.insert(m_Types.end(), rhs.m_Types.begin(), rhs.m_Types.end());
}
namespace
{
size_t GetMaximunTypesCount() { return HEADER_TYPE_MASK + 1; }
}
void FeatureParams::SortTypes()
{
sort(m_Types.begin(), m_Types.end());
@ -47,8 +42,8 @@ void FeatureParams::FinishAddingTypes()
{
sort(m_Types.begin(), m_Types.end());
m_Types.erase(unique(m_Types.begin(), m_Types.end()), m_Types.end());
if (m_Types.size() > GetMaximunTypesCount())
m_Types.resize(GetMaximunTypesCount());
if (m_Types.size() > max_types_count)
m_Types.resize(max_types_count);
}
void FeatureParams::SetType(uint32_t t)
@ -84,7 +79,7 @@ bool FeatureParams::operator == (FeatureParams const & rhs) const
bool FeatureParams::CheckValid() const
{
CHECK(!m_Types.empty() && m_Types.size() <= GetMaximunTypesCount(), ());
CHECK(!m_Types.empty() && m_Types.size() <= max_types_count, ());
CHECK(m_Geom != GEOM_UNDEFINED, ());
return FeatureParamsBase::CheckValid();

View file

@ -33,6 +33,8 @@ namespace feature
HEADER_GEOM_LINE = 1U << 5,
HEADER_GEOM_AREA = 1U << 6
};
static const int max_types_count = HEADER_TYPE_MASK + 1;
}
/// Feature description struct.