Gerber plotter: Better object attributes handling when plotting a zone

- Clear object attributes before and after plotting a zone.
 It avoid using previously defined object attributes when plotting the next
 zone, and using therefore incorrect attributes.
- Add aperture attribute to filled zone solid polygons (regions in Gerber)

From master branch
This commit is contained in:
jean-pierre charras 2020-06-28 13:13:51 +02:00
parent 24aad2eed4
commit a370d69542
2 changed files with 18 additions and 20 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2016-2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2016-2020 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -36,7 +36,6 @@
#include <math/box2.h> #include <math/box2.h>
#include <draw_graphic_text.h> #include <draw_graphic_text.h>
#include <page_info.h> #include <page_info.h>
#include <eda_text.h> // FILL_T
class SHAPE_POLY_SET; class SHAPE_POLY_SET;
class SHAPE_LINE_CHAIN; class SHAPE_LINE_CHAIN;

View File

@ -666,6 +666,7 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone )
cornerList.clear(); cornerList.clear();
m_plotter->SetColor( getColor( aZone->GetLayer() ) ); m_plotter->SetColor( getColor( aZone->GetLayer() ) );
m_plotter->StartBlock( nullptr ); // Clean current object attributes
/* Plot all filled areas: filled areas have a filled area and a thick /* Plot all filled areas: filled areas have a filled area and a thick
* outline we must plot the filled area itself ( as a filled polygon * outline we must plot the filled area itself ( as a filled polygon
@ -689,26 +690,22 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone )
// Plot the current filled area and its outline // Plot the current filled area and its outline
if( GetPlotMode() == FILLED ) if( GetPlotMode() == FILLED )
{ {
// Plot the filled area polygon. // Plot the current filled area (as region for Gerber plotter
// The area can be filled by segments or uses solid polygons // to manage attributes) and its outline for thick outline
if( aZone->GetFillMode() == ZONE_FILL_MODE::ZFM_POLYGONS ) // We are using solid polygons if( GetPlotMode() == FILLED )
{
if( m_plotter->GetPlotterType() == PLOT_FORMAT_GERBER )
{ {
m_plotter->PlotPoly( cornerList, FILLED_SHAPE, aZone->GetMinThickness(), &gbr_metadata ); if( aZone->GetMinThickness() > 0 )
} m_plotter->PlotPoly( cornerList, NO_FILL,
else // We are using areas filled by segments: plot segments and outline aZone->GetMinThickness(), &gbr_metadata );
{
for( unsigned iseg = 0; iseg < aZone->FillSegments().size(); iseg++ )
{
wxPoint start = (wxPoint) aZone->FillSegments()[iseg].A;
wxPoint end = (wxPoint) aZone->FillSegments()[iseg].B;
m_plotter->ThickSegment( start, end,
aZone->GetMinThickness(),
GetPlotMode(), &gbr_metadata );
}
// Plot the area outline only static_cast<GERBER_PLOTTER*>( m_plotter )->PlotGerberRegion(
if( aZone->GetMinThickness() > 0 ) cornerList, &gbr_metadata );
m_plotter->PlotPoly( cornerList, NO_FILL, aZone->GetMinThickness() ); }
else
m_plotter->PlotPoly( cornerList, FILLED_SHAPE,
aZone->GetMinThickness(), &gbr_metadata );
} }
} }
else else
@ -727,6 +724,8 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone )
cornerList.clear(); cornerList.clear();
} }
} }
m_plotter->EndBlock( nullptr ); // Clear object attributes
} }