Handle cases where Simplify removes all outlines

This could theoretically happen for a fully degenerate polygon

Fixes https://gitlab.com/kicad/code/kicad/issues/12120

(cherry picked from commit 5a37211fdb)
This commit is contained in:
Seth Hillbrand
2022-09-06 10:42:02 -07:00
parent b72675ba92
commit b324abefe5
2 changed files with 17 additions and 14 deletions
+14 -13
View File
@@ -503,21 +503,22 @@ void BITMAPCONV_INFO::createOutputData( BMP2CMP_MOD_LAYER aModLayer )
polyset_areas.BooleanSubtract( polyset_holes, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
// Ensure there are no self intersecting polygons
polyset_areas.NormalizeAreaOutlines();
// Convert polygon with holes to a unique polygon
polyset_areas.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
// Output current resulting polygon(s)
for( int ii = 0; ii < polyset_areas.OutlineCount(); ii++ )
if( polyset_areas.NormalizeAreaOutlines() )
{
SHAPE_LINE_CHAIN& poly = polyset_areas.Outline( ii );
outputOnePolygon( poly, getBoardLayerName( aModLayer ));
}
// Convert polygon with holes to a unique polygon
polyset_areas.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
polyset_areas.RemoveAllContours();
polyset_holes.RemoveAllContours();
main_outline = true;
// Output current resulting polygon(s)
for( int ii = 0; ii < polyset_areas.OutlineCount(); ii++ )
{
SHAPE_LINE_CHAIN& poly = polyset_areas.Outline( ii );
outputOnePolygon( poly, getBoardLayerName( aModLayer ));
}
polyset_areas.RemoveAllContours();
polyset_holes.RemoveAllContours();
main_outline = true;
}
}
paths = paths->next;