forked from organicmaps/organicmaps
[generator] Use international names to build country
This commit is contained in:
parent
f08faa8efa
commit
74ec291599
4 changed files with 11 additions and 7 deletions
|
@ -8,7 +8,7 @@ namespace regions
|
|||
{
|
||||
std::unique_ptr<CountrySpecifier> GetCountrySpecifier(std::string const & countryName)
|
||||
{
|
||||
if (countryName == u8"Россия" || countryName == u8"Российская Федерация" || countryName == u8"РФ")
|
||||
if (countryName == u8"Russia")
|
||||
return std::make_unique<specs::RusSpecifier>();
|
||||
|
||||
return std::make_unique<CountrySpecifier>();
|
||||
|
|
|
@ -81,7 +81,7 @@ private:
|
|||
GenerateKv(countryName, outers);
|
||||
});
|
||||
|
||||
LOG(LINFO, ("Regions objects key-value for", builder.GetCountryNames().size(),
|
||||
LOG(LINFO, ("Regions objects key-value for", builder.GetCountryInternationalNames().size(),
|
||||
"countries storage saved to", m_pathOutRegionsKv));
|
||||
LOG(LINFO,
|
||||
(m_objectsRegions.size(), "total regions.", m_regionsCountries.size(), "total objects."));
|
||||
|
|
|
@ -83,13 +83,14 @@ RegionsBuilder::Regions const & RegionsBuilder::GetCountriesOuters() const
|
|||
return m_countriesOuters;
|
||||
}
|
||||
|
||||
RegionsBuilder::StringsList RegionsBuilder::GetCountryNames() const
|
||||
RegionsBuilder::StringsList RegionsBuilder::GetCountryInternationalNames() const
|
||||
{
|
||||
StringsList result;
|
||||
std::unordered_set<std::string> set;
|
||||
for (auto const & c : GetCountriesOuters())
|
||||
{
|
||||
auto const & name = c.GetName();
|
||||
auto const & name =
|
||||
c.GetTranslatedOrTransliteratedName(StringUtf8Multilang::kInternationalCode);
|
||||
if (set.insert(name).second)
|
||||
result.emplace_back(std::move(name));
|
||||
}
|
||||
|
@ -272,7 +273,7 @@ void RegionsBuilder::ForEachCountry(CountryFn fn)
|
|||
{
|
||||
base::thread_pool::computational::ThreadPool threadPool(m_threadsCount);
|
||||
|
||||
for (auto const & countryName : GetCountryNames())
|
||||
for (auto const & countryName : GetCountryInternationalNames())
|
||||
{
|
||||
auto result = threadPool.Submit([this, countryName]() { return BuildCountry(countryName); });
|
||||
buildingTasks.emplace_back(std::move(result));
|
||||
|
@ -292,7 +293,10 @@ Node::PtrList RegionsBuilder::BuildCountry(std::string const & countryName) cons
|
|||
{
|
||||
Regions outers;
|
||||
auto const & countries = GetCountriesOuters();
|
||||
auto const pred = [&](Region const & country) { return countryName == country.GetName(); };
|
||||
auto const pred = [&](Region const & country) {
|
||||
return countryName ==
|
||||
country.GetTranslatedOrTransliteratedName(StringUtf8Multilang::kInternationalCode);
|
||||
};
|
||||
std::copy_if(std::begin(countries), std::end(countries), std::back_inserter(outers), pred);
|
||||
|
||||
auto countrySpecifier = GetCountrySpecifier(countryName);
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
size_t threadsCount = 1);
|
||||
|
||||
Regions const & GetCountriesOuters() const;
|
||||
StringsList GetCountryNames() const;
|
||||
StringsList GetCountryInternationalNames() const;
|
||||
void ForEachCountry(CountryFn fn);
|
||||
|
||||
static void InsertIntoSubtree(Node::Ptr & subtree, LevelRegion && region,
|
||||
|
|
Loading…
Add table
Reference in a new issue