diff options
author | vng <viktor.govako@gmail.com> | 2011-12-07 13:58:30 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:29:47 +0300 |
commit | 9231d3b07e5991252f9fb1ecaf3f36bd4b0a95f1 (patch) | |
tree | 531ddb4fe4f5a81d56466db7e8767bcbb043fce9 /indexer/feature.cpp | |
parent | eb51589efdddccdb8ef20a7399fb00f34d3e0ace (diff) |
Fix bug with "junk" int_names drawing.
Diffstat (limited to 'indexer/feature.cpp')
-rw-r--r-- | indexer/feature.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/indexer/feature.cpp b/indexer/feature.cpp index 4660e96e37..4e2e7ffd63 100644 --- a/indexer/feature.cpp +++ b/indexer/feature.cpp @@ -209,11 +209,11 @@ FeatureType::geom_stat_t FeatureType::GetTrianglesSize(int scale) const struct BestMatchedLangNames { - string & m_defaultName; + string m_defaultName; string m_nativeName; string m_intName; string m_englishName; - BestMatchedLangNames(string & defaultName) : m_defaultName(defaultName) {} + bool operator()(int8_t code, string const & name) { static int8_t defaultCode = StringUtf8Multilang::GetLangIndex("default"); @@ -222,12 +222,16 @@ struct BestMatchedLangNames static int8_t const nativeCode = StringUtf8Multilang::GetLangIndex(languages::CurrentLanguage()); static int8_t const intCode = StringUtf8Multilang::GetLangIndex("int_name"); static int8_t const englishCode = StringUtf8Multilang::GetLangIndex("en"); + if (code == defaultCode) m_defaultName = name; else if (code == nativeCode) m_nativeName = name; else if (code == intCode) - m_intName = name; + { + // There are many "junk" names in Arabian island. + m_intName = name.substr(0, name.find_first_of(',')); + } else if (code == englishCode) m_englishName = name; return true; @@ -241,12 +245,13 @@ void FeatureType::GetPreferredDrawableNames(string & defaultName, string & intNa if (GetFeatureType() == GEOM_AREA) defaultName = m_Params.house.Get(); + BestMatchedLangNames matcher; + ForEachNameRef(matcher); + if (defaultName.empty()) { - BestMatchedLangNames matcher(defaultName); - ForEachNameRef(matcher); + defaultName.swap(matcher.m_defaultName); - // match intName if (!matcher.m_nativeName.empty()) intName.swap(matcher.m_nativeName); else if (!matcher.m_intName.empty()) @@ -257,15 +262,15 @@ void FeatureType::GetPreferredDrawableNames(string & defaultName, string & intNa if (defaultName.empty()) defaultName.swap(intName); else - { // filter out similar intName + { + // filter out similar intName if (!intName.empty() && defaultName.find(intName) != string::npos) intName.clear(); } } else { - BestMatchedLangNames matcher(intName); - ForEachNameRef(matcher); + intName.swap(matcher.m_defaultName); } } |