forked from organicmaps/organicmaps
Merge pull request #11079 from cc-engineering/generator.regions.capital-node-fix
[generator:regions] Fix for capital node
This commit is contained in:
commit
402659a7f0
3 changed files with 13 additions and 4 deletions
generator/regions
|
@ -76,7 +76,7 @@ void CollectorRegionInfo::CollectFeature(const FeatureBuilder &, OsmElement cons
|
|||
FillRegionData(osmId, el, regionData);
|
||||
m_mapRegionData.emplace(osmId, regionData);
|
||||
// If the region is a country.
|
||||
if (regionData.m_adminLevel == AdminLevel::Two)
|
||||
if (regionData.m_place == PlaceType::Country || regionData.m_adminLevel == AdminLevel::Two)
|
||||
{
|
||||
IsoCode isoCode;
|
||||
FillIsoCode(osmId, el, isoCode);
|
||||
|
|
|
@ -6,12 +6,16 @@ namespace regions
|
|||
{
|
||||
PlaceLevel CountrySpecifier::GetLevel(Region const & region) const
|
||||
{
|
||||
auto const placeLevel = GetLevel(region.GetPlaceType());
|
||||
auto const placeType = region.GetPlaceType();
|
||||
auto const placeLevel = GetLevel(placeType);
|
||||
if (placeLevel != PlaceLevel::Unknown)
|
||||
return placeLevel;
|
||||
|
||||
if (region.GetAdminLevel() == AdminLevel::Two)
|
||||
if (region.GetAdminLevel() == AdminLevel::Two &&
|
||||
(placeType == PlaceType::Country || placeType == PlaceType::Unknown))
|
||||
{
|
||||
return PlaceLevel::Country;
|
||||
}
|
||||
|
||||
return PlaceLevel::Unknown;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,12 @@ RegionsBuilder::Regions RegionsBuilder::ExtractCountriesOuters(Regions & regions
|
|||
Regions countriesOuters;
|
||||
|
||||
auto const isCountry = [](Region const & region) {
|
||||
return AdminLevel::Two == region.GetAdminLevel();
|
||||
auto const placeType = region.GetPlaceType();
|
||||
if (placeType == PlaceType::Country)
|
||||
return true;
|
||||
|
||||
auto const adminLevel = region.GetAdminLevel();
|
||||
return adminLevel == AdminLevel::Two && placeType == PlaceType::Unknown;
|
||||
};
|
||||
std::copy_if(std::begin(regions), std::end(regions), std::back_inserter(countriesOuters),
|
||||
isCountry);
|
||||
|
|
Loading…
Add table
Reference in a new issue