Add Gerber plot for SHAPE_ARC and SHAPE_LINE_CHAIN

This commit is contained in:
Seth Hillbrand
2021-06-03 17:12:56 -07:00
parent 013209046b
commit 3d4ce0796e
4 changed files with 183 additions and 64 deletions
+27 -43
View File
@@ -779,9 +779,6 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( const ZONE* aZone, const SHAPE_POLY_SET&
}
}
// We need a buffer to store corners coordinates:
std::vector< wxPoint > cornerList;
m_plotter->SetColor( getColor( aZone->GetLayer() ) );
m_plotter->StartBlock( nullptr ); // Clean current object attributes
@@ -798,55 +795,42 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( const ZONE* aZone, const SHAPE_POLY_SET&
{
const SHAPE_LINE_CHAIN& outline = polysList.Outline( idx );
cornerList.clear();
cornerList.reserve( outline.PointCount() );
for( int ic = 0; ic < outline.PointCount(); ++ic )
// Plot the current filled area (as region for Gerber plotter
// to manage attributes) and its outline for thick outline
if( GetPlotMode() == FILLED )
{
cornerList.emplace_back( wxPoint( outline.CPoint( ic ) ) );
}
if( cornerList.size() ) // Plot the current filled area outline
{
// First, close the outline
if( cornerList[0] != cornerList[cornerList.size() - 1] )
cornerList.push_back( cornerList[0] );
// Plot the current filled area (as region for Gerber plotter
// to manage attributes) and its outline for thick outline
if( GetPlotMode() == FILLED )
if( m_plotter->GetPlotterType() == PLOT_FORMAT::GERBER )
{
if( m_plotter->GetPlotterType() == PLOT_FORMAT::GERBER )
if( outline_thickness > 0 )
{
if( outline_thickness > 0 )
{
m_plotter->PlotPoly( cornerList, FILL_TYPE::NO_FILL, outline_thickness,
&gbr_metadata );
}
m_plotter->PlotPoly( outline, FILL_TYPE::NO_FILL,
outline_thickness, &gbr_metadata );
}
static_cast<GERBER_PLOTTER*>( m_plotter )->PlotGerberRegion( cornerList,
&gbr_metadata );
}
else
{
m_plotter->PlotPoly( cornerList, FILL_TYPE::FILLED_SHAPE, outline_thickness,
&gbr_metadata );
}
static_cast<GERBER_PLOTTER*>( m_plotter )->PlotGerberRegion(
outline, &gbr_metadata );
}
else
{
if( outline_thickness )
{
for( unsigned jj = 1; jj < cornerList.size(); jj++ )
{
m_plotter->ThickSegment( cornerList[jj -1], cornerList[jj],
outline_thickness, GetPlotMode(), &gbr_metadata );
}
}
m_plotter->SetCurrentLineWidth( -1 );
m_plotter->PlotPoly( outline, FILL_TYPE::FILLED_SHAPE,
outline_thickness, &gbr_metadata );
}
}
else
{
if( outline_thickness )
{
for( int jj = 1; jj < outline.PointCount(); jj++ )
{
m_plotter->ThickSegment( wxPoint( outline.CPoint( jj - 1) ),
wxPoint( outline.CPoint( jj ) ),
outline_thickness,
GetPlotMode(), &gbr_metadata );
}
}
m_plotter->SetCurrentLineWidth( -1 );
}
}
m_plotter->EndBlock( nullptr ); // Clear object attributes