forked from organicmaps/organicmaps
Fix bug with early closed polygon point filtration.
We should leave equal first and last point in polygon during simplification.
This commit is contained in:
parent
bfcb154531
commit
037e2a8027
2 changed files with 6 additions and 8 deletions
|
@ -48,13 +48,6 @@ void FeatureBuilder1::AddPoint(m2::PointD const & p)
|
|||
|
||||
void FeatureBuilder1::SetAreaAddHoles(list<vector<m2::PointD> > & holes)
|
||||
{
|
||||
// this function is called from InitFeatureBuilder, when no geometry present
|
||||
if (!m_Geometry.empty())
|
||||
{
|
||||
ASSERT ( IsGeometryClosed(), () );
|
||||
m_Geometry.pop_back();
|
||||
}
|
||||
|
||||
m_bArea = true;
|
||||
|
||||
m_Holes.swap(holes);
|
||||
|
|
|
@ -75,7 +75,7 @@ namespace feature
|
|||
{
|
||||
bool is_equal(m2::PointD const & p1, m2::PointD const & p2)
|
||||
{
|
||||
return p1.EqualDxDy(p2, MercatorBounds::GetCellID2PointAbsEpsilon());
|
||||
return AlmostEqual(p1, p2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -265,6 +265,11 @@ namespace feature
|
|||
|
||||
bool TryToMakeStrip(points_t & points)
|
||||
{
|
||||
ASSERT ( is_equal(points.front(), points.back()), () );
|
||||
// At this point we don't need last point equal to first.
|
||||
// If you try to remove it in first step, 'simplify' will work bad for such polygons.
|
||||
points.pop_back();
|
||||
|
||||
size_t const count = points.size();
|
||||
if (!m_trgInner || count > 15 + 2)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue