pcbnew: Allow closed polygons as board edges

Like circles, polygons are self-closed elements that define an outline.
This allows them to be used as such for board outlines and cutouts.

Fixes: lp:1795563
* https://bugs.launchpad.net/kicad/+bug/1795563
This commit is contained in:
Seth Hillbrand
2018-12-04 12:32:47 -08:00
parent 58036382c1
commit 1858b7dca7
4 changed files with 69 additions and 9 deletions
+19 -7
View File
@@ -762,14 +762,26 @@ void BRDITEMS_PLOTTER::PlotDrawSegment( DRAWSEGMENT* aSeg )
case S_POLYGON:
{
m_plotter->SetCurrentLineWidth( thickness, &gbr_metadata );
// Draw the polygon: only one polygon is expected
// However we provide a multi polygon shape drawing
// ( for the future or to show a non expected shape )
for( int jj = 0; jj < aSeg->GetPolyShape().OutlineCount(); ++jj )
if( m_layerMask[ Edge_Cuts ] )
{
SHAPE_LINE_CHAIN& poly = aSeg->GetPolyShape().Outline( jj );
m_plotter->PlotPoly( poly, FILLED_SHAPE, thickness, &gbr_metadata );
for( auto it = aSeg->GetPolyShape().IterateSegments( 0 ); it; it++ )
{
auto seg = it.Get();
m_plotter->ThickSegment( wxPoint( seg.A ), wxPoint( seg.B ),
thickness, GetPlotMode(), &gbr_metadata );
}
}
else
{
m_plotter->SetCurrentLineWidth( thickness, &gbr_metadata );
// Draw the polygon: only one polygon is expected
// However we provide a multi polygon shape drawing
// ( for the future or to show a non expected shape )
for( int jj = 0; jj < aSeg->GetPolyShape().OutlineCount(); ++jj )
{
SHAPE_LINE_CHAIN& poly = aSeg->GetPolyShape().Outline( jj );
m_plotter->PlotPoly( poly, FILLED_SHAPE, thickness, &gbr_metadata );
}
}
}
break;