Retire the V5 zone fill algorithm.

Fixes https://gitlab.com/kicad/code/kicad/issues/10578
This commit is contained in:
Jeff Young 2022-02-11 12:42:09 +00:00
parent 50a4d610a6
commit 3deaf902bb
32 changed files with 120 additions and 588 deletions

View File

@ -648,61 +648,6 @@ void BOARD_ADAPTER::addSolidAreasShapes( const ZONE* aZone, CONTAINER_2D_BASE* a
// This convert the poly in outline and holes
ConvertPolygonToTriangles( polyList, *aContainer, m_biuTo3Dunits, *aZone );
// add filled areas outlines, which are drawn with thick lines segments
// but only if filled polygons outlines have thickness
if( !aZone->GetFilledPolysUseThickness() )
return;
float width3DU = TO_3DU( aZone->GetMinThickness() );
for( int i = 0; i < polyList.OutlineCount(); ++i )
{
// Add outline
const SHAPE_LINE_CHAIN& pathOutline = polyList.COutline( i );
for( int j = 0; j < pathOutline.PointCount(); ++j )
{
SFVEC2F start3DU = TO_SFVEC2F( pathOutline.CPoint( j ) );
SFVEC2F end3DU = TO_SFVEC2F( pathOutline.CPoint( j + 1 ) );
if( Is_segment_a_circle( start3DU, end3DU ) )
{
float radius3DU = width3DU / 2;
if( radius3DU > 0.0 ) // degenerated circles crash 3D viewer
aContainer->Add( new FILLED_CIRCLE_2D( start3DU, radius3DU, *aZone ) );
}
else
{
aContainer->Add( new ROUND_SEGMENT_2D( start3DU, end3DU, width3DU, *aZone ) );
}
}
// Add holes (of the poly, ie: the open parts) for this outline
for( int h = 0; h < polyList.HoleCount( i ); ++h )
{
const SHAPE_LINE_CHAIN& pathHole = polyList.CHole( i, h );
for( int j = 0; j < pathHole.PointCount(); j++ )
{
SFVEC2F start3DU = TO_SFVEC2F( pathHole.CPoint( j ) );
SFVEC2F end3DU = TO_SFVEC2F( pathHole.CPoint( j + 1 ) );
if( Is_segment_a_circle( start3DU, end3DU ) )
{
float radius3DU = width3DU / 2;
if( radius3DU > 0.0 ) // degenerated circles crash 3D viewer
aContainer->Add( new FILLED_CIRCLE_2D( start3DU, radius3DU, *aZone ) );
}
else
{
aContainer->Add( new ROUND_SEGMENT_2D( start3DU, end3DU, width3DU, *aZone ) );
}
}
}
}
}

View File

@ -700,21 +700,6 @@ public:
std::map<int, SEVERITY> m_DRCSeverities; // Map from DRCErrorCode to SEVERITY
std::set<wxString> m_DrcExclusions;
/**
* Option to select different fill algorithms.
*
* There are currently two supported values:
* 5:
* - Use thick outlines around filled polygons (gives smoothest shape but at the expense
* of processing time and slight infidelity when exporting)
* - Use zone outline when knocking out higher-priority zones (just wrong, but mimics
* legacy behavior.
* 6:
* - No thick outline.
* - Use filled areas when knocking out higher-priority zones.
*/
int m_ZoneFillVersion;
// When smoothing the zone's outline there's the question of external fillets (that is, those
// applied to concave corners). While it seems safer to never have copper extend outside the
// zone outline, 5.1.x and prior did indeed fill them so we leave the mode available.

View File

@ -96,7 +96,6 @@ BOARD::BOARD() :
m_SolderMask->Outline()->Append( VECTOR2I( +infinity, +infinity ) );
m_SolderMask->Outline()->Append( VECTOR2I( +infinity, -infinity ) );
m_SolderMask->SetMinThickness( 0 );
m_SolderMask->SetFillVersion( 6 );
BOARD_DESIGN_SETTINGS& bds = GetDesignSettings();

View File

@ -180,9 +180,7 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
m_DRCSeverities[ DRCE_TEXT_THICKNESS ] = RPT_SEVERITY_WARNING;
m_MaxError = ARC_HIGH_DEF;
m_ZoneFillVersion = 6; // Use new algo by default to fill zones
m_ZoneKeepExternalFillets = false; // Use new algo by default. Legacy boards might
// want to set it to true for old algo....
m_ZoneKeepExternalFillets = false;
m_UseHeightForLengthCalcs = true;
// Global mask margins:
@ -739,18 +737,6 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
&m_SolderMaskToCopperClearance, Millimeter2iu( DEFAULT_SOLDERMASK_TO_COPPER_CLEARANCE ),
Millimeter2iu( 0.0 ), Millimeter2iu( 25.0 ), MM_PER_IU ) );
// TODO: replace with zones_fill_version parameter and migrate zones_use_no_outline?
m_params.emplace_back( new PARAM_LAMBDA<bool>( "zones_use_no_outline",
[this]() -> bool
{
return m_ZoneFillVersion >= 6;
},
[this]( bool aVal )
{
m_ZoneFillVersion = aVal ? 6 : 5;
},
true ) );
m_params.emplace_back( new PARAM<bool>( "zones_allow_external_fillets",
&m_ZoneKeepExternalFillets, false ) );
@ -840,7 +826,6 @@ void BOARD_DESIGN_SETTINGS::initFromOther( const BOARD_DESIGN_SETTINGS& aOther )
m_MinSilkTextThickness = aOther.m_MinSilkTextThickness;
m_DRCSeverities = aOther.m_DRCSeverities;
m_DrcExclusions = aOther.m_DrcExclusions;
m_ZoneFillVersion = aOther.m_ZoneFillVersion;
m_ZoneKeepExternalFillets = aOther.m_ZoneKeepExternalFillets;
m_MaxError = aOther.m_MaxError;
m_SolderMaskExpansion = aOther.m_SolderMaskExpansion;

View File

@ -709,15 +709,6 @@ void CN_VISITOR::checkZoneZoneConnection( CN_ZONE_LAYER* aZoneLayerA, CN_ZONE_LA
const BOX2I& boxA = aZoneLayerA->BBox();
const BOX2I& boxB = aZoneLayerB->BBox();
int radiusA = 0;
int radiusB = 0;
if( zoneA->GetFilledPolysUseThickness() )
radiusA = ( zoneA->GetMinThickness() + 1 ) / 2;
if( zoneB->GetFilledPolysUseThickness() )
radiusB = ( zoneB->GetMinThickness() + 1 ) / 2;
PCB_LAYER_ID layer = static_cast<PCB_LAYER_ID>( aZoneLayerA->Layer() );
const SHAPE_LINE_CHAIN& outline =
@ -728,7 +719,7 @@ void CN_VISITOR::checkZoneZoneConnection( CN_ZONE_LAYER* aZoneLayerA, CN_ZONE_LA
if( !boxB.Contains( outline.CPoint( i ) ) )
continue;
if( aZoneLayerB->ContainsPoint( outline.CPoint( i ), radiusA ) )
if( aZoneLayerB->ContainsPoint( outline.CPoint( i ) ) )
{
aZoneLayerA->Connect( aZoneLayerB );
aZoneLayerB->Connect( aZoneLayerA );
@ -744,7 +735,7 @@ void CN_VISITOR::checkZoneZoneConnection( CN_ZONE_LAYER* aZoneLayerA, CN_ZONE_LA
if( !boxA.Contains( outline2.CPoint( i ) ) )
continue;
if( aZoneLayerA->ContainsPoint( outline2.CPoint( i ), radiusB ) )
if( aZoneLayerA->ContainsPoint( outline2.CPoint( i ) ) )
{
aZoneLayerA->Connect( aZoneLayerB );
aZoneLayerB->Connect( aZoneLayerA );

View File

@ -316,13 +316,7 @@ public:
bool ContainsPoint( const VECTOR2I& p, int aAccuracy = 0 ) const
{
ZONE* zone = static_cast<ZONE*>( Parent() );
int clearance = aAccuracy;
if( zone->GetFilledPolysUseThickness() )
clearance += ( zone->GetMinThickness() + 1 ) / 2;
return m_cachedPoly->ContainsPoint( p, clearance );
return m_cachedPoly->ContainsPoint( p, aAccuracy );
}
const BOX2I& BBox()

View File

@ -74,8 +74,6 @@ bool PANEL_SETUP_CONSTRAINTS::TransferDataToWindow()
m_maxError.SetValue( m_BrdSettings->m_MaxError );
m_rbOutlinePolygonFastest->SetValue( m_BrdSettings->m_ZoneFillVersion == 6 );
m_rbOutlinePolygonBestQ->SetValue( m_BrdSettings->m_ZoneFillVersion == 5 );
m_allowExternalFilletsOpt->SetValue( m_BrdSettings->m_ZoneKeepExternalFillets );
m_minResolvedSpokeCountCtrl->SetValue( m_BrdSettings->m_MinResolvedSpokes );
@ -136,7 +134,6 @@ bool PANEL_SETUP_CONSTRAINTS::TransferDataFromWindow()
m_maxError.GetValue(),
IU_PER_MM * MAXIMUM_ERROR_SIZE_MM );
m_BrdSettings->m_ZoneFillVersion = m_rbOutlinePolygonFastest->GetValue() ? 6 : 5;
m_BrdSettings->m_ZoneKeepExternalFillets = m_allowExternalFilletsOpt->GetValue();
m_BrdSettings->m_MinResolvedSpokes = m_minResolvedSpokeCountCtrl->GetValue();
@ -170,7 +167,6 @@ bool PANEL_SETUP_CONSTRAINTS::Show( bool aShow )
// These *should* work in the constructor, and indeed they do if this panel is the
// first displayed. However, on OSX 3.0.5 (at least), if another panel is displayed
// first then the icons will be blank unless they're set here.
m_bitmapZoneFillOpt->SetBitmap( KiBitmap( BITMAPS::show_zone ) );
m_filletBitmap->SetBitmap( KiBitmap( BITMAPS::zone_fillet ) );
m_spokeBitmap->SetBitmap( KiBitmap( BITMAPS::thermal_spokes ) );
m_bitmapClearance->SetBitmap( KiBitmap( BITMAPS::ps_diff_pair_gap ) );
@ -202,14 +198,3 @@ void PANEL_SETUP_CONSTRAINTS::ImportSettingsFrom( BOARD* aBoard )
m_BrdSettings = savedSettings;
}
void PANEL_SETUP_CONSTRAINTS::onChangeOutlineOpt( wxCommandEvent& event )
{
wxObject* item =event.GetEventObject();
if( item == m_rbOutlinePolygonBestQ )
m_rbOutlinePolygonFastest->SetValue( not m_rbOutlinePolygonBestQ->GetValue() );
else
m_rbOutlinePolygonBestQ->SetValue( not m_rbOutlinePolygonFastest->GetValue() );
}

View File

@ -48,8 +48,6 @@ private:
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
void onChangeOutlineOpt( wxCommandEvent& event ) override;
public:
UNIT_BINDER m_minClearance;
UNIT_BINDER m_trackMinWidth;

View File

@ -97,33 +97,7 @@ PANEL_SETUP_CONSTRAINTS_BASE::PANEL_SETUP_CONSTRAINTS_BASE( wxWindow* parent, wx
m_stZoneFilledPolysOpt = new wxStaticText( m_scrolledWindow, wxID_ANY, _("Zone fill strategy"), wxDefaultPosition, wxDefaultSize, 0 );
m_stZoneFilledPolysOpt->Wrap( -1 );
m_bSizerPolygonFillOption->Add( m_stZoneFilledPolysOpt, 0, wxALL, 5 );
wxBoxSizer* bSizer5;
bSizer5 = new wxBoxSizer( wxHORIZONTAL );
m_bitmapZoneFillOpt = new wxStaticBitmap( m_scrolledWindow, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
bSizer5->Add( m_bitmapZoneFillOpt, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizerOutlinesOpts;
bSizerOutlinesOpts = new wxBoxSizer( wxVERTICAL );
m_rbOutlinePolygonBestQ = new wxRadioButton( m_scrolledWindow, wxID_ANY, _("Mimic legacy behavior"), wxDefaultPosition, wxDefaultSize, 0 );
m_rbOutlinePolygonBestQ->SetToolTip( _("Produces a slightly smoother outline at the expense of performance, some export fidelity issues, and overly aggressive higher-priority zone knockouts.") );
bSizerOutlinesOpts->Add( m_rbOutlinePolygonBestQ, 0, wxALL, 4 );
m_rbOutlinePolygonFastest = new wxRadioButton( m_scrolledWindow, wxID_ANY, _("Smoothed polygons (best performance)"), wxDefaultPosition, wxDefaultSize, 0 );
m_rbOutlinePolygonFastest->SetValue( true );
m_rbOutlinePolygonFastest->SetToolTip( _("Better performance, exact export fidelity, and more complete filling near higher-priority zones.") );
bSizerOutlinesOpts->Add( m_rbOutlinePolygonFastest, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
bSizer5->Add( bSizerOutlinesOpts, 1, wxEXPAND, 5 );
m_bSizerPolygonFillOption->Add( bSizer5, 0, wxEXPAND, 15 );
m_bSizerPolygonFillOption->Add( m_stZoneFilledPolysOpt, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizer9;
bSizer9 = new wxBoxSizer( wxHORIZONTAL );
@ -500,16 +474,8 @@ PANEL_SETUP_CONSTRAINTS_BASE::PANEL_SETUP_CONSTRAINTS_BASE( wxWindow* parent, wx
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
// Connect Events
m_rbOutlinePolygonBestQ->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PANEL_SETUP_CONSTRAINTS_BASE::onChangeOutlineOpt ), NULL, this );
m_rbOutlinePolygonFastest->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PANEL_SETUP_CONSTRAINTS_BASE::onChangeOutlineOpt ), NULL, this );
}
PANEL_SETUP_CONSTRAINTS_BASE::~PANEL_SETUP_CONSTRAINTS_BASE()
{
// Disconnect Events
m_rbOutlinePolygonBestQ->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PANEL_SETUP_CONSTRAINTS_BASE::onChangeOutlineOpt ), NULL, this );
m_rbOutlinePolygonFastest->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PANEL_SETUP_CONSTRAINTS_BASE::onChangeOutlineOpt ), NULL, this );
}

View File

@ -922,7 +922,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
@ -981,216 +981,6 @@
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">15</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer5</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticBitmap" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_bitmapZoneFillOpt</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizerOutlinesOpts</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">4</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxRadioButton" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Mimic legacy behavior</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_rbOutlinePolygonBestQ</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Produces a slightly smoother outline at the expense of performance, some export fidelity issues, and overly aggressive higher-priority zone knockouts.</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnRadioButton">onChangeOutlineOpt</event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">4</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxRadioButton" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Smoothed polygons (best performance)</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_rbOutlinePolygonFastest</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Better performance, exact export fidelity, and more complete filling near higher-priority zones.</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value">1</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnRadioButton">onChangeOutlineOpt</event>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">7</property>
<property name="flag">wxEXPAND|wxTOP</property>

View File

@ -25,7 +25,6 @@
#include <wx/statline.h>
#include <wx/textctrl.h>
#include <wx/valtext.h>
#include <wx/radiobut.h>
#include <wx/spinctrl.h>
#include <wx/scrolwin.h>
#include <wx/panel.h>
@ -54,9 +53,6 @@ class PANEL_SETUP_CONSTRAINTS_BASE : public wxPanel
wxBoxSizer* m_bSizerPolygonFillOption;
wxStaticLine* m_staticline1;
wxStaticText* m_stZoneFilledPolysOpt;
wxStaticBitmap* m_bitmapZoneFillOpt;
wxRadioButton* m_rbOutlinePolygonBestQ;
wxRadioButton* m_rbOutlinePolygonFastest;
wxStaticBitmap* m_filletBitmap;
wxCheckBox* m_allowExternalFilletsOpt;
wxStaticBitmap* m_spokeBitmap;
@ -131,10 +127,6 @@ class PANEL_SETUP_CONSTRAINTS_BASE : public wxPanel
wxTextCtrl* m_textThicknessCtrl;
wxStaticText* m_textThicknessUnits;
// Virtual event handlers, overide them in your derived class
virtual void onChangeOutlineOpt( wxCommandEvent& event ) { event.Skip(); }
public:
wxScrolledWindow* m_scrolledWindow;

View File

@ -278,7 +278,6 @@ bool zonesNeedUpdate( const FP_ZONE* a, const FP_ZONE* b )
TEST( a->GetMinThickness(), b->GetMinThickness() );
TEST( a->GetFillVersion(), b->GetFillVersion() );
TEST( a->GetIslandRemovalMode(), b->GetIslandRemovalMode() );
TEST( a->GetMinIslandArea(), b->GetMinIslandArea() );

View File

@ -1927,20 +1927,14 @@ void PCB_PAINTER::draw( const ZONE* aZone, int aLayer )
if( polySet.OutlineCount() == 0 ) // Nothing to draw
return;
// Set up drawing options
int outline_thickness = 0;
if( aZone->GetFilledPolysUseThickness( layer ) )
outline_thickness = aZone->GetMinThickness();
m_gal->SetStrokeColor( color );
m_gal->SetFillColor( color );
m_gal->SetLineWidth( outline_thickness );
m_gal->SetLineWidth( 0 );
if( displayMode == ZONE_DISPLAY_MODE::SHOW_FILLED )
{
m_gal->SetIsFill( true );
m_gal->SetIsStroke( outline_thickness > 0 );
m_gal->SetIsStroke( false );
}
else
{

View File

@ -867,73 +867,29 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( const ZONE* aZone, const SHAPE_POLY_SET&
m_plotter->StartBlock( nullptr ); // Clean current object attributes
/* Plot all filled areas: filled areas have a filled area and a thick
* outline (depending on the fill area option we must plot the filled area itself
* and plot the thick outline itself, if the thickness has meaning (at least is > 1)
*
* in non filled mode the outline is plotted, but not the filling items
/*
* In non filled mode the outline is plotted, but not the filling items
*/
int outline_thickness = aZone->GetFilledPolysUseThickness() ? aZone->GetMinThickness() : 0;
for( int idx = 0; idx < polysList.OutlineCount(); ++idx )
{
const SHAPE_LINE_CHAIN& outline = polysList.Outline( idx );
// Plot the current filled area (as region for Gerber plotter
// to manage attributes) and its outline for thick outline
// Plot the current filled area (as region for Gerber plotter to manage attributes)
if( GetPlotMode() == FILLED )
{
if( m_plotter->GetPlotterType() == PLOT_FORMAT::GERBER )
{
if( outline_thickness > 0 )
{
m_plotter->PlotPoly( outline, FILL_T::NO_FILL, outline_thickness,
&gbr_metadata );
// Ensure the outline is closed:
int last_idx = outline.PointCount() - 1;
if( outline.CPoint( 0 ) != outline.CPoint( last_idx ) )
{
m_plotter->ThickSegment( VECTOR2I( outline.CPoint( 0 ) ),
VECTOR2I( outline.CPoint( last_idx ) ),
outline_thickness, GetPlotMode(), &gbr_metadata );
}
}
static_cast<GERBER_PLOTTER*>( m_plotter )->PlotGerberRegion( outline,
&gbr_metadata );
}
else
{
m_plotter->PlotPoly( outline, FILL_T::FILLED_SHAPE, outline_thickness,
&gbr_metadata );
m_plotter->PlotPoly( outline, FILL_T::FILLED_SHAPE, 0, &gbr_metadata );
}
}
else
{
if( outline_thickness )
{
int last_idx = outline.PointCount() - 1;
for( int jj = 1; jj <= last_idx; jj++ )
{
m_plotter->ThickSegment( VECTOR2I( outline.CPoint( jj - 1 ) ),
VECTOR2I( outline.CPoint( jj ) ),
outline_thickness,
GetPlotMode(), &gbr_metadata );
}
// Ensure the outline is closed:
if( outline.CPoint( 0 ) != outline.CPoint( last_idx ) )
{
m_plotter->ThickSegment( VECTOR2I( outline.CPoint( 0 ) ),
VECTOR2I( outline.CPoint( last_idx ) ),
outline_thickness,
GetPlotMode(), &gbr_metadata );
}
}
m_plotter->SetCurrentLineWidth( -1 );
}
}

View File

@ -1696,7 +1696,6 @@ void ALTIUM_PCB::ParsePolygons6Data( const ALTIUM_COMPOUND_FILE& aAltiumPcbF
m_board->Add( zone, ADD_MODE::APPEND );
m_polygons.emplace_back( zone );
zone->SetFillVersion( 6 );
zone->SetNetCode( GetNetCode( elem.net ) );
zone->SetLayer( klayer );
zone->SetPosition( elem.vertices.at( 0 ).position );
@ -1896,7 +1895,6 @@ void ALTIUM_PCB::ConvertShapeBasedRegions6ToBoardItem( const AREGION6& aElem )
ZONE* zone = new ZONE( m_board );
m_board->Add( zone, ADD_MODE::APPEND );
zone->SetFillVersion( 6 );
zone->SetIsRuleArea( true );
zone->SetDoNotAllowTracks( false );
zone->SetDoNotAllowVias( false );
@ -1965,7 +1963,6 @@ void ALTIUM_PCB::ConvertShapeBasedRegions6ToFootprintItem( FOOTPRINT* aFoot
FP_ZONE* zone = new FP_ZONE( aFootprint );
aFootprint->Add( zone, ADD_MODE::APPEND );
zone->SetFillVersion( 6 );
zone->SetIsRuleArea( true );
zone->SetDoNotAllowTracks( false );
zone->SetDoNotAllowVias( false );
@ -2096,16 +2093,15 @@ void ALTIUM_PCB::ParseRegions6Data( const ALTIUM_COMPOUND_FILE& aAltiumPcbFi
}
PCB_LAYER_ID klayer = GetKicadLayer( elem.layer );
if( klayer == UNDEFINED_LAYER )
{
continue; // Just skip it for now. Users can fill it themselves.
}
SHAPE_LINE_CHAIN linechain;
for( const ALTIUM_VERTICE& vertice : elem.outline )
{
linechain.Append( vertice.position );
}
linechain.Append( elem.outline.at( 0 ).position );
linechain.SetClosed( true );
@ -2115,21 +2111,20 @@ void ALTIUM_PCB::ParseRegions6Data( const ALTIUM_COMPOUND_FILE& aAltiumPcbFi
for( const std::vector<ALTIUM_VERTICE>& hole : elem.holes )
{
SHAPE_LINE_CHAIN hole_linechain;
for( const ALTIUM_VERTICE& vertice : hole )
{
hole_linechain.Append( vertice.position );
}
hole_linechain.Append( hole.at( 0 ).position );
hole_linechain.SetClosed( true );
rawPolys.AddHole( hole_linechain );
}
if( zone->GetFilledPolysUseThickness() )
rawPolys.Deflate( zone->GetMinThickness() / 2, 32 );
if( zone->HasFilledPolysForLayer( klayer ) )
{
rawPolys.BooleanAdd( zone->RawPolysList( klayer ),
SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
}
SHAPE_POLY_SET finalPolys = rawPolys;
finalPolys.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
@ -3267,7 +3262,6 @@ void ALTIUM_PCB::ConvertFills6ToBoardItemWithNet( const AFILL6& aElem )
ZONE* zone = new ZONE( m_board );
m_board->Add( zone, ADD_MODE::APPEND );
zone->SetFillVersion( 6 );
zone->SetNetCode( GetNetCode( aElem.net ) );
zone->SetPosition( aElem.pos1 );
@ -3369,7 +3363,6 @@ void ALTIUM_PCB::HelperPcpShapeAsBoardKeepoutRegion( const PCB_SHAPE& aShape,
{
ZONE* zone = new ZONE( m_board );
zone->SetFillVersion( 6 );
zone->SetIsRuleArea( true );
zone->SetDoNotAllowTracks( false );
zone->SetDoNotAllowVias( false );
@ -3403,7 +3396,6 @@ void ALTIUM_PCB::HelperPcpShapeAsFootprintKeepoutRegion( FOOTPRINT* aFootp
{
FP_ZONE* zone = new FP_ZONE( aFootprint );
zone->SetFillVersion( 6 );
zone->SetIsRuleArea( true );
zone->SetDoNotAllowTracks( false );
zone->SetDoNotAllowVias( false );

View File

@ -2078,7 +2078,6 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers()
SHAPE_POLY_SET finalPolys = rawPolys;
finalPolys.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
pouredZone->SetFillVersion( 6 );
pouredZone->SetRawPolysList( getKiCadLayer( csCopper.LayerID ), rawPolys );
pouredZone->SetFilledPolysList( getKiCadLayer( csCopper.LayerID ), finalPolys );
pouredZone->SetIsFilled( true );
@ -2161,7 +2160,6 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers()
SHAPE_POLY_SET fillePolys( *zone->Outline() );
fillePolys.Fracture( SHAPE_POLY_SET::POLYGON_MODE::PM_STRICTLY_SIMPLE );
zone->SetFillVersion( 6 );
zone->SetFilledPolysList( getKiCadLayer( csCopper.LayerID ), fillePolys );
}
}

View File

@ -68,7 +68,8 @@ using namespace PCB_KEYS_T;
void PCB_PARSER::init()
{
m_showLegacyZoneWarning = true;
m_showLegacySegmentZoneWarning = true;
m_showLegacy5ZoneWarning = true;
m_tooRecent = false;
m_requiredVersion = 0;
m_layerIndices.clear();
@ -2166,9 +2167,27 @@ void PCB_PARSER::parseSetup()
NeedRIGHT();
break;
case T_filled_areas_thickness: // Note: legacy (early 5.99) token
designSettings.m_ZoneFillVersion = parseBool() ? 5 : 6;
m_board->m_LegacyDesignSettingsLoaded = true;
case T_filled_areas_thickness:
if( parseBool() )
{
if( m_showLegacy5ZoneWarning )
{
// Thick outline fill mode no longer supported. Make sure user is OK with
// converting fills.
KIDIALOG dlg( nullptr, _( "The legacy zone fill strategy is no longer "
"supported.\nConvert zones to smoothed polygon "
"fills?" ),
_( "Legacy Zone Warning" ), wxYES_NO | wxICON_WARNING );
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
if( dlg.ShowModal() == wxID_NO )
THROW_IO_ERROR( wxT( "CANCEL" ) );
m_showLegacy5ZoneWarning = false;
}
}
NeedRIGHT();
break;
@ -5284,8 +5303,7 @@ PCB_VIA* PCB_PARSER::parsePCB_VIA()
ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent )
{
wxCHECK_MSG( CurTok() == T_zone, nullptr,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) +
wxT( " as ZONE." ) );
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as ZONE." ) );
ZONE_BORDER_DISPLAY_STYLE hatchStyle = ZONE_BORDER_DISPLAY_STYLE::NO_HATCH;
@ -5427,7 +5445,26 @@ ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent )
break;
case T_filled_areas_thickness:
zone->SetFillVersion( parseBool() ? 5 : 6 );
if( parseBool() )
{
if( m_showLegacy5ZoneWarning )
{
// Thick outline fill mode no longer supported. Make sure user is OK with
// converting fills.
KIDIALOG dlg( nullptr, _( "The legacy zone fill strategy is no longer "
"supported.\nConvert zones to smoothed polygon "
"fills?" ),
_( "Legacy Zone Warning" ), wxYES_NO | wxICON_WARNING );
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
if( dlg.ShowModal() == wxID_NO )
THROW_IO_ERROR( wxT( "CANCEL" ) );
m_showLegacy5ZoneWarning = false;
}
}
NeedRIGHT();
break;
@ -5453,20 +5490,19 @@ ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent )
{
// SEGMENT fill mode no longer supported. Make sure user is OK with
// converting them.
if( m_showLegacyZoneWarning )
if( m_showLegacySegmentZoneWarning )
{
KIDIALOG dlg( nullptr,
_( "The legacy segment fill mode is no longer supported."
"\nConvert zones to polygon fills?"),
_( "Legacy Zone Warning" ),
wxYES_NO | wxICON_WARNING );
KIDIALOG dlg( nullptr, _( "The legacy segment fill mode is no longer "
"supported.\nConvert zones to smoothed "
"polygon fills?" ),
_( "Legacy Zone Warning" ), wxYES_NO | wxICON_WARNING );
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
if( dlg.ShowModal() == wxID_NO )
THROW_IO_ERROR( wxT( "CANCEL" ) );
m_showLegacyZoneWarning = false;
m_showLegacySegmentZoneWarning = false;
}
zone->SetFillMode( ZONE_FILL_MODE::POLYGONS );

View File

@ -355,7 +355,8 @@ private:
///< if resetting UUIDs, record new ones to update groups with.
KIID_MAP m_resetKIIDMap;
bool m_showLegacyZoneWarning;
bool m_showLegacySegmentZoneWarning;
bool m_showLegacy5ZoneWarning;
PROGRESS_REPORTER* m_progressReporter; ///< optional; may be nullptr
TIME_PT m_lastProgressTime; ///< for progress reporting

View File

@ -2114,10 +2114,8 @@ void PCB_PLUGIN::format( const ZONE* aZone, int aNestLevel ) const
m_out->Print( aNestLevel+1, "(min_thickness %s)",
FormatInternalUnits( aZone->GetMinThickness() ).c_str() );
// write it only if V 6.O version option is used (i.e. do not write if the "legacy"
// algorithm is used)
if( !aZone->GetFilledPolysUseThickness() )
m_out->Print( 0, " (filled_areas_thickness no)" );
// We continue to write this for 3rd-party parsers, but we no longer read it (as of V7).
m_out->Print( 0, " (filled_areas_thickness no)" );
m_out->Print( 0, "\n" );

View File

@ -114,7 +114,8 @@ class SHAPE_LINE_CHAIN;
//#define SEXPR_BOARD_FILE_VERSION 20211230 // Dimensions in footprints
//#define SEXPR_BOARD_FILE_VERSION 20211231 // Private footprint layers
//#define SEXPR_BOARD_FILE_VERSION 20211232 // Fonts
#define SEXPR_BOARD_FILE_VERSION 20220131 // Textboxes
//#define SEXPR_BOARD_FILE_VERSION 20220131 // Textboxes
#define SEXPR_BOARD_FILE_VERSION 20220211 // Deprecate V5 zone fill strategy
#define BOARD_FILE_HOST_VERSION 20200825 ///< Earlier files than this include the host tag
#define LEGACY_ARC_FORMATTING 20210925 ///< These were the last to use old arc formatting

View File

@ -2460,11 +2460,11 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
{
// SEGMENT fill mode no longer supported. Make sure user is OK with converting
// them.
if( m_showLegacyZoneWarning )
if( m_showLegacySegmentZoneWarning )
{
KIDIALOG dlg( nullptr,
_( "The legacy segment fill mode is no longer supported.\n"
"Convert zones to polygon fills?"),
"Convert zones to smoothed polygon fills?" ),
_( "Legacy Zone Warning" ),
wxYES_NO | wxICON_WARNING );
@ -2473,7 +2473,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
if( dlg.ShowModal() == wxID_NO )
THROW_IO_ERROR( wxT( "CANCEL" ) );
m_showLegacyZoneWarning = false;
m_showLegacySegmentZoneWarning = false;
}
// User OK'd; switch to polygon mode
@ -2858,7 +2858,7 @@ void LEGACY_PLUGIN::init( const PROPERTIES* aProperties )
m_loading_format_version = 0;
m_cu_count = 16;
m_board = nullptr;
m_showLegacyZoneWarning = true;
m_showLegacySegmentZoneWarning = true;
m_props = aProperties;
// conversion factor for saving RAM BIUs to KICAD legacy file format.

View File

@ -193,7 +193,7 @@ protected:
wxString m_field; ///< reused to stuff FOOTPRINT fields.
int m_loading_format_version; ///< which BOARD_FORMAT_VERSION am I Load()ing?
LP_CACHE* m_cache;
bool m_showLegacyZoneWarning;
bool m_showLegacySegmentZoneWarning;
std::vector<int> m_netCodes; ///< net codes mapping for boards being loaded

View File

@ -343,15 +343,6 @@ void ZONE::SetCornerRadius( unsigned int aRadius )
}
bool ZONE::GetFilledPolysUseThickness( PCB_LAYER_ID aLayer ) const
{
if( ADVANCED_CFG::GetCfg().m_DebugZoneFiller && LSET::InternalCuMask().Contains( aLayer ) )
return false;
return GetFilledPolysUseThickness();
}
static SHAPE_POLY_SET g_nullPoly;
@ -1385,32 +1376,8 @@ void ZONE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
void ZONE::TransformSolidAreasShapesToPolygon( PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aCornerBuffer,
int aError ) const
{
if( !m_FilledPolysList.count( aLayer ) || m_FilledPolysList.at( aLayer ).IsEmpty() )
return;
// Just add filled areas if filled polygons outlines have no thickness
if( !GetFilledPolysUseThickness() || GetMinThickness() == 0 )
{
const SHAPE_POLY_SET& polys = m_FilledPolysList.at( aLayer );
aCornerBuffer.Append( polys );
return;
}
// Filled areas have polygons with outline thickness.
// we must create the polygons and add inflated polys
SHAPE_POLY_SET polys = m_FilledPolysList.at( aLayer );
auto board = GetBoard();
int maxError = ARC_HIGH_DEF;
if( board )
maxError = board->GetDesignSettings().m_MaxError;
int numSegs = GetArcToSegmentCount( GetMinThickness(), maxError, FULL_CIRCLE );
polys.InflateWithLinkedHoles( GetMinThickness()/2, numSegs, SHAPE_POLY_SET::PM_FAST );
aCornerBuffer.Append( polys );
if( m_FilledPolysList.count( aLayer ) && !m_FilledPolysList.at( aLayer ).IsEmpty() )
aCornerBuffer.Append( m_FilledPolysList.at( aLayer ) );
}

View File

@ -711,12 +711,6 @@ public:
unsigned int GetCornerRadius() const { return m_cornerRadius; }
bool GetFilledPolysUseThickness() const { return m_fillVersion == 5; }
bool GetFilledPolysUseThickness( PCB_LAYER_ID aLayer ) const;
int GetFillVersion() const { return m_fillVersion; }
void SetFillVersion( int aVersion ) { m_fillVersion = aVersion; }
/**
* Remove a cutout from the zone.
*

View File

@ -165,8 +165,6 @@ bool ZONE_FILLER::Fill( std::vector<ZONE*>& aZones, bool aCheck, wxWindow* aPare
// Remove existing fill first to prevent drawing invalid polygons
// on some platforms
zone->UnFill();
zone->SetFillVersion( bds.m_ZoneFillVersion );
}
size_t cores = std::thread::hardware_concurrency();
@ -915,17 +913,8 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE* aZone, PCB_LAYER_ID aLa
// Keepouts use outline with no clearance
aKnockout->TransformSmoothedOutlineToPolygon( aHoles, 0, nullptr );
}
else if( bds.m_ZoneFillVersion == 5 )
{
// 5.x used outline with clearance
int gap = evalRulesForItems( CLEARANCE_CONSTRAINT, aZone, aKnockout,
aLayer );
aKnockout->TransformSmoothedOutlineToPolygon( aHoles, gap, nullptr );
}
else
{
// 6.0 uses filled areas with clearance
int gap = evalRulesForItems( CLEARANCE_CONSTRAINT, aZone, aKnockout,
aLayer );
@ -1203,15 +1192,8 @@ bool ZONE_FILLER::computeRawFilledArea( const ZONE* aZone,
return false;
// Re-inflate after pruning of areas that don't meet minimum-width criteria
if( aZone->GetFilledPolysUseThickness() )
{
// If we're stroking the zone with a min_width stroke then this will naturally inflate
// the zone by half_min_width
}
else if( half_min_width - epsilon > epsilon )
{
if( half_min_width - epsilon > epsilon )
aRawPolys.Inflate( half_min_width - epsilon, numSegs, cornerStrategy );
}
DUMP_POLYS_TO_COPPER_LAYER( aRawPolys, In15_Cu, wxT( "after-reinflating" ) );
@ -1279,15 +1261,8 @@ bool ZONE_FILLER::fillSingleZone( ZONE* aZone, PCB_LAYER_ID aLayer, SHAPE_POLY_S
addHatchFillTypeOnZone( aZone, aLayer, debugLayer, smoothedPoly );
// Re-inflate after pruning of areas that don't meet minimum-width criteria
if( aZone->GetFilledPolysUseThickness() )
{
// If we're stroking the zone with a min_width stroke then this will naturally
// inflate the zone by half_min_width
}
else if( half_min_width - epsilon > epsilon )
{
if( half_min_width - epsilon > epsilon )
smoothedPoly.Inflate( half_min_width - epsilon, numSegs );
}
aRawPolys = smoothedPoly;
aFinalPolys = smoothedPoly;

View File

@ -96,7 +96,7 @@ void LoadBoard( SETTINGS_MANAGER& aSettingsManager, const wxString& aRelPath,
}
void FillZones( BOARD* m_board, int aFillVersion )
void FillZones( BOARD* m_board )
{
TOOL_MANAGER toolMgr;
toolMgr.SetEnvironment( m_board, nullptr, nullptr, nullptr, nullptr );
@ -105,8 +105,6 @@ void FillZones( BOARD* m_board, int aFillVersion )
ZONE_FILLER filler( m_board, &commit );
std::vector<ZONE*> toFill;
m_board->GetDesignSettings().m_ZoneFillVersion = aFillVersion;
for( ZONE* zone : m_board->Zones() )
toFill.push_back( zone );

View File

@ -61,7 +61,7 @@ public:
void LoadBoard( SETTINGS_MANAGER& aSettingsManager, const wxString& aRelPath,
std::unique_ptr<BOARD>& aBoard );
void FillZones( BOARD* m_board, int aFillVersion );
void FillZones( BOARD* m_board );
} // namespace KI_TEST

View File

@ -48,7 +48,7 @@ BOOST_FIXTURE_TEST_CASE( DRCCustomRuleSeverityTest, DRC_REGRESSION_TEST_FIXTURE
// therefore only generate edge-clearance violations for the other edge connector.
KI_TEST::LoadBoard( m_settingsManager, "severities", m_board );
KI_TEST::FillZones( m_board.get(), 6 );
KI_TEST::FillZones( m_board.get() );
std::vector<DRC_ITEM> violations;
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();

View File

@ -63,7 +63,7 @@ BOOST_FIXTURE_TEST_CASE( DRCFalsePositiveRegressions, DRC_REGRESSION_TEST_FIXTUR
for( const wxString& relPath : tests )
{
KI_TEST::LoadBoard( m_settingsManager, relPath, m_board );
KI_TEST::FillZones( m_board.get(), 6 );
KI_TEST::FillZones( m_board.get() );
std::vector<DRC_ITEM> violations;
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
@ -130,7 +130,7 @@ BOOST_FIXTURE_TEST_CASE( DRCFalseNegativeRegressions, DRC_REGRESSION_TEST_FIXTUR
for( const std::pair<wxString, int>& entry : tests )
{
KI_TEST::LoadBoard( m_settingsManager, entry.first, m_board );
KI_TEST::FillZones( m_board.get(), 6 );
KI_TEST::FillZones( m_board.get() );
std::vector<DRC_ITEM> violations;
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();

View File

@ -44,7 +44,7 @@ struct DRC_REGRESSION_TEST_FIXTURE
BOOST_FIXTURE_TEST_CASE( DRCSolderMaskBridgingTest, DRC_REGRESSION_TEST_FIXTURE )
{
KI_TEST::LoadBoard( m_settingsManager, "solder_mask_bridge_test", m_board );
KI_TEST::FillZones( m_board.get(), 6 );
KI_TEST::FillZones( m_board.get() );
std::vector<DRC_ITEM> violations;
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();

View File

@ -75,7 +75,7 @@ BOOST_FIXTURE_TEST_CASE( FailedToCleanRegressionTests, TRACK_CLEANER_TEST_FIXTUR
for( const TEST_DESCRIPTION& entry : tests )
{
KI_TEST::LoadBoard( m_settingsManager, entry.m_File, m_board );
KI_TEST::FillZones( m_board.get(), 6 );
KI_TEST::FillZones( m_board.get() );
m_board->GetConnectivity()->RecalculateRatsnest();
TOOL_MANAGER toolMgr;
@ -141,7 +141,7 @@ BOOST_FIXTURE_TEST_CASE( TrackCleanerRegressionTests, TRACK_CLEANER_TEST_FIXTURE
for( const wxString& relPath : tests )
{
KI_TEST::LoadBoard( m_settingsManager, relPath, m_board );
KI_TEST::FillZones( m_board.get(), 6 );
KI_TEST::FillZones( m_board.get() );
m_board->GetConnectivity()->RecalculateRatsnest();
TOOL_MANAGER toolMgr;

View File

@ -53,7 +53,7 @@ BOOST_FIXTURE_TEST_CASE( BasicZoneFills, ZONE_FILL_TEST_FIXTURE )
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
KI_TEST::FillZones( m_board.get(), 6 );
KI_TEST::FillZones( m_board.get() );
// Now that the zones are filled we're going to increase the size of -some- pads and
// tracks so that they generate DRC errors. The test then makes sure that those errors
@ -159,7 +159,7 @@ BOOST_FIXTURE_TEST_CASE( NotchedZones, ZONE_FILL_TEST_FIXTURE )
BOOST_CHECK_GT( frontCopper.OutlineCount(), 2 );
// Now re-fill and make sure the holes are gone.
KI_TEST::FillZones( m_board.get(), 6 );
KI_TEST::FillZones( m_board.get() );
frontCopper = SHAPE_POLY_SET();
@ -197,44 +197,37 @@ BOOST_FIXTURE_TEST_CASE( RegressionZoneFillTests, ZONE_FILL_TEST_FIXTURE )
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
for( int fillVersion : { 5, 6 } )
{
KI_TEST::FillZones( m_board.get(), fillVersion );
KI_TEST::FillZones( m_board.get() );
std::vector<DRC_ITEM> violations;
std::vector<DRC_ITEM> violations;
bds.m_DRCEngine->SetViolationHandler(
[&]( const std::shared_ptr<DRC_ITEM>& aItem, VECTOR2I aPos,
PCB_LAYER_ID aLayer )
{
if( aItem->GetErrorCode() == DRCE_CLEARANCE )
violations.push_back( *aItem );
} );
bds.m_DRCEngine->RunTests( EDA_UNITS::MILLIMETRES, true, false );
if( violations.empty() )
{
BOOST_CHECK_EQUAL( 1, 1 ); // quiet "did not check any assertions" warning
BOOST_TEST_MESSAGE( wxString::Format( "Zone fill regression: %s, V%d algo passed",
relPath,
fillVersion ) );
}
else
{
std::map<KIID, EDA_ITEM*> itemMap;
m_board->FillItemMap( itemMap );
for( const DRC_ITEM& item : violations )
bds.m_DRCEngine->SetViolationHandler(
[&]( const std::shared_ptr<DRC_ITEM>& aItem, VECTOR2I aPos,
PCB_LAYER_ID aLayer )
{
BOOST_TEST_MESSAGE( item.ShowReport( EDA_UNITS::INCHES, RPT_SEVERITY_ERROR,
itemMap ) );
}
if( aItem->GetErrorCode() == DRCE_CLEARANCE )
violations.push_back( *aItem );
} );
BOOST_ERROR( wxString::Format( "Zone fill regression: %s, V%d algo failed",
relPath,
fillVersion ) );
bds.m_DRCEngine->RunTests( EDA_UNITS::MILLIMETRES, true, false );
if( violations.empty() )
{
BOOST_CHECK_EQUAL( 1, 1 ); // quiet "did not check any assertions" warning
BOOST_TEST_MESSAGE( wxString::Format( "Zone fill regression: %s passed", relPath ) );
}
else
{
std::map<KIID, EDA_ITEM*> itemMap;
m_board->FillItemMap( itemMap );
for( const DRC_ITEM& item : violations )
{
BOOST_TEST_MESSAGE( item.ShowReport( EDA_UNITS::INCHES, RPT_SEVERITY_ERROR,
itemMap ) );
}
BOOST_ERROR( wxString::Format( "Zone fill regression: %s failed", relPath ) );
}
}
}