[generator:regions] Fix around place insertion

This commit is contained in:
Anatoly Serdtcev 2019-07-08 11:28:30 +03:00 committed by Tatiana Yan
parent 76442bf4b8
commit 1937234152

View file

@ -148,14 +148,16 @@ void LocalityPointIntegrator::EmboundBy(LevelRegion const & region)
continue;
// Skip error in boost::geometry::intersection(): there are A and B when
// intersection(A, B) != null and intersection(A, intersection(A, B)) == null.
auto checkPolygon = boost::geometry::model::multi_polygon<BoostPolygon>{};
boost::geometry::intersection(regionPolygon, polygon, checkPolygon);
if (checkPolygon.empty())
continue;
m_localityRegion.SetPolygon(std::make_shared<BoostPolygon>(std::move(polygon)));
return;
// intersection(A, B) != null but intersection(A, B) != intersection(A, intersection(A, B))
// or !covered_by(intersection(A, B), A).
auto checkLocalityRegion = m_localityRegion;
checkLocalityRegion.SetPolygon(std::make_shared<BoostPolygon>(std::move(polygon)));
if (0 < RegionsBuilder::CompareAffiliation(region, checkLocalityRegion,
m_countrySpecifier))
{
m_localityRegion = checkLocalityRegion;
return;
}
}
LOG(LWARNING, ("Failed to embound",