diff options
author | vng <viktor.govako@gmail.com> | 2012-10-17 04:14:33 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:45:40 +0300 |
commit | c0b3220afbd3dfcfa1ee3efe8b7ad92c558a2f91 (patch) | |
tree | 6428d6427d14ce4880ca010c73dbf7e504c06559 /indexer/feature_data.cpp | |
parent | 68e41fba0d99b71543316d909d5f078f80712e41 (diff) |
Return better feature type than "building" if feature has many choices.
Diffstat (limited to 'indexer/feature_data.cpp')
-rw-r--r-- | indexer/feature_data.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/indexer/feature_data.cpp b/indexer/feature_data.cpp index 6decfe5e83..868c7aeb08 100644 --- a/indexer/feature_data.cpp +++ b/indexer/feature_data.cpp @@ -7,6 +7,10 @@ using namespace feature; +//////////////////////////////////////////////////////////////////////////////////// +// TypesHolder implementation +//////////////////////////////////////////////////////////////////////////////////// + TypesHolder::TypesHolder(FeatureBase const & f) : m_size(0), m_geoType(f.GetFeatureType()) { @@ -33,6 +37,34 @@ void TypesHolder::Remove(uint32_t t) } } +void TypesHolder::SortBySpec() +{ + if (m_size < 2) + return; + + // do very simple thing - put "very common" types to the end + /// @todo Make this function usefull for many "common" types. + + // initialize common types + Classificator const & c = classif(); + vector<string> path(1); + path[0] = "building"; + uint32_t const buildingT = c.GetTypeByPath(path); + + // do swaps with "common" types + size_t end = m_size-1; + for (size_t i = 0; i < end; ++i) + if (m_types[i] == buildingT) + { + swap(m_types[i], m_types[end]); + ASSERT_NOT_EQUAL(m_types[i], buildingT, ()); + break; + } +} + +//////////////////////////////////////////////////////////////////////////////////// +// FeatureParamsBase implementation +//////////////////////////////////////////////////////////////////////////////////// void FeatureParamsBase::MakeZero() { |