Custom pad shape primitive not always visible

Fixes: lp:1750458
https://bugs.launchpad.net/kicad/+bug/1750458
This commit is contained in:
jean-pierre charras 2018-02-20 10:52:37 +01:00
parent a752f376a1
commit 79dac591c8
1 changed files with 1 additions and 27 deletions

View File

@ -238,35 +238,9 @@ bool D_PAD::buildCustomPadPolygon( SHAPE_POLY_SET* aMergedPolygon,
aux_polyset.Simplify( SHAPE_POLY_SET::PM_FAST );
// Merge all polygons, if more than one, pick the largest (area-wise)
// Merge all polygons with the initial pad anchot shape
if( aux_polyset.OutlineCount() )
{
if( aux_polyset.OutlineCount() >= 2)
{
int bestOutline = 0;
double maxArea = 0.0;
for( int i = 0; i < aux_polyset.OutlineCount(); i++ )
{
double area = aux_polyset.COutline(i).Area();
if ( area > maxArea )
{
maxArea = area;
bestOutline = i;
}
}
if( bestOutline != 0 )
aux_polyset.Polygon( 0 ) = aux_polyset.Polygon( bestOutline );
for (int i = 1; i < aux_polyset.OutlineCount(); i++ )
{
aux_polyset.DeletePolygon( i );
}
}
aMergedPolygon->BooleanAdd( aux_polyset, SHAPE_POLY_SET::PM_FAST );
aMergedPolygon->Fracture( SHAPE_POLY_SET::PM_FAST );
}